@midscene/playground-app 1.7.3 → 1.7.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.
Files changed (50) hide show
  1. package/dist/es/PlaygroundApp.css +0 -128
  2. package/dist/es/PlaygroundApp.mjs +74 -464
  3. package/dist/es/PlaygroundThemeProvider.mjs +10 -0
  4. package/dist/es/PreviewRenderer.mjs +4 -1
  5. package/dist/es/ScrcpyPanel.mjs +97 -89
  6. package/dist/es/SessionSetupPanel.css +292 -0
  7. package/dist/es/SessionSetupPanel.mjs +60 -39
  8. package/dist/es/controller/ai-config.mjs +37 -0
  9. package/dist/es/controller/auto-create.mjs +19 -0
  10. package/dist/es/controller/selectors.mjs +66 -0
  11. package/dist/es/controller/types.mjs +0 -0
  12. package/dist/es/controller/usePlaygroundController.mjs +356 -0
  13. package/dist/es/icons/dropdown-chevron.mjs +61 -0
  14. package/dist/es/icons/midscene-logo.mjs +247 -0
  15. package/dist/es/index.mjs +4 -1
  16. package/dist/es/panels/PlaygroundConversationPanel.css +20 -0
  17. package/dist/es/panels/PlaygroundConversationPanel.mjs +134 -0
  18. package/dist/es/scrcpy-preview.mjs +30 -0
  19. package/dist/lib/PlaygroundApp.css +0 -128
  20. package/dist/lib/PlaygroundApp.js +70 -460
  21. package/dist/lib/PlaygroundThemeProvider.js +44 -0
  22. package/dist/lib/PreviewRenderer.js +4 -1
  23. package/dist/lib/ScrcpyPanel.js +96 -88
  24. package/dist/lib/SessionSetupPanel.css +292 -0
  25. package/dist/lib/SessionSetupPanel.js +70 -38
  26. package/dist/lib/controller/ai-config.js +74 -0
  27. package/dist/lib/controller/auto-create.js +59 -0
  28. package/dist/lib/controller/selectors.js +103 -0
  29. package/dist/lib/controller/types.js +18 -0
  30. package/dist/lib/controller/usePlaygroundController.js +390 -0
  31. package/dist/lib/icons/dropdown-chevron.js +95 -0
  32. package/dist/lib/icons/midscene-logo.js +281 -0
  33. package/dist/lib/index.js +14 -2
  34. package/dist/lib/panels/PlaygroundConversationPanel.css +20 -0
  35. package/dist/lib/panels/PlaygroundConversationPanel.js +168 -0
  36. package/dist/lib/scrcpy-preview.js +79 -0
  37. package/dist/types/PlaygroundPreview.d.ts +6 -0
  38. package/dist/types/PlaygroundThemeProvider.d.ts +2 -0
  39. package/dist/types/PreviewRenderer.d.ts +7 -1
  40. package/dist/types/ScrcpyPanel.d.ts +14 -1
  41. package/dist/types/SessionSetupPanel.d.ts +4 -3
  42. package/dist/types/controller/ai-config.d.ts +4 -0
  43. package/dist/types/controller/auto-create.d.ts +15 -0
  44. package/dist/types/controller/selectors.d.ts +5 -0
  45. package/dist/types/controller/types.d.ts +36 -0
  46. package/dist/types/controller/usePlaygroundController.d.ts +9 -0
  47. package/dist/types/index.d.ts +5 -0
  48. package/dist/types/panels/PlaygroundConversationPanel.d.ts +20 -0
  49. package/dist/types/scrcpy-preview.d.ts +11 -0
  50. package/package.json +4 -3
