@midscene/visualizer 0.20.2-beta-20250704091851.0 → 0.21.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.
Files changed (37) hide show
  1. package/dist/es/assets/close.909351c0.svg +4 -0
  2. package/dist/es/assets/history.164a4eab.svg +4 -0
  3. package/dist/es/assets/magnifying-glass.9498e70e.svg +12 -0
  4. package/dist/es/assets/setting.80ab7285.svg +11 -0
  5. package/dist/es/component/env-config.js +27 -9
  6. package/dist/es/component/player.css +35 -6
  7. package/dist/es/component/player.js +16 -1
  8. package/dist/es/component/playground/ConfigSelector.js +4 -21
  9. package/dist/es/component/playground/HistorySelector.js +152 -24
  10. package/dist/es/component/playground/PlaygroundResult.js +6 -4
  11. package/dist/es/component/playground/PromptInput.js +46 -29
  12. package/dist/es/component/playground/ServiceModeControl.js +1 -0
  13. package/dist/es/component/playground/index.css +199 -142
  14. package/dist/es/component/playground/playground-constants.js +2 -1
  15. package/dist/es/component/store/store.js +5 -0
  16. package/dist/index.css +234 -148
  17. package/dist/index.js +1 -1
  18. package/dist/lib/assets/close.909351c0.svg +4 -0
  19. package/dist/lib/assets/history.164a4eab.svg +4 -0
  20. package/dist/lib/assets/magnifying-glass.9498e70e.svg +12 -0
  21. package/dist/lib/assets/setting.80ab7285.svg +11 -0
  22. package/dist/lib/component/env-config.js +26 -8
  23. package/dist/lib/component/player.css +35 -6
  24. package/dist/lib/component/player.js +16 -1
  25. package/dist/lib/component/playground/ConfigSelector.js +2 -19
  26. package/dist/lib/component/playground/HistorySelector.js +150 -22
  27. package/dist/lib/component/playground/PlaygroundResult.js +6 -4
  28. package/dist/lib/component/playground/PromptInput.js +46 -29
  29. package/dist/lib/component/playground/ServiceModeControl.js +1 -0
  30. package/dist/lib/component/playground/index.css +199 -142
  31. package/dist/lib/component/playground/playground-constants.js +2 -1
  32. package/dist/lib/component/store/store.js +5 -0
  33. package/dist/types/component/env-config.d.ts +3 -1
  34. package/dist/types/component/player.d.ts +1 -0
  35. package/dist/types/component/playground/PlaygroundResult.d.ts +1 -0
  36. package/dist/types/component/store/store.d.ts +1 -0
  37. package/package.json +5 -5
