@q9labsai/chalk-react 5.2.5 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-HWQLW4JR.js → chunk-ES7AECAD.js} +21 -14
- package/dist/{chunk-6AUMKXPU.js → chunk-HJVAN33K.js} +25 -20
- package/dist/{chunk-WRKIKIXF.js → chunk-RCHBFOCR.js} +410 -362
- package/dist/components/chalk/Chalk.d.ts +1 -0
- package/dist/components/control-bar/command-failure.d.ts +6 -6
- package/dist/components/index.js +3 -3
- package/dist/components/participant-grid/ParticipantGrid.d.ts +3 -0
- package/dist/components/participant-tile/ParticipantTile.d.ts +1 -0
- package/dist/components/participants-panel/ParticipantsPanel.d.ts +1 -0
- package/dist/components/stage/stage-layout.d.ts +1 -0
- package/dist/headless.js +1 -1
- package/dist/index.js +3 -3
- package/dist/selectors/device-hint.d.ts +2 -0
- package/dist/test-support/index.js +2 -2
- package/package.json +5 -5
|
@@ -99,15 +99,17 @@ var FLOAT_BOTTOM = 8 + 64 + 60;
|
|
|
99
99
|
function floatPeople(box, primaryId, stripIds, options) {
|
|
100
100
|
const content = stripIds.filter((id) => options.wideIds?.includes(id));
|
|
101
101
|
const people = stripIds.filter((id) => !content.includes(id));
|
|
102
|
-
const
|
|
102
|
+
const ownDevices = people.filter((id) => options.ownDeviceIds?.includes(id));
|
|
103
|
+
const speaker = options.speakerId && options.speakerId !== options.localId && !ownDevices.includes(options.speakerId) && people.includes(options.speakerId) ? options.speakerId : null;
|
|
103
104
|
const local = options.localId && people.includes(options.localId) ? options.localId : null;
|
|
104
|
-
const others = people.filter((id) => id !== speaker && id !== local);
|
|
105
|
-
const ordered = [...speaker ? [speaker] : [], ...others, ...local ? [local] : []];
|
|
105
|
+
const others = people.filter((id) => id !== speaker && id !== local && !ownDevices.includes(id));
|
|
106
|
+
const ordered = [...speaker ? [speaker] : [], ...others, ...local ? [local] : [], ...ownDevices];
|
|
106
107
|
const fold = (max2) => {
|
|
107
108
|
if (content.length + ordered.length <= max2) return [...content, ...ordered];
|
|
108
109
|
const shares = content.slice(0, max2 - 1);
|
|
109
110
|
const slots = max2 - 1 - shares.length;
|
|
110
|
-
const faces = ordered.
|
|
111
|
+
const faces = ordered.slice(0, slots);
|
|
112
|
+
if (slots > 0 && local && !faces.includes(local)) faces[slots - 1] = local;
|
|
111
113
|
return [...shares, ...faces, MORE_TILE_ID];
|
|
112
114
|
};
|
|
113
115
|
const sizeOf = (id) => id === speaker || content.includes(id) ? FLOAT_SPEAKER : FLOAT_PERSON;
|
|
@@ -181,6 +183,9 @@ function buildStageItems(participants, whiteboardOpen) {
|
|
|
181
183
|
function isContentItem(item) {
|
|
182
184
|
return item.kind !== "participant";
|
|
183
185
|
}
|
|
186
|
+
function isOwnDeviceSeat(item) {
|
|
187
|
+
return item.kind === "participant" && item.participant.isOwnDevice === true;
|
|
188
|
+
}
|
|
184
189
|
function stabilizeOrder(previousIds, items) {
|
|
185
190
|
const byId = new Map(items.map((item) => [item.id, item]));
|
|
186
191
|
const ordered = [];
|
|
@@ -196,7 +201,7 @@ function stabilizeOrder(previousIds, items) {
|
|
|
196
201
|
ordered.push(item);
|
|
197
202
|
placed.add(item.id);
|
|
198
203
|
}
|
|
199
|
-
return ordered;
|
|
204
|
+
return [...ordered.filter((item) => !isOwnDeviceSeat(item)), ...ordered.filter(isOwnDeviceSeat)];
|
|
200
205
|
}
|
|
201
206
|
function firstScreenShare(items, seenAt) {
|
|
202
207
|
let first;
|
|
@@ -215,23 +220,25 @@ function participantWhere(items, predicate) {
|
|
|
215
220
|
return items.find((item) => item.kind === "participant" && predicate(item.participant));
|
|
216
221
|
}
|
|
217
222
|
function choosePrimary(items, context) {
|
|
218
|
-
|
|
219
|
-
|
|
223
|
+
const eligible = items.filter((item) => !isOwnDeviceSeat(item));
|
|
224
|
+
if (eligible.length === 0) return null;
|
|
225
|
+
const pinned = context.pinnedId ? eligible.find((item) => item.id === context.pinnedId) : void 0;
|
|
220
226
|
if (pinned) return pinned;
|
|
221
|
-
const content = firstScreenShare(
|
|
227
|
+
const content = firstScreenShare(eligible, context.seenAt) ?? eligible.find((item) => item.kind === "whiteboard");
|
|
222
228
|
if (content) return content;
|
|
223
|
-
return participantWhere(
|
|
229
|
+
return participantWhere(eligible, (participant) => participant.isActiveSpeaker === true) ?? participantWhere(eligible, (participant) => participant.isSpeaking === true) ?? (context.lastSpeakerId ? eligible.find((item) => item.kind === "participant" && item.id === context.lastSpeakerId) : void 0) ?? participantWhere(eligible, (participant) => !participant.isLocal) ?? participantWhere(eligible, () => true) ?? eligible[0] ?? null;
|
|
224
230
|
}
|
|
225
231
|
function speakingParticipantId(items, accept = () => true) {
|
|
226
|
-
return (participantWhere(items, (participant) => accept(participant) && participant.isActiveSpeaker === true) ?? participantWhere(items, (participant) => accept(participant) && participant.isSpeaking === true))?.id;
|
|
232
|
+
return (participantWhere(items, (participant) => !participant.isOwnDevice && accept(participant) && participant.isActiveSpeaker === true) ?? participantWhere(items, (participant) => !participant.isOwnDevice && accept(participant) && participant.isSpeaking === true))?.id;
|
|
227
233
|
}
|
|
228
234
|
function floatingSpeakerId(items, lastRemoteSpeakerId) {
|
|
229
|
-
|
|
235
|
+
const previous = items.some((item) => item.id === lastRemoteSpeakerId && isOwnDeviceSeat(item)) ? null : lastRemoteSpeakerId;
|
|
236
|
+
return speakingParticipantId(items, (participant) => !participant.isLocal) ?? previous;
|
|
230
237
|
}
|
|
231
238
|
function gridOrder(items, pinnedId) {
|
|
232
|
-
if (!pinnedId) return [
|
|
233
|
-
const pinned = items.find((item) => item.id === pinnedId);
|
|
234
|
-
return pinned ? [pinned, ...items.filter((item) => item.id !== pinnedId)] :
|
|
239
|
+
if (!pinnedId) return stabilizeOrder([], items);
|
|
240
|
+
const pinned = items.find((item) => item.id === pinnedId && !isOwnDeviceSeat(item));
|
|
241
|
+
return stabilizeOrder([], pinned ? [pinned, ...items.filter((item) => item.id !== pinnedId)] : items);
|
|
235
242
|
}
|
|
236
243
|
|
|
237
244
|
export {
|
|
@@ -36,11 +36,11 @@ import {
|
|
|
36
36
|
useRecording,
|
|
37
37
|
useSpaceClient,
|
|
38
38
|
useWhiteboard
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-RCHBFOCR.js";
|
|
40
40
|
import {
|
|
41
41
|
WHITEBOARD_ITEM_ID,
|
|
42
42
|
screenShareItemId
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-ES7AECAD.js";
|
|
44
44
|
import {
|
|
45
45
|
Download01Icon,
|
|
46
46
|
FileTextIcon,
|
|
@@ -262,15 +262,21 @@ function SpaceExperience(props) {
|
|
|
262
262
|
const previousStatus = useRef(connection.status);
|
|
263
263
|
const hasObservedStatus = useRef(false);
|
|
264
264
|
const autoJoinAttempted = useRef(false);
|
|
265
|
-
const previousClient =
|
|
265
|
+
const [previousClient, setPreviousClient] = useState2(client);
|
|
266
266
|
const [joinError, setJoinError] = useState2(null);
|
|
267
267
|
const [retryPending, setRetryPending] = useState2(false);
|
|
268
|
-
const [episodeEnded, setEpisodeEnded] = useState2(
|
|
268
|
+
const [episodeEnded, setEpisodeEnded] = useState2(false);
|
|
269
269
|
const [handledTerminal, setHandledTerminal] = useState2(void 0);
|
|
270
|
-
|
|
270
|
+
const [previousTerminal, setPreviousTerminal] = useState2(props.terminalState);
|
|
271
|
+
if (previousTerminal !== props.terminalState) {
|
|
272
|
+
setPreviousTerminal(props.terminalState);
|
|
273
|
+
setHandledTerminal(void 0);
|
|
274
|
+
}
|
|
271
275
|
const spaceName = props.spaceName ?? props.space ?? "Space";
|
|
272
|
-
if (previousClient
|
|
273
|
-
|
|
276
|
+
if (previousClient !== client) {
|
|
277
|
+
setPreviousClient(client);
|
|
278
|
+
setJoinError(null);
|
|
279
|
+
setEpisodeEnded(false);
|
|
274
280
|
previousStatus.current = connection.status;
|
|
275
281
|
hasObservedStatus.current = false;
|
|
276
282
|
autoJoinAttempted.current = false;
|
|
@@ -293,10 +299,6 @@ function SpaceExperience(props) {
|
|
|
293
299
|
setRetryPending(true);
|
|
294
300
|
void join(defaultJoinOptions(props)).finally(() => setRetryPending(false));
|
|
295
301
|
}, [join, props]);
|
|
296
|
-
useEffect2(() => setJoinError(null), [client]);
|
|
297
|
-
useEffect2(() => {
|
|
298
|
-
setEpisodeEnded(false);
|
|
299
|
-
}, [client]);
|
|
300
302
|
useEffect2(
|
|
301
303
|
() => client.on("episodeEnded", () => {
|
|
302
304
|
setEpisodeEnded(true);
|
|
@@ -312,7 +314,7 @@ function SpaceExperience(props) {
|
|
|
312
314
|
const previous = previousStatus.current;
|
|
313
315
|
if (hasObservedStatus.current) {
|
|
314
316
|
if (connection.status === "live" && previous !== "live" && previous !== "reconnecting") props.onJoined?.();
|
|
315
|
-
if (connection.status === "left" && previous !== "left") props.onLeft?.();
|
|
317
|
+
if ((connection.status === "leaving" || connection.status === "left") && previous !== "leaving" && previous !== "left") props.onLeft?.();
|
|
316
318
|
}
|
|
317
319
|
previousStatus.current = connection.status;
|
|
318
320
|
hasObservedStatus.current = true;
|
|
@@ -438,14 +440,17 @@ function SpaceSurface(props) {
|
|
|
438
440
|
onLeft: () => runCommand(() => client.leave()),
|
|
439
441
|
onEndEpisode: canEndEpisode ? () => runCommand(() => client.endEpisode()) : void 0,
|
|
440
442
|
reconnecting: { isVisible: connection.status === "reconnecting", status: "reconnecting", showNotice: false },
|
|
441
|
-
overlay: /* @__PURE__ */
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
443
|
+
overlay: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
444
|
+
media.microphoneMutedByOtherDevice ? /* @__PURE__ */ jsx("div", { role: "status", className: "pointer-events-none absolute inset-x-3 top-16 z-40 flex justify-center", children: /* @__PURE__ */ jsx("p", { className: "chalk-toast text-center text-sm", children: "Mic off: your other device is using it." }) }) : null,
|
|
445
|
+
media.incomingRequests[0] ? /* @__PURE__ */ jsx(
|
|
446
|
+
MediaRequestDialog,
|
|
447
|
+
{
|
|
448
|
+
request: media.incomingRequests[0],
|
|
449
|
+
onDecline: () => void runCommand(() => client.media.declineRequest(media.incomingRequests[0].requestId), media.incomingRequests[0].kind === "start_camera" ? "camera" : "microphone", "request"),
|
|
450
|
+
onAllow: () => void runCommand(() => client.media.acceptRequest(media.incomingRequests[0].requestId), media.incomingRequests[0].kind === "start_camera" ? "camera" : "microphone", "request")
|
|
451
|
+
}
|
|
452
|
+
) : null
|
|
453
|
+
] })
|
|
449
454
|
}
|
|
450
455
|
);
|
|
451
456
|
}
|