@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.
- package/LICENSE +21 -0
- package/README.md +4 -0
- package/dist/es/DeviceInteractionLayer.mjs +383 -0
- package/dist/es/PlaygroundApp.css +207 -0
- package/dist/es/PlaygroundApp.mjs +776 -0
- package/dist/es/PlaygroundPreview.mjs +29 -0
- package/dist/es/PlaygroundThemeProvider.mjs +10 -0
- package/dist/es/PreviewRenderer.mjs +270 -0
- package/dist/es/ScrcpyPanel.mjs +390 -0
- package/dist/es/SessionSetupPanel.css +299 -0
- package/dist/es/SessionSetupPanel.mjs +169 -0
- package/dist/es/components/Header/index.css +19 -0
- package/dist/es/components/Header/index.mjs +37 -0
- package/dist/es/components/Nav/index.css +15 -0
- package/dist/es/components/Nav/index.mjs +93 -0
- package/dist/es/components/WinControlTool/index.css +5 -0
- package/dist/es/components/WinControlTool/index.mjs +76 -0
- package/dist/es/controller/ai-config.mjs +40 -0
- package/dist/es/controller/auto-create.mjs +19 -0
- package/dist/es/controller/selectors.mjs +78 -0
- package/dist/es/controller/single-flight.mjs +13 -0
- package/dist/es/controller/types.mjs +0 -0
- package/dist/es/controller/usePlaygroundController.mjs +400 -0
- package/dist/es/icons/dropdown-chevron.mjs +61 -0
- package/dist/es/icons/midscene-logo.mjs +247 -0
- package/dist/es/icons/server-offline-background.mjs +102 -0
- package/dist/es/icons/server-offline-foreground.mjs +200 -0
- package/dist/es/index.mjs +7 -0
- package/dist/es/manual-interaction.mjs +56 -0
- package/dist/es/panels/PlaygroundConversationPanel.css +20 -0
- package/dist/es/panels/PlaygroundConversationPanel.mjs +140 -0
- package/dist/es/runtime-info.mjs +128 -0
- package/dist/es/scrcpy-preview.mjs +30 -0
- package/dist/es/scrcpy-stream.mjs +53 -0
- package/dist/es/session-setup.mjs +13 -0
- package/dist/es/session-state.mjs +32 -0
- package/dist/es/useServerStatus.mjs +120 -0
- package/dist/lib/DeviceInteractionLayer.js +434 -0
- package/dist/lib/PlaygroundApp.css +207 -0
- package/dist/lib/PlaygroundApp.js +821 -0
- package/dist/lib/PlaygroundPreview.js +63 -0
- package/dist/lib/PlaygroundThemeProvider.js +44 -0
- package/dist/lib/PreviewRenderer.js +304 -0
- package/dist/lib/ScrcpyPanel.js +424 -0
- package/dist/lib/SessionSetupPanel.css +299 -0
- package/dist/lib/SessionSetupPanel.js +217 -0
- package/dist/lib/components/Header/index.css +19 -0
- package/dist/lib/components/Header/index.js +81 -0
- package/dist/lib/components/Nav/index.css +15 -0
- package/dist/lib/components/Nav/index.js +127 -0
- package/dist/lib/components/WinControlTool/index.css +5 -0
- package/dist/lib/components/WinControlTool/index.js +110 -0
- package/dist/lib/controller/ai-config.js +80 -0
- package/dist/lib/controller/auto-create.js +59 -0
- package/dist/lib/controller/selectors.js +115 -0
- package/dist/lib/controller/single-flight.js +47 -0
- package/dist/lib/controller/types.js +18 -0
- package/dist/lib/controller/usePlaygroundController.js +434 -0
- package/dist/lib/icons/dropdown-chevron.js +95 -0
- package/dist/lib/icons/midscene-logo.js +281 -0
- package/dist/lib/icons/server-offline-background.js +136 -0
- package/dist/lib/icons/server-offline-foreground.js +234 -0
- package/dist/lib/index.js +56 -0
- package/dist/lib/manual-interaction.js +90 -0
- package/dist/lib/panels/PlaygroundConversationPanel.css +20 -0
- package/dist/lib/panels/PlaygroundConversationPanel.js +174 -0
- package/dist/lib/runtime-info.js +174 -0
- package/dist/lib/scrcpy-preview.js +79 -0
- package/dist/lib/scrcpy-stream.js +87 -0
- package/dist/lib/session-setup.js +47 -0
- package/dist/lib/session-state.js +69 -0
- package/dist/lib/useServerStatus.js +154 -0
- package/dist/types/DeviceInteractionLayer.d.ts +50 -0
- package/dist/types/PlaygroundApp.d.ts +14 -0
- package/dist/types/PlaygroundPreview.d.ts +22 -0
- package/dist/types/PlaygroundThemeProvider.d.ts +2 -0
- package/dist/types/PreviewRenderer.d.ts +27 -0
- package/dist/types/ScrcpyPanel.d.ts +21 -0
- package/dist/types/SessionSetupPanel.d.ts +16 -0
- package/dist/types/components/Header/index.d.ts +3 -0
- package/dist/types/components/Nav/index.d.ts +3 -0
- package/dist/types/components/WinControlTool/index.d.ts +3 -0
- package/dist/types/controller/ai-config.d.ts +5 -0
- package/dist/types/controller/auto-create.d.ts +15 -0
- package/dist/types/controller/selectors.d.ts +5 -0
- package/dist/types/controller/single-flight.d.ts +3 -0
- package/dist/types/controller/types.d.ts +36 -0
- package/dist/types/controller/usePlaygroundController.d.ts +16 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/manual-interaction.d.ts +21 -0
- package/dist/types/panels/PlaygroundConversationPanel.d.ts +25 -0
- package/dist/types/runtime-info.d.ts +22 -0
- package/dist/types/scrcpy-preview.d.ts +11 -0
- package/dist/types/scrcpy-stream.d.ts +16 -0
- package/dist/types/session-setup.d.ts +2 -0
- package/dist/types/session-state.d.ts +9 -0
- package/dist/types/useServerStatus.d.ts +12 -0
- package/package.json +69 -0
|
@@ -0,0 +1,63 @@
|
|
|
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 ("u" > 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
|
+
PlaygroundPreview: ()=>PlaygroundPreview
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const external_PreviewRenderer_js_namespaceObject = require("./PreviewRenderer.js");
|
|
31
|
+
function _define_property(obj, key, value) {
|
|
32
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
33
|
+
value: value,
|
|
34
|
+
enumerable: true,
|
|
35
|
+
configurable: true,
|
|
36
|
+
writable: true
|
|
37
|
+
});
|
|
38
|
+
else obj[key] = value;
|
|
39
|
+
return obj;
|
|
40
|
+
}
|
|
41
|
+
function _object_spread(target) {
|
|
42
|
+
for(var i = 1; i < arguments.length; i++){
|
|
43
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
44
|
+
var ownKeys = Object.keys(source);
|
|
45
|
+
if ("function" == typeof Object.getOwnPropertySymbols) ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
46
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
47
|
+
}));
|
|
48
|
+
ownKeys.forEach(function(key) {
|
|
49
|
+
_define_property(target, key, source[key]);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return target;
|
|
53
|
+
}
|
|
54
|
+
function PlaygroundPreview(props) {
|
|
55
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_PreviewRenderer_js_namespaceObject.PreviewRenderer, _object_spread({}, props));
|
|
56
|
+
}
|
|
57
|
+
exports.PlaygroundPreview = __webpack_exports__.PlaygroundPreview;
|
|
58
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
59
|
+
"PlaygroundPreview"
|
|
60
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
61
|
+
Object.defineProperty(exports, '__esModule', {
|
|
62
|
+
value: true
|
|
63
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
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 ("u" > 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
|
+
PlaygroundThemeProvider: ()=>PlaygroundThemeProvider
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const visualizer_namespaceObject = require("@godscene/visualizer");
|
|
31
|
+
const external_antd_namespaceObject = require("antd");
|
|
32
|
+
function PlaygroundThemeProvider({ children }) {
|
|
33
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.ConfigProvider, {
|
|
34
|
+
theme: (0, visualizer_namespaceObject.globalThemeConfig)(),
|
|
35
|
+
children: children
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
exports.PlaygroundThemeProvider = __webpack_exports__.PlaygroundThemeProvider;
|
|
39
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
40
|
+
"PlaygroundThemeProvider"
|
|
41
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
42
|
+
Object.defineProperty(exports, '__esModule', {
|
|
43
|
+
value: true
|
|
44
|
+
});
|
|
@@ -0,0 +1,304 @@
|
|
|
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 ("u" > 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
|
+
PreviewRenderer: ()=>PreviewRenderer
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const visualizer_namespaceObject = require("@godscene/visualizer");
|
|
31
|
+
const scrcpy_decoder_webcodecs_namespaceObject = require("@yume-chan/scrcpy-decoder-webcodecs");
|
|
32
|
+
const external_antd_namespaceObject = require("antd");
|
|
33
|
+
const external_react_namespaceObject = require("react");
|
|
34
|
+
const external_DeviceInteractionLayer_js_namespaceObject = require("./DeviceInteractionLayer.js");
|
|
35
|
+
const external_ScrcpyPanel_js_namespaceObject = require("./ScrcpyPanel.js");
|
|
36
|
+
const external_manual_interaction_js_namespaceObject = require("./manual-interaction.js");
|
|
37
|
+
const external_runtime_info_js_namespaceObject = require("./runtime-info.js");
|
|
38
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
39
|
+
try {
|
|
40
|
+
var info = gen[key](arg);
|
|
41
|
+
var value = info.value;
|
|
42
|
+
} catch (error) {
|
|
43
|
+
reject(error);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (info.done) resolve(value);
|
|
47
|
+
else Promise.resolve(value).then(_next, _throw);
|
|
48
|
+
}
|
|
49
|
+
function _async_to_generator(fn) {
|
|
50
|
+
return function() {
|
|
51
|
+
var self = this, args = arguments;
|
|
52
|
+
return new Promise(function(resolve, reject) {
|
|
53
|
+
var gen = fn.apply(self, args);
|
|
54
|
+
function _next(value) {
|
|
55
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
56
|
+
}
|
|
57
|
+
function _throw(err) {
|
|
58
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
59
|
+
}
|
|
60
|
+
_next(void 0);
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function isNonLocalhostHttp() {
|
|
65
|
+
try {
|
|
66
|
+
const { protocol, hostname } = window.location;
|
|
67
|
+
if ('http:' !== protocol) return false;
|
|
68
|
+
return 'localhost' !== hostname && '127.0.0.1' !== hostname && '::1' !== hostname;
|
|
69
|
+
} catch (unused) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function PreviewRenderer({ connectingOverlay, onScrcpyStatusChange, renderErrorOverlay, scrcpyViewportStyle, screenshotViewerMode, playgroundSDK, runtimeInfo, serverUrl, serverOnline, isUserOperating, manualControlEnabled = false, manualDragActionType = 'Swipe', manualKeyboardEnabled = false }) {
|
|
74
|
+
const previewConnection = (0, external_runtime_info_js_namespaceObject.resolvePreviewConnectionInfo)(runtimeInfo, serverUrl);
|
|
75
|
+
const [deviceSize, setDeviceSize] = (0, external_react_namespaceObject.useState)(null);
|
|
76
|
+
const manualControlQueueRef = (0, external_react_namespaceObject.useRef)(Promise.resolve());
|
|
77
|
+
const enqueueManualControl = (0, external_react_namespaceObject.useCallback)((task)=>{
|
|
78
|
+
const nextTask = manualControlQueueRef.current.then(task, task);
|
|
79
|
+
manualControlQueueRef.current = nextTask.catch(()=>void 0);
|
|
80
|
+
return nextTask;
|
|
81
|
+
}, []);
|
|
82
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
83
|
+
if (!manualControlEnabled || !serverOnline) return void setDeviceSize(null);
|
|
84
|
+
let cancelled = false;
|
|
85
|
+
const fetchSize = ()=>_async_to_generator(function*() {
|
|
86
|
+
var _result_size;
|
|
87
|
+
let result;
|
|
88
|
+
try {
|
|
89
|
+
result = yield playgroundSDK.getInterfaceInfo();
|
|
90
|
+
} catch (unused) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (cancelled) return;
|
|
94
|
+
if ((null == result ? void 0 : null == (_result_size = result.size) ? void 0 : _result_size.width) && result.size.height) {
|
|
95
|
+
const { size } = result;
|
|
96
|
+
setDeviceSize((current)=>{
|
|
97
|
+
if (current && current.width === size.width && current.height === size.height) return current;
|
|
98
|
+
return {
|
|
99
|
+
width: size.width,
|
|
100
|
+
height: size.height
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
})();
|
|
105
|
+
fetchSize();
|
|
106
|
+
const timer = setInterval(fetchSize, 5000);
|
|
107
|
+
return ()=>{
|
|
108
|
+
cancelled = true;
|
|
109
|
+
clearInterval(timer);
|
|
110
|
+
};
|
|
111
|
+
}, [
|
|
112
|
+
manualControlEnabled,
|
|
113
|
+
playgroundSDK,
|
|
114
|
+
serverOnline
|
|
115
|
+
]);
|
|
116
|
+
const showManualControlError = (0, external_react_namespaceObject.useCallback)((fallback, error)=>{
|
|
117
|
+
external_antd_namespaceObject.message.open({
|
|
118
|
+
type: 'error',
|
|
119
|
+
content: error || fallback,
|
|
120
|
+
key: 'manual-control-error'
|
|
121
|
+
});
|
|
122
|
+
}, []);
|
|
123
|
+
const handleTap = (0, external_react_namespaceObject.useCallback)((point)=>_async_to_generator(function*() {
|
|
124
|
+
const res = yield enqueueManualControl(()=>playgroundSDK.interact({
|
|
125
|
+
actionType: 'Tap',
|
|
126
|
+
x: point.x,
|
|
127
|
+
y: point.y
|
|
128
|
+
}));
|
|
129
|
+
if (!res.ok) showManualControlError('Tap failed', res.error);
|
|
130
|
+
})(), [
|
|
131
|
+
enqueueManualControl,
|
|
132
|
+
playgroundSDK,
|
|
133
|
+
showManualControlError
|
|
134
|
+
]);
|
|
135
|
+
const handleSwipe = (0, external_react_namespaceObject.useCallback)((start, end, duration)=>_async_to_generator(function*() {
|
|
136
|
+
const res = yield enqueueManualControl(()=>playgroundSDK.interact((0, external_manual_interaction_js_namespaceObject.buildManualDragInteractPayload)(manualDragActionType, start, end, duration)));
|
|
137
|
+
if (!res.ok) showManualControlError(`${manualDragActionType} failed`, res.error);
|
|
138
|
+
})(), [
|
|
139
|
+
enqueueManualControl,
|
|
140
|
+
manualDragActionType,
|
|
141
|
+
playgroundSDK,
|
|
142
|
+
showManualControlError
|
|
143
|
+
]);
|
|
144
|
+
const handleTextInput = (0, external_react_namespaceObject.useCallback)((text)=>_async_to_generator(function*() {
|
|
145
|
+
if (!text) return;
|
|
146
|
+
const res = yield enqueueManualControl(()=>playgroundSDK.interact({
|
|
147
|
+
actionType: 'Input',
|
|
148
|
+
value: text,
|
|
149
|
+
mode: 'typeOnly'
|
|
150
|
+
}));
|
|
151
|
+
if (!res.ok) showManualControlError('Input failed', res.error);
|
|
152
|
+
})(), [
|
|
153
|
+
enqueueManualControl,
|
|
154
|
+
playgroundSDK,
|
|
155
|
+
showManualControlError
|
|
156
|
+
]);
|
|
157
|
+
const handleKeyboardPress = (0, external_react_namespaceObject.useCallback)((keyName)=>_async_to_generator(function*() {
|
|
158
|
+
if (!keyName) return;
|
|
159
|
+
const res = yield enqueueManualControl(()=>playgroundSDK.interact({
|
|
160
|
+
actionType: 'KeyboardPress',
|
|
161
|
+
keyName
|
|
162
|
+
}));
|
|
163
|
+
if (!res.ok) showManualControlError('Keyboard press failed', res.error);
|
|
164
|
+
})(), [
|
|
165
|
+
enqueueManualControl,
|
|
166
|
+
playgroundSDK,
|
|
167
|
+
showManualControlError
|
|
168
|
+
]);
|
|
169
|
+
const scrcpyAvailable = 'scrcpy' === previewConnection.type && scrcpy_decoder_webcodecs_namespaceObject.WebCodecsVideoDecoder.isSupported;
|
|
170
|
+
const useScreenshot = 'screenshot' === previewConnection.type || 'scrcpy' === previewConnection.type && !scrcpyAvailable;
|
|
171
|
+
const showInsecureContextHint = 'scrcpy' === previewConnection.type && !scrcpy_decoder_webcodecs_namespaceObject.WebCodecsVideoDecoder.isSupported && isNonLocalhostHttp();
|
|
172
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
173
|
+
style: {
|
|
174
|
+
flex: 1,
|
|
175
|
+
minHeight: 0,
|
|
176
|
+
height: '100%',
|
|
177
|
+
position: 'relative'
|
|
178
|
+
},
|
|
179
|
+
children: [
|
|
180
|
+
showInsecureContextHint && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Popover, {
|
|
181
|
+
content: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
182
|
+
style: {
|
|
183
|
+
maxWidth: 360
|
|
184
|
+
},
|
|
185
|
+
children: [
|
|
186
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
|
|
187
|
+
style: {
|
|
188
|
+
margin: '0 0 8px'
|
|
189
|
+
},
|
|
190
|
+
children: "Live scrcpy streaming is unavailable because WebCodecs API is disabled in non-secure (HTTP) contexts with non-localhost addresses."
|
|
191
|
+
}),
|
|
192
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
|
|
193
|
+
style: {
|
|
194
|
+
margin: '0 0 8px'
|
|
195
|
+
},
|
|
196
|
+
children: "Currently using screenshot polling as fallback. To enable scrcpy streaming:"
|
|
197
|
+
}),
|
|
198
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("ol", {
|
|
199
|
+
style: {
|
|
200
|
+
margin: 0,
|
|
201
|
+
paddingLeft: 18
|
|
202
|
+
},
|
|
203
|
+
children: [
|
|
204
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("li", {
|
|
205
|
+
children: [
|
|
206
|
+
"Open",
|
|
207
|
+
' ',
|
|
208
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("code", {
|
|
209
|
+
children: "chrome://flags/#unsafely-treat-insecure-origin-as-secure"
|
|
210
|
+
})
|
|
211
|
+
]
|
|
212
|
+
}),
|
|
213
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("li", {
|
|
214
|
+
children: [
|
|
215
|
+
"Add ",
|
|
216
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("code", {
|
|
217
|
+
children: window.location.origin
|
|
218
|
+
})
|
|
219
|
+
]
|
|
220
|
+
}),
|
|
221
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("li", {
|
|
222
|
+
children: [
|
|
223
|
+
"Set to ",
|
|
224
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("b", {
|
|
225
|
+
children: "Enabled"
|
|
226
|
+
}),
|
|
227
|
+
" and relaunch Chrome"
|
|
228
|
+
]
|
|
229
|
+
})
|
|
230
|
+
]
|
|
231
|
+
})
|
|
232
|
+
]
|
|
233
|
+
}),
|
|
234
|
+
title: "Screenshot polling mode",
|
|
235
|
+
trigger: "click",
|
|
236
|
+
placement: "bottomRight",
|
|
237
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
238
|
+
type: "button",
|
|
239
|
+
style: {
|
|
240
|
+
position: 'absolute',
|
|
241
|
+
top: 8,
|
|
242
|
+
right: 8,
|
|
243
|
+
zIndex: 10,
|
|
244
|
+
background: '#faad14',
|
|
245
|
+
border: 'none',
|
|
246
|
+
borderRadius: '50%',
|
|
247
|
+
width: 28,
|
|
248
|
+
height: 28,
|
|
249
|
+
display: 'flex',
|
|
250
|
+
alignItems: 'center',
|
|
251
|
+
justifyContent: 'center',
|
|
252
|
+
cursor: 'pointer',
|
|
253
|
+
boxShadow: '0 2px 6px rgba(0,0,0,0.2)'
|
|
254
|
+
},
|
|
255
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
256
|
+
style: {
|
|
257
|
+
color: '#fff',
|
|
258
|
+
fontSize: 14,
|
|
259
|
+
fontWeight: 'bold',
|
|
260
|
+
lineHeight: 1
|
|
261
|
+
},
|
|
262
|
+
children: "!"
|
|
263
|
+
})
|
|
264
|
+
})
|
|
265
|
+
}),
|
|
266
|
+
'none' === previewConnection.type ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Alert, {
|
|
267
|
+
type: "warning",
|
|
268
|
+
showIcon: true,
|
|
269
|
+
message: "Preview unavailable",
|
|
270
|
+
description: "This session did not expose a preview capability in runtime metadata."
|
|
271
|
+
}) : scrcpyAvailable ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ScrcpyPanel_js_namespaceObject.ScrcpyPanel, {
|
|
272
|
+
connectingOverlay: connectingOverlay,
|
|
273
|
+
deviceId: previewConnection.deviceId,
|
|
274
|
+
onStatusChange: onScrcpyStatusChange,
|
|
275
|
+
renderErrorOverlay: renderErrorOverlay,
|
|
276
|
+
serverUrl: previewConnection.scrcpyUrl,
|
|
277
|
+
viewportStyle: scrcpyViewportStyle
|
|
278
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(visualizer_namespaceObject.ScreenshotViewer, {
|
|
279
|
+
getScreenshot: ()=>useScreenshot ? playgroundSDK.getScreenshot() : Promise.resolve(null),
|
|
280
|
+
getInterfaceInfo: ()=>playgroundSDK.getInterfaceInfo(),
|
|
281
|
+
serverOnline: serverOnline,
|
|
282
|
+
isUserOperating: isUserOperating,
|
|
283
|
+
mjpegUrl: previewConnection.mjpegUrl,
|
|
284
|
+
mode: screenshotViewerMode
|
|
285
|
+
}),
|
|
286
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_DeviceInteractionLayer_js_namespaceObject.DeviceInteractionLayer, {
|
|
287
|
+
enabled: manualControlEnabled && serverOnline && 'none' !== previewConnection.type,
|
|
288
|
+
deviceSize: deviceSize,
|
|
289
|
+
onTap: handleTap,
|
|
290
|
+
onSwipe: handleSwipe,
|
|
291
|
+
keyboardEnabled: manualKeyboardEnabled,
|
|
292
|
+
onTextInput: handleTextInput,
|
|
293
|
+
onKeyboardPress: handleKeyboardPress
|
|
294
|
+
})
|
|
295
|
+
]
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
exports.PreviewRenderer = __webpack_exports__.PreviewRenderer;
|
|
299
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
300
|
+
"PreviewRenderer"
|
|
301
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
302
|
+
Object.defineProperty(exports, '__esModule', {
|
|
303
|
+
value: true
|
|
304
|
+
});
|