@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,200 @@
|
|
|
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 server_offline_foreground_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 server_offline_foreground_ownKeys(Object(source)).forEach(function(key) {
|
|
41
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
42
|
+
});
|
|
43
|
+
return target;
|
|
44
|
+
}
|
|
45
|
+
const SvgServerOfflineForeground = (props)=>/*#__PURE__*/ jsxs("svg", _object_spread_props(_object_spread({
|
|
46
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
47
|
+
width: 178,
|
|
48
|
+
height: 135,
|
|
49
|
+
fill: "none",
|
|
50
|
+
viewBox: "0 0 178 135"
|
|
51
|
+
}, props), {
|
|
52
|
+
children: [
|
|
53
|
+
/*#__PURE__*/ jsx("g", {
|
|
54
|
+
filter: "url(#server-offline-foreground_svg__a)",
|
|
55
|
+
children: /*#__PURE__*/ jsx("rect", {
|
|
56
|
+
width: 74,
|
|
57
|
+
height: 97.5,
|
|
58
|
+
fill: "url(#server-offline-foreground_svg__b)",
|
|
59
|
+
rx: 12,
|
|
60
|
+
transform: "matrix(.86603 .5 -.86603 .5 99.136 28.5)"
|
|
61
|
+
})
|
|
62
|
+
}),
|
|
63
|
+
/*#__PURE__*/ jsx("rect", {
|
|
64
|
+
width: 78,
|
|
65
|
+
height: 101.5,
|
|
66
|
+
y: -2,
|
|
67
|
+
fill: "url(#server-offline-foreground_svg__c)",
|
|
68
|
+
stroke: "url(#server-offline-foreground_svg__d)",
|
|
69
|
+
strokeWidth: 4,
|
|
70
|
+
rx: 14,
|
|
71
|
+
transform: "matrix(.86603 .5 -.86603 .5 97.404 4)"
|
|
72
|
+
}),
|
|
73
|
+
/*#__PURE__*/ jsx("path", {
|
|
74
|
+
fill: "url(#server-offline-foreground_svg__e)",
|
|
75
|
+
d: "M78.147 31.404a.9.9 0 0 1 .156-.559c.117-.178.295-.34.524-.478.228-.138.503-.248.806-.322a4 4 0 0 1 .961-.114c.33 0 .657.038.961.113s.578.184.807.322c.23.137.407.3.525.478.117.178.17.368.157.559v3c.014.19-.04.38-.156.559a1.6 1.6 0 0 1-.524.478 3 3 0 0 1-.806.322c-.304.075-.631.114-.961.114s-.657-.038-.961-.113a3 3 0 0 1-.807-.321 1.6 1.6 0 0 1-.525-.479.9.9 0 0 1-.157-.559zm-9.678 8.414c-.632-.015-1.23-.17-1.668-.434s-.682-.615-.682-.98c0-.366.246-.717.684-.98.438-.264 1.036-.42 1.669-.434h5.196c.33-.007.659.024.968.091.308.068.59.17.828.303s.428.29.557.466a.93.93 0 0 1 .196.555.93.93 0 0 1-.197.554c-.13.176-.32.334-.558.466s-.52.235-.829.303a4 4 0 0 1-.968.09zm38.106 11a4 4 0 0 1-.956-.098 3 3 0 0 1-.815-.305 1.7 1.7 0 0 1-.547-.463.93.93 0 0 1-.193-.55c0-.188.066-.375.193-.549s.313-.331.547-.463c.233-.132.511-.235.815-.304.304-.07.629-.102.956-.098h5.196c.327-.004.652.029.956.098s.582.172.815.304c.234.132.42.29.547.463s.193.361.193.55a.93.93 0 0 1-.193.55 1.7 1.7 0 0 1-.547.462 3 3 0 0 1-.815.305 4 4 0 0 1-.956.097zm-9.38 2.585c.017-.369.281-.72.74-.978.457-.258 1.071-.402 1.71-.402.64 0 1.255.144 1.713.402.457.258.722.61.738.978v3a.9.9 0 0 1-.169.552c-.12.176-.299.336-.527.471a3 3 0 0 1-.803.316 4 4 0 0 1-.951.11c-.327 0-.65-.037-.952-.11a3 3 0 0 1-.802-.316 1.6 1.6 0 0 1-.527-.47.9.9 0 0 1-.17-.553zm8.515-18.5c-1.838-1.06-4.33-1.656-6.93-1.656-2.598 0-5.09.596-6.928 1.657l-5.196 3c-.225.14-.495.252-.796.33s-.626.12-.956.123a4 4 0 0 1-.963-.102 3 3 0 0 1-.817-.312 1.7 1.7 0 0 1-.54-.471.9.9 0 0 1-.178-.557.95.95 0 0 1 .215-.551c.135-.174.33-.33.571-.46l5.196-3c2.757-1.591 6.495-2.485 10.393-2.485s7.636.894 10.392 2.485c2.756 1.592 4.305 3.75 4.305 6s-1.549 4.409-4.305 6l-5.196 3a2.9 2.9 0 0 1-.796.33 4.087 4.087 0 0 1-1.919.021 3 3 0 0 1-.817-.311 1.7 1.7 0 0 1-.54-.472.9.9 0 0 1-.177-.556.95.95 0 0 1 .214-.552c.135-.174.33-.33.572-.46l5.196-3c1.837-1.06 2.87-2.5 2.87-4s-1.033-2.94-2.87-4m-29.444 5c.224-.14.494-.252.795-.33s.626-.12.956-.123.657.03.963.102c.306.071.584.177.817.312.234.135.417.295.54.472a.9.9 0 0 1 .178.556.95.95 0 0 1-.215.551c-.135.174-.329.33-.571.46l-5.196 3c-1.838 1.06-2.87 2.5-2.87 4s1.032 2.94 2.87 4c1.838 1.062 4.33 1.658 6.929 1.658s5.091-.596 6.929-1.657l5.196-3c.465-.249 1.079-.384 1.712-.376.633.007 1.238.155 1.686.414.448.258.705.607.717.973s-.221.72-.652.988l-5.196 3c-2.756 1.592-6.494 2.486-10.392 2.486s-7.636-.894-10.392-2.486c-2.757-1.591-4.305-3.75-4.305-6s1.548-4.408 4.305-6z"
|
|
76
|
+
}),
|
|
77
|
+
/*#__PURE__*/ jsx("path", {
|
|
78
|
+
fill: "#000",
|
|
79
|
+
d: "m108.005 6.698 3.211-1.854c.954-.55 2.247-.86 3.596-.86s2.642.31 3.596.86c.953.55 1.489 1.297 1.489 2.076 0 .778-.536 1.525-1.489 2.076l-9.589 5.535c-.317.184-.749.287-1.198.287-.45 0-.881-.103-1.199-.287-.317-.183-.496-.432-.496-.692s.179-.508.496-.692l9.589-5.535-2.398-1.384-9.588 5.535c-.953.551-1.489 1.298-1.489 2.076 0 .779.536 1.526 1.489 2.076s2.247.86 3.596.86c1.348 0 2.642-.31 3.595-.86l9.589-5.535c1.589-.918 2.482-2.163 2.482-3.46s-.893-2.543-2.482-3.46c-1.59-.918-3.745-1.433-5.993-1.433s-4.403.515-5.993 1.433l-4.394 2.537z"
|
|
80
|
+
}),
|
|
81
|
+
/*#__PURE__*/ jsxs("defs", {
|
|
82
|
+
children: [
|
|
83
|
+
/*#__PURE__*/ jsxs("linearGradient", {
|
|
84
|
+
id: "server-offline-foreground_svg__b",
|
|
85
|
+
x1: 37,
|
|
86
|
+
x2: 37,
|
|
87
|
+
y1: 0,
|
|
88
|
+
y2: 97.5,
|
|
89
|
+
gradientUnits: "userSpaceOnUse",
|
|
90
|
+
children: [
|
|
91
|
+
/*#__PURE__*/ jsx("stop", {
|
|
92
|
+
stopColor: "#D9D9D9"
|
|
93
|
+
}),
|
|
94
|
+
/*#__PURE__*/ jsx("stop", {
|
|
95
|
+
offset: 1,
|
|
96
|
+
stopColor: "#E9E9EB"
|
|
97
|
+
})
|
|
98
|
+
]
|
|
99
|
+
}),
|
|
100
|
+
/*#__PURE__*/ jsxs("linearGradient", {
|
|
101
|
+
id: "server-offline-foreground_svg__c",
|
|
102
|
+
x1: 37,
|
|
103
|
+
x2: 37,
|
|
104
|
+
y1: 0,
|
|
105
|
+
y2: 97.5,
|
|
106
|
+
gradientUnits: "userSpaceOnUse",
|
|
107
|
+
children: [
|
|
108
|
+
/*#__PURE__*/ jsx("stop", {
|
|
109
|
+
stopColor: "#7D7E80"
|
|
110
|
+
}),
|
|
111
|
+
/*#__PURE__*/ jsx("stop", {
|
|
112
|
+
offset: 1,
|
|
113
|
+
stopColor: "#C7C9CC"
|
|
114
|
+
})
|
|
115
|
+
]
|
|
116
|
+
}),
|
|
117
|
+
/*#__PURE__*/ jsxs("linearGradient", {
|
|
118
|
+
id: "server-offline-foreground_svg__d",
|
|
119
|
+
x1: 37,
|
|
120
|
+
x2: 37,
|
|
121
|
+
y1: 0,
|
|
122
|
+
y2: 97.5,
|
|
123
|
+
gradientUnits: "userSpaceOnUse",
|
|
124
|
+
children: [
|
|
125
|
+
/*#__PURE__*/ jsx("stop", {
|
|
126
|
+
stopColor: "#fff"
|
|
127
|
+
}),
|
|
128
|
+
/*#__PURE__*/ jsx("stop", {
|
|
129
|
+
offset: 1,
|
|
130
|
+
stopColor: "#fff",
|
|
131
|
+
stopOpacity: 0.2
|
|
132
|
+
})
|
|
133
|
+
]
|
|
134
|
+
}),
|
|
135
|
+
/*#__PURE__*/ jsxs("linearGradient", {
|
|
136
|
+
id: "server-offline-foreground_svg__e",
|
|
137
|
+
x1: 72.75,
|
|
138
|
+
x2: 90.111,
|
|
139
|
+
y1: 33.874,
|
|
140
|
+
y2: 63.944,
|
|
141
|
+
gradientUnits: "userSpaceOnUse",
|
|
142
|
+
children: [
|
|
143
|
+
/*#__PURE__*/ jsx("stop", {
|
|
144
|
+
stopColor: "#fff"
|
|
145
|
+
}),
|
|
146
|
+
/*#__PURE__*/ jsx("stop", {
|
|
147
|
+
offset: 1,
|
|
148
|
+
stopColor: "#fff",
|
|
149
|
+
stopOpacity: 0.5
|
|
150
|
+
})
|
|
151
|
+
]
|
|
152
|
+
}),
|
|
153
|
+
/*#__PURE__*/ jsxs("filter", {
|
|
154
|
+
id: "server-offline-foreground_svg__a",
|
|
155
|
+
width: 176.348,
|
|
156
|
+
height: 118.721,
|
|
157
|
+
x: 0.786,
|
|
158
|
+
y: 16.015,
|
|
159
|
+
colorInterpolationFilters: "sRGB",
|
|
160
|
+
filterUnits: "userSpaceOnUse",
|
|
161
|
+
children: [
|
|
162
|
+
/*#__PURE__*/ jsx("feFlood", {
|
|
163
|
+
floodOpacity: 0,
|
|
164
|
+
result: "BackgroundImageFix"
|
|
165
|
+
}),
|
|
166
|
+
/*#__PURE__*/ jsx("feColorMatrix", {
|
|
167
|
+
in: "SourceAlpha",
|
|
168
|
+
result: "hardAlpha",
|
|
169
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
|
|
170
|
+
}),
|
|
171
|
+
/*#__PURE__*/ jsx("feOffset", {
|
|
172
|
+
dy: 4
|
|
173
|
+
}),
|
|
174
|
+
/*#__PURE__*/ jsx("feGaussianBlur", {
|
|
175
|
+
stdDeviation: 10
|
|
176
|
+
}),
|
|
177
|
+
/*#__PURE__*/ jsx("feComposite", {
|
|
178
|
+
in2: "hardAlpha",
|
|
179
|
+
operator: "out"
|
|
180
|
+
}),
|
|
181
|
+
/*#__PURE__*/ jsx("feColorMatrix", {
|
|
182
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.04 0"
|
|
183
|
+
}),
|
|
184
|
+
/*#__PURE__*/ jsx("feBlend", {
|
|
185
|
+
in2: "BackgroundImageFix",
|
|
186
|
+
result: "effect1_dropShadow_4624_2901"
|
|
187
|
+
}),
|
|
188
|
+
/*#__PURE__*/ jsx("feBlend", {
|
|
189
|
+
in: "SourceGraphic",
|
|
190
|
+
in2: "effect1_dropShadow_4624_2901",
|
|
191
|
+
result: "shape"
|
|
192
|
+
})
|
|
193
|
+
]
|
|
194
|
+
})
|
|
195
|
+
]
|
|
196
|
+
})
|
|
197
|
+
]
|
|
198
|
+
}));
|
|
199
|
+
const server_offline_foreground = SvgServerOfflineForeground;
|
|
200
|
+
export { server_offline_foreground as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PlaygroundApp } from "./PlaygroundApp.mjs";
|
|
2
|
+
import { PlaygroundPreview } from "./PlaygroundPreview.mjs";
|
|
3
|
+
import { PlaygroundThemeProvider } from "./PlaygroundThemeProvider.mjs";
|
|
4
|
+
import { DeviceInteractionLayer } from "./DeviceInteractionLayer.mjs";
|
|
5
|
+
import { PlaygroundConversationPanel } from "./panels/PlaygroundConversationPanel.mjs";
|
|
6
|
+
import { usePlaygroundController } from "./controller/usePlaygroundController.mjs";
|
|
7
|
+
export { DeviceInteractionLayer, PlaygroundApp, PlaygroundConversationPanel, PlaygroundPreview, PlaygroundThemeProvider, usePlaygroundController };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
3
|
+
value: value,
|
|
4
|
+
enumerable: true,
|
|
5
|
+
configurable: true,
|
|
6
|
+
writable: true
|
|
7
|
+
});
|
|
8
|
+
else obj[key] = value;
|
|
9
|
+
return obj;
|
|
10
|
+
}
|
|
11
|
+
function _object_spread(target) {
|
|
12
|
+
for(var i = 1; i < arguments.length; i++){
|
|
13
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
14
|
+
var ownKeys = Object.keys(source);
|
|
15
|
+
if ("function" == typeof Object.getOwnPropertySymbols) ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
16
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
17
|
+
}));
|
|
18
|
+
ownKeys.forEach(function(key) {
|
|
19
|
+
_define_property(target, key, source[key]);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return target;
|
|
23
|
+
}
|
|
24
|
+
function manual_interaction_ownKeys(object, enumerableOnly) {
|
|
25
|
+
var keys = Object.keys(object);
|
|
26
|
+
if (Object.getOwnPropertySymbols) {
|
|
27
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
28
|
+
if (enumerableOnly) symbols = symbols.filter(function(sym) {
|
|
29
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
30
|
+
});
|
|
31
|
+
keys.push.apply(keys, symbols);
|
|
32
|
+
}
|
|
33
|
+
return keys;
|
|
34
|
+
}
|
|
35
|
+
function _object_spread_props(target, source) {
|
|
36
|
+
source = null != source ? source : {};
|
|
37
|
+
if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
38
|
+
else manual_interaction_ownKeys(Object(source)).forEach(function(key) {
|
|
39
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
40
|
+
});
|
|
41
|
+
return target;
|
|
42
|
+
}
|
|
43
|
+
function buildManualDragInteractPayload(actionType, start, end, duration) {
|
|
44
|
+
const basePayload = {
|
|
45
|
+
actionType,
|
|
46
|
+
x: start.x,
|
|
47
|
+
y: start.y,
|
|
48
|
+
endX: end.x,
|
|
49
|
+
endY: end.y
|
|
50
|
+
};
|
|
51
|
+
if ('DragAndDrop' === actionType) return basePayload;
|
|
52
|
+
return _object_spread_props(_object_spread({}, basePayload), {
|
|
53
|
+
duration
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
export { buildManualDragInteractPayload };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.playground-conversation-panel, .playground-conversation-body {
|
|
2
|
+
flex-direction: column;
|
|
3
|
+
flex: 1;
|
|
4
|
+
min-height: 0;
|
|
5
|
+
display: flex;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.playground-conversation-body > .playground-container {
|
|
9
|
+
flex: 1;
|
|
10
|
+
min-height: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.playground-conversation-offline {
|
|
14
|
+
flex: 1;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
align-items: center;
|
|
17
|
+
padding: 24px;
|
|
18
|
+
display: flex;
|
|
19
|
+
}
|
|
20
|
+
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { UniversalPlayground } from "@godscene/visualizer";
|
|
3
|
+
import { Alert, Button, Modal } from "antd";
|
|
4
|
+
import { SessionSetupPanel } from "../SessionSetupPanel.mjs";
|
|
5
|
+
import { buildConversationBranding, buildConversationConfig } from "../controller/selectors.mjs";
|
|
6
|
+
import "./PlaygroundConversationPanel.css";
|
|
7
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
8
|
+
try {
|
|
9
|
+
var info = gen[key](arg);
|
|
10
|
+
var value = info.value;
|
|
11
|
+
} catch (error) {
|
|
12
|
+
reject(error);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (info.done) resolve(value);
|
|
16
|
+
else Promise.resolve(value).then(_next, _throw);
|
|
17
|
+
}
|
|
18
|
+
function _async_to_generator(fn) {
|
|
19
|
+
return function() {
|
|
20
|
+
var self = this, args = arguments;
|
|
21
|
+
return new Promise(function(resolve, reject) {
|
|
22
|
+
var gen = fn.apply(self, args);
|
|
23
|
+
function _next(value) {
|
|
24
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
25
|
+
}
|
|
26
|
+
function _throw(err) {
|
|
27
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
28
|
+
}
|
|
29
|
+
_next(void 0);
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const PLAYGROUND_CONVERSATION_SKIN_CLASS = 'playground-conversation-skin';
|
|
34
|
+
function PlaygroundConversationPanel({ controller, appVersion, title = 'Playground', branding, playgroundConfig, header, className, playgroundClassName, notConnectedFallback, onHumanUse }) {
|
|
35
|
+
const { state, actions } = controller;
|
|
36
|
+
const mergedConfig = buildConversationConfig(state, playgroundConfig);
|
|
37
|
+
const mergedBranding = buildConversationBranding(state.runtimeInfo, title, appVersion, state.deviceType, branding);
|
|
38
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
39
|
+
className: [
|
|
40
|
+
'playground-conversation-panel',
|
|
41
|
+
className
|
|
42
|
+
].filter(Boolean).join(' '),
|
|
43
|
+
children: [
|
|
44
|
+
/*#__PURE__*/ jsx(Modal, {
|
|
45
|
+
open: null !== state.countdown,
|
|
46
|
+
footer: /*#__PURE__*/ jsx(Button, {
|
|
47
|
+
onClick: actions.finishCountdown,
|
|
48
|
+
type: "default",
|
|
49
|
+
children: "Skip countdown"
|
|
50
|
+
}),
|
|
51
|
+
closable: true,
|
|
52
|
+
maskClosable: true,
|
|
53
|
+
onCancel: actions.finishCountdown,
|
|
54
|
+
centered: true,
|
|
55
|
+
width: 400,
|
|
56
|
+
style: {
|
|
57
|
+
top: '30%'
|
|
58
|
+
},
|
|
59
|
+
styles: {
|
|
60
|
+
mask: {
|
|
61
|
+
backgroundColor: 'rgba(0, 0, 0, 0.75)'
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
65
|
+
style: {
|
|
66
|
+
textAlign: 'center',
|
|
67
|
+
padding: '40px 20px'
|
|
68
|
+
},
|
|
69
|
+
children: [
|
|
70
|
+
/*#__PURE__*/ jsx("div", {
|
|
71
|
+
style: {
|
|
72
|
+
fontSize: '72px',
|
|
73
|
+
fontWeight: 'bold',
|
|
74
|
+
color: 'GO!' === state.countdown ? '#52c41a' : '#1890ff',
|
|
75
|
+
marginBottom: '24px',
|
|
76
|
+
lineHeight: 1
|
|
77
|
+
},
|
|
78
|
+
children: state.countdown
|
|
79
|
+
}),
|
|
80
|
+
/*#__PURE__*/ jsx("div", {
|
|
81
|
+
style: {
|
|
82
|
+
fontSize: '18px',
|
|
83
|
+
fontWeight: 500,
|
|
84
|
+
marginBottom: '12px'
|
|
85
|
+
},
|
|
86
|
+
children: "Automation Starting Soon"
|
|
87
|
+
}),
|
|
88
|
+
/*#__PURE__*/ jsxs("div", {
|
|
89
|
+
style: {
|
|
90
|
+
fontSize: '14px',
|
|
91
|
+
color: 'rgba(0, 0, 0, 0.65)'
|
|
92
|
+
},
|
|
93
|
+
children: [
|
|
94
|
+
"The selected session requested a countdown before execution.",
|
|
95
|
+
/*#__PURE__*/ jsx("br", {}),
|
|
96
|
+
"Please wait until the run starts."
|
|
97
|
+
]
|
|
98
|
+
})
|
|
99
|
+
]
|
|
100
|
+
})
|
|
101
|
+
}),
|
|
102
|
+
header,
|
|
103
|
+
/*#__PURE__*/ jsx("div", {
|
|
104
|
+
className: "playground-conversation-body",
|
|
105
|
+
children: state.serverOnline ? state.sessionViewState.connected ? /*#__PURE__*/ jsx(UniversalPlayground, {
|
|
106
|
+
onHumanUse: onHumanUse,
|
|
107
|
+
playgroundSDK: state.playgroundSDK,
|
|
108
|
+
config: mergedConfig,
|
|
109
|
+
branding: mergedBranding,
|
|
110
|
+
className: [
|
|
111
|
+
'playground-container',
|
|
112
|
+
PLAYGROUND_CONVERSATION_SKIN_CLASS,
|
|
113
|
+
playgroundClassName
|
|
114
|
+
].filter(Boolean).join(' ')
|
|
115
|
+
}) : void 0 !== notConnectedFallback ? /*#__PURE__*/ jsx(Fragment, {
|
|
116
|
+
children: notConnectedFallback
|
|
117
|
+
}) : /*#__PURE__*/ jsx(SessionSetupPanel, {
|
|
118
|
+
form: state.form,
|
|
119
|
+
sessionSetup: state.sessionSetup,
|
|
120
|
+
sessionSetupError: state.sessionSetupError,
|
|
121
|
+
sessionViewState: state.sessionViewState,
|
|
122
|
+
sessionLoading: state.sessionLoading,
|
|
123
|
+
sessionMutating: state.sessionMutating,
|
|
124
|
+
onCreateSession: ()=>_async_to_generator(function*() {
|
|
125
|
+
yield actions.createSession();
|
|
126
|
+
})()
|
|
127
|
+
}) : /*#__PURE__*/ jsx("div", {
|
|
128
|
+
className: "playground-conversation-offline",
|
|
129
|
+
children: /*#__PURE__*/ jsx(Alert, {
|
|
130
|
+
type: "warning",
|
|
131
|
+
showIcon: true,
|
|
132
|
+
message: "Playground server offline",
|
|
133
|
+
description: "Reconnect the runtime to continue using the Android playground."
|
|
134
|
+
})
|
|
135
|
+
})
|
|
136
|
+
})
|
|
137
|
+
]
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
export { PlaygroundConversationPanel };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
3
|
+
value: value,
|
|
4
|
+
enumerable: true,
|
|
5
|
+
configurable: true,
|
|
6
|
+
writable: true
|
|
7
|
+
});
|
|
8
|
+
else obj[key] = value;
|
|
9
|
+
return obj;
|
|
10
|
+
}
|
|
11
|
+
function _object_spread(target) {
|
|
12
|
+
for(var i = 1; i < arguments.length; i++){
|
|
13
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
14
|
+
var ownKeys = Object.keys(source);
|
|
15
|
+
if ("function" == typeof Object.getOwnPropertySymbols) ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
16
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
17
|
+
}));
|
|
18
|
+
ownKeys.forEach(function(key) {
|
|
19
|
+
_define_property(target, key, source[key]);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return target;
|
|
23
|
+
}
|
|
24
|
+
function runtime_info_ownKeys(object, enumerableOnly) {
|
|
25
|
+
var keys = Object.keys(object);
|
|
26
|
+
if (Object.getOwnPropertySymbols) {
|
|
27
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
28
|
+
if (enumerableOnly) symbols = symbols.filter(function(sym) {
|
|
29
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
30
|
+
});
|
|
31
|
+
keys.push.apply(keys, symbols);
|
|
32
|
+
}
|
|
33
|
+
return keys;
|
|
34
|
+
}
|
|
35
|
+
function _object_spread_props(target, source) {
|
|
36
|
+
source = null != source ? source : {};
|
|
37
|
+
if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
38
|
+
else runtime_info_ownKeys(Object(source)).forEach(function(key) {
|
|
39
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
40
|
+
});
|
|
41
|
+
return target;
|
|
42
|
+
}
|
|
43
|
+
function isRemoteAndroidDeviceId(value) {
|
|
44
|
+
return 'string' == typeof value && /^\d+\.\d+\.\d+\.\d+:\d+$/.test(value);
|
|
45
|
+
}
|
|
46
|
+
const VALID_DEVICE_TYPES = [
|
|
47
|
+
'android',
|
|
48
|
+
'ios',
|
|
49
|
+
'web',
|
|
50
|
+
'harmony',
|
|
51
|
+
'computer'
|
|
52
|
+
];
|
|
53
|
+
const VALID_EXECUTION_UX_HINTS = [
|
|
54
|
+
'countdown-before-run'
|
|
55
|
+
];
|
|
56
|
+
function isValidDeviceType(type) {
|
|
57
|
+
return VALID_DEVICE_TYPES.includes(type);
|
|
58
|
+
}
|
|
59
|
+
function normalizeRuntimeDeviceType(runtimeInfo, fallback) {
|
|
60
|
+
var _runtimeInfo_interface;
|
|
61
|
+
const candidates = [
|
|
62
|
+
null == runtimeInfo ? void 0 : runtimeInfo.platformId,
|
|
63
|
+
null == runtimeInfo ? void 0 : null == (_runtimeInfo_interface = runtimeInfo.interface) ? void 0 : _runtimeInfo_interface.type
|
|
64
|
+
].filter((value)=>Boolean(value));
|
|
65
|
+
for (const candidate of candidates){
|
|
66
|
+
const normalized = candidate.toLowerCase();
|
|
67
|
+
if (isValidDeviceType(normalized)) return normalized;
|
|
68
|
+
}
|
|
69
|
+
return fallback;
|
|
70
|
+
}
|
|
71
|
+
function buildFallbackRuntimeInfo(previousRuntimeInfo, interfaceInfo) {
|
|
72
|
+
return _object_spread_props(_object_spread({}, previousRuntimeInfo), {
|
|
73
|
+
interface: interfaceInfo,
|
|
74
|
+
preview: (null == previousRuntimeInfo ? void 0 : previousRuntimeInfo.preview) || {
|
|
75
|
+
kind: 'none',
|
|
76
|
+
capabilities: []
|
|
77
|
+
},
|
|
78
|
+
executionUxHints: (null == previousRuntimeInfo ? void 0 : previousRuntimeInfo.executionUxHints) || [],
|
|
79
|
+
metadata: (null == previousRuntimeInfo ? void 0 : previousRuntimeInfo.metadata) || {}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function filterValidExecutionUxHints(runtimeInfo) {
|
|
83
|
+
return ((null == runtimeInfo ? void 0 : runtimeInfo.executionUxHints) || []).filter((hint)=>VALID_EXECUTION_UX_HINTS.includes(hint));
|
|
84
|
+
}
|
|
85
|
+
function resolvePreviewConnectionInfo(runtimeInfo, serverUrl) {
|
|
86
|
+
const preview = null == runtimeInfo ? void 0 : runtimeInfo.preview;
|
|
87
|
+
if (!preview || 'none' === preview.kind || 'custom' === preview.kind) return {
|
|
88
|
+
type: 'none'
|
|
89
|
+
};
|
|
90
|
+
const resolvedServerUrl = serverUrl || "u" > typeof window && window.location.origin || '';
|
|
91
|
+
if ('mjpeg' === preview.kind) {
|
|
92
|
+
const mjpegPath = preview.mjpegPath || '/mjpeg';
|
|
93
|
+
if (!resolvedServerUrl) return {
|
|
94
|
+
type: 'screenshot'
|
|
95
|
+
};
|
|
96
|
+
return {
|
|
97
|
+
type: 'mjpeg',
|
|
98
|
+
mjpegUrl: new URL(mjpegPath, `${resolvedServerUrl}/`).toString()
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
if ('scrcpy' === preview.kind) {
|
|
102
|
+
var _runtimeInfo_metadata, _preview_custom;
|
|
103
|
+
const runtimeDeviceId = 'string' == typeof (null == runtimeInfo ? void 0 : null == (_runtimeInfo_metadata = runtimeInfo.metadata) ? void 0 : _runtimeInfo_metadata.deviceId) ? runtimeInfo.metadata.deviceId.trim() : void 0;
|
|
104
|
+
if (isRemoteAndroidDeviceId(runtimeDeviceId)) return {
|
|
105
|
+
type: 'screenshot'
|
|
106
|
+
};
|
|
107
|
+
const scrcpyPort = Number(null == (_preview_custom = preview.custom) ? void 0 : _preview_custom.scrcpyPort);
|
|
108
|
+
const resolvedScrcpyPort = Number.isFinite(scrcpyPort) ? scrcpyPort : void 0;
|
|
109
|
+
const scrcpyUrl = resolvedScrcpyPort && resolvedServerUrl ? (()=>{
|
|
110
|
+
const url = new URL(resolvedServerUrl);
|
|
111
|
+
url.port = String(resolvedScrcpyPort);
|
|
112
|
+
url.pathname = '/';
|
|
113
|
+
url.search = '';
|
|
114
|
+
url.hash = '';
|
|
115
|
+
return url.toString();
|
|
116
|
+
})() : void 0;
|
|
117
|
+
return {
|
|
118
|
+
deviceId: runtimeDeviceId,
|
|
119
|
+
type: 'scrcpy',
|
|
120
|
+
scrcpyPort: resolvedScrcpyPort,
|
|
121
|
+
scrcpyUrl
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
type: 'screenshot'
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
export { buildFallbackRuntimeInfo, filterValidExecutionUxHints, isValidDeviceType, normalizeRuntimeDeviceType, resolvePreviewConnectionInfo };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SCRCPY_PREVIEW_METADATA_TIMEOUT_MS } from "@godscene/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 };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
function createScrcpyVideoStream(socket) {
|
|
2
|
+
let configurationPacketSent = false;
|
|
3
|
+
let pendingDataPackets = [];
|
|
4
|
+
const transformStream = new TransformStream({
|
|
5
|
+
transform (chunk, controller) {
|
|
6
|
+
if ('configuration' === chunk.type) {
|
|
7
|
+
configurationPacketSent = true;
|
|
8
|
+
controller.enqueue(chunk);
|
|
9
|
+
pendingDataPackets.forEach((queuedPacket)=>controller.enqueue(queuedPacket));
|
|
10
|
+
pendingDataPackets = [];
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if ('data' === chunk.type && !configurationPacketSent) return void pendingDataPackets.push(chunk);
|
|
14
|
+
controller.enqueue(chunk);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
let cleanupListeners;
|
|
18
|
+
const readable = new ReadableStream({
|
|
19
|
+
start (controller) {
|
|
20
|
+
const handleVideoData = (data)=>{
|
|
21
|
+
try {
|
|
22
|
+
const payload = new Uint8Array(data.data);
|
|
23
|
+
if ('configuration' === data.type) return void controller.enqueue({
|
|
24
|
+
type: 'configuration',
|
|
25
|
+
data: payload
|
|
26
|
+
});
|
|
27
|
+
controller.enqueue({
|
|
28
|
+
type: 'data',
|
|
29
|
+
data: payload,
|
|
30
|
+
keyframe: data.keyFrame
|
|
31
|
+
});
|
|
32
|
+
} catch (error) {
|
|
33
|
+
controller.error(error);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const handleDisconnect = ()=>controller.close();
|
|
37
|
+
const handleError = (error)=>controller.error(error);
|
|
38
|
+
cleanupListeners = ()=>{
|
|
39
|
+
socket.off('video-data', handleVideoData);
|
|
40
|
+
socket.off('disconnect', handleDisconnect);
|
|
41
|
+
socket.off('error', handleError);
|
|
42
|
+
};
|
|
43
|
+
socket.on('video-data', handleVideoData);
|
|
44
|
+
socket.on('disconnect', handleDisconnect);
|
|
45
|
+
socket.on('error', handleError);
|
|
46
|
+
},
|
|
47
|
+
cancel () {
|
|
48
|
+
null == cleanupListeners || cleanupListeners();
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return readable.pipeThrough(transformStream);
|
|
52
|
+
}
|
|
53
|
+
export { createScrcpyVideoStream };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { buildSessionInitialValues } from "./session-state.mjs";
|
|
2
|
+
function hasSessionFieldValue(value) {
|
|
3
|
+
return null != value && '' !== value;
|
|
4
|
+
}
|
|
5
|
+
function resolveAutoCreateSessionInput(setup, existingValues = {}) {
|
|
6
|
+
if (!(null == setup ? void 0 : setup.autoSubmitWhenReady)) return null;
|
|
7
|
+
const values = buildSessionInitialValues(setup, existingValues);
|
|
8
|
+
for (const field of setup.fields)if (field.required) {
|
|
9
|
+
if (!hasSessionFieldValue(values[field.key])) return null;
|
|
10
|
+
}
|
|
11
|
+
return values;
|
|
12
|
+
}
|
|
13
|
+
export { resolveAutoCreateSessionInput };
|