@midscene/visualizer 0.28.9-beta-20250916162508.0 → 0.28.9-beta-20250917052636.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.
@@ -0,0 +1,32 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { GithubOutlined, QuestionCircleOutlined } from "@ant-design/icons";
3
+ import { Typography } from "antd";
4
+ import { EnvConfig } from "../env-config/index.mjs";
5
+ import "./style.css";
6
+ function NavActions(param) {
7
+ let { showEnvConfig = true, showTooltipWhenEmpty = false, showModelName = false, githubUrl = 'https://github.com/web-infra-dev/midscene', helpUrl = 'https://midscenejs.com/quick-experience.html', className = '' } = param;
8
+ return /*#__PURE__*/ jsxs("div", {
9
+ className: `nav-actions ${className}`,
10
+ children: [
11
+ /*#__PURE__*/ jsx(Typography.Link, {
12
+ href: githubUrl,
13
+ target: "_blank",
14
+ children: /*#__PURE__*/ jsx(GithubOutlined, {
15
+ className: "nav-icon"
16
+ })
17
+ }),
18
+ /*#__PURE__*/ jsx(Typography.Link, {
19
+ href: helpUrl,
20
+ target: "_blank",
21
+ children: /*#__PURE__*/ jsx(QuestionCircleOutlined, {
22
+ className: "nav-icon"
23
+ })
24
+ }),
25
+ showEnvConfig && /*#__PURE__*/ jsx(EnvConfig, {
26
+ showTooltipWhenEmpty: showTooltipWhenEmpty,
27
+ showModelName: showModelName
28
+ })
29
+ ]
30
+ });
31
+ }
32
+ export { NavActions };
@@ -0,0 +1,35 @@
1
+ .nav-actions {
2
+ align-items: center;
3
+ gap: 8px;
4
+ display: flex;
5
+ }
6
+
7
+ .nav-actions .nav-icon {
8
+ color: rgba(0, 0, 0, .65);
9
+ cursor: pointer;
10
+ font-size: 16px;
11
+ transition: color .3s;
12
+ }
13
+
14
+ .nav-actions .nav-icon:hover {
15
+ color: #2b83ff;
16
+ }
17
+
18
+ .nav-actions a {
19
+ align-items: center;
20
+ text-decoration: none;
21
+ display: flex;
22
+ }
23
+
24
+ .nav-actions a:hover .nav-icon {
25
+ color: #2b83ff;
26
+ }
27
+
28
+ [data-theme="dark"] .nav-actions .nav-icon {
29
+ color: rgba(255, 255, 255, .65);
30
+ }
31
+
32
+ [data-theme="dark"] .nav-actions .nav-icon:hover {
33
+ color: #2b83ff;
34
+ }
35
+
@@ -44,21 +44,34 @@
44
44
  }
45
45
 
46
46
  .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group {
47
- scrollbar-width: none;
48
- -ms-overflow-style: none;
47
+ scrollbar-width: thin;
49
48
  flex: 1;
50
49
  align-items: center;
51
50
  gap: 8px;
52
51
  min-width: 0;
53
52
  height: 100%;
54
- margin-right: 80px;
53
+ margin-right: 60px;
55
54
  display: flex;
56
55
  overflow-x: auto;
57
56
  overflow-y: hidden;
58
57
  }
59
58
 
60
59
  .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group::-webkit-scrollbar {
61
- display: none;
60
+ height: 6px;
61
+ }
62
+
63
+ .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group::-webkit-scrollbar-track {
64
+ background: #f1f1f1;
65
+ border-radius: 3px;
66
+ }
67
+
68
+ .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group::-webkit-scrollbar-thumb {
69
+ background: #c1c1c1;
70
+ border-radius: 3px;
71
+ }
72
+
73
+ .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group::-webkit-scrollbar-thumb:hover {
74
+ background: #a8a8a8;
62
75
  }
63
76
 
