@godscene/playground-electron 1.7.11

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 (98) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +4 -0
  3. package/dist/es/DeviceInteractionLayer.mjs +383 -0
  4. package/dist/es/PlaygroundApp.css +207 -0
  5. package/dist/es/PlaygroundApp.mjs +776 -0
  6. package/dist/es/PlaygroundPreview.mjs +29 -0
  7. package/dist/es/PlaygroundThemeProvider.mjs +10 -0
  8. package/dist/es/PreviewRenderer.mjs +270 -0
  9. package/dist/es/ScrcpyPanel.mjs +390 -0
  10. package/dist/es/SessionSetupPanel.css +299 -0
  11. package/dist/es/SessionSetupPanel.mjs +169 -0
  12. package/dist/es/components/Header/index.css +19 -0
  13. package/dist/es/components/Header/index.mjs +37 -0
  14. package/dist/es/components/Nav/index.css +15 -0
  15. package/dist/es/components/Nav/index.mjs +93 -0
  16. package/dist/es/components/WinControlTool/index.css +5 -0
  17. package/dist/es/components/WinControlTool/index.mjs +76 -0
  18. package/dist/es/controller/ai-config.mjs +40 -0
  19. package/dist/es/controller/auto-create.mjs +19 -0
  20. package/dist/es/controller/selectors.mjs +78 -0
  21. package/dist/es/controller/single-flight.mjs +13 -0
  22. package/dist/es/controller/types.mjs +0 -0
  23. package/dist/es/controller/usePlaygroundController.mjs +400 -0
  24. package/dist/es/icons/dropdown-chevron.mjs +61 -0
  25. package/dist/es/icons/midscene-logo.mjs +247 -0
  26. package/dist/es/icons/server-offline-background.mjs +102 -0
  27. package/dist/es/icons/server-offline-foreground.mjs +200 -0
  28. package/dist/es/index.mjs +7 -0
  29. package/dist/es/manual-interaction.mjs +56 -0
  30. package/dist/es/panels/PlaygroundConversationPanel.css +20 -0
  31. package/dist/es/panels/PlaygroundConversationPanel.mjs +140 -0
  32. package/dist/es/runtime-info.mjs +128 -0
  33. package/dist/es/scrcpy-preview.mjs +30 -0
  34. package/dist/es/scrcpy-stream.mjs +53 -0
  35. package/dist/es/session-setup.mjs +13 -0
  36. package/dist/es/session-state.mjs +32 -0
  37. package/dist/es/useServerStatus.mjs +120 -0
  38. package/dist/lib/DeviceInteractionLayer.js +434 -0
  39. package/dist/lib/PlaygroundApp.css +207 -0
  40. package/dist/lib/PlaygroundApp.js +821 -0
  41. package/dist/lib/PlaygroundPreview.js +63 -0
  42. package/dist/lib/PlaygroundThemeProvider.js +44 -0
  43. package/dist/lib/PreviewRenderer.js +304 -0
  44. package/dist/lib/ScrcpyPanel.js +424 -0
  45. package/dist/lib/SessionSetupPanel.css +299 -0
  46. package/dist/lib/SessionSetupPanel.js +217 -0
  47. package/dist/lib/components/Header/index.css +19 -0
  48. package/dist/lib/components/Header/index.js +81 -0
  49. package/dist/lib/components/Nav/index.css +15 -0
  50. package/dist/lib/components/Nav/index.js +127 -0
  51. package/dist/lib/components/WinControlTool/index.css +5 -0
  52. package/dist/lib/components/WinControlTool/index.js +110 -0
  53. package/dist/lib/controller/ai-config.js +80 -0
  54. package/dist/lib/controller/auto-create.js +59 -0
  55. package/dist/lib/controller/selectors.js +115 -0
  56. package/dist/lib/controller/single-flight.js +47 -0
  57. package/dist/lib/controller/types.js +18 -0
  58. package/dist/lib/controller/usePlaygroundController.js +434 -0
  59. package/dist/lib/icons/dropdown-chevron.js +95 -0
  60. package/dist/lib/icons/midscene-logo.js +281 -0
  61. package/dist/lib/icons/server-offline-background.js +136 -0
  62. package/dist/lib/icons/server-offline-foreground.js +234 -0
  63. package/dist/lib/index.js +56 -0
  64. package/dist/lib/manual-interaction.js +90 -0
  65. package/dist/lib/panels/PlaygroundConversationPanel.css +20 -0
  66. package/dist/lib/panels/PlaygroundConversationPanel.js +174 -0
  67. package/dist/lib/runtime-info.js +174 -0
  68. package/dist/lib/scrcpy-preview.js +79 -0
  69. package/dist/lib/scrcpy-stream.js +87 -0
  70. package/dist/lib/session-setup.js +47 -0
  71. package/dist/lib/session-state.js +69 -0
  72. package/dist/lib/useServerStatus.js +154 -0
  73. package/dist/types/DeviceInteractionLayer.d.ts +50 -0
  74. package/dist/types/PlaygroundApp.d.ts +14 -0
  75. package/dist/types/PlaygroundPreview.d.ts +22 -0
  76. package/dist/types/PlaygroundThemeProvider.d.ts +2 -0
  77. package/dist/types/PreviewRenderer.d.ts +27 -0
  78. package/dist/types/ScrcpyPanel.d.ts +21 -0
  79. package/dist/types/SessionSetupPanel.d.ts +16 -0
  80. package/dist/types/components/Header/index.d.ts +3 -0
  81. package/dist/types/components/Nav/index.d.ts +3 -0
  82. package/dist/types/components/WinControlTool/index.d.ts +3 -0
  83. package/dist/types/controller/ai-config.d.ts +5 -0
  84. package/dist/types/controller/auto-create.d.ts +15 -0
  85. package/dist/types/controller/selectors.d.ts +5 -0
  86. package/dist/types/controller/single-flight.d.ts +3 -0
  87. package/dist/types/controller/types.d.ts +36 -0
  88. package/dist/types/controller/usePlaygroundController.d.ts +16 -0
  89. package/dist/types/index.d.ts +13 -0
  90. package/dist/types/manual-interaction.d.ts +21 -0
  91. package/dist/types/panels/PlaygroundConversationPanel.d.ts +25 -0
  92. package/dist/types/runtime-info.d.ts +22 -0
  93. package/dist/types/scrcpy-preview.d.ts +11 -0
  94. package/dist/types/scrcpy-stream.d.ts +16 -0
  95. package/dist/types/session-setup.d.ts +2 -0
  96. package/dist/types/session-state.d.ts +9 -0
  97. package/dist/types/useServerStatus.d.ts +12 -0
  98. package/package.json +69 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-present Bytedance, Inc. and its affiliates.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,4 @@
