@antv/dumi-theme-antv 0.3.17 → 0.3.19-beta.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/dist/builtins/Playground/index.d.ts +1 -1
- package/dist/context.d.ts +1 -1
- package/dist/layouts/entry/API.d.ts +1 -1
- package/dist/layouts/entry/Manual.d.ts +1 -1
- package/dist/locales/en.json +2 -1
- package/dist/locales/zh.json +2 -1
- package/dist/slots/Banner/index.d.ts +1 -1
- package/dist/slots/CodeEditor/Toolbar.d.ts +1 -1
- package/dist/slots/CodeEditor/Toolbar.js +3 -3
- package/dist/slots/CodeEditor/index.d.ts +1 -1
- package/dist/slots/CodePreview/CodeHeader.d.ts +1 -1
- package/dist/slots/CodePreview/index.d.ts +1 -1
- package/dist/slots/CodeRunner/index.d.ts +1 -1
- package/dist/slots/Companies/index.d.ts +1 -1
- package/dist/slots/ContentTable/index.d.ts +1 -1
- package/dist/slots/Detail/index.d.ts +2 -2
- package/dist/slots/Header/Navs.d.ts +3 -3
- package/dist/slots/Header/Navs.js +3 -1
- package/dist/slots/Header/Products/Product.js +3 -5
- package/dist/slots/Header/Products/getProducts.d.ts +2 -2
- package/dist/slots/Header/Search/SearchResult.d.ts +2 -2
- package/dist/slots/Header/Search/SearchResult.js +13 -2
- package/dist/slots/Header/Search/SearchResult.module.less +10 -0
- package/dist/slots/Header/Search/index.js +8 -3
- package/dist/slots/Header/index.d.ts +1 -1
- package/dist/slots/ManualContent/Preview.d.ts +1 -1
- package/dist/slots/ManualContent/index.d.ts +1 -1
- package/dist/slots/ManualContent/index.js +6 -4
- package/dist/slots/ManualContent/usePreview.d.ts +1 -1
- package/dist/slots/ManualContent/usePreview.js +7 -2
- package/dist/types.d.ts +2 -2
- package/package.json +34 -32
package/dist/context.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ExampleTopic } from './types';
|
|
3
|
-
export
|
|
3
|
+
export type IThemeAntVContext = {
|
|
4
4
|
exampleTopics?: ExampleTopic[];
|
|
5
5
|
};
|
|
6
6
|
export declare const ThemeAntVContext: import("react").Context<IThemeAntVContext>;
|
package/dist/locales/en.json
CHANGED
package/dist/locales/zh.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { NotificationProps } from './Notification';
|
|
3
3
|
import 'video-react/dist/video-react.css';
|
|
4
|
-
|
|
4
|
+
type BannerButtonShape = 'round' | 'square';
|
|
5
5
|
interface BannerButton {
|
|
6
6
|
text: string;
|
|
7
7
|
link: string;
|
|
@@ -20,12 +20,12 @@ import { ping } from "../utils";
|
|
|
20
20
|
import { extractImportDeps, getCodeSandboxConfig, getRiddleConfig, getStackblitzConfig } from "./utils";
|
|
21
21
|
import styles from "./Toolbar.module.less";
|
|
22
22
|
var Paragraph = Typography.Paragraph;
|
|
23
|
-
export var EDITOR_TABS
|
|
24
|
-
(function (EDITOR_TABS) {
|
|
23
|
+
export var EDITOR_TABS = /*#__PURE__*/function (EDITOR_TABS) {
|
|
25
24
|
EDITOR_TABS["JAVASCRIPT"] = "JavaScript";
|
|
26
25
|
EDITOR_TABS["SPEC"] = "Spec";
|
|
27
26
|
EDITOR_TABS["DATA"] = "Data";
|
|
28
|
-
|
|
27
|
+
return EDITOR_TABS;
|
|
28
|
+
}({});
|
|
29
29
|
export var Toolbar = function Toolbar(_ref) {
|
|
30
30
|
var sourceCode = _ref.sourceCode,
|
|
31
31
|
fileExtension = _ref.fileExtension,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IC } from '../../types';
|
|
3
3
|
import { NewsProps } from './News';
|
|
4
|
-
|
|
4
|
+
type DetailButtonProps = {
|
|
5
5
|
text: IC;
|
|
6
6
|
link: string;
|
|
7
7
|
style?: React.CSSProperties;
|
|
8
8
|
type?: string;
|
|
9
9
|
shape?: 'round' | 'square';
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
type DetailProps = {
|
|
12
12
|
className?: string;
|
|
13
13
|
style?: React.CSSProperties;
|
|
14
14
|
title: IC;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
type dropdownItem = {
|
|
3
3
|
name: {
|
|
4
4
|
[key: string]: string;
|
|
5
5
|
};
|
|
6
6
|
url: string;
|
|
7
7
|
target?: '_blank';
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type INav = {
|
|
10
10
|
slug?: string;
|
|
11
11
|
order: number;
|
|
12
12
|
title: {
|
|
@@ -16,7 +16,7 @@ export declare type INav = {
|
|
|
16
16
|
notPage?: boolean;
|
|
17
17
|
dropdownItems?: dropdownItem[];
|
|
18
18
|
};
|
|
19
|
-
export
|
|
19
|
+
export type NavProps = {
|
|
20
20
|
navs: INav[];
|
|
21
21
|
path: string;
|
|
22
22
|
};
|
|
@@ -23,10 +23,12 @@ export var Navs = function Navs(_ref) {
|
|
|
23
23
|
var className = '';
|
|
24
24
|
if (nav.slug) {
|
|
25
25
|
href = nav.slug.startsWith('http') ? nav.slug : "/".concat(nav.slug);
|
|
26
|
+
|
|
27
|
+
// 去除 docs 防止新页面 404 和 本页重新刷新。
|
|
28
|
+
href = href.replace(/^\/docs(?=\/)/, '');
|
|
26
29
|
if (locale.id == 'en' && !href.startsWith('http')) {
|
|
27
30
|
href = "/en".concat(href);
|
|
28
31
|
}
|
|
29
|
-
// 去除 docs 防止二次点击相同 nav 跳转出现04
|
|
30
32
|
className = cx('header-menu-item-active', _defineProperty({}, styles.activeItem, getNavCategory(path) === getNavCategory(href)));
|
|
31
33
|
}
|
|
32
34
|
return size(nav.dropdownItems) ? /*#__PURE__*/React.createElement("li", {
|
|
@@ -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
|
})))));
|
|
@@ -13,13 +13,13 @@ export interface ProductItem {
|
|
|
13
13
|
openExternal?: boolean;
|
|
14
14
|
}>;
|
|
15
15
|
}
|
|
16
|
-
export
|
|
16
|
+
export type ValuesOf<T extends any[]> = T[number];
|
|
17
17
|
declare const CATEGORY_TYPE: ["basic", "extension", "mobile", "ecology"];
|
|
18
18
|
export declare const CATEGORIES: Array<{
|
|
19
19
|
type: typeof CATEGORY_TYPE[number];
|
|
20
20
|
name: string;
|
|
21
21
|
}>;
|
|
22
|
-
export
|
|
22
|
+
export type ProductType = {
|
|
23
23
|
links: {
|
|
24
24
|
/** 产品首页 */
|
|
25
25
|
readonly home?: {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useIntl } from 'dumi';
|
|
3
|
+
import { InboxOutlined } from '@ant-design/icons';
|
|
2
4
|
import styles from "./SearchResult.module.less";
|
|
3
5
|
var getHighlightInfo = function getHighlightInfo(textSegments) {
|
|
4
6
|
return /*#__PURE__*/React.createElement(React.Fragment, null, textSegments.map(function (segment) {
|
|
@@ -14,9 +16,10 @@ var getHighlightInfo = function getHighlightInfo(textSegments) {
|
|
|
14
16
|
*/
|
|
15
17
|
export var SearchResult = function SearchResult(_ref) {
|
|
16
18
|
var results = _ref.results;
|
|
19
|
+
var intl = useIntl();
|
|
17
20
|
return /*#__PURE__*/React.createElement("div", {
|
|
18
21
|
className: styles.searchResult
|
|
19
|
-
}, results.map(function (r) {
|
|
22
|
+
}, results !== null && results !== void 0 && results.length ? results.map(function (r) {
|
|
20
23
|
return /*#__PURE__*/React.createElement("div", {
|
|
21
24
|
className: styles.item
|
|
22
25
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -31,5 +34,13 @@ export var SearchResult = function SearchResult(_ref) {
|
|
|
31
34
|
}, getHighlightInfo(r.tilte)), /*#__PURE__*/React.createElement("div", {
|
|
32
35
|
className: styles.description
|
|
33
36
|
}, getHighlightInfo(r.description))));
|
|
34
|
-
})
|
|
37
|
+
}) : /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
className: styles.empty
|
|
39
|
+
}, /*#__PURE__*/React.createElement(InboxOutlined, {
|
|
40
|
+
style: {
|
|
41
|
+
fontSize: 20
|
|
42
|
+
}
|
|
43
|
+
}), /*#__PURE__*/React.createElement("div", null, intl.formatMessage({
|
|
44
|
+
id: '没有找到查询结果'
|
|
45
|
+
}))));
|
|
35
46
|
};
|
|
@@ -17,13 +17,18 @@ export var Search = function Search() {
|
|
|
17
17
|
_useState2 = _slicedToArray(_useState, 2),
|
|
18
18
|
open = _useState2[0],
|
|
19
19
|
setOpen = _useState2[1];
|
|
20
|
+
// useSiteSearch 错误 keywords 为空时 loading 为 true
|
|
20
21
|
var _useSiteSearch = useSiteSearch(),
|
|
21
22
|
keywords = _useSiteSearch.keywords,
|
|
22
23
|
setKeywords = _useSiteSearch.setKeywords,
|
|
23
|
-
result = _useSiteSearch.result
|
|
24
|
+
result = _useSiteSearch.result,
|
|
25
|
+
loading = _useSiteSearch.loading;
|
|
24
26
|
useEffect(function () {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
// keywords 为空 或 loading 为 false 查找结束, 进行开关
|
|
28
|
+
if (!keywords || !loading) {
|
|
29
|
+
setOpen(!!keywords);
|
|
30
|
+
}
|
|
31
|
+
}, [keywords, loading]);
|
|
27
32
|
useEffect(function () {
|
|
28
33
|
var close = function close(e) {
|
|
29
34
|
var _e$target;
|
|
@@ -79,7 +79,9 @@ 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
|
|
82
|
+
var hasPrefix = hrefId.startsWith('/en') || href.startsWith('/zh');
|
|
83
|
+
var splitCount = hasPrefix ? 3 : 2;
|
|
84
|
+
var id = href.split('/').splice(0, splitCount).join('/');
|
|
83
85
|
if (href.includes(baseRoute)) {
|
|
84
86
|
if (id === hrefId) {
|
|
85
87
|
list.push(_objectSpread(_objectSpread({}, item), {}, {
|
|
@@ -188,13 +190,13 @@ export var ManualContent = function ManualContent(_ref) {
|
|
|
188
190
|
if (window.location.pathname == indexRoute) {
|
|
189
191
|
setDefaultOpenKeys(getOpenKeys());
|
|
190
192
|
}
|
|
191
|
-
setDefaultSelectedKey(
|
|
193
|
+
setDefaultSelectedKey(window.location.pathname);
|
|
192
194
|
}, [window.location.pathname]);
|
|
193
195
|
useEffect(function () {
|
|
194
196
|
// 监听选中的menu-item 拿到 prev and next
|
|
195
197
|
getPreAndNext();
|
|
196
198
|
}, [defaultSelectedKey]);
|
|
197
|
-
usePreview();
|
|
199
|
+
usePreview({}, defaultSelectedKey);
|
|
198
200
|
function getPreAndNext() {
|
|
199
201
|
var menuNodes = document.querySelectorAll('aside .ant-menu-item');
|
|
200
202
|
var currentMenuNode = document.querySelector('aside .ant-menu-item-selected');
|
|
@@ -228,7 +230,7 @@ export var ManualContent = function ManualContent(_ref) {
|
|
|
228
230
|
onOpenChange: function onOpenChange(openKeys) {
|
|
229
231
|
setDefaultOpenKeys(openKeys);
|
|
230
232
|
},
|
|
231
|
-
selectedKeys: defaultSelectedKey,
|
|
233
|
+
selectedKeys: [defaultSelectedKey],
|
|
232
234
|
openKeys: defaultOpenKeys,
|
|
233
235
|
mode: "inline",
|
|
234
236
|
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/dist/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export interface IThemeConfig {
|
|
2
2
|
[key: string]: any;
|
|
3
3
|
}
|
|
4
|
-
export
|
|
4
|
+
export type Status = 'responded' | 'error' | 'timeout';
|
|
5
5
|
/**
|
|
6
6
|
* 配置文件中的国际化配置
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type IC = string | {
|
|
9
9
|
zh: string;
|
|
10
10
|
en: string;
|
|
11
11
|
};
|
package/package.json
CHANGED
|
@@ -1,31 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/dumi-theme-antv",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.19-beta.1",
|
|
4
4
|
"description": "AntV website theme based on dumi2.",
|
|
5
|
-
"types": "dist/types.d.ts",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "father dev",
|
|
8
|
-
"dev:example-site": "cd example && npm run start",
|
|
9
|
-
"build": "father build",
|
|
10
|
-
"prepare": "father link-dev-theme",
|
|
11
|
-
"lint": "npm run lint:es && npm run lint:css",
|
|
12
|
-
"lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
|
|
13
|
-
"lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
|
|
14
|
-
"prepublishOnly": "npm run build"
|
|
15
|
-
},
|
|
16
5
|
"keywords": [
|
|
17
6
|
"dumi",
|
|
18
7
|
"dumi-theme",
|
|
19
8
|
"dumi-theme-antv"
|
|
20
9
|
],
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
"antv"
|
|
24
|
-
|
|
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
|
+
},
|
|
25
18
|
"license": "MIT",
|
|
19
|
+
"types": "dist/types.d.ts",
|
|
26
20
|
"files": [
|
|
27
21
|
"dist"
|
|
28
22
|
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "father build",
|
|
25
|
+
"dev": "father dev",
|
|
26
|
+
"dev:example-site": "cd example && npm run start",
|
|
27
|
+
"lint": "npm run lint:es && npm run lint:css",
|
|
28
|
+
"lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
|
|
29
|
+
"lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
|
|
30
|
+
"prepare": "father link-dev-theme",
|
|
31
|
+
"prepublishOnly": "npm run build"
|
|
32
|
+
},
|
|
29
33
|
"commitlint": {
|
|
30
34
|
"extends": [
|
|
31
35
|
"@commitlint/config-conventional"
|
|
@@ -48,9 +52,6 @@
|
|
|
48
52
|
"prettier --parser=typescript --write"
|
|
49
53
|
]
|
|
50
54
|
},
|
|
51
|
-
"publishConfig": {
|
|
52
|
-
"access": "public"
|
|
53
|
-
},
|
|
54
55
|
"dependencies": {
|
|
55
56
|
"@ant-design/icons": "^4.7.0",
|
|
56
57
|
"@babel/plugin-syntax-unicode-sets-regex": "^7.18.6",
|
|
@@ -73,6 +74,7 @@
|
|
|
73
74
|
"lodash-es": "^4.17.21",
|
|
74
75
|
"monaco-editor": "^0.25.0",
|
|
75
76
|
"parse-github-url": "^1.0.2",
|
|
77
|
+
"prettier": "^2.7.1",
|
|
76
78
|
"rc-drawer": "^4.0.0",
|
|
77
79
|
"rc-footer": "^0.6.6",
|
|
78
80
|
"react": "^18.2.0",
|
|
@@ -91,15 +93,10 @@
|
|
|
91
93
|
"unified": "^10.1.2",
|
|
92
94
|
"unist-util-visit": "^4.1.2",
|
|
93
95
|
"uri-parse": "^1.0.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"
|
|
96
|
+
"video-react": "^0.16.0"
|
|
101
97
|
},
|
|
102
98
|
"devDependencies": {
|
|
99
|
+
"@antv/g2": "^4.2.10",
|
|
103
100
|
"@commitlint/cli": "^17.1.2",
|
|
104
101
|
"@commitlint/config-conventional": "^17.1.0",
|
|
105
102
|
"@types/classnames": "^2.3.1",
|
|
@@ -111,6 +108,7 @@
|
|
|
111
108
|
"@types/react-router-dom": "^5.3.3",
|
|
112
109
|
"@types/react-slick": "^0.23.10",
|
|
113
110
|
"@umijs/lint": "^4.0.0",
|
|
111
|
+
"d3-regression": "^1.3.10",
|
|
114
112
|
"dumi": "^2.0.0",
|
|
115
113
|
"eslint": "^8.23.0",
|
|
116
114
|
"father": "^4.1.0",
|
|
@@ -123,12 +121,16 @@
|
|
|
123
121
|
"react-dom": "^18.0.0",
|
|
124
122
|
"stylelint": "^14.9.1"
|
|
125
123
|
},
|
|
126
|
-
"
|
|
127
|
-
"
|
|
128
|
-
"
|
|
124
|
+
"peerDependencies": {
|
|
125
|
+
"dumi": "^2.0.0",
|
|
126
|
+
"react": ">=16.9.0",
|
|
127
|
+
"react-dom": ">=16.9.0"
|
|
129
128
|
},
|
|
130
|
-
"
|
|
131
|
-
"
|
|
129
|
+
"publishConfig": {
|
|
130
|
+
"access": "public"
|
|
132
131
|
},
|
|
133
|
-
"
|
|
132
|
+
"authors": [
|
|
133
|
+
"dumi",
|
|
134
|
+
"antv"
|
|
135
|
+
]
|
|
134
136
|
}
|