@antv/dumi-theme-antv 0.7.9 → 0.8.0-beta.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.js +1 -1
- package/dist/common/styles/Common.js +1 -1
- package/dist/common/styles/theme.js +1 -1
- package/dist/components/AI/HomeDialog/AntVBanner/index.js +4 -0
- package/dist/components/AI/HomeDialog/AntVBanner/index.module.less +35 -0
- package/dist/components/AI/HomeDialog/ModeSelector/index.js +29 -0
- package/dist/components/AI/HomeDialog/ModeSelector/index.module.less +272 -0
- package/dist/components/AI/HomeDialog/PromptTextarea/ChooseLib/index.js +51 -0
- package/dist/components/AI/HomeDialog/PromptTextarea/ChooseLib/index.module.less +5 -0
- package/dist/components/AI/HomeDialog/PromptTextarea/DatasourceCard/index.js +25 -0
- package/dist/components/AI/HomeDialog/PromptTextarea/DatasourceCard/index.module.less +42 -0
- package/dist/components/AI/HomeDialog/PromptTextarea/SendButton.js +23 -0
- package/dist/components/AI/HomeDialog/PromptTextarea/SendButton.module.less +9 -0
- package/dist/components/AI/HomeDialog/PromptTextarea/index.js +132 -0
- package/dist/components/AI/HomeDialog/PromptTextarea/index.module.less +127 -0
- package/dist/components/AI/HomeDialog/RecommendCase/Card.js +70 -0
- package/dist/components/AI/HomeDialog/RecommendCase/card.module.less +131 -0
- package/dist/components/AI/HomeDialog/RecommendCase/index.js +76 -0
- package/dist/components/AI/HomeDialog/RecommendCase/index.module.less +43 -0
- package/dist/components/AI/HomeDialog/RecommendCase/recommend.json +42 -0
- package/dist/components/AI/HomeDialog/index.js +65 -0
- package/dist/components/AI/HomeDialog/index.module.less +3 -0
- package/dist/components/AI/constant.js +35 -0
- package/dist/components/AI/index.js +1 -0
- package/dist/components/AI/types.js +1 -0
- package/dist/components/AI/utils.js +38 -0
- package/dist/hooks/useProducts.js +18 -0
- package/dist/hooks/useStreamingText.js +119 -0
- package/dist/hooks/useVisionsnapSdk.js +159 -0
- package/dist/layouts/DocLayout.js +0 -1
- package/dist/layouts/GlobalLayout/index.js +15 -0
- package/dist/model/AIChat.js +214 -0
- package/dist/pages/AIPlayground/components/ConversationsMenu/index.js +146 -0
- package/dist/pages/AIPlayground/components/ConversationsMenu/index.module.less +44 -0
- package/dist/pages/AIPlayground/components/MarkdownComponent/MarkdownCodeBlock.js +65 -0
- package/dist/pages/AIPlayground/components/MarkdownComponent/index.js +47 -0
- package/dist/pages/AIPlayground/components/MsgBox/index.js +187 -0
- package/dist/pages/AIPlayground/components/MsgBox/index.module.less +42 -0
- package/dist/pages/AIPlayground/components/SessionLayout/index.js +25 -0
- package/dist/pages/AIPlayground/components/SessionLayout/index.module.less +34 -0
- package/dist/pages/AIPlayground/components/TaskBox/generateCode.js +110 -0
- package/dist/pages/AIPlayground/components/TaskBox/index.js +60 -0
- package/dist/pages/AIPlayground/components/TaskBox/index.module.less +8 -0
- package/dist/pages/AIPlayground/demo.js +34 -0
- package/dist/pages/AIPlayground/index.js +9 -0
- package/dist/pages/AIPlayground/index.module.less +0 -0
- package/dist/pages/Examples/index.module.less +2 -2
- package/dist/pages/Index/components/Cases/index.module.less +1 -1
- package/dist/pages/Index/components/Companies/index.module.less +1 -1
- package/dist/pages/Index/components/Features/index.module.less +1 -1
- package/dist/pages/Index/index.js +1 -1
- package/dist/plugin/index.js +14 -6
- package/dist/slots/Banner/index.module.less +1 -1
- package/dist/slots/CodeEditor/Toolbar.js +6 -2
- package/dist/slots/CodeEditor/Toolbar.module.less +6 -0
- package/dist/slots/CodeEditor/index.js +28 -2
- package/dist/slots/CodeEditor/index.module.less +22 -0
- package/dist/{pages/Index/components → slots}/Detail/News.js +1 -1
- package/dist/{pages/Index/components → slots}/Detail/index.js +11 -28
- package/dist/{pages/Index/components → slots}/Detail/index.module.less +13 -7
- package/dist/slots/Footer/index.module.less +1 -1
- package/dist/slots/Header/Products/Product.module.less +1 -1
- package/dist/slots/Header/Products/getProducts.js +20 -26
- package/dist/slots/Header/Products/index.js +20 -16
- package/dist/slots/Header/Search/SearchResult.js +35 -14
- package/dist/slots/Header/Search/index.js +2 -1
- package/dist/slots/Header/index.module.less +2 -2
- package/dist/typings.d.ts +5 -0
- package/package.json +21 -2
- /package/dist/{pages/Index/components → slots}/Detail/News.module.less +0 -0
|
@@ -13,7 +13,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
13
13
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
14
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
15
|
import MonacoEditor, { loader } from '@monaco-editor/react';
|
|
16
|
-
import { Switch } from 'antd';
|
|
16
|
+
import { Drawer, Switch } from 'antd';
|
|
17
17
|
import { autoType as d3AutoType, dsvFormat } from 'd3-dsv';
|
|
18
18
|
import { useLocale, useSiteData } from 'dumi';
|
|
19
19
|
import { debounce, noop } from 'lodash-es';
|
|
@@ -25,6 +25,7 @@ import Loading from "dumi/theme/slots/Loading";
|
|
|
25
25
|
import styles from "./index.module.less";
|
|
26
26
|
import { EDITOR_TABS, Toolbar } from "./Toolbar";
|
|
27
27
|
import { compile, execute, replaceInsertCss } from "./utils";
|
|
28
|
+
import MsgBox from "../../pages/AIPlayground/components/MsgBox";
|
|
28
29
|
loader.config({
|
|
29
30
|
'vs/nls': {
|
|
30
31
|
availableLanguages: {
|
|
@@ -100,6 +101,10 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
100
101
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
101
102
|
currentEditorTab = _useState12[0],
|
|
102
103
|
setCurrentEditorTab = _useState12[1];
|
|
104
|
+
var _useState13 = useState(false),
|
|
105
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
106
|
+
showAI = _useState14[0],
|
|
107
|
+
setShowAI = _useState14[1];
|
|
103
108
|
var containerId = "playgroundScriptContainer_".concat(exampleId);
|
|
104
109
|
|
|
105
110
|
// 出发 auto resize
|
|
@@ -377,6 +382,9 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
377
382
|
return null;
|
|
378
383
|
}
|
|
379
384
|
};
|
|
385
|
+
var onClickAI = function onClickAI() {
|
|
386
|
+
setShowAI(true);
|
|
387
|
+
};
|
|
380
388
|
return /*#__PURE__*/React.createElement("div", {
|
|
381
389
|
className: styles.editor
|
|
382
390
|
}, /*#__PURE__*/React.createElement(Toolbar, {
|
|
@@ -393,6 +401,7 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
393
401
|
},
|
|
394
402
|
onEditorTabChange: onTabChange,
|
|
395
403
|
onToggleFullscreen: onFullscreen,
|
|
404
|
+
onClickAI: onClickAI,
|
|
396
405
|
slots: {
|
|
397
406
|
Spec: /*#__PURE__*/React.createElement("span", {
|
|
398
407
|
style: {
|
|
@@ -444,7 +453,24 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
444
453
|
onMount: function onMount(editor) {
|
|
445
454
|
monacoRef.current = editor;
|
|
446
455
|
}
|
|
447
|
-
})
|
|
456
|
+
}), /*#__PURE__*/React.createElement(Drawer, {
|
|
457
|
+
placement: "right",
|
|
458
|
+
closable: true,
|
|
459
|
+
open: showAI,
|
|
460
|
+
getContainer: false,
|
|
461
|
+
onClose: function onClose() {
|
|
462
|
+
return setShowAI(false);
|
|
463
|
+
},
|
|
464
|
+
rootClassName: styles.drawer
|
|
465
|
+
}, /*#__PURE__*/React.createElement(MsgBox, {
|
|
466
|
+
simple: true,
|
|
467
|
+
messages: [{
|
|
468
|
+
id: crypto.randomUUID(),
|
|
469
|
+
role: 'assistant',
|
|
470
|
+
content: "\u6211\u662FAntV AI\u52A9\u624B\u3002\u60A8\u53EF\u4EE5\u968F\u65F6\u5411\u6211\u63D0\u95EE\uFF0C\u8BA9\u6211\u4E3A\u60A8\uFF1A\n \n1\u3001\u89E3\u8BFB\u5F53\u524D\u56FE\u8868\u7684\u4EE3\u7801\u914D\u7F6E\u3002\n \n2\u3001\u901A\u8FC7\u81EA\u7136\u8BED\u8A00\u5BF9\u8BDD\uFF0C\u57FA\u4E8E\u5F53\u524D\u6848\u4F8B\u751F\u6210\u65B0\u4EE3\u7801\u4EE5\u5B9A\u5236\u56FE\u8868\u3002",
|
|
471
|
+
createdAt: Date.now()
|
|
472
|
+
}]
|
|
473
|
+
})));
|
|
448
474
|
}));
|
|
449
475
|
};
|
|
450
476
|
export default CodeEditor;
|
|
@@ -9,3 +9,25 @@
|
|
|
9
9
|
width: 100%;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
+
|
|
13
|
+
.drawer{
|
|
14
|
+
margin-top: 36px;
|
|
15
|
+
:global {
|
|
16
|
+
.ant-drawer-content {
|
|
17
|
+
background: #f8f9fc;
|
|
18
|
+
div.ant-drawer-header {
|
|
19
|
+
padding-bottom: unset;
|
|
20
|
+
border-bottom: unset;
|
|
21
|
+
flex-direction: row-reverse;
|
|
22
|
+
|
|
23
|
+
.ant-drawer-header-title {
|
|
24
|
+
flex: unset;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
.ant-drawer-body{
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Link, useLocale } from 'dumi';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { ic } from "
|
|
3
|
+
import { ic } from "../hooks";
|
|
4
4
|
import styles from "./News.module.less";
|
|
5
5
|
var numberImages = ['https://gw.alipayobjects.com/zos/antfincdn/IqREAm36K7/1.png', 'https://gw.alipayobjects.com/zos/antfincdn/3fG1Iqjfnz/2.png'];
|
|
6
6
|
export var News = function News(_ref) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
var _excluded = ["className", "style", "title", "engine", "description", "image", "imageStyle", "githubUrl", "showGithubStars", "buttons", "news"];
|
|
3
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
8
7
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
9
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
10
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
11
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -20,8 +20,9 @@ import gh from 'parse-github-url';
|
|
|
20
20
|
import React, { useEffect, useState } from 'react';
|
|
21
21
|
import GitHubButton from 'react-github-button';
|
|
22
22
|
import { News } from "./News";
|
|
23
|
-
import { ic } from "
|
|
23
|
+
import { ic } from "../hooks";
|
|
24
24
|
import styles from "./index.module.less";
|
|
25
|
+
import { HomeDialog } from "../../components/AI/HomeDialog";
|
|
25
26
|
/**
|
|
26
27
|
* Index.技术栈的描述区域!
|
|
27
28
|
* 各自配置
|
|
@@ -67,37 +68,15 @@ export var Detail = function Detail(_ref) {
|
|
|
67
68
|
className: styles.content
|
|
68
69
|
}, /*#__PURE__*/React.createElement("div", {
|
|
69
70
|
className: styles.text
|
|
71
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
72
|
+
className: styles.titleButtons
|
|
70
73
|
}, /*#__PURE__*/React.createElement("div", {
|
|
71
74
|
className: cx(styles.title, 'detail-title')
|
|
72
75
|
}, /*#__PURE__*/React.createElement("span", {
|
|
73
76
|
className: cx(styles.engine, 'detail-engine')
|
|
74
77
|
}, engineText), ic(title).replace(engineText, '')), /*#__PURE__*/React.createElement("div", {
|
|
75
|
-
className: cx(styles.description, 'detail-description')
|
|
76
|
-
}, ic(description)), /*#__PURE__*/React.createElement("div", {
|
|
77
78
|
className: cx(styles.buttons, 'detail-buttons')
|
|
78
|
-
},
|
|
79
|
-
var type = _ref2.type,
|
|
80
|
-
style = _ref2.style,
|
|
81
|
-
text = _ref2.text,
|
|
82
|
-
link = _ref2.link,
|
|
83
|
-
shape = _ref2.shape,
|
|
84
|
-
icon = _ref2.icon;
|
|
85
|
-
return /*#__PURE__*/React.createElement("a", {
|
|
86
|
-
key: ic(text),
|
|
87
|
-
className: cx(styles.buttonLink, styles[type || ''], type === 'primary' ? 'primary-button' : 'common-button'),
|
|
88
|
-
style: _objectSpread({
|
|
89
|
-
borderRadius: shape === 'round' ? '1000px' : '12px'
|
|
90
|
-
}, style),
|
|
91
|
-
href: link[lang] ? link[lang] : link
|
|
92
|
-
}, icon !== null && /*#__PURE__*/React.createElement("div", {
|
|
93
|
-
className: styles.icon,
|
|
94
|
-
style: icon ? {
|
|
95
|
-
backgroundImage: "url(".concat(icon, ")")
|
|
96
|
-
} : {}
|
|
97
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
98
|
-
className: styles.button
|
|
99
|
-
}, ic(text)));
|
|
100
|
-
}), showGitHubStarsButton && /*#__PURE__*/React.createElement("div", {
|
|
79
|
+
}, showGitHubStarsButton && /*#__PURE__*/React.createElement("div", {
|
|
101
80
|
key: "github",
|
|
102
81
|
className: styles.githubWrapper
|
|
103
82
|
}, /*#__PURE__*/React.createElement(GitHubButton, {
|
|
@@ -105,7 +84,11 @@ export var Detail = function Detail(_ref) {
|
|
|
105
84
|
size: "large",
|
|
106
85
|
namespace: githubObj.owner,
|
|
107
86
|
repo: githubObj.name
|
|
108
|
-
})))), /*#__PURE__*/React.createElement(
|
|
87
|
+
}))))), /*#__PURE__*/React.createElement(HomeDialog, {
|
|
88
|
+
style: {
|
|
89
|
+
margin: "140px auto"
|
|
90
|
+
}
|
|
91
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
109
92
|
className: cx(styles.news, 'news')
|
|
110
93
|
}, (news || remoteNews).slice(0, 3).map(function (n, i) {
|
|
111
94
|
return /*#__PURE__*/React.createElement(News, _extends({
|
|
@@ -1,25 +1,31 @@
|
|
|
1
|
-
@import '
|
|
1
|
+
@import '../../common/styles/variables.less';
|
|
2
2
|
|
|
3
3
|
.wrapper {
|
|
4
|
-
min-height:
|
|
5
|
-
max-height:
|
|
4
|
+
min-height: 1000px;
|
|
5
|
+
max-height: 1150px;
|
|
6
6
|
background: linear-gradient(225deg, #ffffff, #f0f5ff);
|
|
7
7
|
height: calc(94vh);
|
|
8
8
|
position: relative;
|
|
9
9
|
overflow: hidden;
|
|
10
10
|
|
|
11
11
|
.content {
|
|
12
|
-
.container1440;
|
|
12
|
+
.container1440();
|
|
13
13
|
height: 100%;
|
|
14
14
|
position: relative;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
.text {
|
|
18
18
|
position: relative;
|
|
19
|
-
top:
|
|
19
|
+
top: 12%;
|
|
20
20
|
z-index: 1;
|
|
21
21
|
margin-left: 4.5%;
|
|
22
22
|
|
|
23
|
+
.titleButtons{
|
|
24
|
+
display: flex;
|
|
25
|
+
gap: 50px;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
}
|
|
28
|
+
|
|
23
29
|
.title {
|
|
24
30
|
font-size: 3.4em; //2.875em;
|
|
25
31
|
color: rgba(0, 0, 0, 1);
|
|
@@ -52,7 +58,7 @@
|
|
|
52
58
|
|
|
53
59
|
.buttons {
|
|
54
60
|
display: flex;
|
|
55
|
-
margin-top:
|
|
61
|
+
margin-top: 10px;
|
|
56
62
|
|
|
57
63
|
.buttonLink {
|
|
58
64
|
display: flex;
|
|
@@ -190,7 +196,7 @@
|
|
|
190
196
|
position: absolute;
|
|
191
197
|
right: 0;
|
|
192
198
|
margin-top: -300px;
|
|
193
|
-
width:
|
|
199
|
+
width: 32%;
|
|
194
200
|
max-width: 598px;
|
|
195
201
|
height: 324px;
|
|
196
202
|
margin: auto;
|
|
@@ -34,34 +34,28 @@ export var CATEGORIES = [{
|
|
|
34
34
|
}];
|
|
35
35
|
export function getNewProducts(_ref) {
|
|
36
36
|
var language = _ref.language,
|
|
37
|
-
isChinaMirrorHost = _ref.isChinaMirrorHost
|
|
38
|
-
|
|
39
|
-
return
|
|
40
|
-
|
|
41
|
-
).
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (isChinaMirrorHost) {
|
|
52
|
-
// g2plot.antv.vision => antv-g2plot.gitee.io
|
|
53
|
-
var match = actualUrl.match(/([http|https]):\/\/(.*)\.antv\.vision/);
|
|
54
|
-
if (match && match[2]) {
|
|
55
|
-
actualUrl = actualUrl.replace("".concat(match[2], ".antv.vision"), "antv-".concat(match[2], ".gitee.io"));
|
|
56
|
-
}
|
|
37
|
+
isChinaMirrorHost = _ref.isChinaMirrorHost,
|
|
38
|
+
products = _ref.products;
|
|
39
|
+
return products.filter(function (d) {
|
|
40
|
+
return d.lang === language;
|
|
41
|
+
}).map(function (d) {
|
|
42
|
+
var links = typeof d.links === 'string' ? JSON.parse(d.links) : _objectSpread({}, d.links);
|
|
43
|
+
var newLinks = {};
|
|
44
|
+
each(links, function (value, k) {
|
|
45
|
+
var actualUrl = (value === null || value === void 0 ? void 0 : value.url) || '';
|
|
46
|
+
if (isChinaMirrorHost) {
|
|
47
|
+
// g2plot.antv.vision => antv-g2plot.gitee.io
|
|
48
|
+
var match = actualUrl.match(/([http|https]):\/\/(.*)\.antv\.vision/);
|
|
49
|
+
if (match && match[2]) {
|
|
50
|
+
actualUrl = actualUrl.replace("".concat(match[2], ".antv.vision"), "antv-".concat(match[2], ".gitee.io"));
|
|
57
51
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
});
|
|
62
|
-
return _objectSpread(_objectSpread({}, d), {}, {
|
|
63
|
-
links: newLinks
|
|
52
|
+
}
|
|
53
|
+
newLinks[k] = _objectSpread(_objectSpread({}, value), {}, {
|
|
54
|
+
url: actualUrl
|
|
64
55
|
});
|
|
65
56
|
});
|
|
57
|
+
return _objectSpread(_objectSpread({}, d), {}, {
|
|
58
|
+
links: newLinks
|
|
59
|
+
});
|
|
66
60
|
});
|
|
67
61
|
}
|
|
@@ -15,11 +15,15 @@ import { useChinaMirrorHost } from "../../hooks";
|
|
|
15
15
|
import Product from "./Product";
|
|
16
16
|
import styles from "./Product.module.less";
|
|
17
17
|
import { CATEGORIES, getNewProducts } from "./getProducts";
|
|
18
|
+
import { useProducts } from "../../../hooks/useProducts";
|
|
18
19
|
export var Products = function Products(_ref) {
|
|
19
20
|
var show = _ref.show,
|
|
20
21
|
language = _ref.language,
|
|
21
22
|
className = _ref.className,
|
|
22
23
|
bannerVisible = _ref.bannerVisible;
|
|
24
|
+
var _useProducts = useProducts(),
|
|
25
|
+
_useProducts$data = _useProducts.data,
|
|
26
|
+
products = _useProducts$data === void 0 ? [] : _useProducts$data;
|
|
23
27
|
var locale = useLocale();
|
|
24
28
|
var _useChinaMirrorHost = useChinaMirrorHost(),
|
|
25
29
|
_useChinaMirrorHost2 = _slicedToArray(_useChinaMirrorHost, 1),
|
|
@@ -30,24 +34,24 @@ export var Products = function Products(_ref) {
|
|
|
30
34
|
setProducts = _React$useState2[1];
|
|
31
35
|
var lang = locale.id === 'zh' ? 'zh' : 'en';
|
|
32
36
|
React.useEffect(function () {
|
|
33
|
-
getNewProducts({
|
|
37
|
+
var data = getNewProducts({
|
|
34
38
|
language: lang,
|
|
35
|
-
isChinaMirrorHost: isChinaMirrorHost
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
setProducts(newProducts);
|
|
39
|
+
isChinaMirrorHost: isChinaMirrorHost,
|
|
40
|
+
products: products
|
|
41
|
+
});
|
|
42
|
+
var newProducts = CATEGORIES.map(function (_ref2) {
|
|
43
|
+
var name = _ref2.name,
|
|
44
|
+
type = _ref2.type;
|
|
45
|
+
return {
|
|
46
|
+
name: name,
|
|
47
|
+
type: type,
|
|
48
|
+
products: data.filter(function (item) {
|
|
49
|
+
return item.category === type;
|
|
50
|
+
})
|
|
51
|
+
};
|
|
49
52
|
});
|
|
50
|
-
|
|
53
|
+
setProducts(newProducts);
|
|
54
|
+
}, [lang, isChinaMirrorHost, products.length]);
|
|
51
55
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
52
56
|
className: cx(styles.products, className, _defineProperty(_defineProperty({}, styles.show, !!show), styles.bannerVisible, !!bannerVisible))
|
|
53
57
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useIntl } from 'dumi';
|
|
1
|
+
import { useIntl, useSiteData } from 'dumi';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import styles from "./SearchResult.module.less";
|
|
4
|
+
import classnames from "classnames";
|
|
5
|
+
import { createNewSession } from "../../../model/AIChat";
|
|
5
6
|
var getHighlightInfo = function getHighlightInfo(textSegments) {
|
|
6
7
|
return /*#__PURE__*/React.createElement(React.Fragment, null, textSegments.map(function (segment) {
|
|
7
8
|
return /*#__PURE__*/React.createElement("span", {
|
|
@@ -15,13 +16,41 @@ var getHighlightInfo = function getHighlightInfo(textSegments) {
|
|
|
15
16
|
* @returns
|
|
16
17
|
*/
|
|
17
18
|
export var SearchResult = function SearchResult(_ref) {
|
|
18
|
-
var results = _ref.results
|
|
19
|
+
var results = _ref.results,
|
|
20
|
+
keywords = _ref.keywords;
|
|
21
|
+
var _useSiteData = useSiteData(),
|
|
22
|
+
themeConfig = _useSiteData.themeConfig;
|
|
19
23
|
var intl = useIntl();
|
|
20
24
|
return /*#__PURE__*/React.createElement("div", {
|
|
21
25
|
className: styles.searchResult
|
|
22
|
-
},
|
|
26
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: styles.item
|
|
28
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
className: styles.subject
|
|
30
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
31
|
+
src: "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*7svFR6wkPMoAAAAAAAAAAAAADmJ7AQ/original",
|
|
32
|
+
alt: "AntV"
|
|
33
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: styles.br
|
|
35
|
+
}), /*#__PURE__*/React.createElement("a", {
|
|
36
|
+
className: styles.result,
|
|
37
|
+
onClick: function onClick() {
|
|
38
|
+
createNewSession({
|
|
39
|
+
promptText: keywords,
|
|
40
|
+
mode: "solve",
|
|
41
|
+
lib: !themeConfig.isAntVSite ? themeConfig.title : undefined
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
45
|
+
className: classnames(styles.title, styles.highlighted)
|
|
46
|
+
}, keywords), /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
className: styles.description
|
|
48
|
+
}, "\u8BD5\u8BD5\xA0", /*#__PURE__*/React.createElement("span", {
|
|
49
|
+
className: styles.highlighted
|
|
50
|
+
}, "AI"), "\xA0\u53EF\u89C6\u5316\u7B54\u7591"))), results !== null && results !== void 0 && results.length ? results.map(function (r, index) {
|
|
23
51
|
return /*#__PURE__*/React.createElement("div", {
|
|
24
|
-
className: styles.item
|
|
52
|
+
className: styles.item,
|
|
53
|
+
key: index
|
|
25
54
|
}, /*#__PURE__*/React.createElement("div", {
|
|
26
55
|
className: styles.subject
|
|
27
56
|
}, r.subject), /*#__PURE__*/React.createElement("div", {
|
|
@@ -34,13 +63,5 @@ export var SearchResult = function SearchResult(_ref) {
|
|
|
34
63
|
}, getHighlightInfo(r.title)), /*#__PURE__*/React.createElement("div", {
|
|
35
64
|
className: styles.description
|
|
36
65
|
}, getHighlightInfo(r.description))));
|
|
37
|
-
}) : /*#__PURE__*/React.createElement(
|
|
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
|
-
}))));
|
|
66
|
+
}) : /*#__PURE__*/React.createElement(React.Fragment, null));
|
|
46
67
|
};
|
|
@@ -58,7 +58,8 @@ export var Search = function Search() {
|
|
|
58
58
|
placement: "topLeft",
|
|
59
59
|
destroyTooltipOnHide: false,
|
|
60
60
|
content: /*#__PURE__*/React.createElement(SearchResult, {
|
|
61
|
-
results: searchResults
|
|
61
|
+
results: searchResults,
|
|
62
|
+
keywords: keywords
|
|
62
63
|
})
|
|
63
64
|
}, /*#__PURE__*/React.createElement("label", {
|
|
64
65
|
className: styles.search
|
package/dist/typings.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/dumi-theme-antv",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0-beta.0",
|
|
4
4
|
"description": "AntV website theme based on dumi2.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dumi",
|
|
@@ -57,14 +57,19 @@
|
|
|
57
57
|
"@ant-design/cssinjs": "^1.23.0",
|
|
58
58
|
"@ant-design/icons": "^4.8.3",
|
|
59
59
|
"@ant-design/pro-components": "^2.8.7",
|
|
60
|
+
"@ant-design/x": "^1.6.1",
|
|
60
61
|
"@babel/plugin-syntax-unicode-sets-regex": "^7.18.6",
|
|
61
62
|
"@babel/standalone": "^7.26.2",
|
|
63
|
+
"@codesandbox/sandpack-react": "^2.20.0",
|
|
62
64
|
"@docsearch/css": "^3.8.0",
|
|
63
65
|
"@docsearch/react": "^3.8.0",
|
|
64
66
|
"@emotion/server": "^11.11.0",
|
|
67
|
+
"@fingerprintjs/fingerprintjs": "^4.6.2",
|
|
65
68
|
"@monaco-editor/react": "^4.6.0",
|
|
66
69
|
"@petercatai/assistant": "^2.0.24",
|
|
67
70
|
"@stackblitz/sdk": "^1.11.0",
|
|
71
|
+
"@tanstack/react-query": "^5.90.2",
|
|
72
|
+
"ahooks": "^3.9.5",
|
|
68
73
|
"antd": "^5.24.5",
|
|
69
74
|
"antd-style": "^3.7.1",
|
|
70
75
|
"babel-loader": "^10.0.0",
|
|
@@ -83,6 +88,7 @@
|
|
|
83
88
|
"indent-string": "^5.0.0",
|
|
84
89
|
"insert-css": "^2.0.0",
|
|
85
90
|
"leancloud-storage": "^4.15.2",
|
|
91
|
+
"localforage": "^1.10.0",
|
|
86
92
|
"lodash-es": "^4.17.21",
|
|
87
93
|
"lodash.merge": "^4.6.2",
|
|
88
94
|
"mini-css-extract-plugin": "^2.9.2",
|
|
@@ -102,6 +108,7 @@
|
|
|
102
108
|
"react-router-dom": "^6.28.0",
|
|
103
109
|
"react-slick": "^0.29.0",
|
|
104
110
|
"react-split-pane": "^0.1.92",
|
|
111
|
+
"react-syntax-highlighter": "^15.6.6",
|
|
105
112
|
"react-use": "^17.5.1",
|
|
106
113
|
"reading-time": "^1.5.0",
|
|
107
114
|
"rehype-raw": "^7.0.0",
|
|
@@ -133,6 +140,7 @@
|
|
|
133
140
|
"@types/react": "^18.3.12",
|
|
134
141
|
"@types/react-router-dom": "^5.3.3",
|
|
135
142
|
"@types/react-slick": "^0.23.13",
|
|
143
|
+
"@types/react-syntax-highlighter": "^15.5.13",
|
|
136
144
|
"@types/styled-components": "^5.1.34",
|
|
137
145
|
"@umijs/lint": "^4.3.34",
|
|
138
146
|
"css-loader": "^7.1.2",
|
|
@@ -161,5 +169,16 @@
|
|
|
161
169
|
"authors": [
|
|
162
170
|
"dumi",
|
|
163
171
|
"antv"
|
|
164
|
-
]
|
|
172
|
+
],
|
|
173
|
+
"resolutions": {
|
|
174
|
+
"@monaco-editor/loader": "1.5.0"
|
|
175
|
+
},
|
|
176
|
+
"overrides": {
|
|
177
|
+
"@monaco-editor/loader": "1.5.0"
|
|
178
|
+
},
|
|
179
|
+
"pnpm": {
|
|
180
|
+
"overrides": {
|
|
181
|
+
"@monaco-editor/loader": "1.5.0"
|
|
182
|
+
}
|
|
183
|
+
}
|
|
165
184
|
}
|
|
File without changes
|