@@ -0,0 +1,30 @@
1
+ import { SCRCPY_PREVIEW_METADATA_TIMEOUT_MS } from "@midscene/shared/constants";
2
+ const SCRCPY_METADATA_TIMEOUT_MS = SCRCPY_PREVIEW_METADATA_TIMEOUT_MS;
3
+ function isScrcpyPreviewStatusEvent(value) {
4
+ return 'object' == typeof value && null !== value && 'message' in value && 'string' == typeof value.message;
5
+ }
6
+ function getDefaultScrcpyWaitingStatusText() {
7
+ return 'Preparing Android device connection…';
8
+ }
9
+ function getScrcpyDecoderStatusText() {
10
+ return 'Starting video decoder…';
11
+ }
12
+ function getScrcpyPreviewStatusText(status, waitingMessage = getDefaultScrcpyWaitingStatusText()) {
13
+ switch(status){
14
+ case 'connected':
15
+ return 'Live scrcpy preview connected';
16
+ case 'waiting-for-stream':
17
+ return waitingMessage;
18
+ case 'error':
19
+ return 'Unable to start scrcpy preview';
20
+ case 'disconnected':
21
+ return 'scrcpy preview disconnected, retrying…';
22
+ default:
23
+ return 'Connecting to scrcpy preview server…';
24
+ }
25
+ }
26
+ function getScrcpyMetadataTimeoutMessage(timeoutMs = SCRCPY_METADATA_TIMEOUT_MS) {
27
+ const seconds = Math.max(1, Math.round(timeoutMs / 1000));
28
+ return `Timed out waiting ${seconds}s for scrcpy video stream metadata.`;
29
+ }
30
+ export { SCRCPY_METADATA_TIMEOUT_MS, getDefaultScrcpyWaitingStatusText, getScrcpyDecoderStatusText, getScrcpyMetadataTimeoutMessage, getScrcpyPreviewStatusText, isScrcpyPreviewStatusEvent };
@@ -103,134 +103,6 @@ h3 {
103
103
  overflow: hidden;
104
104
  }
105
105
 
