@antv/dumi-theme-antv 0.8.2 → 0.8.4
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.
|
@@ -27,8 +27,9 @@ export function HomeDialog(props) {
|
|
|
27
27
|
_fileSummary = _useState4[0],
|
|
28
28
|
setFileSummary = _useState4[1];
|
|
29
29
|
var handleConfirm = function handleConfirm() {
|
|
30
|
-
//
|
|
31
|
-
var
|
|
30
|
+
// 在新标签页打开新站点,携带问题参数,并将选择的技术栈拼接在消息前面
|
|
31
|
+
var libPrefix = snap.lib ? lang === 'zh' ? "\u4F7F\u7528".concat(snap.lib, "\u65F6\uFF0C") : "When using ".concat(snap.lib, ", ") : '';
|
|
32
|
+
var encodedMessage = encodeURIComponent("".concat(libPrefix).concat(promptText));
|
|
32
33
|
var targetUrl = "https://sive.antv.antgroup.com/qa?message=".concat(encodedMessage);
|
|
33
34
|
window.open(targetUrl, '_blank', 'noopener,noreferrer');
|
|
34
35
|
};
|
|
@@ -13,7 +13,7 @@ var GlobalLayout = function GlobalLayout() {
|
|
|
13
13
|
if (typeof window !== 'undefined') {
|
|
14
14
|
window.antd = antd;
|
|
15
15
|
}
|
|
16
|
-
console.log("%c @antv/dumi-theme-antv %c ".concat("0.8.
|
|
16
|
+
console.log("%c @antv/dumi-theme-antv %c ".concat("0.8.4", " %c"), 'background:#35495e; padding: 1px; border-radius: 3px 0 0 3px; color: #fff;', 'background:#41b883; padding: 1px; border-radius: 0 3px 3px 0; color: #fff;', 'background:transparent;');
|
|
17
17
|
}, []);
|
|
18
18
|
return outlet && /*#__PURE__*/React.createElement(QueryClientProvider, {
|
|
19
19
|
client: queryClient
|
|
@@ -13,9 +13,9 @@ 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 {
|
|
16
|
+
import { Switch } from 'antd';
|
|
17
17
|
import { autoType as d3AutoType, dsvFormat } from 'd3-dsv';
|
|
18
|
-
import {
|
|
18
|
+
import { useLocale, useSiteData } from 'dumi';
|
|
19
19
|
import { debounce, noop } from 'lodash-es';
|
|
20
20
|
import { format } from 'prettier';
|
|
21
21
|
import parserBabel from 'prettier/parser-babel';
|
|
@@ -25,8 +25,6 @@ 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";
|
|
29
|
-
import { ClearOutlined } from '@ant-design/icons';
|
|
30
28
|
loader.config({
|
|
31
29
|
'vs/nls': {
|
|
32
30
|
availableLanguages: {
|
|
@@ -62,20 +60,15 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
62
60
|
_ref$showAI = _ref.showAI,
|
|
63
61
|
showAI = _ref$showAI === void 0 ? true : _ref$showAI,
|
|
64
62
|
style = _ref.style;
|
|
65
|
-
var umiLocation = useLocation();
|
|
66
63
|
var locale = useLocale();
|
|
67
64
|
var _useSiteData = useSiteData(),
|
|
68
65
|
themeConfig = _useSiteData.themeConfig;
|
|
69
|
-
var intl = useIntl();
|
|
70
66
|
var _themeConfig$es = themeConfig.es5,
|
|
71
67
|
es5 = _themeConfig$es === void 0 ? true : _themeConfig$es,
|
|
72
68
|
_themeConfig$showSpec = themeConfig.showSpecTab,
|
|
73
69
|
showSpecTab = _themeConfig$showSpec === void 0 ? false : _themeConfig$showSpec;
|
|
74
|
-
var _themeConfig$playgrou = themeConfig.playground,
|
|
75
|
-
_themeConfig$
|
|
76
|
-
extraLib = _themeConfig$playgrou2 === void 0 ? '' : _themeConfig$playgrou2,
|
|
77
|
-
_themeConfig$playgrou3 = _themeConfig$playgrou.playgroundBeforeExecute,
|
|
78
|
-
playgroundBeforeExecute = _themeConfig$playgrou3 === void 0 ? '' : _themeConfig$playgrou3;
|
|
70
|
+
var _themeConfig$playgrou = themeConfig.playground.playgroundBeforeExecute,
|
|
71
|
+
playgroundBeforeExecute = _themeConfig$playgrou === void 0 ? '' : _themeConfig$playgrou;
|
|
79
72
|
// 编辑器两个 tab,分别是代码和数据
|
|
80
73
|
var _useState = useState(null),
|
|
81
74
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -107,14 +100,6 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
107
100
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
108
101
|
currentEditorTab = _useState12[0],
|
|
109
102
|
setCurrentEditorTab = _useState12[1];
|
|
110
|
-
var _useState13 = useState(false),
|
|
111
|
-
_useState14 = _slicedToArray(_useState13, 2),
|
|
112
|
-
showAIDrawer = _useState14[0],
|
|
113
|
-
setShowAIDrawer = _useState14[1];
|
|
114
|
-
var _useState15 = useState("_"),
|
|
115
|
-
_useState16 = _slicedToArray(_useState15, 2),
|
|
116
|
-
msgBoxKey = _useState16[0],
|
|
117
|
-
setMsgBoxKey = _useState16[1];
|
|
118
103
|
var containerId = "playgroundScriptContainer_".concat(exampleId);
|
|
119
104
|
|
|
120
105
|
// 出发 auto resize
|
|
@@ -290,7 +275,6 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
290
275
|
// 用于更新当前 example 的 spec 和 data
|
|
291
276
|
useEffect(function () {
|
|
292
277
|
setCurrentEditorTab(EDITOR_TABS.JAVASCRIPT);
|
|
293
|
-
setShowAIDrawer(false);
|
|
294
278
|
}, [exampleId]);
|
|
295
279
|
|
|
296
280
|
// hook 用户的数据
|
|
@@ -394,7 +378,9 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
394
378
|
}
|
|
395
379
|
};
|
|
396
380
|
var onClickAI = function onClickAI() {
|
|
397
|
-
|
|
381
|
+
var _themeConfig$ai;
|
|
382
|
+
var aiUrl = (themeConfig === null || themeConfig === void 0 || (_themeConfig$ai = themeConfig.ai) === null || _themeConfig$ai === void 0 ? void 0 : _themeConfig$ai.url) || 'https://sive.antv.antgroup.com/qa';
|
|
383
|
+
window.open(aiUrl);
|
|
398
384
|
};
|
|
399
385
|
var onReload = function onReload() {
|
|
400
386
|
setCode(source);
|
|
@@ -470,43 +456,7 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
470
456
|
onMount: function onMount(editor) {
|
|
471
457
|
monacoRef.current = editor;
|
|
472
458
|
}
|
|
473
|
-
})
|
|
474
|
-
closable: true,
|
|
475
|
-
open: showAIDrawer,
|
|
476
|
-
getContainer: false,
|
|
477
|
-
onClose: function onClose() {
|
|
478
|
-
return setShowAIDrawer(false);
|
|
479
|
-
},
|
|
480
|
-
rootClassName: styles.drawer,
|
|
481
|
-
width: '80%',
|
|
482
|
-
key: "".concat(umiLocation.hash, "_").concat(umiLocation.key),
|
|
483
|
-
extra: /*#__PURE__*/React.createElement(Tooltip, {
|
|
484
|
-
title: intl.formatMessage({
|
|
485
|
-
id: 'ai.toolbar.clear.conversation'
|
|
486
|
-
})
|
|
487
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
488
|
-
type: "link",
|
|
489
|
-
onClick: function onClick() {
|
|
490
|
-
return setMsgBoxKey(crypto.randomUUID());
|
|
491
|
-
}
|
|
492
|
-
}, /*#__PURE__*/React.createElement(ClearOutlined, null)))
|
|
493
|
-
}, /*#__PURE__*/React.createElement(MsgBox, {
|
|
494
|
-
key: "".concat(umiLocation.hash, "_").concat(umiLocation.key, "_").concat(msgBoxKey),
|
|
495
|
-
simple: true,
|
|
496
|
-
messages: [{
|
|
497
|
-
id: crypto.randomUUID(),
|
|
498
|
-
role: 'assistant',
|
|
499
|
-
content: intl.formatMessage({
|
|
500
|
-
id: 'ai.assistant.editor.intro'
|
|
501
|
-
}),
|
|
502
|
-
createdAt: Date.now()
|
|
503
|
-
}],
|
|
504
|
-
context: valueOf(tab),
|
|
505
|
-
onCodegen: function onCodegen(codeBlock) {
|
|
506
|
-
setCode(codeBlock);
|
|
507
|
-
},
|
|
508
|
-
title: title
|
|
509
|
-
})));
|
|
459
|
+
}));
|
|
510
460
|
}));
|
|
511
461
|
};
|
|
512
462
|
export default CodeEditor;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import { useIntl, useSiteData } from 'dumi';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import styles from "./SearchResult.module.less";
|
|
4
|
-
import classnames from "classnames";
|
|
5
|
-
import { AIChatStore, createNewSession } from "../../../model/AIChat";
|
|
6
|
-
import { authStore, showLoginModal } from "../../../model/auth";
|
|
7
|
-
import { useSnapshot } from "valtio";
|
|
8
3
|
var getHighlightInfo = function getHighlightInfo(textSegments) {
|
|
9
4
|
return /*#__PURE__*/React.createElement(React.Fragment, null, textSegments.map(function (segment) {
|
|
10
5
|
return /*#__PURE__*/React.createElement("span", {
|
|
@@ -20,52 +15,9 @@ var getHighlightInfo = function getHighlightInfo(textSegments) {
|
|
|
20
15
|
export var SearchResult = function SearchResult(_ref) {
|
|
21
16
|
var results = _ref.results,
|
|
22
17
|
keywords = _ref.keywords;
|
|
23
|
-
var _useSiteData = useSiteData(),
|
|
24
|
-
themeConfig = _useSiteData.themeConfig;
|
|
25
|
-
var intl = useIntl();
|
|
26
|
-
var authSnap = useSnapshot(authStore);
|
|
27
|
-
function pureSearch() {
|
|
28
|
-
AIChatStore.mode = 'solve';
|
|
29
|
-
createNewSession({
|
|
30
|
-
promptText: keywords,
|
|
31
|
-
mode: 'solve',
|
|
32
|
-
lib: !themeConfig.isAntVSite ? themeConfig.title : undefined,
|
|
33
|
-
jump: true,
|
|
34
|
-
lang: intl.locale === 'zh' ? 'zh' : 'en',
|
|
35
|
-
entry_point: 'SearchResult'
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
18
|
return /*#__PURE__*/React.createElement("div", {
|
|
39
19
|
className: styles.searchResult
|
|
40
|
-
},
|
|
41
|
-
className: styles.item
|
|
42
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
43
|
-
className: styles.subject
|
|
44
|
-
}, /*#__PURE__*/React.createElement("img", {
|
|
45
|
-
src: "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*7svFR6wkPMoAAAAAAAAAAAAADmJ7AQ/original",
|
|
46
|
-
alt: "AntV"
|
|
47
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
48
|
-
className: styles.br
|
|
49
|
-
}), /*#__PURE__*/React.createElement("a", {
|
|
50
|
-
className: styles.result,
|
|
51
|
-
onClick: function onClick() {
|
|
52
|
-
if (!authSnap.isAuthenticated) {
|
|
53
|
-
showLoginModal(pureSearch);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
pureSearch();
|
|
57
|
-
}
|
|
58
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
59
|
-
className: classnames(styles.title, styles.highlighted)
|
|
60
|
-
}, keywords), /*#__PURE__*/React.createElement("div", {
|
|
61
|
-
className: styles.description
|
|
62
|
-
}, intl.formatMessage({
|
|
63
|
-
id: 'ai.search.try'
|
|
64
|
-
}), "\xA0", /*#__PURE__*/React.createElement("span", {
|
|
65
|
-
className: styles.highlighted
|
|
66
|
-
}, "AI"), "\xA0", intl.formatMessage({
|
|
67
|
-
id: 'ai.search.visualization'
|
|
68
|
-
})))), results !== null && results !== void 0 && results.length ? results.map(function (r, index) {
|
|
20
|
+
}, results !== null && results !== void 0 && results.length ? results.map(function (r, index) {
|
|
69
21
|
return /*#__PURE__*/React.createElement("div", {
|
|
70
22
|
className: styles.item,
|
|
71
23
|
key: index
|