@midscene/playground-app 1.8.4-beta-20260521070317.0 → 1.8.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.
- package/dist/es/DeviceInteractionLayer.mjs +5 -2
- package/dist/es/DisconnectedPreview.mjs +45 -0
- package/dist/es/PlaygroundApp.mjs +3 -2
- package/dist/es/PreviewRenderer.mjs +7 -2
- package/dist/es/ScrcpyPanel.mjs +2 -1
- package/dist/es/icons/connection-closed.mjs +76 -0
- package/dist/lib/DeviceInteractionLayer.js +5 -2
- package/dist/lib/DisconnectedPreview.js +91 -0
- package/dist/lib/PlaygroundApp.js +3 -2
- package/dist/lib/PreviewRenderer.js +7 -2
- package/dist/lib/ScrcpyPanel.js +13 -1
- package/dist/lib/icons/connection-closed.js +110 -0
- package/dist/types/DeviceInteractionLayer.d.ts +9 -1
- package/dist/types/DisconnectedPreview.d.ts +5 -0
- package/dist/types/ScrcpyPanel.d.ts +2 -1
- package/package.json +4 -4
|
@@ -107,7 +107,7 @@ function inscribedContentRect(panel, deviceSize) {
|
|
|
107
107
|
height: renderedHeight
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
function DeviceInteractionLayer({ enabled, deviceSize, onTap, onSwipe, keyboardEnabled = false, onTextInput, onKeyboardPress, tapMaxDistance = 8, tapMaxDurationMs = 250, style }) {
|
|
110
|
+
function DeviceInteractionLayer({ enabled, deviceSize, onTap, onSwipe, keyboardEnabled = false, onTextInput, onKeyboardPress, contentRef, tapMaxDistance = 8, tapMaxDurationMs = 250, style }) {
|
|
111
111
|
const overlayRef = useRef(null);
|
|
112
112
|
const keyboardSinkRef = useRef(null);
|
|
113
113
|
const activePointer = useRef(null);
|
|
@@ -149,7 +149,9 @@ function DeviceInteractionLayer({ enabled, deviceSize, onTap, onSwipe, keyboardE
|
|
|
149
149
|
const handlePointerDown = useCallback((event)=>{
|
|
150
150
|
if (!enabled || !deviceSize || !overlayRef.current) return;
|
|
151
151
|
if (0 !== event.button && 'mouse' === event.pointerType) return;
|
|
152
|
-
|
|
152
|
+
var _contentRef_current;
|
|
153
|
+
const measurementSource = null != (_contentRef_current = null == contentRef ? void 0 : contentRef.current) ? _contentRef_current : overlayRef.current;
|
|
154
|
+
const panelRect = measurementSource.getBoundingClientRect();
|
|
153
155
|
const contentRect = inscribedContentRect(panelRect, deviceSize);
|
|
154
156
|
if (event.clientX < contentRect.left || event.clientX > contentRect.left + contentRect.width || event.clientY < contentRect.top || event.clientY > contentRect.top + contentRect.height) {
|
|
155
157
|
keyboardArmedRef.current = false;
|
|
@@ -168,6 +170,7 @@ function DeviceInteractionLayer({ enabled, deviceSize, onTap, onSwipe, keyboardE
|
|
|
168
170
|
};
|
|
169
171
|
event.preventDefault();
|
|
170
172
|
}, [
|
|
173
|
+
contentRef,
|
|
171
174
|
enabled,
|
|
172
175
|
deviceSize,
|
|
173
176
|
focusKeyboardSink,
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import connection_closed from "./icons/connection-closed.mjs";
|
|
4
|
+
function DisconnectedPreview({ title = 'Connect to a device' }) {
|
|
5
|
+
return /*#__PURE__*/ jsx("div", {
|
|
6
|
+
style: {
|
|
7
|
+
display: 'flex',
|
|
8
|
+
height: '100%',
|
|
9
|
+
width: '100%',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
justifyContent: 'center'
|
|
12
|
+
},
|
|
13
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
14
|
+
style: {
|
|
15
|
+
display: 'flex',
|
|
16
|
+
flexDirection: 'column',
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
gap: 4
|
|
19
|
+
},
|
|
20
|
+
children: [
|
|
21
|
+
/*#__PURE__*/ jsx(connection_closed, {
|
|
22
|
+
"aria-hidden": "true",
|
|
23
|
+
style: {
|
|
24
|
+
width: 24,
|
|
25
|
+
height: 24,
|
|
26
|
+
objectFit: 'contain'
|
|
27
|
+
}
|
|
28
|
+
}),
|
|
29
|
+
/*#__PURE__*/ jsx("h2", {
|
|
30
|
+
style: {
|
|
31
|
+
margin: 0,
|
|
32
|
+
whiteSpace: 'nowrap',
|
|
33
|
+
textAlign: 'center',
|
|
34
|
+
fontSize: 13,
|
|
35
|
+
lineHeight: '24px',
|
|
36
|
+
fontWeight: 400,
|
|
37
|
+
color: 'rgba(0, 0, 0, 0.85)'
|
|
38
|
+
},
|
|
39
|
+
children: title
|
|
40
|
+
})
|
|
41
|
+
]
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export { DisconnectedPreview };
|
|
@@ -3,6 +3,7 @@ import { Logo, NavActions } from "@midscene/visualizer";
|
|
|
3
3
|
import { Layout } from "antd";
|
|
4
4
|
import { useEffect, useState } from "react";
|
|
5
5
|
import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
|
|
6
|
+
import { DisconnectedPreview } from "./DisconnectedPreview.mjs";
|
|
6
7
|
import { PlaygroundPreview } from "./PlaygroundPreview.mjs";
|
|
7
8
|
import { PlaygroundThemeProvider } from "./PlaygroundThemeProvider.mjs";
|
|
8
9
|
import { usePlaygroundController } from "./controller/usePlaygroundController.mjs";
|
|
@@ -115,13 +116,13 @@ function PlaygroundApp({ serverUrl, appVersion, title = 'Playground', defaultDev
|
|
|
115
116
|
className: "app-panel right-panel",
|
|
116
117
|
children: /*#__PURE__*/ jsx("div", {
|
|
117
118
|
className: "panel-content right-panel-content",
|
|
118
|
-
children: /*#__PURE__*/ jsx(PlaygroundPreview, {
|
|
119
|
+
children: controller.state.sessionViewState.connected ? /*#__PURE__*/ jsx(PlaygroundPreview, {
|
|
119
120
|
playgroundSDK: controller.state.playgroundSDK,
|
|
120
121
|
runtimeInfo: controller.state.runtimeInfo,
|
|
121
122
|
serverUrl: serverUrl,
|
|
122
123
|
serverOnline: controller.state.serverOnline,
|
|
123
124
|
isUserOperating: controller.state.isUserOperating
|
|
124
|
-
})
|
|
125
|
+
}) : /*#__PURE__*/ jsx(DisconnectedPreview, {})
|
|
125
126
|
})
|
|
126
127
|
})
|
|
127
128
|
]
|
|
@@ -48,6 +48,8 @@ function PreviewRenderer({ connectingOverlay, onDeviceSizeChange, onScrcpyStatus
|
|
|
48
48
|
const [streamSize, setStreamSize] = useState(null);
|
|
49
49
|
const [actionTypes, setActionTypes] = useState(null);
|
|
50
50
|
const manualControlQueueRef = useRef(Promise.resolve());
|
|
51
|
+
const previewContentRef = useRef(null);
|
|
52
|
+
const resolvedScreenshotViewerMode = null != screenshotViewerMode ? screenshotViewerMode : 'screen-only';
|
|
51
53
|
var _actionTypes_includes;
|
|
52
54
|
const manualControlEnabled = null != (_actionTypes_includes = null == actionTypes ? void 0 : actionTypes.includes('Tap')) ? _actionTypes_includes : false;
|
|
53
55
|
const manualDragActionType = (null == actionTypes ? void 0 : actionTypes.includes('Swipe')) ? 'Swipe' : 'DragAndDrop';
|
|
@@ -269,18 +271,21 @@ function PreviewRenderer({ connectingOverlay, onDeviceSizeChange, onScrcpyStatus
|
|
|
269
271
|
onStatusChange: onScrcpyStatusChange,
|
|
270
272
|
renderErrorOverlay: renderErrorOverlay,
|
|
271
273
|
serverUrl: previewConnection.scrcpyUrl,
|
|
272
|
-
viewportStyle: scrcpyViewportStyle
|
|
274
|
+
viewportStyle: scrcpyViewportStyle,
|
|
275
|
+
contentRef: previewContentRef
|
|
273
276
|
}) : /*#__PURE__*/ jsx(ScreenshotViewer, {
|
|
274
277
|
getScreenshot: ()=>useScreenshot ? playgroundSDK.getScreenshot() : Promise.resolve(null),
|
|
275
278
|
getInterfaceInfo: ()=>playgroundSDK.getInterfaceInfo(),
|
|
276
279
|
serverOnline: serverOnline,
|
|
277
280
|
isUserOperating: isUserOperating,
|
|
278
281
|
mjpegUrl: previewConnection.mjpegUrl,
|
|
279
|
-
mode:
|
|
282
|
+
mode: resolvedScreenshotViewerMode,
|
|
283
|
+
contentRef: previewContentRef
|
|
280
284
|
}),
|
|
281
285
|
/*#__PURE__*/ jsx(DeviceInteractionLayer, {
|
|
282
286
|
enabled: manualControlEnabled && serverOnline && 'none' !== previewConnection.type,
|
|
283
287
|
deviceSize: deviceSize,
|
|
288
|
+
contentRef: previewContentRef,
|
|
284
289
|
onTap: handleTap,
|
|
285
290
|
onSwipe: handleSwipe,
|
|
286
291
|
keyboardEnabled: manualKeyboardEnabled,
|
package/dist/es/ScrcpyPanel.mjs
CHANGED
|
@@ -75,7 +75,7 @@ function _object_spread_props(target, source) {
|
|
|
75
75
|
return target;
|
|
76
76
|
}
|
|
77
77
|
const { Text } = Typography;
|
|
78
|
-
function ScrcpyPanel({ connectingOverlay, deviceId, onIntrinsicSize, onStatusChange, renderErrorOverlay, serverUrl, metadataTimeoutMs = SCRCPY_METADATA_TIMEOUT_MS, reconnectInterval = 3000, viewportStyle }) {
|
|
78
|
+
function ScrcpyPanel({ connectingOverlay, deviceId, onIntrinsicSize, onStatusChange, renderErrorOverlay, serverUrl, metadataTimeoutMs = SCRCPY_METADATA_TIMEOUT_MS, reconnectInterval = 3000, viewportStyle, contentRef }) {
|
|
79
79
|
const canvasStageRef = useRef(null);
|
|
80
80
|
const socketRef = useRef(null);
|
|
81
81
|
const decoderRef = useRef(null);
|
|
@@ -307,6 +307,7 @@ function ScrcpyPanel({ connectingOverlay, deviceId, onIntrinsicSize, onStatusCha
|
|
|
307
307
|
description: errorMessage
|
|
308
308
|
}) : null,
|
|
309
309
|
/*#__PURE__*/ jsxs("div", {
|
|
310
|
+
ref: contentRef,
|
|
310
311
|
style: _object_spread({
|
|
311
312
|
position: 'relative',
|
|
312
313
|
flex: 1,
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "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
|
+
function connection_closed_ownKeys(object, enumerableOnly) {
|
|
27
|
+
var keys = Object.keys(object);
|
|
28
|
+
if (Object.getOwnPropertySymbols) {
|
|
29
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
30
|
+
if (enumerableOnly) symbols = symbols.filter(function(sym) {
|
|
31
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
32
|
+
});
|
|
33
|
+
keys.push.apply(keys, symbols);
|
|
34
|
+
}
|
|
35
|
+
return keys;
|
|
36
|
+
}
|
|
37
|
+
function _object_spread_props(target, source) {
|
|
38
|
+
source = null != source ? source : {};
|
|
39
|
+
if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
40
|
+
else connection_closed_ownKeys(Object(source)).forEach(function(key) {
|
|
41
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
42
|
+
});
|
|
43
|
+
return target;
|
|
44
|
+
}
|
|
45
|
+
const SvgConnectionClosed = (props)=>/*#__PURE__*/ jsxs("svg", _object_spread_props(_object_spread({
|
|
46
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
47
|
+
width: 24,
|
|
48
|
+
height: 24,
|
|
49
|
+
fill: "none",
|
|
50
|
+
viewBox: "0 0 24 24"
|
|
51
|
+
}, props), {
|
|
52
|
+
children: [
|
|
53
|
+
/*#__PURE__*/ jsx("path", {
|
|
54
|
+
stroke: "#6D6D6D",
|
|
55
|
+
strokeLinecap: "round",
|
|
56
|
+
strokeLinejoin: "round",
|
|
57
|
+
strokeWidth: 2,
|
|
58
|
+
d: "M22 9.483A14.53 14.53 0 0 0 9.75 5.674M19 12.9a9.85 9.85 0 0 0-4.75-2.642M5 12.9a10 10 0 0 1 2.18-1.65M8 16.157a5.63 5.63 0 0 1 2.5-1.455"
|
|
59
|
+
}),
|
|
60
|
+
/*#__PURE__*/ jsx("path", {
|
|
61
|
+
fill: "#6D6D6D",
|
|
62
|
+
fillRule: "evenodd",
|
|
63
|
+
d: "M12 20a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5",
|
|
64
|
+
clipRule: "evenodd"
|
|
65
|
+
}),
|
|
66
|
+
/*#__PURE__*/ jsx("path", {
|
|
67
|
+
stroke: "#6D6D6D",
|
|
68
|
+
strokeLinecap: "round",
|
|
69
|
+
strokeLinejoin: "round",
|
|
70
|
+
strokeWidth: 2,
|
|
71
|
+
d: "M20 20 4 4M2 9.483a15 15 0 0 1 1.75-1.42"
|
|
72
|
+
})
|
|
73
|
+
]
|
|
74
|
+
}));
|
|
75
|
+
const connection_closed = SvgConnectionClosed;
|
|
76
|
+
export { connection_closed as default };
|
|
@@ -148,7 +148,7 @@ function inscribedContentRect(panel, deviceSize) {
|
|
|
148
148
|
height: renderedHeight
|
|
149
149
|
};
|
|
150
150
|
}
|
|
151
|
-
function DeviceInteractionLayer({ enabled, deviceSize, onTap, onSwipe, keyboardEnabled = false, onTextInput, onKeyboardPress, tapMaxDistance = 8, tapMaxDurationMs = 250, style }) {
|
|
151
|
+
function DeviceInteractionLayer({ enabled, deviceSize, onTap, onSwipe, keyboardEnabled = false, onTextInput, onKeyboardPress, contentRef, tapMaxDistance = 8, tapMaxDurationMs = 250, style }) {
|
|
152
152
|
const overlayRef = (0, external_react_namespaceObject.useRef)(null);
|
|
153
153
|
const keyboardSinkRef = (0, external_react_namespaceObject.useRef)(null);
|
|
154
154
|
const activePointer = (0, external_react_namespaceObject.useRef)(null);
|
|
@@ -190,7 +190,9 @@ function DeviceInteractionLayer({ enabled, deviceSize, onTap, onSwipe, keyboardE
|
|
|
190
190
|
const handlePointerDown = (0, external_react_namespaceObject.useCallback)((event)=>{
|
|
191
191
|
if (!enabled || !deviceSize || !overlayRef.current) return;
|
|
192
192
|
if (0 !== event.button && 'mouse' === event.pointerType) return;
|
|
193
|
-
|
|
193
|
+
var _contentRef_current;
|
|
194
|
+
const measurementSource = null != (_contentRef_current = null == contentRef ? void 0 : contentRef.current) ? _contentRef_current : overlayRef.current;
|
|
195
|
+
const panelRect = measurementSource.getBoundingClientRect();
|
|
194
196
|
const contentRect = inscribedContentRect(panelRect, deviceSize);
|
|
195
197
|
if (event.clientX < contentRect.left || event.clientX > contentRect.left + contentRect.width || event.clientY < contentRect.top || event.clientY > contentRect.top + contentRect.height) {
|
|
196
198
|
keyboardArmedRef.current = false;
|
|
@@ -209,6 +211,7 @@ function DeviceInteractionLayer({ enabled, deviceSize, onTap, onSwipe, keyboardE
|
|
|
209
211
|
};
|
|
210
212
|
event.preventDefault();
|
|
211
213
|
}, [
|
|
214
|
+
contentRef,
|
|
212
215
|
enabled,
|
|
213
216
|
deviceSize,
|
|
214
217
|
focusKeyboardSink,
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
DisconnectedPreview: ()=>DisconnectedPreview
|
|
37
|
+
});
|
|
38
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
39
|
+
const external_react_namespaceObject = require("react");
|
|
40
|
+
var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
|
|
41
|
+
const connection_closed_js_namespaceObject = require("./icons/connection-closed.js");
|
|
42
|
+
var connection_closed_js_default = /*#__PURE__*/ __webpack_require__.n(connection_closed_js_namespaceObject);
|
|
43
|
+
external_react_default();
|
|
44
|
+
function DisconnectedPreview({ title = 'Connect to a device' }) {
|
|
45
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
46
|
+
style: {
|
|
47
|
+
display: 'flex',
|
|
48
|
+
height: '100%',
|
|
49
|
+
width: '100%',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
justifyContent: 'center'
|
|
52
|
+
},
|
|
53
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
54
|
+
style: {
|
|
55
|
+
display: 'flex',
|
|
56
|
+
flexDirection: 'column',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
gap: 4
|
|
59
|
+
},
|
|
60
|
+
children: [
|
|
61
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(connection_closed_js_default(), {
|
|
62
|
+
"aria-hidden": "true",
|
|
63
|
+
style: {
|
|
64
|
+
width: 24,
|
|
65
|
+
height: 24,
|
|
66
|
+
objectFit: 'contain'
|
|
67
|
+
}
|
|
68
|
+
}),
|
|
69
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("h2", {
|
|
70
|
+
style: {
|
|
71
|
+
margin: 0,
|
|
72
|
+
whiteSpace: 'nowrap',
|
|
73
|
+
textAlign: 'center',
|
|
74
|
+
fontSize: 13,
|
|
75
|
+
lineHeight: '24px',
|
|
76
|
+
fontWeight: 400,
|
|
77
|
+
color: 'rgba(0, 0, 0, 0.85)'
|
|
78
|
+
},
|
|
79
|
+
children: title
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
})
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
exports.DisconnectedPreview = __webpack_exports__.DisconnectedPreview;
|
|
86
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
87
|
+
"DisconnectedPreview"
|
|
88
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
89
|
+
Object.defineProperty(exports, '__esModule', {
|
|
90
|
+
value: true
|
|
91
|
+
});
|
|
@@ -40,6 +40,7 @@ const visualizer_namespaceObject = require("@midscene/visualizer");
|
|
|
40
40
|
const external_antd_namespaceObject = require("antd");
|
|
41
41
|
const external_react_namespaceObject = require("react");
|
|
42
42
|
const external_react_resizable_panels_namespaceObject = require("react-resizable-panels");
|
|
43
|
+
const external_DisconnectedPreview_js_namespaceObject = require("./DisconnectedPreview.js");
|
|
43
44
|
const external_PlaygroundPreview_js_namespaceObject = require("./PlaygroundPreview.js");
|
|
44
45
|
const external_PlaygroundThemeProvider_js_namespaceObject = require("./PlaygroundThemeProvider.js");
|
|
45
46
|
const usePlaygroundController_js_namespaceObject = require("./controller/usePlaygroundController.js");
|
|
@@ -154,13 +155,13 @@ function PlaygroundApp({ serverUrl, appVersion, title = 'Playground', defaultDev
|
|
|
154
155
|
className: "app-panel right-panel",
|
|
155
156
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
156
157
|
className: "panel-content right-panel-content",
|
|
157
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_PlaygroundPreview_js_namespaceObject.PlaygroundPreview, {
|
|
158
|
+
children: controller.state.sessionViewState.connected ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_PlaygroundPreview_js_namespaceObject.PlaygroundPreview, {
|
|
158
159
|
playgroundSDK: controller.state.playgroundSDK,
|
|
159
160
|
runtimeInfo: controller.state.runtimeInfo,
|
|
160
161
|
serverUrl: serverUrl,
|
|
161
162
|
serverOnline: controller.state.serverOnline,
|
|
162
163
|
isUserOperating: controller.state.isUserOperating
|
|
163
|
-
})
|
|
164
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_DisconnectedPreview_js_namespaceObject.DisconnectedPreview, {})
|
|
164
165
|
})
|
|
165
166
|
})
|
|
166
167
|
]
|
|
@@ -76,6 +76,8 @@ function PreviewRenderer({ connectingOverlay, onDeviceSizeChange, onScrcpyStatus
|
|
|
76
76
|
const [streamSize, setStreamSize] = (0, external_react_namespaceObject.useState)(null);
|
|
77
77
|
const [actionTypes, setActionTypes] = (0, external_react_namespaceObject.useState)(null);
|
|
78
78
|
const manualControlQueueRef = (0, external_react_namespaceObject.useRef)(Promise.resolve());
|
|
79
|
+
const previewContentRef = (0, external_react_namespaceObject.useRef)(null);
|
|
80
|
+
const resolvedScreenshotViewerMode = null != screenshotViewerMode ? screenshotViewerMode : 'screen-only';
|
|
79
81
|
var _actionTypes_includes;
|
|
80
82
|
const manualControlEnabled = null != (_actionTypes_includes = null == actionTypes ? void 0 : actionTypes.includes('Tap')) ? _actionTypes_includes : false;
|
|
81
83
|
const manualDragActionType = (null == actionTypes ? void 0 : actionTypes.includes('Swipe')) ? 'Swipe' : 'DragAndDrop';
|
|
@@ -297,18 +299,21 @@ function PreviewRenderer({ connectingOverlay, onDeviceSizeChange, onScrcpyStatus
|
|
|
297
299
|
onStatusChange: onScrcpyStatusChange,
|
|
298
300
|
renderErrorOverlay: renderErrorOverlay,
|
|
299
301
|
serverUrl: previewConnection.scrcpyUrl,
|
|
300
|
-
viewportStyle: scrcpyViewportStyle
|
|
302
|
+
viewportStyle: scrcpyViewportStyle,
|
|
303
|
+
contentRef: previewContentRef
|
|
301
304
|
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(visualizer_namespaceObject.ScreenshotViewer, {
|
|
302
305
|
getScreenshot: ()=>useScreenshot ? playgroundSDK.getScreenshot() : Promise.resolve(null),
|
|
303
306
|
getInterfaceInfo: ()=>playgroundSDK.getInterfaceInfo(),
|
|
304
307
|
serverOnline: serverOnline,
|
|
305
308
|
isUserOperating: isUserOperating,
|
|
306
309
|
mjpegUrl: previewConnection.mjpegUrl,
|
|
307
|
-
mode:
|
|
310
|
+
mode: resolvedScreenshotViewerMode,
|
|
311
|
+
contentRef: previewContentRef
|
|
308
312
|
}),
|
|
309
313
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_DeviceInteractionLayer_js_namespaceObject.DeviceInteractionLayer, {
|
|
310
314
|
enabled: manualControlEnabled && serverOnline && 'none' !== previewConnection.type,
|
|
311
315
|
deviceSize: deviceSize,
|
|
316
|
+
contentRef: previewContentRef,
|
|
312
317
|
onTap: handleTap,
|
|
313
318
|
onSwipe: handleSwipe,
|
|
314
319
|
keyboardEnabled: manualKeyboardEnabled,
|
package/dist/lib/ScrcpyPanel.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
3
12
|
(()=>{
|
|
4
13
|
__webpack_require__.d = (exports1, definition)=>{
|
|
5
14
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
@@ -31,6 +40,7 @@ const scrcpy_namespaceObject = require("@yume-chan/scrcpy");
|
|
|
31
40
|
const scrcpy_decoder_webcodecs_namespaceObject = require("@yume-chan/scrcpy-decoder-webcodecs");
|
|
32
41
|
const external_antd_namespaceObject = require("antd");
|
|
33
42
|
const external_react_namespaceObject = require("react");
|
|
43
|
+
var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
|
|
34
44
|
const external_socket_io_client_namespaceObject = require("socket.io-client");
|
|
35
45
|
const external_scrcpy_preview_js_namespaceObject = require("./scrcpy-preview.js");
|
|
36
46
|
const external_scrcpy_stream_js_namespaceObject = require("./scrcpy-stream.js");
|
|
@@ -102,8 +112,9 @@ function _object_spread_props(target, source) {
|
|
|
102
112
|
});
|
|
103
113
|
return target;
|
|
104
114
|
}
|
|
115
|
+
external_react_default();
|
|
105
116
|
const { Text } = external_antd_namespaceObject.Typography;
|
|
106
|
-
function ScrcpyPanel({ connectingOverlay, deviceId, onIntrinsicSize, onStatusChange, renderErrorOverlay, serverUrl, metadataTimeoutMs = external_scrcpy_preview_js_namespaceObject.SCRCPY_METADATA_TIMEOUT_MS, reconnectInterval = 3000, viewportStyle }) {
|
|
117
|
+
function ScrcpyPanel({ connectingOverlay, deviceId, onIntrinsicSize, onStatusChange, renderErrorOverlay, serverUrl, metadataTimeoutMs = external_scrcpy_preview_js_namespaceObject.SCRCPY_METADATA_TIMEOUT_MS, reconnectInterval = 3000, viewportStyle, contentRef }) {
|
|
107
118
|
const canvasStageRef = (0, external_react_namespaceObject.useRef)(null);
|
|
108
119
|
const socketRef = (0, external_react_namespaceObject.useRef)(null);
|
|
109
120
|
const decoderRef = (0, external_react_namespaceObject.useRef)(null);
|
|
@@ -335,6 +346,7 @@ function ScrcpyPanel({ connectingOverlay, deviceId, onIntrinsicSize, onStatusCha
|
|
|
335
346
|
description: errorMessage
|
|
336
347
|
}) : null,
|
|
337
348
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
349
|
+
ref: contentRef,
|
|
338
350
|
style: _object_spread({
|
|
339
351
|
position: 'relative',
|
|
340
352
|
flex: 1,
|
|
@@ -0,0 +1,110 @@
|
|
|
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
|
+
default: ()=>connection_closed
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
require("react");
|
|
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 connection_closed_ownKeys(object, enumerableOnly) {
|
|
55
|
+
var keys = Object.keys(object);
|
|
56
|
+
if (Object.getOwnPropertySymbols) {
|
|
57
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
58
|
+
if (enumerableOnly) symbols = symbols.filter(function(sym) {
|
|
59
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
60
|
+
});
|
|
61
|
+
keys.push.apply(keys, symbols);
|
|
62
|
+
}
|
|
63
|
+
return keys;
|
|
64
|
+
}
|
|
65
|
+
function _object_spread_props(target, source) {
|
|
66
|
+
source = null != source ? source : {};
|
|
67
|
+
if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
68
|
+
else connection_closed_ownKeys(Object(source)).forEach(function(key) {
|
|
69
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
70
|
+
});
|
|
71
|
+
return target;
|
|
72
|
+
}
|
|
73
|
+
const SvgConnectionClosed = (props)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("svg", _object_spread_props(_object_spread({
|
|
74
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
75
|
+
width: 24,
|
|
76
|
+
height: 24,
|
|
77
|
+
fill: "none",
|
|
78
|
+
viewBox: "0 0 24 24"
|
|
79
|
+
}, props), {
|
|
80
|
+
children: [
|
|
81
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("path", {
|
|
82
|
+
stroke: "#6D6D6D",
|
|
83
|
+
strokeLinecap: "round",
|
|
84
|
+
strokeLinejoin: "round",
|
|
85
|
+
strokeWidth: 2,
|
|
86
|
+
d: "M22 9.483A14.53 14.53 0 0 0 9.75 5.674M19 12.9a9.85 9.85 0 0 0-4.75-2.642M5 12.9a10 10 0 0 1 2.18-1.65M8 16.157a5.63 5.63 0 0 1 2.5-1.455"
|
|
87
|
+
}),
|
|
88
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("path", {
|
|
89
|
+
fill: "#6D6D6D",
|
|
90
|
+
fillRule: "evenodd",
|
|
91
|
+
d: "M12 20a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5",
|
|
92
|
+
clipRule: "evenodd"
|
|
93
|
+
}),
|
|
94
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("path", {
|
|
95
|
+
stroke: "#6D6D6D",
|
|
96
|
+
strokeLinecap: "round",
|
|
97
|
+
strokeLinejoin: "round",
|
|
98
|
+
strokeWidth: 2,
|
|
99
|
+
d: "M20 20 4 4M2 9.483a15 15 0 0 1 1.75-1.42"
|
|
100
|
+
})
|
|
101
|
+
]
|
|
102
|
+
}));
|
|
103
|
+
const connection_closed = SvgConnectionClosed;
|
|
104
|
+
exports["default"] = __webpack_exports__["default"];
|
|
105
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
106
|
+
"default"
|
|
107
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
108
|
+
Object.defineProperty(exports, '__esModule', {
|
|
109
|
+
value: true
|
|
110
|
+
});
|
|
@@ -26,6 +26,14 @@ export interface DeviceInteractionLayerProps {
|
|
|
26
26
|
x: number;
|
|
27
27
|
y: number;
|
|
28
28
|
}) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Element whose bounding box represents the actual screen-mirror area
|
|
31
|
+
* (the `<img>`/canvas container). When provided, pointer coordinates are
|
|
32
|
+
* projected against this element instead of the overlay itself — so any
|
|
33
|
+
* chrome wrapping the preview (toolbars, headers, padding) does not shift
|
|
34
|
+
* taps downward.
|
|
35
|
+
*/
|
|
36
|
+
contentRef?: React.RefObject<HTMLElement>;
|
|
29
37
|
/**
|
|
30
38
|
* Tap classification thresholds. Pointer movement below this distance and
|
|
31
39
|
* total duration below this delay is reported as a Tap; anything else is a
|
|
@@ -47,4 +55,4 @@ export declare function inscribedContentRect(panel: {
|
|
|
47
55
|
width: number;
|
|
48
56
|
height: number;
|
|
49
57
|
};
|
|
50
|
-
export declare function DeviceInteractionLayer({ enabled, deviceSize, onTap, onSwipe, keyboardEnabled, onTextInput, onKeyboardPress, tapMaxDistance, tapMaxDurationMs, style, }: DeviceInteractionLayerProps): React.JSX.Element | null;
|
|
58
|
+
export declare function DeviceInteractionLayer({ enabled, deviceSize, onTap, onSwipe, keyboardEnabled, onTextInput, onKeyboardPress, contentRef, tapMaxDistance, tapMaxDurationMs, style, }: DeviceInteractionLayerProps): React.JSX.Element | null;
|
|
@@ -28,6 +28,7 @@ interface ScrcpyPanelProps {
|
|
|
28
28
|
metadataTimeoutMs?: number;
|
|
29
29
|
reconnectInterval?: number;
|
|
30
30
|
viewportStyle?: CSSProperties;
|
|
31
|
+
contentRef?: React.Ref<HTMLDivElement>;
|
|
31
32
|
}
|
|
32
|
-
export declare function ScrcpyPanel({ connectingOverlay, deviceId, onIntrinsicSize, onStatusChange, renderErrorOverlay, serverUrl, metadataTimeoutMs, reconnectInterval, viewportStyle, }: ScrcpyPanelProps): React.JSX.Element;
|
|
33
|
+
export declare function ScrcpyPanel({ connectingOverlay, deviceId, onIntrinsicSize, onStatusChange, renderErrorOverlay, serverUrl, metadataTimeoutMs, reconnectInterval, viewportStyle, contentRef, }: ScrcpyPanelProps): React.JSX.Element;
|
|
33
34
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/playground-app",
|
|
3
|
-
"version": "1.8.4
|
|
3
|
+
"version": "1.8.4",
|
|
4
4
|
"description": "Reusable React shell for Midscene playground applications",
|
|
5
5
|
"repository": "https://github.com/web-infra-dev/midscene",
|
|
6
6
|
"homepage": "https://midscenejs.com/",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"antd": "^5.21.6",
|
|
29
29
|
"react-resizable-panels": "2.0.22",
|
|
30
30
|
"socket.io-client": "4.8.1",
|
|
31
|
-
"@midscene/playground": "1.8.4
|
|
32
|
-
"@midscene/
|
|
33
|
-
"@midscene/
|
|
31
|
+
"@midscene/playground": "1.8.4",
|
|
32
|
+
"@midscene/visualizer": "1.8.4",
|
|
33
|
+
"@midscene/shared": "1.8.4"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@rsbuild/plugin-less": "^1.5.0",
|