106
- .session-setup-panel {
107
- flex: 1;
108
- justify-content: center;
109
- align-items: center;
110
- padding: 24px 0;
111
- display: flex;
112
- }
113
-
114
- .session-setup-card {
115
- background: linear-gradient(#fff 0%, #fafafa 100%);
116
- border: 1px solid rgba(0, 0, 0, .08);
117
- border-radius: 16px;
118
- width: 100%;
119
- max-width: 520px;
120
- padding: 28px;
121
- box-shadow: 0 12px 32px rgba(15, 23, 42, .06);
122
- }
123
-
124
- .session-setup-card .ant-alert {
125
- margin-bottom: 16px;
126
- }
127
-
128
- .session-setup-form {
129
- margin: 24px 0 8px;
130
- }
131
-
132
- .platform-selector-group {
133
- grid-template-columns: repeat(2, minmax(0, 1fr));
134
- gap: 12px;
135
- width: 100%;
136
- display: grid;
137
- }
138
-
139
- .platform-selector-group .ant-radio-button-wrapper {
140
- white-space: normal;
141
- background: #fff;
142
- border-radius: 14px;
143
- justify-content: flex-start;
144
- align-items: flex-start;
145
- height: auto;
146
- min-height: 92px;
147
- padding: 14px 16px;
148
- transition: border-color .2s, box-shadow .2s, transform .2s;
149
- display: flex;
150
- }
151
-
152
- .platform-selector-group .ant-radio-button-wrapper:not(:-webkit-any(:lang(ae), :lang(ar), :lang(arc), :lang(bcc), :lang(bqi), :lang(ckb), :lang(dv), :lang(fa), :lang(glk), :lang(he), :lang(ku), :lang(mzn), :lang(nqo), :lang(pnb), :lang(ps), :lang(sd), :lang(ug), :lang(ur), :lang(yi))) {
153
- border-left-width: 1px;
154
- }
155
-
156
- .platform-selector-group .ant-radio-button-wrapper:not(:-moz-any(:lang(ae), :lang(ar), :lang(arc), :lang(bcc), :lang(bqi), :lang(ckb), :lang(dv), :lang(fa), :lang(glk), :lang(he), :lang(ku), :lang(mzn), :lang(nqo), :lang(pnb), :lang(ps), :lang(sd), :lang(ug), :lang(ur), :lang(yi))) {
157
- border-left-width: 1px;
158
- }
159
-
160
- .platform-selector-group .ant-radio-button-wrapper:not(:is(:lang(ae), :lang(ar), :lang(arc), :lang(bcc), :lang(bqi), :lang(ckb), :lang(dv), :lang(fa), :lang(glk), :lang(he), :lang(ku), :lang(mzn), :lang(nqo), :lang(pnb), :lang(ps), :lang(sd), :lang(ug), :lang(ur), :lang(yi))) {
161
- border-left-width: 1px;
162
- }
163
-
164
- .platform-selector-group .ant-radio-button-wrapper:-webkit-any(:lang(ae), :lang(ar), :lang(arc), :lang(bcc), :lang(bqi), :lang(ckb), :lang(dv), :lang(fa), :lang(glk), :lang(he), :lang(ku), :lang(mzn), :lang(nqo), :lang(pnb), :lang(ps), :lang(sd), :lang(ug), :lang(ur), :lang(yi)) {
165
- border-right-width: 1px;
166
- }
167
-
168
- .platform-selector-group .ant-radio-button-wrapper:-moz-any(:lang(ae), :lang(ar), :lang(arc), :lang(bcc), :lang(bqi), :lang(ckb), :lang(dv), :lang(fa), :lang(glk), :lang(he), :lang(ku), :lang(mzn), :lang(nqo), :lang(pnb), :lang(ps), :lang(sd), :lang(ug), :lang(ur), :lang(yi)) {
169
- border-right-width: 1px;
170
- }
171
-
172
- .platform-selector-group .ant-radio-button-wrapper:is(:lang(ae), :lang(ar), :lang(arc), :lang(bcc), :lang(bqi), :lang(ckb), :lang(dv), :lang(fa), :lang(glk), :lang(he), :lang(ku), :lang(mzn), :lang(nqo), :lang(pnb), :lang(ps), :lang(sd), :lang(ug), :lang(ur), :lang(yi)) {
173
- border-right-width: 1px;
174
- }
175
-
176
- .platform-selector-group .ant-radio-button-wrapper:before {
177
- display: none;
178
- }
179
-
180
- .platform-selector-group .ant-radio-button-wrapper:hover {
181
- border-color: #1677ff;
182
- transform: translateY(-1px);
183
- }
184
-
185
- .platform-selector-group .ant-radio-button-wrapper-checked {
186
- border-color: #1677ff;
187
- box-shadow: 0 10px 24px rgba(22, 119, 255, .12);
188
- }
189
-
190
- .platform-selector-card .platform-selector-title {
191
- color: rgba(0, 0, 0, .88);
192
- font-size: 15px;
193
- font-weight: 600;
194
- line-height: 1.4;
195
- }
196
-
197
- .platform-selector-card .platform-selector-description {
198
- color: rgba(0, 0, 0, .5);
199
- margin-top: 6px;
200
- font-size: 12px;
201
- line-height: 1.5;
202
- }
203
-
204
- .session-select-option {
205
- flex-direction: column;
206
- gap: 2px;
207
- line-height: 1.4;
208
- display: flex;
209
- }
210
-
211
- .session-select-option-label {
212
- color: rgba(0, 0, 0, .88);
213
- }
214
-
215
- .session-select-option-description {
216
- color: rgba(0, 0, 0, .45);
217
- font-size: 12px;
218
- }
219
-
220
- .session-toolbar {
221
- justify-content: space-between;
222
- align-items: center;
223
- gap: 12px;
224
- padding: 20px 0 16px;
225
- display: flex;
226
- }
227
-
228
- @media (max-width: 640px) {
229
- .platform-selector-group {
230
- grid-template-columns: 1fr;
231
- }
232
- }
233
-
234
106
  .server-offline-container {
235
107
  background: #f5f5f5;
236
108
  justify-content: center;