@meshagent/meshagent-tailwind 0.41.2 → 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 +9 -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
|
@@ -27,6 +27,7 @@ __export(meeting_scope_exports, {
|
|
|
27
27
|
module.exports = __toCommonJS(meeting_scope_exports);
|
|
28
28
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
29
|
var import_react = require("react");
|
|
30
|
+
var import_meshagent_react = require("@meshagent/meshagent-react");
|
|
30
31
|
var import_livekit_client = require("livekit-client");
|
|
31
32
|
var import_wake_lock = require("./wake-lock");
|
|
32
33
|
class PendingLocalMediaState {
|
|
@@ -182,23 +183,35 @@ class MeetingController {
|
|
|
182
183
|
return this.livekitRoom.state !== import_livekit_client.ConnectionState.Disconnected;
|
|
183
184
|
}
|
|
184
185
|
get hasParticipantsWithVideo() {
|
|
185
|
-
const localHasVideo = Array.from(
|
|
186
|
-
|
|
186
|
+
const localHasVideo = Array.from(
|
|
187
|
+
this.livekitRoom.localParticipant.videoTrackPublications.values()
|
|
188
|
+
).some((publication) => !publication.isMuted);
|
|
189
|
+
const remoteHasVideo = Array.from(
|
|
190
|
+
this.livekitRoom.remoteParticipants.values()
|
|
191
|
+
).some(
|
|
192
|
+
(participant) => Array.from(participant.videoTrackPublications.values()).some(
|
|
193
|
+
(publication) => !publication.isMuted
|
|
194
|
+
)
|
|
195
|
+
);
|
|
187
196
|
return localHasVideo || remoteHasVideo;
|
|
188
197
|
}
|
|
189
198
|
subscribe(listener) {
|
|
190
199
|
this.listeners.add(listener);
|
|
191
200
|
return () => this.listeners.delete(listener);
|
|
192
201
|
}
|
|
193
|
-
async configure({ breakoutRoom } = {}) {
|
|
202
|
+
async configure({ breakoutRoom = "" } = {}) {
|
|
194
203
|
if (this.livekitRoom.state !== import_livekit_client.ConnectionState.Disconnected) {
|
|
195
|
-
throw new Error(
|
|
204
|
+
throw new Error(
|
|
205
|
+
"You cannot reconfigure while the controller is connected"
|
|
206
|
+
);
|
|
196
207
|
}
|
|
197
208
|
this._config = null;
|
|
198
209
|
this._configurationError = null;
|
|
199
210
|
this.notify();
|
|
200
211
|
try {
|
|
201
|
-
this._config = await this.room.livekit.getConnectionInfo({
|
|
212
|
+
this._config = await this.room.livekit.getConnectionInfo({
|
|
213
|
+
breakoutRoom
|
|
214
|
+
});
|
|
202
215
|
this.notify();
|
|
203
216
|
} catch (error) {
|
|
204
217
|
this._configurationError = error;
|
|
@@ -221,20 +234,29 @@ class MeetingController {
|
|
|
221
234
|
cameraAwaitEnableConfirmation: cameraEnabled,
|
|
222
235
|
microphoneAwaitEnableConfirmation: microphoneEnabled
|
|
223
236
|
});
|
|
224
|
-
const {
|
|
237
|
+
const {
|
|
238
|
+
camera: _camera,
|
|
239
|
+
microphone: _microphone,
|
|
240
|
+
...connectOptions
|
|
241
|
+
} = options ?? {};
|
|
225
242
|
try {
|
|
226
243
|
await this.livekitRoom.connect(config.url, config.token, connectOptions);
|
|
227
244
|
const localParticipant = this.livekitRoom.localParticipant;
|
|
228
245
|
await Promise.all([
|
|
229
|
-
cameraEnabled ? localParticipant.setCameraEnabled(true).then(() => this.pendingLocalMedia.setCameraUnavailable(false)).catch((error) => {
|
|
246
|
+
cameraEnabled ? localParticipant.setCameraEnabled(true, options?.camera?.options).then(() => this.pendingLocalMedia.setCameraUnavailable(false)).catch((error) => {
|
|
230
247
|
this.pendingLocalMedia.setCameraPending(false);
|
|
231
248
|
this.pendingLocalMedia.setCameraUnavailable(true);
|
|
232
249
|
console.warn("unable to enable camera after connecting", error);
|
|
233
250
|
}) : Promise.resolve(this.pendingLocalMedia.setCameraPending(false)),
|
|
234
|
-
microphoneEnabled ? localParticipant.setMicrophoneEnabled(true).then(
|
|
251
|
+
microphoneEnabled ? localParticipant.setMicrophoneEnabled(true, options?.microphone?.options).then(
|
|
252
|
+
() => this.pendingLocalMedia.setMicrophoneUnavailable(false)
|
|
253
|
+
).catch((error) => {
|
|
235
254
|
this.pendingLocalMedia.setMicrophonePending(false);
|
|
236
255
|
this.pendingLocalMedia.setMicrophoneUnavailable(true);
|
|
237
|
-
console.warn(
|
|
256
|
+
console.warn(
|
|
257
|
+
"unable to enable microphone after connecting",
|
|
258
|
+
error
|
|
259
|
+
);
|
|
238
260
|
}) : Promise.resolve(this.pendingLocalMedia.setMicrophonePending(false))
|
|
239
261
|
]);
|
|
240
262
|
this.syncPendingLocalMediaState();
|
|
@@ -245,7 +267,24 @@ class MeetingController {
|
|
|
245
267
|
}
|
|
246
268
|
async disconnect() {
|
|
247
269
|
this.pendingLocalMedia.clear();
|
|
248
|
-
|
|
270
|
+
const localParticipant = this.livekitRoom.localParticipant;
|
|
271
|
+
const disableResults = await Promise.allSettled([
|
|
272
|
+
localParticipant.setCameraEnabled(false),
|
|
273
|
+
localParticipant.setMicrophoneEnabled(false),
|
|
274
|
+
localParticipant.setScreenShareEnabled(false)
|
|
275
|
+
]);
|
|
276
|
+
for (const result of disableResults) {
|
|
277
|
+
if (result.status === "rejected") {
|
|
278
|
+
console.warn("unable to disable local meeting media", result.reason);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
for (const publication of Array.from(
|
|
282
|
+
localParticipant.trackPublications.values()
|
|
283
|
+
)) {
|
|
284
|
+
publication.track?.detach();
|
|
285
|
+
publication.track?.stop();
|
|
286
|
+
}
|
|
287
|
+
await this.livekitRoom.disconnect(true);
|
|
249
288
|
}
|
|
250
289
|
dispose() {
|
|
251
290
|
this.livekitRoom.removeAllListeners();
|
|
@@ -273,7 +312,9 @@ function useMeetingController(controller) {
|
|
|
273
312
|
const contextController = (0, import_react.useContext)(MeetingControllerContext);
|
|
274
313
|
const resolved = controller ?? contextController;
|
|
275
314
|
if (resolved == null) {
|
|
276
|
-
throw new Error(
|
|
315
|
+
throw new Error(
|
|
316
|
+
"useMeetingController must be used within MeetingScope or receive a controller"
|
|
317
|
+
);
|
|
277
318
|
}
|
|
278
319
|
(0, import_react.useSyncExternalStore)(
|
|
279
320
|
(listener) => resolved.subscribe(listener),
|
|
@@ -288,12 +329,18 @@ function MeetingScope({
|
|
|
288
329
|
roomOptions,
|
|
289
330
|
children
|
|
290
331
|
}) {
|
|
291
|
-
const controller = (0, import_react.useMemo)(
|
|
332
|
+
const controller = (0, import_react.useMemo)(
|
|
333
|
+
() => new MeetingController({
|
|
334
|
+
room: client,
|
|
335
|
+
roomOptions
|
|
336
|
+
}),
|
|
337
|
+
[client, roomOptions]
|
|
338
|
+
);
|
|
292
339
|
(0, import_react.useEffect)(() => {
|
|
293
|
-
|
|
340
|
+
controller.configure({ breakoutRoom });
|
|
294
341
|
return () => {
|
|
295
342
|
if (controller.isConnected) {
|
|
296
|
-
|
|
343
|
+
controller.disconnect().catch((error) => {
|
|
297
344
|
console.warn("unable to disconnect", error);
|
|
298
345
|
});
|
|
299
346
|
}
|
|
@@ -303,7 +350,9 @@ function MeetingScope({
|
|
|
303
350
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wake_lock.WakeLocker, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MeetingControllerContext.Provider, { value: controller, children: typeof children === "function" ? children(controller) : children }) });
|
|
304
351
|
}
|
|
305
352
|
function firstEnabledVideoPublication(participant) {
|
|
306
|
-
return Array.from(
|
|
353
|
+
return Array.from(
|
|
354
|
+
participant.videoTrackPublications.values()
|
|
355
|
+
).find(
|
|
307
356
|
(publication) => !publication.isMuted && publication.source === import_livekit_client.Track.Source.Camera && publication.videoTrack != null
|
|
308
357
|
);
|
|
309
358
|
}
|