@aixnn/aixautots 0.6.12 → 0.6.17
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/{automation-queue-CvrWEOw2.d.ts → automation-queue-DO8fOG6l.d.ts} +2 -2
- package/dist/{chunk-PUEKOYSH.js → chunk-2KPZSPV6.js} +131 -3
- package/dist/{chunk-D7J4EQTA.js → chunk-3OBCSW2J.js} +1 -1
- package/dist/{chunk-UH5OYPXE.js → chunk-7BJPVSEZ.js} +205 -18
- package/dist/{chunk-SKTL6ACT.js → chunk-7RQTSTR6.js} +3 -3
- package/dist/{chunk-LO3XD4T5.js → chunk-FJPIY4YI.js} +124 -8
- package/dist/{chunk-SL6M6CC6.js → chunk-KASSYUGM.js} +3 -3
- package/dist/chunk-LOKPZ677.js +422 -0
- package/dist/{chunk-E7WMHM63.js → chunk-MBBVYSPD.js} +7 -0
- package/dist/{chunk-ROOOAG3E.js → chunk-NIEGPH3E.js} +51 -418
- package/dist/{chunk-7IXBWJHB.js → chunk-QEK25NUA.js} +5 -5
- package/dist/{chunk-QZLUQSLA.js → chunk-TJ2QIP5M.js} +352 -423
- package/dist/{chunk-LR5LJJNM.js → chunk-WOPEKCVC.js} +4 -4
- package/dist/chunk-ZCTAYVPK.js +1 -0
- package/dist/{chunk-XCYGBYFC.js → chunk-ZDCTHR7D.js} +215 -126
- package/dist/{config-BUH2EYHO.d.ts → config-CBUhr4Gl.d.ts} +173 -2
- package/dist/core/index.d.ts +29 -11
- package/dist/core/index.js +2 -2
- package/dist/{device-normalize-DzuVemCy.d.ts → device-normalize-Vl5JYbAI.d.ts} +7 -4
- package/dist/device-session-3XK2SZDF.js +1 -0
- package/dist/i18n/index.js +1 -1
- package/dist/{mirror-session-D2YY9mKf.d.ts → mirror-session-Y1InpkUY.d.ts} +14 -4
- package/dist/react/index.d.ts +9 -9
- package/dist/react/index.js +3 -3
- package/dist/{script-debugger-Csm4CrfY.d.ts → script-debugger-DoT02din.d.ts} +1 -1
- package/dist/{task-agent-runner-C4WfT77g.d.ts → task-agent-runner-Cl2ickJ1.d.ts} +3 -3
- package/dist/{types-BfIeUpsU.d.ts → types-Cp1ohbTb.d.ts} +35 -3
- package/dist/ui/billing.d.ts +2 -2
- package/dist/ui/billing.js +14 -8
- package/dist/ui/device-create.d.ts +5 -2
- package/dist/ui/device-create.js +8 -7
- package/dist/ui/device-mirror.js +7 -7
- package/dist/ui/devices.d.ts +5 -5
- package/dist/ui/devices.js +12 -11
- package/dist/ui/editor.d.ts +2 -2
- package/dist/ui/editor.js +7 -7
- package/dist/ui/index.d.ts +5 -4
- package/dist/ui/index.js +9 -7
- package/dist/ui/inspector.js +5 -5
- package/dist/ui/ip-commerce.d.ts +28 -0
- package/dist/ui/ip-commerce.js +8 -0
- package/dist/ui/market.js +4 -4
- package/dist/ui/mirror.d.ts +5 -4
- package/dist/ui/mirror.js +1 -1
- package/dist/ui/primitives/index.js +1 -1
- package/dist/ui/script-studio.js +6 -6
- package/dist/ui/scripts.d.ts +1 -1
- package/dist/ui/scripts.js +5 -5
- package/dist/ui/tasks.js +12 -11
- package/package.json +6 -2
- package/dist/device-session-7MKEJTIA.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { LogConsole } from './chunk-
|
|
2
|
-
import { cn, Button, Select } from './chunk-
|
|
3
|
-
import { useDevices, useClient, useScripts, useScriptRun } from './chunk-
|
|
4
|
-
import { variablesToSchema, normalizeDevices, schemaToVariables } from './chunk-
|
|
1
|
+
import { LogConsole } from './chunk-3OBCSW2J.js';
|
|
2
|
+
import { cn, Button, Select } from './chunk-7RQTSTR6.js';
|
|
3
|
+
import { useDevices, useClient, useScripts, useScriptRun } from './chunk-QEK25NUA.js';
|
|
4
|
+
import { variablesToSchema, normalizeDevices, schemaToVariables } from './chunk-7BJPVSEZ.js';
|
|
5
5
|
import { useMemo, useState, useEffect, useRef, useCallback } from 'react';
|
|
6
6
|
import { Trash2, Plus, Play, Pause, Square, ArrowDownToLine, WrapText, ChevronRight, Save, XCircle, CheckCircle2, Loader2, Circle } from 'lucide-react';
|
|
7
7
|
import CodeMirror, { EditorView } from '@uiw/react-codemirror';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -1,12 +1,76 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ControlBar, MirrorView } from './chunk-MBBVYSPD.js';
|
|
2
2
|
import { canConnectPhysicalDevice } from './chunk-ZB5ET67B.js';
|
|
3
|
-
import { useAixT } from './chunk-
|
|
4
|
-
import { Dialog, Select, Button, Popover } from './chunk-
|
|
5
|
-
import { useClient, useDevices, useMirror } from './chunk-
|
|
3
|
+
import { useAixT } from './chunk-FJPIY4YI.js';
|
|
4
|
+
import { Dialog, Select, Button, useToast, ToastViewport, Popover } from './chunk-7RQTSTR6.js';
|
|
5
|
+
import { useClient, useDevices, useMirror, createAgentTaskRunner, useTaskAgentRun } from './chunk-QEK25NUA.js';
|
|
6
6
|
import { useState, useRef, useEffect, useId, useCallback, useMemo } from 'react';
|
|
7
|
-
import {
|
|
7
|
+
import { ClipboardPaste, Wrench, Check, Settings2, VolumeX, Volume2, RotateCw, X, PanelsTopLeft, Minimize2, Maximize2, Rocket, Loader2, Square, Video, Download } from 'lucide-react';
|
|
8
8
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
9
9
|
|
|
10
|
+
function MirrorAiChat({ deviceId }) {
|
|
11
|
+
const client = useClient();
|
|
12
|
+
const runner = useMemo(() => createAgentTaskRunner(client.cfg), [client.cfg]);
|
|
13
|
+
const task = useTaskAgentRun(runner);
|
|
14
|
+
const [prompt, setPrompt] = useState("");
|
|
15
|
+
const [submitted, setSubmitted] = useState("");
|
|
16
|
+
const [history, setHistory] = useState([]);
|
|
17
|
+
const [agent, setAgent] = useState("claude");
|
|
18
|
+
const [starting, setStarting] = useState(false);
|
|
19
|
+
const target = task.devices[0];
|
|
20
|
+
const submit = async () => {
|
|
21
|
+
const text = prompt.trim();
|
|
22
|
+
if (!text || task.running || starting) return;
|
|
23
|
+
if (submitted) setHistory((items) => [...items, { prompt: submitted, status: target?.status ?? "", logs: task.logs.map((entry) => entry.msg) }]);
|
|
24
|
+
setStarting(true);
|
|
25
|
+
setSubmitted(text);
|
|
26
|
+
setPrompt("");
|
|
27
|
+
try {
|
|
28
|
+
await task.start({ agent, devices: [{ id: deviceId, name: deviceId }], prompt: text, concurrency: 1 });
|
|
29
|
+
} finally {
|
|
30
|
+
setStarting(false);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-3", children: [
|
|
34
|
+
/* @__PURE__ */ jsxs("div", { className: "min-h-0 flex-1 space-y-3 overflow-y-auto text-xs", "aria-live": "polite", children: [
|
|
35
|
+
!submitted && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: "\u63CF\u8FF0\u4F60\u5E0C\u671B\u8BBE\u5907\u5B8C\u6210\u7684\u64CD\u4F5C\uFF0C\u6267\u884C\u8FC7\u7A0B\u548C\u7ED3\u679C\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002" }),
|
|
36
|
+
history.map((item, i) => /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
37
|
+
/* @__PURE__ */ jsx("div", { className: "ml-4 whitespace-pre-wrap rounded-lg bg-primary/10 p-3", children: item.prompt }),
|
|
38
|
+
/* @__PURE__ */ jsxs("p", { className: "rounded-md bg-secondary p-2", children: [
|
|
39
|
+
"\u6267\u884C\u72B6\u6001\uFF1A",
|
|
40
|
+
item.status
|
|
41
|
+
] }),
|
|
42
|
+
item.logs.map((line, j) => /* @__PURE__ */ jsx("p", { className: "whitespace-pre-wrap break-words text-muted-foreground", children: line }, j))
|
|
43
|
+
] }, i)),
|
|
44
|
+
submitted && /* @__PURE__ */ jsx("div", { className: "ml-4 whitespace-pre-wrap rounded-lg bg-primary/10 p-3", children: submitted }),
|
|
45
|
+
target && /* @__PURE__ */ jsxs("p", { className: "rounded-md bg-secondary p-2", children: [
|
|
46
|
+
"\u6267\u884C\u72B6\u6001\uFF1A",
|
|
47
|
+
target.status,
|
|
48
|
+
target.error ? ` \xB7 ${target.error}` : "",
|
|
49
|
+
target.blocker?.message ? ` \xB7 ${target.blocker.message}` : ""
|
|
50
|
+
] }),
|
|
51
|
+
task.logs.map((entry, i) => /* @__PURE__ */ jsx("p", { className: "whitespace-pre-wrap break-words text-muted-foreground", children: entry.msg }, i)),
|
|
52
|
+
task.error && /* @__PURE__ */ jsx("p", { role: "alert", className: "break-words text-destructive", children: task.error })
|
|
53
|
+
] }),
|
|
54
|
+
target?.status === "blocked" && /* @__PURE__ */ jsx("button", { type: "button", onClick: () => void task.approveDevice(deviceId), className: "min-h-11 rounded border border-border px-3 text-xs", children: "\u6279\u51C6\u7EE7\u7EED" }),
|
|
55
|
+
/* @__PURE__ */ jsxs("form", { onSubmit: (e) => {
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
void submit();
|
|
58
|
+
}, className: "space-y-2 border-t border-border pt-3", children: [
|
|
59
|
+
/* @__PURE__ */ jsxs("label", { className: "block text-xs", children: [
|
|
60
|
+
"\u6267\u884C Agent ",
|
|
61
|
+
/* @__PURE__ */ jsxs("select", { "aria-label": "\u6267\u884C Agent", value: agent, disabled: task.running || starting, onChange: (e) => setAgent(e.target.value), className: "ml-2 rounded border border-border bg-background p-1", children: [
|
|
62
|
+
/* @__PURE__ */ jsx("option", { value: "claude", children: "Claude" }),
|
|
63
|
+
/* @__PURE__ */ jsx("option", { value: "codex", children: "Codex" })
|
|
64
|
+
] })
|
|
65
|
+
] }),
|
|
66
|
+
/* @__PURE__ */ jsxs("label", { className: "block text-xs", children: [
|
|
67
|
+
"\u64CD\u4F5C\u6307\u4EE4",
|
|
68
|
+
/* @__PURE__ */ jsx("textarea", { "aria-label": "\u64CD\u4F5C\u6307\u4EE4", value: prompt, onChange: (e) => setPrompt(e.target.value), placeholder: "\u4F8B\u5982\uFF1A\u6253\u5F00\u8BBE\u7F6E\u5E76\u67E5\u770B\u7F51\u7EDC\u72B6\u6001", rows: 3, className: "mt-1 w-full resize-y rounded border border-border bg-secondary p-2 text-sm" })
|
|
69
|
+
] }),
|
|
70
|
+
task.running || starting ? /* @__PURE__ */ jsx("button", { type: "button", disabled: !task.runId, onClick: () => void task.cancelAll(), className: "min-h-11 w-full rounded border border-border text-xs disabled:opacity-40", children: "\u505C\u6B62\u6267\u884C" }) : /* @__PURE__ */ jsx("button", { type: "submit", disabled: !prompt.trim() || !runner.available, className: "min-h-11 w-full rounded bg-primary text-xs text-primary-foreground disabled:opacity-40", children: "\u53D1\u9001\u5E76\u6267\u884C" })
|
|
71
|
+
] })
|
|
72
|
+
] });
|
|
73
|
+
}
|
|
10
74
|
var button = "flex w-full items-center justify-center gap-2 rounded-md border border-border px-2 py-2 text-xs hover:bg-secondary disabled:opacity-40";
|
|
11
75
|
function MirrorActions({ deviceId, stream, ready, platform = "android" }) {
|
|
12
76
|
const client = useClient();
|
|
@@ -949,6 +1013,9 @@ var PROFILE_LABELS = {
|
|
|
949
1013
|
low_latency: "\u4F4E\u5EF6\u8FDF",
|
|
950
1014
|
high_quality: "\u9AD8\u753B\u8D28"
|
|
951
1015
|
};
|
|
1016
|
+
function clipboardToastMessage(message) {
|
|
1017
|
+
return message.replace(/^(?:GET|POST|PUT|PATCH|DELETE)\s+\S+\s+\d{3}:\s*/, "");
|
|
1018
|
+
}
|
|
952
1019
|
var DEFAULT_SIZE = { width: 1080, height: 2340 };
|
|
953
1020
|
var AUTO_QUALITY_FIRST_CHECK_MS = 2e3;
|
|
954
1021
|
var AUTO_QUALITY_INTERVAL_MS = 8e3;
|
|
@@ -984,7 +1051,7 @@ function AndroidMirrorSurface(props) {
|
|
|
984
1051
|
return () => clearTimeout(timer);
|
|
985
1052
|
}, [notProvisioned, loading, refetch]);
|
|
986
1053
|
if (loading && devices === null || error && devices === null || notProvisioned) {
|
|
987
|
-
return /* @__PURE__ */ jsxs(
|
|
1054
|
+
return /* @__PURE__ */ jsxs(MirrorStatusShell, { ...props, children: [
|
|
988
1055
|
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: error ? "\u65E0\u6CD5\u6838\u5BF9\u8BBE\u5907\u72B6\u6001" : notProvisioned ? provision?.status === "pending" ? "\u8BBE\u5907\u6B63\u5728\u521B\u5EFA" : "\u8BBE\u5907\u521B\u5EFA\u672A\u5B8C\u6210" : "\u6B63\u5728\u6838\u5BF9\u8BBE\u5907\u72B6\u6001\u2026" }),
|
|
989
1056
|
notProvisioned && /* @__PURE__ */ jsx("p", { className: "max-w-sm text-xs text-white/70", children: provision?.error || (provision?.status === "pending" ? "\u521B\u5EFA\u5B8C\u6210\u540E\u5C06\u81EA\u52A8\u8FDE\u63A5\u753B\u9762\u3002" : "\u521B\u5EFA\u7ED3\u679C\u5C1A\u672A\u786E\u8BA4\uFF0C\u8BF7\u6838\u5BF9\u539F\u521B\u5EFA\u4EFB\u52A1\uFF1B\u5F53\u524D\u6CA1\u6709\u53EF\u8FDE\u63A5\u7684\u8BBE\u5907\u753B\u9762\u3002") }),
|
|
990
1057
|
error && /* @__PURE__ */ jsx("p", { className: "text-xs text-white/70", children: "\u8BF7\u5237\u65B0\u72B6\u6001\u540E\u91CD\u8BD5\u3002" }),
|
|
@@ -994,7 +1061,7 @@ function AndroidMirrorSurface(props) {
|
|
|
994
1061
|
] });
|
|
995
1062
|
}
|
|
996
1063
|
if (needsRecovery && recoveryDevice) {
|
|
997
|
-
return /* @__PURE__ */ jsxs(
|
|
1064
|
+
return /* @__PURE__ */ jsxs(MirrorStatusShell, { ...props, children: [
|
|
998
1065
|
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: t("deviceConnect.sessionClosed") }),
|
|
999
1066
|
/* @__PURE__ */ jsx("p", { className: "max-w-sm text-xs text-white/70", children: t("deviceConnect.recoveryExplanation") }),
|
|
1000
1067
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
@@ -1010,9 +1077,34 @@ function AndroidMirrorSurface(props) {
|
|
|
1010
1077
|
}
|
|
1011
1078
|
return /* @__PURE__ */ jsx(WebRtcMirrorSurface, { ...props }, props.deviceId);
|
|
1012
1079
|
}
|
|
1080
|
+
function MirrorStatusShell({ videoAspect, className, children }) {
|
|
1081
|
+
return /* @__PURE__ */ jsxs("div", { className: `flex min-h-0 flex-col items-center gap-2 ${className ?? ""}`, children: [
|
|
1082
|
+
/* @__PURE__ */ jsxs("div", { className: `flex min-h-0 max-w-[96vw] flex-1 items-stretch justify-center gap-2 ${videoAspect ? "w-max" : "w-full"}`, children: [
|
|
1083
|
+
/* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: "w-[54px] shrink-0" }),
|
|
1084
|
+
/* @__PURE__ */ jsx(
|
|
1085
|
+
"div",
|
|
1086
|
+
{
|
|
1087
|
+
role: "status",
|
|
1088
|
+
className: `flex min-h-0 flex-col items-center justify-center gap-3 overflow-hidden rounded-lg bg-black/80 p-6 text-center text-white ${videoAspect ? "h-full shrink-0" : "h-full flex-1"}`,
|
|
1089
|
+
style: videoAspect ? { aspectRatio: String(videoAspect), maxHeight: `calc((96vw - 3.5rem - 0px) / ${videoAspect})` } : void 0,
|
|
1090
|
+
children
|
|
1091
|
+
}
|
|
1092
|
+
)
|
|
1093
|
+
] }),
|
|
1094
|
+
/* @__PURE__ */ jsxs("div", { "aria-hidden": "true", className: "invisible flex items-center justify-center gap-1 rounded-xl border border-border px-2 py-1", children: [
|
|
1095
|
+
/* @__PURE__ */ jsx(ControlBar, { onHome: () => {
|
|
1096
|
+
}, onBack: () => {
|
|
1097
|
+
}, onMenu: () => {
|
|
1098
|
+
} }),
|
|
1099
|
+
/* @__PURE__ */ jsx("span", { className: "h-11 w-11" })
|
|
1100
|
+
] })
|
|
1101
|
+
] });
|
|
1102
|
+
}
|
|
1013
1103
|
function WebRtcMirrorSurface({ deviceId, platform = "android", onSize, videoAspect, shortcutBar, className }) {
|
|
1014
1104
|
const { stream, error, sendInput, setQuality, session } = useMirror(deviceId);
|
|
1015
1105
|
const [pasteContent, setPasteContent] = useState("");
|
|
1106
|
+
const [pasteOpen, setPasteOpen] = useState(false);
|
|
1107
|
+
const [actionsOpen, setActionsOpen] = useState(false);
|
|
1016
1108
|
const [panelOpen, setPanelOpen] = useState(false);
|
|
1017
1109
|
const [panelMounted, setPanelMounted] = useState(false);
|
|
1018
1110
|
const panelId = useId();
|
|
@@ -1022,6 +1114,13 @@ function WebRtcMirrorSurface({ deviceId, platform = "android", onSize, videoAspe
|
|
|
1022
1114
|
panelButton.current?.focus();
|
|
1023
1115
|
};
|
|
1024
1116
|
const { error: clipboardError, conflict: clipboardConflict, resolveConflict } = useClipboardSync(deviceId, !!stream);
|
|
1117
|
+
const { toasts, toast, dismiss } = useToast();
|
|
1118
|
+
const toastRef = useRef(toast);
|
|
1119
|
+
toastRef.current = toast;
|
|
1120
|
+
useEffect(() => {
|
|
1121
|
+
if (!clipboardError) return;
|
|
1122
|
+
toastRef.current.error(clipboardToastMessage(clipboardError));
|
|
1123
|
+
}, [clipboardError]);
|
|
1025
1124
|
const [size, setSize] = useState(DEFAULT_SIZE);
|
|
1026
1125
|
const [hasFrame, setHasFrame] = useState(false);
|
|
1027
1126
|
useEffect(() => {
|
|
@@ -1122,14 +1221,101 @@ function WebRtcMirrorSurface({ deviceId, platform = "android", onSize, videoAspe
|
|
|
1122
1221
|
[reportSize]
|
|
1123
1222
|
);
|
|
1124
1223
|
return /* @__PURE__ */ jsxs("div", { className: `flex min-h-0 flex-col items-center gap-2 ${className ?? ""}`, children: [
|
|
1224
|
+
/* @__PURE__ */ jsx(ToastViewport, { toasts, onDismiss: dismiss }),
|
|
1125
1225
|
/* @__PURE__ */ jsxs("div", { className: `flex min-h-0 max-w-[96vw] flex-1 items-stretch justify-center gap-2 ${videoAspect ? "w-max" : "w-full"}`, children: [
|
|
1226
|
+
/* @__PURE__ */ jsxs("aside", { "aria-label": "\u8BBE\u5907\u5DE5\u5177\u680F", className: "flex shrink-0 flex-col items-center gap-1 rounded-lg border border-border bg-background p-1 text-foreground", children: [
|
|
1227
|
+
/* @__PURE__ */ jsx("button", { type: "button", "aria-label": "\u7C98\u8D34\u6587\u672C", title: "\u7C98\u8D34\u6587\u672C", onClick: () => setPasteOpen(true), className: "flex h-11 w-11 items-center justify-center rounded-md hover:bg-secondary", children: /* @__PURE__ */ jsx(ClipboardPaste, { className: "h-4 w-4" }) }),
|
|
1228
|
+
/* @__PURE__ */ jsx("button", { type: "button", "aria-label": "\u8BBE\u5907\u64CD\u4F5C", title: "\u8BBE\u5907\u64CD\u4F5C", onClick: () => setActionsOpen(true), className: "flex h-11 w-11 items-center justify-center rounded-md hover:bg-secondary", children: /* @__PURE__ */ jsx(Wrench, { className: "h-4 w-4" }) }),
|
|
1229
|
+
/* @__PURE__ */ jsx(Popover, { className: "left-full top-0 !right-auto ml-2 !mt-0 !min-w-[140px]", trigger: ({ open, toggle }) => /* @__PURE__ */ jsx(
|
|
1230
|
+
"button",
|
|
1231
|
+
{
|
|
1232
|
+
type: "button",
|
|
1233
|
+
"aria-label": "\u753B\u8D28\u6863\u4F4D",
|
|
1234
|
+
"aria-expanded": open,
|
|
1235
|
+
"aria-haspopup": "menu",
|
|
1236
|
+
onClick: toggle,
|
|
1237
|
+
className: "flex h-11 w-11 items-center justify-center rounded-md text-xs text-foreground hover:bg-secondary",
|
|
1238
|
+
title: "\u753B\u8D28\u6863\u4F4D",
|
|
1239
|
+
children: /* @__PURE__ */ jsx(Settings2, { className: "h-4 w-4" })
|
|
1240
|
+
}
|
|
1241
|
+
), children: (close) => /* @__PURE__ */ jsx("div", { role: "menu", "aria-label": "\u9009\u62E9\u753B\u8D28", children: Object.keys(PROFILE_LABELS).map((p) => /* @__PURE__ */ jsxs(
|
|
1242
|
+
"button",
|
|
1243
|
+
{
|
|
1244
|
+
type: "button",
|
|
1245
|
+
role: "menuitemradio",
|
|
1246
|
+
"aria-checked": profile === p,
|
|
1247
|
+
onClick: () => {
|
|
1248
|
+
changeProfile(p, true);
|
|
1249
|
+
close();
|
|
1250
|
+
},
|
|
1251
|
+
className: "flex w-full items-center justify-between gap-4 rounded px-2 py-2 text-xs text-foreground hover:bg-secondary",
|
|
1252
|
+
children: [
|
|
1253
|
+
PROFILE_LABELS[p],
|
|
1254
|
+
profile === p && /* @__PURE__ */ jsx(Check, { className: "h-3.5 w-3.5" })
|
|
1255
|
+
]
|
|
1256
|
+
},
|
|
1257
|
+
p
|
|
1258
|
+
)) }) }),
|
|
1259
|
+
/* @__PURE__ */ jsx(Popover, { className: "left-full top-0 !right-auto ml-2 !mt-0 !min-w-0", trigger: ({ open, toggle }) => /* @__PURE__ */ jsx(
|
|
1260
|
+
"button",
|
|
1261
|
+
{
|
|
1262
|
+
type: "button",
|
|
1263
|
+
"aria-label": "\u97F3\u91CF",
|
|
1264
|
+
"aria-expanded": open,
|
|
1265
|
+
"aria-haspopup": "dialog",
|
|
1266
|
+
onClick: toggle,
|
|
1267
|
+
title: `\u97F3\u91CF ${volume}%`,
|
|
1268
|
+
className: "flex h-11 w-11 items-center justify-center rounded-md text-foreground hover:bg-secondary",
|
|
1269
|
+
children: volume === 0 ? /* @__PURE__ */ jsx(VolumeX, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Volume2, { className: "h-4 w-4" })
|
|
1270
|
+
}
|
|
1271
|
+
), children: () => /* @__PURE__ */ jsxs("div", { role: "dialog", "aria-label": "\u97F3\u91CF\u8C03\u8282", className: "flex flex-col items-center gap-2", children: [
|
|
1272
|
+
/* @__PURE__ */ jsx(
|
|
1273
|
+
"input",
|
|
1274
|
+
{
|
|
1275
|
+
type: "range",
|
|
1276
|
+
"aria-label": "\u64AD\u653E\u97F3\u91CF",
|
|
1277
|
+
min: 0,
|
|
1278
|
+
max: 100,
|
|
1279
|
+
value: volume,
|
|
1280
|
+
style: { writingMode: "vertical-lr", direction: "rtl", width: 24, height: 112 },
|
|
1281
|
+
disabled: !stream,
|
|
1282
|
+
onChange: (e) => {
|
|
1283
|
+
const next = Number(e.target.value);
|
|
1284
|
+
setVolume(next);
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
),
|
|
1288
|
+
/* @__PURE__ */ jsxs("span", { className: "whitespace-nowrap text-xs text-foreground", children: [
|
|
1289
|
+
volume,
|
|
1290
|
+
"%"
|
|
1291
|
+
] }),
|
|
1292
|
+
volume > 0 && !hasAudio && /* @__PURE__ */ jsx("span", { role: "status", className: "whitespace-nowrap text-xs text-muted-foreground", children: "\u7B49\u5F85\u97F3\u9891\u6D41" })
|
|
1293
|
+
] }) }),
|
|
1294
|
+
clipboardConflict && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1295
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => resolveConflict("local"), className: "text-xs underline", children: "\u4FDD\u7559\u672C\u673A\u526A\u8D34\u677F" }),
|
|
1296
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => resolveConflict("device"), className: "text-xs underline", children: "\u4FDD\u7559\u8BBE\u5907\u526A\u8D34\u677F" })
|
|
1297
|
+
] }),
|
|
1298
|
+
platform === "android" && /* @__PURE__ */ jsx(
|
|
1299
|
+
"button",
|
|
1300
|
+
{
|
|
1301
|
+
type: "button",
|
|
1302
|
+
onClick: toggleOrientation,
|
|
1303
|
+
"aria-label": landscape ? "\u5207\u56DE\u7AD6\u5C4F" : "\u5207\u6362\u6A2A\u5C4F",
|
|
1304
|
+
title: landscape ? "\u5207\u56DE\u7AD6\u5C4F" : "\u5207\u6362\u6A2A\u5C4F",
|
|
1305
|
+
"aria-pressed": landscape,
|
|
1306
|
+
className: `flex h-11 w-11 items-center justify-center rounded-md text-xs outline-none hover:bg-card ${landscape ? "bg-primary/15 text-primary" : "bg-secondary text-foreground"}`,
|
|
1307
|
+
children: /* @__PURE__ */ jsx(RotateCw, { className: "h-3.5 w-3.5" })
|
|
1308
|
+
}
|
|
1309
|
+
),
|
|
1310
|
+
shortcutBar
|
|
1311
|
+
] }),
|
|
1126
1312
|
/* @__PURE__ */ jsxs(
|
|
1127
1313
|
"div",
|
|
1128
1314
|
{
|
|
1129
1315
|
className: `relative min-h-0 overflow-hidden rounded-lg ${videoAspect ? "h-full shrink-0" : "h-full flex-1"}`,
|
|
1130
1316
|
style: videoAspect ? {
|
|
1131
1317
|
aspectRatio: String(videoAspect),
|
|
1132
|
-
maxHeight: `calc((96vw - ${panelOpen ? "min(16rem, 45vw) - 0.5rem" : "0px"}) / ${videoAspect})`
|
|
1318
|
+
maxHeight: `calc((96vw - 3.5rem - ${panelOpen ? "min(16rem, 45vw) - 0.5rem" : "0px"}) / ${videoAspect})`
|
|
1133
1319
|
} : void 0,
|
|
1134
1320
|
children: [
|
|
1135
1321
|
stream && /* @__PURE__ */ jsx(
|
|
@@ -1167,38 +1353,25 @@ function WebRtcMirrorSurface({ deviceId, platform = "android", onSize, videoAspe
|
|
|
1167
1353
|
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "AI \u63A7\u5236" }),
|
|
1168
1354
|
/* @__PURE__ */ jsx("button", { type: "button", "aria-label": "\u6536\u8D77 AI \u63A7\u5236\u9762\u677F", onClick: closePanel, className: "flex h-11 w-11 items-center justify-center rounded-md hover:bg-secondary focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary", children: /* @__PURE__ */ jsx(X, { "aria-hidden": "true", className: "h-4 w-4" }) })
|
|
1169
1355
|
] }),
|
|
1170
|
-
/* @__PURE__ */ jsx(
|
|
1171
|
-
shortcutBar,
|
|
1172
|
-
/* @__PURE__ */ jsxs("form", { className: "flex flex-col gap-2", onSubmit: (e) => {
|
|
1173
|
-
e.preventDefault();
|
|
1174
|
-
if (hasFrame && stream && pasteContent.trim()) sendInput({ t: "text", value: pasteContent });
|
|
1175
|
-
}, children: [
|
|
1176
|
-
/* @__PURE__ */ jsxs("label", { className: "text-xs font-medium", children: [
|
|
1177
|
-
"\u547D\u4EE4 / \u7C98\u8D34\u5185\u5BB9",
|
|
1178
|
-
/* @__PURE__ */ jsx(
|
|
1179
|
-
"textarea",
|
|
1180
|
-
{
|
|
1181
|
-
"aria-label": "\u547D\u4EE4 / \u7C98\u8D34\u5185\u5BB9",
|
|
1182
|
-
value: pasteContent,
|
|
1183
|
-
onChange: (e) => setPasteContent(e.target.value),
|
|
1184
|
-
placeholder: "\u8F93\u5165\u6216\u7C98\u8D34\u5185\u5BB9",
|
|
1185
|
-
rows: 5,
|
|
1186
|
-
className: "mt-2 w-full resize-y rounded border border-border bg-secondary p-2 text-xs"
|
|
1187
|
-
}
|
|
1188
|
-
)
|
|
1189
|
-
] }),
|
|
1190
|
-
/* @__PURE__ */ jsx("button", { type: "submit", disabled: !hasFrame || !stream || !pasteContent.trim(), className: "min-h-11 rounded bg-primary px-2 py-2 text-xs text-primary-foreground disabled:opacity-40", children: "\u7C98\u8D34\u5230\u8BBE\u5907" })
|
|
1191
|
-
] })
|
|
1356
|
+
/* @__PURE__ */ jsx(MirrorAiChat, { deviceId })
|
|
1192
1357
|
] })
|
|
1193
1358
|
] }),
|
|
1194
|
-
/* @__PURE__ */
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1359
|
+
/* @__PURE__ */ jsx(Dialog, { open: pasteOpen, onClose: () => setPasteOpen(false), title: "\u7C98\u8D34\u6587\u672C\u5230\u8BBE\u5907", description: "\u8F93\u5165\u8981\u53D1\u9001\u5230\u8BBE\u5907\u7684\u6587\u672C\u3002", children: /* @__PURE__ */ jsxs("form", { className: "flex flex-col gap-3", onSubmit: (e) => {
|
|
1360
|
+
e.preventDefault();
|
|
1361
|
+
if (hasFrame && stream && pasteContent.trim()) {
|
|
1362
|
+
sendInput({ t: "text", value: pasteContent });
|
|
1363
|
+
setPasteOpen(false);
|
|
1364
|
+
setPasteContent("");
|
|
1365
|
+
}
|
|
1366
|
+
}, children: [
|
|
1367
|
+
/* @__PURE__ */ jsxs("label", { className: "text-sm", children: [
|
|
1368
|
+
"\u6587\u672C\u5185\u5BB9",
|
|
1369
|
+
/* @__PURE__ */ jsx("textarea", { "aria-label": "\u6587\u672C\u5185\u5BB9", value: pasteContent, onChange: (e) => setPasteContent(e.target.value), rows: 5, className: "mt-2 w-full rounded border border-border bg-secondary p-2 text-sm" })
|
|
1201
1370
|
] }),
|
|
1371
|
+
/* @__PURE__ */ jsx("button", { type: "submit", disabled: !hasFrame || !stream || !pasteContent.trim(), className: "min-h-11 rounded bg-primary px-3 text-sm text-primary-foreground disabled:opacity-40", children: "\u7C98\u8D34\u5230\u8BBE\u5907" })
|
|
1372
|
+
] }) }),
|
|
1373
|
+
/* @__PURE__ */ jsx(Dialog, { open: actionsOpen, onClose: () => setActionsOpen(false), title: "\u8BBE\u5907\u64CD\u4F5C", children: /* @__PURE__ */ jsx(MirrorActions, { deviceId, stream, ready: hasFrame, platform }) }),
|
|
1374
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-center gap-1 rounded-xl border border-border bg-background px-2 py-1 shadow-lg", children: [
|
|
1202
1375
|
/* @__PURE__ */ jsx(
|
|
1203
1376
|
ControlBar,
|
|
1204
1377
|
{
|
|
@@ -1208,94 +1381,10 @@ function WebRtcMirrorSurface({ deviceId, platform = "android", onSize, videoAspe
|
|
|
1208
1381
|
onMenu: () => sendInput({ t: "key", code: "app_switch" })
|
|
1209
1382
|
}
|
|
1210
1383
|
),
|
|
1211
|
-
/* @__PURE__ */ jsx(
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
"aria-label": "\u753B\u8D28\u6863\u4F4D",
|
|
1216
|
-
"aria-expanded": open,
|
|
1217
|
-
"aria-haspopup": "menu",
|
|
1218
|
-
onClick: toggle,
|
|
1219
|
-
className: "flex h-9 items-center gap-1.5 rounded-md px-2 text-xs text-foreground hover:bg-secondary",
|
|
1220
|
-
title: "\u753B\u8D28\u6863\u4F4D",
|
|
1221
|
-
children: [
|
|
1222
|
-
/* @__PURE__ */ jsx(Settings2, { className: "h-4 w-4" }),
|
|
1223
|
-
PROFILE_LABELS[profile]
|
|
1224
|
-
]
|
|
1225
|
-
}
|
|
1226
|
-
), children: (close) => /* @__PURE__ */ jsx("div", { role: "menu", "aria-label": "\u9009\u62E9\u753B\u8D28", children: Object.keys(PROFILE_LABELS).map((p) => /* @__PURE__ */ jsxs(
|
|
1227
|
-
"button",
|
|
1228
|
-
{
|
|
1229
|
-
type: "button",
|
|
1230
|
-
role: "menuitemradio",
|
|
1231
|
-
"aria-checked": profile === p,
|
|
1232
|
-
onClick: () => {
|
|
1233
|
-
changeProfile(p, true);
|
|
1234
|
-
close();
|
|
1235
|
-
},
|
|
1236
|
-
className: "flex w-full items-center justify-between gap-4 rounded px-2 py-2 text-xs text-foreground hover:bg-secondary",
|
|
1237
|
-
children: [
|
|
1238
|
-
PROFILE_LABELS[p],
|
|
1239
|
-
profile === p && /* @__PURE__ */ jsx(Check, { className: "h-3.5 w-3.5" })
|
|
1240
|
-
]
|
|
1241
|
-
},
|
|
1242
|
-
p
|
|
1243
|
-
)) }) }),
|
|
1244
|
-
/* @__PURE__ */ jsx(Popover, { className: "bottom-full mb-2 !mt-0 !min-w-0", trigger: ({ open, toggle }) => /* @__PURE__ */ jsx(
|
|
1245
|
-
"button",
|
|
1246
|
-
{
|
|
1247
|
-
type: "button",
|
|
1248
|
-
"aria-label": "\u97F3\u91CF",
|
|
1249
|
-
"aria-expanded": open,
|
|
1250
|
-
"aria-haspopup": "dialog",
|
|
1251
|
-
onClick: toggle,
|
|
1252
|
-
title: `\u97F3\u91CF ${volume}%`,
|
|
1253
|
-
className: "flex h-9 w-9 items-center justify-center rounded-md text-foreground hover:bg-secondary",
|
|
1254
|
-
children: volume === 0 ? /* @__PURE__ */ jsx(VolumeX, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Volume2, { className: "h-4 w-4" })
|
|
1255
|
-
}
|
|
1256
|
-
), children: () => /* @__PURE__ */ jsxs("div", { role: "dialog", "aria-label": "\u97F3\u91CF\u8C03\u8282", className: "flex flex-col items-center gap-2", children: [
|
|
1257
|
-
/* @__PURE__ */ jsx(
|
|
1258
|
-
"input",
|
|
1259
|
-
{
|
|
1260
|
-
type: "range",
|
|
1261
|
-
"aria-label": "\u64AD\u653E\u97F3\u91CF",
|
|
1262
|
-
min: 0,
|
|
1263
|
-
max: 100,
|
|
1264
|
-
value: volume,
|
|
1265
|
-
style: { writingMode: "vertical-lr", direction: "rtl", width: 24, height: 112 },
|
|
1266
|
-
disabled: !stream,
|
|
1267
|
-
onChange: (e) => {
|
|
1268
|
-
const next = Number(e.target.value);
|
|
1269
|
-
setVolume(next);
|
|
1270
|
-
}
|
|
1271
|
-
}
|
|
1272
|
-
),
|
|
1273
|
-
/* @__PURE__ */ jsxs("span", { className: "whitespace-nowrap text-xs text-foreground", children: [
|
|
1274
|
-
volume,
|
|
1275
|
-
"%"
|
|
1276
|
-
] }),
|
|
1277
|
-
volume > 0 && !hasAudio && /* @__PURE__ */ jsx("span", { role: "status", className: "whitespace-nowrap text-xs text-muted-foreground", children: "\u7B49\u5F85\u97F3\u9891\u6D41" })
|
|
1278
|
-
] }) }),
|
|
1279
|
-
clipboardConflict && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1280
|
-
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => resolveConflict("local"), className: "text-xs underline", children: "\u4FDD\u7559\u672C\u673A\u526A\u8D34\u677F" }),
|
|
1281
|
-
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => resolveConflict("device"), className: "text-xs underline", children: "\u4FDD\u7559\u8BBE\u5907\u526A\u8D34\u677F" })
|
|
1282
|
-
] }),
|
|
1283
|
-
clipboardError && /* @__PURE__ */ jsxs("span", { role: "status", className: "text-xs text-destructive", children: [
|
|
1284
|
-
"\u526A\u8D34\u677F\u540C\u6B65\u5931\u8D25\uFF1A",
|
|
1285
|
-
clipboardError
|
|
1286
|
-
] }),
|
|
1287
|
-
platform === "android" && /* @__PURE__ */ jsx(
|
|
1288
|
-
"button",
|
|
1289
|
-
{
|
|
1290
|
-
type: "button",
|
|
1291
|
-
onClick: toggleOrientation,
|
|
1292
|
-
"aria-label": landscape ? "\u5207\u56DE\u7AD6\u5C4F" : "\u5207\u6362\u6A2A\u5C4F",
|
|
1293
|
-
title: landscape ? "\u5207\u56DE\u7AD6\u5C4F" : "\u5207\u6362\u6A2A\u5C4F",
|
|
1294
|
-
"aria-pressed": landscape,
|
|
1295
|
-
className: `flex h-9 w-9 items-center justify-center rounded-md text-xs outline-none hover:bg-card ${landscape ? "bg-primary/15 text-primary" : "bg-secondary text-foreground"}`,
|
|
1296
|
-
children: /* @__PURE__ */ jsx(RotateCw, { className: "h-3.5 w-3.5" })
|
|
1297
|
-
}
|
|
1298
|
-
)
|
|
1384
|
+
/* @__PURE__ */ jsx("button", { ref: panelButton, type: "button", "aria-label": "AI \u63A7\u5236", title: "AI \u63A7\u5236", "aria-expanded": panelOpen, "aria-controls": panelMounted ? panelId : void 0, onClick: () => {
|
|
1385
|
+
setPanelMounted(true);
|
|
1386
|
+
setPanelOpen((open) => !open);
|
|
1387
|
+
}, className: "flex h-11 w-11 items-center justify-center rounded-md text-foreground hover:bg-secondary focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary", children: /* @__PURE__ */ jsx(PanelsTopLeft, { "aria-hidden": "true", className: "h-4 w-4" }) })
|
|
1299
1388
|
] })
|
|
1300
1389
|
] });
|
|
1301
1390
|
}
|
|
@@ -1366,7 +1455,7 @@ function DeviceMirror({ deviceId, deviceName, platform = "android", shortcutBar,
|
|
|
1366
1455
|
if (!open) return;
|
|
1367
1456
|
const onKey = (e) => {
|
|
1368
1457
|
resetActivity();
|
|
1369
|
-
if (e.key === "Escape" && !fullscreen) onClose();
|
|
1458
|
+
if (e.key === "Escape" && !fullscreen && !e.defaultPrevented) onClose();
|
|
1370
1459
|
};
|
|
1371
1460
|
window.addEventListener("keydown", onKey);
|
|
1372
1461
|
return () => window.removeEventListener("keydown", onKey);
|