@opengeni/react 7.4.0 → 7.5.0-canary.36919050519001
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/README.md +124 -27
- package/dist/artifacts-document.js +3 -2
- package/dist/artifacts-presentation.js +3 -2
- package/dist/artifacts-spreadsheet.js +2 -2
- package/dist/artifacts.d.ts +1 -0
- package/dist/artifacts.js +516 -1413
- package/dist/artifacts.js.map +1 -1
- package/dist/{browser-viewer-2E6R2Y4W.js → browser-viewer-Z7S7QEJL.js} +6 -5
- package/dist/chat-interactive-block-UGBTNB3L.js +11 -0
- package/dist/{chunk-Y3QTZN2F.js → chunk-2VFNCX4E.js} +6 -6
- package/dist/{chunk-UDD6DLLT.js → chunk-3IJJEYW4.js} +15 -3
- package/dist/chunk-3IJJEYW4.js.map +1 -0
- package/dist/chunk-4RVYOY4O.js +379 -0
- package/dist/chunk-4RVYOY4O.js.map +1 -0
- package/dist/chunk-5CVXZA3Y.js +292 -0
- package/dist/chunk-5CVXZA3Y.js.map +1 -0
- package/dist/{chunk-5YK2ZDIG.js → chunk-5J4FOW6Q.js} +2 -10
- package/dist/chunk-5J4FOW6Q.js.map +1 -0
- package/dist/{chunk-KVERXCFY.js → chunk-5KYZIQFY.js} +40 -3
- package/dist/chunk-5KYZIQFY.js.map +1 -0
- package/dist/{chunk-KNDIXZN6.js → chunk-7UAMYXJY.js} +25 -18
- package/dist/{chunk-KNDIXZN6.js.map → chunk-7UAMYXJY.js.map} +1 -1
- package/dist/{chunk-SEEVCT36.js → chunk-A4UJB2MM.js} +2 -2
- package/dist/{chunk-X4HIN6TV.js → chunk-AFLPWUQ7.js} +71 -162
- package/dist/chunk-AFLPWUQ7.js.map +1 -0
- package/dist/chunk-B3V6TG77.js +41 -0
- package/dist/chunk-B3V6TG77.js.map +1 -0
- package/dist/{chunk-XEJEOAOV.js → chunk-B7WMS3CS.js} +51 -40
- package/dist/chunk-B7WMS3CS.js.map +1 -0
- package/dist/{chunk-S5JQ4R22.js → chunk-BDKR6BAR.js} +54 -24
- package/dist/chunk-BDKR6BAR.js.map +1 -0
- package/dist/{chunk-4MDLEHXL.js → chunk-DYWBUX5Q.js} +24 -12
- package/dist/chunk-DYWBUX5Q.js.map +1 -0
- package/dist/{chunk-YZ3YYMOM.js → chunk-E3G7SAYZ.js} +252 -624
- package/dist/chunk-E3G7SAYZ.js.map +1 -0
- package/dist/chunk-JT4JW7BC.js +54 -0
- package/dist/chunk-JT4JW7BC.js.map +1 -0
- package/dist/{chunk-5AZSK6MV.js → chunk-LWNLETQT.js} +5 -5
- package/dist/{chunk-USXVQACU.js → chunk-M7LBYP63.js} +5 -4
- package/dist/{chunk-USXVQACU.js.map → chunk-M7LBYP63.js.map} +1 -1
- package/dist/{chunk-L4OSXQ6H.js → chunk-NBOHNRLJ.js} +1289 -1060
- package/dist/chunk-NBOHNRLJ.js.map +1 -0
- package/dist/chunk-RHREZ7BO.js +11 -0
- package/dist/chunk-RHREZ7BO.js.map +1 -0
- package/dist/chunk-SCOTPE2I.js +589 -0
- package/dist/chunk-SCOTPE2I.js.map +1 -0
- package/dist/chunk-WEHMPOXK.js +39 -0
- package/dist/chunk-WEHMPOXK.js.map +1 -0
- package/dist/chunk-WRHIZYZF.js +988 -0
- package/dist/chunk-WRHIZYZF.js.map +1 -0
- package/dist/{chunk-3E2AITTZ.js → chunk-WUISZ3WU.js} +32 -28
- package/dist/{chunk-3E2AITTZ.js.map → chunk-WUISZ3WU.js.map} +1 -1
- package/dist/chunk-XCHWDJ22.js +107 -0
- package/dist/chunk-XCHWDJ22.js.map +1 -0
- package/dist/{chunk-DUEBTL3N.js → chunk-Y2PRMYLC.js} +4 -3
- package/dist/{chunk-DUEBTL3N.js.map → chunk-Y2PRMYLC.js.map} +1 -1
- package/dist/chunk-YBXQDQFX.js +1772 -0
- package/dist/chunk-YBXQDQFX.js.map +1 -0
- package/dist/chunk-YV4L3ILF.js +9 -0
- package/dist/chunk-YV4L3ILF.js.map +1 -0
- package/dist/{chunk-V2ABIVYJ.js → chunk-ZXSEDZP7.js} +70 -6
- package/dist/chunk-ZXSEDZP7.js.map +1 -0
- package/dist/components/artifacts/artifact-chrome.d.ts +120 -0
- package/dist/components/artifacts/artifact-sandbox.d.ts +27 -0
- package/dist/components/artifacts/chat-interactive-block.d.ts +29 -0
- package/dist/components/artifacts/deferred-chat-media.d.ts +15 -0
- package/dist/components/artifacts/editable-artifact-ui.d.ts +2 -1
- package/dist/components/artifacts/editable-artifact-view.d.ts +46 -0
- package/dist/components/artifacts/index.d.ts +7 -0
- package/dist/components/artifacts/latest-task-runner.d.ts +15 -0
- package/dist/components/artifacts/session-artifact-viewer.d.ts +39 -0
- package/dist/components/artifacts/site-view.d.ts +23 -0
- package/dist/components/browser-select-control.d.ts +3 -1
- package/dist/components/code-editor.d.ts +1 -4
- package/dist/components/desktop-viewer.d.ts +1 -1
- package/dist/components/message-timeline.d.ts +20 -3
- package/dist/components/open-geni-links.d.ts +16 -0
- package/dist/components/session-conversation.d.ts +20 -1
- package/dist/components/timeline-pill-geometry.d.ts +8 -0
- package/dist/components/timeline-pill-placement.d.ts +24 -0
- package/dist/components/usage-limit-notice.d.ts +49 -0
- package/dist/components/usage-member-list.d.ts +91 -0
- package/dist/components/usage-meter.d.ts +73 -0
- package/dist/composer.js +5 -5
- package/dist/{computer-viewer-WMJE6OA3.js → computer-viewer-KJWLH3GI.js} +7 -5
- package/dist/connect.js +7 -6
- package/dist/connect.js.map +1 -1
- package/dist/conversation-timeline.d.ts +1 -1
- package/dist/desktop.d.ts +7 -0
- package/dist/desktop.js +26 -0
- package/dist/desktop.js.map +1 -0
- package/dist/editor.d.ts +7 -0
- package/dist/editor.js +21 -0
- package/dist/editor.js.map +1 -0
- package/dist/hooks/latest-question.d.ts +1 -1
- package/dist/hooks/use-composer.d.ts +4 -0
- package/dist/hooks/use-desktop-stream.d.ts +1 -1
- package/dist/hooks/use-usage.d.ts +40 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.js +460 -1386
- package/dist/index.js.map +1 -1
- package/dist/interaction.js +8 -6
- package/dist/interaction.js.map +1 -1
- package/dist/{latest-question-QB4EUCW5.js → latest-question-IS445HOW.js} +3 -3
- package/dist/lib/format.d.ts +6 -1
- package/dist/lib/workbench-peers.d.ts +36 -0
- package/dist/machines.js +2 -2
- package/dist/{markdown-table-layout-PFUEZ2U4.js → markdown-table-layout-QXSLK4BY.js} +37 -5
- package/dist/markdown-table-layout-QXSLK4BY.js.map +1 -0
- package/dist/{queue-surface-implementation-IM2HD3SK.js → queue-surface-implementation-2CAQAIHM.js} +2 -2
- package/dist/realtime.js +3 -3
- package/dist/{sandbox-files-PXPIZAFG.js → sandbox-files-AEJTWGT4.js} +8 -5
- package/dist/sandbox-files-AEJTWGT4.js.map +1 -0
- package/dist/session-ui.d.ts +9 -2
- package/dist/session-ui.js +39 -20
- package/dist/session-ui.js.map +1 -1
- package/dist/session.js +4 -4
- package/dist/sites.js +4 -289
- package/dist/sites.js.map +1 -1
- package/dist/terminal.d.ts +8 -0
- package/dist/terminal.js +31 -0
- package/dist/terminal.js.map +1 -0
- package/dist/timeline/allowance-exhausted-row.d.ts +24 -0
- package/dist/timeline/genie-loading.d.ts +3 -1
- package/dist/timeline/types.d.ts +8 -1
- package/dist/{timeline-annotation-selection-ODLVF4OI.js → timeline-annotation-selection-DMLMM2TX.js} +6 -1
- package/dist/timeline-annotation-selection-DMLMM2TX.js.map +1 -0
- package/dist/timeline-pill-geometry-Z23V243M.js +110 -0
- package/dist/timeline-pill-geometry-Z23V243M.js.map +1 -0
- package/dist/usage/allowance-copy.d.ts +25 -0
- package/dist/usage/summary.d.ts +35 -0
- package/dist/usage.d.ts +13 -0
- package/dist/usage.js +1073 -0
- package/dist/usage.js.map +1 -0
- package/package.json +19 -3
- package/src/artifacts.ts +37 -0
- package/src/components/artifacts/artifact-chrome.tsx +413 -0
- package/src/components/artifacts/artifact-sandbox.tsx +185 -0
- package/src/components/artifacts/chat-interactive-block.tsx +260 -0
- package/src/components/artifacts/deferred-chat-media.tsx +67 -0
- package/src/components/artifacts/editable-artifact-ui.tsx +3 -1
- package/src/components/artifacts/editable-artifact-view.tsx +187 -0
- package/src/components/artifacts/editable-artifact-workbench.tsx +5 -2
- package/src/components/artifacts/editable-document.tsx +34 -36
- package/src/components/artifacts/editable-presentation.tsx +21 -16
- package/src/components/artifacts/index.ts +41 -0
- package/src/components/artifacts/latest-task-runner.ts +49 -0
- package/src/components/artifacts/session-artifact-viewer.tsx +376 -0
- package/src/components/artifacts/site-view.tsx +116 -0
- package/src/components/browser-select-control.tsx +4 -1
- package/src/components/browser-viewer.tsx +81 -22
- package/src/components/code-editor.tsx +13 -16
- package/src/components/computer-viewer.tsx +51 -23
- package/src/components/desktop-viewer.tsx +1 -1
- package/src/components/markdown-table-layout.ts +49 -5
- package/src/components/markdown.tsx +5 -2
- package/src/components/message-timeline.tsx +557 -516
- package/src/components/open-geni-links.tsx +24 -0
- package/src/components/sandbox-terminal.tsx +48 -11
- package/src/components/session-chrome.tsx +22 -3
- package/src/components/session-conversation.tsx +195 -102
- package/src/components/timeline-annotation-selection.tsx +7 -0
- package/src/components/timeline-pill-geometry.ts +169 -0
- package/src/components/timeline-pill-placement.ts +99 -0
- package/src/components/usage-limit-notice.tsx +179 -0
- package/src/components/usage-member-list.tsx +792 -0
- package/src/components/usage-meter.tsx +382 -0
- package/src/conversation-timeline.ts +10 -2
- package/src/desktop.ts +24 -0
- package/src/editor.ts +13 -0
- package/src/hooks/use-available-models.ts +1 -1
- package/src/hooks/use-composer.ts +57 -2
- package/src/hooks/use-desktop-stream.ts +19 -28
- package/src/hooks/use-usage.ts +100 -0
- package/src/index.ts +22 -0
- package/src/lib/format.ts +32 -6
- package/src/lib/workbench-peers.ts +62 -0
- package/src/session-ui.ts +22 -0
- package/src/terminal.ts +26 -0
- package/src/timeline/activity-rail.tsx +5 -3
- package/src/timeline/allowance-exhausted-row.tsx +86 -0
- package/src/timeline/genie-loading.tsx +16 -6
- package/src/timeline/projection.ts +78 -4
- package/src/timeline/types.ts +8 -0
- package/src/usage/allowance-copy.ts +64 -0
- package/src/usage/summary.ts +93 -0
- package/src/usage.ts +50 -0
- package/styles/compiled.css +325 -0
- package/dist/chunk-4MDLEHXL.js.map +0 -1
- package/dist/chunk-5YK2ZDIG.js.map +0 -1
- package/dist/chunk-KVERXCFY.js.map +0 -1
- package/dist/chunk-L4OSXQ6H.js.map +0 -1
- package/dist/chunk-S5JQ4R22.js.map +0 -1
- package/dist/chunk-UDD6DLLT.js.map +0 -1
- package/dist/chunk-UGMKPUEM.js +0 -299
- package/dist/chunk-UGMKPUEM.js.map +0 -1
- package/dist/chunk-V2ABIVYJ.js.map +0 -1
- package/dist/chunk-X4HIN6TV.js.map +0 -1
- package/dist/chunk-XEJEOAOV.js.map +0 -1
- package/dist/chunk-YZ3YYMOM.js.map +0 -1
- package/dist/markdown-table-layout-PFUEZ2U4.js.map +0 -1
- package/dist/timeline-annotation-selection-ODLVF4OI.js.map +0 -1
- /package/dist/{browser-viewer-2E6R2Y4W.js.map → browser-viewer-Z7S7QEJL.js.map} +0 -0
- /package/dist/{computer-viewer-WMJE6OA3.js.map → chat-interactive-block-UGBTNB3L.js.map} +0 -0
- /package/dist/{chunk-Y3QTZN2F.js.map → chunk-2VFNCX4E.js.map} +0 -0
- /package/dist/{chunk-SEEVCT36.js.map → chunk-A4UJB2MM.js.map} +0 -0
- /package/dist/{chunk-5AZSK6MV.js.map → chunk-LWNLETQT.js.map} +0 -0
- /package/dist/{sandbox-files-PXPIZAFG.js.map → computer-viewer-KJWLH3GI.js.map} +0 -0
- /package/dist/{latest-question-QB4EUCW5.js.map → latest-question-IS445HOW.js.map} +0 -0
- /package/dist/{queue-surface-implementation-IM2HD3SK.js.map → queue-surface-implementation-2CAQAIHM.js.map} +0 -0
|
@@ -5,9 +5,12 @@ import {
|
|
|
5
5
|
useInteractionInterventions,
|
|
6
6
|
useInteractionInvalidation
|
|
7
7
|
} from "./chunk-YSMMDOOE.js";
|
|
8
|
+
import {
|
|
9
|
+
copyTextToClipboard
|
|
10
|
+
} from "./chunk-JVYQRRC4.js";
|
|
8
11
|
import {
|
|
9
12
|
DesktopViewer
|
|
10
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-DYWBUX5Q.js";
|
|
11
14
|
import {
|
|
12
15
|
STREAM_CLOSE_REASON_NORMAL,
|
|
13
16
|
STREAM_KIND_COMPUTER,
|
|
@@ -16,7 +19,7 @@ import {
|
|
|
16
19
|
decodeStreamOpenAck,
|
|
17
20
|
encodeStreamClose,
|
|
18
21
|
encodeStreamOpen
|
|
19
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-5J4FOW6Q.js";
|
|
20
23
|
import {
|
|
21
24
|
usePageLiveActivity
|
|
22
25
|
} from "./chunk-KZ73RL76.js";
|
|
@@ -26,9 +29,6 @@ import {
|
|
|
26
29
|
import {
|
|
27
30
|
cn
|
|
28
31
|
} from "./chunk-22KP6LR5.js";
|
|
29
|
-
import {
|
|
30
|
-
copyTextToClipboard
|
|
31
|
-
} from "./chunk-JVYQRRC4.js";
|
|
32
32
|
|
|
33
33
|
// src/components/computer-viewer.tsx
|
|
34
34
|
import { interactionControlFailureFromError } from "@opengeni/sdk/interaction";
|
|
@@ -1083,13 +1083,15 @@ function ComputerViewer({
|
|
|
1083
1083
|
});
|
|
1084
1084
|
const displayedFrame = frames.frame && frames.frame.computerSessionId === selection?.sessionId && frames.frame.targetId === computer.selectedTarget?.id && frames.frame.targetGeneration === computer.selectedTarget?.targetGeneration ? frames.frame : null;
|
|
1085
1085
|
const rfbStream = frames.attachment?.stream.kind === "direct_rfb" ? frames.attachment.stream : null;
|
|
1086
|
+
const machineLocked = selectedRegistrySession?.failureCode === "machine_locked";
|
|
1087
|
+
const rfbInputEnabled = !machineLocked && computer.session?.capabilities?.pointerInput === true && computer.session?.capabilities?.keyboardInput === true;
|
|
1086
1088
|
const rfbCapability = useMemo2(() => {
|
|
1087
1089
|
if (!rfbStream || !frames.attachment) return null;
|
|
1088
1090
|
const bounds = computer.selectedTarget?.bounds;
|
|
1089
1091
|
return {
|
|
1090
1092
|
transport: "vnc-ws",
|
|
1091
1093
|
client: "novnc",
|
|
1092
|
-
mode: "interactive",
|
|
1094
|
+
mode: rfbInputEnabled ? "interactive" : "read-only",
|
|
1093
1095
|
url: rfbStream.url,
|
|
1094
1096
|
token: null,
|
|
1095
1097
|
expiresAt: frames.attachment.expiresAt,
|
|
@@ -1101,8 +1103,7 @@ function ComputerViewer({
|
|
|
1101
1103
|
sharedSessionIds: [],
|
|
1102
1104
|
reason: null
|
|
1103
1105
|
};
|
|
1104
|
-
}, [computer.selectedTarget?.bounds, frames.attachment, rfbStream]);
|
|
1105
|
-
const machineLocked = selectedRegistrySession?.failureCode === "machine_locked";
|
|
1106
|
+
}, [computer.selectedTarget?.bounds, frames.attachment, rfbInputEnabled, rfbStream]);
|
|
1106
1107
|
const currentIds = useMemo2(() => new Set(relevant.map((session) => session.id)), [relevant]);
|
|
1107
1108
|
useEffect4(() => {
|
|
1108
1109
|
for (const intervention of interventions.interventions) {
|
|
@@ -1206,7 +1207,8 @@ function ComputerViewer({
|
|
|
1206
1207
|
);
|
|
1207
1208
|
const copyFromRfb = useCallback4(
|
|
1208
1209
|
(event) => {
|
|
1209
|
-
if (!rfbStream || computer.session?.capabilities?.clipboard !== true)
|
|
1210
|
+
if (!rfbInputEnabled || !rfbStream || computer.session?.capabilities?.clipboard !== true)
|
|
1211
|
+
return;
|
|
1210
1212
|
event.preventDefault();
|
|
1211
1213
|
event.stopPropagation();
|
|
1212
1214
|
void perform({ type: "clipboard", operation: "copy" }, null).then(() => computer.readClipboard()).then(async (clipboard) => {
|
|
@@ -1215,11 +1217,12 @@ function ComputerViewer({
|
|
|
1215
1217
|
}
|
|
1216
1218
|
}).catch((cause) => notifyError(cause, "Could not copy from the desktop."));
|
|
1217
1219
|
},
|
|
1218
|
-
[computer, notifyError, perform, rfbStream]
|
|
1220
|
+
[computer, notifyError, perform, rfbInputEnabled, rfbStream]
|
|
1219
1221
|
);
|
|
1220
1222
|
const pasteIntoRfb = useCallback4(
|
|
1221
1223
|
(text) => {
|
|
1222
|
-
if (!rfbStream || computer.session?.capabilities?.clipboard !== true)
|
|
1224
|
+
if (!rfbInputEnabled || !rfbStream || computer.session?.capabilities?.clipboard !== true)
|
|
1225
|
+
return false;
|
|
1223
1226
|
void (async () => {
|
|
1224
1227
|
await perform({ type: "clipboard", operation: "write", text }, null);
|
|
1225
1228
|
assertExactComputerClipboard(await computer.readClipboard(), text);
|
|
@@ -1227,7 +1230,7 @@ function ComputerViewer({
|
|
|
1227
1230
|
})().catch((cause) => notifyError(cause, "Could not paste into the desktop."));
|
|
1228
1231
|
return true;
|
|
1229
1232
|
},
|
|
1230
|
-
[computer, notifyError, perform, rfbStream]
|
|
1233
|
+
[computer, notifyError, perform, rfbInputEnabled, rfbStream]
|
|
1231
1234
|
);
|
|
1232
1235
|
const hideGenericCreate = suppressGenericCreate && liveRelevant.length === 0;
|
|
1233
1236
|
const generationLossSelected = selectedRegistrySession !== null && isAttachedChromeGenerationLoss(selectedRegistrySession);
|
|
@@ -1333,18 +1336,21 @@ function ComputerViewer({
|
|
|
1333
1336
|
}
|
|
1334
1337
|
),
|
|
1335
1338
|
/* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1", children: [
|
|
1336
|
-
rfbStream ? /* @__PURE__ */
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1339
|
+
rfbStream ? /* @__PURE__ */ jsxs("div", { className: "relative min-h-0 flex-1 bg-black", onCopyCapture: copyFromRfb, children: [
|
|
1340
|
+
/* @__PURE__ */ jsx(
|
|
1341
|
+
DesktopViewer,
|
|
1342
|
+
{
|
|
1343
|
+
capability: rfbCapability,
|
|
1344
|
+
interactive: rfbInputEnabled,
|
|
1345
|
+
showControlToggle: false,
|
|
1346
|
+
webSocketProtocols: rfbStream.protocols,
|
|
1347
|
+
onPasteText: pasteIntoRfb,
|
|
1348
|
+
targetPlatform: computer.session?.platform ?? null,
|
|
1349
|
+
className: "h-full"
|
|
1350
|
+
}
|
|
1351
|
+
),
|
|
1352
|
+
!rfbInputEnabled ? /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute bottom-3 left-1/2 -translate-x-1/2 rounded-full border border-white/10 bg-black/70 px-3 py-1 text-[11px] text-white/80 backdrop-blur", children: "View only \xB7 direct input unavailable" }) : null
|
|
1353
|
+
] }) : /* @__PURE__ */ jsx(
|
|
1348
1354
|
ComputerViewport,
|
|
1349
1355
|
{
|
|
1350
1356
|
frame: machineLocked ? null : displayedFrame,
|
|
@@ -1356,6 +1362,8 @@ function ComputerViewer({
|
|
|
1356
1362
|
mutating: computer.mutating,
|
|
1357
1363
|
backgroundActions: computer.session?.capabilities?.backgroundActions === true,
|
|
1358
1364
|
clipboardEnabled: computer.session?.capabilities?.clipboard === true,
|
|
1365
|
+
pointerInput: computer.session?.capabilities?.pointerInput === true,
|
|
1366
|
+
keyboardInput: computer.session?.capabilities?.keyboardInput === true,
|
|
1359
1367
|
onAction: perform,
|
|
1360
1368
|
onReadClipboard: computer.readClipboard,
|
|
1361
1369
|
onReconnect: generationLossSelected || generationLossFrames ? () => void 0 : frames.reconnect,
|
|
@@ -1642,6 +1650,8 @@ function ComputerViewport(props) {
|
|
|
1642
1650
|
lastClickRef.current = null;
|
|
1643
1651
|
if (inputRef.current) inputRef.current.value = "";
|
|
1644
1652
|
}, []);
|
|
1653
|
+
const pointerInputEnabled = rawInputEnabled && props.pointerInput;
|
|
1654
|
+
const keyboardInputEnabled = rawInputEnabled && props.keyboardInput;
|
|
1645
1655
|
const paintQueuedFrames = useCallback4(() => {
|
|
1646
1656
|
if (decodingFrameRef.current) return;
|
|
1647
1657
|
decodingFrameRef.current = true;
|
|
@@ -1714,11 +1724,11 @@ function ComputerViewport(props) {
|
|
|
1714
1724
|
paintQueuedFrames();
|
|
1715
1725
|
}, [clearBufferedInput, paintQueuedFrames, props.frame]);
|
|
1716
1726
|
useLayoutEffect(() => {
|
|
1717
|
-
if (!rawInputEnabled) {
|
|
1727
|
+
if (!rawInputEnabled || !props.pointerInput || !props.keyboardInput) {
|
|
1718
1728
|
actionQueueEpochRef.current += 1;
|
|
1719
1729
|
clearBufferedInput();
|
|
1720
1730
|
}
|
|
1721
|
-
}, [clearBufferedInput, rawInputEnabled]);
|
|
1731
|
+
}, [clearBufferedInput, props.keyboardInput, props.pointerInput, rawInputEnabled]);
|
|
1722
1732
|
const enqueue = useCallback4(
|
|
1723
1733
|
(action, frame, after) => {
|
|
1724
1734
|
const epoch = actionQueueEpochRef.current;
|
|
@@ -1788,6 +1798,8 @@ function ComputerViewport(props) {
|
|
|
1788
1798
|
const frame = paintedFrameRef.current;
|
|
1789
1799
|
if (!frame || props.mutating || !rawInputEnabled || event.button !== 0) return;
|
|
1790
1800
|
event.preventDefault();
|
|
1801
|
+
if (keyboardInputEnabled) inputRef.current?.focus({ preventScroll: true });
|
|
1802
|
+
if (!pointerInputEnabled) return;
|
|
1791
1803
|
flushPendingWheel();
|
|
1792
1804
|
flushPendingText();
|
|
1793
1805
|
pointerStartRef.current = {
|
|
@@ -1797,10 +1809,9 @@ function ComputerViewport(props) {
|
|
|
1797
1809
|
frame
|
|
1798
1810
|
};
|
|
1799
1811
|
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
1800
|
-
inputRef.current?.focus({ preventScroll: true });
|
|
1801
1812
|
};
|
|
1802
1813
|
const pointerUp = (event) => {
|
|
1803
|
-
if (!
|
|
1814
|
+
if (!pointerInputEnabled) return;
|
|
1804
1815
|
const start = pointerStartRef.current;
|
|
1805
1816
|
pointerStartRef.current = null;
|
|
1806
1817
|
if (!start || start.pointerId !== event.pointerId) return;
|
|
@@ -1859,7 +1870,7 @@ function ComputerViewport(props) {
|
|
|
1859
1870
|
};
|
|
1860
1871
|
const contextMenu = (event) => {
|
|
1861
1872
|
event.preventDefault();
|
|
1862
|
-
if (!
|
|
1873
|
+
if (!pointerInputEnabled) return;
|
|
1863
1874
|
const frame = paintedFrameRef.current;
|
|
1864
1875
|
if (!frame) return;
|
|
1865
1876
|
flushPendingWheel();
|
|
@@ -1881,7 +1892,7 @@ function ComputerViewport(props) {
|
|
|
1881
1892
|
}
|
|
1882
1893
|
};
|
|
1883
1894
|
const wheel = (event) => {
|
|
1884
|
-
if (!
|
|
1895
|
+
if (!pointerInputEnabled) return;
|
|
1885
1896
|
const frame = paintedFrameRef.current;
|
|
1886
1897
|
if (!frame) return;
|
|
1887
1898
|
const at = point(frame, event.clientX, event.clientY);
|
|
@@ -1904,7 +1915,7 @@ function ComputerViewport(props) {
|
|
|
1904
1915
|
};
|
|
1905
1916
|
};
|
|
1906
1917
|
const keyDown = (event) => {
|
|
1907
|
-
if (!
|
|
1918
|
+
if (!keyboardInputEnabled) return;
|
|
1908
1919
|
flushPendingWheel();
|
|
1909
1920
|
const command = event.metaKey || event.ctrlKey;
|
|
1910
1921
|
if (props.clipboardEnabled && command && !event.altKey && ["c", "v"].includes(event.key.toLowerCase())) {
|
|
@@ -1919,7 +1930,7 @@ function ComputerViewport(props) {
|
|
|
1919
1930
|
enqueue({ type: "keyboard", action: "press", value: key }, null);
|
|
1920
1931
|
};
|
|
1921
1932
|
const copy = (event) => {
|
|
1922
|
-
if (!props.clipboardEnabled || !
|
|
1933
|
+
if (!props.clipboardEnabled || !keyboardInputEnabled) return;
|
|
1923
1934
|
event.preventDefault();
|
|
1924
1935
|
flushPendingWheel();
|
|
1925
1936
|
flushPendingText();
|
|
@@ -1935,7 +1946,7 @@ function ComputerViewport(props) {
|
|
|
1935
1946
|
});
|
|
1936
1947
|
};
|
|
1937
1948
|
const paste = (event) => {
|
|
1938
|
-
if (!props.clipboardEnabled || !
|
|
1949
|
+
if (!props.clipboardEnabled || !keyboardInputEnabled) return;
|
|
1939
1950
|
event.preventDefault();
|
|
1940
1951
|
flushPendingWheel();
|
|
1941
1952
|
flushPendingText();
|
|
@@ -1951,7 +1962,7 @@ function ComputerViewport(props) {
|
|
|
1951
1962
|
});
|
|
1952
1963
|
};
|
|
1953
1964
|
const input = (value) => {
|
|
1954
|
-
if (!value || !
|
|
1965
|
+
if (!value || !keyboardInputEnabled) return;
|
|
1955
1966
|
flushPendingWheel();
|
|
1956
1967
|
flushPendingClick();
|
|
1957
1968
|
const pending = pendingTextRef.current;
|
|
@@ -1976,7 +1987,7 @@ function ComputerViewport(props) {
|
|
|
1976
1987
|
className: cn(
|
|
1977
1988
|
"absolute inset-0 m-auto max-h-full max-w-full touch-none focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-og-accent",
|
|
1978
1989
|
!showCanvas && "invisible",
|
|
1979
|
-
!
|
|
1990
|
+
!pointerInputEnabled && "cursor-default"
|
|
1980
1991
|
),
|
|
1981
1992
|
onPointerDown: pointerDown,
|
|
1982
1993
|
onPointerUp: pointerUp,
|
|
@@ -2002,7 +2013,7 @@ function ComputerViewport(props) {
|
|
|
2002
2013
|
autoCapitalize: "off",
|
|
2003
2014
|
autoCorrect: "off",
|
|
2004
2015
|
spellCheck: false,
|
|
2005
|
-
disabled: !
|
|
2016
|
+
disabled: !keyboardInputEnabled
|
|
2006
2017
|
}
|
|
2007
2018
|
),
|
|
2008
2019
|
!showCanvas ? /* @__PURE__ */ jsx(
|
|
@@ -2020,9 +2031,9 @@ function ComputerViewport(props) {
|
|
|
2020
2031
|
/* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-3 animate-spin" }),
|
|
2021
2032
|
" Acting"
|
|
2022
2033
|
] }) : null,
|
|
2023
|
-
showCanvas && !rawInputEnabled ? /* @__PURE__ */ jsxs("div", { className: "absolute bottom-3 left-1/2 flex -translate-x-1/2 items-center gap-2 rounded-full border border-white/10 bg-black/70 py-1 pl-3 pr-1 text-[11px] text-white/80 backdrop-blur", children: [
|
|
2024
|
-
/* @__PURE__ */ jsx("span", { children: "Background view \xB7 use native controls" }),
|
|
2025
|
-
props.target ? /* @__PURE__ */ jsx(
|
|
2034
|
+
showCanvas && (!rawInputEnabled || !props.pointerInput || !props.keyboardInput) ? /* @__PURE__ */ jsxs("div", { className: "absolute bottom-3 left-1/2 flex -translate-x-1/2 items-center gap-2 rounded-full border border-white/10 bg-black/70 py-1 pl-3 pr-1 text-[11px] text-white/80 backdrop-blur", children: [
|
|
2035
|
+
/* @__PURE__ */ jsx("span", { children: !rawInputEnabled && (props.pointerInput || props.keyboardInput) ? "Background view \xB7 use native controls" : !props.pointerInput && !props.keyboardInput ? "View only \xB7 mouse and keyboard unavailable" : props.keyboardInput ? "Keyboard only \xB7 mouse unavailable" : "Mouse only \xB7 keyboard unavailable" }),
|
|
2036
|
+
!rawInputEnabled && props.target && (props.pointerInput || props.keyboardInput) ? /* @__PURE__ */ jsx(
|
|
2026
2037
|
"button",
|
|
2027
2038
|
{
|
|
2028
2039
|
type: "button",
|
|
@@ -2403,4 +2414,4 @@ export {
|
|
|
2403
2414
|
ComputerViewer,
|
|
2404
2415
|
computerKey
|
|
2405
2416
|
};
|
|
2406
|
-
//# sourceMappingURL=chunk-
|
|
2417
|
+
//# sourceMappingURL=chunk-B7WMS3CS.js.map
|