@q9labsai/chalk-react 5.2.5 → 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-6AUMKXPU.js → chunk-26BQBCEI.js} +12 -10
- package/dist/{chunk-WRKIKIXF.js → chunk-JK4JXOGC.js} +374 -353
- package/dist/components/control-bar/command-failure.d.ts +6 -6
- 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;
|
|
@@ -4326,7 +4334,7 @@ function DevicePopover({
|
|
|
4326
4334
|
busy,
|
|
4327
4335
|
onCancelPending
|
|
4328
4336
|
}) {
|
|
4329
|
-
const [open, setOpen] =
|
|
4337
|
+
const [open, setOpen] = useState17(false);
|
|
4330
4338
|
const mic = type === "mic";
|
|
4331
4339
|
const label = mic ? isActive ? "Mute microphone" : "Unmute microphone" : isActive ? "Turn off camera" : "Turn on camera";
|
|
4332
4340
|
return /* @__PURE__ */ jsxs20("div", { "data-part": `${type}-split`, className: cn("chalk-shell-split", className), "data-off": !isActive, children: [
|
|
@@ -4416,10 +4424,10 @@ function LeaveMenu({ onLeave, onEndForEveryone, renderButton }) {
|
|
|
4416
4424
|
}
|
|
4417
4425
|
|
|
4418
4426
|
// src/components/control-bar/DockLayout.tsx
|
|
4419
|
-
import { useState as
|
|
4427
|
+
import { useState as useState18 } from "react";
|
|
4420
4428
|
import { Fragment as Fragment13, jsx as jsx41, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4421
4429
|
function DockLayout({ layout, onLayoutChange, children }) {
|
|
4422
|
-
const [open, setOpen] =
|
|
4430
|
+
const [open, setOpen] = useState18(false);
|
|
4423
4431
|
return /* @__PURE__ */ jsxs23(Fragment13, { children: [
|
|
4424
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" }) }) }),
|
|
4425
4433
|
/* @__PURE__ */ jsx41(ChalkSheet, { title: "More options", open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs23(
|
|
@@ -4460,7 +4468,7 @@ function DockLayout({ layout, onLayoutChange, children }) {
|
|
|
4460
4468
|
}
|
|
4461
4469
|
|
|
4462
4470
|
// src/components/control-bar/ShareControl.tsx
|
|
4463
|
-
import { useState as
|
|
4471
|
+
import { useState as useState19 } from "react";
|
|
4464
4472
|
import { Fragment as Fragment14, jsx as jsx42, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4465
4473
|
function SourceIcon({ source }) {
|
|
4466
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: [
|
|
@@ -4475,9 +4483,9 @@ function SourceIcon({ source }) {
|
|
|
4475
4483
|
] }) });
|
|
4476
4484
|
}
|
|
4477
4485
|
function ShareControl({ sharing, onToggle, onStart, disabled = false, startDisabled = false }) {
|
|
4478
|
-
const [surface, setSurface] =
|
|
4479
|
-
const [audio, setAudio] =
|
|
4480
|
-
const [replace, setReplace] =
|
|
4486
|
+
const [surface, setSurface] = useState19("window");
|
|
4487
|
+
const [audio, setAudio] = useState19(true);
|
|
4488
|
+
const [replace, setReplace] = useState19(false);
|
|
4481
4489
|
const start2 = (next) => {
|
|
4482
4490
|
if (disabled || startDisabled) return;
|
|
4483
4491
|
setSurface(next);
|
|
@@ -4532,7 +4540,7 @@ function ShareControl({ sharing, onToggle, onStart, disabled = false, startDisab
|
|
|
4532
4540
|
}
|
|
4533
4541
|
|
|
4534
4542
|
// src/components/control-bar/control-bar-behavior.ts
|
|
4535
|
-
import { useCallback as
|
|
4543
|
+
import { useCallback as useCallback6, useEffect as useEffect14, useMemo as useMemo10, useState as useState20 } from "react";
|
|
4536
4544
|
|
|
4537
4545
|
// src/components/control-bar/media-toggle.ts
|
|
4538
4546
|
function mediaToggleTarget(state, live) {
|
|
@@ -4576,10 +4584,10 @@ function useControlBarSurfaceBehavior({
|
|
|
4576
4584
|
participantGradientPreference,
|
|
4577
4585
|
detectDevices = true
|
|
4578
4586
|
}) {
|
|
4579
|
-
const themeVariables =
|
|
4580
|
-
const [detectedDevices, setDetectedDevices] =
|
|
4587
|
+
const themeVariables = useMemo10(() => getParticipantThemeVariables(participantColorSeed, participantGradientPreference), [participantColorSeed, participantGradientPreference]);
|
|
4588
|
+
const [detectedDevices, setDetectedDevices] = useState20(EMPTY_DETECTED_DEVICES);
|
|
4581
4589
|
const buttonsToRender = buttons ?? DEFAULT_CONTROL_BAR_BUTTONS;
|
|
4582
|
-
|
|
4590
|
+
useEffect14(() => {
|
|
4583
4591
|
if (!detectDevices || density !== "comfortable" || !navigator.mediaDevices?.enumerateDevices) return;
|
|
4584
4592
|
let cancelled = false;
|
|
4585
4593
|
const syncDevices = async () => {
|
|
@@ -4638,11 +4646,11 @@ function useConnectedControlBarBehavior(props) {
|
|
|
4638
4646
|
const recordingStatus = recording.current?.status;
|
|
4639
4647
|
const isRecording = recordingStatus === "recording" || recordingStatus === "stopping";
|
|
4640
4648
|
const isRecordingPending = recordingStatus === "starting" || recordingStatus === "stopping";
|
|
4641
|
-
const [noiseSuppression, setNoiseSuppression] =
|
|
4642
|
-
const [commandError, setCommandError] =
|
|
4643
|
-
const [commandSource, setCommandSource] =
|
|
4644
|
-
const [commandAction, setCommandAction] =
|
|
4645
|
-
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(
|
|
4646
4654
|
async (command, source, action) => {
|
|
4647
4655
|
setCommandError(null);
|
|
4648
4656
|
setCommandSource(void 0);
|
|
@@ -4662,7 +4670,7 @@ function useConnectedControlBarBehavior(props) {
|
|
|
4662
4670
|
},
|
|
4663
4671
|
[props.onCommandError]
|
|
4664
4672
|
);
|
|
4665
|
-
const leave =
|
|
4673
|
+
const leave = useCallback6(() => {
|
|
4666
4674
|
if (props.onLeaveRequest) {
|
|
4667
4675
|
props.onLeaveRequest();
|
|
4668
4676
|
return;
|
|
@@ -4810,10 +4818,10 @@ function ControlBarPresentation(props) {
|
|
|
4810
4818
|
var ControlBarSurface = React12.memo((props) => {
|
|
4811
4819
|
const { buttonsToRender, effectiveAudioInputDevices, effectiveAudioOutputDevices, effectiveVideoInputDevices, showLeave } = useControlBarSurfaceBehavior({ ...props, density: props.density ?? "comfortable", detectDevices: props.detectDevices ?? true });
|
|
4812
4820
|
const dock = useRef12(null);
|
|
4813
|
-
const [fullscreen, setFullscreen] =
|
|
4814
|
-
const [canCaptureDisplay, setCanCaptureDisplay] =
|
|
4815
|
-
|
|
4816
|
-
|
|
4821
|
+
const [fullscreen, setFullscreen] = useState21(false);
|
|
4822
|
+
const [canCaptureDisplay, setCanCaptureDisplay] = useState21(false);
|
|
4823
|
+
useEffect15(() => setCanCaptureDisplay(typeof navigator.mediaDevices?.getDisplayMedia === "function"), []);
|
|
4824
|
+
useEffect15(() => {
|
|
4817
4825
|
const changed = () => setFullscreen(Boolean(document.fullscreenElement));
|
|
4818
4826
|
document.addEventListener("fullscreenchange", changed);
|
|
4819
4827
|
return () => document.removeEventListener("fullscreenchange", changed);
|
|
@@ -4964,10 +4972,10 @@ function ControlBar(props) {
|
|
|
4964
4972
|
}
|
|
4965
4973
|
|
|
4966
4974
|
// src/components/participants-panel/ParticipantsPanel.tsx
|
|
4967
|
-
import React13, { useMemo as
|
|
4975
|
+
import React13, { useMemo as useMemo11, useState as useState23 } from "react";
|
|
4968
4976
|
|
|
4969
4977
|
// src/components/participants-panel/participant-row.tsx
|
|
4970
|
-
import { useState as
|
|
4978
|
+
import { useState as useState22, useRef as useRef13, useEffect as useEffect16 } from "react";
|
|
4971
4979
|
|
|
4972
4980
|
// src/components/participants-panel/participant-options-menu-contract.ts
|
|
4973
4981
|
function runParticipantAction(action, onClose, onCommandError) {
|
|
@@ -5142,13 +5150,13 @@ function ParticipantRow({
|
|
|
5142
5150
|
onMenuToggle,
|
|
5143
5151
|
onMenuClose
|
|
5144
5152
|
}) {
|
|
5145
|
-
const [isEditing, setIsEditing] =
|
|
5146
|
-
const [editName, setEditName] =
|
|
5153
|
+
const [isEditing, setIsEditing] = useState22(false);
|
|
5154
|
+
const [editName, setEditName] = useState22(participant.displayName);
|
|
5147
5155
|
const inputRef = useRef13(null);
|
|
5148
5156
|
const rootRef = useRef13(null);
|
|
5149
5157
|
const hasVolumeControl = !!participantVolumes && !!onParticipantVolumeChange;
|
|
5150
5158
|
const showMenuButton = canManageParticipants || hasVolumeControl || participant.isLocal && !!onUpdateDisplayName;
|
|
5151
|
-
|
|
5159
|
+
useEffect16(() => {
|
|
5152
5160
|
if (isEditing) {
|
|
5153
5161
|
inputRef.current?.focus();
|
|
5154
5162
|
inputRef.current?.select();
|
|
@@ -5292,10 +5300,10 @@ var ParticipantsPanelSurface = React13.memo(
|
|
|
5292
5300
|
participantGradientPreference,
|
|
5293
5301
|
generatedAvatars = true
|
|
5294
5302
|
}) => {
|
|
5295
|
-
const [query, setQuery] =
|
|
5296
|
-
const [activeMenuId, setActiveMenuId] =
|
|
5297
|
-
const [muting, setMuting] =
|
|
5298
|
-
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);
|
|
5299
5307
|
const filtered = participants.filter((person) => person.displayName.toLocaleLowerCase().includes(query.trim().toLocaleLowerCase()));
|
|
5300
5308
|
const raised = participants.filter((person) => person.isHandRaised);
|
|
5301
5309
|
const unmutedCount = participants.filter((person) => !person.isLocal && !person.isMuted).length;
|
|
@@ -5399,7 +5407,7 @@ var ParticipantsPanel = React13.memo((props) => {
|
|
|
5399
5407
|
const canRemoveParticipants = useCan("removeParticipant");
|
|
5400
5408
|
const canManageAdmission = useCan("manageAdmission");
|
|
5401
5409
|
const contextVolumeState = useParticipantVolumeContext();
|
|
5402
|
-
const [localVolumes, setLocalVolumes] =
|
|
5410
|
+
const [localVolumes, setLocalVolumes] = useState23(/* @__PURE__ */ new Map());
|
|
5403
5411
|
const isControlled = props.participantVolumes !== void 0 && props.onParticipantVolumeChange !== void 0;
|
|
5404
5412
|
const participantVolumes = isControlled ? props.participantVolumes : contextVolumeState?.volumes ?? localVolumes;
|
|
5405
5413
|
const onParticipantVolumeChange = isControlled ? props.onParticipantVolumeChange : contextVolumeState?.setVolume ?? ((participantId, volume) => setLocalVolumes((current) => {
|
|
@@ -5408,7 +5416,7 @@ var ParticipantsPanel = React13.memo((props) => {
|
|
|
5408
5416
|
else next.set(participantId, volume);
|
|
5409
5417
|
return next;
|
|
5410
5418
|
}));
|
|
5411
|
-
const participants =
|
|
5419
|
+
const participants = useMemo11(
|
|
5412
5420
|
() => participantsSlice.roster.map((participant) => ({
|
|
5413
5421
|
id: participant.participantId,
|
|
5414
5422
|
displayName: participant.displayName,
|
|
@@ -5518,7 +5526,7 @@ function StatusAction({ icon, label, onClick, disabled }) {
|
|
|
5518
5526
|
}
|
|
5519
5527
|
|
|
5520
5528
|
// src/components/call-limbo/CallReady.tsx
|
|
5521
|
-
import { useEffect as
|
|
5529
|
+
import { useEffect as useEffect17, useId, useRef as useRef14, useState as useState24 } from "react";
|
|
5522
5530
|
|
|
5523
5531
|
// src/components/call-limbo/qr-code.ts
|
|
5524
5532
|
function inviteQR(text) {
|
|
@@ -5661,28 +5669,28 @@ function inviteQR(text) {
|
|
|
5661
5669
|
// src/components/call-limbo/CallReady.tsx
|
|
5662
5670
|
import { Fragment as Fragment19, jsx as jsx48, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
5663
5671
|
function CallReady({ open, onClose, link = typeof location === "undefined" ? "" : location.href }) {
|
|
5664
|
-
const [showQR, setShowQR] =
|
|
5672
|
+
const [showQR, setShowQR] = useState24(false);
|
|
5665
5673
|
const qrRef = useRef14(null);
|
|
5666
5674
|
const cardRef = useRef14(null);
|
|
5667
5675
|
const phone = useIsMobile();
|
|
5668
5676
|
const reducedMotion = usePrefersReducedMotion();
|
|
5669
|
-
const [entered, setEntered] =
|
|
5670
|
-
const [present, setPresent] =
|
|
5677
|
+
const [entered, setEntered] = useState24(false);
|
|
5678
|
+
const [present, setPresent] = useState24(open);
|
|
5671
5679
|
const id = useId();
|
|
5672
5680
|
const qr = showQR ? inviteQR(link) : null;
|
|
5673
5681
|
const close = () => {
|
|
5674
5682
|
onClose();
|
|
5675
5683
|
cardRef.current?.closest("[data-chalk]")?.querySelector("[data-call-link-trigger]")?.focus();
|
|
5676
5684
|
};
|
|
5677
|
-
|
|
5685
|
+
useEffect17(() => {
|
|
5678
5686
|
if (!open && cardRef.current?.contains(document.activeElement)) cardRef.current.closest("[data-chalk]")?.querySelector("[data-call-link-trigger]")?.focus();
|
|
5679
5687
|
}, [open]);
|
|
5680
|
-
|
|
5688
|
+
useEffect17(() => {
|
|
5681
5689
|
if (!showQR || reducedMotion) return;
|
|
5682
5690
|
const animation = qrRef.current?.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 200, easing: "ease-out" });
|
|
5683
5691
|
return () => animation?.cancel();
|
|
5684
5692
|
}, [showQR, reducedMotion]);
|
|
5685
|
-
|
|
5693
|
+
useEffect17(() => {
|
|
5686
5694
|
if (open) setPresent(true);
|
|
5687
5695
|
const frame = requestAnimationFrame(() => setEntered(open));
|
|
5688
5696
|
const timer = setTimeout(
|
|
@@ -5748,11 +5756,11 @@ function CallReady({ open, onClose, link = typeof location === "undefined" ? ""
|
|
|
5748
5756
|
}
|
|
5749
5757
|
|
|
5750
5758
|
// src/components/toast-stack/ToastStack.tsx
|
|
5751
|
-
import { memo, useLayoutEffect as useLayoutEffect3, useRef as useRef15, useState as
|
|
5759
|
+
import { memo, useLayoutEffect as useLayoutEffect3, useRef as useRef15, useState as useState26 } from "react";
|
|
5752
5760
|
import { flushSync as flushSync2 } from "react-dom";
|
|
5753
5761
|
|
|
5754
5762
|
// src/components/toast-stack/useToastCapacity.ts
|
|
5755
|
-
import { isValidElement as isValidElement2, useLayoutEffect as useLayoutEffect2, useState as
|
|
5763
|
+
import { isValidElement as isValidElement2, useLayoutEffect as useLayoutEffect2, useState as useState25 } from "react";
|
|
5756
5764
|
import { flushSync } from "react-dom";
|
|
5757
5765
|
|
|
5758
5766
|
// src/components/toast-stack/toast-layout-snapshot.ts
|
|
@@ -5797,7 +5805,7 @@ function measureToastLayout(stack, snapshot) {
|
|
|
5797
5805
|
|
|
5798
5806
|
// src/components/toast-stack/useToastCapacity.ts
|
|
5799
5807
|
function useToastCapacity(stack, candidates, enabled, ownedIds) {
|
|
5800
|
-
const [fit, setFit] =
|
|
5808
|
+
const [fit, setFit] = useState25(null);
|
|
5801
5809
|
let count = candidates.length;
|
|
5802
5810
|
if (enabled) {
|
|
5803
5811
|
count = 0;
|
|
@@ -5891,7 +5899,7 @@ var ToastStack = memo(function ToastStack2({ toasts, onDismiss, maxVisible = 3,
|
|
|
5891
5899
|
const stack = useRef15(null);
|
|
5892
5900
|
const short = useShortCall(stack, onFold !== void 0);
|
|
5893
5901
|
const candidates = maxVisible > 0 ? toasts.slice(-maxVisible) : [];
|
|
5894
|
-
const [ownedIds, setOwnedIds] =
|
|
5902
|
+
const [ownedIds, setOwnedIds] = useState26([]);
|
|
5895
5903
|
const fold = useRef15(onFold);
|
|
5896
5904
|
const capacity = useToastCapacity(stack, candidates, onFold !== void 0 && short === false, ownedIds);
|
|
5897
5905
|
const selected = onFold !== void 0 && short !== false ? [] : candidates.slice(candidates.length - capacity.count);
|
|
@@ -5900,7 +5908,7 @@ var ToastStack = memo(function ToastStack2({ toasts, onDismiss, maxVisible = 3,
|
|
|
5900
5908
|
const foldedIds = folded.map((toast) => toast.id);
|
|
5901
5909
|
const announced = useRef15(/* @__PURE__ */ new Map());
|
|
5902
5910
|
const wasAnnounced = (toast) => announced.current.get(toast.id) === noticeIdentity(toast);
|
|
5903
|
-
const [unheard, setUnheard] =
|
|
5911
|
+
const [unheard, setUnheard] = useState26([]);
|
|
5904
5912
|
const reported = useRef15([]);
|
|
5905
5913
|
const reporting = useRef15(false);
|
|
5906
5914
|
useLayoutEffect3(() => {
|
|
@@ -5947,7 +5955,7 @@ var ToastStack = memo(function ToastStack2({ toasts, onDismiss, maxVisible = 3,
|
|
|
5947
5955
|
] });
|
|
5948
5956
|
});
|
|
5949
5957
|
function useShortCall(stack, enabled) {
|
|
5950
|
-
const [short, setShort] =
|
|
5958
|
+
const [short, setShort] = useState26(null);
|
|
5951
5959
|
useLayoutEffect3(() => {
|
|
5952
5960
|
if (!enabled) {
|
|
5953
5961
|
setShort(null);
|
|
@@ -5968,7 +5976,7 @@ function sameIds(a, b) {
|
|
|
5968
5976
|
}
|
|
5969
5977
|
|
|
5970
5978
|
// src/internal/call-motion.ts
|
|
5971
|
-
import { useEffect as
|
|
5979
|
+
import { useEffect as useEffect18, useState as useState27 } from "react";
|
|
5972
5980
|
var moves = /* @__PURE__ */ new WeakMap();
|
|
5973
5981
|
function captureFlip(elements) {
|
|
5974
5982
|
const previous = Array.from(elements, (element) => ({ element, box: element.getBoundingClientRect() }));
|
|
@@ -5996,9 +6004,9 @@ function playFlip(previous) {
|
|
|
5996
6004
|
}
|
|
5997
6005
|
var ACTIVE_LAYERS = '[role="menu"],[role="dialog"],[data-part="toast"],[data-part="notice-button"],[data-chalk-drawer]';
|
|
5998
6006
|
function useIdleChrome(root, enabled) {
|
|
5999
|
-
const [idle, setIdle] =
|
|
6007
|
+
const [idle, setIdle] = useState27(false);
|
|
6000
6008
|
const fine = useMediaQuery("(pointer:fine) and (min-width:641px)");
|
|
6001
|
-
|
|
6009
|
+
useEffect18(() => {
|
|
6002
6010
|
const element = root.current;
|
|
6003
6011
|
if (!element || !enabled || !fine) return;
|
|
6004
6012
|
let timer;
|
|
@@ -6028,10 +6036,10 @@ function useIdleChrome(root, enabled) {
|
|
|
6028
6036
|
}
|
|
6029
6037
|
|
|
6030
6038
|
// src/components/space-header/SpaceHeader.tsx
|
|
6031
|
-
import React14, { useCallback as
|
|
6039
|
+
import React14, { useCallback as useCallback7, useRef as useRef18, useState as useState29 } from "react";
|
|
6032
6040
|
|
|
6033
6041
|
// src/internal/useSoundsSetting.ts
|
|
6034
|
-
import { useSyncExternalStore as
|
|
6042
|
+
import { useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
6035
6043
|
var KEY2 = "chalk_sounds";
|
|
6036
6044
|
var listeners2 = /* @__PURE__ */ new Set();
|
|
6037
6045
|
var fallback2 = true;
|
|
@@ -6051,7 +6059,7 @@ function subscribe2(listener) {
|
|
|
6051
6059
|
};
|
|
6052
6060
|
}
|
|
6053
6061
|
function useSoundsSetting() {
|
|
6054
|
-
const enabled =
|
|
6062
|
+
const enabled = useSyncExternalStore4(subscribe2, read2, () => true);
|
|
6055
6063
|
return [
|
|
6056
6064
|
enabled,
|
|
6057
6065
|
(next) => {
|
|
@@ -6080,7 +6088,7 @@ function LayoutMenu({ layout, onLayoutChange }) {
|
|
|
6080
6088
|
|
|
6081
6089
|
// src/components/space-header/CallDetails.tsx
|
|
6082
6090
|
import { Dialog as Dialog2 } from "@base-ui/react/dialog";
|
|
6083
|
-
import {
|
|
6091
|
+
import { useRef as useRef16, useState as useState28 } from "react";
|
|
6084
6092
|
|
|
6085
6093
|
// src/components/space-header/share-qr.ts
|
|
6086
6094
|
function shareQr(text) {
|
|
@@ -6235,18 +6243,20 @@ function CallDialog({
|
|
|
6235
6243
|
const container = useRef16(null);
|
|
6236
6244
|
const reportInput = useRef16(null);
|
|
6237
6245
|
const reportOpener = useRef16(null);
|
|
6238
|
-
const [text, setText] =
|
|
6239
|
-
const [includeDiagnostics, setIncludeDiagnostics] =
|
|
6240
|
-
const [status, setStatus] =
|
|
6241
|
-
const [error, setError] =
|
|
6242
|
-
|
|
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 });
|
|
6243
6253
|
if (open && kind === "report") {
|
|
6244
6254
|
setText("");
|
|
6245
6255
|
setIncludeDiagnostics(false);
|
|
6246
6256
|
setError("");
|
|
6247
6257
|
setStatus("idle");
|
|
6248
6258
|
}
|
|
6249
|
-
}
|
|
6259
|
+
}
|
|
6250
6260
|
return /* @__PURE__ */ jsx51(
|
|
6251
6261
|
"span",
|
|
6252
6262
|
{
|
|
@@ -6373,7 +6383,7 @@ function CallDetails({
|
|
|
6373
6383
|
}) {
|
|
6374
6384
|
const link = shareUrl ?? (typeof location === "undefined" ? "" : location.href);
|
|
6375
6385
|
const qr = shareQr(link);
|
|
6376
|
-
const [details, setDetails] =
|
|
6386
|
+
const [details, setDetails] = useState28(false);
|
|
6377
6387
|
return /* @__PURE__ */ jsxs32("div", { className: "chalk-details", children: [
|
|
6378
6388
|
/* @__PURE__ */ jsxs32("div", { className: "chalk-shell-details-heading", children: [
|
|
6379
6389
|
/* @__PURE__ */ jsx51("h2", { children: spaceName }),
|
|
@@ -6445,11 +6455,11 @@ function CallDetails({
|
|
|
6445
6455
|
}
|
|
6446
6456
|
|
|
6447
6457
|
// src/components/space-header/useCallShortcuts.ts
|
|
6448
|
-
import { useEffect as
|
|
6458
|
+
import { useEffect as useEffect19, useRef as useRef17 } from "react";
|
|
6449
6459
|
function useCallShortcuts(actions, show) {
|
|
6450
6460
|
const latest = useRef17(actions);
|
|
6451
6461
|
latest.current = actions;
|
|
6452
|
-
|
|
6462
|
+
useEffect19(() => {
|
|
6453
6463
|
let talking = false;
|
|
6454
6464
|
const restore = () => {
|
|
6455
6465
|
if (talking) {
|
|
@@ -6521,17 +6531,17 @@ var SpaceHeader = React14.memo((props) => {
|
|
|
6521
6531
|
const { spaceName, duration = 0, isRecording = false, layout = "focus", onLayoutChange, className, weakConnection } = props;
|
|
6522
6532
|
const remaining = props.timeLeft != null && props.timeLeft <= 600 ? props.timeLeft : null;
|
|
6523
6533
|
const timer = remaining === null ? formatDuration(duration) : `${formatDuration(remaining)} left`;
|
|
6524
|
-
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)" };
|
|
6525
6535
|
const [sounds, setSounds] = useSoundsSetting();
|
|
6526
6536
|
const triggerRef = useRef18(null);
|
|
6527
6537
|
const focusScope = useRef18(null);
|
|
6528
|
-
const [open, setOpen] =
|
|
6529
|
-
const [dialog, setDialog] =
|
|
6530
|
-
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 }), []);
|
|
6531
6541
|
useCallShortcuts(props.shortcuts, showShortcuts);
|
|
6532
6542
|
const phone = useMediaQuery("(max-width: 640px)");
|
|
6533
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" }) });
|
|
6534
|
-
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: [
|
|
6535
6545
|
/* @__PURE__ */ jsx52("span", { dir: "auto", children: spaceName }),
|
|
6536
6546
|
/* @__PURE__ */ jsx52("span", { "data-part": "call-timer", className: "chalk-call-timer", style: timerStyle, children: timer }),
|
|
6537
6547
|
chevron
|
|
@@ -6555,7 +6565,7 @@ var SpaceHeader = React14.memo((props) => {
|
|
|
6555
6565
|
/* @__PURE__ */ jsx52(ShellStyles, {}),
|
|
6556
6566
|
/* @__PURE__ */ jsxs33("div", { className: "chalk-header-title flex min-w-0 items-center gap-3", children: [
|
|
6557
6567
|
phone ? /* @__PURE__ */ jsxs33(Fragment22, { children: [
|
|
6558
|
-
/* @__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: [
|
|
6559
6569
|
/* @__PURE__ */ jsx52("span", { dir: "auto", children: spaceName }),
|
|
6560
6570
|
chevron
|
|
6561
6571
|
] }),
|
|
@@ -6613,16 +6623,16 @@ var SpaceHeader = React14.memo((props) => {
|
|
|
6613
6623
|
SpaceHeader.displayName = "SpaceHeader";
|
|
6614
6624
|
|
|
6615
6625
|
// src/components/composite/ScreenShareView.tsx
|
|
6616
|
-
import { useEffect as
|
|
6626
|
+
import { useEffect as useEffect20, useMemo as useMemo12, useRef as useRef19, useState as useState30 } from "react";
|
|
6617
6627
|
import { Fragment as Fragment23, jsx as jsx53, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
6618
6628
|
function ScreenSharePresentation({ sharedByName, media, mediaVisible, state, isLocal = false, hasAudio = false, capture: capture2, primary = true, pinned, hidden, style, onClick, onDoubleClick, onStopSharing, onChangeShare, switcher, className }) {
|
|
6619
6629
|
const root = useRef19(null);
|
|
6620
|
-
const [fill, setFill] =
|
|
6621
|
-
const [controlsOpen, setControlsOpen] =
|
|
6622
|
-
const [poppedOut, setPoppedOut] =
|
|
6623
|
-
const [zoom, setZoom] =
|
|
6624
|
-
const [pending, setPending] =
|
|
6625
|
-
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);
|
|
6626
6636
|
const status = state ?? (mediaVisible ? "live" : "connecting");
|
|
6627
6637
|
const name = isLocal ? "Your screen" : `${sharedByName}'s screen`;
|
|
6628
6638
|
const source = capture2?.surface === "window" ? "a window" : capture2?.surface === "browser" ? "a tab" : capture2?.surface === "monitor" ? "your screen" : null;
|
|
@@ -6638,7 +6648,7 @@ function ScreenSharePresentation({ sharedByName, media, mediaVisible, state, isL
|
|
|
6638
6648
|
setPending(false);
|
|
6639
6649
|
}
|
|
6640
6650
|
};
|
|
6641
|
-
|
|
6651
|
+
useEffect20(() => {
|
|
6642
6652
|
const video = root.current?.querySelector("video");
|
|
6643
6653
|
if (!video) return;
|
|
6644
6654
|
const entered = () => setPoppedOut(true);
|
|
@@ -6709,14 +6719,14 @@ function ScreenSharePresentation({ sharedByName, media, mediaVisible, state, isL
|
|
|
6709
6719
|
"\u2019s screen\u2026"
|
|
6710
6720
|
] })
|
|
6711
6721
|
] }) : null,
|
|
6712
|
-
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-
|
|
6713
|
-
/* @__PURE__ */ jsx53("span", { className: "grid h-12 w-12 place-items-center rounded-[50%] bg-[
|
|
6714
|
-
/* @__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: [
|
|
6715
6725
|
sharedByName,
|
|
6716
6726
|
" paused sharing"
|
|
6717
6727
|
] })
|
|
6718
6728
|
] }) : null,
|
|
6719
|
-
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: [
|
|
6720
6730
|
/* @__PURE__ */ jsx53(SignalBars, {}),
|
|
6721
6731
|
/* @__PURE__ */ jsxs34("span", { children: [
|
|
6722
6732
|
sharedByName,
|
|
@@ -6724,10 +6734,10 @@ function ScreenSharePresentation({ sharedByName, media, mediaVisible, state, isL
|
|
|
6724
6734
|
] })
|
|
6725
6735
|
] }) : null,
|
|
6726
6736
|
primary ? switcher : null,
|
|
6727
|
-
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: [
|
|
6728
6738
|
/* @__PURE__ */ jsxs34("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
|
|
6729
6739
|
/* @__PURE__ */ jsx53("b", { className: "truncate font-semibold", children: source ? `You\u2019re sharing ${source}` : "You\u2019re screen sharing" }),
|
|
6730
|
-
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: [
|
|
6731
6741
|
"Seeing a mirror effect? That\u2019s normal when you share ",
|
|
6732
6742
|
capture2.surface === "browser" ? "this tab" : "your whole screen",
|
|
6733
6743
|
"."
|
|
@@ -6736,7 +6746,7 @@ function ScreenSharePresentation({ sharedByName, media, mediaVisible, state, isL
|
|
|
6736
6746
|
onChangeShare ? /* @__PURE__ */ jsx53(
|
|
6737
6747
|
ChalkMenu,
|
|
6738
6748
|
{
|
|
6739
|
-
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" }),
|
|
6740
6750
|
children: [
|
|
6741
6751
|
{ surface: "monitor", label: "Entire screen" },
|
|
6742
6752
|
{ surface: "window", label: "Window" },
|
|
@@ -6744,7 +6754,7 @@ function ScreenSharePresentation({ sharedByName, media, mediaVisible, state, isL
|
|
|
6744
6754
|
].map((option) => /* @__PURE__ */ jsx53(ChalkMenuItem, { onClick: () => void run(() => onChangeShare({ surface: option.surface, audio: option.surface === "browser" }), "screen", "start"), children: option.label }, option.surface))
|
|
6745
6755
|
}
|
|
6746
6756
|
) : null,
|
|
6747
|
-
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
|
|
6748
6758
|
] }) : null,
|
|
6749
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: [
|
|
6750
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 }) }),
|
|
@@ -6752,7 +6762,7 @@ function ScreenSharePresentation({ sharedByName, media, mediaVisible, state, isL
|
|
|
6752
6762
|
/* @__PURE__ */ jsx53(ShareControl2, { label: "Pop out", onClick: () => void popout(), children: /* @__PURE__ */ jsx53(StageIcon, { name: "pip", size: 16 }) }),
|
|
6753
6763
|
/* @__PURE__ */ jsx53(ShareControl2, { label: "Full screen", onClick: () => void fullscreen(), children: /* @__PURE__ */ jsx53(StageIcon, { name: "maximize", size: 16 }) })
|
|
6754
6764
|
] }) : null,
|
|
6755
|
-
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
|
|
6756
6766
|
]
|
|
6757
6767
|
}
|
|
6758
6768
|
)
|
|
@@ -6767,7 +6777,7 @@ function ShareControl2({ label, pressed, onClick, children }) {
|
|
|
6767
6777
|
"aria-label": label,
|
|
6768
6778
|
"aria-pressed": pressed,
|
|
6769
6779
|
onClick,
|
|
6770
|
-
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",
|
|
6771
6781
|
children
|
|
6772
6782
|
}
|
|
6773
6783
|
);
|
|
@@ -6784,7 +6794,7 @@ function ScreenShareView(props) {
|
|
|
6784
6794
|
const participantsSlice = useParticipants();
|
|
6785
6795
|
const media = useMedia();
|
|
6786
6796
|
const localId = self.participantId ?? "local";
|
|
6787
|
-
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]);
|
|
6788
6798
|
const active = participants.find((participant) => participant.isScreenSharing && participant.screenShareTrack);
|
|
6789
6799
|
if (!active?.screenShareTrack)
|
|
6790
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" });
|
|
@@ -6808,16 +6818,16 @@ function ScreenShareView(props) {
|
|
|
6808
6818
|
}
|
|
6809
6819
|
|
|
6810
6820
|
// src/components/stage/Stage.tsx
|
|
6811
|
-
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";
|
|
6812
6822
|
import { createPortal as createPortal2 } from "react-dom";
|
|
6813
6823
|
|
|
6814
6824
|
// src/components/stage/useStageDimensions.ts
|
|
6815
|
-
import { useLayoutEffect as useLayoutEffect4, useRef as useRef20, useState as
|
|
6825
|
+
import { useLayoutEffect as useLayoutEffect4, useRef as useRef20, useState as useState31 } from "react";
|
|
6816
6826
|
import { flushSync as flushSync3 } from "react-dom";
|
|
6817
6827
|
function useStageDimensions(fallback3) {
|
|
6818
6828
|
const ref = useRef20(null);
|
|
6819
6829
|
const current = useRef20(fallback3);
|
|
6820
|
-
const [dimensions, setDimensions] =
|
|
6830
|
+
const [dimensions, setDimensions] = useState31(fallback3);
|
|
6821
6831
|
useLayoutEffect4(() => {
|
|
6822
6832
|
const element = ref.current;
|
|
6823
6833
|
if (!element || typeof ResizeObserver === "undefined") return;
|
|
@@ -7013,7 +7023,7 @@ function createContentPlacement() {
|
|
|
7013
7023
|
};
|
|
7014
7024
|
}
|
|
7015
7025
|
function PersistentStageContent({ placement, children }) {
|
|
7016
|
-
const [host, setHost] =
|
|
7026
|
+
const [host, setHost] = useState32(null);
|
|
7017
7027
|
useLayoutEffect5(() => {
|
|
7018
7028
|
const element = document.createElement("div");
|
|
7019
7029
|
Object.assign(element.style, TILE_FILL);
|
|
@@ -7056,16 +7066,16 @@ function Stage({
|
|
|
7056
7066
|
}) {
|
|
7057
7067
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
7058
7068
|
const { ref: boxRef, dimensions: box } = useStageDimensions(FALLBACK_BOX);
|
|
7059
|
-
const [overflowOpen, setOverflowOpen] =
|
|
7060
|
-
const [shareAspects, setShareAspects] =
|
|
7061
|
-
const [uncontrolledPinnedId, setUncontrolledPinnedId] =
|
|
7069
|
+
const [overflowOpen, setOverflowOpen] = useState32(false);
|
|
7070
|
+
const [shareAspects, setShareAspects] = useState32(/* @__PURE__ */ new Map());
|
|
7071
|
+
const [uncontrolledPinnedId, setUncontrolledPinnedId] = useState32(null);
|
|
7062
7072
|
const activePinnedId = pinnedId === void 0 ? uncontrolledPinnedId : pinnedId;
|
|
7063
7073
|
const orderRef = useRef22([]);
|
|
7064
7074
|
const seenAtRef = useRef22(/* @__PURE__ */ new Map());
|
|
7065
7075
|
const nextSeenRef = useRef22(0);
|
|
7066
7076
|
const lastSpeakerRef = useRef22(null);
|
|
7067
7077
|
const lastRemoteSpeakerRef = useRef22(null);
|
|
7068
|
-
const ordered =
|
|
7078
|
+
const ordered = useMemo13(() => {
|
|
7069
7079
|
if (!interactive) {
|
|
7070
7080
|
seenAtRef.current = new Map(items.map((item, index) => [item.id, index]));
|
|
7071
7081
|
nextSeenRef.current = items.length;
|
|
@@ -7078,21 +7088,21 @@ function Stage({
|
|
|
7078
7088
|
return stabilizeOrder(orderRef.current, items);
|
|
7079
7089
|
}, [interactive, items]);
|
|
7080
7090
|
const handOrderRef = useRef22([]);
|
|
7081
|
-
const handOrders =
|
|
7091
|
+
const handOrders = useMemo13(() => {
|
|
7082
7092
|
const raised = ordered.filter((item) => item.kind === "participant" && item.participant.isHandRaised).map((item) => item.id);
|
|
7083
7093
|
const survivors = handOrderRef.current.filter((id) => raised.includes(id));
|
|
7084
7094
|
const next = [...survivors, ...raised.filter((id) => !survivors.includes(id))];
|
|
7085
7095
|
handOrderRef.current = next;
|
|
7086
7096
|
return new Map(next.map((id, index) => [id, index + 1]));
|
|
7087
7097
|
}, [ordered]);
|
|
7088
|
-
|
|
7098
|
+
useEffect21(() => {
|
|
7089
7099
|
orderRef.current = ordered.map((item) => item.id);
|
|
7090
7100
|
const speaking = speakingParticipantId(ordered);
|
|
7091
7101
|
if (speaking) lastSpeakerRef.current = speaking;
|
|
7092
7102
|
lastRemoteSpeakerRef.current = floatingSpeakerId(ordered, lastRemoteSpeakerRef.current);
|
|
7093
7103
|
}, [ordered]);
|
|
7094
|
-
const primary =
|
|
7095
|
-
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(() => {
|
|
7096
7106
|
if (!ordered.length) return EMPTY_GEOMETRY;
|
|
7097
7107
|
const wideIds = ordered.filter(isContentItem).map((item) => item.id);
|
|
7098
7108
|
if (layout === "grid" || !primary) {
|
|
@@ -7130,7 +7140,7 @@ function Stage({
|
|
|
7130
7140
|
}
|
|
7131
7141
|
);
|
|
7132
7142
|
}, [activePinnedId, box, interactive, layout, maxPerPage, minTileWidth, ordered, primary, shareAspects]);
|
|
7133
|
-
const framesById =
|
|
7143
|
+
const framesById = useMemo13(() => new Map(geometry.frames.map((frame) => [frame.id, frame])), [geometry.frames]);
|
|
7134
7144
|
const foldedContent = ordered.filter((item) => item.kind !== "participant" && !framesById.has(item.id));
|
|
7135
7145
|
const renderContent = (item, context, primaryRenderer) => {
|
|
7136
7146
|
if (primaryRenderer && renderPrimaryContent) return /* @__PURE__ */ jsx56(StageContentTileSurface, { item, ...context, mediaVisible: true, media: renderPrimaryContent(item) });
|
|
@@ -7139,7 +7149,7 @@ function Stage({
|
|
|
7139
7149
|
return /* @__PURE__ */ jsx56(StageContentTile, { item, ...context });
|
|
7140
7150
|
};
|
|
7141
7151
|
const animate = animateOverride ?? !prefersReducedMotion;
|
|
7142
|
-
const [displayed, setDisplayed] =
|
|
7152
|
+
const [displayed, setDisplayed] = useState32({
|
|
7143
7153
|
source: ordered,
|
|
7144
7154
|
geometry,
|
|
7145
7155
|
tiles: ordered.map((item) => ({ item, frame: framesById.get(item.id), leaving: false }))
|
|
@@ -7158,11 +7168,11 @@ function Stage({
|
|
|
7158
7168
|
}
|
|
7159
7169
|
return placement;
|
|
7160
7170
|
};
|
|
7161
|
-
|
|
7171
|
+
useEffect21(() => {
|
|
7162
7172
|
const present = new Set(displayed.tiles.map(({ item }) => item.id));
|
|
7163
7173
|
for (const id of contentPlacements.current.keys()) if (!present.has(id)) contentPlacements.current.delete(id);
|
|
7164
7174
|
}, [displayed.tiles]);
|
|
7165
|
-
|
|
7175
|
+
useEffect21(() => {
|
|
7166
7176
|
const departing = displayed.tiles.filter((tile) => tile.leaving);
|
|
7167
7177
|
if (!departing.length) return;
|
|
7168
7178
|
const nextExpiry = Math.min(...departing.map((tile) => (tile.departedAt ?? 0) + 160));
|
|
@@ -7170,7 +7180,7 @@ function Stage({
|
|
|
7170
7180
|
return () => clearTimeout(timer);
|
|
7171
7181
|
}, [displayed]);
|
|
7172
7182
|
const tilesRef = useRef22(null);
|
|
7173
|
-
|
|
7183
|
+
useEffect21(() => {
|
|
7174
7184
|
const root = tilesRef.current;
|
|
7175
7185
|
if (!root) return;
|
|
7176
7186
|
const updateAspect = (event) => {
|
|
@@ -7191,7 +7201,7 @@ function Stage({
|
|
|
7191
7201
|
};
|
|
7192
7202
|
}, [ordered]);
|
|
7193
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(";");
|
|
7194
|
-
const togglePin =
|
|
7204
|
+
const togglePin = useCallback8(
|
|
7195
7205
|
(item) => {
|
|
7196
7206
|
const next = activePinnedId === item.id && !(layout === "grid" && isContentItem(item)) ? null : item.id;
|
|
7197
7207
|
if (pinnedId === void 0) setUncontrolledPinnedId(next);
|
|
@@ -7199,7 +7209,7 @@ function Stage({
|
|
|
7199
7209
|
},
|
|
7200
7210
|
[activePinnedId, layout, onPinnedChange, pinnedId]
|
|
7201
7211
|
);
|
|
7202
|
-
const handlersById =
|
|
7212
|
+
const handlersById = useMemo13(() => {
|
|
7203
7213
|
const map = /* @__PURE__ */ new Map();
|
|
7204
7214
|
if (!interactive) return map;
|
|
7205
7215
|
for (const item of ordered) {
|
|
@@ -7310,7 +7320,7 @@ function Stage({
|
|
|
7310
7320
|
Stage.displayName = "Stage";
|
|
7311
7321
|
|
|
7312
7322
|
// src/components/participant-grid/ParticipantGrid.tsx
|
|
7313
|
-
import React19, { useMemo as
|
|
7323
|
+
import React19, { useMemo as useMemo14 } from "react";
|
|
7314
7324
|
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
7315
7325
|
var MIN_TILE_WIDTH = { desktop: 150, mobile: 88 };
|
|
7316
7326
|
function ParticipantGrid(props) {
|
|
@@ -7318,7 +7328,7 @@ function ParticipantGrid(props) {
|
|
|
7318
7328
|
const participantsSlice = useParticipants();
|
|
7319
7329
|
const media = useMedia();
|
|
7320
7330
|
const localId = self.participantId ?? "local";
|
|
7321
|
-
const participants =
|
|
7331
|
+
const participants = useMemo14(() => {
|
|
7322
7332
|
const hasLocalPresence = Boolean(self.participantId || self.displayName || Object.values(media.local).some((track) => track.state !== "disabled"));
|
|
7323
7333
|
return hasLocalPresence ? toVideoParticipants(participantsSlice.roster, media.remote, localId, self.displayName ?? "You", media.local) : [];
|
|
7324
7334
|
}, [localId, media.local, media.remote, participantsSlice.roster, self.displayName, self.participantId]);
|
|
@@ -7327,7 +7337,7 @@ function ParticipantGrid(props) {
|
|
|
7327
7337
|
var ParticipantGridSurface = React19.memo(function ParticipantGridSurface2({ participants, layout = "grid", variant, pinnedParticipantId, onOverflowClick, onParticipantClick, onParticipantDoubleClick, maxVisibleParticipants, className, screenShareContent }) {
|
|
7328
7338
|
const isMobile = useIsMobile();
|
|
7329
7339
|
const effectiveVariant = variant ?? (isMobile ? "mobile" : "desktop");
|
|
7330
|
-
const items =
|
|
7340
|
+
const items = useMemo14(() => buildStageItems(participants, false), [participants]);
|
|
7331
7341
|
return /* @__PURE__ */ jsx57(
|
|
7332
7342
|
Stage,
|
|
7333
7343
|
{
|
|
@@ -7390,7 +7400,7 @@ var WhiteboardView = memo2(WhiteboardViewBase);
|
|
|
7390
7400
|
WhiteboardView.displayName = "WhiteboardView";
|
|
7391
7401
|
|
|
7392
7402
|
// src/components/call-card/CallCard.tsx
|
|
7393
|
-
import { useEffect as
|
|
7403
|
+
import { useEffect as useEffect22, useId as useId2, useRef as useRef23 } from "react";
|
|
7394
7404
|
import { Fragment as Fragment26, jsx as jsx59, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
7395
7405
|
function CallCard({ state, onClose, interactive = true, children, panel, onPanelChange, peopleCount, chatEnabled = true, participantsEnabled = true }) {
|
|
7396
7406
|
const phone = useIsMobile();
|
|
@@ -7401,14 +7411,14 @@ function CallCard({ state, onClose, interactive = true, children, panel, onPanel
|
|
|
7401
7411
|
const selected = panel === "chat" ? "chat" : "participants";
|
|
7402
7412
|
const drawerRef = useRef23(null);
|
|
7403
7413
|
const openerRef = useRef23(null);
|
|
7404
|
-
|
|
7414
|
+
useEffect22(() => {
|
|
7405
7415
|
if (!interactive || state !== "open") return;
|
|
7406
7416
|
const drawer = drawerRef.current;
|
|
7407
7417
|
if (!drawer || drawer.contains(document.activeElement)) return;
|
|
7408
7418
|
openerRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
7409
7419
|
drawer.focus({ preventScroll: true });
|
|
7410
7420
|
}, [interactive, state]);
|
|
7411
|
-
|
|
7421
|
+
useEffect22(() => {
|
|
7412
7422
|
if (!interactive || state !== "closing") return;
|
|
7413
7423
|
const opener = openerRef.current;
|
|
7414
7424
|
openerRef.current = null;
|
|
@@ -7506,7 +7516,7 @@ function SpacePresentation({ colorScheme = "dark", stageBackground, header, stag
|
|
|
7506
7516
|
// src/components/space-view/SpaceView.tsx
|
|
7507
7517
|
import "@q9labsai/chalk-client";
|
|
7508
7518
|
import { DEFAULT_QUICK_REACTIONS as DEFAULT_QUICK_REACTIONS2 } from "@q9labsai/chalk-ui/reactions";
|
|
7509
|
-
import { useCallback as
|
|
7519
|
+
import { useCallback as useCallback15, useEffect as useEffect32, useMemo as useMemo19, useRef as useRef29, useState as useState43 } from "react";
|
|
7510
7520
|
|
|
7511
7521
|
// src/components/space-header/call-diagnostics.ts
|
|
7512
7522
|
function callDiagnostics(connection, media) {
|
|
@@ -7537,12 +7547,12 @@ function callCountdown(deadline, now, previousSeconds) {
|
|
|
7537
7547
|
}
|
|
7538
7548
|
|
|
7539
7549
|
// src/internal/useEpisodeDuration.ts
|
|
7540
|
-
import { useEffect as
|
|
7550
|
+
import { useEffect as useEffect23, useState as useState33 } from "react";
|
|
7541
7551
|
function useEpisodeDuration() {
|
|
7542
7552
|
const connection = useConnection();
|
|
7543
7553
|
const episodeStart = connection.episode?.startedAt ? Date.parse(connection.episode.startedAt) : null;
|
|
7544
|
-
const [now, setNow] =
|
|
7545
|
-
|
|
7554
|
+
const [now, setNow] = useState33(() => Date.now());
|
|
7555
|
+
useEffect23(() => {
|
|
7546
7556
|
if (episodeStart === null || Number.isNaN(episodeStart)) return;
|
|
7547
7557
|
setNow(Date.now());
|
|
7548
7558
|
const timer = window.setInterval(() => setNow(Date.now()), 1e3);
|
|
@@ -7553,7 +7563,7 @@ function useEpisodeDuration() {
|
|
|
7553
7563
|
}
|
|
7554
7564
|
|
|
7555
7565
|
// src/internal/useSoundCues.ts
|
|
7556
|
-
import { useCallback as
|
|
7566
|
+
import { useCallback as useCallback9, useEffect as useEffect24, useRef as useRef25 } from "react";
|
|
7557
7567
|
|
|
7558
7568
|
// src/internal/sound-cues.ts
|
|
7559
7569
|
function idsOf(items, id) {
|
|
@@ -7711,7 +7721,7 @@ function useSoundCues(enabled, createPlayer = createSoundPlayer) {
|
|
|
7711
7721
|
createPlayerRef.current = createPlayer;
|
|
7712
7722
|
const pendingFailures = useRef25(/* @__PURE__ */ new Set());
|
|
7713
7723
|
const failureTurn = useRef25(void 0);
|
|
7714
|
-
const playFailure =
|
|
7724
|
+
const playFailure = useCallback9((failure) => {
|
|
7715
7725
|
const key = JSON.stringify([failure.code, failure.message, failure.recoverable]);
|
|
7716
7726
|
if (!enabledRef.current || pendingFailures.current.has(key)) return;
|
|
7717
7727
|
pendingFailures.current.add(key);
|
|
@@ -7722,7 +7732,7 @@ function useSoundCues(enabled, createPlayer = createSoundPlayer) {
|
|
|
7722
7732
|
failureTurn.current = void 0;
|
|
7723
7733
|
}, 0);
|
|
7724
7734
|
}, []);
|
|
7725
|
-
|
|
7735
|
+
useEffect24(() => {
|
|
7726
7736
|
const player = createPlayerRef.current({ outputDeviceId });
|
|
7727
7737
|
playerRef.current = player;
|
|
7728
7738
|
let previous = client.getSnapshot();
|
|
@@ -7754,7 +7764,7 @@ function useSoundCues(enabled, createPlayer = createSoundPlayer) {
|
|
|
7754
7764
|
pendingFailures.current.clear();
|
|
7755
7765
|
};
|
|
7756
7766
|
}, [client, outputDeviceId, playFailure]);
|
|
7757
|
-
return
|
|
7767
|
+
return useCallback9(
|
|
7758
7768
|
(cue, failure) => {
|
|
7759
7769
|
if (cue === "error" && failure) return playFailure(failure);
|
|
7760
7770
|
if (enabledRef.current) playerRef.current?.play(cue);
|
|
@@ -7764,14 +7774,14 @@ function useSoundCues(enabled, createPlayer = createSoundPlayer) {
|
|
|
7764
7774
|
}
|
|
7765
7775
|
|
|
7766
7776
|
// src/components/composite/ReactionPicker.tsx
|
|
7767
|
-
import React21, { useMemo as
|
|
7777
|
+
import React21, { useMemo as useMemo15, useState as useState35, useCallback as useCallback11, useEffect as useEffect26, useRef as useRef27 } from "react";
|
|
7768
7778
|
import { DEFAULT_QUICK_REACTIONS, EMOJI_CATEGORIES, EMOJI_KEYWORDS } from "@q9labsai/chalk-ui/reactions";
|
|
7769
7779
|
|
|
7770
7780
|
// src/components/composite/ReactionTray.tsx
|
|
7771
|
-
import { useCallback as
|
|
7781
|
+
import { useCallback as useCallback10, useEffect as useEffect25, useLayoutEffect as useLayoutEffect6, useRef as useRef26, useState as useState34 } from "react";
|
|
7772
7782
|
import { Fragment as Fragment27, jsx as jsx61, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
7773
7783
|
function ReactionTray({ isHandRaised, onToggleHandRaise, reactions, onSelect, onClose, position = "top", className }) {
|
|
7774
|
-
const [more, setMore] =
|
|
7784
|
+
const [more, setMore] = useState34(false);
|
|
7775
7785
|
const returnFocus = useRef26(null);
|
|
7776
7786
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
7777
7787
|
const { trigger } = useHaptics();
|
|
@@ -7808,14 +7818,14 @@ function ReactionTray({ isHandRaised, onToggleHandRaise, reactions, onSelect, on
|
|
|
7808
7818
|
if (returnFocus.current instanceof HTMLElement && returnFocus.current.isConnected) returnFocus.current.focus();
|
|
7809
7819
|
};
|
|
7810
7820
|
}, [position]);
|
|
7811
|
-
|
|
7821
|
+
useEffect25(() => {
|
|
7812
7822
|
const handleKeyDown2 = (event) => {
|
|
7813
7823
|
if (event.key === "Escape") onClose();
|
|
7814
7824
|
};
|
|
7815
7825
|
document.addEventListener("keydown", handleKeyDown2);
|
|
7816
7826
|
return () => document.removeEventListener("keydown", handleKeyDown2);
|
|
7817
7827
|
}, [onClose]);
|
|
7818
|
-
const handleSelect =
|
|
7828
|
+
const handleSelect = useCallback10(
|
|
7819
7829
|
(emoji) => {
|
|
7820
7830
|
void trigger("success");
|
|
7821
7831
|
onSelect(emoji);
|
|
@@ -7856,18 +7866,19 @@ import { Fragment as Fragment28, jsx as jsx62, jsxs as jsxs40 } from "react/jsx-
|
|
|
7856
7866
|
var ReactionPicker = React21.memo(({ isHandRaised, onToggleHandRaise, isOpen, onClose, onSelect, recentReactions = [], allowedReactions, position = "top", participantColorSeed, participantGradientPreference, className, size = "default" }) => {
|
|
7857
7867
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
7858
7868
|
const { trigger } = useHaptics();
|
|
7859
|
-
const [activeCategory, setActiveCategory] =
|
|
7860
|
-
const [searchQuery, setSearchQuery] =
|
|
7869
|
+
const [activeCategory, setActiveCategory] = useState35("smileys");
|
|
7870
|
+
const [searchQuery, setSearchQuery] = useState35("");
|
|
7861
7871
|
const inputRef = useRef27(null);
|
|
7862
|
-
const themeVariables =
|
|
7863
|
-
|
|
7872
|
+
const themeVariables = useMemo15(() => getParticipantThemeVariables(participantColorSeed, participantGradientPreference), [participantColorSeed, participantGradientPreference]);
|
|
7873
|
+
useEffect26(() => {
|
|
7864
7874
|
if (isOpen) {
|
|
7865
|
-
setTimeout(() => inputRef.current?.focus(), 50);
|
|
7875
|
+
const timer = setTimeout(() => inputRef.current?.focus(), 50);
|
|
7866
7876
|
setSearchQuery("");
|
|
7867
7877
|
setActiveCategory("smileys");
|
|
7878
|
+
return () => clearTimeout(timer);
|
|
7868
7879
|
}
|
|
7869
7880
|
}, [isOpen]);
|
|
7870
|
-
const handleSelect =
|
|
7881
|
+
const handleSelect = useCallback11(
|
|
7871
7882
|
(emoji) => {
|
|
7872
7883
|
void trigger("success");
|
|
7873
7884
|
onSelect(emoji);
|
|
@@ -7875,7 +7886,7 @@ var ReactionPicker = React21.memo(({ isHandRaised, onToggleHandRaise, isOpen, on
|
|
|
7875
7886
|
},
|
|
7876
7887
|
[onClose, onSelect, trigger]
|
|
7877
7888
|
);
|
|
7878
|
-
|
|
7889
|
+
useEffect26(() => {
|
|
7879
7890
|
if (!isOpen || typeof window === "undefined") return;
|
|
7880
7891
|
const handleKeyDown = (e) => {
|
|
7881
7892
|
if (e.key === "Escape") onClose();
|
|
@@ -7887,7 +7898,7 @@ var ReactionPicker = React21.memo(({ isHandRaised, onToggleHandRaise, isOpen, on
|
|
|
7887
7898
|
const categories = Object.entries(EMOJI_CATEGORIES);
|
|
7888
7899
|
const isSearching = searchQuery.trim() !== "";
|
|
7889
7900
|
const query = searchQuery.toLowerCase().trim();
|
|
7890
|
-
const searchResults =
|
|
7901
|
+
const searchResults = useMemo15(() => {
|
|
7891
7902
|
if (!isSearching) return [];
|
|
7892
7903
|
const results = [];
|
|
7893
7904
|
for (const [emoji, keywords] of Object.entries(EMOJI_KEYWORDS)) {
|
|
@@ -8014,7 +8025,7 @@ var ReactionPicker = React21.memo(({ isHandRaised, onToggleHandRaise, isOpen, on
|
|
|
8014
8025
|
ReactionPicker.displayName = "ReactionPicker";
|
|
8015
8026
|
|
|
8016
8027
|
// src/components/offline-actions/OfflineActions.tsx
|
|
8017
|
-
import { useEffect as
|
|
8028
|
+
import { useEffect as useEffect27, useState as useState36, useSyncExternalStore as useSyncExternalStore5 } from "react";
|
|
8018
8029
|
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
8019
8030
|
var RECONNECTING_GRACE_MS = 2e3;
|
|
8020
8031
|
function offlineNoticeText(pendingCount, online) {
|
|
@@ -8026,10 +8037,10 @@ function OfflineActions({ reconnecting: requestedReconnecting = false, hasNotice
|
|
|
8026
8037
|
const client = useSpaceClient();
|
|
8027
8038
|
const connection = useConnection();
|
|
8028
8039
|
const offline = useOffline();
|
|
8029
|
-
const online =
|
|
8040
|
+
const online = useSyncExternalStore5(subscribeToOnline, readOnline, () => true);
|
|
8030
8041
|
const reconnecting = requestedReconnecting || connection.status === "reconnecting";
|
|
8031
8042
|
const reconnectingNoticeDue = useTrueFor(reconnecting, RECONNECTING_GRACE_MS);
|
|
8032
|
-
|
|
8043
|
+
useEffect27(() => {
|
|
8033
8044
|
void client.offline.setPolicy("send");
|
|
8034
8045
|
}, [client]);
|
|
8035
8046
|
const count = offline.pending.length;
|
|
@@ -8042,8 +8053,8 @@ function OfflineActions({ reconnecting: requestedReconnecting = false, hasNotice
|
|
|
8042
8053
|
return null;
|
|
8043
8054
|
}
|
|
8044
8055
|
function useTrueFor(value, milliseconds) {
|
|
8045
|
-
const [elapsed, setElapsed] =
|
|
8046
|
-
|
|
8056
|
+
const [elapsed, setElapsed] = useState36(false);
|
|
8057
|
+
useEffect27(() => {
|
|
8047
8058
|
setElapsed(false);
|
|
8048
8059
|
if (!value) return;
|
|
8049
8060
|
const timer = setTimeout(() => setElapsed(true), milliseconds);
|
|
@@ -8064,13 +8075,13 @@ function readOnline() {
|
|
|
8064
8075
|
}
|
|
8065
8076
|
|
|
8066
8077
|
// src/components/reconnecting-overlay/ReconnectingOverlay.tsx
|
|
8067
|
-
import { memo as memo3, useEffect as
|
|
8078
|
+
import { memo as memo3, useEffect as useEffect28, useState as useState37 } from "react";
|
|
8068
8079
|
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
8069
8080
|
var RECONNECTING_NOTICE_MS = 2e3;
|
|
8070
8081
|
var ReconnectingOverlay = memo3(function ReconnectingOverlay2({ isVisible, status, onRetry, onLeft, message, showNotice }) {
|
|
8071
8082
|
const reconnecting = isVisible && status === "reconnecting";
|
|
8072
|
-
const [elapsed, setElapsed] =
|
|
8073
|
-
|
|
8083
|
+
const [elapsed, setElapsed] = useState37(false);
|
|
8084
|
+
useEffect28(() => {
|
|
8074
8085
|
setElapsed(false);
|
|
8075
8086
|
if (!reconnecting) return;
|
|
8076
8087
|
const timer = setTimeout(() => setElapsed(true), RECONNECTING_NOTICE_MS);
|
|
@@ -8084,7 +8095,7 @@ var ReconnectingOverlay = memo3(function ReconnectingOverlay2({ isVisible, statu
|
|
|
8084
8095
|
});
|
|
8085
8096
|
|
|
8086
8097
|
// src/components/toast-stack/useCallToasts.ts
|
|
8087
|
-
import { useCallback as
|
|
8098
|
+
import { useCallback as useCallback12, useEffect as useEffect29, useRef as useRef28, useState as useState38 } from "react";
|
|
8088
8099
|
|
|
8089
8100
|
// src/components/toast-stack/call-events.tsx
|
|
8090
8101
|
import { Fragment as Fragment29, jsx as jsx65, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
@@ -8181,9 +8192,9 @@ function callEventToasts(previous, next) {
|
|
|
8181
8192
|
// src/components/toast-stack/useCallToasts.ts
|
|
8182
8193
|
function useCallToasts() {
|
|
8183
8194
|
const client = useSpaceClient();
|
|
8184
|
-
const [toasts, setToasts] =
|
|
8195
|
+
const [toasts, setToasts] = useState38([]);
|
|
8185
8196
|
const sequence = useRef28(0);
|
|
8186
|
-
|
|
8197
|
+
useEffect29(() => {
|
|
8187
8198
|
setToasts([]);
|
|
8188
8199
|
let previous = client.getSnapshot();
|
|
8189
8200
|
let failedSource;
|
|
@@ -8216,26 +8227,28 @@ function useCallToasts() {
|
|
|
8216
8227
|
offError();
|
|
8217
8228
|
};
|
|
8218
8229
|
}, [client]);
|
|
8219
|
-
const dismiss =
|
|
8220
|
-
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)), []);
|
|
8221
8232
|
return { toasts, dismiss, dismissFailure };
|
|
8222
8233
|
}
|
|
8223
8234
|
|
|
8224
8235
|
// src/components/call-limbo/useCallLink.ts
|
|
8225
|
-
import {
|
|
8236
|
+
import { useState as useState39 } from "react";
|
|
8226
8237
|
function useCallLink(alone) {
|
|
8227
|
-
const [open, setOpen] =
|
|
8228
|
-
|
|
8238
|
+
const [open, setOpen] = useState39(alone);
|
|
8239
|
+
const [wasAlone, setWasAlone] = useState39(alone);
|
|
8240
|
+
if (wasAlone !== alone) {
|
|
8241
|
+
setWasAlone(alone);
|
|
8229
8242
|
if (!alone) setOpen(false);
|
|
8230
|
-
}
|
|
8243
|
+
}
|
|
8231
8244
|
return { open, toggle: () => setOpen((current) => !current), close: () => setOpen(false) };
|
|
8232
8245
|
}
|
|
8233
8246
|
|
|
8234
8247
|
// src/components/toast-stack/NoticeButton.tsx
|
|
8235
|
-
import { useState as
|
|
8248
|
+
import { useState as useState40 } from "react";
|
|
8236
8249
|
import { jsx as jsx66, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
8237
8250
|
function NoticeButton({ toasts, onDismiss }) {
|
|
8238
|
-
const [open, setOpen] =
|
|
8251
|
+
const [open, setOpen] = useState40(false);
|
|
8239
8252
|
if (toasts.length === 0) return null;
|
|
8240
8253
|
const label = toasts.length === 1 ? "1 notice" : `${toasts.length} notices`;
|
|
8241
8254
|
const trigger = /* @__PURE__ */ jsxs42("button", { type: "button", "data-part": "notice-button", className: "chalk-notice-button", "aria-label": `Show ${label}`, children: [
|
|
@@ -8257,13 +8270,13 @@ function NoticeButton({ toasts, onDismiss }) {
|
|
|
8257
8270
|
import { BoardToastContext as BoardToastContext2 } from "@q9labsai/chalk-whiteboard/react";
|
|
8258
8271
|
|
|
8259
8272
|
// src/components/stage/SpaceStage.tsx
|
|
8260
|
-
import { useCallback as
|
|
8273
|
+
import { useCallback as useCallback14, useEffect as useEffect30, useMemo as useMemo18, useState as useState41 } from "react";
|
|
8261
8274
|
|
|
8262
8275
|
// src/components/board/Board.tsx
|
|
8263
|
-
import { useContext as useContext3, useMemo as
|
|
8276
|
+
import { useContext as useContext3, useMemo as useMemo17 } from "react";
|
|
8264
8277
|
|
|
8265
8278
|
// src/components/board/board-draw-policy.ts
|
|
8266
|
-
import { useCallback as
|
|
8279
|
+
import { useCallback as useCallback13, useMemo as useMemo16 } from "react";
|
|
8267
8280
|
function useWhoCanDraw(toast) {
|
|
8268
8281
|
const client = useSpaceClient();
|
|
8269
8282
|
const isHost = useCan("manageWhiteboard");
|
|
@@ -8271,7 +8284,7 @@ function useWhoCanDraw(toast) {
|
|
|
8271
8284
|
const { roster } = useParticipants();
|
|
8272
8285
|
const { access } = useWhiteboard();
|
|
8273
8286
|
const transport = client.whiteboard.transport();
|
|
8274
|
-
const people =
|
|
8287
|
+
const people = useMemo16(
|
|
8275
8288
|
() => roster.filter((person) => person.participantId !== self.participantId && !person.capabilities.includes("manageWhiteboard")).map((person) => ({
|
|
8276
8289
|
id: person.participantId,
|
|
8277
8290
|
name: person.displayName,
|
|
@@ -8279,13 +8292,13 @@ function useWhoCanDraw(toast) {
|
|
|
8279
8292
|
})),
|
|
8280
8293
|
[roster, self.participantId, access.permissions]
|
|
8281
8294
|
);
|
|
8282
|
-
const onPolicy =
|
|
8295
|
+
const onPolicy = useCallback13(
|
|
8283
8296
|
(policy) => {
|
|
8284
8297
|
transport?.setDrawPolicy?.(policy).catch(() => toast({ type: "error", message: "Could not change who can draw. Try again." }));
|
|
8285
8298
|
},
|
|
8286
8299
|
[transport, toast]
|
|
8287
8300
|
);
|
|
8288
|
-
const onPick =
|
|
8301
|
+
const onPick = useCallback13(
|
|
8289
8302
|
(id, picked) => {
|
|
8290
8303
|
transport?.setDrawPermission(id, picked).catch(() => toast({ type: "error", message: "Could not change who can draw. Try again." }));
|
|
8291
8304
|
},
|
|
@@ -8306,7 +8319,7 @@ function Board(props) {
|
|
|
8306
8319
|
const boardSession = useWhiteboard().engine;
|
|
8307
8320
|
const self = useSelf();
|
|
8308
8321
|
const { roster } = useParticipants();
|
|
8309
|
-
const participantIds =
|
|
8322
|
+
const participantIds = useMemo17(() => roster.map((person) => person.participantId), [roster]);
|
|
8310
8323
|
const whoCanDraw = useWhoCanDraw(useContext3(BoardToastContext));
|
|
8311
8324
|
return /* @__PURE__ */ jsx67(
|
|
8312
8325
|
SharedBoard,
|
|
@@ -8328,33 +8341,35 @@ function Board(props) {
|
|
|
8328
8341
|
// src/components/stage/SpaceStage.tsx
|
|
8329
8342
|
import { jsx as jsx68 } from "react/jsx-runtime";
|
|
8330
8343
|
function SpaceStage({ pinnedId, onPinnedChange, tiles, layout, onLayoutChange, generatedAvatars = true, whiteboard, onOverflowClick, shareCapture, onStopSharing, onChangeShare, colorScheme = "dark", onCloseBoard, className }) {
|
|
8331
|
-
const items =
|
|
8332
|
-
const [selectedShare, setSelectedShare] =
|
|
8333
|
-
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);
|
|
8334
8347
|
const pin = pinnedId === void 0 ? localPin : pinnedId;
|
|
8335
|
-
const setPin =
|
|
8348
|
+
const setPin = useCallback14(
|
|
8336
8349
|
(id) => {
|
|
8337
8350
|
setLocalPin(id);
|
|
8338
8351
|
onPinnedChange?.(id);
|
|
8339
8352
|
},
|
|
8340
8353
|
[onPinnedChange]
|
|
8341
8354
|
);
|
|
8342
|
-
const [following, setFollowing] =
|
|
8355
|
+
const [following, setFollowing] = useState41(void 0);
|
|
8343
8356
|
const boardOpen = whiteboard?.isOpen === true && Boolean(whiteboard.props);
|
|
8344
|
-
|
|
8357
|
+
const [wasBoardOpen, setWasBoardOpen] = useState41(boardOpen);
|
|
8358
|
+
if (wasBoardOpen !== boardOpen) {
|
|
8359
|
+
setWasBoardOpen(boardOpen);
|
|
8345
8360
|
if (!boardOpen) setFollowing(void 0);
|
|
8346
|
-
}
|
|
8361
|
+
}
|
|
8347
8362
|
const canFollow = boardOpen && Boolean(whiteboard?.sendView);
|
|
8348
8363
|
const target = following === void 0 ? whiteboard?.presenterId : following;
|
|
8349
8364
|
const followed = canFollow && tiles.some((tile) => tile.id === target && !tile.isLocal) ? target ?? null : null;
|
|
8350
8365
|
const activePin = items.some((item) => item.id === pin) ? pin : null;
|
|
8351
8366
|
const shares = items.filter((item) => item.kind === "screen-share");
|
|
8352
8367
|
const activeShare = selectedShare && shares.some((item) => item.id === selectedShare) ? selectedShare : null;
|
|
8353
|
-
|
|
8368
|
+
useEffect30(() => {
|
|
8354
8369
|
if (pin !== activePin) setPin(activePin);
|
|
8355
8370
|
if (selectedShare !== activeShare) setSelectedShare(activeShare);
|
|
8356
8371
|
}, [pin, activePin, selectedShare, activeShare, setPin]);
|
|
8357
|
-
const follow =
|
|
8372
|
+
const follow = useCallback14(
|
|
8358
8373
|
(id) => {
|
|
8359
8374
|
if (id) {
|
|
8360
8375
|
setPin(null);
|
|
@@ -8364,7 +8379,7 @@ function SpaceStage({ pinnedId, onPinnedChange, tiles, layout, onLayoutChange, g
|
|
|
8364
8379
|
},
|
|
8365
8380
|
[setPin]
|
|
8366
8381
|
);
|
|
8367
|
-
const renderContentTile =
|
|
8382
|
+
const renderContentTile = useCallback14(
|
|
8368
8383
|
(item, context) => {
|
|
8369
8384
|
if (item.kind === "screen-share")
|
|
8370
8385
|
return /* @__PURE__ */ jsx68(
|
|
@@ -8375,7 +8390,7 @@ function SpaceStage({ pinnedId, onPinnedChange, tiles, layout, onLayoutChange, g
|
|
|
8375
8390
|
capture: item.participant.isLocal ? shareCapture : void 0,
|
|
8376
8391
|
onStopSharing: item.participant.isLocal ? onStopSharing : void 0,
|
|
8377
8392
|
onChangeShare: item.participant.isLocal ? onChangeShare : void 0,
|
|
8378
|
-
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(
|
|
8379
8394
|
"button",
|
|
8380
8395
|
{
|
|
8381
8396
|
type: "button",
|
|
@@ -8384,7 +8399,7 @@ function SpaceStage({ pinnedId, onPinnedChange, tiles, layout, onLayoutChange, g
|
|
|
8384
8399
|
setPin(null);
|
|
8385
8400
|
setSelectedShare(share.id);
|
|
8386
8401
|
},
|
|
8387
|
-
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",
|
|
8388
8403
|
children: share.participant.displayName
|
|
8389
8404
|
},
|
|
8390
8405
|
share.id
|
|
@@ -8404,7 +8419,7 @@ function SpaceStage({ pinnedId, onPinnedChange, tiles, layout, onLayoutChange, g
|
|
|
8404
8419
|
},
|
|
8405
8420
|
[follow, whiteboard, shares, shareCapture, onStopSharing, onChangeShare, colorScheme, tiles, followed, canFollow, onCloseBoard]
|
|
8406
8421
|
);
|
|
8407
|
-
const focusContent =
|
|
8422
|
+
const focusContent = useCallback14(
|
|
8408
8423
|
(item) => {
|
|
8409
8424
|
if (item.kind !== "participant") onLayoutChange?.("focus");
|
|
8410
8425
|
},
|
|
@@ -8431,12 +8446,12 @@ function SpaceStage({ pinnedId, onPinnedChange, tiles, layout, onLayoutChange, g
|
|
|
8431
8446
|
SpaceStage.displayName = "SpaceStage";
|
|
8432
8447
|
|
|
8433
8448
|
// src/components/space-view/useDrawerPresence.ts
|
|
8434
|
-
import { useEffect as
|
|
8449
|
+
import { useEffect as useEffect31, useState as useState42 } from "react";
|
|
8435
8450
|
var DRAWER_EXIT_MS = 200;
|
|
8436
8451
|
function useDrawerPresence(panel, exitMs) {
|
|
8437
|
-
const [retained, setRetained] =
|
|
8438
|
-
const [state, setState] =
|
|
8439
|
-
|
|
8452
|
+
const [retained, setRetained] = useState42(panel);
|
|
8453
|
+
const [state, setState] = useState42(panel === null ? "closed" : "open");
|
|
8454
|
+
useEffect31(() => {
|
|
8440
8455
|
if (panel !== null) {
|
|
8441
8456
|
setRetained(panel);
|
|
8442
8457
|
setState("open");
|
|
@@ -8496,7 +8511,7 @@ function SpaceView({
|
|
|
8496
8511
|
const media = useMedia();
|
|
8497
8512
|
const connection = useConnection();
|
|
8498
8513
|
const offline = useOffline();
|
|
8499
|
-
const [dismissedOfflineNotice, setDismissedOfflineNotice] =
|
|
8514
|
+
const [dismissedOfflineNotice, setDismissedOfflineNotice] = useState43(null);
|
|
8500
8515
|
const offlineNotice = offline.notice && offline.notice !== dismissedOfflineNotice ? offline.notice : null;
|
|
8501
8516
|
const recording = useRecording();
|
|
8502
8517
|
const canPublishScreen = useCan("publishScreen");
|
|
@@ -8507,32 +8522,37 @@ function SpaceView({
|
|
|
8507
8522
|
const canManageRecording = useCan("manageRecording");
|
|
8508
8523
|
const episodeDuration = useEpisodeDuration();
|
|
8509
8524
|
const deadline = connection.episode?.deadline;
|
|
8510
|
-
const [now, setNow] =
|
|
8525
|
+
const [now, setNow] = useState43(Date.now);
|
|
8511
8526
|
const previousCountdown = useRef29(null);
|
|
8512
|
-
const [limitWarning, setLimitWarning] =
|
|
8527
|
+
const [limitWarning, setLimitWarning] = useState43(null);
|
|
8513
8528
|
const countdown = callCountdown(deadline, now);
|
|
8514
|
-
|
|
8529
|
+
useEffect32(() => {
|
|
8515
8530
|
if (!deadline) return;
|
|
8516
8531
|
const tick = () => setNow(Date.now());
|
|
8517
8532
|
tick();
|
|
8518
8533
|
const timer = window.setInterval(tick, 1e3);
|
|
8519
8534
|
return () => window.clearInterval(timer);
|
|
8520
8535
|
}, [deadline]);
|
|
8521
|
-
|
|
8536
|
+
useEffect32(() => {
|
|
8522
8537
|
const previous = previousCountdown.current;
|
|
8523
8538
|
const next = callCountdown(deadline, now, previous?.deadline === deadline ? previous?.seconds : void 0);
|
|
8524
8539
|
previousCountdown.current = { deadline, seconds: next.seconds };
|
|
8525
8540
|
if (previous?.deadline !== deadline) setLimitWarning(null);
|
|
8526
8541
|
if (next.warning !== null) setLimitWarning({ id: `time-limit-${deadline}-${next.warning}`, minutes: next.warning });
|
|
8527
8542
|
}, [deadline, now]);
|
|
8528
|
-
const [uncontrolledLayout, setUncontrolledLayout] =
|
|
8529
|
-
const [pinnedId, setPinnedId] =
|
|
8530
|
-
const [activePanel, setActivePanel] =
|
|
8531
|
-
const [
|
|
8532
|
-
|
|
8533
|
-
|
|
8534
|
-
|
|
8535
|
-
|
|
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();
|
|
8536
8556
|
const onCommandError = (failure, source, mediaSource, action, command) => {
|
|
8537
8557
|
if (!failure && commandError && typeof commandError === "object") callToasts.dismissFailure(commandError.code);
|
|
8538
8558
|
setCommandError(failure);
|
|
@@ -8544,15 +8564,14 @@ function SpaceView({
|
|
|
8544
8564
|
const layout = onLayoutChange ? controlledLayout ?? uncontrolledLayout : uncontrolledLayout;
|
|
8545
8565
|
const feature = (name) => features?.[name] !== false;
|
|
8546
8566
|
const localId = self.participantId ?? "local";
|
|
8547
|
-
const tiles =
|
|
8567
|
+
const tiles = useMemo19(
|
|
8548
8568
|
() => toVideoParticipants(participantsSlice.roster, media.remote, localId, self.displayName ?? "You", media.local).map((tile) => ({
|
|
8549
8569
|
...tile,
|
|
8550
8570
|
screenShareHasAudio: tile.isLocal ? media.screenShare.hasAudio : participantsSlice.roster.find((person) => person.participantId === tile.id)?.media.screenShareHasAudio
|
|
8551
8571
|
})),
|
|
8552
8572
|
[localId, media.local, media.remote, media.screenShare.hasAudio, participantsSlice.roster, self.displayName]
|
|
8553
8573
|
);
|
|
8554
|
-
|
|
8555
|
-
useEffect36(() => {
|
|
8574
|
+
useEffect32(() => {
|
|
8556
8575
|
if (feature("admission") && feature("participants") && canManageAdmission && participantsSlice.admissionQueue.length > 0) setActivePanel("participants");
|
|
8557
8576
|
}, [canManageAdmission, participantsSlice.admissionQueue.length, features?.admission, features?.participants]);
|
|
8558
8577
|
const buttons = [
|
|
@@ -8576,7 +8595,7 @@ function SpaceView({
|
|
|
8576
8595
|
const playSound = useSoundCues(feature("sounds") && soundsEnabled);
|
|
8577
8596
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
8578
8597
|
const drawer = useDrawerPresence(activePanel, prefersReducedMotion ? 0 : DRAWER_EXIT_MS);
|
|
8579
|
-
const runCommand =
|
|
8598
|
+
const runCommand = useCallback15(async (command, source, action) => {
|
|
8580
8599
|
try {
|
|
8581
8600
|
await command();
|
|
8582
8601
|
setCommandError(null);
|
|
@@ -8605,12 +8624,14 @@ function SpaceView({
|
|
|
8605
8624
|
};
|
|
8606
8625
|
const mappedFailure = mediaFailureToast(typeof displayedCommandError === "object" ? displayedCommandError : null, displayedCommandSource, externalCommandError != null ? externalCommandAction : commandAction, externalCommandError == null && retryCommand ? () => void retryMedia() : void 0);
|
|
8607
8626
|
const commandToasts = mappedFailure ? [{ id: "space-command-error", ...mappedFailure }] : typeof displayedCommandError === "string" ? [{ id: "space-command-error", message: displayedCommandError, type: "error" }] : [];
|
|
8608
|
-
const [boardToasts, setBoardToasts] =
|
|
8627
|
+
const [boardToasts, setBoardToasts] = useState43([]);
|
|
8609
8628
|
const boardToastCount = useRef29(0);
|
|
8610
|
-
|
|
8629
|
+
const [previousBoardOpen, setPreviousBoardOpen] = useState43(whiteboard?.isOpen);
|
|
8630
|
+
if (previousBoardOpen !== whiteboard?.isOpen) {
|
|
8631
|
+
setPreviousBoardOpen(whiteboard?.isOpen);
|
|
8611
8632
|
if (!whiteboard?.isOpen) setBoardToasts([]);
|
|
8612
|
-
}
|
|
8613
|
-
const showBoardToast =
|
|
8633
|
+
}
|
|
8634
|
+
const showBoardToast = useCallback15((toast) => {
|
|
8614
8635
|
if (!toast) {
|
|
8615
8636
|
setBoardToasts([]);
|
|
8616
8637
|
return;
|
|
@@ -8639,7 +8660,7 @@ function SpaceView({
|
|
|
8639
8660
|
else if (id.startsWith("board-")) setBoardToasts((current) => current.filter((toast) => toast.id !== id));
|
|
8640
8661
|
else callToasts.dismiss(id);
|
|
8641
8662
|
};
|
|
8642
|
-
const [foldedNotices, setFoldedNotices] =
|
|
8663
|
+
const [foldedNotices, setFoldedNotices] = useState43([]);
|
|
8643
8664
|
const microphoneTarget = mediaToggleTarget(media.local.microphone.state, connection.status === "live");
|
|
8644
8665
|
const cameraTarget = mediaToggleTarget(media.local.camera.state, connection.status === "live");
|
|
8645
8666
|
const folded = toasts.filter((toast) => foldedNotices.includes(toast.id));
|