@celljs/ta-screen-share 4.22.0 → 4.23.0
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/package.json +3 -3
- package/web/index.js +190 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-screen-share",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.23.0",
|
|
4
4
|
"description": "A pi package for Ta: the desktops of other computers, seen and worked from a phone or another computer, over VNC through ta serve",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package"
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@celljs/ta-protocol": "4.
|
|
29
|
-
"@celljs/ta-web": "4.
|
|
28
|
+
"@celljs/ta-protocol": "4.23.0",
|
|
29
|
+
"@celljs/ta-web": "4.23.0",
|
|
30
30
|
"@types/react": "^19.3.0"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
package/web/index.js
CHANGED
|
@@ -40,6 +40,9 @@ var TaLanguageUtil;
|
|
|
40
40
|
// web-src/i18n.ts
|
|
41
41
|
var EN = {
|
|
42
42
|
hideBar: "Hide the bar",
|
|
43
|
+
full: "Full screen",
|
|
44
|
+
leaveFull: "Leave full screen",
|
|
45
|
+
turn: "Turn your phone for a bigger picture",
|
|
43
46
|
showBar: "Show the bar",
|
|
44
47
|
modifiers: "Keys",
|
|
45
48
|
title: "Remote desktop",
|
|
@@ -91,6 +94,9 @@ var EN = {
|
|
|
91
94
|
};
|
|
92
95
|
var ZH = {
|
|
93
96
|
hideBar: "收起工具栏",
|
|
97
|
+
full: "全屏",
|
|
98
|
+
leaveFull: "退出全屏",
|
|
99
|
+
turn: "横过手机,画面更大",
|
|
94
100
|
showBar: "显示工具栏",
|
|
95
101
|
modifiers: "按键",
|
|
96
102
|
title: "远程桌面",
|
|
@@ -142,6 +148,9 @@ var ZH = {
|
|
|
142
148
|
};
|
|
143
149
|
var ZH_TW = {
|
|
144
150
|
hideBar: "收起工具列",
|
|
151
|
+
full: "全螢幕",
|
|
152
|
+
leaveFull: "結束全螢幕",
|
|
153
|
+
turn: "橫過手機,畫面更大",
|
|
145
154
|
showBar: "顯示工具列",
|
|
146
155
|
modifiers: "按鍵",
|
|
147
156
|
title: "遠端桌面",
|
|
@@ -193,6 +202,9 @@ var ZH_TW = {
|
|
|
193
202
|
};
|
|
194
203
|
var JA = {
|
|
195
204
|
hideBar: "ツールバーを隠す",
|
|
205
|
+
full: "全画面",
|
|
206
|
+
leaveFull: "全画面を終了",
|
|
207
|
+
turn: "スマホを横にすると大きく見えます",
|
|
196
208
|
showBar: "ツールバーを表示",
|
|
197
209
|
modifiers: "キー",
|
|
198
210
|
title: "リモートデスクトップ",
|
|
@@ -369,6 +381,11 @@ var DRAG_AFTER_TAP_MS = 250;
|
|
|
369
381
|
var PINCH_RATIO = 0.08;
|
|
370
382
|
var PINCH_DECIDE_MS = 80;
|
|
371
383
|
var NOTCH = 24;
|
|
384
|
+
var GLIDE_FRICTION = 0.94;
|
|
385
|
+
var GLIDE_MIN = 0.3;
|
|
386
|
+
var GLIDE_STOP = 0.04;
|
|
387
|
+
var FRAME_MS = 16;
|
|
388
|
+
var GLIDE_RESTED_MS = 80;
|
|
372
389
|
|
|
373
390
|
class DesktopGestures {
|
|
374
391
|
mode;
|
|
@@ -378,7 +395,9 @@ class DesktopGestures {
|
|
|
378
395
|
state = { kind: "idle" };
|
|
379
396
|
lastTap;
|
|
380
397
|
holdTimer;
|
|
381
|
-
|
|
398
|
+
glideTimer;
|
|
399
|
+
glideId = 0;
|
|
400
|
+
constructor(mode, emit, now = () => Date.now(), later = (run, ms) => setTimeout(run, ms)) {
|
|
382
401
|
this.mode = mode;
|
|
383
402
|
this.emit = emit;
|
|
384
403
|
this.now = now;
|
|
@@ -386,6 +405,7 @@ class DesktopGestures {
|
|
|
386
405
|
}
|
|
387
406
|
down(touches) {
|
|
388
407
|
const at = this.now();
|
|
408
|
+
this.stopGlide();
|
|
389
409
|
if (touches.length === 1 && this.state.kind === "idle") {
|
|
390
410
|
const start = touches[0];
|
|
391
411
|
const afterTap = this.lastTap && at - this.lastTap.at < DRAG_AFTER_TAP_MS && Math.hypot(start.x - this.lastTap.x, start.y - this.lastTap.y) < TAP_SLOP * 3;
|
|
@@ -408,7 +428,7 @@ class DesktopGestures {
|
|
|
408
428
|
this.emit({ kind: "release" });
|
|
409
429
|
}
|
|
410
430
|
const pair = [touches[0], touches[1]];
|
|
411
|
-
this.state = { kind: "two", start: pair, last: pair, at, moved: false, rest: 0 };
|
|
431
|
+
this.state = { kind: "two", start: pair, last: pair, at, moved: false, rest: 0, speed: 0, movedAt: at };
|
|
412
432
|
}
|
|
413
433
|
}
|
|
414
434
|
move(touches) {
|
|
@@ -462,6 +482,10 @@ class DesktopGestures {
|
|
|
462
482
|
this.emit({ kind: "zoom", factor: is / Math.max(1, was), x: after.x, y: after.y });
|
|
463
483
|
this.emit({ kind: "pan", dx: after.x - before.x, dy: after.y - before.y });
|
|
464
484
|
} else if (state.mode === "scroll") {
|
|
485
|
+
const now = this.now();
|
|
486
|
+
const speed = (before.y - after.y) / Math.max(1, now - state.movedAt);
|
|
487
|
+
state.speed = state.speed ? state.speed * 0.5 + speed * 0.5 : speed;
|
|
488
|
+
state.movedAt = now;
|
|
465
489
|
state.rest += before.y - after.y;
|
|
466
490
|
const notches = Math.trunc(state.rest / NOTCH);
|
|
467
491
|
if (notches) {
|
|
@@ -481,7 +505,8 @@ class DesktopGestures {
|
|
|
481
505
|
this.emit({ kind: "release" });
|
|
482
506
|
} else if (!state.moved && !state.held) {
|
|
483
507
|
const double = state.afterTap || !!this.lastTap && at - this.lastTap.at < DOUBLE_MS;
|
|
484
|
-
const
|
|
508
|
+
const first = double && this.lastTap ? this.lastTap : state.start;
|
|
509
|
+
const where = this.mode() === "direct" ? { x: first.x, y: first.y } : {};
|
|
485
510
|
this.emit({ kind: "click", button: "left", ...where, ...double ? { double: true } : {} });
|
|
486
511
|
this.lastTap = double ? undefined : { at, x: state.start.x, y: state.start.y };
|
|
487
512
|
}
|
|
@@ -491,12 +516,15 @@ class DesktopGestures {
|
|
|
491
516
|
if (state.kind === "two" && remaining.length === 0) {
|
|
492
517
|
if (!state.moved && at - state.at < HOLD_MS) {
|
|
493
518
|
this.emit({ kind: "click", button: "right" });
|
|
519
|
+
} else if (state.mode === "scroll" && at - state.movedAt < GLIDE_RESTED_MS && Math.abs(state.speed) > GLIDE_MIN) {
|
|
520
|
+
this.glide(state.speed, state.rest);
|
|
494
521
|
}
|
|
495
522
|
this.state = { kind: "idle" };
|
|
496
523
|
}
|
|
497
524
|
}
|
|
498
525
|
cancel() {
|
|
499
526
|
this.cancelHold();
|
|
527
|
+
this.stopGlide();
|
|
500
528
|
if (this.state.kind === "one" && this.state.dragging) {
|
|
501
529
|
this.emit({ kind: "release" });
|
|
502
530
|
}
|
|
@@ -519,6 +547,30 @@ class DesktopGestures {
|
|
|
519
547
|
this.emit({ kind: "click", button: "right" });
|
|
520
548
|
}
|
|
521
549
|
}
|
|
550
|
+
glide(speed, rest) {
|
|
551
|
+
const id = ++this.glideId;
|
|
552
|
+
const step = () => {
|
|
553
|
+
if (id !== this.glideId) {
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
rest += speed * FRAME_MS;
|
|
557
|
+
const notches = Math.trunc(rest / NOTCH);
|
|
558
|
+
if (notches) {
|
|
559
|
+
rest -= notches * NOTCH;
|
|
560
|
+
this.emit({ kind: "scroll", dx: 0, dy: notches });
|
|
561
|
+
}
|
|
562
|
+
speed *= GLIDE_FRICTION;
|
|
563
|
+
this.glideTimer = Math.abs(speed) > GLIDE_STOP ? this.later(step, FRAME_MS) : undefined;
|
|
564
|
+
};
|
|
565
|
+
this.glideTimer = this.later(step, FRAME_MS);
|
|
566
|
+
}
|
|
567
|
+
stopGlide() {
|
|
568
|
+
this.glideId++;
|
|
569
|
+
if (this.glideTimer !== undefined) {
|
|
570
|
+
clearTimeout(this.glideTimer);
|
|
571
|
+
this.glideTimer = undefined;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
522
574
|
cancelHold() {
|
|
523
575
|
if (this.holdTimer !== undefined) {
|
|
524
576
|
clearTimeout(this.holdTimer);
|
|
@@ -755,7 +807,7 @@ function DesktopKeyBar({ pi, send, onClose }) {
|
|
|
755
807
|
var RETRY_MS = [300, 1000, 3000];
|
|
756
808
|
var BATCH_MS = 16;
|
|
757
809
|
var MAX_WINDOW = 4;
|
|
758
|
-
var TARGET_FPS =
|
|
810
|
+
var TARGET_FPS = 30;
|
|
759
811
|
var SAMPLES = 8;
|
|
760
812
|
|
|
761
813
|
class DesktopLink {
|
|
@@ -822,7 +874,14 @@ class DesktopLink {
|
|
|
822
874
|
}
|
|
823
875
|
}
|
|
824
876
|
input(events) {
|
|
825
|
-
|
|
877
|
+
for (const event of events) {
|
|
878
|
+
const last = this.queue.at(-1);
|
|
879
|
+
if (event.kind === "pointer" && last?.kind === "pointer" && last.buttons === event.buttons) {
|
|
880
|
+
this.queue[this.queue.length - 1] = event;
|
|
881
|
+
} else {
|
|
882
|
+
this.queue.push(event);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
826
885
|
this.flushTimer ??= setTimeout(() => this.flush(), BATCH_MS);
|
|
827
886
|
}
|
|
828
887
|
async take() {
|
|
@@ -1106,6 +1165,7 @@ function pageId() {
|
|
|
1106
1165
|
return id;
|
|
1107
1166
|
}
|
|
1108
1167
|
var BUTTON = { left: 1, right: 4 };
|
|
1168
|
+
var BAR_MS = 3500;
|
|
1109
1169
|
function DesktopViewer({ pi, desktop, prompt, onBack }) {
|
|
1110
1170
|
const words = DesktopWordsUtil.of(pi.ui.language);
|
|
1111
1171
|
const { touch, handheld } = pi.ui.useDevice();
|
|
@@ -1122,6 +1182,11 @@ function DesktopViewer({ pi, desktop, prompt, onBack }) {
|
|
|
1122
1182
|
const [quality, setQuality] = React.useState("auto");
|
|
1123
1183
|
const [keyboard, setKeyboard] = React.useState(false);
|
|
1124
1184
|
const [bar, setBar] = React.useState(true);
|
|
1185
|
+
const Full = pi.ui.FullScreen;
|
|
1186
|
+
const [full, setFull] = React.useState(!!Full && handheld);
|
|
1187
|
+
const [barAt, setBarAt] = React.useState(0);
|
|
1188
|
+
const [turnHint, setTurnHint] = React.useState(false);
|
|
1189
|
+
const icons = pi.ui.icons;
|
|
1125
1190
|
const [opening, setOpening] = React.useState(0);
|
|
1126
1191
|
const live = React.useRef({
|
|
1127
1192
|
viewport: { x: 0, y: 0, scale: 1 },
|
|
@@ -1210,6 +1275,9 @@ function DesktopViewer({ pi, desktop, prompt, onBack }) {
|
|
|
1210
1275
|
const rect = box.getBoundingClientRect();
|
|
1211
1276
|
const dpr = window.devicePixelRatio || 1;
|
|
1212
1277
|
live.current.box = { width: Math.max(1, rect.width), height: Math.max(1, rect.height) };
|
|
1278
|
+
if (rect.width > rect.height) {
|
|
1279
|
+
setTurnHint(false);
|
|
1280
|
+
}
|
|
1213
1281
|
const canvas = canvasRef.current;
|
|
1214
1282
|
if (canvas) {
|
|
1215
1283
|
canvas.width = Math.round(rect.width * dpr);
|
|
@@ -1227,7 +1295,51 @@ function DesktopViewer({ pi, desktop, prompt, onBack }) {
|
|
|
1227
1295
|
observer.disconnect();
|
|
1228
1296
|
clearTimeout(timer);
|
|
1229
1297
|
};
|
|
1230
|
-
}, [link, wanted]);
|
|
1298
|
+
}, [link, wanted, full]);
|
|
1299
|
+
React.useEffect(() => {
|
|
1300
|
+
if (!full) {
|
|
1301
|
+
return;
|
|
1302
|
+
}
|
|
1303
|
+
const root = document.documentElement;
|
|
1304
|
+
if (document.fullscreenEnabled && !document.fullscreenElement) {
|
|
1305
|
+
root.requestFullscreen?.({ navigationUI: "hide" }).catch(() => {
|
|
1306
|
+
return;
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
const changed = () => {
|
|
1310
|
+
if (!document.fullscreenElement && !handheld) {
|
|
1311
|
+
setFull(false);
|
|
1312
|
+
}
|
|
1313
|
+
};
|
|
1314
|
+
document.addEventListener("fullscreenchange", changed);
|
|
1315
|
+
return () => {
|
|
1316
|
+
document.removeEventListener("fullscreenchange", changed);
|
|
1317
|
+
if (document.fullscreenElement) {
|
|
1318
|
+
document.exitFullscreen().catch(() => {
|
|
1319
|
+
return;
|
|
1320
|
+
});
|
|
1321
|
+
}
|
|
1322
|
+
};
|
|
1323
|
+
}, [full, handheld]);
|
|
1324
|
+
const wide = shown.width > shown.height;
|
|
1325
|
+
React.useEffect(() => {
|
|
1326
|
+
const { box } = live.current;
|
|
1327
|
+
if (!full || !handheld || !wide || box.width >= box.height) {
|
|
1328
|
+
return;
|
|
1329
|
+
}
|
|
1330
|
+
setTurnHint(true);
|
|
1331
|
+
const timer = setTimeout(() => setTurnHint(false), 3500);
|
|
1332
|
+
return () => clearTimeout(timer);
|
|
1333
|
+
}, [full, handheld, wide]);
|
|
1334
|
+
const seen = shown.state === "live" && !prompt;
|
|
1335
|
+
const barShown = bar || !seen;
|
|
1336
|
+
React.useEffect(() => {
|
|
1337
|
+
if (!full || !bar || !seen) {
|
|
1338
|
+
return;
|
|
1339
|
+
}
|
|
1340
|
+
const timer = setTimeout(() => setBar(false), BAR_MS);
|
|
1341
|
+
return () => clearTimeout(timer);
|
|
1342
|
+
}, [full, bar, barAt, seen]);
|
|
1231
1343
|
const send = React.useCallback((events) => link?.input(events), [link]);
|
|
1232
1344
|
const viewTimer = React.useRef(undefined);
|
|
1233
1345
|
const moveView = (viewport) => {
|
|
@@ -1327,8 +1439,8 @@ function DesktopViewer({ pi, desktop, prompt, onBack }) {
|
|
|
1327
1439
|
const mine = !!shown.control?.self;
|
|
1328
1440
|
const watching = !!shown.control && !mine;
|
|
1329
1441
|
const status = prompt ? undefined : shown.state === "connecting" ? words.connecting : shown.state === "lost" ? DesktopWordsUtil.format(words.failed, { reason: shown.error ?? words.lost }) : undefined;
|
|
1330
|
-
|
|
1331
|
-
className: `trd-viewer${
|
|
1442
|
+
const viewer = /* @__PURE__ */ React.createElement("div", {
|
|
1443
|
+
className: `trd-viewer${full ? " trd-full" : ""}${barShown ? "" : " trd-bare"}`
|
|
1332
1444
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
1333
1445
|
ref: boxRef,
|
|
1334
1446
|
className: "trd-screen",
|
|
@@ -1337,6 +1449,9 @@ function DesktopViewer({ pi, desktop, prompt, onBack }) {
|
|
|
1337
1449
|
"aria-label": desktop.name,
|
|
1338
1450
|
tabIndex: 0,
|
|
1339
1451
|
onTouchStart: (event) => {
|
|
1452
|
+
if (full && bar && seen) {
|
|
1453
|
+
setBar(false);
|
|
1454
|
+
}
|
|
1340
1455
|
if (mine) {
|
|
1341
1456
|
gestures.down(points(event));
|
|
1342
1457
|
}
|
|
@@ -1344,7 +1459,18 @@ function DesktopViewer({ pi, desktop, prompt, onBack }) {
|
|
|
1344
1459
|
onTouchMove: (event) => mine && gestures.move(points(event)),
|
|
1345
1460
|
onTouchEnd: (event) => mine && gestures.up(points(event)),
|
|
1346
1461
|
onTouchCancel: () => gestures.cancel(),
|
|
1347
|
-
onPointerMove: (event) =>
|
|
1462
|
+
onPointerMove: (event) => {
|
|
1463
|
+
if (event.pointerType !== "mouse") {
|
|
1464
|
+
return;
|
|
1465
|
+
}
|
|
1466
|
+
if (full && !barShown && event.clientY - event.currentTarget.getBoundingClientRect().top < 4) {
|
|
1467
|
+
setBar(true);
|
|
1468
|
+
setBarAt(Date.now());
|
|
1469
|
+
}
|
|
1470
|
+
if (mine) {
|
|
1471
|
+
mouse(event, event.buttons);
|
|
1472
|
+
}
|
|
1473
|
+
},
|
|
1348
1474
|
onPointerDown: (event) => {
|
|
1349
1475
|
if (event.pointerType === "mouse" && mine) {
|
|
1350
1476
|
event.currentTarget.focus();
|
|
@@ -1378,7 +1504,14 @@ function DesktopViewer({ pi, desktop, prompt, onBack }) {
|
|
|
1378
1504
|
type: "button",
|
|
1379
1505
|
className: "ta-button",
|
|
1380
1506
|
onClick: () => setOpening((n) => n + 1)
|
|
1381
|
-
}, words.retry)), !status && watching && /* @__PURE__ */ React.createElement("div", {
|
|
1507
|
+
}, words.retry)), !status && !watching && turnHint && /* @__PURE__ */ React.createElement("div", {
|
|
1508
|
+
className: "trd-hint",
|
|
1509
|
+
role: "status"
|
|
1510
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1511
|
+
className: "trd-hint-turn"
|
|
1512
|
+
}, /* @__PURE__ */ React.createElement(icons.Smartphone, {
|
|
1513
|
+
size: 16
|
|
1514
|
+
})), /* @__PURE__ */ React.createElement("span", null, words.turn)), !status && watching && /* @__PURE__ */ React.createElement("div", {
|
|
1382
1515
|
className: "trd-watching"
|
|
1383
1516
|
}, /* @__PURE__ */ React.createElement("span", null, shown.control?.name ? DesktopWordsUtil.format(words.watching, { name: shown.control.name }) : words.watchingYou), /* @__PURE__ */ React.createElement("button", {
|
|
1384
1517
|
type: "button",
|
|
@@ -1386,7 +1519,8 @@ function DesktopViewer({ pi, desktop, prompt, onBack }) {
|
|
|
1386
1519
|
onClick: () => void link?.take().catch((error) => pi.ui.notify(error.message, "error"))
|
|
1387
1520
|
}, words.take))), /* @__PURE__ */ React.createElement("div", {
|
|
1388
1521
|
className: "trd-bar",
|
|
1389
|
-
role: "toolbar"
|
|
1522
|
+
role: "toolbar",
|
|
1523
|
+
onPointerDown: () => setBarAt(Date.now())
|
|
1390
1524
|
}, /* @__PURE__ */ React.createElement("button", {
|
|
1391
1525
|
type: "button",
|
|
1392
1526
|
className: "trd-tool",
|
|
@@ -1436,26 +1570,44 @@ function DesktopViewer({ pi, desktop, prompt, onBack }) {
|
|
|
1436
1570
|
title: words.fit,
|
|
1437
1571
|
"aria-label": words.fit,
|
|
1438
1572
|
onClick: () => moveView(DesktopViewportUtil.fit(live.current.desktop, live.current.box))
|
|
1439
|
-
}, /* @__PURE__ */ React.createElement(
|
|
1440
|
-
size: 18
|
|
1441
|
-
})), /* @__PURE__ */ React.createElement("button", {
|
|
1573
|
+
}, React.createElement(icons.Scan ?? icons.Maximize, { size: 18 })), /* @__PURE__ */ React.createElement("button", {
|
|
1442
1574
|
type: "button",
|
|
1443
1575
|
className: "trd-tool trd-quality",
|
|
1444
1576
|
title: words.quality,
|
|
1445
1577
|
onClick: () => setQuality(quality === "auto" ? "crisp" : quality === "crisp" ? "smooth" : "auto")
|
|
1446
|
-
}, words[quality]),
|
|
1578
|
+
}, words[quality]), Full && /* @__PURE__ */ React.createElement("button", {
|
|
1579
|
+
type: "button",
|
|
1580
|
+
className: "trd-tool",
|
|
1581
|
+
title: full ? words.leaveFull : words.full,
|
|
1582
|
+
"aria-label": full ? words.leaveFull : words.full,
|
|
1583
|
+
onClick: () => {
|
|
1584
|
+
setFull(!full);
|
|
1585
|
+
setBar(true);
|
|
1586
|
+
}
|
|
1587
|
+
}, React.createElement((full ? icons.Minimize2 : icons.Maximize2) ?? icons.Maximize, { size: 18 })), touch && !full && /* @__PURE__ */ React.createElement("button", {
|
|
1447
1588
|
type: "button",
|
|
1448
1589
|
className: "trd-tool",
|
|
1449
1590
|
"aria-label": words.hideBar,
|
|
1450
1591
|
onClick: () => setBar(false)
|
|
1451
1592
|
}, /* @__PURE__ */ React.createElement(pi.ui.icons.ChevronDown, {
|
|
1452
1593
|
size: 18
|
|
1453
|
-
}))), !
|
|
1594
|
+
}))), !barShown && /* @__PURE__ */ React.createElement("button", {
|
|
1454
1595
|
type: "button",
|
|
1455
|
-
className: "trd-show-bar",
|
|
1596
|
+
className: full ? "trd-handle" : "trd-show-bar",
|
|
1456
1597
|
"aria-label": words.showBar,
|
|
1457
|
-
|
|
1458
|
-
|
|
1598
|
+
onPointerEnter: (event) => {
|
|
1599
|
+
if (event.pointerType === "mouse") {
|
|
1600
|
+
setBar(true);
|
|
1601
|
+
setBarAt(Date.now());
|
|
1602
|
+
}
|
|
1603
|
+
},
|
|
1604
|
+
onClick: () => {
|
|
1605
|
+
setBar(true);
|
|
1606
|
+
setBarAt(Date.now());
|
|
1607
|
+
}
|
|
1608
|
+
}, full ? /* @__PURE__ */ React.createElement(pi.ui.icons.ChevronDown, {
|
|
1609
|
+
size: 16
|
|
1610
|
+
}) : /* @__PURE__ */ React.createElement(pi.ui.icons.ChevronUp, {
|
|
1459
1611
|
size: 16
|
|
1460
1612
|
})), keyboard && mine && /* @__PURE__ */ React.createElement(DesktopKeyBar, {
|
|
1461
1613
|
pi,
|
|
@@ -1469,6 +1621,9 @@ function DesktopViewer({ pi, desktop, prompt, onBack }) {
|
|
|
1469
1621
|
prompt,
|
|
1470
1622
|
onCancel: onBack
|
|
1471
1623
|
})));
|
|
1624
|
+
return full && Full ? /* @__PURE__ */ React.createElement(Full, {
|
|
1625
|
+
className: "trd-full-screen"
|
|
1626
|
+
}, viewer) : viewer;
|
|
1472
1627
|
}
|
|
1473
1628
|
|
|
1474
1629
|
// web-src/desktops-view.tsx
|
|
@@ -1648,6 +1803,22 @@ var STYLE = `
|
|
|
1648
1803
|
.trd-tool.trd-on { background: rgba(255, 255, 255, 0.14); color: #ffffff; }
|
|
1649
1804
|
.trd-quality { color: rgba(232, 234, 237, 0.7); }
|
|
1650
1805
|
.trd-show-bar { position: absolute; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: 36px; height: 28px; border: 0; border-radius: 14px; background: rgba(20, 22, 26, 0.7); color: #f2f3f5; display: inline-flex; align-items: center; justify-content: center; }
|
|
1806
|
+
/* Full screen (ui.FullScreen): the picture takes all of the screen, the bar floats over its top and goes while it is worked. */
|
|
1807
|
+
.trd-full-screen { background: #000; }
|
|
1808
|
+
.trd-full { flex: 1; background: #000; }
|
|
1809
|
+
.trd-full .trd-screen { margin: 0 env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px); }
|
|
1810
|
+
.trd-full .trd-bar { position: absolute; z-index: 2; top: 0; left: 0; right: 0; height: 44px; padding: env(safe-area-inset-top, 0px) calc(6px + env(safe-area-inset-right, 0px)) 0 calc(6px + env(safe-area-inset-left, 0px)); border-top: 0; background: linear-gradient(rgba(10, 12, 15, 0.82), rgba(10, 12, 15, 0.62)); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); animation: trd-bar-in 160ms ease-out; }
|
|
1811
|
+
.trd-full.trd-bare .trd-bar { display: none; }
|
|
1812
|
+
@keyframes trd-bar-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
|
|
1813
|
+
.trd-handle { position: absolute; z-index: 2; top: calc(6px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 26px; padding: 0; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 13px; background: rgba(16, 18, 22, 0.72); color: #f2f3f5; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); cursor: pointer; animation: trd-fade-in 160ms ease-out; }
|
|
1814
|
+
@keyframes trd-fade-in { from { opacity: 0; } to { opacity: 1; } }
|
|
1815
|
+
/* A finger's target bigger than the pill. */
|
|
1816
|
+
.trd-handle::before { content: ''; position: absolute; inset: -10px -16px; }
|
|
1817
|
+
.trd-hint { position: absolute; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: flex; align-items: center; gap: 8px; width: max-content; max-width: calc(100% - 32px); padding: 8px 14px; border-radius: 999px; background: rgba(20, 22, 26, 0.86); color: #f2f3f5; font-size: calc(13px * var(--ta-font-scale)); line-height: calc(18px * var(--ta-font-scale)); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); pointer-events: none; animation: trd-bar-in 160ms ease-out; }
|
|
1818
|
+
.trd-hint-turn { display: inline-flex; flex: none; animation: trd-turn 1.6s ease-in-out infinite; }
|
|
1819
|
+
@keyframes trd-turn { 0%, 30% { transform: none; } 60%, 100% { transform: rotate(-90deg); } }
|
|
1820
|
+
:root[data-reduce-motion] .trd-hint-turn { animation: none; }
|
|
1821
|
+
.trd-full .trd-keys { padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
|
|
1651
1822
|
.trd-keys { position: relative; display: flex; align-items: center; gap: 6px; padding: 6px 8px; overflow-x: auto; flex: none; background: #16181c; border-top: 1px solid rgba(255, 255, 255, 0.08); scrollbar-width: none; }
|
|
1652
1823
|
.trd-keys-field { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; resize: none; font-size: max(16px, calc(13px * var(--ta-font-scale))); }
|
|
1653
1824
|
.trd-key { flex: none; min-width: 40px; height: 34px; padding: 0 10px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, 0.1); color: #e8eaed; font: inherit; font-size: calc(13px * var(--ta-font-scale)); }
|