1
+ # @midscene/playground-app
2
+
3
+ Reusable React shell for Midscene playground applications.
4
+
@@ -0,0 +1,383 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useRef } from "react";
3
+ function _define_property(obj, key, value) {
4
+ if (key in obj) Object.defineProperty(obj, key, {
5
+ value: value,
6
+ enumerable: true,
7
+ configurable: true,
8
+ writable: true
9
+ });
10
+ else obj[key] = value;
11
+ return obj;
12
+ }
13
+ function _object_spread(target) {
14
+ for(var i = 1; i < arguments.length; i++){
15
+ var source = null != arguments[i] ? arguments[i] : {};
16
+ var ownKeys = Object.keys(source);
17
+ if ("function" == typeof Object.getOwnPropertySymbols) ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
18
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
19
+ }));
20
+ ownKeys.forEach(function(key) {
21
+ _define_property(target, key, source[key]);
22
+ });
23
+ }
24
+ return target;
25
+ }
26
+ const keyboardControlKeys = new Set([
27
+ 'Backspace',
28
+ 'Delete',
29
+ 'Enter',
30
+ 'Tab',
31
+ 'Escape',
32
+ 'ArrowLeft',
33
+ 'ArrowRight',
34
+ 'ArrowUp',
35
+ 'ArrowDown',
36
+ 'Home',
37
+ 'End',
38
+ 'PageUp',
39
+ 'PageDown'
40
+ ]);
41
+ const pureModifierKeys = new Set([
42
+ 'Alt',
43
+ 'Control',
44
+ 'Meta',
45
+ 'Shift'
46
+ ]);
47
+ function isHostCopyShortcut(event) {
48
+ return !event.altKey && (event.metaKey || event.ctrlKey) && 'c' === event.key.toLowerCase();
49
+ }
50
+ function isHostReservedShortcut(event) {
51
+ if ('F5' === event.key || 'F11' === event.key || 'F12' === event.key) return true;
52
+ const hasPrimaryModifier = event.metaKey || event.ctrlKey;
53
+ if (!hasPrimaryModifier) return false;
54
+ const lowerKey = event.key.toLowerCase();
55
+ if (event.altKey && 'i' === lowerKey) return true;
56
+ if (event.shiftKey && ('i' === lowerKey || 'j' === lowerKey)) return true;
57
+ const hostReservedKeys = new Set([
58
+ 'r',
59
+ 'q',
60
+ 'w',
61
+ 'm',
62
+ 'h',
63
+ 'n',
64
+ 't',
65
+ '+',
66
+ '=',
67
+ '-',
68
+ '_',
69
+ '0'
70
+ ]);
71
+ return hostReservedKeys.has(lowerKey);
72
+ }
73
+ function hasHostSelectionOutsideOverlay(overlay) {
74
+ const selection = window.getSelection();
75
+ if (!selection || selection.isCollapsed || !overlay) return false;
76
+ const { anchorNode, focusNode } = selection;
77
+ if (!anchorNode || !focusNode) return false;
78
+ return !overlay.contains(anchorNode) && !overlay.contains(focusNode);
79
+ }
80
+ function keyNameForKeyboardEvent(event) {
81
+ if (pureModifierKeys.has(event.key)) return null;
82
+ const parts = [];
83
+ if (event.ctrlKey) parts.push('Control');
84
+ if (event.metaKey) parts.push('Meta');
85
+ if (event.altKey) parts.push('Alt');
86
+ if (event.shiftKey && 'Shift' !== event.key) parts.push('Shift');
87
+ parts.push(' ' === event.key ? 'Space' : event.key);
88
+ return parts.join('+');
89
+ }
90
+ function inscribedContentRect(panel, deviceSize) {
91
+ const aspect = deviceSize.width / deviceSize.height;
92
+ if (panel.height <= 0 || panel.width <= 0) return panel;
93
+ if (panel.width / panel.height > aspect) {
94
+ const renderedWidth = panel.height * aspect;
95
+ return {
96
+ left: panel.left + (panel.width - renderedWidth) / 2,
97
+ top: panel.top,
98
+ width: renderedWidth,
99
+ height: panel.height
100
+ };
101
+ }
102
+ const renderedHeight = panel.width / aspect;
103
+ return {
104
+ left: panel.left,
105
+ top: panel.top + (panel.height - renderedHeight) / 2,
106
+ width: panel.width,
107
+ height: renderedHeight
108
+ };
109
+ }
110
+ function DeviceInteractionLayer({ enabled, deviceSize, onTap, onSwipe, keyboardEnabled = false, onTextInput, onKeyboardPress, tapMaxDistance = 8, tapMaxDurationMs = 250, style }) {
111
+ const overlayRef = useRef(null);
112
+ const keyboardSinkRef = useRef(null);
113
+ const activePointer = useRef(null);
114
+ const composingRef = useRef(false);
115
+ const keyboardArmedRef = useRef(false);
116
+ const lastKeyboardPointRef = useRef(null);
117
+ const focusKeyboardSink = useCallback(()=>{
118
+ if (keyboardEnabled) {
119
+ var _keyboardSinkRef_current;
120
+ keyboardArmedRef.current = true;
121
+ null == (_keyboardSinkRef_current = keyboardSinkRef.current) || _keyboardSinkRef_current.focus({
122
+ preventScroll: true
123
+ });
124
+ }
125
+ }, [
126
+ keyboardEnabled
127
+ ]);
128
+ const positionKeyboardSink = useCallback((clientX, clientY)=>{
129
+ const overlay = overlayRef.current;
130
+ const sink = keyboardSinkRef.current;
131
+ if (!overlay || !sink) return;
132
+ const rect = overlay.getBoundingClientRect();
133
+ sink.style.left = `${Math.max(0, clientX - rect.left)}px`;
134
+ sink.style.top = `${Math.max(0, clientY - rect.top)}px`;
135
+ }, []);
136
+ const projectToDevice = useCallback((clientX, clientY, contentRect)=>{
137
+ if (!deviceSize) return null;
138
+ const ratioX = (clientX - contentRect.left) / contentRect.width;
139
+ const ratioY = (clientY - contentRect.top) / contentRect.height;
140
+ const x = Math.max(0, Math.min(deviceSize.width - 1, Math.round(ratioX * deviceSize.width)));
141
+ const y = Math.max(0, Math.min(deviceSize.height - 1, Math.round(ratioY * deviceSize.height)));
142
+ return {
143
+ x,
144
+ y
145
+ };
146
+ }, [
147
+ deviceSize
148
+ ]);
149
+ const handlePointerDown = useCallback((event)=>{
150
+ if (!enabled || !deviceSize || !overlayRef.current) return;
151
+ if (0 !== event.button && 'mouse' === event.pointerType) return;
152
+ const panelRect = overlayRef.current.getBoundingClientRect();
153
+ const contentRect = inscribedContentRect(panelRect, deviceSize);
154
+ if (event.clientX < contentRect.left || event.clientX > contentRect.left + contentRect.width || event.clientY < contentRect.top || event.clientY > contentRect.top + contentRect.height) {
155
+ keyboardArmedRef.current = false;
156
+ return;
157
+ }
158
+ positionKeyboardSink(event.clientX, event.clientY);
159
+ focusKeyboardSink();
160
+ try {
161
+ overlayRef.current.setPointerCapture(event.pointerId);
162
+ } catch (unused) {}
163
+ activePointer.current = {
164
+ startX: event.clientX,
165
+ startY: event.clientY,
166
+ startTime: performance.now(),
167
+ contentRect
168
+ };
169
+ event.preventDefault();
170
+ }, [
171
+ enabled,
172
+ deviceSize,
173
+ focusKeyboardSink,
174
+ positionKeyboardSink
175
+ ]);
176
+ const finishPointer = useCallback((event, cancelled)=>{
177
+ const active = activePointer.current;
178
+ activePointer.current = null;
179
+ if (!active) return;
180
+ try {
181
+ var _overlayRef_current;
182
+ null == (_overlayRef_current = overlayRef.current) || _overlayRef_current.releasePointerCapture(event.pointerId);
183
+ } catch (unused) {}
184
+ if (cancelled) return;
185
+ const dx = event.clientX - active.startX;
186
+ const dy = event.clientY - active.startY;
187
+ const distance = Math.sqrt(dx * dx + dy * dy);
188
+ const duration = Math.max(0, performance.now() - active.startTime);
189
+ const startPoint = projectToDevice(active.startX, active.startY, active.contentRect);
190
+ const endPoint = projectToDevice(event.clientX, event.clientY, active.contentRect);
191
+ if (!startPoint || !endPoint) return;
192
+ lastKeyboardPointRef.current = endPoint;
193
+ if (distance <= tapMaxDistance && duration <= tapMaxDurationMs) null == onTap || onTap(startPoint);
194
+ else null == onSwipe || onSwipe(startPoint, endPoint, Math.round(duration));
195
+ }, [
196
+ onTap,
197
+ onSwipe,
198
+ projectToDevice,
199
+ tapMaxDistance,
200
+ tapMaxDurationMs
201
+ ]);
202
+ const handlePointerUp = useCallback((event)=>finishPointer(event, false), [
203
+ finishPointer
204
+ ]);
205
+ const handlePointerCancel = useCallback((event)=>finishPointer(event, true), [
206
+ finishPointer
207
+ ]);
208
+ const clearLocalEditableText = useCallback(()=>{
209
+ var _keyboardSinkRef_current;
210
+ if (null == (_keyboardSinkRef_current = keyboardSinkRef.current) ? void 0 : _keyboardSinkRef_current.value) keyboardSinkRef.current.value = '';
211
+ }, []);
212
+ const handleKeyboardEvent = useCallback((event)=>{
213
+ if (!keyboardEnabled || !keyboardArmedRef.current) return;
214
+ if (isHostCopyShortcut(event) && hasHostSelectionOutsideOverlay(overlayRef.current)) {
215
+ keyboardArmedRef.current = false;
216
+ return;
217
+ }
218
+ if (composingRef.current || event.isComposing) return;
219
+ if (isHostReservedShortcut(event)) return;
220
+ if (keyboardControlKeys.has(event.key) || event.altKey || event.ctrlKey || event.metaKey) {
221
+ var _lastKeyboardPointRef_current;
222
+ const keyName = keyNameForKeyboardEvent(event);
223
+ if (!keyName) return;
224
+ event.preventDefault();
225
+ event.stopPropagation();
226
+ null == onKeyboardPress || onKeyboardPress(keyName, null != (_lastKeyboardPointRef_current = lastKeyboardPointRef.current) ? _lastKeyboardPointRef_current : void 0);
227
+ }
228
+ }, [
229
+ keyboardEnabled,
230
+ onKeyboardPress
231
+ ]);
232
+ const handlePaste = useCallback((event)=>{
233
+ var _lastKeyboardPointRef_current;
234
+ if (!keyboardEnabled || !keyboardArmedRef.current) return;
235
+ const text = event.clipboardData.getData('text');
236
+ if (!text) return;
237
+ event.preventDefault();
238
+ event.stopPropagation();
239
+ null == onTextInput || onTextInput(text, null != (_lastKeyboardPointRef_current = lastKeyboardPointRef.current) ? _lastKeyboardPointRef_current : void 0);
240
+ }, [
241
+ keyboardEnabled,
242
+ onTextInput
243
+ ]);
244
+ const handleEditableInput = useCallback((event)=>{
245
+ var _lastKeyboardPointRef_current;
246
+ var _keyboardSinkRef_current;
247
+ if (!keyboardEnabled || !keyboardArmedRef.current) {
248
+ if (!composingRef.current) clearLocalEditableText();
249
+ return;
250
+ }
251
+ if (composingRef.current) return;
252
+ const nativeEvent = event.nativeEvent;
253
+ if ('insertLineBreak' === nativeEvent.inputType) {
254
+ var _lastKeyboardPointRef_current1;
255
+ clearLocalEditableText();
256
+ event.preventDefault();
257
+ event.stopPropagation();
258
+ null == onKeyboardPress || onKeyboardPress('Enter', null != (_lastKeyboardPointRef_current1 = lastKeyboardPointRef.current) ? _lastKeyboardPointRef_current1 : void 0);
259
+ return;
260
+ }
261
+ if ('deleteContentBackward' === nativeEvent.inputType) {
262
+ var _lastKeyboardPointRef_current2;
263
+ clearLocalEditableText();
264
+ event.preventDefault();
265
+ event.stopPropagation();
266
+ null == onKeyboardPress || onKeyboardPress('Backspace', null != (_lastKeyboardPointRef_current2 = lastKeyboardPointRef.current) ? _lastKeyboardPointRef_current2 : void 0);
267
+ return;
268
+ }
269
+ if ('deleteContentForward' === nativeEvent.inputType) {
270
+ var _lastKeyboardPointRef_current3;
271
+ clearLocalEditableText();
272
+ event.preventDefault();
273
+ event.stopPropagation();
274
+ null == onKeyboardPress || onKeyboardPress('Delete', null != (_lastKeyboardPointRef_current3 = lastKeyboardPointRef.current) ? _lastKeyboardPointRef_current3 : void 0);
275
+ return;
276
+ }
277
+ const text = nativeEvent.data || (null == (_keyboardSinkRef_current = keyboardSinkRef.current) ? void 0 : _keyboardSinkRef_current.value) || '';
278
+ clearLocalEditableText();
279
+ if (!text) return;
280
+ event.preventDefault();
281
+ event.stopPropagation();
282
+ null == onTextInput || onTextInput(text, null != (_lastKeyboardPointRef_current = lastKeyboardPointRef.current) ? _lastKeyboardPointRef_current : void 0);
283
+ }, [
284
+ clearLocalEditableText,
285
+ keyboardEnabled,
286
+ onKeyboardPress,
287
+ onTextInput
288
+ ]);
289
+ useEffect(()=>{
290
+ if (!enabled) {
291
+ activePointer.current = null;
292
+ composingRef.current = false;
293
+ keyboardArmedRef.current = false;
294
+ lastKeyboardPointRef.current = null;
295
+ }
296
+ }, [
297
+ enabled
298
+ ]);
299
+ useEffect(()=>{
300
+ if (!enabled || !keyboardEnabled) {
301
+ keyboardArmedRef.current = false;
302
+ return;
303
+ }
304
+ const handleDocumentPointerDown = (event)=>{
305
+ const overlay = overlayRef.current;
306
+ if (overlay && event.target instanceof Node && overlay.contains(event.target)) return;
307
+ keyboardArmedRef.current = false;
308
+ };
309
+ window.addEventListener('keydown', handleKeyboardEvent, true);
310
+ window.addEventListener('pointerdown', handleDocumentPointerDown, true);
311
+ return ()=>{
312
+ window.removeEventListener('keydown', handleKeyboardEvent, true);
313
+ window.removeEventListener('pointerdown', handleDocumentPointerDown, true);
314
+ };
315
+ }, [
316
+ enabled,
317
+ handleKeyboardEvent,
318
+ keyboardEnabled
319
+ ]);
320
+ if (!enabled || !deviceSize) return null;
321
+ return /*#__PURE__*/ jsx("div", {
322
+ ref: overlayRef,
323
+ onPointerDown: handlePointerDown,
324
+ onPointerUp: handlePointerUp,
325
+ onPointerCancel: handlePointerCancel,
326
+ onContextMenu: (e)=>e.preventDefault(),
327
+ "data-midscene-device-interaction-layer": "true",
328
+ style: _object_spread({
329
+ position: 'absolute',
330
+ inset: 0,
331
+ zIndex: 5,
332
+ cursor: keyboardEnabled ? 'default' : 'crosshair',
333
+ outline: 'none',
334
+ color: 'transparent',
335
+ caretColor: 'transparent',
336
+ touchAction: 'none',
337
+ userSelect: 'none'
338
+ }, style),
339
+ children: keyboardEnabled ? /*#__PURE__*/ jsx("textarea", {
340
+ ref: keyboardSinkRef,
341
+ "data-midscene-keyboard-sink": "true",
342
+ tabIndex: -1,
343
+ onPaste: handlePaste,
344
+ onCompositionStart: ()=>{
345
+ keyboardArmedRef.current = true;
346
+ composingRef.current = true;
347
+ },
348
+ onCompositionEnd: (event)=>{
349
+ var _keyboardSinkRef_current;
350
+ if (!keyboardEnabled || !keyboardArmedRef.current) return;
351
+ composingRef.current = false;
352
+ const text = event.data || (null == (_keyboardSinkRef_current = keyboardSinkRef.current) ? void 0 : _keyboardSinkRef_current.value) || '';
353
+ clearLocalEditableText();
354
+ if (text) {
355
+ var _lastKeyboardPointRef_current;
356
+ null == onTextInput || onTextInput(text, null != (_lastKeyboardPointRef_current = lastKeyboardPointRef.current) ? _lastKeyboardPointRef_current : void 0);
357
+ }
358
+ },
359
+ onInput: handleEditableInput,
360
+ style: {
361
+ position: 'absolute',
362
+ left: 0,
363
+ top: 0,
364
+ width: 32,
365
+ height: 24,
366
+ opacity: 0.01,
367
+ pointerEvents: 'none',
368
+ resize: 'none',
369
+ border: 0,
370
+ padding: 0,
371
+ margin: 0,
372
+ outline: 'none',
373
+ background: 'transparent',
374
+ color: 'transparent',
375
+ caretColor: 'transparent',
376
+ fontSize: 16,
377
+ lineHeight: '20px',
378
+ transform: 'translate(-50%, -50%)'
379
+ }
380
+ }) : null
381
+ });
382
+ }
383
+ export { DeviceInteractionLayer, inscribedContentRect, keyNameForKeyboardEvent };
@@ -0,0 +1,207 @@
1
+ body {
2
+ margin: 0;
3
+ padding: 0;
4
+ font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Noto Sans, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji;
5
+ font-size: 14px;
6
+ }
7
+
8
+ h3 {
9
+ text-transform: capitalize;
10
+ }
11
+
12
+ .app-container {
13
+ background-color: #f5f5f5;
14
+ flex-direction: column;
15
+ width: 100%;
16
+ height: 100vh;
17
+ display: flex;
18
+ }
19
+
20
+ .app-content {
21
+ height: 100vh;
22
+ overflow: hidden;
23
+ }
24
+
25
+ .app-panel {
26
+ background-color: #fff;
27
+ border-radius: 0;
28
+ height: 100%;
29
+ transition: box-shadow .3s;
30
+ overflow: hidden;
31
+ box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
32
+ }
33
+
34
+ .app-panel:hover {
35
+ box-shadow: 0 2px 8px rgba(0, 0, 0, .09);
36
+ }
37
+
38
+ .app-panel.left-panel {
39
+ flex-direction: column;
40
+ height: 100%;
41
+ display: flex;
42
+ overflow: hidden;
43
+ }
44
+
45
+ .app-panel.right-panel {
46
+ border-radius: 0;
47
+ flex: 1;
48
+ padding-top: 16px;
49
+ overflow: hidden;
50
+ box-shadow: -4px 0 20px rgba(0, 0, 0, .04);
51
+ }
52
+
53
+ .panel-content {
54
+ flex-direction: column;
55
+ height: 100%;
56
+ display: flex;
57
+ overflow: auto;
58
+ }
59
+
60
+ .panel-content.left-panel-content {
61
+ flex-direction: column;
62
+ height: 100%;
63
+ display: flex;
64
+ position: relative;
65
+ overflow: hidden;
66
+ }
67
+
68
+ .panel-content.left-panel-content .playground-panel-header {
69
+ border-bottom: 1px solid rgba(0, 0, 0, .06);
70
+ flex-shrink: 0;
71
+ align-items: center;
72
+ height: 60px;
73
+ padding: 0 24px;
74
+ display: flex;
75
+ }
76
+
77
+ .panel-content.left-panel-content .playground-panel-header .header-row {
78
+ justify-content: space-between;
79
+ align-items: center;
80
+ gap: 10px;
81
+ width: 100%;
82
+ display: flex;
83
+ }
84
+
85
+ .panel-content.left-panel-content .playground-panel-playground {
86
+ flex-direction: column;
87
+ flex: 1;
88
+ min-height: 0;
89
+ padding: 0 24px;
90
+ display: flex;
91
+ }
92
+
93
+ .panel-content.left-panel-content .playground-panel-playground .playground-container {
94
+ background: #fff;
95
+ border: none;
96
+ border-radius: 8px;
97
+ flex: 1;
98
+ overflow: hidden;
99
+ }
100
+
101
+ .panel-content.right-panel-content {
102
+ border-radius: 0;
103
+ flex-direction: column;
104
+ padding: 0 24px 24px;
105
+ display: flex;
106
+ overflow: hidden;
107
+ }
108
+
109
+ .panel-content.right-panel-content .screenshot-viewer {
110
+ flex: 1;
111
+ overflow: hidden;
112
+ }
113
+
114
+ .server-offline-container {
115
+ background: #f5f5f5;
116
+ justify-content: center;
117
+ align-items: center;
118
+ height: 100vh;
119
+ display: flex;
120
+ }
121
+
122
+ .server-offline-container .server-offline-message {
123
+ background: #f2f4f7;
124
+ border-radius: 8px;
125
+ flex-direction: column;
126
+ width: 100%;
127
+ height: 100%;
128
+ padding: 14px 24px 0;
129
+ display: flex;
130
+ box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
131
+ }
132
+
133
+ .server-offline-container .server-offline-message .server-offline-content {
134
+ text-align: center;
135
+ flex-direction: column;
136
+ flex: 1;
137
+ justify-content: flex-start;
138
+ align-items: center;
139
+ padding-top: max(200px, min(24vh, 280px));
140
+ display: flex;
141
+ }
142
+
143
+ .server-offline-container .server-offline-message .server-offline-icon {
144
+ width: 300px;
145
+ height: 212px;
146
+ display: inline-block;
147
+ position: relative;
148
+ }
149
+
150
+ .server-offline-container .server-offline-message .server-offline-icon .icon-background, .server-offline-container .server-offline-message .server-offline-icon .icon-foreground {
151
+ display: block;
152
+ position: absolute;
153
+ top: 50%;
154
+ left: 50%;
155
+ transform: translate(-50%, -50%);
156
+ }
157
+
158
+ .server-offline-container .server-offline-message .server-offline-icon .icon-background {
159
+ z-index: 1;
160
+ width: 300px;
161
+ height: 212px;
162
+ }
163
+
164
+ .server-offline-container .server-offline-message .server-offline-icon .icon-foreground {
165
+ z-index: 2;
166
+ width: 134px;
167
+ height: 101px;
168
+ }
169
+
170
+ .server-offline-container .server-offline-message h1 {
171
+ color: #000;
172
+ margin: 0;
173
+ font-size: 18px;
174
+ font-weight: 600;
175
+ }
176
+
177
+ .server-offline-container .server-offline-message .connection-status {
178
+ text-align: center;
179
+ margin-top: 8px;
180
+ font-size: 12px;
181
+ }
182
+
183
+ .panel-resize-handle {
184
+ background-color: #f0f0f0;
185
+ transition: background-color .2s;
186
+ position: relative;
187
+ }
188
+
189
+ .panel-resize-handle.horizontal {
190
+ cursor: col-resize;
191
+ width: 1px;
192
+ }
193
+
194
+ .panel-resize-handle.vertical {
195
+ cursor: row-resize;
196
+ height: 1px;
197
+ }
198
+
199
+ .panel-resize-handle:hover, .panel-resize-handle:active, .panel-resize-handle[data-resize-handle-active] {
200
+ background-color: #1677ff;
201
+ }
202
+
203
+ .clear-button-container {
204
+ top: 20px !important;
205
+ right: -4px !important;
206
+ }
207
+