@antv/dumi-theme-antv 0.7.10 → 0.8.0-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.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 +139 -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 +66 -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 +139 -0
- package/dist/hooks/useTypewriter.js +69 -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 +224 -0
- package/dist/pages/AIPlayground/components/ConversationsMenu/index.js +149 -0
- package/dist/pages/AIPlayground/components/ConversationsMenu/index.module.less +44 -0
- package/dist/pages/AIPlayground/components/MarkdownComponent/MarkdownCodeBlock.js +78 -0
- package/dist/pages/AIPlayground/components/MarkdownComponent/MarkdownCodeBlock.module.less +14 -0
- package/dist/pages/AIPlayground/components/MarkdownComponent/index.js +47 -0
- package/dist/pages/AIPlayground/components/MsgBox/index.js +269 -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 +109 -0
- package/dist/pages/AIPlayground/components/TaskBox/index.js +61 -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/Index/index.js +1 -1
- package/dist/plugin/index.js +14 -6
- package/dist/slots/CodeEditor/Toolbar.js +13 -3
- package/dist/slots/CodeEditor/Toolbar.module.less +7 -0
- package/dist/slots/CodeEditor/index.js +39 -2
- package/dist/slots/CodeEditor/index.module.less +22 -0
- package/dist/slots/CodeRunner/index.js +2 -1
- 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 +12 -6
- 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 +36 -14
- package/dist/slots/Header/Search/index.js +2 -1
- package/dist/slots/Header/index.module.less +1 -1
- package/dist/typings.d.ts +5 -0
- package/dist/utils/code.js +35 -0
- package/package.json +23 -4
- /package/dist/{pages/Index/components → slots}/Detail/News.module.less +0 -0
|
@@ -10,7 +10,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
10
10
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
11
11
|
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); }
|
|
12
12
|
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); }
|
|
13
|
-
import { CodeSandboxOutlined, PlayCircleOutlined, ThunderboltOutlined } from '@ant-design/icons';
|
|
13
|
+
import { CodeSandboxOutlined, PlayCircleOutlined, ReloadOutlined, ThunderboltOutlined } from '@ant-design/icons';
|
|
14
14
|
import stackblitzSdk from '@stackblitz/sdk';
|
|
15
15
|
import { Tooltip, Typography } from 'antd';
|
|
16
16
|
import { getParameters } from 'codesandbox/lib/api/define';
|
|
@@ -42,7 +42,9 @@ export var Toolbar = function Toolbar(_ref) {
|
|
|
42
42
|
onEditorTabChange = _ref.onEditorTabChange,
|
|
43
43
|
_ref$onToggleFullscre = _ref.onToggleFullscreen,
|
|
44
44
|
onToggleFullscreen = _ref$onToggleFullscre === void 0 ? null : _ref$onToggleFullscre,
|
|
45
|
-
onExecuteCode = _ref.onExecuteCode
|
|
45
|
+
onExecuteCode = _ref.onExecuteCode,
|
|
46
|
+
onClickAI = _ref.onClickAI,
|
|
47
|
+
onReload = _ref.onReload;
|
|
46
48
|
var locale = useLocale();
|
|
47
49
|
var exampleTitle = _typeof(title) === 'object' ? title[locale.id] : title;
|
|
48
50
|
|
|
@@ -78,7 +80,15 @@ export var Toolbar = function Toolbar(_ref) {
|
|
|
78
80
|
return onEditorTabChange(tab);
|
|
79
81
|
}
|
|
80
82
|
}, tab, " ", slot && slot);
|
|
81
|
-
})),
|
|
83
|
+
})), /*#__PURE__*/React.createElement("a", {
|
|
84
|
+
className: styles.ai,
|
|
85
|
+
onClick: onClickAI
|
|
86
|
+
}, "AI \u52A9\u624B"), /*#__PURE__*/React.createElement(Tooltip, {
|
|
87
|
+
title: "\u8FD8\u539F"
|
|
88
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
89
|
+
className: styles.ai,
|
|
90
|
+
onClick: onReload
|
|
91
|
+
}, /*#__PURE__*/React.createElement(ReloadOutlined, null))), riddleVisible ? /*#__PURE__*/React.createElement("form", {
|
|
82
92
|
action: "//riddle.alibaba-inc.com/riddles/define",
|
|
83
93
|
method: "POST",
|
|
84
94
|
target: "_blank"
|
|
@@ -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
|
|
@@ -275,6 +280,7 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
275
280
|
// 用于更新当前 example 的 spec 和 data
|
|
276
281
|
useEffect(function () {
|
|
277
282
|
setCurrentEditorTab(EDITOR_TABS.JAVASCRIPT);
|
|
283
|
+
setShowAI(false);
|
|
278
284
|
}, [exampleId]);
|
|
279
285
|
|
|
280
286
|
// hook 用户的数据
|
|
@@ -377,6 +383,12 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
377
383
|
return null;
|
|
378
384
|
}
|
|
379
385
|
};
|
|
386
|
+
var onClickAI = function onClickAI() {
|
|
387
|
+
setShowAI(true);
|
|
388
|
+
};
|
|
389
|
+
var onReload = function onReload() {
|
|
390
|
+
setCode(source);
|
|
391
|
+
};
|
|
380
392
|
return /*#__PURE__*/React.createElement("div", {
|
|
381
393
|
className: styles.editor
|
|
382
394
|
}, /*#__PURE__*/React.createElement(Toolbar, {
|
|
@@ -393,6 +405,8 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
393
405
|
},
|
|
394
406
|
onEditorTabChange: onTabChange,
|
|
395
407
|
onToggleFullscreen: onFullscreen,
|
|
408
|
+
onClickAI: onClickAI,
|
|
409
|
+
onReload: onReload,
|
|
396
410
|
slots: {
|
|
397
411
|
Spec: /*#__PURE__*/React.createElement("span", {
|
|
398
412
|
style: {
|
|
@@ -444,7 +458,30 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
444
458
|
onMount: function onMount(editor) {
|
|
445
459
|
monacoRef.current = editor;
|
|
446
460
|
}
|
|
447
|
-
})
|
|
461
|
+
}), /*#__PURE__*/React.createElement(Drawer, {
|
|
462
|
+
placement: "right",
|
|
463
|
+
closable: true,
|
|
464
|
+
open: showAI,
|
|
465
|
+
getContainer: false,
|
|
466
|
+
onClose: function onClose() {
|
|
467
|
+
return setShowAI(false);
|
|
468
|
+
},
|
|
469
|
+
rootClassName: styles.drawer,
|
|
470
|
+
width: '90%'
|
|
471
|
+
}, /*#__PURE__*/React.createElement(MsgBox, {
|
|
472
|
+
simple: true,
|
|
473
|
+
messages: [{
|
|
474
|
+
id: crypto.randomUUID(),
|
|
475
|
+
role: 'assistant',
|
|
476
|
+
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",
|
|
477
|
+
createdAt: Date.now()
|
|
478
|
+
}],
|
|
479
|
+
context: valueOf(tab),
|
|
480
|
+
onCodegen: function onCodegen(codeBlock) {
|
|
481
|
+
setCode(codeBlock);
|
|
482
|
+
},
|
|
483
|
+
title: title
|
|
484
|
+
})));
|
|
448
485
|
}));
|
|
449
486
|
};
|
|
450
487
|
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,8 +1,8 @@
|
|
|
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;
|
|
@@ -16,10 +16,16 @@
|
|
|
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,42 @@ 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
|
+
jump: true
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: classnames(styles.title, styles.highlighted)
|
|
47
|
+
}, keywords), /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
className: styles.description
|
|
49
|
+
}, "\u8BD5\u8BD5\xA0", /*#__PURE__*/React.createElement("span", {
|
|
50
|
+
className: styles.highlighted
|
|
51
|
+
}, "AI"), "\xA0\u53EF\u89C6\u5316\u7B54\u7591"))), results !== null && results !== void 0 && results.length ? results.map(function (r, index) {
|
|
23
52
|
return /*#__PURE__*/React.createElement("div", {
|
|
24
|
-
className: styles.item
|
|
53
|
+
className: styles.item,
|
|
54
|
+
key: index
|
|
25
55
|
}, /*#__PURE__*/React.createElement("div", {
|
|
26
56
|
className: styles.subject
|
|
27
57
|
}, r.subject), /*#__PURE__*/React.createElement("div", {
|
|
@@ -34,13 +64,5 @@ export var SearchResult = function SearchResult(_ref) {
|
|
|
34
64
|
}, getHighlightInfo(r.title)), /*#__PURE__*/React.createElement("div", {
|
|
35
65
|
className: styles.description
|
|
36
66
|
}, 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
|
-
}))));
|
|
67
|
+
}) : /*#__PURE__*/React.createElement(React.Fragment, null));
|
|
46
68
|
};
|
|
@@ -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
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(e, r) { return new BabelRegExp(e, void 0, r); }; var e = RegExp.prototype, r = new WeakMap(); function BabelRegExp(e, t, p) { var o = new RegExp(e, t); return r.set(o, p || r.get(e)), _setPrototypeOf(o, BabelRegExp.prototype); } function buildGroups(e, t) { var p = r.get(t); return Object.keys(p).reduce(function (r, t) { var o = p[t]; if ("number" == typeof o) r[t] = e[o];else { for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; r[t] = e[o[i]]; } return r; }, Object.create(null)); } return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { var t = e.exec.call(this, r); if (t) { t.groups = buildGroups(t, this); var p = t.indices; p && (p.groups = buildGroups(p, this)); } return t; }, BabelRegExp.prototype[Symbol.replace] = function (t, p) { if ("string" == typeof p) { var o = r.get(this); return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)>/g, function (e, r) { var t = o[r]; return "$" + (Array.isArray(t) ? t.join("$") : t); })); } if ("function" == typeof p) { var i = this; return e[Symbol.replace].call(this, t, function () { var e = arguments; return "object" != _typeof(e[e.length - 1]) && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); }); } return e[Symbol.replace].call(this, t, p); }, _wrapRegExp.apply(this, arguments); }
|
|
3
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
4
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
5
|
+
export function isPreviewable(str) {
|
|
6
|
+
if (typeof str !== 'string') {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
var trimmedStr = str.trim();
|
|
10
|
+
|
|
11
|
+
// \b 是一个“单词边界”,确保我们匹配的是完整的 "import" 单词
|
|
12
|
+
// 而不是 "important" 的一部分
|
|
13
|
+
var hasImportStatement = /\bimport\b/.test(trimmedStr);
|
|
14
|
+
if (trimmedStr.startsWith('```') && trimmedStr.endsWith('```') && hasImportStatement) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
export function getCodeFromMarkdown() {
|
|
20
|
+
var md = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
21
|
+
var regex = /*#__PURE__*/_wrapRegExp(/```(\w*)\n?([\s\S]*?)```/, {
|
|
22
|
+
lang: 1,
|
|
23
|
+
code: 2
|
|
24
|
+
});
|
|
25
|
+
var match = md.match(regex);
|
|
26
|
+
if (match) {
|
|
27
|
+
return {
|
|
28
|
+
lang: match.groups.lang || 'plaintext',
|
|
29
|
+
code: match.groups.code.trim()
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
code: ''
|
|
34
|
+
};
|
|
35
|
+
}
|
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.1",
|
|
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",
|
|
65
|
-
"@
|
|
67
|
+
"@fingerprintjs/fingerprintjs": "^4.6.2",
|
|
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,11 +88,12 @@
|
|
|
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",
|
|
89
95
|
"moment": "^2.30.1",
|
|
90
|
-
"monaco-editor": "0.
|
|
96
|
+
"monaco-editor": "^0.25.2",
|
|
91
97
|
"nprogress": "^0.2.0",
|
|
92
98
|
"p-limit": "^3.1.0",
|
|
93
99
|
"parse-github-url": "^1.0.3",
|
|
@@ -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
|