64
77
  .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group .ant-form-item {
@@ -146,10 +159,11 @@
146
159
 
147
160
  .prompt-input-wrapper .mode-radio-group-wrapper .action-icons {
148
161
  z-index: 10;
149
- background: #fff;
162
+ background: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(255, 255, 255, .5) 20%, rgba(255, 255, 255, .8) 40%, rgba(255, 255, 255, .95) 60%, #fff 70%);
150
163
  flex-shrink: 0;
151
164
  align-items: center;
152
- padding-left: 8px;
165
+ width: 80px;
166
+ padding-left: 20px;
153
167
  display: flex;
154
168
  position: absolute;
155
169
  top: 50%;
@@ -10,21 +10,34 @@
10
10
  }
11
11
 
12
12
  .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group {
13
- scrollbar-width: none;
14
- -ms-overflow-style: none;
13
+ scrollbar-width: thin;
15
14
  flex: 1;
16
15
  align-items: center;
17
16
  gap: 8px;
18
17
  min-width: 0;
19
18
  height: 100%;
20
- margin-right: 80px;
19
+ margin-right: 60px;
21
20
  display: flex;
22
21
  overflow-x: auto;
23
22
  overflow-y: hidden;
24
23
  }
25
24
 
26
25
  .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group::-webkit-scrollbar {
27
- display: none;
26
+ height: 6px;
27
+ }
28
+
29
+ .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group::-webkit-scrollbar-track {
30
+ background: #f1f1f1;
31
+ border-radius: 3px;
32
+ }
33
+
34
+ .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group::-webkit-scrollbar-thumb {
35
+ background: #c1c1c1;
36
+ border-radius: 3px;
37
+ }
38
+
39
+ .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group::-webkit-scrollbar-thumb:hover {
40
+ background: #a8a8a8;
28
41
  }
29
42
 
30
43
  .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group .ant-form-item {
@@ -112,10 +125,11 @@
112
125
 
113
126
  .prompt-input-wrapper .mode-radio-group-wrapper .action-icons {
114
127
  z-index: 10;
115
- background: #fff;
128
+ background: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(255, 255, 255, .5) 20%, rgba(255, 255, 255, .8) 40%, rgba(255, 255, 255, .95) 60%, #fff 70%);
116
129
  flex-shrink: 0;
117
130
  align-items: center;
118
- padding-left: 8px;
131
+ width: 80px;
132
+ padding-left: 20px;
119
133
  display: flex;
120
134
  position: absolute;
121
135
  top: 50%;
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { BorderOutlined, DownOutlined, SendOutlined } from "@ant-design/icons";
3
3
  import "./index.css";
4
- import { Button, Dropdown, Form, Input, Radio, Space, Tooltip } from "antd";
4
+ import { Button, Dropdown, Form, Input, Radio, Tooltip } from "antd";
5
5
  import react, { useCallback, useEffect, useMemo, useRef, useState } from "react";
6
6
  import { useHistoryStore } from "../../store/history.mjs";
7
7
  import { extractDefaultValue, isLocateField, isZodObjectSchema, unwrapZodType } from "../../types.mjs";
@@ -17,6 +17,7 @@ const PromptInput = (param)=>{
17
17
  const [promptValue, setPromptValue] = useState('');
18
18
  const placeholder = getPlaceholderForType(selectedType);
19
19
  const textAreaRef = useRef(null);
20
+ const modeRadioGroupRef = useRef(null);
20
21
  const params = Form.useWatch('params', form);
21
22
  const lastHistoryRef = useRef(null);
22
23
  const history = useHistoryStore((state)=>state.history);
@@ -160,6 +161,27 @@ const PromptInput = (param)=>{
160
161
  lastSelectedType,
161
162
  setLastSelectedType
162
163
  ]);
164
+ const scrollToSelectedItem = useCallback(()=>{
165
+ const container = modeRadioGroupRef.current;
166
+ if (!container) return;
167
+ let targetElement = null;
168
+ const selectedRadioButton = container.querySelector('.ant-radio-button-wrapper-checked');
169
+ const dropdownButton = container.querySelector('.more-apis-button.selected-from-dropdown');
170
+ if (selectedRadioButton) targetElement = selectedRadioButton;
171
+ else if (dropdownButton) targetElement = dropdownButton;
172
+ if (targetElement) {
173
+ const containerRect = container.getBoundingClientRect();
174
+ const targetRect = targetElement.getBoundingClientRect();
175
+ const targetLeft = targetRect.left - containerRect.left + container.scrollLeft;
176
+ const targetWidth = targetRect.width;
177
+ const containerWidth = containerRect.width;
178
+ const optimalScrollLeft = targetLeft - (containerWidth - targetWidth) / 2;
179
+ container.scrollTo({
180
+ left: Math.max(0, optimalScrollLeft),
181
+ behavior: 'smooth'
182
+ });
183
+ }
184
+ }, []);
163
185
  useEffect(()=>{
164
186
  const lastHistory = historyForSelectedType[0];
165
187
  if (lastHistory && lastHistoryRef.current && lastHistory.timestamp === lastHistoryRef.current.timestamp) return;
@@ -186,6 +208,15 @@ const PromptInput = (param)=>{
186
208
  form,
187
209
  getDefaultParams
188
210
  ]);
211
+ useEffect(()=>{
212
+ const timeoutId = setTimeout(()=>{
213
+ scrollToSelectedItem();
214
+ }, 100);
215
+ return ()=>clearTimeout(timeoutId);
216
+ }, [
217
+ selectedType,
218
+ scrollToSelectedItem
219
+ ]);
189
220
  const formPromptValue = Form.useWatch('prompt', form);
190
221
  useEffect(()=>{
191
222
  if (formPromptValue !== promptValue) setPromptValue(formPromptValue || '');
@@ -501,11 +532,12 @@ const PromptInput = (param)=>{
501
532
  return /*#__PURE__*/ jsxs("div", {
502
533
  className: "prompt-input-wrapper",
503
534
  children: [
504
- /*#__PURE__*/ jsxs(Space, {
535
+ /*#__PURE__*/ jsxs("div", {
505
536
  className: "mode-radio-group-wrapper",
506
537
  children: [
507
538
  /*#__PURE__*/ jsxs("div", {
508
539
  className: "mode-radio-group",
540
+ ref: modeRadioGroupRef,
509
541
  children: [
510
542
  /*#__PURE__*/ jsx(Form.Item, {
511
543
  name: "type",
package/dist/es/index.mjs CHANGED
@@ -5,6 +5,7 @@ import { useEnvConfig } from "./store/store.mjs";
5
5
  import { colorForName, globalThemeConfig, highlightColorForType } from "./utils/color.mjs";
6
6
  import { EnvConfig } from "./component/env-config/index.mjs";
7
7
  import { EnvConfigReminder } from "./component/env-config-reminder/index.mjs";
8
+ import { NavActions } from "./component/nav-actions/index.mjs";
8
9
  import { Logo } from "./component/logo/index.mjs";
9
10
  import { iconForStatus, timeCostStrElement } from "./component/misc/index.mjs";
10
11
  import { useServerValid } from "./hooks/useServerValid.mjs";
@@ -15,11 +16,10 @@ import { ContextPreview } from "./component/context-preview/index.mjs";
15
16
  import { PromptInput } from "./component/prompt-input/index.mjs";
16
17
  import { Player } from "./component/player/index.mjs";
17
18
  import { Blackboard } from "./component/blackboard/index.mjs";
18
- import { GithubStar } from "./component/github-star/index.mjs";
19
19
  import { actionNameForType, getPlaceholderForType, staticAgentFromContext } from "./utils/playground-utils.mjs";
20
20
  import { filterBase64Value, timeStr } from "./utils/index.mjs";
21
21
  import shiny_text from "./component/shiny-text/index.mjs";
22
22
  import universal_playground, { UniversalPlayground } from "./component/universal-playground/index.mjs";
23
23
  import { LocalStorageProvider, MemoryStorageProvider, NoOpStorageProvider } from "./component/universal-playground/providers/storage-provider.mjs";
24
24
  import { AgentContextProvider, BaseContextProvider, NoOpContextProvider, StaticContextProvider } from "./component/universal-playground/providers/context-provider.mjs";
25
- export { AgentContextProvider, BaseContextProvider, Blackboard, ContextPreview, EnvConfig, EnvConfigReminder, GithubStar, LocalStorageProvider, Logo, MemoryStorageProvider, NoOpContextProvider, NoOpStorageProvider, Player, PlaygroundResultView, PromptInput, ServiceModeControl, shiny_text as ShinyText, StaticContextProvider, UniversalPlayground, universal_playground as UniversalPlaygroundDefault, actionNameForType, allScriptsFromDump, colorForName, filterBase64Value, generateAnimationScripts, getPlaceholderForType, globalThemeConfig, highlightColorForType, iconForStatus, safeOverrideAIConfig, staticAgentFromContext, timeCostStrElement, timeStr, useEnvConfig, useSafeOverrideAIConfig, useServerValid };
25
+ export { AgentContextProvider, BaseContextProvider, Blackboard, ContextPreview, EnvConfig, EnvConfigReminder, LocalStorageProvider, Logo, MemoryStorageProvider, NavActions, NoOpContextProvider, NoOpStorageProvider, Player, PlaygroundResultView, PromptInput, ServiceModeControl, shiny_text as ShinyText, StaticContextProvider, UniversalPlayground, universal_playground as UniversalPlaygroundDefault, actionNameForType, allScriptsFromDump, colorForName, filterBase64Value, generateAnimationScripts, getPlaceholderForType, globalThemeConfig, highlightColorForType, iconForStatus, safeOverrideAIConfig, staticAgentFromContext, timeCostStrElement, timeStr, useEnvConfig, useSafeOverrideAIConfig, useServerValid };
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ NavActions: ()=>NavActions
28
+ });
29
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
+ const icons_namespaceObject = require("@ant-design/icons");
31
+ const external_antd_namespaceObject = require("antd");
32
+ const index_js_namespaceObject = require("../env-config/index.js");
33
+ require("./style.css");
34
+ function NavActions(param) {
35
+ let { showEnvConfig = true, showTooltipWhenEmpty = false, showModelName = false, githubUrl = 'https://github.com/web-infra-dev/midscene', helpUrl = 'https://midscenejs.com/quick-experience.html', className = '' } = param;
36
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
37
+ className: `nav-actions ${className}`,
38
+ children: [
39
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Typography.Link, {
40
+ href: githubUrl,
41
+ target: "_blank",
42
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.GithubOutlined, {
43
+ className: "nav-icon"
44
+ })
45
+ }),
46
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Typography.Link, {
47
+ href: helpUrl,
48
+ target: "_blank",
49
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.QuestionCircleOutlined, {
50
+ className: "nav-icon"
51
+ })
52
+ }),
53
+ showEnvConfig && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.EnvConfig, {
54
+ showTooltipWhenEmpty: showTooltipWhenEmpty,
55
+ showModelName: showModelName
56
+ })
57
+ ]
58
+ });
59
+ }
60
+ exports.NavActions = __webpack_exports__.NavActions;
61
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
62
+ "NavActions"
63
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
64
+ Object.defineProperty(exports, '__esModule', {
65
+ value: true
66
+ });
@@ -0,0 +1,35 @@
1
+ .nav-actions {
2
+ align-items: center;
3
+ gap: 8px;
4
+ display: flex;
5
+ }
6
+
7
+ .nav-actions .nav-icon {
8
+ color: rgba(0, 0, 0, .65);
9
+ cursor: pointer;
10
+ font-size: 16px;
11
+ transition: color .3s;
12
+ }
13
+
14
+ .nav-actions .nav-icon:hover {
15
+ color: #2b83ff;
16
+ }
17
+
18
+ .nav-actions a {
19
+ align-items: center;
20
+ text-decoration: none;
21
+ display: flex;
22
+ }
23
+
24
+ .nav-actions a:hover .nav-icon {
25
+ color: #2b83ff;
26
+ }
27
+
28
+ [data-theme="dark"] .nav-actions .nav-icon {
29
+ color: rgba(255, 255, 255, .65);
30
+ }
31
+
32
+ [data-theme="dark"] .nav-actions .nav-icon:hover {
33
+ color: #2b83ff;
34
+ }
35
+
@@ -44,21 +44,34 @@
44
44
  }
45
45
 
46
46
  .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group {
47
- scrollbar-width: none;
48
- -ms-overflow-style: none;
47
+ scrollbar-width: thin;
49
48
  flex: 1;
50
49
  align-items: center;
51
50
  gap: 8px;
52
51
  min-width: 0;
53
52
  height: 100%;
54
- margin-right: 80px;
53
+ margin-right: 60px;
55
54
  display: flex;
56
55
  overflow-x: auto;
57
56
  overflow-y: hidden;
58
57
  }
59
58
 
60
59
  .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group::-webkit-scrollbar {
61
- display: none;
60
+ height: 6px;
61
+ }
62
+
63
+ .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group::-webkit-scrollbar-track {
64
+ background: #f1f1f1;
65
+ border-radius: 3px;
66
+ }
67
+
68
+ .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group::-webkit-scrollbar-thumb {
69
+ background: #c1c1c1;
70
+ border-radius: 3px;
71
+ }
72
+
73
+ .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group::-webkit-scrollbar-thumb:hover {
74
+ background: #a8a8a8;
62
75
  }
63
76
 
64
77
  .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group .ant-form-item {
@@ -146,10 +159,11 @@
146
159
 
147
160
  .prompt-input-wrapper .mode-radio-group-wrapper .action-icons {
148
161
  z-index: 10;
149
- background: #fff;
162
+ background: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(255, 255, 255, .5) 20%, rgba(255, 255, 255, .8) 40%, rgba(255, 255, 255, .95) 60%, #fff 70%);
150
163
  flex-shrink: 0;
151
164
  align-items: center;
152
- padding-left: 8px;
165
+ width: 80px;
166
+ padding-left: 20px;
153
167
  display: flex;
154
168
  position: absolute;
155
169
  top: 50%;
@@ -10,21 +10,34 @@
10
10
  }
11
11
 
12
12
  .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group {
13
- scrollbar-width: none;
14
- -ms-overflow-style: none;
13
+ scrollbar-width: thin;
15
14
  flex: 1;
16
15
  align-items: center;
17
16
  gap: 8px;
18
17
  min-width: 0;
19
18
  height: 100%;
20
- margin-right: 80px;
19
+ margin-right: 60px;
21
20
  display: flex;
22
21
  overflow-x: auto;
23
22
  overflow-y: hidden;
24
23
  }
25
24
 
26
25
  .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group::-webkit-scrollbar {
27
- display: none;
26
+ height: 6px;
27
+ }
28
+
29
+ .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group::-webkit-scrollbar-track {
30
+ background: #f1f1f1;
31
+ border-radius: 3px;
32
+ }
33
+
34
+ .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group::-webkit-scrollbar-thumb {
35
+ background: #c1c1c1;
36
+ border-radius: 3px;
37
+ }
38
+
39
+ .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group::-webkit-scrollbar-thumb:hover {
40
+ background: #a8a8a8;
28
41
  }
29
42
 
30
43
  .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group .ant-form-item {
@@ -112,10 +125,11 @@
112
125
 
113
126
  .prompt-input-wrapper .mode-radio-group-wrapper .action-icons {
114
127
  z-index: 10;
115
- background: #fff;
128
+ background: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(255, 255, 255, .5) 20%, rgba(255, 255, 255, .8) 40%, rgba(255, 255, 255, .95) 60%, #fff 70%);
116
129
  flex-shrink: 0;
117
130
  align-items: center;
118
- padding-left: 8px;
131
+ width: 80px;
132
+ padding-left: 20px;
119
133
  display: flex;
120
134
  position: absolute;
121
135
  top: 50%;
@@ -55,6 +55,7 @@ const PromptInput = (param)=>{
55
55
  const [promptValue, setPromptValue] = (0, external_react_namespaceObject.useState)('');
56
56
  const placeholder = (0, playground_utils_js_namespaceObject.getPlaceholderForType)(selectedType);
57
57
  const textAreaRef = (0, external_react_namespaceObject.useRef)(null);
58
+ const modeRadioGroupRef = (0, external_react_namespaceObject.useRef)(null);
58
59
  const params = external_antd_namespaceObject.Form.useWatch('params', form);
59
60
  const lastHistoryRef = (0, external_react_namespaceObject.useRef)(null);
60
61
  const history = (0, history_js_namespaceObject.useHistoryStore)((state)=>state.history);
@@ -198,6 +199,27 @@ const PromptInput = (param)=>{
198
199
  lastSelectedType,
199
200
  setLastSelectedType
200
201
  ]);
202
+ const scrollToSelectedItem = (0, external_react_namespaceObject.useCallback)(()=>{
203
+ const container = modeRadioGroupRef.current;
204
+ if (!container) return;
205
+ let targetElement = null;
206
+ const selectedRadioButton = container.querySelector('.ant-radio-button-wrapper-checked');
207
+ const dropdownButton = container.querySelector('.more-apis-button.selected-from-dropdown');
208
+ if (selectedRadioButton) targetElement = selectedRadioButton;
209
+ else if (dropdownButton) targetElement = dropdownButton;
210
+ if (targetElement) {
211
+ const containerRect = container.getBoundingClientRect();
212
+ const targetRect = targetElement.getBoundingClientRect();
213
+ const targetLeft = targetRect.left - containerRect.left + container.scrollLeft;
214
+ const targetWidth = targetRect.width;
215
+ const containerWidth = containerRect.width;
216
+ const optimalScrollLeft = targetLeft - (containerWidth - targetWidth) / 2;
217
+ container.scrollTo({
218
+ left: Math.max(0, optimalScrollLeft),
219
+ behavior: 'smooth'
220
+ });
221
+ }
222
+ }, []);
201
223
  (0, external_react_namespaceObject.useEffect)(()=>{
202
224
  const lastHistory = historyForSelectedType[0];
203
225
  if (lastHistory && lastHistoryRef.current && lastHistory.timestamp === lastHistoryRef.current.timestamp) return;
@@ -224,6 +246,15 @@ const PromptInput = (param)=>{
224
246
  form,
225
247
  getDefaultParams
226
248
  ]);
249
+ (0, external_react_namespaceObject.useEffect)(()=>{
250
+ const timeoutId = setTimeout(()=>{
251
+ scrollToSelectedItem();
252
+ }, 100);
253
+ return ()=>clearTimeout(timeoutId);
254
+ }, [
255
+ selectedType,
256
+ scrollToSelectedItem
257
+ ]);
227
258
  const formPromptValue = external_antd_namespaceObject.Form.useWatch('prompt', form);
228
259
  (0, external_react_namespaceObject.useEffect)(()=>{
229
260
  if (formPromptValue !== promptValue) setPromptValue(formPromptValue || '');
@@ -539,11 +570,12 @@ const PromptInput = (param)=>{
539
570
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
540
571
  className: "prompt-input-wrapper",
541
572
  children: [
542
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_antd_namespaceObject.Space, {
573
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
543
574
  className: "mode-radio-group-wrapper",
544
575
  children: [
545
576
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
546
577
  className: "mode-radio-group",
578
+ ref: modeRadioGroupRef,
547
579
  children: [
548
580
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Form.Item, {
549
581
  name: "type",
package/dist/lib/index.js CHANGED
@@ -51,9 +51,9 @@ __webpack_require__.d(__webpack_exports__, {
51
51
  BaseContextProvider: ()=>context_provider_js_namespaceObject.BaseContextProvider,
52
52
  colorForName: ()=>color_js_namespaceObject.colorForName,
53
53
  safeOverrideAIConfig: ()=>useSafeOverrideAIConfig_js_namespaceObject.safeOverrideAIConfig,
54
- GithubStar: ()=>github_star_index_js_namespaceObject.GithubStar,
55
54
  Logo: ()=>logo_index_js_namespaceObject.Logo,
56
55
  UniversalPlayground: ()=>universal_playground_index_js_namespaceObject.UniversalPlayground,
56
+ NavActions: ()=>nav_actions_index_js_namespaceObject.NavActions,
57
57
  useEnvConfig: ()=>store_js_namespaceObject.useEnvConfig,
58
58
  NoOpStorageProvider: ()=>storage_provider_js_namespaceObject.NoOpStorageProvider,
59
59
  ContextPreview: ()=>context_preview_index_js_namespaceObject.ContextPreview,
@@ -77,6 +77,7 @@ const store_js_namespaceObject = require("./store/store.js");
77
77
  const color_js_namespaceObject = require("./utils/color.js");
78
78
  const index_js_namespaceObject = require("./component/env-config/index.js");
79
79
  const env_config_reminder_index_js_namespaceObject = require("./component/env-config-reminder/index.js");
80
+ const nav_actions_index_js_namespaceObject = require("./component/nav-actions/index.js");
80
81
  const logo_index_js_namespaceObject = require("./component/logo/index.js");
81
82
  const misc_index_js_namespaceObject = require("./component/misc/index.js");
82
83
  const useServerValid_js_namespaceObject = require("./hooks/useServerValid.js");
@@ -87,7 +88,6 @@ const context_preview_index_js_namespaceObject = require("./component/context-pr
87
88
  const prompt_input_index_js_namespaceObject = require("./component/prompt-input/index.js");
88
89
  const player_index_js_namespaceObject = require("./component/player/index.js");
89
90
  const blackboard_index_js_namespaceObject = require("./component/blackboard/index.js");
90
- const github_star_index_js_namespaceObject = require("./component/github-star/index.js");
91
91
  const playground_utils_js_namespaceObject = require("./utils/playground-utils.js");
92
92
  const external_utils_index_js_namespaceObject = require("./utils/index.js");
93
93
  const shiny_text_index_js_namespaceObject = require("./component/shiny-text/index.js");
@@ -102,10 +102,10 @@ exports.Blackboard = __webpack_exports__.Blackboard;
102
102
  exports.ContextPreview = __webpack_exports__.ContextPreview;
103
103
  exports.EnvConfig = __webpack_exports__.EnvConfig;
104
104
  exports.EnvConfigReminder = __webpack_exports__.EnvConfigReminder;
105
- exports.GithubStar = __webpack_exports__.GithubStar;
106
105
  exports.LocalStorageProvider = __webpack_exports__.LocalStorageProvider;
107
106
  exports.Logo = __webpack_exports__.Logo;
108
107
  exports.MemoryStorageProvider = __webpack_exports__.MemoryStorageProvider;
108
+ exports.NavActions = __webpack_exports__.NavActions;
109
109
  exports.NoOpContextProvider = __webpack_exports__.NoOpContextProvider;
110
110
  exports.NoOpStorageProvider = __webpack_exports__.NoOpStorageProvider;
111
111
  exports.Player = __webpack_exports__.Player;
@@ -139,10 +139,10 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
139
139
  "ContextPreview",
140
140
  "EnvConfig",
141
141
  "EnvConfigReminder",
142
- "GithubStar",
143
142
  "LocalStorageProvider",
144
143
  "Logo",
145
144
  "MemoryStorageProvider",
145
+ "NavActions",
146
146
  "NoOpContextProvider",
147
147
  "NoOpStorageProvider",
148
148
  "Player",
@@ -0,0 +1,10 @@
1
+ import './style.less';
2
+ export interface NavActionsProps {
3
+ showEnvConfig?: boolean;
4
+ showTooltipWhenEmpty?: boolean;
5
+ showModelName?: boolean;
6
+ githubUrl?: string;
7
+ helpUrl?: string;
8
+ className?: string;
9
+ }
10
+ export declare function NavActions({ showEnvConfig, showTooltipWhenEmpty, showModelName, githubUrl, helpUrl, className, }: NavActionsProps): import("react").JSX.Element;
@@ -5,6 +5,8 @@ export { useEnvConfig } from './store/store';
5
5
  export { colorForName, highlightColorForType, globalThemeConfig, } from './utils/color';
6
6
  export { EnvConfig } from './component/env-config';
7
7
  export { EnvConfigReminder } from './component/env-config-reminder';
8
+ export { NavActions } from './component/nav-actions';
9
+ export type { NavActionsProps } from './component/nav-actions';
8
10
  export { Logo } from './component/logo';
9
11
  export { iconForStatus, timeCostStrElement } from './component/misc';
10
12
  export { useServerValid } from './hooks/useServerValid';
@@ -16,7 +18,6 @@ export { ContextPreview } from './component/context-preview';
16
18
  export { PromptInput } from './component/prompt-input';
17
19
  export { Player } from './component/player';
18
20
  export { Blackboard } from './component/blackboard';
19
- export { GithubStar } from './component/github-star';
20
21
  export { actionNameForType, staticAgentFromContext, getPlaceholderForType, } from './utils/playground-utils';
21
22
  export { timeStr, filterBase64Value } from './utils';
22
23
  export { default as ShinyText } from './component/shiny-text';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/visualizer",
3
- "version": "0.28.9-beta-20250916162508.0",
3
+ "version": "0.28.9-beta-20250917052636.0",
4
4
  "repository": "https://github.com/web-infra-dev/midscene",
5
5
  "homepage": "https://midscenejs.com/",
6
6
  "types": "./dist/types/index.d.ts",
@@ -52,7 +52,7 @@
52
52
  "react-dom": "18.3.1",
53
53
  "react-resizable-panels": "2.0.22",
54
54
  "rimraf": "~3.0.2",
55
- "tsx": "4.19.2",
55
+ "tsx": "^4.19.2",
56
56
  "typescript": "^5.8.3",
57
57
  "zustand": "4.5.2"
58
58
  },
@@ -70,10 +70,10 @@
70
70
  "antd": "^5.21.6",
71
71
  "buffer": "6.0.3",
72
72
  "dayjs": "^1.11.11",
73
- "@midscene/core": "0.28.9-beta-20250916162508.0",
74
- "@midscene/playground": "0.28.9-beta-20250916162508.0",
75
- "@midscene/shared": "0.28.9-beta-20250916162508.0",
76
- "@midscene/web": "0.28.9-beta-20250916162508.0"
73
+ "@midscene/playground": "0.28.9-beta-20250917052636.0",
74
+ "@midscene/web": "0.28.9-beta-20250917052636.0",
75
+ "@midscene/core": "0.28.9-beta-20250917052636.0",
76
+ "@midscene/shared": "0.28.9-beta-20250917052636.0"
77
77
  },
78
78
  "license": "MIT",
79
79
  "scripts": {
@@ -1,4 +0,0 @@
1
- .github-star {
2
- height: 22px;
3
- }
4
-
@@ -1,20 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import "./index.css";
3
- const GithubStar = ()=>/*#__PURE__*/ jsx("a", {
4
- href: "https://github.com/web-infra-dev/midscene",
5
- target: "_blank",
6
- rel: "noreferrer",
7
- style: {
8
- display: 'flex',
9
- alignItems: 'center'
10
- },
11
- children: /*#__PURE__*/ jsx("img", {
12
- className: "github-star",
13
- src: "https://img.shields.io/github/stars/web-infra-dev/midscene?style=social",
14
- alt: "Github star",
15
- style: {
16
- display: 'block'
17
- }
18
- })
19
- });
20
- export { GithubStar };
@@ -1,4 +0,0 @@
1
- .github-star {
2
- height: 22px;
3
- }
4
-
@@ -1,54 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, definition)=>{
5
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
- enumerable: true,
7
- get: definition[key]
8
- });
9
- };
10
- })();
11
- (()=>{
12
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
- })();
14
- (()=>{
15
- __webpack_require__.r = (exports1)=>{
16
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
- value: 'Module'
18
- });
19
- Object.defineProperty(exports1, '__esModule', {
20
- value: true
21
- });
22
- };
23
- })();
24
- var __webpack_exports__ = {};
25
- __webpack_require__.r(__webpack_exports__);
26
- __webpack_require__.d(__webpack_exports__, {
27
- GithubStar: ()=>GithubStar
28
- });
29
- const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
- require("./index.css");
31
- const GithubStar = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("a", {
32
- href: "https://github.com/web-infra-dev/midscene",
33
- target: "_blank",
34
- rel: "noreferrer",
35
- style: {
36
- display: 'flex',
37
- alignItems: 'center'
38
- },
39
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("img", {
40
- className: "github-star",
41
- src: "https://img.shields.io/github/stars/web-infra-dev/midscene?style=social",
42
- alt: "Github star",
43
- style: {
44
- display: 'block'
45
- }
46
- })
47
- });
48
- exports.GithubStar = __webpack_exports__.GithubStar;
49
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
50
- "GithubStar"
51
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
52
- Object.defineProperty(exports, '__esModule', {
53
- value: true
54
- });
@@ -1,2 +0,0 @@
1
- import './index.less';
2
- export declare const GithubStar: () => import("react").JSX.Element;