@q9labsai/chalk-react 5.2.4 → 5.2.6
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/{chunk-IZ44PX4W.js → chunk-26BQBCEI.js} +27 -11
- package/dist/{chunk-34SIWIY5.js → chunk-JK4JXOGC.js} +432 -364
- package/dist/components/control-bar/command-failure.d.ts +6 -6
- package/dist/components/control-bar/control-bar-behavior.d.ts +3 -0
- package/dist/components/control-bar/media-toggle.d.ts +2 -0
- package/dist/components/device-popover/DevicePopover.d.ts +2 -1
- package/dist/components/index.js +2 -2
- package/dist/index.js +2 -2
- package/dist/test-support/index.js +1 -1
- package/package.json +5 -5
|
@@ -455,7 +455,7 @@ import { ChalkTooltip } from "@q9labsai/chalk-whiteboard/react";
|
|
|
455
455
|
import { ChalkMenuPrimitive, ChalkPopoverPrimitive } from "@q9labsai/chalk-whiteboard/react";
|
|
456
456
|
|
|
457
457
|
// src/components/call-limbo/CallLimbo.tsx
|
|
458
|
-
import { useEffect as
|
|
458
|
+
import { useEffect as useEffect3, useRef as useRef3, useState as useState5 } from "react";
|
|
459
459
|
|
|
460
460
|
// src/theme.ts
|
|
461
461
|
var LIGHT_CHALK_THEME_TOKENS = {
|
|
@@ -539,20 +539,18 @@ function chalkThemeStyle(theme, colorScheme = theme?.colorScheme ?? "dark") {
|
|
|
539
539
|
}
|
|
540
540
|
|
|
541
541
|
// src/internal/useMediaQuery.ts
|
|
542
|
-
import {
|
|
542
|
+
import { useCallback as useCallback3, useMemo as useMemo2, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
543
|
+
var serverSnapshot = () => false;
|
|
543
544
|
function useMediaQuery(query) {
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
return () => mediaQuery.removeEventListener("change", handleChange);
|
|
554
|
-
}, [query]);
|
|
555
|
-
return matches;
|
|
545
|
+
const mediaQuery = useMemo2(() => typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia(query) : void 0, [query]);
|
|
546
|
+
const subscribe3 = useCallback3(
|
|
547
|
+
(notify) => {
|
|
548
|
+
mediaQuery?.addEventListener("change", notify);
|
|
549
|
+
return () => mediaQuery?.removeEventListener("change", notify);
|
|
550
|
+
},
|
|
551
|
+
[mediaQuery]
|
|
552
|
+
);
|
|
553
|
+
return useSyncExternalStore2(subscribe3, () => mediaQuery?.matches ?? false, serverSnapshot);
|
|
556
554
|
}
|
|
557
555
|
function useIsMobile() {
|
|
558
556
|
return useMediaQuery("(max-width: 767px)");
|
|
@@ -598,8 +596,8 @@ import { jsx as jsx20, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
|
598
596
|
function CallLimbo({ spaceName = "Call", message, detail, action, children, overlay = false, active = true, initiallyCovered = false, theme, recorded = false, blocking = true, className }) {
|
|
599
597
|
const layerRef = useRef3(null);
|
|
600
598
|
const reducedMotion = usePrefersReducedMotion();
|
|
601
|
-
const [covered, setCovered] =
|
|
602
|
-
|
|
599
|
+
const [covered, setCovered] = useState5(active || initiallyCovered);
|
|
600
|
+
useEffect3(() => {
|
|
603
601
|
let nextFrame = 0;
|
|
604
602
|
const frame = requestAnimationFrame(() => {
|
|
605
603
|
nextFrame = requestAnimationFrame(() => setCovered(active));
|
|
@@ -609,7 +607,7 @@ function CallLimbo({ spaceName = "Call", message, detail, action, children, over
|
|
|
609
607
|
cancelAnimationFrame(nextFrame);
|
|
610
608
|
};
|
|
611
609
|
}, [active]);
|
|
612
|
-
|
|
610
|
+
useEffect3(() => {
|
|
613
611
|
if (!overlay || !active || !layerRef.current) return;
|
|
614
612
|
const root = layerRef.current.closest("[data-chalk]");
|
|
615
613
|
if (!root) return;
|
|
@@ -685,6 +683,7 @@ function commandFailure(cause) {
|
|
|
685
683
|
});
|
|
686
684
|
}
|
|
687
685
|
var again = ({ recoverable }) => recoverable ? " Try again." : "";
|
|
686
|
+
var interrupted = ({ recoverable }) => `That change was interrupted.${recoverable ? " Try again." : " Rejoin the call."}`;
|
|
688
687
|
var device = ({ source }) => source ?? "device";
|
|
689
688
|
var settings = (context) => `Couldn\u2019t change ${context.source === "screen" ? "screen sharing" : `your ${device(context)} settings`}.`;
|
|
690
689
|
var stop = (context) => context.source === "screen" ? "Couldn\u2019t stop screen sharing." : settings(context);
|
|
@@ -714,11 +713,12 @@ var MEDIA_FAILURE_POLICY = {
|
|
|
714
713
|
"command.rejected": unavailable,
|
|
715
714
|
"connection.invalid_state": {
|
|
716
715
|
copy: {
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
716
|
+
start: interrupted,
|
|
717
|
+
stop: interrupted,
|
|
718
|
+
select: interrupted,
|
|
719
|
+
test: interrupted,
|
|
720
|
+
request: interrupted,
|
|
721
|
+
change: interrupted
|
|
722
722
|
},
|
|
723
723
|
retry: true
|
|
724
724
|
},
|
|
@@ -780,7 +780,7 @@ function commandFailureMessage(failure, source, operation) {
|
|
|
780
780
|
}
|
|
781
781
|
|
|
782
782
|
// src/components/media-request-dialog/media-request-dialog-state.ts
|
|
783
|
-
import { useEffect as
|
|
783
|
+
import { useEffect as useEffect4, useMemo as useMemo3, useState as useState6 } from "react";
|
|
784
784
|
function formatExpiryLabel(expiresAtMs, now) {
|
|
785
785
|
if (!Number.isFinite(expiresAtMs)) return null;
|
|
786
786
|
const remainingSeconds = Math.max(0, Math.ceil((expiresAtMs - now) / 1e3));
|
|
@@ -790,16 +790,18 @@ function formatExpiryLabel(expiresAtMs, now) {
|
|
|
790
790
|
return `Expires in ${minutes} min`;
|
|
791
791
|
}
|
|
792
792
|
function useMediaRequestDialogState({ request, onDecline, onAllow, onActionError }) {
|
|
793
|
-
const expiresAtMs =
|
|
794
|
-
const [now, setNow] =
|
|
795
|
-
const [pendingAction, setPendingAction] =
|
|
796
|
-
const [errorMessageState, setErrorMessage] =
|
|
797
|
-
|
|
793
|
+
const expiresAtMs = useMemo3(() => Date.parse(request.expiresAt), [request.expiresAt]);
|
|
794
|
+
const [now, setNow] = useState6(() => Date.now());
|
|
795
|
+
const [pendingAction, setPendingAction] = useState6(null);
|
|
796
|
+
const [errorMessageState, setErrorMessage] = useState6(null);
|
|
797
|
+
const [previousRequestId, setPreviousRequestId] = useState6(request.requestId);
|
|
798
|
+
if (previousRequestId !== request.requestId) {
|
|
799
|
+
setPreviousRequestId(request.requestId);
|
|
798
800
|
setNow(Date.now());
|
|
799
801
|
setPendingAction(null);
|
|
800
802
|
setErrorMessage(null);
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
+
}
|
|
804
|
+
useEffect4(() => {
|
|
803
805
|
if (!Number.isFinite(expiresAtMs) || expiresAtMs <= Date.now()) return;
|
|
804
806
|
const interval = window.setInterval(() => setNow(Date.now()), 1e3);
|
|
805
807
|
return () => window.clearInterval(interval);
|
|
@@ -853,7 +855,7 @@ function MediaRequestDialog({ request, onDecline, onAllow, onActionError }) {
|
|
|
853
855
|
"button",
|
|
854
856
|
{
|
|
855
857
|
type: "button",
|
|
856
|
-
className: "rounded-lg bg-[var(--chalk-app-control-primary)] px-3 py-2 text-sm font-medium text-
|
|
858
|
+
className: "rounded-lg bg-[var(--chalk-app-control-primary)] px-3 py-2 text-sm font-medium text-[var(--chalk-app-control-active-text)] hover:bg-[var(--chalk-app-control-primary-hover)] disabled:cursor-not-allowed disabled:opacity-55",
|
|
857
859
|
onClick: () => runAction("allow"),
|
|
858
860
|
disabled: isExpired || pendingAction !== null,
|
|
859
861
|
children: isExpired ? "Expired" : pendingAction === "allow" ? "Working\u2026" : "Allow"
|
|
@@ -866,11 +868,11 @@ function MediaRequestDialog({ request, onDecline, onAllow, onActionError }) {
|
|
|
866
868
|
}
|
|
867
869
|
|
|
868
870
|
// src/components/admission-panel/AdmissionPanel.tsx
|
|
869
|
-
import React8, { useEffect as
|
|
871
|
+
import React8, { useEffect as useEffect8, useState as useState12 } from "react";
|
|
870
872
|
import { IconButton, Spinner } from "@q9labsai/chalk-ui";
|
|
871
873
|
|
|
872
874
|
// src/components/audio-output/AudioOutput.tsx
|
|
873
|
-
import { useCallback as
|
|
875
|
+
import { useCallback as useCallback4, useEffect as useEffect5, useMemo as useMemo5, useRef as useRef4, useState as useState8 } from "react";
|
|
874
876
|
|
|
875
877
|
// src/selectors/space-selectors.ts
|
|
876
878
|
function toVideoParticipants(participants, remoteMedia, localId, displayName, localMedia) {
|
|
@@ -931,12 +933,12 @@ function toAudioParticipants(remoteMedia) {
|
|
|
931
933
|
}
|
|
932
934
|
|
|
933
935
|
// src/components/participants-panel/participant-volume-context.tsx
|
|
934
|
-
import { createContext as createContext2, useContext as useContext2, useMemo as
|
|
936
|
+
import { createContext as createContext2, useContext as useContext2, useMemo as useMemo4, useState as useState7 } from "react";
|
|
935
937
|
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
936
938
|
var ParticipantVolumeContext = createContext2(null);
|
|
937
939
|
function ParticipantVolumeProvider({ children }) {
|
|
938
|
-
const [volumes, setVolumes] =
|
|
939
|
-
const value =
|
|
940
|
+
const [volumes, setVolumes] = useState7(/* @__PURE__ */ new Map());
|
|
941
|
+
const value = useMemo4(
|
|
940
942
|
() => ({
|
|
941
943
|
volumes,
|
|
942
944
|
setVolume: (participantId, volume) => {
|
|
@@ -962,8 +964,8 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
|
|
|
962
964
|
const media = useMedia();
|
|
963
965
|
const participantState = useParticipants();
|
|
964
966
|
const volumeContext = useParticipantVolumeContext();
|
|
965
|
-
const contextParticipants =
|
|
966
|
-
const effectiveParticipants =
|
|
967
|
+
const contextParticipants = useMemo5(() => toAudioParticipants(media.remote), [media.remote]);
|
|
968
|
+
const effectiveParticipants = useMemo5(() => {
|
|
967
969
|
const stateById = new Map(participantState.roster.map((participant) => [participant.participantId, participant.media]));
|
|
968
970
|
return (participants ?? contextParticipants).map((participant) => {
|
|
969
971
|
const state = stateById.get(participant.id);
|
|
@@ -979,7 +981,7 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
|
|
|
979
981
|
const audioElementsRef = useRef4(/* @__PURE__ */ new Map());
|
|
980
982
|
const screenShareAudioRef = useRef4(/* @__PURE__ */ new Map());
|
|
981
983
|
const pendingAutoplayRetryRef = useRef4(/* @__PURE__ */ new Set());
|
|
982
|
-
const [needsAutoplayUnlock, setNeedsAutoplayUnlock] =
|
|
984
|
+
const [needsAutoplayUnlock, setNeedsAutoplayUnlock] = useState8(false);
|
|
983
985
|
const resumeAudioRef = useRef4(null);
|
|
984
986
|
const markAutoplayBlocked = (el) => {
|
|
985
987
|
pendingAutoplayRetryRef.current.add(el);
|
|
@@ -989,7 +991,7 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
|
|
|
989
991
|
pendingAutoplayRetryRef.current.delete(el);
|
|
990
992
|
if (pendingAutoplayRetryRef.current.size === 0) setNeedsAutoplayUnlock(false);
|
|
991
993
|
};
|
|
992
|
-
const applyAudioOutputDevice =
|
|
994
|
+
const applyAudioOutputDevice = useCallback4(
|
|
993
995
|
(audioEl) => {
|
|
994
996
|
if (!effectiveAudioOutputDeviceId) return;
|
|
995
997
|
const sinkAware = audioEl;
|
|
@@ -1000,7 +1002,7 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
|
|
|
1000
1002
|
},
|
|
1001
1003
|
[effectiveAudioOutputDeviceId]
|
|
1002
1004
|
);
|
|
1003
|
-
const remoteWithAudio =
|
|
1005
|
+
const remoteWithAudio = useMemo5(
|
|
1004
1006
|
() => effectiveParticipants.filter((p) => {
|
|
1005
1007
|
if (p.isLocal) return false;
|
|
1006
1008
|
if (!p.audioTrack) return false;
|
|
@@ -1012,7 +1014,7 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
|
|
|
1012
1014
|
}),
|
|
1013
1015
|
[effectiveParticipants]
|
|
1014
1016
|
);
|
|
1015
|
-
const remoteWithScreenShareAudio =
|
|
1017
|
+
const remoteWithScreenShareAudio = useMemo5(
|
|
1016
1018
|
() => effectiveParticipants.filter((p) => {
|
|
1017
1019
|
if (p.isLocal) return false;
|
|
1018
1020
|
if (!p.screenShareAudioTrack) return false;
|
|
@@ -1024,8 +1026,8 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
|
|
|
1024
1026
|
}),
|
|
1025
1027
|
[effectiveParticipants]
|
|
1026
1028
|
);
|
|
1027
|
-
const unlockEvents =
|
|
1028
|
-
|
|
1029
|
+
const unlockEvents = useMemo5(() => ["pointerdown", "touchend", "click", "keydown"], []);
|
|
1030
|
+
useEffect5(() => {
|
|
1029
1031
|
if (!needsAutoplayUnlock) return;
|
|
1030
1032
|
if (typeof window === "undefined") return;
|
|
1031
1033
|
let inFlight = false;
|
|
@@ -1071,7 +1073,7 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
|
|
|
1071
1073
|
}
|
|
1072
1074
|
};
|
|
1073
1075
|
}, [needsAutoplayUnlock, unlockEvents]);
|
|
1074
|
-
|
|
1076
|
+
useEffect5(() => {
|
|
1075
1077
|
const audioElements = audioElementsRef.current;
|
|
1076
1078
|
for (const participant of remoteWithAudio) {
|
|
1077
1079
|
const { id, audioTrack } = participant;
|
|
@@ -1088,7 +1090,7 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
|
|
|
1088
1090
|
audioEl.volume = Math.max(0, Math.min(1, baseVolume * volume));
|
|
1089
1091
|
const currentStream = audioEl.srcObject;
|
|
1090
1092
|
const currentTrack = currentStream?.getAudioTracks()[0];
|
|
1091
|
-
if (currentTrack
|
|
1093
|
+
if (currentTrack !== audioTrack) {
|
|
1092
1094
|
const stream = new MediaStream([audioTrack]);
|
|
1093
1095
|
audioEl.srcObject = stream;
|
|
1094
1096
|
const attachedElement = audioEl;
|
|
@@ -1107,7 +1109,7 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
|
|
|
1107
1109
|
}
|
|
1108
1110
|
}
|
|
1109
1111
|
}, [remoteWithAudio, volume, effectiveAudioOutputDeviceId, effectiveGetParticipantVolume, applyAudioOutputDevice]);
|
|
1110
|
-
|
|
1112
|
+
useEffect5(() => {
|
|
1111
1113
|
const audioElements = audioElementsRef.current;
|
|
1112
1114
|
return () => {
|
|
1113
1115
|
for (const audioEl of audioElements.values()) {
|
|
@@ -1118,7 +1120,7 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
|
|
|
1118
1120
|
audioElements.clear();
|
|
1119
1121
|
};
|
|
1120
1122
|
}, []);
|
|
1121
|
-
|
|
1123
|
+
useEffect5(() => {
|
|
1122
1124
|
const handlers = /* @__PURE__ */ new Map();
|
|
1123
1125
|
for (const participant of remoteWithAudio) {
|
|
1124
1126
|
const { id, audioTrack } = participant;
|
|
@@ -1147,7 +1149,7 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
|
|
|
1147
1149
|
}
|
|
1148
1150
|
};
|
|
1149
1151
|
}, [remoteWithAudio]);
|
|
1150
|
-
|
|
1152
|
+
useEffect5(() => {
|
|
1151
1153
|
const audioElements = screenShareAudioRef.current;
|
|
1152
1154
|
for (const participant of remoteWithScreenShareAudio) {
|
|
1153
1155
|
const { id, screenShareAudioTrack } = participant;
|
|
@@ -1165,7 +1167,7 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
|
|
|
1165
1167
|
audioEl.volume = Math.max(0, Math.min(1, baseVolume * volume));
|
|
1166
1168
|
const currentStream = audioEl.srcObject;
|
|
1167
1169
|
const currentTrack = currentStream?.getAudioTracks()[0];
|
|
1168
|
-
if (currentTrack
|
|
1170
|
+
if (currentTrack !== screenShareAudioTrack) {
|
|
1169
1171
|
const stream = new MediaStream([screenShareAudioTrack]);
|
|
1170
1172
|
audioEl.srcObject = stream;
|
|
1171
1173
|
const attachedElement = audioEl;
|
|
@@ -1184,7 +1186,7 @@ function AudioOutput({ participants, volume = 1, audioOutputDeviceId, getPartici
|
|
|
1184
1186
|
}
|
|
1185
1187
|
}
|
|
1186
1188
|
}, [remoteWithScreenShareAudio, volume, effectiveAudioOutputDeviceId, effectiveGetParticipantVolume, applyAudioOutputDevice]);
|
|
1187
|
-
|
|
1189
|
+
useEffect5(() => {
|
|
1188
1190
|
const audioElements = screenShareAudioRef.current;
|
|
1189
1191
|
return () => {
|
|
1190
1192
|
for (const audioEl of audioElements.values()) {
|
|
@@ -1226,10 +1228,10 @@ function useHaptics({ enabled = true } = {}) {
|
|
|
1226
1228
|
|
|
1227
1229
|
// src/components/participant-tile/ParticipantTile.tsx
|
|
1228
1230
|
import { Facehash as Facehash2 } from "@q9labsai/facehash/react";
|
|
1229
|
-
import React5, { useMemo as
|
|
1231
|
+
import React5, { useMemo as useMemo7, useRef as useRef6 } from "react";
|
|
1230
1232
|
|
|
1231
1233
|
// src/internal/useMirrorSetting.ts
|
|
1232
|
-
import { useSyncExternalStore as
|
|
1234
|
+
import { useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
1233
1235
|
var KEY = "chalk_mirror";
|
|
1234
1236
|
var listeners = /* @__PURE__ */ new Set();
|
|
1235
1237
|
var fallback = true;
|
|
@@ -1252,7 +1254,7 @@ function subscribe(listener) {
|
|
|
1252
1254
|
};
|
|
1253
1255
|
}
|
|
1254
1256
|
function useMirrorSetting() {
|
|
1255
|
-
const mirrored =
|
|
1257
|
+
const mirrored = useSyncExternalStore3(subscribe, read, () => true);
|
|
1256
1258
|
return [mirrored, setMirrored];
|
|
1257
1259
|
}
|
|
1258
1260
|
function setMirrored(next) {
|
|
@@ -1316,7 +1318,7 @@ function StageIcon({ name, size = 16, ...props }) {
|
|
|
1316
1318
|
}
|
|
1317
1319
|
|
|
1318
1320
|
// src/components/atomic/Avatar.tsx
|
|
1319
|
-
import React3, {
|
|
1321
|
+
import React3, { useMemo as useMemo6, useState as useState9 } from "react";
|
|
1320
1322
|
import { Facehash } from "@q9labsai/facehash/react";
|
|
1321
1323
|
import { jsx as jsx25, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1322
1324
|
var GeneratedFacehash = Facehash;
|
|
@@ -1335,16 +1337,14 @@ var statusColorMap = {
|
|
|
1335
1337
|
offline: "var(--chalk-muted-text)"
|
|
1336
1338
|
};
|
|
1337
1339
|
var Avatar = React3.memo(({ name, src, size = "md", status, className, style, gradientPreference, generated = true, animated = true }) => {
|
|
1338
|
-
const [
|
|
1339
|
-
|
|
1340
|
+
const [image, setImage] = useState9({ src, name, generated, failed: false });
|
|
1341
|
+
if (image.src !== src || image.name !== name || image.generated !== generated) setImage({ src, name, generated, failed: false });
|
|
1342
|
+
const hasUploadedImage = Boolean(src) && !image.failed;
|
|
1340
1343
|
const shouldShowGeneratedAvatar = generated && Boolean(name) && !hasUploadedImage;
|
|
1341
|
-
|
|
1342
|
-
setImageError(false);
|
|
1343
|
-
}, [src, name, generated]);
|
|
1344
|
-
const avatarRecipe = useMemo5(() => getParticipantAvatarRecipe(name || "unknown", gradientPreference), [gradientPreference, name]);
|
|
1344
|
+
const avatarRecipe = useMemo6(() => getParticipantAvatarRecipe(name || "unknown", gradientPreference), [gradientPreference, name]);
|
|
1345
1345
|
const { size: pxSize, fontSize } = sizeMap[size];
|
|
1346
1346
|
return /* @__PURE__ */ jsxs10("div", { className: cn("relative inline-flex shrink-0 rounded-full", className), style: { width: pxSize, height: pxSize, ...style }, role: "img", "aria-label": `Avatar for ${name || "Unknown"}`, children: [
|
|
1347
|
-
hasUploadedImage ? /* @__PURE__ */ jsx25("img", { src: src || "", alt: name, className: "h-full w-full rounded-full object-cover", onError: () =>
|
|
1347
|
+
hasUploadedImage ? /* @__PURE__ */ jsx25("img", { src: src || "", alt: name, className: "h-full w-full rounded-full object-cover", onError: () => setImage({ src, name, generated, failed: true }) }) : shouldShowGeneratedAvatar ? /* @__PURE__ */ jsx25("div", { "aria-hidden": "true", className: "h-full w-full overflow-hidden rounded-full", children: /* @__PURE__ */ jsx25(GeneratedFacehash, { name: name || "guest", size: pxSize, variant: "flat", interactive: false, intensity3d: "subtle", enableBlink: animated, colors: [...avatarRecipe.facehashColors] }) }) : /* @__PURE__ */ jsx25("div", { className: "flex h-full w-full items-center justify-center rounded-full font-medium !text-[var(--chalk-accent-text)]", style: { fontSize, backgroundColor: avatarRecipe.color }, children: avatarRecipe.initials }),
|
|
1348
1348
|
status && /* @__PURE__ */ jsx25(
|
|
1349
1349
|
"span",
|
|
1350
1350
|
{
|
|
@@ -1391,7 +1391,7 @@ function TileShell({ label, accentColor, pinned = false, ring = false, speaking
|
|
|
1391
1391
|
tabIndex: hidden ? -1 : 0,
|
|
1392
1392
|
"aria-label": label,
|
|
1393
1393
|
"aria-pressed": pinned,
|
|
1394
|
-
className: "absolute inset-0 z-20 rounded-[inherit] outline-none motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-[ease-out] hover:bg-
|
|
1394
|
+
className: "absolute inset-0 z-20 rounded-[inherit] outline-none motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-[ease-out] hover:bg-[var(--chalk-on-overlay)]/[.045] active:bg-[var(--chalk-on-overlay)]/[.09] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--chalk-focus)]"
|
|
1395
1395
|
}
|
|
1396
1396
|
) : null,
|
|
1397
1397
|
/* @__PURE__ */ jsx26(
|
|
@@ -1400,23 +1400,23 @@ function TileShell({ label, accentColor, pinned = false, ring = false, speaking
|
|
|
1400
1400
|
"aria-hidden": "true",
|
|
1401
1401
|
"data-part": "speaking-ring",
|
|
1402
1402
|
className: "pointer-events-none absolute inset-0 z-30 rounded-[inherit] motion-safe:transition-opacity motion-safe:duration-[90ms] motion-safe:ease-linear",
|
|
1403
|
-
style: { opacity: speaking ? 0.3 + 0.7 * audioLevel : 0, boxShadow: "inset 0 0 0 3px
|
|
1403
|
+
style: { opacity: speaking ? 0.3 + 0.7 * audioLevel : 0, boxShadow: "inset 0 0 0 3px color-mix(in srgb, var(--chalk-on-overlay) 90%, transparent), inset 0 0 0 4px var(--chalk-scrim)" }
|
|
1404
1404
|
}
|
|
1405
1405
|
),
|
|
1406
1406
|
ring ? /* @__PURE__ */ jsx26("div", { "aria-hidden": "true", "data-part": "follow-ring", className: "pointer-events-none absolute inset-0 z-30 rounded-[inherit] shadow-[inset_0_0_0_2px_var(--chalk-text)]" }) : null,
|
|
1407
1407
|
corner,
|
|
1408
|
-
chip ? /* @__PURE__ */ jsx26("div", { "data-part": "tile-tag", className: "pointer-events-none absolute bottom-2 left-2 z-30 flex h-6 max-w-[calc(100%_-_16px)] items-center gap-[5px] rounded-[6px] bg-[
|
|
1408
|
+
chip ? /* @__PURE__ */ jsx26("div", { "data-part": "tile-tag", className: "pointer-events-none absolute bottom-2 left-2 z-30 flex h-6 max-w-[calc(100%_-_16px)] items-center gap-[5px] rounded-[6px] bg-[var(--chalk-overlay)] px-2 text-[12px] leading-[1.4] font-medium text-[var(--chalk-on-overlay)]", children: chip }) : null
|
|
1409
1409
|
]
|
|
1410
1410
|
}
|
|
1411
1411
|
);
|
|
1412
1412
|
}
|
|
1413
1413
|
|
|
1414
1414
|
// src/components/participant-tile/useVideoTrack.ts
|
|
1415
|
-
import { useEffect as
|
|
1415
|
+
import { useEffect as useEffect6, useRef as useRef5, useState as useState10 } from "react";
|
|
1416
1416
|
function useVideoTrack(videoRef, track, enabled) {
|
|
1417
|
-
const [status, setStatus] =
|
|
1417
|
+
const [status, setStatus] = useState10("idle");
|
|
1418
1418
|
const loadedRef = useRef5(false);
|
|
1419
|
-
|
|
1419
|
+
useEffect6(() => {
|
|
1420
1420
|
const video = videoRef.current;
|
|
1421
1421
|
loadedRef.current = false;
|
|
1422
1422
|
if (!video || !track || !enabled || track.readyState !== "live") {
|
|
@@ -1494,8 +1494,8 @@ var ParticipantTileSurface = React5.memo(function ParticipantTileSurface2({
|
|
|
1494
1494
|
const phone = useMediaQuery("(max-width:640px)");
|
|
1495
1495
|
const [localMirrored] = useMirrorSetting();
|
|
1496
1496
|
const mirrored = mirror ?? (participant.isLocal === true && localMirrored);
|
|
1497
|
-
const colors =
|
|
1498
|
-
const recipe =
|
|
1497
|
+
const colors = useMemo7(() => getParticipantColor(participant.displayName || participant.id, gradientPreference), [gradientPreference, participant.displayName, participant.id]);
|
|
1498
|
+
const recipe = useMemo7(() => getParticipantAvatarRecipe(participant.displayName || participant.id, gradientPreference), [participant.displayName, participant.id, gradientPreference]);
|
|
1499
1499
|
const actionLabel = `${pinned ? "Unpin" : "Pin"} ${participant.displayName}`;
|
|
1500
1500
|
const followLabel = following ? "Stop following" : "Follow";
|
|
1501
1501
|
const hasPoorConnection = participant.connectionQuality !== void 0 && participant.connectionQuality > 0 && participant.connectionQuality <= 2;
|
|
@@ -1516,11 +1516,19 @@ var ParticipantTileSurface = React5.memo(function ParticipantTileSurface2({
|
|
|
1516
1516
|
dataTour: participant.isLocal ? "local-video" : "video-grid",
|
|
1517
1517
|
hidden,
|
|
1518
1518
|
corner: /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
1519
|
-
showStatus && hasPoorConnection ? /* @__PURE__ */ jsx27("span", { role: "img", "data-part": "tile-signal", "aria-label": `${participant.displayName} has a weak connection`, className: "pointer-events-none absolute top-2 left-2 z-30 flex h-6 items-center rounded-[6px] bg-[
|
|
1519
|
+
showStatus && hasPoorConnection ? /* @__PURE__ */ jsx27("span", { role: "img", "data-part": "tile-signal", "aria-label": `${participant.displayName} has a weak connection`, className: "pointer-events-none absolute top-2 left-2 z-30 flex h-6 items-center rounded-[6px] bg-[var(--chalk-overlay)] px-[7px]", children: /* @__PURE__ */ jsx27(SignalBars, {}) }) : null,
|
|
1520
1520
|
onClick || onFollow ? /* @__PURE__ */ jsx27("span", { "data-part": "tile-menu", className: "absolute top-2 right-2 z-30 transition-opacity duration-150 min-[641px]:opacity-0 group-hover/tile:opacity-100 focus-within:opacity-100", children: /* @__PURE__ */ jsxs12(
|
|
1521
1521
|
ChalkMenu,
|
|
1522
1522
|
{
|
|
1523
|
-
trigger: /* @__PURE__ */ jsx27(
|
|
1523
|
+
trigger: /* @__PURE__ */ jsx27(
|
|
1524
|
+
"button",
|
|
1525
|
+
{
|
|
1526
|
+
type: "button",
|
|
1527
|
+
"aria-label": `More options for ${participant.displayName}`,
|
|
1528
|
+
className: "grid h-8 w-8 place-items-center rounded-full bg-[var(--chalk-overlay)] text-[var(--chalk-on-overlay)] outline-none hover:bg-[var(--chalk-overlay-hover)] focus-visible:ring-2 focus-visible:ring-[var(--chalk-focus)]",
|
|
1529
|
+
children: /* @__PURE__ */ jsx27(StageIcon, { name: "more", size: 18 })
|
|
1530
|
+
}
|
|
1531
|
+
),
|
|
1524
1532
|
children: [
|
|
1525
1533
|
onClick ? /* @__PURE__ */ jsx27(ChalkMenuItem, { onClick, children: actionLabel }) : null,
|
|
1526
1534
|
onFollow ? /* @__PURE__ */ jsx27(ChalkMenuItem, { onClick: onFollow, children: followLabel }) : null
|
|
@@ -1533,13 +1541,13 @@ var ParticipantTileSurface = React5.memo(function ParticipantTileSurface2({
|
|
|
1533
1541
|
showName && /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
1534
1542
|
/* @__PURE__ */ jsxs12("span", { dir: "auto", "data-part": "tile-full-name", className: "min-w-0 truncate [unicode-bidi:plaintext]", title: participant.displayName, children: [
|
|
1535
1543
|
participant.displayName,
|
|
1536
|
-
participant.isLocal && participant.displayName !== "You" && /* @__PURE__ */ jsx27("span", { className: "text-
|
|
1544
|
+
participant.isLocal && participant.displayName !== "You" && /* @__PURE__ */ jsx27("span", { className: "text-[var(--chalk-on-overlay)]", children: " (You)" })
|
|
1537
1545
|
] }),
|
|
1538
1546
|
/* @__PURE__ */ jsx27("span", { dir: "auto", "data-part": "tile-short-name", className: "hidden min-w-0 truncate [unicode-bidi:plaintext]", children: participant.isLocal ? "You" : participant.displayName.split(" ")[0] })
|
|
1539
1547
|
] }),
|
|
1540
1548
|
following ? /* @__PURE__ */ jsx27("span", { "data-part": "tile-following", className: "shrink-0 font-semibold opacity-80", children: "following" }) : null,
|
|
1541
|
-
showStatus && participant.isMuted && /* @__PURE__ */ jsx27(StageIcon, { name: "mute", size: 14, className: "shrink-0 text-[
|
|
1542
|
-
showStatus && participant.isHandRaised && /* @__PURE__ */ jsxs12("span", { className: "flex shrink-0 items-center text-[
|
|
1549
|
+
showStatus && participant.isMuted && /* @__PURE__ */ jsx27(StageIcon, { name: "mute", size: 14, className: "shrink-0 text-[var(--chalk-overlay-danger)]", "aria-label": "Muted" }),
|
|
1550
|
+
showStatus && participant.isHandRaised && /* @__PURE__ */ jsxs12("span", { className: "flex shrink-0 items-center text-[var(--chalk-overlay-warning)]", role: "img", "aria-label": `Hand raised${participant.handRaiseOrder ? `, number ${participant.handRaiseOrder}` : ""}`, children: [
|
|
1543
1551
|
/* @__PURE__ */ jsx27(StageIcon, { name: "hand", size: 14 }),
|
|
1544
1552
|
participant.handRaiseOrder ? /* @__PURE__ */ jsx27("b", { className: "ml-px text-[11px] font-bold", children: participant.handRaiseOrder }) : null
|
|
1545
1553
|
] })
|
|
@@ -1572,11 +1580,11 @@ var ParticipantTileSurface = React5.memo(function ParticipantTileSurface2({
|
|
|
1572
1580
|
ParticipantTile.displayName = "ParticipantTile";
|
|
1573
1581
|
ParticipantTileSurface.displayName = "ParticipantTileSurface";
|
|
1574
1582
|
function SignalBars() {
|
|
1575
|
-
return /* @__PURE__ */ jsx27("span", { "aria-hidden": "true", className: "inline-flex h-3 items-end gap-0.5", children: [6, 9, 12, 15].map((height, index) => /* @__PURE__ */ jsx27("i", { className: "block w-[3px] rounded-[1px]", style: { height, background: index === 0 ? "
|
|
1583
|
+
return /* @__PURE__ */ jsx27("span", { "aria-hidden": "true", className: "inline-flex h-3 items-end gap-0.5", children: [6, 9, 12, 15].map((height, index) => /* @__PURE__ */ jsx27("i", { className: "block w-[3px] rounded-[1px]", style: { height, background: index === 0 ? "var(--chalk-overlay-warning)" : "color-mix(in srgb, var(--chalk-on-overlay) 30%, transparent)" } }, height)) });
|
|
1576
1584
|
}
|
|
1577
1585
|
|
|
1578
1586
|
// src/components/atomic/ReactionBubble.tsx
|
|
1579
|
-
import React6, { useEffect as
|
|
1587
|
+
import React6, { useEffect as useEffect7, useState as useState11, useMemo as useMemo8 } from "react";
|
|
1580
1588
|
import { CELEBRATION_EMOJIS } from "@q9labsai/chalk-ui/reactions";
|
|
1581
1589
|
import { jsx as jsx28, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1582
1590
|
var BASE_PARTICLE_COLORS = ["#14b8a6", "#f59e0b", "#ec4899", "#8b5cf6", "#06b6d4", "#22c55e"];
|
|
@@ -1620,15 +1628,15 @@ function getParticleStyle(particle) {
|
|
|
1620
1628
|
};
|
|
1621
1629
|
}
|
|
1622
1630
|
var ReactionBubble = React6.memo(({ emoji, participantName, onComplete, duration: baseDuration = 3e3, animated = true, className }) => {
|
|
1623
|
-
const [isVisible, setIsVisible] =
|
|
1631
|
+
const [isVisible, setIsVisible] = useState11(true);
|
|
1624
1632
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
1625
|
-
const participantColors =
|
|
1633
|
+
const participantColors = useMemo8(() => getParticipantColor(participantName || "unknown"), [participantName]);
|
|
1626
1634
|
const isCelebration = CELEBRATION_EMOJIS.includes(emoji);
|
|
1627
|
-
const animProps =
|
|
1628
|
-
const particles =
|
|
1635
|
+
const animProps = useMemo8(() => animated ? generateAnimationProps() : null, [animated]);
|
|
1636
|
+
const particles = useMemo8(() => animated && isCelebration ? generateParticles(participantColors.primary) : [], [animated, isCelebration, participantColors.primary]);
|
|
1629
1637
|
const timeoutMs = baseDuration;
|
|
1630
1638
|
const floatDurationMs = prefersReducedMotion || !animProps ? baseDuration : animProps.duration;
|
|
1631
|
-
|
|
1639
|
+
useEffect7(() => {
|
|
1632
1640
|
if (!animated) return;
|
|
1633
1641
|
const timer = setTimeout(() => {
|
|
1634
1642
|
setIsVisible(false);
|
|
@@ -1708,13 +1716,13 @@ function getWaitingLabel(joinedAt) {
|
|
|
1708
1716
|
return `Waiting ${minutes} min`;
|
|
1709
1717
|
}
|
|
1710
1718
|
var AdmissionPanelSurface = React8.memo(({ participants, onAdmit, onDeny, onAdmitAll, onDenyAll, loading = false, className, onClose, inline = false }) => {
|
|
1711
|
-
const [, setTick] =
|
|
1712
|
-
|
|
1719
|
+
const [, setTick] = useState12(0);
|
|
1720
|
+
useEffect8(() => {
|
|
1713
1721
|
const timer = window.setInterval(() => setTick((t) => t + 1), 6e4);
|
|
1714
1722
|
return () => window.clearInterval(timer);
|
|
1715
1723
|
}, []);
|
|
1716
|
-
const [busy, setBusy] =
|
|
1717
|
-
const [error, setError] =
|
|
1724
|
+
const [busy, setBusy] = useState12(false);
|
|
1725
|
+
const [error, setError] = useState12(null);
|
|
1718
1726
|
const perform = async (action) => {
|
|
1719
1727
|
if (busy) return;
|
|
1720
1728
|
setBusy(true);
|
|
@@ -1787,7 +1795,7 @@ AdmissionPanel.displayName = "AdmissionPanel";
|
|
|
1787
1795
|
|
|
1788
1796
|
// src/components/composite/ChatPanel.tsx
|
|
1789
1797
|
import { CHALK_CHAT_ATTACHMENT_LIMITS, CHALK_CHAT_ATTACHMENT_MIME_TYPES } from "@q9labsai/chalk-client";
|
|
1790
|
-
import React10, { useEffect as
|
|
1798
|
+
import React10, { useEffect as useEffect11, useLayoutEffect, useMemo as useMemo9, useRef as useRef9, useState as useState15 } from "react";
|
|
1791
1799
|
import { Button } from "@q9labsai/chalk-ui";
|
|
1792
1800
|
|
|
1793
1801
|
// src/components/call-card/CallCardStyles.tsx
|
|
@@ -2193,7 +2201,7 @@ var styles = `.call-card-tabs {
|
|
|
2193
2201
|
font-weight: 700;
|
|
2194
2202
|
line-height: 1;
|
|
2195
2203
|
letter-spacing: 0.04em;
|
|
2196
|
-
color:
|
|
2204
|
+
color: var(--chalk-on-overlay);
|
|
2197
2205
|
}
|
|
2198
2206
|
.call-file-type.ti,
|
|
2199
2207
|
.call-file-type.tx {
|
|
@@ -2257,7 +2265,7 @@ var styles = `.call-card-tabs {
|
|
|
2257
2265
|
border-radius: 999px;
|
|
2258
2266
|
background: var(--chalk-popover);
|
|
2259
2267
|
border: 1px solid var(--chalk-line-strong);
|
|
2260
|
-
box-shadow:
|
|
2268
|
+
box-shadow: var(--chalk-shadow);
|
|
2261
2269
|
opacity: 0;
|
|
2262
2270
|
visibility: hidden;
|
|
2263
2271
|
transform: translateY(3px);
|
|
@@ -2365,8 +2373,8 @@ var styles = `.call-card-tabs {
|
|
|
2365
2373
|
width: 20px;
|
|
2366
2374
|
height: 20px;
|
|
2367
2375
|
border-radius: 50%;
|
|
2368
|
-
background:
|
|
2369
|
-
color:
|
|
2376
|
+
background: var(--chalk-warning);
|
|
2377
|
+
color: var(--chalk-accent-text);
|
|
2370
2378
|
font-size: 12px;
|
|
2371
2379
|
font-weight: 700;
|
|
2372
2380
|
}
|
|
@@ -2403,7 +2411,7 @@ var styles = `.call-card-tabs {
|
|
|
2403
2411
|
.call-attachments.image-1 .call-photo { border-radius: 14px; aspect-ratio: auto; }
|
|
2404
2412
|
.call-attachments.image-1 .call-photo img { height: auto; min-height: 150px; max-height: 320px; }
|
|
2405
2413
|
.call-attachments.image-3 .call-photo:nth-child(3) { grid-column: span 2; aspect-ratio: 2; }
|
|
2406
|
-
.call-photo-more { position: absolute; inset: 0; display: grid; place-items: center; background:
|
|
2414
|
+
.call-photo-more { position: absolute; inset: 0; display: grid; place-items: center; background: var(--chalk-scrim); color: var(--chalk-on-overlay); font-size: 20px; font-weight: 600; }
|
|
2407
2415
|
.call-file > span:not(.call-file-type) {
|
|
2408
2416
|
flex: 1;
|
|
2409
2417
|
min-width: 0;
|
|
@@ -2563,22 +2571,22 @@ var styles = `.call-card-tabs {
|
|
|
2563
2571
|
padding: 0;
|
|
2564
2572
|
border: 0;
|
|
2565
2573
|
margin: 0;
|
|
2566
|
-
background:
|
|
2567
|
-
color:
|
|
2574
|
+
background: var(--chalk-photo-viewer-overlay);
|
|
2575
|
+
color: var(--chalk-on-overlay);
|
|
2568
2576
|
}
|
|
2569
2577
|
.call-photo-viewer::backdrop { background: transparent; }
|
|
2570
2578
|
.call-photo-viewer { opacity: 0; visibility: hidden; transition: opacity .18s ease-out, visibility 0s .18s; }
|
|
2571
2579
|
.call-photo-viewer[open] { display: flex; flex-direction: column; opacity: 1; visibility: visible; transition: opacity .18s ease-out; }
|
|
2572
2580
|
.call-photo-viewer[open][data-closing] { opacity: 0; visibility: hidden; transition: opacity .18s ease-out, visibility 0s .18s; }
|
|
2573
2581
|
@starting-style { .call-photo-viewer[open] { opacity: 0; } }
|
|
2574
|
-
.call-photo-viewer :focus-visible { outline-color:
|
|
2582
|
+
.call-photo-viewer :focus-visible { outline-color: var(--chalk-on-overlay); }
|
|
2575
2583
|
.call-photo-viewer-bar { flex: none; display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 20px; }
|
|
2576
2584
|
.call-photo-viewer-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
|
|
2577
2585
|
.call-photo-viewer-name b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
2578
|
-
.call-photo-viewer-name small { font-size: 12px; color:
|
|
2579
|
-
.call-photo-viewer-control { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; color:
|
|
2586
|
+
.call-photo-viewer-name small { font-size: 12px; color: var(--chalk-on-overlay); }
|
|
2587
|
+
.call-photo-viewer-control { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; color: var(--chalk-on-overlay); background: color-mix(in srgb, var(--chalk-on-overlay) 8%, transparent); }
|
|
2580
2588
|
.call-photo-viewer-control svg { width: 20px; height: 20px; }
|
|
2581
|
-
.call-photo-viewer-control:hover { background:
|
|
2589
|
+
.call-photo-viewer-control:hover { background: color-mix(in srgb, var(--chalk-on-overlay) 16%, transparent); }
|
|
2582
2590
|
.call-photo-viewer-stage { position: relative; flex: 1; min-height: 0; }
|
|
2583
2591
|
.call-photo-viewer-stage img { position: absolute; inset: 0 76px 36px; margin: auto; max-width: calc(100% - 152px); max-height: calc(100% - 36px); border-radius: 8px; user-select: none; }
|
|
2584
2592
|
.call-photo-previous, .call-photo-next { position: absolute; top: 50%; width: 44px; height: 44px; margin-top: -40px; }
|
|
@@ -2650,14 +2658,14 @@ function CallCardStyles() {
|
|
|
2650
2658
|
|
|
2651
2659
|
// src/components/composite/MessageBubble.tsx
|
|
2652
2660
|
import { CHALK_REACTIONS } from "@q9labsai/chalk-client";
|
|
2653
|
-
import React9, { useEffect as
|
|
2661
|
+
import React9, { useEffect as useEffect10, useRef as useRef8, useState as useState14 } from "react";
|
|
2654
2662
|
|
|
2655
2663
|
// src/components/composite/use-chat-attachment-previews.ts
|
|
2656
|
-
import { useCallback as
|
|
2664
|
+
import { useCallback as useCallback5, useEffect as useEffect9, useRef as useRef7, useState as useState13 } from "react";
|
|
2657
2665
|
function useChatAttachmentPreviews(attachments, resolveUrl) {
|
|
2658
|
-
const [resolvedUrls, setResolvedUrls] =
|
|
2659
|
-
const [failedAttachmentIds, setFailedAttachmentIds] =
|
|
2660
|
-
const [retryGeneration, setRetryGeneration] =
|
|
2666
|
+
const [resolvedUrls, setResolvedUrls] = useState13(() => /* @__PURE__ */ new Map());
|
|
2667
|
+
const [failedAttachmentIds, setFailedAttachmentIds] = useState13(() => /* @__PURE__ */ new Set());
|
|
2668
|
+
const [retryGeneration, setRetryGeneration] = useState13(0);
|
|
2661
2669
|
const resolvingAttachmentIds = useRef7(/* @__PURE__ */ new Set());
|
|
2662
2670
|
const resolvedUrlsRef = useRef7(resolvedUrls);
|
|
2663
2671
|
const failedAttachmentIdsRef = useRef7(failedAttachmentIds);
|
|
@@ -2669,7 +2677,7 @@ function useChatAttachmentPreviews(attachments, resolveUrl) {
|
|
|
2669
2677
|
failedAttachmentIdsRef.current = failedAttachmentIds;
|
|
2670
2678
|
currentAttachmentIdsRef.current = currentAttachmentIds;
|
|
2671
2679
|
currentImageIdsRef.current = currentImageIds;
|
|
2672
|
-
const markFailed =
|
|
2680
|
+
const markFailed = useCallback5((attachmentId, operation) => {
|
|
2673
2681
|
console.warn("Chat attachment preview unavailable.", { attachmentId, operation });
|
|
2674
2682
|
setResolvedUrls((current) => {
|
|
2675
2683
|
const next = new Map(current);
|
|
@@ -2678,7 +2686,7 @@ function useChatAttachmentPreviews(attachments, resolveUrl) {
|
|
|
2678
2686
|
});
|
|
2679
2687
|
setFailedAttachmentIds((current) => new Set(current).add(attachmentId));
|
|
2680
2688
|
}, []);
|
|
2681
|
-
|
|
2689
|
+
useEffect9(() => {
|
|
2682
2690
|
if (!resolveUrl) return;
|
|
2683
2691
|
setResolvedUrls((current) => {
|
|
2684
2692
|
const next = new Map([...current].filter(([attachmentId]) => currentImageIdsRef.current.has(attachmentId)));
|
|
@@ -2701,7 +2709,7 @@ function useChatAttachmentPreviews(attachments, resolveUrl) {
|
|
|
2701
2709
|
).finally(() => resolvingAttachmentIds.current.delete(attachment.attachmentId));
|
|
2702
2710
|
}
|
|
2703
2711
|
}, [attachments, markFailed, resolveUrl, retryGeneration]);
|
|
2704
|
-
const retry =
|
|
2712
|
+
const retry = useCallback5((attachmentId) => {
|
|
2705
2713
|
setFailedAttachmentIds((current) => {
|
|
2706
2714
|
const next = new Set(current);
|
|
2707
2715
|
next.delete(attachmentId);
|
|
@@ -2740,17 +2748,17 @@ var MessageBubble = React9.memo(
|
|
|
2740
2748
|
className
|
|
2741
2749
|
}) => {
|
|
2742
2750
|
const { resolvedUrls, failedAttachmentIds, markFailed, retry } = useChatAttachmentPreviews(attachments, onResolveAttachmentUrl);
|
|
2743
|
-
const [reactionError, setReactionError] =
|
|
2744
|
-
const [reacting, setReacting] =
|
|
2745
|
-
const [reactionBarOpen, setReactionBarOpen] =
|
|
2751
|
+
const [reactionError, setReactionError] = useState14(null);
|
|
2752
|
+
const [reacting, setReacting] = useState14(false);
|
|
2753
|
+
const [reactionBarOpen, setReactionBarOpen] = useState14(false);
|
|
2746
2754
|
const messageRef = useRef8(null);
|
|
2747
2755
|
const press = useRef8(null);
|
|
2748
2756
|
const cancelPress = () => {
|
|
2749
2757
|
if (press.current) clearTimeout(press.current.timer);
|
|
2750
2758
|
press.current = null;
|
|
2751
2759
|
};
|
|
2752
|
-
|
|
2753
|
-
|
|
2760
|
+
useEffect10(() => () => cancelPress(), []);
|
|
2761
|
+
useEffect10(() => {
|
|
2754
2762
|
if (!reactionBarOpen) return;
|
|
2755
2763
|
messageRef.current?.querySelector(".call-reaction-bar button")?.focus({ preventScroll: true });
|
|
2756
2764
|
const dismiss = (event) => {
|
|
@@ -2759,11 +2767,11 @@ var MessageBubble = React9.memo(
|
|
|
2759
2767
|
document.addEventListener("pointerdown", dismiss);
|
|
2760
2768
|
return () => document.removeEventListener("pointerdown", dismiss);
|
|
2761
2769
|
}, [reactionBarOpen]);
|
|
2762
|
-
const [photo, setPhoto] =
|
|
2763
|
-
const [downloading, setDownloading] =
|
|
2764
|
-
const [downloadError, setDownloadError] =
|
|
2770
|
+
const [photo, setPhoto] = useState14(null);
|
|
2771
|
+
const [downloading, setDownloading] = useState14(false);
|
|
2772
|
+
const [downloadError, setDownloadError] = useState14(null);
|
|
2765
2773
|
const downloadController = useRef8(null);
|
|
2766
|
-
|
|
2774
|
+
useEffect10(() => () => downloadController.current?.abort(), []);
|
|
2767
2775
|
const downloadPhoto = async () => {
|
|
2768
2776
|
if (!photo || downloading) return;
|
|
2769
2777
|
const url = resolvedUrls.get(photo.attachmentId);
|
|
@@ -2793,9 +2801,9 @@ var MessageBubble = React9.memo(
|
|
|
2793
2801
|
downloadController.current = null;
|
|
2794
2802
|
}
|
|
2795
2803
|
};
|
|
2796
|
-
const [photoClosing, setPhotoClosing] =
|
|
2804
|
+
const [photoClosing, setPhotoClosing] = useState14(false);
|
|
2797
2805
|
const closeTimer = useRef8(null);
|
|
2798
|
-
|
|
2806
|
+
useEffect10(
|
|
2799
2807
|
() => () => {
|
|
2800
2808
|
if (closeTimer.current) clearTimeout(closeTimer.current);
|
|
2801
2809
|
},
|
|
@@ -3149,29 +3157,29 @@ var ChatPanelSurface = React10.memo(
|
|
|
3149
3157
|
autoScrollBehavior,
|
|
3150
3158
|
className
|
|
3151
3159
|
}) => {
|
|
3152
|
-
const [draft, setDraft] =
|
|
3153
|
-
const [stagedFiles, setStagedFiles] =
|
|
3160
|
+
const [draft, setDraft] = useState15("");
|
|
3161
|
+
const [stagedFiles, setStagedFiles] = useState15([]);
|
|
3154
3162
|
const uploads = useRef9(/* @__PURE__ */ new Map());
|
|
3155
|
-
const [failedUploads, setFailedUploads] =
|
|
3156
|
-
const [uploading, setUploading] =
|
|
3157
|
-
const [previews, setPreviews] =
|
|
3158
|
-
|
|
3163
|
+
const [failedUploads, setFailedUploads] = useState15(/* @__PURE__ */ new Set());
|
|
3164
|
+
const [uploading, setUploading] = useState15(/* @__PURE__ */ new Set());
|
|
3165
|
+
const [previews, setPreviews] = useState15(/* @__PURE__ */ new Map());
|
|
3166
|
+
useEffect11(() => {
|
|
3159
3167
|
const urls = new Map(stagedFiles.flatMap((file) => file instanceof File && file.type.startsWith("image/") ? [[file, URL.createObjectURL(file)]] : []));
|
|
3160
3168
|
setPreviews(urls);
|
|
3161
3169
|
return () => {
|
|
3162
3170
|
for (const url of urls.values()) URL.revokeObjectURL(url);
|
|
3163
3171
|
};
|
|
3164
3172
|
}, [stagedFiles]);
|
|
3165
|
-
const [sending, setSending] =
|
|
3166
|
-
const [pickingFiles, setPickingFiles] =
|
|
3167
|
-
const [composerError, setComposerError] =
|
|
3173
|
+
const [sending, setSending] = useState15(false);
|
|
3174
|
+
const [pickingFiles, setPickingFiles] = useState15(false);
|
|
3175
|
+
const [composerError, setComposerError] = useState15(null);
|
|
3168
3176
|
const scrollRef = useRef9(null);
|
|
3169
3177
|
const textareaRef = useRef9(null);
|
|
3170
3178
|
const fileInputRef = useRef9(null);
|
|
3171
3179
|
const isAtBottomRef = useRef9(true);
|
|
3172
3180
|
const lastMarkedSequenceRef = useRef9(localReadThroughSequence);
|
|
3173
3181
|
const restoreScrollRef = useRef9(null);
|
|
3174
|
-
const grouped =
|
|
3182
|
+
const grouped = useMemo9(() => groupChatMessages(messages), [messages]);
|
|
3175
3183
|
const latestSequence = messages.at(-1)?.sequence;
|
|
3176
3184
|
useLayoutEffect(() => {
|
|
3177
3185
|
const scroller = scrollRef.current;
|
|
@@ -3189,14 +3197,14 @@ var ChatPanelSurface = React10.memo(
|
|
|
3189
3197
|
scroller.scrollTo({ top: scroller.scrollHeight, behavior: autoScrollBehavior ?? "auto" });
|
|
3190
3198
|
if (latestSequence) markChatSequenceRead(latestSequence, lastMarkedSequenceRef, onMarkRead);
|
|
3191
3199
|
}, [autoScrollBehavior, latestSequence, messages.length, onMarkRead, pendingMessages.length]);
|
|
3192
|
-
|
|
3200
|
+
useEffect11(() => {
|
|
3193
3201
|
if (!localReadThroughSequence) return;
|
|
3194
3202
|
const previous = lastMarkedSequenceRef.current;
|
|
3195
3203
|
if (!previous || compareChatSequence(localReadThroughSequence, previous) > 0) {
|
|
3196
3204
|
lastMarkedSequenceRef.current = localReadThroughSequence;
|
|
3197
3205
|
}
|
|
3198
3206
|
}, [localReadThroughSequence]);
|
|
3199
|
-
|
|
3207
|
+
useEffect11(() => {
|
|
3200
3208
|
const textarea = textareaRef.current;
|
|
3201
3209
|
if (!textarea) return;
|
|
3202
3210
|
textarea.style.height = "auto";
|
|
@@ -3317,7 +3325,7 @@ var ChatPanelSurface = React10.memo(
|
|
|
3317
3325
|
setComposerError(cause instanceof Error ? cause.message : "Earlier messages could not be loaded.");
|
|
3318
3326
|
}
|
|
3319
3327
|
};
|
|
3320
|
-
const scrollWork =
|
|
3328
|
+
const scrollWork = useMemo9(
|
|
3321
3329
|
() => createChatScrollWork({
|
|
3322
3330
|
getScroller: () => scrollRef.current,
|
|
3323
3331
|
getLatestSequence: () => messages.at(-1)?.sequence ?? null,
|
|
@@ -3329,7 +3337,7 @@ var ChatPanelSurface = React10.memo(
|
|
|
3329
3337
|
}),
|
|
3330
3338
|
[messages, onMarkRead]
|
|
3331
3339
|
);
|
|
3332
|
-
|
|
3340
|
+
useEffect11(() => () => scrollWork.dispose(), [scrollWork]);
|
|
3333
3341
|
const handleScroll = scrollWork.onScroll;
|
|
3334
3342
|
return /* @__PURE__ */ jsxs17("div", { className: cn("relative flex h-full min-h-0 w-full flex-col overflow-hidden bg-transparent text-[var(--chalk-app-text)]", className), role: "complementary", "aria-label": "Chat panel", children: [
|
|
3335
3343
|
/* @__PURE__ */ jsx33(CallCardStyles, {}),
|
|
@@ -3448,7 +3456,7 @@ var ChatPanel = React10.memo((props) => {
|
|
|
3448
3456
|
const participants = useParticipants();
|
|
3449
3457
|
const self = useSelf();
|
|
3450
3458
|
const localParticipantId = self.participantId ?? "local";
|
|
3451
|
-
const participantNames =
|
|
3459
|
+
const participantNames = useMemo9(() => Object.fromEntries([...participants.roster.map((participant) => [participant.participantId, participant.displayName]), [localParticipantId, self.displayName ?? "You"]]), [localParticipantId, participants.roster, self.displayName]);
|
|
3452
3460
|
return /* @__PURE__ */ jsx33(
|
|
3453
3461
|
ChatPanelSurface,
|
|
3454
3462
|
{
|
|
@@ -3480,7 +3488,7 @@ var ChatPanel = React10.memo((props) => {
|
|
|
3480
3488
|
ChatPanel.displayName = "ChatPanel";
|
|
3481
3489
|
|
|
3482
3490
|
// src/components/composite/ReactionsOverlay.tsx
|
|
3483
|
-
import { useEffect as
|
|
3491
|
+
import { useEffect as useEffect12, useRef as useRef10, useState as useState16 } from "react";
|
|
3484
3492
|
import { createPortal } from "react-dom";
|
|
3485
3493
|
|
|
3486
3494
|
// src/components/composite/reaction-float.ts
|
|
@@ -3524,15 +3532,15 @@ function ReactionsOverlaySurface({ reactions, maxVisible = 6, className }) {
|
|
|
3524
3532
|
return /* @__PURE__ */ jsx34("div", { ref: root, className: cn("pointer-events-none absolute inset-0 z-30", className), "aria-live": "polite", "aria-atomic": "false", children: reactions.slice(-maxVisible).map((reaction) => /* @__PURE__ */ jsx34(TileReaction, { reaction, root }, reaction.eventId)) });
|
|
3525
3533
|
}
|
|
3526
3534
|
function TileReaction({ reaction, root }) {
|
|
3527
|
-
const [host, setHost] =
|
|
3535
|
+
const [host, setHost] = useState16(null);
|
|
3528
3536
|
const emoji = useRef10(null);
|
|
3529
3537
|
const reduced = usePrefersReducedMotion();
|
|
3530
|
-
|
|
3538
|
+
useEffect12(() => {
|
|
3531
3539
|
const frame = root.current?.closest("[data-part=call-frame]");
|
|
3532
3540
|
const tile = Array.from(frame?.querySelectorAll("[data-stage-item]") ?? []).find((element) => element.dataset.stageItem === reaction.participantId && element.getAttribute("aria-hidden") !== "true");
|
|
3533
3541
|
setHost(tile?.firstElementChild ?? root.current);
|
|
3534
3542
|
}, [reaction.participantId, root]);
|
|
3535
|
-
|
|
3543
|
+
useEffect12(() => {
|
|
3536
3544
|
const element = emoji.current;
|
|
3537
3545
|
if (!element || !host) return;
|
|
3538
3546
|
const animation = element.animate(
|
|
@@ -3570,10 +3578,10 @@ function CommandErrorAlert({ message }) {
|
|
|
3570
3578
|
}
|
|
3571
3579
|
|
|
3572
3580
|
// src/components/control-bar/ControlBar.tsx
|
|
3573
|
-
import React12, { useEffect as
|
|
3581
|
+
import React12, { useEffect as useEffect15, useRef as useRef12, useState as useState21 } from "react";
|
|
3574
3582
|
|
|
3575
3583
|
// src/components/device-popover/DevicePopover.tsx
|
|
3576
|
-
import { useEffect as
|
|
3584
|
+
import { useEffect as useEffect13, useRef as useRef11, useState as useState17 } from "react";
|
|
3577
3585
|
|
|
3578
3586
|
// src/components/control-bar/ShellIcon.tsx
|
|
3579
3587
|
import { Fragment as Fragment11, jsx as jsx36, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
@@ -3717,8 +3725,8 @@ var CALL_SHELL_CSS = `.chalk-shell-dock {
|
|
|
3717
3725
|
width: 16px;
|
|
3718
3726
|
height: 16px;
|
|
3719
3727
|
border-radius: 50%;
|
|
3720
|
-
background: var(--chalk-warning
|
|
3721
|
-
color:
|
|
3728
|
+
background: var(--chalk-warning);
|
|
3729
|
+
color: var(--chalk-accent-text);
|
|
3722
3730
|
font-size: 11px;
|
|
3723
3731
|
font-weight: 700;
|
|
3724
3732
|
line-height: 16px;
|
|
@@ -3748,7 +3756,7 @@ var CALL_SHELL_CSS = `.chalk-shell-dock {
|
|
|
3748
3756
|
width: 9px;
|
|
3749
3757
|
height: 9px;
|
|
3750
3758
|
border-radius: 50%;
|
|
3751
|
-
background: var(--chalk-warning
|
|
3759
|
+
background: var(--chalk-warning);
|
|
3752
3760
|
box-shadow: 0 0 0 2px var(--chalk-raised);
|
|
3753
3761
|
}
|
|
3754
3762
|
.chalk-shell-corner {
|
|
@@ -3785,11 +3793,11 @@ var CALL_SHELL_CSS = `.chalk-shell-dock {
|
|
|
3785
3793
|
height: 22px;
|
|
3786
3794
|
padding: 0 8px;
|
|
3787
3795
|
border-radius: 6px;
|
|
3788
|
-
background:
|
|
3796
|
+
background: var(--chalk-overlay);
|
|
3789
3797
|
font-size: 12px;
|
|
3790
3798
|
display: flex;
|
|
3791
3799
|
align-items: center;
|
|
3792
|
-
color:
|
|
3800
|
+
color: var(--chalk-on-overlay);
|
|
3793
3801
|
}
|
|
3794
3802
|
.chalk-shell-menu-separator {height:1px;background:var(--chalk-line);margin:6px 4px;}
|
|
3795
3803
|
.chalk-shell-level {
|
|
@@ -3930,7 +3938,7 @@ var CALL_SHELL_CSS = `.chalk-shell-dock {
|
|
|
3930
3938
|
background: var(--chalk-pressed);
|
|
3931
3939
|
}
|
|
3932
3940
|
.chalk-shell-quality i:first-child {
|
|
3933
|
-
background: var(--chalk-warning
|
|
3941
|
+
background: var(--chalk-warning);
|
|
3934
3942
|
}
|
|
3935
3943
|
.chalk-shell-modal-backdrop {
|
|
3936
3944
|
position: absolute;
|
|
@@ -3950,13 +3958,13 @@ var CALL_SHELL_CSS = `.chalk-shell-dock {
|
|
|
3950
3958
|
background: var(--chalk-surface);
|
|
3951
3959
|
border: 1px solid var(--chalk-line-strong);
|
|
3952
3960
|
border-radius: 16px;
|
|
3953
|
-
box-shadow:
|
|
3961
|
+
box-shadow: var(--chalk-shadow);
|
|
3954
3962
|
transition:transform .2s cubic-bezier(.16,1,.3,1);
|
|
3955
3963
|
}
|
|
3956
3964
|
.chalk-shell-modal[data-starting-style],.chalk-shell-modal[data-ending-style] {transform:translateY(8px);}
|
|
3957
3965
|
.chalk-shell-modal-backdrop {transition:opacity .18s ease-out;}
|
|
3958
3966
|
.chalk-shell-modal-backdrop[data-starting-style],.chalk-shell-modal-backdrop[data-ending-style] {opacity:0;}
|
|
3959
|
-
[data-chalk-theme="light"] .chalk-shell-modal {box-shadow:
|
|
3967
|
+
[data-chalk-theme="light"] .chalk-shell-modal {box-shadow:var(--chalk-shadow);}
|
|
3960
3968
|
.chalk-shell-modal-heading {
|
|
3961
3969
|
display: flex;
|
|
3962
3970
|
justify-content: space-between;
|
|
@@ -3993,7 +4001,7 @@ var CALL_SHELL_CSS = `.chalk-shell-dock {
|
|
|
3993
4001
|
border-radius: 6px;
|
|
3994
4002
|
background: var(--chalk-hover);
|
|
3995
4003
|
color: var(--chalk-text);
|
|
3996
|
-
box-shadow: inset 0 -1px 0
|
|
4004
|
+
box-shadow: inset 0 -1px 0 var(--chalk-line-strong);
|
|
3997
4005
|
}
|
|
3998
4006
|
.chalk-shell-report {
|
|
3999
4007
|
display: flex;
|
|
@@ -4032,7 +4040,7 @@ var CALL_SHELL_CSS = `.chalk-shell-dock {
|
|
|
4032
4040
|
box-shadow: 0 0 0 1px var(--chalk-line);
|
|
4033
4041
|
}
|
|
4034
4042
|
[data-chalk-theme="light"] .chalk-shell-reactions {
|
|
4035
|
-
box-shadow:
|
|
4043
|
+
box-shadow: var(--chalk-shadow);
|
|
4036
4044
|
}
|
|
4037
4045
|
@media (max-width: 640px) {
|
|
4038
4046
|
.chalk-shell-details-heading {display:none;}
|
|
@@ -4150,7 +4158,7 @@ var CALL_SHELL_CSS = `.chalk-shell-dock {
|
|
|
4150
4158
|
border: 1px solid var(--chalk-line-strong);
|
|
4151
4159
|
border-radius: 999px;
|
|
4152
4160
|
background: var(--chalk-popover);
|
|
4153
|
-
box-shadow:
|
|
4161
|
+
box-shadow: var(--chalk-shadow);
|
|
4154
4162
|
}
|
|
4155
4163
|
.chalk-shell-reactions-enter {animation:chalk-shell-reactions-in .18s cubic-bezier(.16,1,.3,1);}
|
|
4156
4164
|
@keyframes chalk-shell-reactions-in {from{opacity:0;translate:0 4px;}}
|
|
@@ -4185,10 +4193,10 @@ var CALL_SHELL_CSS = `.chalk-shell-dock {
|
|
|
4185
4193
|
.chalk-shell-raise svg {width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round;}
|
|
4186
4194
|
.chalk-shell-raise svg {color:var(--chalk-muted-text);}
|
|
4187
4195
|
.chalk-shell-raise:hover {background:var(--chalk-pressed);}
|
|
4188
|
-
.chalk-shell-raise[aria-pressed="true"] svg {color
|
|
4196
|
+
.chalk-shell-raise[aria-pressed="true"] svg {color:var(--chalk-accent-text);}
|
|
4189
4197
|
.chalk-shell-raise[aria-pressed="true"] {
|
|
4190
|
-
background: var(--chalk-warning
|
|
4191
|
-
color:
|
|
4198
|
+
background: var(--chalk-warning);
|
|
4199
|
+
color: var(--chalk-accent-text);
|
|
4192
4200
|
}
|
|
4193
4201
|
.chalk-shell-reactions-expanded {
|
|
4194
4202
|
display: grid;
|
|
@@ -4232,8 +4240,8 @@ var CALL_SHELL_CSS = `.chalk-shell-dock {
|
|
|
4232
4240
|
// src/components/device-popover/DevicePopover.tsx
|
|
4233
4241
|
import { Fragment as Fragment12, jsx as jsx38, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4234
4242
|
function InputLevel({ track }) {
|
|
4235
|
-
const [level, setLevel] =
|
|
4236
|
-
|
|
4243
|
+
const [level, setLevel] = useState17(0);
|
|
4244
|
+
useEffect13(() => {
|
|
4237
4245
|
if (!track || track.readyState !== "live") return;
|
|
4238
4246
|
const context = new AudioContext();
|
|
4239
4247
|
const source = context.createMediaStreamSource(new MediaStream([track]));
|
|
@@ -4256,9 +4264,9 @@ function InputLevel({ track }) {
|
|
|
4256
4264
|
}
|
|
4257
4265
|
function CameraPreview({ track, mirrored, open, selectedDeviceId, captureCameraPreview }) {
|
|
4258
4266
|
const video = useRef11(null);
|
|
4259
|
-
const [unavailable2, setUnavailable] =
|
|
4267
|
+
const [unavailable2, setUnavailable] = useState17(false);
|
|
4260
4268
|
const trackEnabled = track?.enabled;
|
|
4261
|
-
|
|
4269
|
+
useEffect13(() => {
|
|
4262
4270
|
const element = video.current;
|
|
4263
4271
|
if (!element || !open) return;
|
|
4264
4272
|
let cancelled = false;
|
|
@@ -4323,9 +4331,10 @@ function DevicePopover({
|
|
|
4323
4331
|
className,
|
|
4324
4332
|
disabled,
|
|
4325
4333
|
toggleDisabled,
|
|
4326
|
-
busy
|
|
4334
|
+
busy,
|
|
4335
|
+
onCancelPending
|
|
4327
4336
|
}) {
|
|
4328
|
-
const [open, setOpen] =
|
|
4337
|
+
const [open, setOpen] = useState17(false);
|
|
4329
4338
|
const mic = type === "mic";
|
|
4330
4339
|
const label = mic ? isActive ? "Mute microphone" : "Unmute microphone" : isActive ? "Turn off camera" : "Turn on camera";
|
|
4331
4340
|
return /* @__PURE__ */ jsxs20("div", { "data-part": `${type}-split`, className: cn("chalk-shell-split", className), "data-off": !isActive, children: [
|
|
@@ -4333,8 +4342,20 @@ function DevicePopover({
|
|
|
4333
4342
|
/* @__PURE__ */ jsx38(
|
|
4334
4343
|
ChalkTooltip,
|
|
4335
4344
|
{
|
|
4336
|
-
trigger: /* @__PURE__ */ jsx38(
|
|
4337
|
-
|
|
4345
|
+
trigger: /* @__PURE__ */ jsx38(
|
|
4346
|
+
"button",
|
|
4347
|
+
{
|
|
4348
|
+
type: "button",
|
|
4349
|
+
className: "chalk-shell-main",
|
|
4350
|
+
"aria-label": busy ? `${onCancelPending ? "Cancel connecting" : "Updating"} ${mic ? "microphone" : "camera"}` : label,
|
|
4351
|
+
"aria-pressed": isActive,
|
|
4352
|
+
"aria-busy": busy,
|
|
4353
|
+
disabled: disabled || toggleDisabled && !(busy && onCancelPending) || busy && !onCancelPending,
|
|
4354
|
+
onClick: busy && onCancelPending ? onCancelPending : onToggle,
|
|
4355
|
+
children: busy ? /* @__PURE__ */ jsx38("span", { "aria-hidden": "true", children: "\u2026" }) : /* @__PURE__ */ jsx38(ShellIcon, { name: mic ? isActive ? "mic" : "micOff" : isActive ? "cam" : "camOff" })
|
|
4356
|
+
}
|
|
4357
|
+
),
|
|
4358
|
+
children: warning ? `${mic ? "Microphone" : "Camera"} didn\u2019t reach the call. Try turning it on again.` : busy ? `Connecting ${mic ? "microphone" : "camera"}\u2026` : label
|
|
4338
4359
|
}
|
|
4339
4360
|
),
|
|
4340
4361
|
/* @__PURE__ */ jsxs20(
|
|
@@ -4367,7 +4388,18 @@ function DevicePopover({
|
|
|
4367
4388
|
]
|
|
4368
4389
|
}
|
|
4369
4390
|
),
|
|
4370
|
-
warning ? /* @__PURE__ */
|
|
4391
|
+
warning ? /* @__PURE__ */ jsxs20("span", { className: "chalk-shell-warning", role: "status", "aria-label": `${mic ? "Microphone" : "Camera"} didn\u2019t reach the call. Try turning it on again.`, children: [
|
|
4392
|
+
/* @__PURE__ */ jsx38("span", { "aria-hidden": "true", children: "!" }),
|
|
4393
|
+
/* @__PURE__ */ jsxs20("span", { className: "sr-only", children: [
|
|
4394
|
+
mic ? "Microphone" : "Camera",
|
|
4395
|
+
" didn\u2019t reach the call. Try turning it on again."
|
|
4396
|
+
] })
|
|
4397
|
+
] }) : null,
|
|
4398
|
+
busy ? /* @__PURE__ */ jsxs20("span", { className: "sr-only", role: "status", children: [
|
|
4399
|
+
"Connecting ",
|
|
4400
|
+
mic ? "microphone" : "camera",
|
|
4401
|
+
"\u2026"
|
|
4402
|
+
] }) : null,
|
|
4371
4403
|
mic && speakingWhileMuted ? /* @__PURE__ */ jsx38("span", { className: "chalk-shell-muted-hint", role: "status", children: "You\u2019re muted" }) : null
|
|
4372
4404
|
] });
|
|
4373
4405
|
}
|
|
@@ -4392,10 +4424,10 @@ function LeaveMenu({ onLeave, onEndForEveryone, renderButton }) {
|
|
|
4392
4424
|
}
|
|
4393
4425
|
|
|
4394
4426
|
// src/components/control-bar/DockLayout.tsx
|
|
4395
|
-
import { useState as
|
|
4427
|
+
import { useState as useState18 } from "react";
|
|
4396
4428
|
import { Fragment as Fragment13, jsx as jsx41, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4397
4429
|
function DockLayout({ layout, onLayoutChange, children }) {
|
|
4398
|
-
const [open, setOpen] =
|
|
4430
|
+
const [open, setOpen] = useState18(false);
|
|
4399
4431
|
return /* @__PURE__ */ jsxs23(Fragment13, { children: [
|
|
4400
4432
|
/* @__PURE__ */ jsx41(ChalkIconButton, { size: "lg", "aria-label": "More options", "aria-haspopup": "dialog", "aria-expanded": open, onClick: () => setOpen(true), children: /* @__PURE__ */ jsx41("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx41("path", { "data-part": "dock-more-glyph", d: "M5 12h.01M12 12h.01M19 12h.01", strokeWidth: "3" }) }) }),
|
|
4401
4433
|
/* @__PURE__ */ jsx41(ChalkSheet, { title: "More options", open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs23(
|
|
@@ -4436,7 +4468,7 @@ function DockLayout({ layout, onLayoutChange, children }) {
|
|
|
4436
4468
|
}
|
|
4437
4469
|
|
|
4438
4470
|
// src/components/control-bar/ShareControl.tsx
|
|
4439
|
-
import { useState as
|
|
4471
|
+
import { useState as useState19 } from "react";
|
|
4440
4472
|
import { Fragment as Fragment14, jsx as jsx42, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4441
4473
|
function SourceIcon({ source }) {
|
|
4442
4474
|
return /* @__PURE__ */ jsx42("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: source === "monitor" ? /* @__PURE__ */ jsxs24(Fragment14, { children: [
|
|
@@ -4451,9 +4483,9 @@ function SourceIcon({ source }) {
|
|
|
4451
4483
|
] }) });
|
|
4452
4484
|
}
|
|
4453
4485
|
function ShareControl({ sharing, onToggle, onStart, disabled = false, startDisabled = false }) {
|
|
4454
|
-
const [surface, setSurface] =
|
|
4455
|
-
const [audio, setAudio] =
|
|
4456
|
-
const [replace, setReplace] =
|
|
4486
|
+
const [surface, setSurface] = useState19("window");
|
|
4487
|
+
const [audio, setAudio] = useState19(true);
|
|
4488
|
+
const [replace, setReplace] = useState19(false);
|
|
4457
4489
|
const start2 = (next) => {
|
|
4458
4490
|
if (disabled || startDisabled) return;
|
|
4459
4491
|
setSurface(next);
|
|
@@ -4508,7 +4540,15 @@ function ShareControl({ sharing, onToggle, onStart, disabled = false, startDisab
|
|
|
4508
4540
|
}
|
|
4509
4541
|
|
|
4510
4542
|
// src/components/control-bar/control-bar-behavior.ts
|
|
4511
|
-
import { useCallback as
|
|
4543
|
+
import { useCallback as useCallback6, useEffect as useEffect14, useMemo as useMemo10, useState as useState20 } from "react";
|
|
4544
|
+
|
|
4545
|
+
// src/components/control-bar/media-toggle.ts
|
|
4546
|
+
function mediaToggleTarget(state, live) {
|
|
4547
|
+
if (state === "enabled" || state === "requesting") return false;
|
|
4548
|
+
return live ? true : void 0;
|
|
4549
|
+
}
|
|
4550
|
+
|
|
4551
|
+
// src/components/control-bar/control-bar-behavior.ts
|
|
4512
4552
|
var DEFAULT_CONTROL_BAR_BUTTONS = ["mic", "video", "screenshare", "record", "whiteboard", "handraise", "leave", "participants", "chat", "reactions"];
|
|
4513
4553
|
var EMPTY_DETECTED_DEVICES = {
|
|
4514
4554
|
audioinput: [],
|
|
@@ -4544,10 +4584,10 @@ function useControlBarSurfaceBehavior({
|
|
|
4544
4584
|
participantGradientPreference,
|
|
4545
4585
|
detectDevices = true
|
|
4546
4586
|
}) {
|
|
4547
|
-
const themeVariables =
|
|
4548
|
-
const [detectedDevices, setDetectedDevices] =
|
|
4587
|
+
const themeVariables = useMemo10(() => getParticipantThemeVariables(participantColorSeed, participantGradientPreference), [participantColorSeed, participantGradientPreference]);
|
|
4588
|
+
const [detectedDevices, setDetectedDevices] = useState20(EMPTY_DETECTED_DEVICES);
|
|
4549
4589
|
const buttonsToRender = buttons ?? DEFAULT_CONTROL_BAR_BUTTONS;
|
|
4550
|
-
|
|
4590
|
+
useEffect14(() => {
|
|
4551
4591
|
if (!detectDevices || density !== "comfortable" || !navigator.mediaDevices?.enumerateDevices) return;
|
|
4552
4592
|
let cancelled = false;
|
|
4553
4593
|
const syncDevices = async () => {
|
|
@@ -4600,15 +4640,17 @@ function useConnectedControlBarBehavior(props) {
|
|
|
4600
4640
|
const live = useConnection().status === "live";
|
|
4601
4641
|
const microphoneEnabled = media.local.microphone.state === "enabled";
|
|
4602
4642
|
const cameraEnabled = media.local.camera.state === "enabled";
|
|
4643
|
+
const microphoneTarget = mediaToggleTarget(media.local.microphone.state, live);
|
|
4644
|
+
const cameraTarget = mediaToggleTarget(media.local.camera.state, live);
|
|
4603
4645
|
const screenSharing = media.local.screen.state === "enabled" || media.local.screen.state === "requesting";
|
|
4604
4646
|
const recordingStatus = recording.current?.status;
|
|
4605
4647
|
const isRecording = recordingStatus === "recording" || recordingStatus === "stopping";
|
|
4606
4648
|
const isRecordingPending = recordingStatus === "starting" || recordingStatus === "stopping";
|
|
4607
|
-
const [noiseSuppression, setNoiseSuppression] =
|
|
4608
|
-
const [commandError, setCommandError] =
|
|
4609
|
-
const [commandSource, setCommandSource] =
|
|
4610
|
-
const [commandAction, setCommandAction] =
|
|
4611
|
-
const run =
|
|
4649
|
+
const [noiseSuppression, setNoiseSuppression] = useState20(true);
|
|
4650
|
+
const [commandError, setCommandError] = useState20(null);
|
|
4651
|
+
const [commandSource, setCommandSource] = useState20();
|
|
4652
|
+
const [commandAction, setCommandAction] = useState20();
|
|
4653
|
+
const run = useCallback6(
|
|
4612
4654
|
async (command, source, action) => {
|
|
4613
4655
|
setCommandError(null);
|
|
4614
4656
|
setCommandSource(void 0);
|
|
@@ -4628,7 +4670,7 @@ function useConnectedControlBarBehavior(props) {
|
|
|
4628
4670
|
},
|
|
4629
4671
|
[props.onCommandError]
|
|
4630
4672
|
);
|
|
4631
|
-
const leave =
|
|
4673
|
+
const leave = useCallback6(() => {
|
|
4632
4674
|
if (props.onLeaveRequest) {
|
|
4633
4675
|
props.onLeaveRequest();
|
|
4634
4676
|
return;
|
|
@@ -4649,6 +4691,8 @@ function useConnectedControlBarBehavior(props) {
|
|
|
4649
4691
|
const audioInputDevices = media.devices.microphones.map((device2) => ({ ...device2, kind: "audioinput" }));
|
|
4650
4692
|
const audioOutputDevices = media.devices.speakers.map((device2) => ({ ...device2, kind: "audiooutput" }));
|
|
4651
4693
|
const videoInputDevices = media.devices.cameras.map((device2) => ({ ...device2, kind: "videoinput" }));
|
|
4694
|
+
const toggleMicrophone = microphoneTarget === void 0 ? void 0 : () => void run(() => client.media.setMicrophoneEnabled(microphoneTarget), "microphone", microphoneTarget ? "start" : "stop");
|
|
4695
|
+
const toggleCamera = cameraTarget === void 0 ? void 0 : () => void run(() => client.media.setCameraEnabled(cameraTarget), "camera", cameraTarget ? "start" : "stop");
|
|
4652
4696
|
const surfaceProps = {
|
|
4653
4697
|
...props,
|
|
4654
4698
|
detectDevices: false,
|
|
@@ -4675,9 +4719,11 @@ function useConnectedControlBarBehavior(props) {
|
|
|
4675
4719
|
shareUrl: props.shareUrl,
|
|
4676
4720
|
isMuted: !microphoneEnabled,
|
|
4677
4721
|
microphonePending: media.local.microphone.state === "requesting",
|
|
4722
|
+
onCancelMicrophonePending: toggleMicrophone,
|
|
4678
4723
|
mediaEnableDisabled: !live,
|
|
4679
4724
|
reactionsDisabled: !live,
|
|
4680
4725
|
cameraPending: media.local.camera.state === "requesting",
|
|
4726
|
+
onCancelCameraPending: toggleCamera,
|
|
4681
4727
|
isVideoEnabled: cameraEnabled,
|
|
4682
4728
|
isScreenSharing: screenSharing,
|
|
4683
4729
|
isRecording,
|
|
@@ -4724,8 +4770,8 @@ function useConnectedControlBarBehavior(props) {
|
|
|
4724
4770
|
"speaker",
|
|
4725
4771
|
"test"
|
|
4726
4772
|
),
|
|
4727
|
-
onToggleMute:
|
|
4728
|
-
onToggleVideo:
|
|
4773
|
+
onToggleMute: toggleMicrophone,
|
|
4774
|
+
onToggleVideo: toggleCamera,
|
|
4729
4775
|
onAudioInputChange: (deviceId) => void run(() => client.media.selectMicrophone(deviceId), "microphone", "select"),
|
|
4730
4776
|
onAudioOutputChange: (deviceId) => void run(() => client.media.selectSpeaker(deviceId), "speaker", "select"),
|
|
4731
4777
|
onVideoInputChange: (deviceId) => void run(() => client.media.selectCamera(deviceId), "camera", "select"),
|
|
@@ -4739,7 +4785,12 @@ function useConnectedControlBarBehavior(props) {
|
|
|
4739
4785
|
onLeft: leave,
|
|
4740
4786
|
onEndForEveryone: props.onEndForEveryone
|
|
4741
4787
|
};
|
|
4742
|
-
return { surfaceProps, commandError, commandSource, commandAction };
|
|
4788
|
+
return { surfaceProps, commandError, commandSource, commandAction, mediaNotice: failedMediaNotice(media.local) };
|
|
4789
|
+
}
|
|
4790
|
+
function failedMediaNotice(media) {
|
|
4791
|
+
if (media.microphone.state === "failed") return "Microphone didn\u2019t reach the call. Turn it on to try again.";
|
|
4792
|
+
if (media.camera.state === "failed") return "Camera didn\u2019t reach the call. Turn it on to try again.";
|
|
4793
|
+
return void 0;
|
|
4743
4794
|
}
|
|
4744
4795
|
|
|
4745
4796
|
// src/components/control-bar/next-camera.ts
|
|
@@ -4767,10 +4818,10 @@ function ControlBarPresentation(props) {
|
|
|
4767
4818
|
var ControlBarSurface = React12.memo((props) => {
|
|
4768
4819
|
const { buttonsToRender, effectiveAudioInputDevices, effectiveAudioOutputDevices, effectiveVideoInputDevices, showLeave } = useControlBarSurfaceBehavior({ ...props, density: props.density ?? "comfortable", detectDevices: props.detectDevices ?? true });
|
|
4769
4820
|
const dock = useRef12(null);
|
|
4770
|
-
const [fullscreen, setFullscreen] =
|
|
4771
|
-
const [canCaptureDisplay, setCanCaptureDisplay] =
|
|
4772
|
-
|
|
4773
|
-
|
|
4821
|
+
const [fullscreen, setFullscreen] = useState21(false);
|
|
4822
|
+
const [canCaptureDisplay, setCanCaptureDisplay] = useState21(false);
|
|
4823
|
+
useEffect15(() => setCanCaptureDisplay(typeof navigator.mediaDevices?.getDisplayMedia === "function"), []);
|
|
4824
|
+
useEffect15(() => {
|
|
4774
4825
|
const changed = () => setFullscreen(Boolean(document.fullscreenElement));
|
|
4775
4826
|
document.addEventListener("fullscreenchange", changed);
|
|
4776
4827
|
return () => document.removeEventListener("fullscreenchange", changed);
|
|
@@ -4804,6 +4855,7 @@ var ControlBarSurface = React12.memo((props) => {
|
|
|
4804
4855
|
type: "mic",
|
|
4805
4856
|
isActive: !props.isMuted,
|
|
4806
4857
|
busy: props.microphonePending,
|
|
4858
|
+
onCancelPending: props.onCancelMicrophonePending,
|
|
4807
4859
|
toggleDisabled: props.mediaEnableDisabled && props.isMuted,
|
|
4808
4860
|
onToggle: props.onToggleMute ?? (() => {
|
|
4809
4861
|
}),
|
|
@@ -4828,6 +4880,7 @@ var ControlBarSurface = React12.memo((props) => {
|
|
|
4828
4880
|
type: "video",
|
|
4829
4881
|
isActive: props.isVideoEnabled ?? true,
|
|
4830
4882
|
busy: props.cameraPending,
|
|
4883
|
+
onCancelPending: props.onCancelCameraPending,
|
|
4831
4884
|
toggleDisabled: props.mediaEnableDisabled && !props.isVideoEnabled,
|
|
4832
4885
|
onToggle: props.onToggleVideo ?? (() => {
|
|
4833
4886
|
}),
|
|
@@ -4911,18 +4964,18 @@ var ControlBarSurface = React12.memo((props) => {
|
|
|
4911
4964
|
});
|
|
4912
4965
|
ControlBarSurface.displayName = "ControlBarSurface";
|
|
4913
4966
|
function ControlBar(props) {
|
|
4914
|
-
const { surfaceProps, commandError, commandSource, commandAction } = useConnectedControlBarBehavior(props);
|
|
4967
|
+
const { surfaceProps, commandError, commandSource, commandAction, mediaNotice } = useConnectedControlBarBehavior(props);
|
|
4915
4968
|
return /* @__PURE__ */ jsxs25(Fragment15, { children: [
|
|
4916
4969
|
/* @__PURE__ */ jsx43(ControlBarSurface, { ...surfaceProps }),
|
|
4917
|
-
|
|
4970
|
+
/* @__PURE__ */ jsx43(CommandErrorAlert, { message: mediaNotice ?? (!props.onCommandError && commandError ? commandFailureMessage(commandError, commandSource, commandAction) : void 0) })
|
|
4918
4971
|
] });
|
|
4919
4972
|
}
|
|
4920
4973
|
|
|
4921
4974
|
// src/components/participants-panel/ParticipantsPanel.tsx
|
|
4922
|
-
import React13, { useMemo as
|
|
4975
|
+
import React13, { useMemo as useMemo11, useState as useState23 } from "react";
|
|
4923
4976
|
|
|
4924
4977
|
// src/components/participants-panel/participant-row.tsx
|
|
4925
|
-
import { useState as
|
|
4978
|
+
import { useState as useState22, useRef as useRef13, useEffect as useEffect16 } from "react";
|
|
4926
4979
|
|
|
4927
4980
|
// src/components/participants-panel/participant-options-menu-contract.ts
|
|
4928
4981
|
function runParticipantAction(action, onClose, onCommandError) {
|
|
@@ -5097,13 +5150,13 @@ function ParticipantRow({
|
|
|
5097
5150
|
onMenuToggle,
|
|
5098
5151
|
onMenuClose
|
|
5099
5152
|
}) {
|
|
5100
|
-
const [isEditing, setIsEditing] =
|
|
5101
|
-
const [editName, setEditName] =
|
|
5153
|
+
const [isEditing, setIsEditing] = useState22(false);
|
|
5154
|
+
const [editName, setEditName] = useState22(participant.displayName);
|
|
5102
5155
|
const inputRef = useRef13(null);
|
|
5103
5156
|
const rootRef = useRef13(null);
|
|
5104
5157
|
const hasVolumeControl = !!participantVolumes && !!onParticipantVolumeChange;
|
|
5105
5158
|
const showMenuButton = canManageParticipants || hasVolumeControl || participant.isLocal && !!onUpdateDisplayName;
|
|
5106
|
-
|
|
5159
|
+
useEffect16(() => {
|
|
5107
5160
|
if (isEditing) {
|
|
5108
5161
|
inputRef.current?.focus();
|
|
5109
5162
|
inputRef.current?.select();
|
|
@@ -5247,10 +5300,10 @@ var ParticipantsPanelSurface = React13.memo(
|
|
|
5247
5300
|
participantGradientPreference,
|
|
5248
5301
|
generatedAvatars = true
|
|
5249
5302
|
}) => {
|
|
5250
|
-
const [query, setQuery] =
|
|
5251
|
-
const [activeMenuId, setActiveMenuId] =
|
|
5252
|
-
const [muting, setMuting] =
|
|
5253
|
-
const [error, setError] =
|
|
5303
|
+
const [query, setQuery] = useState23("");
|
|
5304
|
+
const [activeMenuId, setActiveMenuId] = useState23(null);
|
|
5305
|
+
const [muting, setMuting] = useState23(false);
|
|
5306
|
+
const [error, setError] = useState23(null);
|
|
5254
5307
|
const filtered = participants.filter((person) => person.displayName.toLocaleLowerCase().includes(query.trim().toLocaleLowerCase()));
|
|
5255
5308
|
const raised = participants.filter((person) => person.isHandRaised);
|
|
5256
5309
|
const unmutedCount = participants.filter((person) => !person.isLocal && !person.isMuted).length;
|
|
@@ -5354,7 +5407,7 @@ var ParticipantsPanel = React13.memo((props) => {
|
|
|
5354
5407
|
const canRemoveParticipants = useCan("removeParticipant");
|
|
5355
5408
|
const canManageAdmission = useCan("manageAdmission");
|
|
5356
5409
|
const contextVolumeState = useParticipantVolumeContext();
|
|
5357
|
-
const [localVolumes, setLocalVolumes] =
|
|
5410
|
+
const [localVolumes, setLocalVolumes] = useState23(/* @__PURE__ */ new Map());
|
|
5358
5411
|
const isControlled = props.participantVolumes !== void 0 && props.onParticipantVolumeChange !== void 0;
|
|
5359
5412
|
const participantVolumes = isControlled ? props.participantVolumes : contextVolumeState?.volumes ?? localVolumes;
|
|
5360
5413
|
const onParticipantVolumeChange = isControlled ? props.onParticipantVolumeChange : contextVolumeState?.setVolume ?? ((participantId, volume) => setLocalVolumes((current) => {
|
|
@@ -5363,7 +5416,7 @@ var ParticipantsPanel = React13.memo((props) => {
|
|
|
5363
5416
|
else next.set(participantId, volume);
|
|
5364
5417
|
return next;
|
|
5365
5418
|
}));
|
|
5366
|
-
const participants =
|
|
5419
|
+
const participants = useMemo11(
|
|
5367
5420
|
() => participantsSlice.roster.map((participant) => ({
|
|
5368
5421
|
id: participant.participantId,
|
|
5369
5422
|
displayName: participant.displayName,
|
|
@@ -5473,7 +5526,7 @@ function StatusAction({ icon, label, onClick, disabled }) {
|
|
|
5473
5526
|
}
|
|
5474
5527
|
|
|
5475
5528
|
// src/components/call-limbo/CallReady.tsx
|
|
5476
|
-
import { useEffect as
|
|
5529
|
+
import { useEffect as useEffect17, useId, useRef as useRef14, useState as useState24 } from "react";
|
|
5477
5530
|
|
|
5478
5531
|
// src/components/call-limbo/qr-code.ts
|
|
5479
5532
|
function inviteQR(text) {
|
|
@@ -5616,28 +5669,28 @@ function inviteQR(text) {
|
|
|
5616
5669
|
// src/components/call-limbo/CallReady.tsx
|
|
5617
5670
|
import { Fragment as Fragment19, jsx as jsx48, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
5618
5671
|
function CallReady({ open, onClose, link = typeof location === "undefined" ? "" : location.href }) {
|
|
5619
|
-
const [showQR, setShowQR] =
|
|
5672
|
+
const [showQR, setShowQR] = useState24(false);
|
|
5620
5673
|
const qrRef = useRef14(null);
|
|
5621
5674
|
const cardRef = useRef14(null);
|
|
5622
5675
|
const phone = useIsMobile();
|
|
5623
5676
|
const reducedMotion = usePrefersReducedMotion();
|
|
5624
|
-
const [entered, setEntered] =
|
|
5625
|
-
const [present, setPresent] =
|
|
5677
|
+
const [entered, setEntered] = useState24(false);
|
|
5678
|
+
const [present, setPresent] = useState24(open);
|
|
5626
5679
|
const id = useId();
|
|
5627
5680
|
const qr = showQR ? inviteQR(link) : null;
|
|
5628
5681
|
const close = () => {
|
|
5629
5682
|
onClose();
|
|
5630
5683
|
cardRef.current?.closest("[data-chalk]")?.querySelector("[data-call-link-trigger]")?.focus();
|
|
5631
5684
|
};
|
|
5632
|
-
|
|
5685
|
+
useEffect17(() => {
|
|
5633
5686
|
if (!open && cardRef.current?.contains(document.activeElement)) cardRef.current.closest("[data-chalk]")?.querySelector("[data-call-link-trigger]")?.focus();
|
|
5634
5687
|
}, [open]);
|
|
5635
|
-
|
|
5688
|
+
useEffect17(() => {
|
|
5636
5689
|
if (!showQR || reducedMotion) return;
|
|
5637
5690
|
const animation = qrRef.current?.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 200, easing: "ease-out" });
|
|
5638
5691
|
return () => animation?.cancel();
|
|
5639
5692
|
}, [showQR, reducedMotion]);
|
|
5640
|
-
|
|
5693
|
+
useEffect17(() => {
|
|
5641
5694
|
if (open) setPresent(true);
|
|
5642
5695
|
const frame = requestAnimationFrame(() => setEntered(open));
|
|
5643
5696
|
const timer = setTimeout(
|
|
@@ -5703,11 +5756,11 @@ function CallReady({ open, onClose, link = typeof location === "undefined" ? ""
|
|
|
5703
5756
|
}
|
|
5704
5757
|
|
|
5705
5758
|
// src/components/toast-stack/ToastStack.tsx
|
|
5706
|
-
import { memo, useLayoutEffect as useLayoutEffect3, useRef as useRef15, useState as
|
|
5759
|
+
import { memo, useLayoutEffect as useLayoutEffect3, useRef as useRef15, useState as useState26 } from "react";
|
|
5707
5760
|
import { flushSync as flushSync2 } from "react-dom";
|
|
5708
5761
|
|
|
5709
5762
|
// src/components/toast-stack/useToastCapacity.ts
|
|
5710
|
-
import { isValidElement as isValidElement2, useLayoutEffect as useLayoutEffect2, useState as
|
|
5763
|
+
import { isValidElement as isValidElement2, useLayoutEffect as useLayoutEffect2, useState as useState25 } from "react";
|
|
5711
5764
|
import { flushSync } from "react-dom";
|
|
5712
5765
|
|
|
5713
5766
|
// src/components/toast-stack/toast-layout-snapshot.ts
|
|
@@ -5752,7 +5805,7 @@ function measureToastLayout(stack, snapshot) {
|
|
|
5752
5805
|
|
|
5753
5806
|
// src/components/toast-stack/useToastCapacity.ts
|
|
5754
5807
|
function useToastCapacity(stack, candidates, enabled, ownedIds) {
|
|
5755
|
-
const [fit, setFit] =
|
|
5808
|
+
const [fit, setFit] = useState25(null);
|
|
5756
5809
|
let count = candidates.length;
|
|
5757
5810
|
if (enabled) {
|
|
5758
5811
|
count = 0;
|
|
@@ -5846,7 +5899,7 @@ var ToastStack = memo(function ToastStack2({ toasts, onDismiss, maxVisible = 3,
|
|
|
5846
5899
|
const stack = useRef15(null);
|
|
5847
5900
|
const short = useShortCall(stack, onFold !== void 0);
|
|
5848
5901
|
const candidates = maxVisible > 0 ? toasts.slice(-maxVisible) : [];
|
|
5849
|
-
const [ownedIds, setOwnedIds] =
|
|
5902
|
+
const [ownedIds, setOwnedIds] = useState26([]);
|
|
5850
5903
|
const fold = useRef15(onFold);
|
|
5851
5904
|
const capacity = useToastCapacity(stack, candidates, onFold !== void 0 && short === false, ownedIds);
|
|
5852
5905
|
const selected = onFold !== void 0 && short !== false ? [] : candidates.slice(candidates.length - capacity.count);
|
|
@@ -5855,7 +5908,7 @@ var ToastStack = memo(function ToastStack2({ toasts, onDismiss, maxVisible = 3,
|
|
|
5855
5908
|
const foldedIds = folded.map((toast) => toast.id);
|
|
5856
5909
|
const announced = useRef15(/* @__PURE__ */ new Map());
|
|
5857
5910
|
const wasAnnounced = (toast) => announced.current.get(toast.id) === noticeIdentity(toast);
|
|
5858
|
-
const [unheard, setUnheard] =
|
|
5911
|
+
const [unheard, setUnheard] = useState26([]);
|
|
5859
5912
|
const reported = useRef15([]);
|
|
5860
5913
|
const reporting = useRef15(false);
|
|
5861
5914
|
useLayoutEffect3(() => {
|
|
@@ -5902,7 +5955,7 @@ var ToastStack = memo(function ToastStack2({ toasts, onDismiss, maxVisible = 3,
|
|
|
5902
5955
|
] });
|
|
5903
5956
|
});
|
|
5904
5957
|
function useShortCall(stack, enabled) {
|
|
5905
|
-
const [short, setShort] =
|
|
5958
|
+
const [short, setShort] = useState26(null);
|
|
5906
5959
|
useLayoutEffect3(() => {
|
|
5907
5960
|
if (!enabled) {
|
|
5908
5961
|
setShort(null);
|
|
@@ -5923,7 +5976,7 @@ function sameIds(a, b) {
|
|
|
5923
5976
|
}
|
|
5924
5977
|
|
|
5925
5978
|
// src/internal/call-motion.ts
|
|
5926
|
-
import { useEffect as
|
|
5979
|
+
import { useEffect as useEffect18, useState as useState27 } from "react";
|
|
5927
5980
|
var moves = /* @__PURE__ */ new WeakMap();
|
|
5928
5981
|
function captureFlip(elements) {
|
|
5929
5982
|
const previous = Array.from(elements, (element) => ({ element, box: element.getBoundingClientRect() }));
|
|
@@ -5951,9 +6004,9 @@ function playFlip(previous) {
|
|
|
5951
6004
|
}
|
|
5952
6005
|
var ACTIVE_LAYERS = '[role="menu"],[role="dialog"],[data-part="toast"],[data-part="notice-button"],[data-chalk-drawer]';
|
|
5953
6006
|
function useIdleChrome(root, enabled) {
|
|
5954
|
-
const [idle, setIdle] =
|
|
6007
|
+
const [idle, setIdle] = useState27(false);
|
|
5955
6008
|
const fine = useMediaQuery("(pointer:fine) and (min-width:641px)");
|
|
5956
|
-
|
|
6009
|
+
useEffect18(() => {
|
|
5957
6010
|
const element = root.current;
|
|
5958
6011
|
if (!element || !enabled || !fine) return;
|
|
5959
6012
|
let timer;
|
|
@@ -5983,10 +6036,10 @@ function useIdleChrome(root, enabled) {
|
|
|
5983
6036
|
}
|
|
5984
6037
|
|
|
5985
6038
|
// src/components/space-header/SpaceHeader.tsx
|
|
5986
|
-
import React14, { useCallback as
|
|
6039
|
+
import React14, { useCallback as useCallback7, useRef as useRef18, useState as useState29 } from "react";
|
|
5987
6040
|
|
|
5988
6041
|
// src/internal/useSoundsSetting.ts
|
|
5989
|
-
import { useSyncExternalStore as
|
|
6042
|
+
import { useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
5990
6043
|
var KEY2 = "chalk_sounds";
|
|
5991
6044
|
var listeners2 = /* @__PURE__ */ new Set();
|
|
5992
6045
|
var fallback2 = true;
|
|
@@ -6006,7 +6059,7 @@ function subscribe2(listener) {
|
|
|
6006
6059
|
};
|
|
6007
6060
|
}
|
|
6008
6061
|
function useSoundsSetting() {
|
|
6009
|
-
const enabled =
|
|
6062
|
+
const enabled = useSyncExternalStore4(subscribe2, read2, () => true);
|
|
6010
6063
|
return [
|
|
6011
6064
|
enabled,
|
|
6012
6065
|
(next) => {
|
|
@@ -6035,7 +6088,7 @@ function LayoutMenu({ layout, onLayoutChange }) {
|
|
|
6035
6088
|
|
|
6036
6089
|
// src/components/space-header/CallDetails.tsx
|
|
6037
6090
|
import { Dialog as Dialog2 } from "@base-ui/react/dialog";
|
|
6038
|
-
import {
|
|
6091
|
+
import { useRef as useRef16, useState as useState28 } from "react";
|
|
6039
6092
|
|
|
6040
6093
|
// src/components/space-header/share-qr.ts
|
|
6041
6094
|
function shareQr(text) {
|
|
@@ -6190,18 +6243,20 @@ function CallDialog({
|
|
|
6190
6243
|
const container = useRef16(null);
|
|
6191
6244
|
const reportInput = useRef16(null);
|
|
6192
6245
|
const reportOpener = useRef16(null);
|
|
6193
|
-
const [text, setText] =
|
|
6194
|
-
const [includeDiagnostics, setIncludeDiagnostics] =
|
|
6195
|
-
const [status, setStatus] =
|
|
6196
|
-
const [error, setError] =
|
|
6197
|
-
|
|
6246
|
+
const [text, setText] = useState28("");
|
|
6247
|
+
const [includeDiagnostics, setIncludeDiagnostics] = useState28(false);
|
|
6248
|
+
const [status, setStatus] = useState28("idle");
|
|
6249
|
+
const [error, setError] = useState28("");
|
|
6250
|
+
const [session, setSession] = useState28({ kind, open });
|
|
6251
|
+
if (session.kind !== kind || session.open !== open) {
|
|
6252
|
+
setSession({ kind, open });
|
|
6198
6253
|
if (open && kind === "report") {
|
|
6199
6254
|
setText("");
|
|
6200
6255
|
setIncludeDiagnostics(false);
|
|
6201
6256
|
setError("");
|
|
6202
6257
|
setStatus("idle");
|
|
6203
6258
|
}
|
|
6204
|
-
}
|
|
6259
|
+
}
|
|
6205
6260
|
return /* @__PURE__ */ jsx51(
|
|
6206
6261
|
"span",
|
|
6207
6262
|
{
|
|
@@ -6328,7 +6383,7 @@ function CallDetails({
|
|
|
6328
6383
|
}) {
|
|
6329
6384
|
const link = shareUrl ?? (typeof location === "undefined" ? "" : location.href);
|
|
6330
6385
|
const qr = shareQr(link);
|
|
6331
|
-
const [details, setDetails] =
|
|
6386
|
+
const [details, setDetails] = useState28(false);
|
|
6332
6387
|
return /* @__PURE__ */ jsxs32("div", { className: "chalk-details", children: [
|
|
6333
6388
|
/* @__PURE__ */ jsxs32("div", { className: "chalk-shell-details-heading", children: [
|
|
6334
6389
|
/* @__PURE__ */ jsx51("h2", { children: spaceName }),
|
|
@@ -6400,11 +6455,11 @@ function CallDetails({
|
|
|
6400
6455
|
}
|
|
6401
6456
|
|
|
6402
6457
|
// src/components/space-header/useCallShortcuts.ts
|
|
6403
|
-
import { useEffect as
|
|
6458
|
+
import { useEffect as useEffect19, useRef as useRef17 } from "react";
|
|
6404
6459
|
function useCallShortcuts(actions, show) {
|
|
6405
6460
|
const latest = useRef17(actions);
|
|
6406
6461
|
latest.current = actions;
|
|
6407
|
-
|
|
6462
|
+
useEffect19(() => {
|
|
6408
6463
|
let talking = false;
|
|
6409
6464
|
const restore = () => {
|
|
6410
6465
|
if (talking) {
|
|
@@ -6476,17 +6531,17 @@ var SpaceHeader = React14.memo((props) => {
|
|
|
6476
6531
|
const { spaceName, duration = 0, isRecording = false, layout = "focus", onLayoutChange, className, weakConnection } = props;
|
|
6477
6532
|
const remaining = props.timeLeft != null && props.timeLeft <= 600 ? props.timeLeft : null;
|
|
6478
6533
|
const timer = remaining === null ? formatDuration(duration) : `${formatDuration(remaining)} left`;
|
|
6479
|
-
const timerStyle = remaining === null ? void 0 : { color: remaining <= 60 ? "var(--chalk-danger-text)" : "var(--chalk-warning
|
|
6534
|
+
const timerStyle = remaining === null ? void 0 : { color: remaining <= 60 ? "var(--chalk-danger-text)" : "var(--chalk-warning)" };
|
|
6480
6535
|
const [sounds, setSounds] = useSoundsSetting();
|
|
6481
6536
|
const triggerRef = useRef18(null);
|
|
6482
6537
|
const focusScope = useRef18(null);
|
|
6483
|
-
const [open, setOpen] =
|
|
6484
|
-
const [dialog, setDialog] =
|
|
6485
|
-
const showShortcuts =
|
|
6538
|
+
const [open, setOpen] = useState29(false);
|
|
6539
|
+
const [dialog, setDialog] = useState29({ kind: "shortcuts", open: false });
|
|
6540
|
+
const showShortcuts = useCallback7(() => setDialog({ kind: "shortcuts", open: true }), []);
|
|
6486
6541
|
useCallShortcuts(props.shortcuts, showShortcuts);
|
|
6487
6542
|
const phone = useMediaQuery("(max-width: 640px)");
|
|
6488
6543
|
const chevron = /* @__PURE__ */ jsx52("svg", { width: phone ? "16" : "14", height: phone ? "16" : "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", "aria-hidden": "true", children: /* @__PURE__ */ jsx52("path", { d: "m6 9 6 6 6-6" }) });
|
|
6489
|
-
const trigger = /* @__PURE__ */ jsxs33("button", { ref: triggerRef, type: "button", "data-part": "call-name", "aria-label": "Call details", className: "chalk-call-name", children: [
|
|
6544
|
+
const trigger = /* @__PURE__ */ jsxs33("button", { ref: triggerRef, type: "button", "data-part": "call-name", title: spaceName, "aria-label": "Call details", className: "chalk-call-name", children: [
|
|
6490
6545
|
/* @__PURE__ */ jsx52("span", { dir: "auto", children: spaceName }),
|
|
6491
6546
|
/* @__PURE__ */ jsx52("span", { "data-part": "call-timer", className: "chalk-call-timer", style: timerStyle, children: timer }),
|
|
6492
6547
|
chevron
|
|
@@ -6510,7 +6565,7 @@ var SpaceHeader = React14.memo((props) => {
|
|
|
6510
6565
|
/* @__PURE__ */ jsx52(ShellStyles, {}),
|
|
6511
6566
|
/* @__PURE__ */ jsxs33("div", { className: "chalk-header-title flex min-w-0 items-center gap-3", children: [
|
|
6512
6567
|
phone ? /* @__PURE__ */ jsxs33(Fragment22, { children: [
|
|
6513
|
-
/* @__PURE__ */ jsxs33("button", { ref: triggerRef, type: "button", "data-call-link-trigger": true, "data-part": "call-name", className: "chalk-call-name chalk-call-name-phone", "aria-label": "Call details", "aria-haspopup": "dialog", "aria-expanded": open, onClick: () => setOpen(true), children: [
|
|
6568
|
+
/* @__PURE__ */ jsxs33("button", { ref: triggerRef, type: "button", "data-call-link-trigger": true, "data-part": "call-name", title: spaceName, className: "chalk-call-name chalk-call-name-phone", "aria-label": "Call details", "aria-haspopup": "dialog", "aria-expanded": open, onClick: () => setOpen(true), children: [
|
|
6514
6569
|
/* @__PURE__ */ jsx52("span", { dir: "auto", children: spaceName }),
|
|
6515
6570
|
chevron
|
|
6516
6571
|
] }),
|
|
@@ -6568,16 +6623,16 @@ var SpaceHeader = React14.memo((props) => {
|
|
|
6568
6623
|
SpaceHeader.displayName = "SpaceHeader";
|
|
6569
6624
|
|
|
6570
6625
|
// src/components/composite/ScreenShareView.tsx
|
|
6571
|
-
import { useEffect as
|
|
6626
|
+
import { useEffect as useEffect20, useMemo as useMemo12, useRef as useRef19, useState as useState30 } from "react";
|
|
6572
6627
|
import { Fragment as Fragment23, jsx as jsx53, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
6573
6628
|
function ScreenSharePresentation({ sharedByName, media, mediaVisible, state, isLocal = false, hasAudio = false, capture: capture2, primary = true, pinned, hidden, style, onClick, onDoubleClick, onStopSharing, onChangeShare, switcher, className }) {
|
|
6574
6629
|
const root = useRef19(null);
|
|
6575
|
-
const [fill, setFill] =
|
|
6576
|
-
const [controlsOpen, setControlsOpen] =
|
|
6577
|
-
const [poppedOut, setPoppedOut] =
|
|
6578
|
-
const [zoom, setZoom] =
|
|
6579
|
-
const [pending, setPending] =
|
|
6580
|
-
const [error, setError] =
|
|
6630
|
+
const [fill, setFill] = useState30(false);
|
|
6631
|
+
const [controlsOpen, setControlsOpen] = useState30(false);
|
|
6632
|
+
const [poppedOut, setPoppedOut] = useState30(false);
|
|
6633
|
+
const [zoom, setZoom] = useState30(false);
|
|
6634
|
+
const [pending, setPending] = useState30(false);
|
|
6635
|
+
const [error, setError] = useState30(null);
|
|
6581
6636
|
const status = state ?? (mediaVisible ? "live" : "connecting");
|
|
6582
6637
|
const name = isLocal ? "Your screen" : `${sharedByName}'s screen`;
|
|
6583
6638
|
const source = capture2?.surface === "window" ? "a window" : capture2?.surface === "browser" ? "a tab" : capture2?.surface === "monitor" ? "your screen" : null;
|
|
@@ -6593,7 +6648,7 @@ function ScreenSharePresentation({ sharedByName, media, mediaVisible, state, isL
|
|
|
6593
6648
|
setPending(false);
|
|
6594
6649
|
}
|
|
6595
6650
|
};
|
|
6596
|
-
|
|
6651
|
+
useEffect20(() => {
|
|
6597
6652
|
const video = root.current?.querySelector("video");
|
|
6598
6653
|
if (!video) return;
|
|
6599
6654
|
const entered = () => setPoppedOut(true);
|
|
@@ -6664,14 +6719,14 @@ function ScreenSharePresentation({ sharedByName, media, mediaVisible, state, isL
|
|
|
6664
6719
|
"\u2019s screen\u2026"
|
|
6665
6720
|
] })
|
|
6666
6721
|
] }) : null,
|
|
6667
|
-
status === "paused" ? /* @__PURE__ */ jsxs34("div", { role: "status", className: "pointer-events-none absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 text-
|
|
6668
|
-
/* @__PURE__ */ jsx53("span", { className: "grid h-12 w-12 place-items-center rounded-[50%] bg-[
|
|
6669
|
-
/* @__PURE__ */ jsxs34("p", { className: "rounded-[8px] bg-[
|
|
6722
|
+
status === "paused" ? /* @__PURE__ */ jsxs34("div", { role: "status", className: "pointer-events-none absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 text-[var(--chalk-on-overlay)]", children: [
|
|
6723
|
+
/* @__PURE__ */ jsx53("span", { className: "grid h-12 w-12 place-items-center rounded-[50%] bg-[var(--chalk-overlay-strong)]", children: /* @__PURE__ */ jsx53(StageIcon, { name: "pause", size: 24 }) }),
|
|
6724
|
+
/* @__PURE__ */ jsxs34("p", { className: "rounded-[8px] bg-[var(--chalk-overlay-strong)] px-3 py-1.5 font-semibold", children: [
|
|
6670
6725
|
sharedByName,
|
|
6671
6726
|
" paused sharing"
|
|
6672
6727
|
] })
|
|
6673
6728
|
] }) : null,
|
|
6674
|
-
status === "low-quality" ? /* @__PURE__ */ jsxs34("div", { role: "status", "data-part": "share-low-quality", className: "absolute top-2 left-2 z-30 flex h-7 items-center gap-2 rounded-[6px] bg-[
|
|
6729
|
+
status === "low-quality" ? /* @__PURE__ */ jsxs34("div", { role: "status", "data-part": "share-low-quality", className: "absolute top-2 left-2 z-30 flex h-7 items-center gap-2 rounded-[6px] bg-[var(--chalk-overlay-strong)] px-2.5 text-[12px] font-medium text-[var(--chalk-on-overlay)]", children: [
|
|
6675
6730
|
/* @__PURE__ */ jsx53(SignalBars, {}),
|
|
6676
6731
|
/* @__PURE__ */ jsxs34("span", { children: [
|
|
6677
6732
|
sharedByName,
|
|
@@ -6679,10 +6734,10 @@ function ScreenSharePresentation({ sharedByName, media, mediaVisible, state, isL
|
|
|
6679
6734
|
] })
|
|
6680
6735
|
] }) : null,
|
|
6681
6736
|
primary ? switcher : null,
|
|
6682
|
-
isLocal && primary ? /* @__PURE__ */ jsxs34("div", { "data-part": "share-local-overlay", role: "group", "aria-label": "Your share", className: "absolute top-2.5 right-2.5 left-2.5 z-30 flex items-center gap-2 rounded-[12px] bg-[
|
|
6737
|
+
isLocal && primary ? /* @__PURE__ */ jsxs34("div", { "data-part": "share-local-overlay", role: "group", "aria-label": "Your share", className: "absolute top-2.5 right-2.5 left-2.5 z-30 flex items-center gap-2 rounded-[12px] bg-[var(--chalk-overlay-strong)] p-2 pl-3.5 text-[var(--chalk-on-overlay)] max-[640px]:flex-wrap", children: [
|
|
6683
6738
|
/* @__PURE__ */ jsxs34("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
|
|
6684
6739
|
/* @__PURE__ */ jsx53("b", { className: "truncate font-semibold", children: source ? `You\u2019re sharing ${source}` : "You\u2019re screen sharing" }),
|
|
6685
|
-
capture2?.surface === "monitor" || capture2?.surface === "browser" ? /* @__PURE__ */ jsxs34("span", { className: "text-[12px] text-[
|
|
6740
|
+
capture2?.surface === "monitor" || capture2?.surface === "browser" ? /* @__PURE__ */ jsxs34("span", { className: "text-[12px] text-[var(--chalk-on-overlay)]", children: [
|
|
6686
6741
|
"Seeing a mirror effect? That\u2019s normal when you share ",
|
|
6687
6742
|
capture2.surface === "browser" ? "this tab" : "your whole screen",
|
|
6688
6743
|
"."
|
|
@@ -6691,7 +6746,7 @@ function ScreenSharePresentation({ sharedByName, media, mediaVisible, state, isL
|
|
|
6691
6746
|
onChangeShare ? /* @__PURE__ */ jsx53(
|
|
6692
6747
|
ChalkMenu,
|
|
6693
6748
|
{
|
|
6694
|
-
trigger: /* @__PURE__ */ jsx53(ChalkButton, { disabled: pending, className: "!h-8 !bg-
|
|
6749
|
+
trigger: /* @__PURE__ */ jsx53(ChalkButton, { disabled: pending, className: "!h-8 !bg-[var(--chalk-on-overlay)]/[.14] !px-3 !text-[var(--chalk-on-overlay)] hover:!bg-[var(--chalk-on-overlay)]/[.22]", children: "Change" }),
|
|
6695
6750
|
children: [
|
|
6696
6751
|
{ surface: "monitor", label: "Entire screen" },
|
|
6697
6752
|
{ surface: "window", label: "Window" },
|
|
@@ -6699,7 +6754,7 @@ function ScreenSharePresentation({ sharedByName, media, mediaVisible, state, isL
|
|
|
6699
6754
|
].map((option) => /* @__PURE__ */ jsx53(ChalkMenuItem, { onClick: () => void run(() => onChangeShare({ surface: option.surface, audio: option.surface === "browser" }), "screen", "start"), children: option.label }, option.surface))
|
|
6700
6755
|
}
|
|
6701
6756
|
) : null,
|
|
6702
|
-
onStopSharing ? /* @__PURE__ */ jsx53(ChalkButton, { disabled: pending, tone: "danger", className: "!h-8 !bg-[var(--chalk-danger)] !px-3 !text-
|
|
6757
|
+
onStopSharing ? /* @__PURE__ */ jsx53(ChalkButton, { disabled: pending, tone: "danger", className: "!h-8 !bg-[var(--chalk-danger)] !px-3 !text-[var(--chalk-on-overlay)] hover:!bg-[var(--chalk-danger-hover)]", onClick: () => void run(onStopSharing, "screen", "stop"), children: "Stop sharing" }) : null
|
|
6703
6758
|
] }) : null,
|
|
6704
6759
|
primary && !isLocal && status !== "connecting" ? /* @__PURE__ */ jsxs34("div", { role: "toolbar", "aria-label": "Share controls", className: cn("absolute right-2 bottom-2 z-30 flex gap-1.5 opacity-0 transition-opacity duration-150 group-hover/tile:opacity-100 focus-within:opacity-100", controlsOpen && "opacity-100"), children: [
|
|
6705
6760
|
/* @__PURE__ */ jsx53(ShareControl2, { label: fill ? "Fit the whole screen" : "Fill the tile", pressed: fill, onClick: () => setFill(!fill), children: /* @__PURE__ */ jsx53(StageIcon, { name: fill ? "fit" : "fill", size: 16 }) }),
|
|
@@ -6707,7 +6762,7 @@ function ScreenSharePresentation({ sharedByName, media, mediaVisible, state, isL
|
|
|
6707
6762
|
/* @__PURE__ */ jsx53(ShareControl2, { label: "Pop out", onClick: () => void popout(), children: /* @__PURE__ */ jsx53(StageIcon, { name: "pip", size: 16 }) }),
|
|
6708
6763
|
/* @__PURE__ */ jsx53(ShareControl2, { label: "Full screen", onClick: () => void fullscreen(), children: /* @__PURE__ */ jsx53(StageIcon, { name: "maximize", size: 16 }) })
|
|
6709
6764
|
] }) : null,
|
|
6710
|
-
error ? /* @__PURE__ */ jsx53("p", { role: "alert", className: "absolute right-2 bottom-12 left-2 z-40 rounded-md bg-[
|
|
6765
|
+
error ? /* @__PURE__ */ jsx53("p", { role: "alert", className: "absolute right-2 bottom-12 left-2 z-40 rounded-md bg-[var(--chalk-overlay-strong)] p-2 text-sm text-[var(--chalk-on-overlay)]", children: error }) : null
|
|
6711
6766
|
]
|
|
6712
6767
|
}
|
|
6713
6768
|
)
|
|
@@ -6722,7 +6777,7 @@ function ShareControl2({ label, pressed, onClick, children }) {
|
|
|
6722
6777
|
"aria-label": label,
|
|
6723
6778
|
"aria-pressed": pressed,
|
|
6724
6779
|
onClick,
|
|
6725
|
-
className: "relative grid h-8 w-8 place-items-center rounded-[50%] bg-[
|
|
6780
|
+
className: "relative grid h-8 w-8 place-items-center rounded-[50%] bg-[var(--chalk-overlay)] text-[var(--chalk-on-overlay)] outline-none hover:bg-[var(--chalk-overlay-hover)] aria-pressed:bg-[var(--chalk-on-overlay)] aria-pressed:text-[var(--chalk-overlay)] motion-safe:transition-transform motion-safe:duration-150 motion-safe:ease-[ease-out] active:scale-[.92] focus-visible:ring-2 focus-visible:ring-[var(--chalk-focus)] [@media(pointer:coarse)]:before:absolute [@media(pointer:coarse)]:before:-inset-1.5",
|
|
6726
6781
|
children
|
|
6727
6782
|
}
|
|
6728
6783
|
);
|
|
@@ -6739,7 +6794,7 @@ function ScreenShareView(props) {
|
|
|
6739
6794
|
const participantsSlice = useParticipants();
|
|
6740
6795
|
const media = useMedia();
|
|
6741
6796
|
const localId = self.participantId ?? "local";
|
|
6742
|
-
const participants =
|
|
6797
|
+
const participants = useMemo12(() => toVideoParticipants(participantsSlice.roster, media.remote, localId, self.displayName ?? "You", media.local), [localId, media.local, media.remote, participantsSlice.roster, self.displayName]);
|
|
6743
6798
|
const active = participants.find((participant) => participant.isScreenSharing && participant.screenShareTrack);
|
|
6744
6799
|
if (!active?.screenShareTrack)
|
|
6745
6800
|
return /* @__PURE__ */ jsx53("div", { className: "grid h-full place-items-center text-sm text-[var(--chalk-muted-text)]", role: "status", children: "No active screen share" });
|
|
@@ -6763,16 +6818,16 @@ function ScreenShareView(props) {
|
|
|
6763
6818
|
}
|
|
6764
6819
|
|
|
6765
6820
|
// src/components/stage/Stage.tsx
|
|
6766
|
-
import { useCallback as
|
|
6821
|
+
import { useCallback as useCallback8, useEffect as useEffect21, useLayoutEffect as useLayoutEffect5, useMemo as useMemo13, useRef as useRef22, useState as useState32 } from "react";
|
|
6767
6822
|
import { createPortal as createPortal2 } from "react-dom";
|
|
6768
6823
|
|
|
6769
6824
|
// src/components/stage/useStageDimensions.ts
|
|
6770
|
-
import { useLayoutEffect as useLayoutEffect4, useRef as useRef20, useState as
|
|
6825
|
+
import { useLayoutEffect as useLayoutEffect4, useRef as useRef20, useState as useState31 } from "react";
|
|
6771
6826
|
import { flushSync as flushSync3 } from "react-dom";
|
|
6772
6827
|
function useStageDimensions(fallback3) {
|
|
6773
6828
|
const ref = useRef20(null);
|
|
6774
6829
|
const current = useRef20(fallback3);
|
|
6775
|
-
const [dimensions, setDimensions] =
|
|
6830
|
+
const [dimensions, setDimensions] = useState31(fallback3);
|
|
6776
6831
|
useLayoutEffect4(() => {
|
|
6777
6832
|
const element = ref.current;
|
|
6778
6833
|
if (!element || typeof ResizeObserver === "undefined") return;
|
|
@@ -6968,7 +7023,7 @@ function createContentPlacement() {
|
|
|
6968
7023
|
};
|
|
6969
7024
|
}
|
|
6970
7025
|
function PersistentStageContent({ placement, children }) {
|
|
6971
|
-
const [host, setHost] =
|
|
7026
|
+
const [host, setHost] = useState32(null);
|
|
6972
7027
|
useLayoutEffect5(() => {
|
|
6973
7028
|
const element = document.createElement("div");
|
|
6974
7029
|
Object.assign(element.style, TILE_FILL);
|
|
@@ -7011,16 +7066,16 @@ function Stage({
|
|
|
7011
7066
|
}) {
|
|
7012
7067
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
7013
7068
|
const { ref: boxRef, dimensions: box } = useStageDimensions(FALLBACK_BOX);
|
|
7014
|
-
const [overflowOpen, setOverflowOpen] =
|
|
7015
|
-
const [shareAspects, setShareAspects] =
|
|
7016
|
-
const [uncontrolledPinnedId, setUncontrolledPinnedId] =
|
|
7069
|
+
const [overflowOpen, setOverflowOpen] = useState32(false);
|
|
7070
|
+
const [shareAspects, setShareAspects] = useState32(/* @__PURE__ */ new Map());
|
|
7071
|
+
const [uncontrolledPinnedId, setUncontrolledPinnedId] = useState32(null);
|
|
7017
7072
|
const activePinnedId = pinnedId === void 0 ? uncontrolledPinnedId : pinnedId;
|
|
7018
7073
|
const orderRef = useRef22([]);
|
|
7019
7074
|
const seenAtRef = useRef22(/* @__PURE__ */ new Map());
|
|
7020
7075
|
const nextSeenRef = useRef22(0);
|
|
7021
7076
|
const lastSpeakerRef = useRef22(null);
|
|
7022
7077
|
const lastRemoteSpeakerRef = useRef22(null);
|
|
7023
|
-
const ordered =
|
|
7078
|
+
const ordered = useMemo13(() => {
|
|
7024
7079
|
if (!interactive) {
|
|
7025
7080
|
seenAtRef.current = new Map(items.map((item, index) => [item.id, index]));
|
|
7026
7081
|
nextSeenRef.current = items.length;
|
|
@@ -7033,21 +7088,21 @@ function Stage({
|
|
|
7033
7088
|
return stabilizeOrder(orderRef.current, items);
|
|
7034
7089
|
}, [interactive, items]);
|
|
7035
7090
|
const handOrderRef = useRef22([]);
|
|
7036
|
-
const handOrders =
|
|
7091
|
+
const handOrders = useMemo13(() => {
|
|
7037
7092
|
const raised = ordered.filter((item) => item.kind === "participant" && item.participant.isHandRaised).map((item) => item.id);
|
|
7038
7093
|
const survivors = handOrderRef.current.filter((id) => raised.includes(id));
|
|
7039
7094
|
const next = [...survivors, ...raised.filter((id) => !survivors.includes(id))];
|
|
7040
7095
|
handOrderRef.current = next;
|
|
7041
7096
|
return new Map(next.map((id, index) => [id, index + 1]));
|
|
7042
7097
|
}, [ordered]);
|
|
7043
|
-
|
|
7098
|
+
useEffect21(() => {
|
|
7044
7099
|
orderRef.current = ordered.map((item) => item.id);
|
|
7045
7100
|
const speaking = speakingParticipantId(ordered);
|
|
7046
7101
|
if (speaking) lastSpeakerRef.current = speaking;
|
|
7047
7102
|
lastRemoteSpeakerRef.current = floatingSpeakerId(ordered, lastRemoteSpeakerRef.current);
|
|
7048
7103
|
}, [ordered]);
|
|
7049
|
-
const primary =
|
|
7050
|
-
const geometry =
|
|
7104
|
+
const primary = useMemo13(() => layout === "grid" ? null : choosePrimary(ordered, { layout, pinnedId: activePinnedId, lastSpeakerId: interactive ? lastSpeakerRef.current : null, seenAt: seenAtRef.current }), [activePinnedId, interactive, layout, ordered]);
|
|
7105
|
+
const geometry = useMemo13(() => {
|
|
7051
7106
|
if (!ordered.length) return EMPTY_GEOMETRY;
|
|
7052
7107
|
const wideIds = ordered.filter(isContentItem).map((item) => item.id);
|
|
7053
7108
|
if (layout === "grid" || !primary) {
|
|
@@ -7085,7 +7140,7 @@ function Stage({
|
|
|
7085
7140
|
}
|
|
7086
7141
|
);
|
|
7087
7142
|
}, [activePinnedId, box, interactive, layout, maxPerPage, minTileWidth, ordered, primary, shareAspects]);
|
|
7088
|
-
const framesById =
|
|
7143
|
+
const framesById = useMemo13(() => new Map(geometry.frames.map((frame) => [frame.id, frame])), [geometry.frames]);
|
|
7089
7144
|
const foldedContent = ordered.filter((item) => item.kind !== "participant" && !framesById.has(item.id));
|
|
7090
7145
|
const renderContent = (item, context, primaryRenderer) => {
|
|
7091
7146
|
if (primaryRenderer && renderPrimaryContent) return /* @__PURE__ */ jsx56(StageContentTileSurface, { item, ...context, mediaVisible: true, media: renderPrimaryContent(item) });
|
|
@@ -7094,7 +7149,7 @@ function Stage({
|
|
|
7094
7149
|
return /* @__PURE__ */ jsx56(StageContentTile, { item, ...context });
|
|
7095
7150
|
};
|
|
7096
7151
|
const animate = animateOverride ?? !prefersReducedMotion;
|
|
7097
|
-
const [displayed, setDisplayed] =
|
|
7152
|
+
const [displayed, setDisplayed] = useState32({
|
|
7098
7153
|
source: ordered,
|
|
7099
7154
|
geometry,
|
|
7100
7155
|
tiles: ordered.map((item) => ({ item, frame: framesById.get(item.id), leaving: false }))
|
|
@@ -7113,11 +7168,11 @@ function Stage({
|
|
|
7113
7168
|
}
|
|
7114
7169
|
return placement;
|
|
7115
7170
|
};
|
|
7116
|
-
|
|
7171
|
+
useEffect21(() => {
|
|
7117
7172
|
const present = new Set(displayed.tiles.map(({ item }) => item.id));
|
|
7118
7173
|
for (const id of contentPlacements.current.keys()) if (!present.has(id)) contentPlacements.current.delete(id);
|
|
7119
7174
|
}, [displayed.tiles]);
|
|
7120
|
-
|
|
7175
|
+
useEffect21(() => {
|
|
7121
7176
|
const departing = displayed.tiles.filter((tile) => tile.leaving);
|
|
7122
7177
|
if (!departing.length) return;
|
|
7123
7178
|
const nextExpiry = Math.min(...departing.map((tile) => (tile.departedAt ?? 0) + 160));
|
|
@@ -7125,7 +7180,7 @@ function Stage({
|
|
|
7125
7180
|
return () => clearTimeout(timer);
|
|
7126
7181
|
}, [displayed]);
|
|
7127
7182
|
const tilesRef = useRef22(null);
|
|
7128
|
-
|
|
7183
|
+
useEffect21(() => {
|
|
7129
7184
|
const root = tilesRef.current;
|
|
7130
7185
|
if (!root) return;
|
|
7131
7186
|
const updateAspect = (event) => {
|
|
@@ -7146,7 +7201,7 @@ function Stage({
|
|
|
7146
7201
|
};
|
|
7147
7202
|
}, [ordered]);
|
|
7148
7203
|
const motionKey = displayed.tiles.map(({ item, frame, leaving }) => `${item.id}:${frame?.x},${frame?.y},${frame?.width},${frame?.height}:${leaving}`).join(";") + geometry.frames.filter((frame) => frame.id === MORE_TILE_ID).map((frame) => `${frame.x},${frame.y},${frame.width},${frame.height}`).join(";");
|
|
7149
|
-
const togglePin =
|
|
7204
|
+
const togglePin = useCallback8(
|
|
7150
7205
|
(item) => {
|
|
7151
7206
|
const next = activePinnedId === item.id && !(layout === "grid" && isContentItem(item)) ? null : item.id;
|
|
7152
7207
|
if (pinnedId === void 0) setUncontrolledPinnedId(next);
|
|
@@ -7154,7 +7209,7 @@ function Stage({
|
|
|
7154
7209
|
},
|
|
7155
7210
|
[activePinnedId, layout, onPinnedChange, pinnedId]
|
|
7156
7211
|
);
|
|
7157
|
-
const handlersById =
|
|
7212
|
+
const handlersById = useMemo13(() => {
|
|
7158
7213
|
const map = /* @__PURE__ */ new Map();
|
|
7159
7214
|
if (!interactive) return map;
|
|
7160
7215
|
for (const item of ordered) {
|
|
@@ -7265,7 +7320,7 @@ function Stage({
|
|
|
7265
7320
|
Stage.displayName = "Stage";
|
|
7266
7321
|
|
|
7267
7322
|
// src/components/participant-grid/ParticipantGrid.tsx
|
|
7268
|
-
import React19, { useMemo as
|
|
7323
|
+
import React19, { useMemo as useMemo14 } from "react";
|
|
7269
7324
|
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
7270
7325
|
var MIN_TILE_WIDTH = { desktop: 150, mobile: 88 };
|
|
7271
7326
|
function ParticipantGrid(props) {
|
|
@@ -7273,7 +7328,7 @@ function ParticipantGrid(props) {
|
|
|
7273
7328
|
const participantsSlice = useParticipants();
|
|
7274
7329
|
const media = useMedia();
|
|
7275
7330
|
const localId = self.participantId ?? "local";
|
|
7276
|
-
const participants =
|
|
7331
|
+
const participants = useMemo14(() => {
|
|
7277
7332
|
const hasLocalPresence = Boolean(self.participantId || self.displayName || Object.values(media.local).some((track) => track.state !== "disabled"));
|
|
7278
7333
|
return hasLocalPresence ? toVideoParticipants(participantsSlice.roster, media.remote, localId, self.displayName ?? "You", media.local) : [];
|
|
7279
7334
|
}, [localId, media.local, media.remote, participantsSlice.roster, self.displayName, self.participantId]);
|
|
@@ -7282,7 +7337,7 @@ function ParticipantGrid(props) {
|
|
|
7282
7337
|
var ParticipantGridSurface = React19.memo(function ParticipantGridSurface2({ participants, layout = "grid", variant, pinnedParticipantId, onOverflowClick, onParticipantClick, onParticipantDoubleClick, maxVisibleParticipants, className, screenShareContent }) {
|
|
7283
7338
|
const isMobile = useIsMobile();
|
|
7284
7339
|
const effectiveVariant = variant ?? (isMobile ? "mobile" : "desktop");
|
|
7285
|
-
const items =
|
|
7340
|
+
const items = useMemo14(() => buildStageItems(participants, false), [participants]);
|
|
7286
7341
|
return /* @__PURE__ */ jsx57(
|
|
7287
7342
|
Stage,
|
|
7288
7343
|
{
|
|
@@ -7345,7 +7400,7 @@ var WhiteboardView = memo2(WhiteboardViewBase);
|
|
|
7345
7400
|
WhiteboardView.displayName = "WhiteboardView";
|
|
7346
7401
|
|
|
7347
7402
|
// src/components/call-card/CallCard.tsx
|
|
7348
|
-
import { useEffect as
|
|
7403
|
+
import { useEffect as useEffect22, useId as useId2, useRef as useRef23 } from "react";
|
|
7349
7404
|
import { Fragment as Fragment26, jsx as jsx59, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
7350
7405
|
function CallCard({ state, onClose, interactive = true, children, panel, onPanelChange, peopleCount, chatEnabled = true, participantsEnabled = true }) {
|
|
7351
7406
|
const phone = useIsMobile();
|
|
@@ -7356,14 +7411,14 @@ function CallCard({ state, onClose, interactive = true, children, panel, onPanel
|
|
|
7356
7411
|
const selected = panel === "chat" ? "chat" : "participants";
|
|
7357
7412
|
const drawerRef = useRef23(null);
|
|
7358
7413
|
const openerRef = useRef23(null);
|
|
7359
|
-
|
|
7414
|
+
useEffect22(() => {
|
|
7360
7415
|
if (!interactive || state !== "open") return;
|
|
7361
7416
|
const drawer = drawerRef.current;
|
|
7362
7417
|
if (!drawer || drawer.contains(document.activeElement)) return;
|
|
7363
7418
|
openerRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
7364
7419
|
drawer.focus({ preventScroll: true });
|
|
7365
7420
|
}, [interactive, state]);
|
|
7366
|
-
|
|
7421
|
+
useEffect22(() => {
|
|
7367
7422
|
if (!interactive || state !== "closing") return;
|
|
7368
7423
|
const opener = openerRef.current;
|
|
7369
7424
|
openerRef.current = null;
|
|
@@ -7461,7 +7516,7 @@ function SpacePresentation({ colorScheme = "dark", stageBackground, header, stag
|
|
|
7461
7516
|
// src/components/space-view/SpaceView.tsx
|
|
7462
7517
|
import "@q9labsai/chalk-client";
|
|
7463
7518
|
import { DEFAULT_QUICK_REACTIONS as DEFAULT_QUICK_REACTIONS2 } from "@q9labsai/chalk-ui/reactions";
|
|
7464
|
-
import { useCallback as
|
|
7519
|
+
import { useCallback as useCallback15, useEffect as useEffect32, useMemo as useMemo19, useRef as useRef29, useState as useState43 } from "react";
|
|
7465
7520
|
|
|
7466
7521
|
// src/components/space-header/call-diagnostics.ts
|
|
7467
7522
|
function callDiagnostics(connection, media) {
|
|
@@ -7492,12 +7547,12 @@ function callCountdown(deadline, now, previousSeconds) {
|
|
|
7492
7547
|
}
|
|
7493
7548
|
|
|
7494
7549
|
// src/internal/useEpisodeDuration.ts
|
|
7495
|
-
import { useEffect as
|
|
7550
|
+
import { useEffect as useEffect23, useState as useState33 } from "react";
|
|
7496
7551
|
function useEpisodeDuration() {
|
|
7497
7552
|
const connection = useConnection();
|
|
7498
7553
|
const episodeStart = connection.episode?.startedAt ? Date.parse(connection.episode.startedAt) : null;
|
|
7499
|
-
const [now, setNow] =
|
|
7500
|
-
|
|
7554
|
+
const [now, setNow] = useState33(() => Date.now());
|
|
7555
|
+
useEffect23(() => {
|
|
7501
7556
|
if (episodeStart === null || Number.isNaN(episodeStart)) return;
|
|
7502
7557
|
setNow(Date.now());
|
|
7503
7558
|
const timer = window.setInterval(() => setNow(Date.now()), 1e3);
|
|
@@ -7508,7 +7563,7 @@ function useEpisodeDuration() {
|
|
|
7508
7563
|
}
|
|
7509
7564
|
|
|
7510
7565
|
// src/internal/useSoundCues.ts
|
|
7511
|
-
import { useCallback as
|
|
7566
|
+
import { useCallback as useCallback9, useEffect as useEffect24, useRef as useRef25 } from "react";
|
|
7512
7567
|
|
|
7513
7568
|
// src/internal/sound-cues.ts
|
|
7514
7569
|
function idsOf(items, id) {
|
|
@@ -7666,7 +7721,7 @@ function useSoundCues(enabled, createPlayer = createSoundPlayer) {
|
|
|
7666
7721
|
createPlayerRef.current = createPlayer;
|
|
7667
7722
|
const pendingFailures = useRef25(/* @__PURE__ */ new Set());
|
|
7668
7723
|
const failureTurn = useRef25(void 0);
|
|
7669
|
-
const playFailure =
|
|
7724
|
+
const playFailure = useCallback9((failure) => {
|
|
7670
7725
|
const key = JSON.stringify([failure.code, failure.message, failure.recoverable]);
|
|
7671
7726
|
if (!enabledRef.current || pendingFailures.current.has(key)) return;
|
|
7672
7727
|
pendingFailures.current.add(key);
|
|
@@ -7677,7 +7732,7 @@ function useSoundCues(enabled, createPlayer = createSoundPlayer) {
|
|
|
7677
7732
|
failureTurn.current = void 0;
|
|
7678
7733
|
}, 0);
|
|
7679
7734
|
}, []);
|
|
7680
|
-
|
|
7735
|
+
useEffect24(() => {
|
|
7681
7736
|
const player = createPlayerRef.current({ outputDeviceId });
|
|
7682
7737
|
playerRef.current = player;
|
|
7683
7738
|
let previous = client.getSnapshot();
|
|
@@ -7709,7 +7764,7 @@ function useSoundCues(enabled, createPlayer = createSoundPlayer) {
|
|
|
7709
7764
|
pendingFailures.current.clear();
|
|
7710
7765
|
};
|
|
7711
7766
|
}, [client, outputDeviceId, playFailure]);
|
|
7712
|
-
return
|
|
7767
|
+
return useCallback9(
|
|
7713
7768
|
(cue, failure) => {
|
|
7714
7769
|
if (cue === "error" && failure) return playFailure(failure);
|
|
7715
7770
|
if (enabledRef.current) playerRef.current?.play(cue);
|
|
@@ -7719,14 +7774,14 @@ function useSoundCues(enabled, createPlayer = createSoundPlayer) {
|
|
|
7719
7774
|
}
|
|
7720
7775
|
|
|
7721
7776
|
// src/components/composite/ReactionPicker.tsx
|
|
7722
|
-
import React21, { useMemo as
|
|
7777
|
+
import React21, { useMemo as useMemo15, useState as useState35, useCallback as useCallback11, useEffect as useEffect26, useRef as useRef27 } from "react";
|
|
7723
7778
|
import { DEFAULT_QUICK_REACTIONS, EMOJI_CATEGORIES, EMOJI_KEYWORDS } from "@q9labsai/chalk-ui/reactions";
|
|
7724
7779
|
|
|
7725
7780
|
// src/components/composite/ReactionTray.tsx
|
|
7726
|
-
import { useCallback as
|
|
7781
|
+
import { useCallback as useCallback10, useEffect as useEffect25, useLayoutEffect as useLayoutEffect6, useRef as useRef26, useState as useState34 } from "react";
|
|
7727
7782
|
import { Fragment as Fragment27, jsx as jsx61, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
7728
7783
|
function ReactionTray({ isHandRaised, onToggleHandRaise, reactions, onSelect, onClose, position = "top", className }) {
|
|
7729
|
-
const [more, setMore] =
|
|
7784
|
+
const [more, setMore] = useState34(false);
|
|
7730
7785
|
const returnFocus = useRef26(null);
|
|
7731
7786
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
7732
7787
|
const { trigger } = useHaptics();
|
|
@@ -7763,14 +7818,14 @@ function ReactionTray({ isHandRaised, onToggleHandRaise, reactions, onSelect, on
|
|
|
7763
7818
|
if (returnFocus.current instanceof HTMLElement && returnFocus.current.isConnected) returnFocus.current.focus();
|
|
7764
7819
|
};
|
|
7765
7820
|
}, [position]);
|
|
7766
|
-
|
|
7821
|
+
useEffect25(() => {
|
|
7767
7822
|
const handleKeyDown2 = (event) => {
|
|
7768
7823
|
if (event.key === "Escape") onClose();
|
|
7769
7824
|
};
|
|
7770
7825
|
document.addEventListener("keydown", handleKeyDown2);
|
|
7771
7826
|
return () => document.removeEventListener("keydown", handleKeyDown2);
|
|
7772
7827
|
}, [onClose]);
|
|
7773
|
-
const handleSelect =
|
|
7828
|
+
const handleSelect = useCallback10(
|
|
7774
7829
|
(emoji) => {
|
|
7775
7830
|
void trigger("success");
|
|
7776
7831
|
onSelect(emoji);
|
|
@@ -7811,18 +7866,19 @@ import { Fragment as Fragment28, jsx as jsx62, jsxs as jsxs40 } from "react/jsx-
|
|
|
7811
7866
|
var ReactionPicker = React21.memo(({ isHandRaised, onToggleHandRaise, isOpen, onClose, onSelect, recentReactions = [], allowedReactions, position = "top", participantColorSeed, participantGradientPreference, className, size = "default" }) => {
|
|
7812
7867
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
7813
7868
|
const { trigger } = useHaptics();
|
|
7814
|
-
const [activeCategory, setActiveCategory] =
|
|
7815
|
-
const [searchQuery, setSearchQuery] =
|
|
7869
|
+
const [activeCategory, setActiveCategory] = useState35("smileys");
|
|
7870
|
+
const [searchQuery, setSearchQuery] = useState35("");
|
|
7816
7871
|
const inputRef = useRef27(null);
|
|
7817
|
-
const themeVariables =
|
|
7818
|
-
|
|
7872
|
+
const themeVariables = useMemo15(() => getParticipantThemeVariables(participantColorSeed, participantGradientPreference), [participantColorSeed, participantGradientPreference]);
|
|
7873
|
+
useEffect26(() => {
|
|
7819
7874
|
if (isOpen) {
|
|
7820
|
-
setTimeout(() => inputRef.current?.focus(), 50);
|
|
7875
|
+
const timer = setTimeout(() => inputRef.current?.focus(), 50);
|
|
7821
7876
|
setSearchQuery("");
|
|
7822
7877
|
setActiveCategory("smileys");
|
|
7878
|
+
return () => clearTimeout(timer);
|
|
7823
7879
|
}
|
|
7824
7880
|
}, [isOpen]);
|
|
7825
|
-
const handleSelect =
|
|
7881
|
+
const handleSelect = useCallback11(
|
|
7826
7882
|
(emoji) => {
|
|
7827
7883
|
void trigger("success");
|
|
7828
7884
|
onSelect(emoji);
|
|
@@ -7830,7 +7886,7 @@ var ReactionPicker = React21.memo(({ isHandRaised, onToggleHandRaise, isOpen, on
|
|
|
7830
7886
|
},
|
|
7831
7887
|
[onClose, onSelect, trigger]
|
|
7832
7888
|
);
|
|
7833
|
-
|
|
7889
|
+
useEffect26(() => {
|
|
7834
7890
|
if (!isOpen || typeof window === "undefined") return;
|
|
7835
7891
|
const handleKeyDown = (e) => {
|
|
7836
7892
|
if (e.key === "Escape") onClose();
|
|
@@ -7842,7 +7898,7 @@ var ReactionPicker = React21.memo(({ isHandRaised, onToggleHandRaise, isOpen, on
|
|
|
7842
7898
|
const categories = Object.entries(EMOJI_CATEGORIES);
|
|
7843
7899
|
const isSearching = searchQuery.trim() !== "";
|
|
7844
7900
|
const query = searchQuery.toLowerCase().trim();
|
|
7845
|
-
const searchResults =
|
|
7901
|
+
const searchResults = useMemo15(() => {
|
|
7846
7902
|
if (!isSearching) return [];
|
|
7847
7903
|
const results = [];
|
|
7848
7904
|
for (const [emoji, keywords] of Object.entries(EMOJI_KEYWORDS)) {
|
|
@@ -7969,7 +8025,7 @@ var ReactionPicker = React21.memo(({ isHandRaised, onToggleHandRaise, isOpen, on
|
|
|
7969
8025
|
ReactionPicker.displayName = "ReactionPicker";
|
|
7970
8026
|
|
|
7971
8027
|
// src/components/offline-actions/OfflineActions.tsx
|
|
7972
|
-
import { useEffect as
|
|
8028
|
+
import { useEffect as useEffect27, useState as useState36, useSyncExternalStore as useSyncExternalStore5 } from "react";
|
|
7973
8029
|
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
7974
8030
|
var RECONNECTING_GRACE_MS = 2e3;
|
|
7975
8031
|
function offlineNoticeText(pendingCount, online) {
|
|
@@ -7981,10 +8037,10 @@ function OfflineActions({ reconnecting: requestedReconnecting = false, hasNotice
|
|
|
7981
8037
|
const client = useSpaceClient();
|
|
7982
8038
|
const connection = useConnection();
|
|
7983
8039
|
const offline = useOffline();
|
|
7984
|
-
const online =
|
|
8040
|
+
const online = useSyncExternalStore5(subscribeToOnline, readOnline, () => true);
|
|
7985
8041
|
const reconnecting = requestedReconnecting || connection.status === "reconnecting";
|
|
7986
8042
|
const reconnectingNoticeDue = useTrueFor(reconnecting, RECONNECTING_GRACE_MS);
|
|
7987
|
-
|
|
8043
|
+
useEffect27(() => {
|
|
7988
8044
|
void client.offline.setPolicy("send");
|
|
7989
8045
|
}, [client]);
|
|
7990
8046
|
const count = offline.pending.length;
|
|
@@ -7997,8 +8053,8 @@ function OfflineActions({ reconnecting: requestedReconnecting = false, hasNotice
|
|
|
7997
8053
|
return null;
|
|
7998
8054
|
}
|
|
7999
8055
|
function useTrueFor(value, milliseconds) {
|
|
8000
|
-
const [elapsed, setElapsed] =
|
|
8001
|
-
|
|
8056
|
+
const [elapsed, setElapsed] = useState36(false);
|
|
8057
|
+
useEffect27(() => {
|
|
8002
8058
|
setElapsed(false);
|
|
8003
8059
|
if (!value) return;
|
|
8004
8060
|
const timer = setTimeout(() => setElapsed(true), milliseconds);
|
|
@@ -8019,13 +8075,13 @@ function readOnline() {
|
|
|
8019
8075
|
}
|
|
8020
8076
|
|
|
8021
8077
|
// src/components/reconnecting-overlay/ReconnectingOverlay.tsx
|
|
8022
|
-
import { memo as memo3, useEffect as
|
|
8078
|
+
import { memo as memo3, useEffect as useEffect28, useState as useState37 } from "react";
|
|
8023
8079
|
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
8024
8080
|
var RECONNECTING_NOTICE_MS = 2e3;
|
|
8025
8081
|
var ReconnectingOverlay = memo3(function ReconnectingOverlay2({ isVisible, status, onRetry, onLeft, message, showNotice }) {
|
|
8026
8082
|
const reconnecting = isVisible && status === "reconnecting";
|
|
8027
|
-
const [elapsed, setElapsed] =
|
|
8028
|
-
|
|
8083
|
+
const [elapsed, setElapsed] = useState37(false);
|
|
8084
|
+
useEffect28(() => {
|
|
8029
8085
|
setElapsed(false);
|
|
8030
8086
|
if (!reconnecting) return;
|
|
8031
8087
|
const timer = setTimeout(() => setElapsed(true), RECONNECTING_NOTICE_MS);
|
|
@@ -8039,7 +8095,7 @@ var ReconnectingOverlay = memo3(function ReconnectingOverlay2({ isVisible, statu
|
|
|
8039
8095
|
});
|
|
8040
8096
|
|
|
8041
8097
|
// src/components/toast-stack/useCallToasts.ts
|
|
8042
|
-
import { useCallback as
|
|
8098
|
+
import { useCallback as useCallback12, useEffect as useEffect29, useRef as useRef28, useState as useState38 } from "react";
|
|
8043
8099
|
|
|
8044
8100
|
// src/components/toast-stack/call-events.tsx
|
|
8045
8101
|
import { Fragment as Fragment29, jsx as jsx65, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
@@ -8136,9 +8192,9 @@ function callEventToasts(previous, next) {
|
|
|
8136
8192
|
// src/components/toast-stack/useCallToasts.ts
|
|
8137
8193
|
function useCallToasts() {
|
|
8138
8194
|
const client = useSpaceClient();
|
|
8139
|
-
const [toasts, setToasts] =
|
|
8195
|
+
const [toasts, setToasts] = useState38([]);
|
|
8140
8196
|
const sequence = useRef28(0);
|
|
8141
|
-
|
|
8197
|
+
useEffect29(() => {
|
|
8142
8198
|
setToasts([]);
|
|
8143
8199
|
let previous = client.getSnapshot();
|
|
8144
8200
|
let failedSource;
|
|
@@ -8171,26 +8227,28 @@ function useCallToasts() {
|
|
|
8171
8227
|
offError();
|
|
8172
8228
|
};
|
|
8173
8229
|
}, [client]);
|
|
8174
|
-
const dismiss =
|
|
8175
|
-
const dismissFailure =
|
|
8230
|
+
const dismiss = useCallback12((id) => setToasts((current) => current.filter((toast) => toast.id !== id)), []);
|
|
8231
|
+
const dismissFailure = useCallback12((code) => setToasts((current) => current.filter((toast) => toast.failureCode !== code)), []);
|
|
8176
8232
|
return { toasts, dismiss, dismissFailure };
|
|
8177
8233
|
}
|
|
8178
8234
|
|
|
8179
8235
|
// src/components/call-limbo/useCallLink.ts
|
|
8180
|
-
import {
|
|
8236
|
+
import { useState as useState39 } from "react";
|
|
8181
8237
|
function useCallLink(alone) {
|
|
8182
|
-
const [open, setOpen] =
|
|
8183
|
-
|
|
8238
|
+
const [open, setOpen] = useState39(alone);
|
|
8239
|
+
const [wasAlone, setWasAlone] = useState39(alone);
|
|
8240
|
+
if (wasAlone !== alone) {
|
|
8241
|
+
setWasAlone(alone);
|
|
8184
8242
|
if (!alone) setOpen(false);
|
|
8185
|
-
}
|
|
8243
|
+
}
|
|
8186
8244
|
return { open, toggle: () => setOpen((current) => !current), close: () => setOpen(false) };
|
|
8187
8245
|
}
|
|
8188
8246
|
|
|
8189
8247
|
// src/components/toast-stack/NoticeButton.tsx
|
|
8190
|
-
import { useState as
|
|
8248
|
+
import { useState as useState40 } from "react";
|
|
8191
8249
|
import { jsx as jsx66, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
8192
8250
|
function NoticeButton({ toasts, onDismiss }) {
|
|
8193
|
-
const [open, setOpen] =
|
|
8251
|
+
const [open, setOpen] = useState40(false);
|
|
8194
8252
|
if (toasts.length === 0) return null;
|
|
8195
8253
|
const label = toasts.length === 1 ? "1 notice" : `${toasts.length} notices`;
|
|
8196
8254
|
const trigger = /* @__PURE__ */ jsxs42("button", { type: "button", "data-part": "notice-button", className: "chalk-notice-button", "aria-label": `Show ${label}`, children: [
|
|
@@ -8212,13 +8270,13 @@ function NoticeButton({ toasts, onDismiss }) {
|
|
|
8212
8270
|
import { BoardToastContext as BoardToastContext2 } from "@q9labsai/chalk-whiteboard/react";
|
|
8213
8271
|
|
|
8214
8272
|
// src/components/stage/SpaceStage.tsx
|
|
8215
|
-
import { useCallback as
|
|
8273
|
+
import { useCallback as useCallback14, useEffect as useEffect30, useMemo as useMemo18, useState as useState41 } from "react";
|
|
8216
8274
|
|
|
8217
8275
|
// src/components/board/Board.tsx
|
|
8218
|
-
import { useContext as useContext3, useMemo as
|
|
8276
|
+
import { useContext as useContext3, useMemo as useMemo17 } from "react";
|
|
8219
8277
|
|
|
8220
8278
|
// src/components/board/board-draw-policy.ts
|
|
8221
|
-
import { useCallback as
|
|
8279
|
+
import { useCallback as useCallback13, useMemo as useMemo16 } from "react";
|
|
8222
8280
|
function useWhoCanDraw(toast) {
|
|
8223
8281
|
const client = useSpaceClient();
|
|
8224
8282
|
const isHost = useCan("manageWhiteboard");
|
|
@@ -8226,7 +8284,7 @@ function useWhoCanDraw(toast) {
|
|
|
8226
8284
|
const { roster } = useParticipants();
|
|
8227
8285
|
const { access } = useWhiteboard();
|
|
8228
8286
|
const transport = client.whiteboard.transport();
|
|
8229
|
-
const people =
|
|
8287
|
+
const people = useMemo16(
|
|
8230
8288
|
() => roster.filter((person) => person.participantId !== self.participantId && !person.capabilities.includes("manageWhiteboard")).map((person) => ({
|
|
8231
8289
|
id: person.participantId,
|
|
8232
8290
|
name: person.displayName,
|
|
@@ -8234,13 +8292,13 @@ function useWhoCanDraw(toast) {
|
|
|
8234
8292
|
})),
|
|
8235
8293
|
[roster, self.participantId, access.permissions]
|
|
8236
8294
|
);
|
|
8237
|
-
const onPolicy =
|
|
8295
|
+
const onPolicy = useCallback13(
|
|
8238
8296
|
(policy) => {
|
|
8239
8297
|
transport?.setDrawPolicy?.(policy).catch(() => toast({ type: "error", message: "Could not change who can draw. Try again." }));
|
|
8240
8298
|
},
|
|
8241
8299
|
[transport, toast]
|
|
8242
8300
|
);
|
|
8243
|
-
const onPick =
|
|
8301
|
+
const onPick = useCallback13(
|
|
8244
8302
|
(id, picked) => {
|
|
8245
8303
|
transport?.setDrawPermission(id, picked).catch(() => toast({ type: "error", message: "Could not change who can draw. Try again." }));
|
|
8246
8304
|
},
|
|
@@ -8261,7 +8319,7 @@ function Board(props) {
|
|
|
8261
8319
|
const boardSession = useWhiteboard().engine;
|
|
8262
8320
|
const self = useSelf();
|
|
8263
8321
|
const { roster } = useParticipants();
|
|
8264
|
-
const participantIds =
|
|
8322
|
+
const participantIds = useMemo17(() => roster.map((person) => person.participantId), [roster]);
|
|
8265
8323
|
const whoCanDraw = useWhoCanDraw(useContext3(BoardToastContext));
|
|
8266
8324
|
return /* @__PURE__ */ jsx67(
|
|
8267
8325
|
SharedBoard,
|
|
@@ -8283,33 +8341,35 @@ function Board(props) {
|
|
|
8283
8341
|
// src/components/stage/SpaceStage.tsx
|
|
8284
8342
|
import { jsx as jsx68 } from "react/jsx-runtime";
|
|
8285
8343
|
function SpaceStage({ pinnedId, onPinnedChange, tiles, layout, onLayoutChange, generatedAvatars = true, whiteboard, onOverflowClick, shareCapture, onStopSharing, onChangeShare, colorScheme = "dark", onCloseBoard, className }) {
|
|
8286
|
-
const items =
|
|
8287
|
-
const [selectedShare, setSelectedShare] =
|
|
8288
|
-
const [localPin, setLocalPin] =
|
|
8344
|
+
const items = useMemo18(() => buildStageItems(tiles, whiteboard?.isOpen === true), [tiles, whiteboard?.isOpen]);
|
|
8345
|
+
const [selectedShare, setSelectedShare] = useState41(null);
|
|
8346
|
+
const [localPin, setLocalPin] = useState41(null);
|
|
8289
8347
|
const pin = pinnedId === void 0 ? localPin : pinnedId;
|
|
8290
|
-
const setPin =
|
|
8348
|
+
const setPin = useCallback14(
|
|
8291
8349
|
(id) => {
|
|
8292
8350
|
setLocalPin(id);
|
|
8293
8351
|
onPinnedChange?.(id);
|
|
8294
8352
|
},
|
|
8295
8353
|
[onPinnedChange]
|
|
8296
8354
|
);
|
|
8297
|
-
const [following, setFollowing] =
|
|
8355
|
+
const [following, setFollowing] = useState41(void 0);
|
|
8298
8356
|
const boardOpen = whiteboard?.isOpen === true && Boolean(whiteboard.props);
|
|
8299
|
-
|
|
8357
|
+
const [wasBoardOpen, setWasBoardOpen] = useState41(boardOpen);
|
|
8358
|
+
if (wasBoardOpen !== boardOpen) {
|
|
8359
|
+
setWasBoardOpen(boardOpen);
|
|
8300
8360
|
if (!boardOpen) setFollowing(void 0);
|
|
8301
|
-
}
|
|
8361
|
+
}
|
|
8302
8362
|
const canFollow = boardOpen && Boolean(whiteboard?.sendView);
|
|
8303
8363
|
const target = following === void 0 ? whiteboard?.presenterId : following;
|
|
8304
8364
|
const followed = canFollow && tiles.some((tile) => tile.id === target && !tile.isLocal) ? target ?? null : null;
|
|
8305
8365
|
const activePin = items.some((item) => item.id === pin) ? pin : null;
|
|
8306
8366
|
const shares = items.filter((item) => item.kind === "screen-share");
|
|
8307
8367
|
const activeShare = selectedShare && shares.some((item) => item.id === selectedShare) ? selectedShare : null;
|
|
8308
|
-
|
|
8368
|
+
useEffect30(() => {
|
|
8309
8369
|
if (pin !== activePin) setPin(activePin);
|
|
8310
8370
|
if (selectedShare !== activeShare) setSelectedShare(activeShare);
|
|
8311
8371
|
}, [pin, activePin, selectedShare, activeShare, setPin]);
|
|
8312
|
-
const follow =
|
|
8372
|
+
const follow = useCallback14(
|
|
8313
8373
|
(id) => {
|
|
8314
8374
|
if (id) {
|
|
8315
8375
|
setPin(null);
|
|
@@ -8319,7 +8379,7 @@ function SpaceStage({ pinnedId, onPinnedChange, tiles, layout, onLayoutChange, g
|
|
|
8319
8379
|
},
|
|
8320
8380
|
[setPin]
|
|
8321
8381
|
);
|
|
8322
|
-
const renderContentTile =
|
|
8382
|
+
const renderContentTile = useCallback14(
|
|
8323
8383
|
(item, context) => {
|
|
8324
8384
|
if (item.kind === "screen-share")
|
|
8325
8385
|
return /* @__PURE__ */ jsx68(
|
|
@@ -8330,7 +8390,7 @@ function SpaceStage({ pinnedId, onPinnedChange, tiles, layout, onLayoutChange, g
|
|
|
8330
8390
|
capture: item.participant.isLocal ? shareCapture : void 0,
|
|
8331
8391
|
onStopSharing: item.participant.isLocal ? onStopSharing : void 0,
|
|
8332
8392
|
onChangeShare: item.participant.isLocal ? onChangeShare : void 0,
|
|
8333
|
-
switcher: shares.length > 1 ? /* @__PURE__ */ jsx68("div", { role: "group", "aria-label": "Whose screen is big", className: cn("absolute left-2 z-30 flex rounded-[999px] bg-[
|
|
8393
|
+
switcher: shares.length > 1 ? /* @__PURE__ */ jsx68("div", { role: "group", "aria-label": "Whose screen is big", className: cn("absolute left-2 z-30 flex rounded-[999px] bg-[var(--chalk-overlay-strong)] p-[3px]", item.participant.screenShareState === "low-quality" ? "top-11" : "top-2"), children: shares.map((share) => /* @__PURE__ */ jsx68(
|
|
8334
8394
|
"button",
|
|
8335
8395
|
{
|
|
8336
8396
|
type: "button",
|
|
@@ -8339,7 +8399,7 @@ function SpaceStage({ pinnedId, onPinnedChange, tiles, layout, onLayoutChange, g
|
|
|
8339
8399
|
setPin(null);
|
|
8340
8400
|
setSelectedShare(share.id);
|
|
8341
8401
|
},
|
|
8342
|
-
className: "relative h-7 rounded-[999px] px-3 text-[12px] font-semibold text-[
|
|
8402
|
+
className: "relative h-7 rounded-[999px] px-3 text-[12px] font-semibold text-[var(--chalk-on-overlay)] hover:bg-[var(--chalk-on-overlay)]/10 aria-pressed:bg-[var(--chalk-on-overlay)] aria-pressed:text-[var(--chalk-overlay)] [@media(pointer:coarse)]:before:absolute [@media(pointer:coarse)]:before:-inset-y-2 [@media(pointer:coarse)]:before:inset-x-0",
|
|
8343
8403
|
children: share.participant.displayName
|
|
8344
8404
|
},
|
|
8345
8405
|
share.id
|
|
@@ -8359,7 +8419,7 @@ function SpaceStage({ pinnedId, onPinnedChange, tiles, layout, onLayoutChange, g
|
|
|
8359
8419
|
},
|
|
8360
8420
|
[follow, whiteboard, shares, shareCapture, onStopSharing, onChangeShare, colorScheme, tiles, followed, canFollow, onCloseBoard]
|
|
8361
8421
|
);
|
|
8362
|
-
const focusContent =
|
|
8422
|
+
const focusContent = useCallback14(
|
|
8363
8423
|
(item) => {
|
|
8364
8424
|
if (item.kind !== "participant") onLayoutChange?.("focus");
|
|
8365
8425
|
},
|
|
@@ -8386,12 +8446,12 @@ function SpaceStage({ pinnedId, onPinnedChange, tiles, layout, onLayoutChange, g
|
|
|
8386
8446
|
SpaceStage.displayName = "SpaceStage";
|
|
8387
8447
|
|
|
8388
8448
|
// src/components/space-view/useDrawerPresence.ts
|
|
8389
|
-
import { useEffect as
|
|
8449
|
+
import { useEffect as useEffect31, useState as useState42 } from "react";
|
|
8390
8450
|
var DRAWER_EXIT_MS = 200;
|
|
8391
8451
|
function useDrawerPresence(panel, exitMs) {
|
|
8392
|
-
const [retained, setRetained] =
|
|
8393
|
-
const [state, setState] =
|
|
8394
|
-
|
|
8452
|
+
const [retained, setRetained] = useState42(panel);
|
|
8453
|
+
const [state, setState] = useState42(panel === null ? "closed" : "open");
|
|
8454
|
+
useEffect31(() => {
|
|
8395
8455
|
if (panel !== null) {
|
|
8396
8456
|
setRetained(panel);
|
|
8397
8457
|
setState("open");
|
|
@@ -8451,7 +8511,7 @@ function SpaceView({
|
|
|
8451
8511
|
const media = useMedia();
|
|
8452
8512
|
const connection = useConnection();
|
|
8453
8513
|
const offline = useOffline();
|
|
8454
|
-
const [dismissedOfflineNotice, setDismissedOfflineNotice] =
|
|
8514
|
+
const [dismissedOfflineNotice, setDismissedOfflineNotice] = useState43(null);
|
|
8455
8515
|
const offlineNotice = offline.notice && offline.notice !== dismissedOfflineNotice ? offline.notice : null;
|
|
8456
8516
|
const recording = useRecording();
|
|
8457
8517
|
const canPublishScreen = useCan("publishScreen");
|
|
@@ -8462,32 +8522,37 @@ function SpaceView({
|
|
|
8462
8522
|
const canManageRecording = useCan("manageRecording");
|
|
8463
8523
|
const episodeDuration = useEpisodeDuration();
|
|
8464
8524
|
const deadline = connection.episode?.deadline;
|
|
8465
|
-
const [now, setNow] =
|
|
8525
|
+
const [now, setNow] = useState43(Date.now);
|
|
8466
8526
|
const previousCountdown = useRef29(null);
|
|
8467
|
-
const [limitWarning, setLimitWarning] =
|
|
8527
|
+
const [limitWarning, setLimitWarning] = useState43(null);
|
|
8468
8528
|
const countdown = callCountdown(deadline, now);
|
|
8469
|
-
|
|
8529
|
+
useEffect32(() => {
|
|
8470
8530
|
if (!deadline) return;
|
|
8471
8531
|
const tick = () => setNow(Date.now());
|
|
8472
8532
|
tick();
|
|
8473
8533
|
const timer = window.setInterval(tick, 1e3);
|
|
8474
8534
|
return () => window.clearInterval(timer);
|
|
8475
8535
|
}, [deadline]);
|
|
8476
|
-
|
|
8536
|
+
useEffect32(() => {
|
|
8477
8537
|
const previous = previousCountdown.current;
|
|
8478
8538
|
const next = callCountdown(deadline, now, previous?.deadline === deadline ? previous?.seconds : void 0);
|
|
8479
8539
|
previousCountdown.current = { deadline, seconds: next.seconds };
|
|
8480
8540
|
if (previous?.deadline !== deadline) setLimitWarning(null);
|
|
8481
8541
|
if (next.warning !== null) setLimitWarning({ id: `time-limit-${deadline}-${next.warning}`, minutes: next.warning });
|
|
8482
8542
|
}, [deadline, now]);
|
|
8483
|
-
const [uncontrolledLayout, setUncontrolledLayout] =
|
|
8484
|
-
const [pinnedId, setPinnedId] =
|
|
8485
|
-
const [activePanel, setActivePanel] =
|
|
8486
|
-
const [
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8543
|
+
const [uncontrolledLayout, setUncontrolledLayout] = useState43(controlledLayout ?? "focus");
|
|
8544
|
+
const [pinnedId, setPinnedId] = useState43(null);
|
|
8545
|
+
const [activePanel, setActivePanel] = useState43(initialPanel);
|
|
8546
|
+
const [previousInitialPanel, setPreviousInitialPanel] = useState43(initialPanel);
|
|
8547
|
+
if (previousInitialPanel !== initialPanel) {
|
|
8548
|
+
setPreviousInitialPanel(initialPanel);
|
|
8549
|
+
setActivePanel(initialPanel);
|
|
8550
|
+
}
|
|
8551
|
+
const [isReactionPickerOpen, setReactionPickerOpen] = useState43(false);
|
|
8552
|
+
const [commandError, setCommandError] = useState43(null);
|
|
8553
|
+
const [commandSource, setCommandSource] = useState43();
|
|
8554
|
+
const [commandAction, setCommandAction] = useState43();
|
|
8555
|
+
const [retryCommand, setRetryCommand] = useState43();
|
|
8491
8556
|
const onCommandError = (failure, source, mediaSource, action, command) => {
|
|
8492
8557
|
if (!failure && commandError && typeof commandError === "object") callToasts.dismissFailure(commandError.code);
|
|
8493
8558
|
setCommandError(failure);
|
|
@@ -8499,15 +8564,14 @@ function SpaceView({
|
|
|
8499
8564
|
const layout = onLayoutChange ? controlledLayout ?? uncontrolledLayout : uncontrolledLayout;
|
|
8500
8565
|
const feature = (name) => features?.[name] !== false;
|
|
8501
8566
|
const localId = self.participantId ?? "local";
|
|
8502
|
-
const tiles =
|
|
8567
|
+
const tiles = useMemo19(
|
|
8503
8568
|
() => toVideoParticipants(participantsSlice.roster, media.remote, localId, self.displayName ?? "You", media.local).map((tile) => ({
|
|
8504
8569
|
...tile,
|
|
8505
8570
|
screenShareHasAudio: tile.isLocal ? media.screenShare.hasAudio : participantsSlice.roster.find((person) => person.participantId === tile.id)?.media.screenShareHasAudio
|
|
8506
8571
|
})),
|
|
8507
8572
|
[localId, media.local, media.remote, media.screenShare.hasAudio, participantsSlice.roster, self.displayName]
|
|
8508
8573
|
);
|
|
8509
|
-
|
|
8510
|
-
useEffect36(() => {
|
|
8574
|
+
useEffect32(() => {
|
|
8511
8575
|
if (feature("admission") && feature("participants") && canManageAdmission && participantsSlice.admissionQueue.length > 0) setActivePanel("participants");
|
|
8512
8576
|
}, [canManageAdmission, participantsSlice.admissionQueue.length, features?.admission, features?.participants]);
|
|
8513
8577
|
const buttons = [
|
|
@@ -8531,7 +8595,7 @@ function SpaceView({
|
|
|
8531
8595
|
const playSound = useSoundCues(feature("sounds") && soundsEnabled);
|
|
8532
8596
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
8533
8597
|
const drawer = useDrawerPresence(activePanel, prefersReducedMotion ? 0 : DRAWER_EXIT_MS);
|
|
8534
|
-
const runCommand =
|
|
8598
|
+
const runCommand = useCallback15(async (command, source, action) => {
|
|
8535
8599
|
try {
|
|
8536
8600
|
await command();
|
|
8537
8601
|
setCommandError(null);
|
|
@@ -8560,12 +8624,14 @@ function SpaceView({
|
|
|
8560
8624
|
};
|
|
8561
8625
|
const mappedFailure = mediaFailureToast(typeof displayedCommandError === "object" ? displayedCommandError : null, displayedCommandSource, externalCommandError != null ? externalCommandAction : commandAction, externalCommandError == null && retryCommand ? () => void retryMedia() : void 0);
|
|
8562
8626
|
const commandToasts = mappedFailure ? [{ id: "space-command-error", ...mappedFailure }] : typeof displayedCommandError === "string" ? [{ id: "space-command-error", message: displayedCommandError, type: "error" }] : [];
|
|
8563
|
-
const [boardToasts, setBoardToasts] =
|
|
8627
|
+
const [boardToasts, setBoardToasts] = useState43([]);
|
|
8564
8628
|
const boardToastCount = useRef29(0);
|
|
8565
|
-
|
|
8629
|
+
const [previousBoardOpen, setPreviousBoardOpen] = useState43(whiteboard?.isOpen);
|
|
8630
|
+
if (previousBoardOpen !== whiteboard?.isOpen) {
|
|
8631
|
+
setPreviousBoardOpen(whiteboard?.isOpen);
|
|
8566
8632
|
if (!whiteboard?.isOpen) setBoardToasts([]);
|
|
8567
|
-
}
|
|
8568
|
-
const showBoardToast =
|
|
8633
|
+
}
|
|
8634
|
+
const showBoardToast = useCallback15((toast) => {
|
|
8569
8635
|
if (!toast) {
|
|
8570
8636
|
setBoardToasts([]);
|
|
8571
8637
|
return;
|
|
@@ -8594,7 +8660,9 @@ function SpaceView({
|
|
|
8594
8660
|
else if (id.startsWith("board-")) setBoardToasts((current) => current.filter((toast) => toast.id !== id));
|
|
8595
8661
|
else callToasts.dismiss(id);
|
|
8596
8662
|
};
|
|
8597
|
-
const [foldedNotices, setFoldedNotices] =
|
|
8663
|
+
const [foldedNotices, setFoldedNotices] = useState43([]);
|
|
8664
|
+
const microphoneTarget = mediaToggleTarget(media.local.microphone.state, connection.status === "live");
|
|
8665
|
+
const cameraTarget = mediaToggleTarget(media.local.camera.state, connection.status === "live");
|
|
8598
8666
|
const folded = toasts.filter((toast) => foldedNotices.includes(toast.id));
|
|
8599
8667
|
return /* @__PURE__ */ jsx69(ParticipantVolumeProvider, { children: /* @__PURE__ */ jsx69(BoardToastContext2.Provider, { value: showBoardToast, children: /* @__PURE__ */ jsx69(
|
|
8600
8668
|
SpacePresentation,
|
|
@@ -8617,8 +8685,8 @@ function SpaceView({
|
|
|
8617
8685
|
diagnostics: callDiagnostics(connection, media),
|
|
8618
8686
|
shortcuts: {
|
|
8619
8687
|
isMuted: media.local.microphone.state !== "enabled",
|
|
8620
|
-
onToggleMute:
|
|
8621
|
-
onToggleVideo:
|
|
8688
|
+
onToggleMute: microphoneTarget === void 0 ? void 0 : () => void runCommand(() => client.media.setMicrophoneEnabled(microphoneTarget), "microphone", microphoneTarget ? "start" : "stop"),
|
|
8689
|
+
onToggleVideo: cameraTarget === void 0 ? void 0 : () => void runCommand(() => client.media.setCameraEnabled(cameraTarget), "camera", cameraTarget ? "start" : "stop"),
|
|
8622
8690
|
onToggleHand: feature("handRaise") && canRaiseHand ? () => void runCommand(() => self.handRaised ? client.participants.lowerHand() : client.participants.raiseHand()) : void 0,
|
|
8623
8691
|
onToggleChat: feature("chat") ? () => setActivePanel((current) => current === "chat" ? null : "chat") : void 0,
|
|
8624
8692
|
onTogglePeople: feature("participants") ? () => setActivePanel((current) => current === "participants" ? null : "participants") : void 0,
|