@meshagent/meshagent-tailwind 0.41.4 → 0.41.5
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/CHANGELOG.md +3 -0
- package/README.md +33 -0
- package/dist/cjs/chat/chat-thread.js +15 -10
- package/dist/cjs/chat/dataset-chat-thread.d.ts +4 -1
- package/dist/cjs/chat/dataset-chat-thread.js +130 -157
- package/dist/cjs/chat/multi-thread-view.d.ts +4 -1
- package/dist/cjs/chat/multi-thread-view.js +4 -0
- package/dist/cjs/chat/new-chat-thread.d.ts +4 -1
- package/dist/cjs/chat/new-chat-thread.js +43 -87
- package/dist/cjs/file-preview/file-preview.d.ts +6 -0
- package/dist/cjs/file-preview/file-preview.js +220 -0
- package/dist/cjs/meetings/camera-grid.d.ts +46 -0
- package/dist/cjs/meetings/camera-grid.js +435 -0
- package/dist/cjs/meetings/controls.d.ts +4 -2
- package/dist/cjs/meetings/controls.js +9 -3
- package/dist/cjs/meetings/lobby.d.ts +17 -0
- package/dist/cjs/meetings/lobby.js +595 -0
- package/dist/cjs/meetings/meeting-scope.d.ts +7 -6
- package/dist/cjs/meetings/meeting-scope.js +64 -15
- package/dist/cjs/meetings/meeting-view.d.ts +6 -0
- package/dist/cjs/meetings/meeting-view.js +635 -0
- package/dist/cjs/meetings/meetings.d.ts +3 -0
- package/dist/cjs/meetings/meetings.js +3 -0
- package/dist/cjs/meetings/wake-lock.js +2 -2
- package/dist/esm/chat/chat-thread.js +15 -10
- package/dist/esm/chat/dataset-chat-thread.d.ts +4 -1
- package/dist/esm/chat/dataset-chat-thread.js +129 -133
- package/dist/esm/chat/multi-thread-view.d.ts +4 -1
- package/dist/esm/chat/multi-thread-view.js +4 -0
- package/dist/esm/chat/new-chat-thread.d.ts +4 -1
- package/dist/esm/chat/new-chat-thread.js +43 -87
- package/dist/esm/file-preview/file-preview.d.ts +6 -0
- package/dist/esm/file-preview/file-preview.js +220 -0
- package/dist/esm/meetings/camera-grid.d.ts +46 -0
- package/dist/esm/meetings/camera-grid.js +405 -0
- package/dist/esm/meetings/controls.d.ts +4 -2
- package/dist/esm/meetings/controls.js +9 -3
- package/dist/esm/meetings/lobby.d.ts +17 -0
- package/dist/esm/meetings/lobby.js +595 -0
- package/dist/esm/meetings/meeting-scope.d.ts +7 -6
- package/dist/esm/meetings/meeting-scope.js +71 -16
- package/dist/esm/meetings/meeting-view.d.ts +6 -0
- package/dist/esm/meetings/meeting-view.js +630 -0
- package/dist/esm/meetings/meetings.d.ts +3 -0
- package/dist/esm/meetings/meetings.js +3 -0
- package/dist/esm/meetings/wake-lock.js +2 -2
- package/dist/index.css +1 -1
- package/package.json +9 -5
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
createContext,
|
|
4
|
+
useContext,
|
|
5
|
+
useEffect,
|
|
6
|
+
useMemo,
|
|
7
|
+
useSyncExternalStore
|
|
8
|
+
} from "react";
|
|
9
|
+
import "@meshagent/meshagent-react";
|
|
3
10
|
import {
|
|
4
11
|
ConnectionState,
|
|
5
12
|
Room,
|
|
@@ -160,23 +167,35 @@ class MeetingController {
|
|
|
160
167
|
return this.livekitRoom.state !== ConnectionState.Disconnected;
|
|
161
168
|
}
|
|
162
169
|
get hasParticipantsWithVideo() {
|
|
163
|
-
const localHasVideo = Array.from(
|
|
164
|
-
|
|
170
|
+
const localHasVideo = Array.from(
|
|
171
|
+
this.livekitRoom.localParticipant.videoTrackPublications.values()
|
|
172
|
+
).some((publication) => !publication.isMuted);
|
|
173
|
+
const remoteHasVideo = Array.from(
|
|
174
|
+
this.livekitRoom.remoteParticipants.values()
|
|
175
|
+
).some(
|
|
176
|
+
(participant) => Array.from(participant.videoTrackPublications.values()).some(
|
|
177
|
+
(publication) => !publication.isMuted
|
|
178
|
+
)
|
|
179
|
+
);
|
|
165
180
|
return localHasVideo || remoteHasVideo;
|
|
166
181
|
}
|
|
167
182
|
subscribe(listener) {
|
|
168
183
|
this.listeners.add(listener);
|
|
169
184
|
return () => this.listeners.delete(listener);
|
|
170
185
|
}
|
|
171
|
-
async configure({ breakoutRoom } = {}) {
|
|
186
|
+
async configure({ breakoutRoom = "" } = {}) {
|
|
172
187
|
if (this.livekitRoom.state !== ConnectionState.Disconnected) {
|
|
173
|
-
throw new Error(
|
|
188
|
+
throw new Error(
|
|
189
|
+
"You cannot reconfigure while the controller is connected"
|
|
190
|
+
);
|
|
174
191
|
}
|
|
175
192
|
this._config = null;
|
|
176
193
|
this._configurationError = null;
|
|
177
194
|
this.notify();
|
|
178
195
|
try {
|
|
179
|
-
this._config = await this.room.livekit.getConnectionInfo({
|
|
196
|
+
this._config = await this.room.livekit.getConnectionInfo({
|
|
197
|
+
breakoutRoom
|
|
198
|
+
});
|
|
180
199
|
this.notify();
|
|
181
200
|
} catch (error) {
|
|
182
201
|
this._configurationError = error;
|
|
@@ -199,20 +218,29 @@ class MeetingController {
|
|
|
199
218
|
cameraAwaitEnableConfirmation: cameraEnabled,
|
|
200
219
|
microphoneAwaitEnableConfirmation: microphoneEnabled
|
|
201
220
|
});
|
|
202
|
-
const {
|
|
221
|
+
const {
|
|
222
|
+
camera: _camera,
|
|
223
|
+
microphone: _microphone,
|
|
224
|
+
...connectOptions
|
|
225
|
+
} = options ?? {};
|
|
203
226
|
try {
|
|
204
227
|
await this.livekitRoom.connect(config.url, config.token, connectOptions);
|
|
205
228
|
const localParticipant = this.livekitRoom.localParticipant;
|
|
206
229
|
await Promise.all([
|
|
207
|
-
cameraEnabled ? localParticipant.setCameraEnabled(true).then(() => this.pendingLocalMedia.setCameraUnavailable(false)).catch((error) => {
|
|
230
|
+
cameraEnabled ? localParticipant.setCameraEnabled(true, options?.camera?.options).then(() => this.pendingLocalMedia.setCameraUnavailable(false)).catch((error) => {
|
|
208
231
|
this.pendingLocalMedia.setCameraPending(false);
|
|
209
232
|
this.pendingLocalMedia.setCameraUnavailable(true);
|
|
210
233
|
console.warn("unable to enable camera after connecting", error);
|
|
211
234
|
}) : Promise.resolve(this.pendingLocalMedia.setCameraPending(false)),
|
|
212
|
-
microphoneEnabled ? localParticipant.setMicrophoneEnabled(true).then(
|
|
235
|
+
microphoneEnabled ? localParticipant.setMicrophoneEnabled(true, options?.microphone?.options).then(
|
|
236
|
+
() => this.pendingLocalMedia.setMicrophoneUnavailable(false)
|
|
237
|
+
).catch((error) => {
|
|
213
238
|
this.pendingLocalMedia.setMicrophonePending(false);
|
|
214
239
|
this.pendingLocalMedia.setMicrophoneUnavailable(true);
|
|
215
|
-
console.warn(
|
|
240
|
+
console.warn(
|
|
241
|
+
"unable to enable microphone after connecting",
|
|
242
|
+
error
|
|
243
|
+
);
|
|
216
244
|
}) : Promise.resolve(this.pendingLocalMedia.setMicrophonePending(false))
|
|
217
245
|
]);
|
|
218
246
|
this.syncPendingLocalMediaState();
|
|
@@ -223,7 +251,24 @@ class MeetingController {
|
|
|
223
251
|
}
|
|
224
252
|
async disconnect() {
|
|
225
253
|
this.pendingLocalMedia.clear();
|
|
226
|
-
|
|
254
|
+
const localParticipant = this.livekitRoom.localParticipant;
|
|
255
|
+
const disableResults = await Promise.allSettled([
|
|
256
|
+
localParticipant.setCameraEnabled(false),
|
|
257
|
+
localParticipant.setMicrophoneEnabled(false),
|
|
258
|
+
localParticipant.setScreenShareEnabled(false)
|
|
259
|
+
]);
|
|
260
|
+
for (const result of disableResults) {
|
|
261
|
+
if (result.status === "rejected") {
|
|
262
|
+
console.warn("unable to disable local meeting media", result.reason);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
for (const publication of Array.from(
|
|
266
|
+
localParticipant.trackPublications.values()
|
|
267
|
+
)) {
|
|
268
|
+
publication.track?.detach();
|
|
269
|
+
publication.track?.stop();
|
|
270
|
+
}
|
|
271
|
+
await this.livekitRoom.disconnect(true);
|
|
227
272
|
}
|
|
228
273
|
dispose() {
|
|
229
274
|
this.livekitRoom.removeAllListeners();
|
|
@@ -251,7 +296,9 @@ function useMeetingController(controller) {
|
|
|
251
296
|
const contextController = useContext(MeetingControllerContext);
|
|
252
297
|
const resolved = controller ?? contextController;
|
|
253
298
|
if (resolved == null) {
|
|
254
|
-
throw new Error(
|
|
299
|
+
throw new Error(
|
|
300
|
+
"useMeetingController must be used within MeetingScope or receive a controller"
|
|
301
|
+
);
|
|
255
302
|
}
|
|
256
303
|
useSyncExternalStore(
|
|
257
304
|
(listener) => resolved.subscribe(listener),
|
|
@@ -266,12 +313,18 @@ function MeetingScope({
|
|
|
266
313
|
roomOptions,
|
|
267
314
|
children
|
|
268
315
|
}) {
|
|
269
|
-
const controller = useMemo(
|
|
316
|
+
const controller = useMemo(
|
|
317
|
+
() => new MeetingController({
|
|
318
|
+
room: client,
|
|
319
|
+
roomOptions
|
|
320
|
+
}),
|
|
321
|
+
[client, roomOptions]
|
|
322
|
+
);
|
|
270
323
|
useEffect(() => {
|
|
271
|
-
|
|
324
|
+
controller.configure({ breakoutRoom });
|
|
272
325
|
return () => {
|
|
273
326
|
if (controller.isConnected) {
|
|
274
|
-
|
|
327
|
+
controller.disconnect().catch((error) => {
|
|
275
328
|
console.warn("unable to disconnect", error);
|
|
276
329
|
});
|
|
277
330
|
}
|
|
@@ -281,7 +334,9 @@ function MeetingScope({
|
|
|
281
334
|
return /* @__PURE__ */ jsx(WakeLocker, { children: /* @__PURE__ */ jsx(MeetingControllerContext.Provider, { value: controller, children: typeof children === "function" ? children(controller) : children }) });
|
|
282
335
|
}
|
|
283
336
|
function firstEnabledVideoPublication(participant) {
|
|
284
|
-
return Array.from(
|
|
337
|
+
return Array.from(
|
|
338
|
+
participant.videoTrackPublications.values()
|
|
339
|
+
).find(
|
|
285
340
|
(publication) => !publication.isMuted && publication.source === Track.Source.Camera && publication.videoTrack != null
|
|
286
341
|
);
|
|
287
342
|
}
|