@antv/dumi-theme-antv 0.3.0-beta.8 → 0.3.0
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 +3 -6
- package/dist/builtins/Playground/index.js +27 -7
- package/dist/layouts/DocLayout.js +4 -5
- package/dist/layouts/entry/Index.js +21 -12
- package/dist/layouts/entry/Manual.js +6 -4
- package/dist/pages/404.js +7 -4
- package/dist/pages/Example/index.js +15 -4
- package/dist/pages/Example/utils.d.ts +1 -0
- package/dist/pages/Example/utils.js +9 -0
- package/dist/pages/Examples/components/ExampleTopicMenu/components/LeftMenu/index.js +2 -1
- package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.js +10 -5
- package/dist/pages/Examples/components/GalleryPageContent/index.js +2 -1
- package/dist/pages/Examples/index.js +13 -4
- package/dist/pages/Examples/index.module.less +13 -0
- package/dist/pages/Examples/utils.d.ts +1 -0
- package/dist/pages/Examples/utils.js +3 -0
- package/dist/plugin/index.js +11 -0
- package/dist/slots/Article/index.d.ts +3 -0
- package/dist/slots/Article/index.js +11 -0
- package/dist/slots/Article/index.module.less +8 -0
- package/dist/slots/Banner/Notification.d.ts +10 -0
- package/dist/slots/Banner/Notification.js +43 -0
- package/dist/slots/Banner/Notification.module.less +120 -0
- package/dist/slots/Banner/index.d.ts +26 -0
- package/dist/slots/Banner/index.js +184 -0
- package/dist/slots/Banner/index.module.less +449 -0
- package/dist/slots/Cases/index.d.ts +1 -1
- package/dist/slots/Cases/index.js +13 -7
- package/dist/slots/Cases/index.module.less +2 -1
- package/dist/slots/CodeEditor/Toolbar.js +13 -6
- package/dist/slots/CodeEditor/index.d.ts +4 -0
- package/dist/slots/CodeEditor/index.js +43 -21
- package/dist/slots/CodeEditor/utils.js +1 -1
- package/dist/slots/CodePreview/CodeHeader.js +15 -14
- package/dist/slots/CodePreview/index.d.ts +8 -0
- package/dist/slots/CodePreview/index.js +15 -6
- package/dist/slots/CodePreview/index.module.less +11 -2
- package/dist/slots/CodeRunner/index.d.ts +2 -0
- package/dist/slots/CodeRunner/index.js +13 -5
- package/dist/slots/Companies/index.d.ts +1 -1
- package/dist/slots/{TOC.d.ts → ContentTable/index.d.ts} +2 -1
- package/dist/slots/{TOC.js → ContentTable/index.js} +2 -1
- package/dist/slots/ContentTable/index.module.less +11 -0
- package/dist/slots/Detail/News.js +3 -2
- package/dist/slots/Detail/index.js +3 -1
- package/dist/slots/ExampleSider/index.js +21 -20
- package/dist/slots/Features/index.js +5 -2
- package/dist/slots/Features/index.module.less +3 -3
- package/dist/slots/Footer/index.js +34 -14
- package/dist/slots/Header/LogoWhite.js +1 -2
- package/dist/slots/Header/Navs.d.ts +10 -1
- package/dist/slots/Header/Navs.js +36 -25
- package/dist/slots/Header/Products/NavigatorBanner.js +4 -3
- package/dist/slots/Header/Products/Product.js +7 -3
- package/dist/slots/Header/Products/getProducts.js +4 -2
- package/dist/slots/Header/Products/index.js +5 -3
- package/dist/slots/Header/Search.js +5 -3
- package/dist/slots/Header/index.d.ts +7 -2
- package/dist/slots/Header/index.js +128 -24
- package/dist/slots/ManualContent/NavigatorBanner.js +5 -3
- package/dist/slots/ManualContent/ReadingTime.js +6 -2
- package/dist/slots/ManualContent/index.js +36 -30
- package/dist/slots/ManualContent/index.module.less +52 -33
- package/dist/slots/ManualContent/utils.d.ts +15 -0
- package/dist/slots/ManualContent/utils.js +30 -1
- package/dist/slots/SEO.d.ts +10 -0
- package/dist/slots/SEO.js +59 -0
- package/dist/slots/_.less +1 -1
- package/dist/slots/hooks.d.ts +1 -1
- package/dist/slots/hooks.js +5 -8
- package/dist/slots/utils.js +6 -1
- package/package.json +5 -2
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useSiteData } from 'dumi';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Helmet } from 'react-helmet';
|
|
4
|
+
export var SEO = function SEO(_ref) {
|
|
5
|
+
var description = _ref.description,
|
|
6
|
+
_ref$lang = _ref.lang,
|
|
7
|
+
lang = _ref$lang === void 0 ? '' : _ref$lang,
|
|
8
|
+
_ref$meta = _ref.meta,
|
|
9
|
+
meta = _ref$meta === void 0 ? [] : _ref$meta,
|
|
10
|
+
title = _ref.title,
|
|
11
|
+
titleSuffix = _ref.titleSuffix;
|
|
12
|
+
|
|
13
|
+
var _useSiteData = useSiteData(),
|
|
14
|
+
themeConfig = _useSiteData.themeConfig;
|
|
15
|
+
|
|
16
|
+
var defaultTitle = themeConfig.title,
|
|
17
|
+
defaultDescription = themeConfig.defaultDescription;
|
|
18
|
+
var metaDescription = description || defaultDescription;
|
|
19
|
+
return /*#__PURE__*/React.createElement(Helmet, {
|
|
20
|
+
htmlAttributes: {
|
|
21
|
+
lang: lang
|
|
22
|
+
},
|
|
23
|
+
title: title,
|
|
24
|
+
titleTemplate: "%s | ".concat(titleSuffix || defaultTitle),
|
|
25
|
+
meta: [{
|
|
26
|
+
name: "description",
|
|
27
|
+
content: metaDescription
|
|
28
|
+
}, {
|
|
29
|
+
property: "og:title",
|
|
30
|
+
content: title
|
|
31
|
+
}, {
|
|
32
|
+
property: "og:description",
|
|
33
|
+
content: metaDescription
|
|
34
|
+
}, {
|
|
35
|
+
property: "og:image",
|
|
36
|
+
content: 'https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png'
|
|
37
|
+
}, {
|
|
38
|
+
property: "og:type",
|
|
39
|
+
content: "website"
|
|
40
|
+
}, {
|
|
41
|
+
name: "twitter:card",
|
|
42
|
+
content: "summary"
|
|
43
|
+
}, {
|
|
44
|
+
name: "twitter:title",
|
|
45
|
+
content: title
|
|
46
|
+
}, {
|
|
47
|
+
name: "twitter:description",
|
|
48
|
+
content: metaDescription
|
|
49
|
+
}, {
|
|
50
|
+
property: "twitter:image",
|
|
51
|
+
content: 'https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png'
|
|
52
|
+
}].concat(meta)
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
SEO.defaultProps = {
|
|
56
|
+
lang: "zh",
|
|
57
|
+
meta: [],
|
|
58
|
+
description: ""
|
|
59
|
+
};
|
package/dist/slots/_.less
CHANGED
package/dist/slots/hooks.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { NavigatorBannerProps } from './ManualContent/NavigatorBanner';
|
|
2
2
|
export declare const useChinaMirrorHost: () => [boolean];
|
|
3
3
|
export declare const useScrollToTop: () => void;
|
|
4
|
-
export declare const useT: (transformedMessage: string) => string;
|
|
5
4
|
export declare const useLogoLink: ({ link, siteUrl, lang, }: {
|
|
6
5
|
link?: string;
|
|
7
6
|
siteUrl?: string;
|
|
@@ -14,3 +13,4 @@ export declare const usePrevAndNext: () => NavigatorBannerProps['post'][];
|
|
|
14
13
|
* @param v
|
|
15
14
|
*/
|
|
16
15
|
export declare function ic(v: string | object): any;
|
|
16
|
+
export declare function icWithLocale(v: string | object, locale: any): any;
|
package/dist/slots/hooks.js
CHANGED
|
@@ -14,7 +14,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
14
14
|
|
|
15
15
|
import { useEffect, useState } from 'react';
|
|
16
16
|
import { get } from 'lodash-es';
|
|
17
|
-
import {
|
|
17
|
+
import { useLocale } from 'dumi';
|
|
18
18
|
export var useChinaMirrorHost = function useChinaMirrorHost() {
|
|
19
19
|
var _useState = useState(false),
|
|
20
20
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -31,12 +31,6 @@ export var useChinaMirrorHost = function useChinaMirrorHost() {
|
|
|
31
31
|
export var useScrollToTop = function useScrollToTop() {
|
|
32
32
|
document.body.scrollTop = document.documentElement.scrollTop = 0;
|
|
33
33
|
};
|
|
34
|
-
export var useT = function useT(transformedMessage) {
|
|
35
|
-
var intl = useIntl();
|
|
36
|
-
return intl.formatMessage({
|
|
37
|
-
id: transformedMessage
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
34
|
export var useLogoLink = function useLogoLink(_ref) {
|
|
41
35
|
var _ref$link = _ref.link,
|
|
42
36
|
link = _ref$link === void 0 ? '' : _ref$link,
|
|
@@ -100,5 +94,8 @@ export var usePrevAndNext = function usePrevAndNext() {
|
|
|
100
94
|
|
|
101
95
|
export function ic(v) {
|
|
102
96
|
var locale = useLocale();
|
|
103
|
-
return
|
|
97
|
+
return icWithLocale(v, locale.id);
|
|
98
|
+
}
|
|
99
|
+
export function icWithLocale(v, locale) {
|
|
100
|
+
return _typeof(v) === 'object' ? get(v, [locale]) : v;
|
|
104
101
|
}
|
package/dist/slots/utils.js
CHANGED
|
@@ -18,6 +18,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
18
18
|
|
|
19
19
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
20
20
|
|
|
21
|
+
import { icWithLocale } from "./hooks";
|
|
21
22
|
export function ping() {
|
|
22
23
|
return _ping.apply(this, arguments);
|
|
23
24
|
}
|
|
@@ -102,7 +103,11 @@ export var filterTreeNode = function filterTreeNode(treeNode, keyValue, locale)
|
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
105
|
|
|
105
|
-
var
|
|
106
|
+
var title = icWithLocale(treeNode.title, locale) || '';
|
|
107
|
+
var matchFields = [title, treeNode.id, treeNode.filename];
|
|
108
|
+
var isCurrentTreeNodeMatched = matchFields.some(function (f) {
|
|
109
|
+
return (f ? f.toLowerCase() : '').includes(keyValue ? keyValue.toLowerCase() : '');
|
|
110
|
+
}); // 当前节点自身匹配,那么其孩子直接匹配,可以直接返回当前节点
|
|
106
111
|
|
|
107
112
|
if (isCurrentTreeNodeMatched) {
|
|
108
113
|
return treeNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/dumi-theme-antv",
|
|
3
|
-
"version": "0.3.0
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "AntV website theme based on dumi2.",
|
|
5
5
|
"types": "dist/types.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -75,7 +75,9 @@
|
|
|
75
75
|
"rc-footer": "^0.6.6",
|
|
76
76
|
"react": "^18.2.0",
|
|
77
77
|
"react-dom": "^18.2.0",
|
|
78
|
+
"react-error-boundary": "^3.1.4",
|
|
78
79
|
"react-github-button": "^0.1.11",
|
|
80
|
+
"react-helmet": "^6.1.0",
|
|
79
81
|
"react-router-dom": "^6.4.2",
|
|
80
82
|
"react-slick": "^0.29.0",
|
|
81
83
|
"react-split-pane": "^0.1.92",
|
|
@@ -83,7 +85,8 @@
|
|
|
83
85
|
"reading-time": "^1.5.0",
|
|
84
86
|
"size-sensor": "^1.0.1",
|
|
85
87
|
"slick-carousel": "^1.8.1",
|
|
86
|
-
"uri-parse": "^1.0.0"
|
|
88
|
+
"uri-parse": "^1.0.0",
|
|
89
|
+
"video-react": "^0.16.0"
|
|
87
90
|
},
|
|
88
91
|
"peerDependencies": {
|
|
89
92
|
"dumi": "^2.0.0-beta.15",
|