@antv/dumi-theme-antv 0.8.0-beta.2 → 0.8.0-beta.21
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.module.less +0 -1
- package/dist/components/AI/HomeDialog/AntVBanner/index.module.less +2 -2
- package/dist/components/AI/HomeDialog/ModeSelector/ModeSelectorDropdown.js +42 -0
- package/dist/components/AI/HomeDialog/ModeSelector/index.module.less +39 -22
- package/dist/components/AI/HomeDialog/PromptTextarea/ChooseLib/index.js +12 -4
- package/dist/components/AI/HomeDialog/PromptTextarea/ChooseLib/index.module.less +0 -1
- package/dist/components/AI/HomeDialog/PromptTextarea/DatasourceCard/index.module.less +3 -3
- package/dist/components/AI/HomeDialog/PromptTextarea/index.js +38 -36
- package/dist/components/AI/HomeDialog/PromptTextarea/index.module.less +8 -8
- package/dist/components/AI/HomeDialog/RecommendCase/Card.js +14 -11
- package/dist/components/AI/HomeDialog/RecommendCase/card.module.less +3 -3
- package/dist/components/AI/HomeDialog/RecommendCase/index.js +73 -24
- package/dist/components/AI/HomeDialog/RecommendCase/index.module.less +4 -2
- package/dist/components/AI/HomeDialog/RecommendCase/recommend.json +41 -17
- package/dist/components/AI/HomeDialog/index.js +21 -33
- package/dist/components/AI/constant.js +4 -2
- package/dist/components/Login/Captcha/index.js +185 -0
- package/dist/components/Login/Captcha/index.less +91 -0
- package/dist/components/Login/CheckCode/index.js +244 -0
- package/dist/components/Login/CheckCode/index.less +137 -0
- package/dist/components/Login/CountDownButton/index.js +109 -0
- package/dist/components/Login/CountDownButton/index.less +8 -0
- package/dist/components/Login/LoginForm.js +239 -0
- package/dist/components/Login/LoginForm.less +409 -0
- package/dist/components/Login/index.js +24 -0
- package/dist/components/Login/openAuthWindow.js +54 -0
- package/dist/components/Login/types.js +5 -0
- package/dist/components/Login/utils.js +47 -0
- package/dist/hooks/useProducts.js +22 -1
- package/dist/layouts/DocLayout.js +2 -1
- package/dist/layouts/GlobalLayout/index.js +11 -4
- package/dist/locales/en.json +43 -2
- package/dist/locales/zh.json +43 -2
- package/dist/model/AIChat.js +93 -6
- package/dist/model/auth.js +147 -0
- package/dist/pages/AIPlayground/components/ConversationsMenu/index.js +15 -7
- package/dist/pages/AIPlayground/components/ConversationsMenu/index.module.less +2 -0
- package/dist/pages/AIPlayground/components/MarkdownComponent/MarkdownCodeBlock.js +26 -17
- package/dist/pages/AIPlayground/components/MarkdownComponent/MarkdownCodeBlock.module.less +1 -2
- package/dist/pages/AIPlayground/components/MarkdownComponent/index.js +7 -4
- package/dist/pages/AIPlayground/components/MsgBox/index.js +266 -149
- package/dist/pages/AIPlayground/components/MsgBox/index.module.less +3 -2
- package/dist/pages/AIPlayground/components/MsgBox/useAutoScroll.js +46 -0
- package/dist/pages/AIPlayground/components/SessionLayout/index.js +41 -12
- package/dist/pages/AIPlayground/components/SessionLayout/index.module.less +4 -4
- package/dist/pages/AIPlayground/components/TaskBox/generateCode.js +129 -8
- package/dist/pages/AIPlayground/components/TaskBox/index.js +92 -55
- package/dist/pages/AIPlayground/components/TaskBox/index.module.less +1 -0
- package/dist/pages/AIPlayground/index.js +4 -1
- package/dist/pages/AIPlayground/index.module.less +5 -0
- package/dist/pages/Examples/components/Accouncement/index.module.less +1 -1
- package/dist/pages/Examples/index.module.less +11 -11
- package/dist/pages/Index/components/Cases/index.module.less +8 -8
- package/dist/pages/Index/components/Companies/index.module.less +4 -3
- package/dist/pages/Index/components/Features/FeatureCard.module.less +4 -5
- package/dist/pages/Index/components/Features/index.module.less +5 -5
- package/dist/pages/Index/components/_.less +9 -9
- package/dist/slots/Banner/Notification.module.less +8 -8
- package/dist/slots/Banner/index.module.less +10 -9
- package/dist/slots/CodeEditor/Toolbar.js +7 -25
- package/dist/slots/CodeEditor/index.js +34 -12
- package/dist/slots/CodeEditor/index.module.less +3 -1
- package/dist/slots/CodeEditor/utils.js +2 -1
- package/dist/slots/CodePreview/index.module.less +0 -3
- package/dist/slots/CodeRunner/index.js +23 -11
- package/dist/slots/ContentTable/index.module.less +2 -1
- package/dist/slots/Detail/News.module.less +9 -9
- package/dist/slots/Detail/index.js +2 -1
- package/dist/slots/Detail/index.module.less +11 -14
- package/dist/slots/ExampleSider/index.module.less +3 -4
- package/dist/slots/Footer/index.module.less +2 -2
- package/dist/slots/Header/Products/Product.module.less +2 -2
- package/dist/slots/Header/Search/SearchResult.js +20 -8
- package/dist/slots/Header/Search/SearchResult.module.less +1 -0
- package/dist/slots/Header/index.js +51 -25
- package/dist/slots/Header/index.module.less +13 -5
- package/dist/slots/LiveExample/index.module.less +1 -1
- package/dist/slots/Loading/index.module.less +30 -28
- package/dist/slots/ManualContent/index.module.less +14 -17
- package/dist/slots/_.less +9 -9
- package/dist/static/user.svg +3 -0
- package/dist/typings.d.ts +6 -0
- package/dist/utils/analytics.js +16 -0
- package/dist/utils/env.js +63 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/request.js +42 -0
- package/package.json +9 -5
- package/dist/static/SearchAiIcon.svg +0 -14
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
|
|
18
18
|
.title {
|
|
19
19
|
font-size: 1.714em;
|
|
20
|
-
color: #000;
|
|
21
20
|
margin-top: 28px;
|
|
22
21
|
margin-bottom: 11px;
|
|
23
22
|
font-family: AlibabaPuHuiTiM;
|
|
@@ -29,7 +28,7 @@
|
|
|
29
28
|
.description {
|
|
30
29
|
opacity: 0.6;
|
|
31
30
|
width: 100%;
|
|
32
|
-
color: rgba(105, 123, 140,
|
|
31
|
+
color: rgba(105, 123, 140, 100%);
|
|
33
32
|
font-size: 1em;
|
|
34
33
|
line-height: 1.8em;
|
|
35
34
|
margin-top: 11px;
|
|
@@ -42,7 +41,7 @@
|
|
|
42
41
|
.cards {
|
|
43
42
|
.cardWrapper {
|
|
44
43
|
.card {
|
|
45
|
-
margin: 84px 19px 80px
|
|
44
|
+
margin: 84px 19px 80px;
|
|
46
45
|
|
|
47
46
|
.content {
|
|
48
47
|
.icon {
|
|
@@ -56,8 +55,8 @@
|
|
|
56
55
|
|
|
57
56
|
.description {
|
|
58
57
|
font-size: 1em;
|
|
59
|
-
padding-bottom:
|
|
60
|
-
padding-top:
|
|
58
|
+
padding-bottom: 0;
|
|
59
|
+
padding-top: 0;
|
|
61
60
|
margin-top: 12px;
|
|
62
61
|
}
|
|
63
62
|
}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
.title {
|
|
23
23
|
font-weight: 500;
|
|
24
|
-
margin: 17px 0 0
|
|
24
|
+
margin: 17px 0 0;
|
|
25
25
|
position: relative;
|
|
26
26
|
font-family: AlibabaPuHuiTiB;
|
|
27
27
|
font-size: 40px;
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
display: flex;
|
|
53
53
|
justify-content: center;
|
|
54
54
|
width: 100%;
|
|
55
|
-
background-color: #
|
|
55
|
+
background-color: #fff;
|
|
56
56
|
border: 1px solid #e5e8ef;
|
|
57
|
-
box-shadow: 0 8px 20px 0 rgba(0, 0, 0,
|
|
57
|
+
box-shadow: 0 8px 20px 0 rgba(0, 0, 0, 3%);
|
|
58
58
|
border-radius: 16px;
|
|
59
59
|
overflow: hidden;
|
|
60
60
|
}
|
|
@@ -77,12 +77,12 @@
|
|
|
77
77
|
|
|
78
78
|
.cardWrapper {
|
|
79
79
|
flex: none;
|
|
80
|
-
margin: 0 0 28px
|
|
80
|
+
margin: 0 0 28px;
|
|
81
81
|
width: 100%;
|
|
82
82
|
max-width: 100%;
|
|
83
83
|
|
|
84
84
|
&:last-child {
|
|
85
|
-
margin: 0 0 30px
|
|
85
|
+
margin: 0 0 30px;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
}
|
|
@@ -81,30 +81,30 @@ h6 {
|
|
|
81
81
|
width: 100%;
|
|
82
82
|
height: 11px;
|
|
83
83
|
margin: -5px 0;
|
|
84
|
-
border-top: 5px solid rgba(255, 255, 255, 0);
|
|
85
|
-
border-bottom: 5px solid rgba(255, 255, 255, 0);
|
|
84
|
+
border-top: 5px solid rgba(255, 255, 255, 0%);
|
|
85
|
+
border-bottom: 5px solid rgba(255, 255, 255, 0%);
|
|
86
86
|
cursor: row-resize;
|
|
87
87
|
|
|
88
88
|
&:hover {
|
|
89
|
-
border-top: 5px solid rgba(0, 0, 0,
|
|
90
|
-
border-bottom: 5px solid rgba(0, 0, 0,
|
|
89
|
+
border-top: 5px solid rgba(0, 0, 0, 50%);
|
|
90
|
+
border-bottom: 5px solid rgba(0, 0, 0, 50%);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
&.vertical {
|
|
95
95
|
width: 11px;
|
|
96
96
|
margin: 0 -5px;
|
|
97
|
-
border-right: 5px solid rgba(255, 255, 255, 0);
|
|
98
|
-
border-left: 5px solid rgba(255, 255, 255, 0);
|
|
97
|
+
border-right: 5px solid rgba(255, 255, 255, 0%);
|
|
98
|
+
border-left: 5px solid rgba(255, 255, 255, 0%);
|
|
99
99
|
cursor: col-resize;
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
pane2 {
|
|
102
102
|
border-left: 1px solid #e6e6e6;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
&:hover {
|
|
106
|
-
border-right: 5px solid rgba(0, 0, 0,
|
|
107
|
-
border-left: 5px solid rgba(0, 0, 0,
|
|
106
|
+
border-right: 5px solid rgba(0, 0, 0, 50%);
|
|
107
|
+
border-left: 5px solid rgba(0, 0, 0, 50%);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
.content {
|
|
19
19
|
padding-left: 20px;
|
|
20
|
-
color: rgba(49, 70, 89,
|
|
20
|
+
color: rgba(49, 70, 89, 100%);
|
|
21
21
|
text-align: left;
|
|
22
22
|
|
|
23
23
|
.description {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
.date {
|
|
31
|
-
color: rgba(216, 203, 249,
|
|
31
|
+
color: rgba(216, 203, 249, 100%);
|
|
32
32
|
bottom: 0;
|
|
33
33
|
font-size: 1em;
|
|
34
34
|
margin-top: 4px;
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
&:hover .description {
|
|
41
|
-
color: rgba(89, 126, 247,
|
|
41
|
+
color: rgba(89, 126, 247, 100%);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -67,12 +67,12 @@
|
|
|
67
67
|
@keyframes showAndHide0 {
|
|
68
68
|
0% {
|
|
69
69
|
opacity: 1;
|
|
70
|
-
top:
|
|
70
|
+
top: 0;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
33.3% {
|
|
74
74
|
opacity: 1;
|
|
75
|
-
top:
|
|
75
|
+
top: 0;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
50% {
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
|
|
88
88
|
100% {
|
|
89
89
|
opacity: 1;
|
|
90
|
-
top:
|
|
90
|
+
top: 0;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
@@ -105,12 +105,12 @@
|
|
|
105
105
|
|
|
106
106
|
50% {
|
|
107
107
|
opacity: 1;
|
|
108
|
-
top:
|
|
108
|
+
top: 0;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
83.3% {
|
|
112
112
|
opacity: 1;
|
|
113
|
-
top:
|
|
113
|
+
top: 0;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
100% {
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
.wrapper {
|
|
4
4
|
min-height: 650px;
|
|
5
5
|
max-height: 803px;
|
|
6
|
-
background: linear-gradient(225deg, #
|
|
6
|
+
background: linear-gradient(225deg, #fff, #f0f5ff);
|
|
7
7
|
height: calc(94vh);
|
|
8
8
|
position: relative;
|
|
9
9
|
overflow: hidden;
|
|
10
10
|
|
|
11
11
|
.content {
|
|
12
12
|
.container1440();
|
|
13
|
+
|
|
13
14
|
height: 100%;
|
|
14
15
|
position: relative;
|
|
15
16
|
}
|
|
@@ -23,14 +24,14 @@
|
|
|
23
24
|
.title {
|
|
24
25
|
font-size: 3.4em; //2.875em;
|
|
25
26
|
font-weight: 800;
|
|
26
|
-
color: rgba(0, 0, 0,
|
|
27
|
+
color: rgba(0, 0, 0, 100%);
|
|
27
28
|
position: relative;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
.description {
|
|
31
32
|
margin-top: 0.83%; //12px;
|
|
32
|
-
margin-bottom:
|
|
33
|
-
color: rgba(106, 123, 140,
|
|
33
|
+
margin-bottom: 0;
|
|
34
|
+
color: rgba(106, 123, 140, 100%);
|
|
34
35
|
font-size: 1.14em;
|
|
35
36
|
font-weight: 200;
|
|
36
37
|
position: relative;
|
|
@@ -162,6 +163,7 @@
|
|
|
162
163
|
.gh-count {
|
|
163
164
|
position: relative;
|
|
164
165
|
display: none;
|
|
166
|
+
|
|
165
167
|
/* hidden to start */
|
|
166
168
|
margin-left: 52px;
|
|
167
169
|
margin-top: 7px;
|
|
@@ -183,8 +185,8 @@
|
|
|
183
185
|
color: #4183c4;
|
|
184
186
|
}
|
|
185
187
|
|
|
186
|
-
.gh-count
|
|
187
|
-
.gh-count
|
|
188
|
+
.gh-count::before,
|
|
189
|
+
.gh-count::after {
|
|
188
190
|
content: '';
|
|
189
191
|
position: absolute;
|
|
190
192
|
display: inline-block;
|
|
@@ -194,7 +196,7 @@
|
|
|
194
196
|
border-style: solid;
|
|
195
197
|
}
|
|
196
198
|
|
|
197
|
-
.gh-count
|
|
199
|
+
.gh-count::before {
|
|
198
200
|
top: 50%;
|
|
199
201
|
left: -3px;
|
|
200
202
|
margin-top: -5px;
|
|
@@ -202,7 +204,7 @@
|
|
|
202
204
|
border-right-color: #fafafa;
|
|
203
205
|
}
|
|
204
206
|
|
|
205
|
-
.gh-count
|
|
207
|
+
.gh-count::after {
|
|
206
208
|
top: 50%;
|
|
207
209
|
border-width: 5px 5px 5px 0;
|
|
208
210
|
border-right-color: #d4d4d4;
|
|
@@ -228,7 +230,6 @@
|
|
|
228
230
|
display: flex;
|
|
229
231
|
position: absolute;
|
|
230
232
|
right: 0;
|
|
231
|
-
margin-top: -300px;
|
|
232
233
|
width: 52%;
|
|
233
234
|
max-width: 598px;
|
|
234
235
|
height: 324px;
|
|
@@ -10,10 +10,9 @@ 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 {
|
|
13
|
+
import { PlayCircleOutlined, ReloadOutlined, ThunderboltOutlined } from '@ant-design/icons';
|
|
14
14
|
import stackblitzSdk from '@stackblitz/sdk';
|
|
15
15
|
import { Tooltip, Typography } from 'antd';
|
|
16
|
-
import { getParameters } from 'codesandbox/lib/api/define';
|
|
17
16
|
import { FormattedMessage, useLocale } from 'dumi';
|
|
18
17
|
import React, { useEffect, useState } from 'react';
|
|
19
18
|
import { ping } from "../utils";
|
|
@@ -44,7 +43,9 @@ export var Toolbar = function Toolbar(_ref) {
|
|
|
44
43
|
onToggleFullscreen = _ref$onToggleFullscre === void 0 ? null : _ref$onToggleFullscre,
|
|
45
44
|
onExecuteCode = _ref.onExecuteCode,
|
|
46
45
|
onClickAI = _ref.onClickAI,
|
|
47
|
-
onReload = _ref.onReload
|
|
46
|
+
onReload = _ref.onReload,
|
|
47
|
+
_ref$showAI = _ref.showAI,
|
|
48
|
+
showAI = _ref$showAI === void 0 ? true : _ref$showAI;
|
|
48
49
|
var locale = useLocale();
|
|
49
50
|
var exampleTitle = _typeof(title) === 'object' ? title[locale.id] : title;
|
|
50
51
|
|
|
@@ -80,7 +81,7 @@ export var Toolbar = function Toolbar(_ref) {
|
|
|
80
81
|
return onEditorTabChange(tab);
|
|
81
82
|
}
|
|
82
83
|
}, tab, " ", slot && slot);
|
|
83
|
-
})), /*#__PURE__*/React.createElement("a", {
|
|
84
|
+
})), showAI ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("a", {
|
|
84
85
|
className: styles.ai,
|
|
85
86
|
onClick: onClickAI
|
|
86
87
|
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
@@ -92,7 +93,7 @@ export var Toolbar = function Toolbar(_ref) {
|
|
|
92
93
|
}, /*#__PURE__*/React.createElement("span", {
|
|
93
94
|
className: styles.ai,
|
|
94
95
|
onClick: onReload
|
|
95
|
-
}, /*#__PURE__*/React.createElement(ReloadOutlined, null))), riddleVisible ? /*#__PURE__*/React.createElement("form", {
|
|
96
|
+
}, /*#__PURE__*/React.createElement(ReloadOutlined, null)))) : null, riddleVisible ? /*#__PURE__*/React.createElement("form", {
|
|
96
97
|
action: "//riddle.alibaba-inc.com/riddles/define",
|
|
97
98
|
method: "POST",
|
|
98
99
|
target: "_blank"
|
|
@@ -117,26 +118,7 @@ export var Toolbar = function Toolbar(_ref) {
|
|
|
117
118
|
onClick: function onClick() {
|
|
118
119
|
stackblitzSdk.openProject(stackblitzPrefillConfig);
|
|
119
120
|
}
|
|
120
|
-
})), /*#__PURE__*/React.createElement(
|
|
121
|
-
title: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
122
|
-
id: "ai.toolbar.open.codesandbox"
|
|
123
|
-
})
|
|
124
|
-
}, /*#__PURE__*/React.createElement("form", {
|
|
125
|
-
action: "https://codesandbox.io/api/v1/sandboxes/define",
|
|
126
|
-
method: "POST",
|
|
127
|
-
target: "_blank"
|
|
128
|
-
}, /*#__PURE__*/React.createElement("input", {
|
|
129
|
-
type: "hidden",
|
|
130
|
-
name: "parameters",
|
|
131
|
-
value: getParameters(codeSandboxConfig)
|
|
132
|
-
}), /*#__PURE__*/React.createElement("button", {
|
|
133
|
-
type: "submit",
|
|
134
|
-
className: styles.codesandbox
|
|
135
|
-
}, /*#__PURE__*/React.createElement(CodeSandboxOutlined, {
|
|
136
|
-
style: {
|
|
137
|
-
marginLeft: 8
|
|
138
|
-
}
|
|
139
|
-
})))), /*#__PURE__*/React.createElement(Paragraph, {
|
|
121
|
+
})), /*#__PURE__*/React.createElement(Paragraph, {
|
|
140
122
|
copyable: {
|
|
141
123
|
text: sourceCode
|
|
142
124
|
},
|
|
@@ -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 { Drawer, Switch } from 'antd';
|
|
16
|
+
import { Button, Drawer, Switch, Tooltip } from 'antd';
|
|
17
17
|
import { autoType as d3AutoType, dsvFormat } from 'd3-dsv';
|
|
18
|
-
import { useLocale,
|
|
18
|
+
import { useIntl, useLocale, useLocation, 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';
|
|
@@ -26,6 +26,7 @@ import styles from "./index.module.less";
|
|
|
26
26
|
import { EDITOR_TABS, Toolbar } from "./Toolbar";
|
|
27
27
|
import { compile, execute, replaceInsertCss } from "./utils";
|
|
28
28
|
import MsgBox from "../../pages/AIPlayground/components/MsgBox";
|
|
29
|
+
import { ClearOutlined } from '@ant-design/icons';
|
|
29
30
|
loader.config({
|
|
30
31
|
'vs/nls': {
|
|
31
32
|
availableLanguages: {
|
|
@@ -57,7 +58,11 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
57
58
|
_ref$onError = _ref.onError,
|
|
58
59
|
onError = _ref$onError === void 0 ? noop : _ref$onError,
|
|
59
60
|
_ref$onFullscreen = _ref.onFullscreen,
|
|
60
|
-
onFullscreen = _ref$onFullscreen === void 0 ? noop : _ref$onFullscreen
|
|
61
|
+
onFullscreen = _ref$onFullscreen === void 0 ? noop : _ref$onFullscreen,
|
|
62
|
+
_ref$showAI = _ref.showAI,
|
|
63
|
+
showAI = _ref$showAI === void 0 ? true : _ref$showAI,
|
|
64
|
+
style = _ref.style;
|
|
65
|
+
var umiLocation = useLocation();
|
|
61
66
|
var locale = useLocale();
|
|
62
67
|
var _useSiteData = useSiteData(),
|
|
63
68
|
themeConfig = _useSiteData.themeConfig;
|
|
@@ -104,8 +109,12 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
104
109
|
setCurrentEditorTab = _useState12[1];
|
|
105
110
|
var _useState13 = useState(false),
|
|
106
111
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
107
|
-
|
|
108
|
-
|
|
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];
|
|
109
118
|
var containerId = "playgroundScriptContainer_".concat(exampleId);
|
|
110
119
|
|
|
111
120
|
// 出发 auto resize
|
|
@@ -281,7 +290,7 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
281
290
|
// 用于更新当前 example 的 spec 和 data
|
|
282
291
|
useEffect(function () {
|
|
283
292
|
setCurrentEditorTab(EDITOR_TABS.JAVASCRIPT);
|
|
284
|
-
|
|
293
|
+
setShowAIDrawer(false);
|
|
285
294
|
}, [exampleId]);
|
|
286
295
|
|
|
287
296
|
// hook 用户的数据
|
|
@@ -385,13 +394,14 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
385
394
|
}
|
|
386
395
|
};
|
|
387
396
|
var onClickAI = function onClickAI() {
|
|
388
|
-
|
|
397
|
+
setShowAIDrawer(true);
|
|
389
398
|
};
|
|
390
399
|
var onReload = function onReload() {
|
|
391
400
|
setCode(source);
|
|
392
401
|
};
|
|
393
402
|
return /*#__PURE__*/React.createElement("div", {
|
|
394
|
-
className: styles.editor
|
|
403
|
+
className: styles.editor,
|
|
404
|
+
style: style
|
|
395
405
|
}, /*#__PURE__*/React.createElement(Toolbar, {
|
|
396
406
|
fileExtension: fileExtension,
|
|
397
407
|
sourceCode: code,
|
|
@@ -407,6 +417,7 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
407
417
|
onEditorTabChange: onTabChange,
|
|
408
418
|
onToggleFullscreen: onFullscreen,
|
|
409
419
|
onClickAI: onClickAI,
|
|
420
|
+
showAI: showAI,
|
|
410
421
|
onReload: onReload,
|
|
411
422
|
slots: {
|
|
412
423
|
Spec: /*#__PURE__*/React.createElement("span", {
|
|
@@ -460,16 +471,27 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
460
471
|
monacoRef.current = editor;
|
|
461
472
|
}
|
|
462
473
|
}), /*#__PURE__*/React.createElement(Drawer, {
|
|
463
|
-
placement: "right",
|
|
464
474
|
closable: true,
|
|
465
|
-
open:
|
|
475
|
+
open: showAIDrawer,
|
|
466
476
|
getContainer: false,
|
|
467
477
|
onClose: function onClose() {
|
|
468
|
-
return
|
|
478
|
+
return setShowAIDrawer(false);
|
|
469
479
|
},
|
|
470
480
|
rootClassName: styles.drawer,
|
|
471
|
-
width: '
|
|
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)))
|
|
472
493
|
}, /*#__PURE__*/React.createElement(MsgBox, {
|
|
494
|
+
key: "".concat(umiLocation.hash, "_").concat(umiLocation.key, "_").concat(msgBoxKey),
|
|
473
495
|
simple: true,
|
|
474
496
|
messages: [{
|
|
475
497
|
id: crypto.randomUUID(),
|
|
@@ -12,18 +12,20 @@
|
|
|
12
12
|
|
|
13
13
|
.drawer{
|
|
14
14
|
margin-top: 36px;
|
|
15
|
+
|
|
15
16
|
:global {
|
|
16
17
|
.ant-drawer-content {
|
|
17
18
|
background: #f8f9fc;
|
|
19
|
+
|
|
18
20
|
div.ant-drawer-header {
|
|
19
21
|
padding-bottom: unset;
|
|
20
22
|
border-bottom: unset;
|
|
21
|
-
flex-direction: row-reverse;
|
|
22
23
|
|
|
23
24
|
.ant-drawer-header-title {
|
|
24
25
|
flex: unset;
|
|
25
26
|
}
|
|
26
27
|
}
|
|
28
|
+
|
|
27
29
|
.ant-drawer-body{
|
|
28
30
|
display: flex;
|
|
29
31
|
flex-direction: column;
|
|
@@ -75,7 +75,8 @@ export function getStackblitzConfig(title, sourceCode, fileExtension, deps, devD
|
|
|
75
75
|
return {
|
|
76
76
|
title: title || '',
|
|
77
77
|
description: '',
|
|
78
|
-
|
|
78
|
+
// https://developer.stackblitz.com/platform/api/javascript-sdk-options#projecttemplate
|
|
79
|
+
template: playground.template || 'typescript',
|
|
79
80
|
dependencies: deps,
|
|
80
81
|
files: _defineProperty(_defineProperty({}, "index.".concat(fileExtension.startsWith('ts') ? 'ts' : 'js'), sourceCode), 'index.html', playground.container || '<div id="container" />')
|
|
81
82
|
};
|
|
@@ -32,7 +32,11 @@ var CodeRunner = function CodeRunner(_ref) {
|
|
|
32
32
|
replaceId = _ref.replaceId,
|
|
33
33
|
isPlayground = _ref.isPlayground,
|
|
34
34
|
_ref$notFound = _ref.notFound,
|
|
35
|
-
notFound = _ref$notFound === void 0 ? /*#__PURE__*/React.createElement(NotFound, null) : _ref$notFound
|
|
35
|
+
notFound = _ref$notFound === void 0 ? /*#__PURE__*/React.createElement(NotFound, null) : _ref$notFound,
|
|
36
|
+
_ref$showAI = _ref.showAI,
|
|
37
|
+
showAI = _ref$showAI === void 0 ? true : _ref$showAI,
|
|
38
|
+
_ref$showEditor = _ref.showEditor,
|
|
39
|
+
showEditor = _ref$showEditor === void 0 ? true : _ref$showEditor;
|
|
36
40
|
var demoInfo = getDemoInfo(exampleTopics, topic, example, demo);
|
|
37
41
|
|
|
38
42
|
// 找不到,啥也别干了,404 页面
|
|
@@ -59,18 +63,13 @@ var CodeRunner = function CodeRunner(_ref) {
|
|
|
59
63
|
githubUrl: githubUrl
|
|
60
64
|
});
|
|
61
65
|
var exampleId = "".concat(topic, "_").concat(example, "_").concat(demo);
|
|
62
|
-
|
|
63
|
-
fallback: null
|
|
64
|
-
}, /*#__PURE__*/React.createElement(SplitPane, {
|
|
65
|
-
split: "vertical",
|
|
66
|
-
defaultSize: "".concat((1 - size) * 100, "%"),
|
|
67
|
-
minSize: 100
|
|
68
|
-
}, /*#__PURE__*/React.createElement(CodePreview, {
|
|
66
|
+
var codePreview = /*#__PURE__*/React.createElement(CodePreview, {
|
|
69
67
|
exampleId: exampleId,
|
|
70
68
|
error: error,
|
|
71
69
|
header: header,
|
|
72
70
|
isPlayground: isPlayground
|
|
73
|
-
})
|
|
71
|
+
});
|
|
72
|
+
var codeEditor = /*#__PURE__*/React.createElement(ClientOnly, null, /*#__PURE__*/React.createElement(CodeEditor, {
|
|
74
73
|
exampleId: exampleId,
|
|
75
74
|
source: source,
|
|
76
75
|
relativePath: relativePath,
|
|
@@ -80,7 +79,20 @@ var CodeRunner = function CodeRunner(_ref) {
|
|
|
80
79
|
onDestroy: noop,
|
|
81
80
|
onReady: noop,
|
|
82
81
|
playground: playground,
|
|
83
|
-
title: ic(title)
|
|
84
|
-
|
|
82
|
+
title: ic(title),
|
|
83
|
+
showAI: showAI,
|
|
84
|
+
style: {
|
|
85
|
+
display: showEditor ? 'block' : 'none'
|
|
86
|
+
}
|
|
87
|
+
}));
|
|
88
|
+
return /*#__PURE__*/React.createElement(InViewSuspense, {
|
|
89
|
+
fallback: null
|
|
90
|
+
},
|
|
91
|
+
// @ts-ignore
|
|
92
|
+
showEditor ? /*#__PURE__*/React.createElement(SplitPane, {
|
|
93
|
+
split: "vertical",
|
|
94
|
+
defaultSize: "".concat((1 - size) * 100, "%"),
|
|
95
|
+
minSize: 100
|
|
96
|
+
}, codePreview, codeEditor) : /*#__PURE__*/React.createElement(React.Fragment, null, codePreview, codeEditor));
|
|
85
97
|
};
|
|
86
98
|
export default CodeRunner;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
.news {
|
|
2
2
|
width: 50%;
|
|
3
3
|
margin-right: 2%;
|
|
4
|
-
background-color: #
|
|
4
|
+
background-color: #fff;
|
|
5
5
|
border: 1px solid #e5e8ef;
|
|
6
|
-
box-shadow: 0 8px 28px 0 rgba(0, 0, 0,
|
|
6
|
+
box-shadow: 0 8px 28px 0 rgba(0, 0, 0, 5%);
|
|
7
7
|
border-radius: 16px;
|
|
8
8
|
height: 100%;
|
|
9
9
|
font-size: 14px;
|
|
@@ -91,13 +91,13 @@
|
|
|
91
91
|
@keyframes showAndHide0 {
|
|
92
92
|
0% {
|
|
93
93
|
opacity: 1;
|
|
94
|
-
top:
|
|
94
|
+
top: 0;
|
|
95
95
|
z-index: 1;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
33.3% {
|
|
99
99
|
opacity: 0;
|
|
100
|
-
top:
|
|
100
|
+
top: 0;
|
|
101
101
|
z-index: 0;
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
|
|
110
110
|
100% {
|
|
111
111
|
opacity: 1;
|
|
112
|
-
top:
|
|
112
|
+
top: 0;
|
|
113
113
|
z-index: 1;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -123,13 +123,13 @@
|
|
|
123
123
|
|
|
124
124
|
33.3% {
|
|
125
125
|
opacity: 1;
|
|
126
|
-
top:
|
|
126
|
+
top: 0;
|
|
127
127
|
z-index: 1;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
66.6% {
|
|
131
131
|
opacity: 0;
|
|
132
|
-
top:
|
|
132
|
+
top: 0;
|
|
133
133
|
z-index: 0;
|
|
134
134
|
}
|
|
135
135
|
|
|
@@ -155,13 +155,13 @@
|
|
|
155
155
|
|
|
156
156
|
66.6% {
|
|
157
157
|
opacity: 1;
|
|
158
|
-
top:
|
|
158
|
+
top: 0;
|
|
159
159
|
z-index: 1;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
100% {
|
|
163
163
|
opacity: 0;
|
|
164
|
-
top:
|
|
164
|
+
top: 0;
|
|
165
165
|
z-index: 0;
|
|
166
166
|
}
|
|
167
167
|
}
|
|
@@ -23,6 +23,7 @@ import { News } from "./News";
|
|
|
23
23
|
import { ic } from "../hooks";
|
|
24
24
|
import styles from "./index.module.less";
|
|
25
25
|
import { HomeDialog } from "../../components/AI/HomeDialog";
|
|
26
|
+
import { getBaseSiteDataUrl } from "../../utils/env";
|
|
26
27
|
/**
|
|
27
28
|
* Index.技术栈的描述区域!
|
|
28
29
|
* 各自配置
|
|
@@ -48,7 +49,7 @@ export var Detail = function Detail(_ref) {
|
|
|
48
49
|
setRemoteNews = _useState2[1];
|
|
49
50
|
var lang = useLocale().id;
|
|
50
51
|
useEffect(function () {
|
|
51
|
-
fetch(
|
|
52
|
+
fetch("".concat(getBaseSiteDataUrl(), "/antv/banner-messages.json") // 生产环境
|
|
52
53
|
// 'https://site-data-pre.alipay.com/antv/banner-messages.json', // 预发测试
|
|
53
54
|
).then(function (res) {
|
|
54
55
|
return res.json();
|