@@ -72,6 +72,7 @@ const ServiceModeControl = ({
72
72
  style: {
73
73
  display: "flex",
74
74
  alignItems: "center",
75
+ justifyContent: "space-between",
75
76
  gap: "10px"
76
77
  },
77
78
  children: [
@@ -12,140 +12,20 @@ body {
12
12
  "Segoe UI Emoji";
13
13
  font-size: 14px;
14
14
  }
15
- .playground-container,
16
- .image-describer {
15
+ .prompt-input-wrapper {
17
16
  width: 100%;
18
- height: 100%;
19
- }
20
- .playground-container.vertical-mode,
21
- .image-describer.vertical-mode {
22
- height: inherit;
23
- }
24
- .playground-container.vertical-mode .form-part h3,
25
- .image-describer.vertical-mode .form-part h3 {
26
- font-size: 14px;
27
- line-height: 1.6;
28
- }
29
- .playground-container .playground-header,
30
- .image-describer .playground-header {
31
- padding: 10px 10px 30px;
32
- }
33
- .playground-container .playground-left-panel,
34
- .image-describer .playground-left-panel {
35
- width: 100%;
36
- background-color: #FFF;
37
- display: flex;
38
- flex-direction: column;
39
- justify-content: space-between;
40
- overflow-y: auto !important;
41
- }
42
- .playground-container .playground-left-panel .ant-form,
43
- .image-describer .playground-left-panel .ant-form {
44
- flex-grow: 1;
45
- display: flex;
46
- flex-direction: column;
47
- justify-content: center;
48
- }
49
- .playground-container .form-part h3,
50
- .image-describer .form-part h3 {
51
- margin-top: 0;
52
- margin-bottom: 12px;
53
- font-size: 18px;
54
17
  }
55
- .playground-container .form-part .form-sub-title,
56
- .image-describer .form-part .form-sub-title {
57
- margin-bottom: 12px;
58
- font-size: 14px;
59
- }
60
- .playground-container .form-part .switch-btn-wrapper .ant-btn,
61
- .image-describer .form-part .switch-btn-wrapper .ant-btn {
62
- padding: 0;
63
- }
64
- .playground-container .loading-container,
65
- .image-describer .loading-container {
66
- display: flex;
67
- flex-direction: column;
68
- align-items: center;
69
- box-sizing: border-box;
70
- padding: 20px 20px;
71
- }
72
- .playground-container .loading-container .loading-progress-text,
73
- .image-describer .loading-container .loading-progress-text {
74
- text-align: center;
75
- width: 100%;
76
- color: #777;
77
- margin-top: 16px;
78
- }
79
- .playground-container .loading-container .loading-progress-text-tab-info,
80
- .image-describer .loading-container .loading-progress-text-tab-info {
81
- overflow: hidden;
82
- white-space: nowrap;
83
- text-overflow: ellipsis;
84
- }
85
- .playground-container .loading-container .loading-progress-text-progress,
86
- .image-describer .loading-container .loading-progress-text-progress {
87
- height: 60px;
88
- }
89
- .playground-container .result-wrapper,
90
- .image-describer .result-wrapper {
91
- width: 100%;
92
- height: 100%;
93
- display: flex;
94
- flex-direction: column;
95
- justify-content: center;
96
- box-sizing: border-box;
97
- border-radius: 4px;
98
- flex: 1 1 auto;
99
- min-height: 0;
100
- overflow: auto;
101
- }
102
- .playground-container .result-wrapper.result-wrapper-compact,
103
- .image-describer .result-wrapper.result-wrapper-compact {
104
- padding: 0;
105
- }
106
- .playground-container .result-wrapper.vertical-mode-result,
107
- .image-describer .result-wrapper.vertical-mode-result {
108
- height: inherit;
109
- min-height: 300px;
110
- display: flex;
111
- flex-direction: column;
112
- flex: 1 1;
113
- }
114
- .playground-container .result-wrapper pre,
115
- .image-describer .result-wrapper pre {
116
- display: block;
117
- word-wrap: break-word;
118
- white-space: pre-wrap;
119
- }
120
- .playground-container .result-wrapper .result-empty-tip,
121
- .image-describer .result-wrapper .result-empty-tip {
122
- flex: 1 1;
123
- display: flex;
124
- justify-content: center;
125
- align-items: center;
126
- min-height: 200px;
127
- width: 100%;
128
- height: 100%;
129
- border: 1px solid rgba(0, 0, 0, 0.12);
130
- border-radius: 8px;
131
- color: rgba(0, 0, 0, 0.45);
132
- font-size: 14px;
133
- box-sizing: border-box;
134
- }
135
- .input-wrapper {
136
- box-sizing: border-box;
137
- }
138
- .input-wrapper .mode-radio-group-wrapper {
18
+ .prompt-input-wrapper .mode-radio-group-wrapper {
139
19
  display: flex;
140
20
  align-items: center;
141
21
  justify-content: space-between;
142
22
  }
143
- .input-wrapper .mode-radio-group {
23
+ .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group {
144
24
  display: flex;
145
25
  align-items: center;
146
26
  height: 100%;
147
27
  }
148
- .input-wrapper .mode-radio-group .ant-radio-button-wrapper {
28
+ .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group .ant-radio-button-wrapper {
149
29
  height: 24px;
150
30
  padding: 0 8px;
151
31
  line-height: 24px;
@@ -156,55 +36,85 @@ body {
156
36
  background-color: #F7F7F7;
157
37
  font-size: 12px;
158
38
  }
159
- .input-wrapper .mode-radio-group .ant-radio-button-wrapper:before {
39
+ .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group .ant-radio-button-wrapper:before {
160
40
  display: none;
161
41
  }
162
- .input-wrapper .mode-radio-group .ant-radio-button-wrapper:focus-within {
42
+ .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group .ant-radio-button-wrapper:focus-within {
163
43
  outline: none;
164
44
  }
165
- .input-wrapper .mode-radio-group .ant-radio-button-wrapper.ant-radio-button-wrapper-checked {
45
+ .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group .ant-radio-button-wrapper.ant-radio-button-wrapper-checked {
166
46
  background-color: #2B83FF;
167
47
  border-color: #2B83FF;
168
48
  color: white;
169
49
  }
170
- .input-wrapper .mode-radio-group .ant-radio-button-wrapper.ant-radio-button-wrapper-checked:hover {
50
+ .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group .ant-radio-button-wrapper.ant-radio-button-wrapper-checked:hover {
171
51
  color: #fff;
172
52
  }
173
- .input-wrapper .mode-radio-group .ant-radio-button-wrapper:hover {
53
+ .prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group .ant-radio-button-wrapper:hover {
174
54
  color: #2B83FF;
175
55
  }
176
- .input-wrapper .main-side-console-input {
56
+ .prompt-input-wrapper .mode-radio-group-wrapper .action-icons {
57
+ display: flex;
58
+ align-items: center;
59
+ }
60
+ .prompt-input-wrapper .main-side-console-input {
177
61
  position: relative;
178
62
  margin-top: 10px;
179
63
  }
180
- .input-wrapper .main-side-console-input .main-side-console-input-textarea {
64
+ .prompt-input-wrapper .main-side-console-input .main-side-console-input-textarea {
181
65
  border-radius: 12px;
182
- border: 1px solid rgba(0, 0, 0, 0.12);
183
- padding: 12px 16px 52px 16px;
66
+ border: 1px solid #F2F4F7;
67
+ background: white;
68
+ padding: 12px 16px;
184
69
  transition: background-color 0.2s ease;
185
70
  overflow-y: auto;
186
71
  white-space: pre-wrap;
187
72
  line-height: 21px;
188
73
  scrollbar-width: thin;
189
74
  }
190
- .input-wrapper .main-side-console-input .main-side-console-input-textarea::-webkit-scrollbar {
75
+ @keyframes hue-shift {
76
+ 0% {
77
+ filter: hue-rotate(0deg);
78
+ }
79
+ 100% {
80
+ filter: hue-rotate(360deg);
81
+ }
82
+ }
83
+ .prompt-input-wrapper .main-side-console-input .main-side-console-input-textarea:focus-within {
84
+ border: 1px solid transparent;
85
+ background: linear-gradient(white, white) padding-box, linear-gradient(135deg, #4285f4 0%, #0066FF 25%, #7B02C5 50%, #ea4335 75%, #ff7043 100%) border-box;
86
+ }
87
+ .prompt-input-wrapper .main-side-console-input .main-side-console-input-textarea::-webkit-scrollbar {
191
88
  width: 6px;
192
89
  }
193
- .input-wrapper .main-side-console-input .main-side-console-input-textarea::-webkit-scrollbar-thumb {
90
+ .prompt-input-wrapper .main-side-console-input .main-side-console-input-textarea::-webkit-scrollbar-thumb {
194
91
  background-color: rgba(0, 0, 0, 0.2);
195
92
  border-radius: 3px;
196
93
  }
197
- .input-wrapper .main-side-console-input.disabled .form-controller-wrapper {
94
+ .prompt-input-wrapper .main-side-console-input.loading .main-side-console-input-textarea {
95
+ border: 1px solid transparent;
96
+ background: linear-gradient(white, white) padding-box, linear-gradient(135deg, #4285f4 0%, #0066FF 25%, #7B02C5 50%, #ea4335 75%, #ff7043 100%) border-box;
97
+ animation: hue-shift 5s linear infinite;
98
+ }
99
+ .prompt-input-wrapper .main-side-console-input .ant-form-item-control-input-content {
100
+ border: 3px solid transparent;
101
+ border-radius: 14px;
102
+ z-index: 999;
103
+ }
104
+ .prompt-input-wrapper .main-side-console-input:focus-within .ant-form-item-control-input-content {
105
+ border-color: rgba(43, 131, 255, 0.16);
106
+ }
107
+ .prompt-input-wrapper .main-side-console-input.disabled .form-controller-wrapper {
198
108
  background-color: transparent;
199
109
  }
200
- .input-wrapper .ant-input {
110
+ .prompt-input-wrapper .ant-input {
201
111
  padding-bottom: 40px;
202
112
  }
203
- .input-wrapper .form-controller-wrapper {
113
+ .prompt-input-wrapper .form-controller-wrapper {
204
114
  position: absolute;
205
115
  display: flex;
206
116
  flex-direction: row;
207
- justify-content: space-between;
117
+ justify-content: flex-end;
208
118
  width: calc(100% - 32px);
209
119
  box-sizing: border-box;
210
120
  align-items: flex-end;
@@ -212,17 +122,164 @@ body {
212
122
  background-color: #FFF;
213
123
  left: 16px;
214
124
  bottom: 0.5px;
215
- padding: 8px 0;
125
+ padding: 12px 0;
216
126
  line-height: 32px;
217
127
  transition: background-color 0.2s ease;
218
128
  }
219
- .input-wrapper .settings-wrapper {
129
+ .prompt-input-wrapper .settings-wrapper {
220
130
  display: flex;
221
131
  flex-direction: row;
222
132
  gap: 2px;
223
133
  color: #777;
224
134
  flex-wrap: wrap;
225
135
  }
226
- .input-wrapper .settings-wrapper.settings-wrapper-hover {
136
+ .prompt-input-wrapper .settings-wrapper.settings-wrapper-hover {
227
137
  color: #3b3b3b;
228
138
  }
139
+ .selector-trigger {
140
+ width: 24px;
141
+ height: 24px;
142
+ cursor: pointer;
143
+ transition: all 0.2s ease;
144
+ }
145
+ .selector-trigger .action-icon {
146
+ font-size: 14px;
147
+ color: rgba(0, 0, 0, 0.85);
148
+ transition: all 0.2s;
149
+ }
150
+ .selector-trigger .action-icon:hover {
151
+ color: #2B83FF;
152
+ }
153
+ .history-modal-container {
154
+ height: 70vh;
155
+ display: flex;
156
+ flex-direction: column;
157
+ border-radius: 12px 12px 0 0;
158
+ overflow: hidden;
159
+ }
160
+ .history-modal-container .history-modal-header {
161
+ display: flex;
162
+ justify-content: space-between;
163
+ align-items: center;
164
+ height: 48px;
165
+ line-height: 48px;
166
+ padding: 0 25px;
167
+ }
168
+ .history-modal-container .history-modal-header .close-button {
169
+ margin-right: -4px;
170
+ padding: 4px;
171
+ display: flex;
172
+ align-items: center;
173
+ justify-content: center;
174
+ }
175
+ .history-modal-container .history-modal-header .close-button .anticon {
176
+ font-size: 18px;
177
+ color: #999999;
178
+ }
179
+ .history-modal-container .history-modal-header .close-button:hover .anticon {
180
+ color: #666666;
181
+ }
182
+ .history-modal-container .history-search-section {
183
+ padding: 16px 20px;
184
+ background: #ffffff;
185
+ }
186
+ .history-modal-container .history-search-section .search-input-wrapper {
187
+ display: flex;
188
+ align-items: center;
189
+ gap: 12px;
190
+ color: rgba(0, 0, 0, 0.25);
191
+ }
192
+ .history-modal-container .history-search-section .search-input-wrapper .search-input {
193
+ flex: 1 1;
194
+ height: 36px;
195
+ border-radius: 16px;
196
+ background: #f1f2f3;
197
+ border: none;
198
+ }
199
+ .history-modal-container .history-search-section .search-input-wrapper .search-input .ant-input {
200
+ background: transparent;
201
+ border: none;
202
+ box-shadow: none;
203
+ }
204
+ .history-modal-container .history-search-section .search-input-wrapper .search-input:hover,
205
+ .history-modal-container .history-search-section .search-input-wrapper .search-input:focus-within {
206
+ border-color: #d9d9d9;
207
+ background: #ffffff;
208
+ }
209
+ .history-modal-container .history-search-section .search-input-wrapper .clear-button {
210
+ color: #1890ff;
211
+ padding: 0;
212
+ height: auto;
213
+ }
214
+ .history-modal-container .history-search-section .search-input-wrapper .clear-button:hover {
215
+ color: #40a9ff;
216
+ }
217
+ .history-modal-container .history-content {
218
+ flex: 1 1;
219
+ overflow-y: auto;
220
+ padding: 0 25px 25px 25px;
221
+ }
222
+ .history-modal-container .history-content .history-group {
223
+ margin-bottom: 10px;
224
+ }
225
+ .history-modal-container .history-content .history-group .history-group-title {
226
+ font-size: 12px;
227
+ color: rgba(0, 0, 0, 0.45);
228
+ height: 40px;
229
+ line-height: 40px;
230
+ font-weight: 400;
231
+ }
232
+ .history-modal-container .history-content .history-group .history-item {
233
+ cursor: pointer;
234
+ height: 40px;
235
+ line-height: 40px;
236
+ font-size: 14px;
237
+ color: rgba(0, 0, 0, 0.85);
238
+ overflow: hidden;
239
+ white-space: nowrap;
240
+ text-overflow: ellipsis;
241
+ }
242
+ .history-modal-container .history-content .history-group .history-item:hover {
243
+ background: #f2f4f7;
244
+ padding: 0 8px;
245
+ margin: 0 -8px;
246
+ }
247
+ .history-modal-container .history-content .no-results {
248
+ text-align: center;
249
+ padding: 40px 20px;
250
+ color: #999999;
251
+ }
252
+ .ant-modal-wrap .ant-modal-content {
253
+ animation: slideUpFromBottom 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
254
+ }
255
+ @keyframes slideUpFromBottom {
256
+ 0% {
257
+ transform: translateY(100%);
258
+ opacity: 0;
259
+ }
260
+ 100% {
261
+ transform: translateY(0);
262
+ opacity: 1;
263
+ }
264
+ }
265
+ .result-wrapper {
266
+ display: flex;
267
+ height: 100%;
268
+ justify-content: center;
269
+ margin: 4px 0;
270
+ }
271
+ .result-wrapper .loading-container {
272
+ text-align: center;
273
+ }
274
+ .result-wrapper pre {
275
+ margin: 4px 0;
276
+ margin: 0;
277
+ white-space: pre-wrap;
278
+ text-wrap: unset;
279
+ word-wrap: break-word;
280
+ overflow-wrap: break-word;
281
+ background: #F2F4F7;
282
+ border-radius: 8px;
283
+ padding: 14px;
284
+ overflow: scroll;
285
+ }
@@ -6,6 +6,7 @@ var buffer = {
6
6
  };
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { Alert } from "antd";
9
+ import ShinyText from "../shiny-text";
9
10
  import "./index.css";
10
11
  const errorMessageServerNotReady = /* @__PURE__ */ jsxs("span", { children: [
11
12
  "Don't worry, just one more step to launch the playground server.",
@@ -26,7 +27,7 @@ const serverLaunchTip = (notReadyMessage = errorMessageServerNotReady) => /* @__
26
27
  type: "warning"
27
28
  }
28
29
  ) });
29
- const emptyResultTip = /* @__PURE__ */ jsx("div", { className: "result-empty-tip", style: {}, children: /* @__PURE__ */ jsx("span", { children: "The result will be shown here" }) });
30
+ const emptyResultTip = /* @__PURE__ */ jsx("div", { className: "result-empty-tip", style: { textAlign: "center" }, children: /* @__PURE__ */ jsx(ShinyText, { disabled: true, text: "The result will be shown here" }) });
30
31
  const trackingTip = "limit popup to current tab";
31
32
  const deepThinkTip = "deep think";
32
33
  export {
@@ -69,6 +69,11 @@ const useEnvConfig = create((set, get) => {
69
69
  set({ config: config2, configString: configString2 });
70
70
  localStorage.setItem(CONFIG_KEY, configString2);
71
71
  },
72
+ syncFromStorage: () => {
73
+ const latestConfigString = getConfigStringFromLocalStorage();
74
+ const latestConfig = parseConfig(latestConfigString);
75
+ set({ config: latestConfig, configString: latestConfigString });
76
+ },
72
77
  forceSameTabNavigation: savedForceSameTabNavigation,
73
78
  setForceSameTabNavigation: (forceSameTabNavigation) => {
74
79
  set({ forceSameTabNavigation });