wenay-react2 1.0.48 → 1.0.49

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.
@@ -0,0 +1,449 @@
1
+ import { Peer, Replay } from "wenay-common2";
2
+ export type ConfFrame = {
3
+ n: number;
4
+ at: number;
5
+ image: string;
6
+ };
7
+ export type ConfLine = [ConfFrame, number];
8
+ export type ConferenceWorldOptions = {
9
+ /** Seat accounts; the FIRST one is the room host (places the star calls) and the focus viewer. */
10
+ accounts?: string[];
11
+ /** Injected WebRTC runtime, `() => new RTCPeerConnection(cfg)` in a browser. */
12
+ rtc?: () => Replay.RtcPeerConnection;
13
+ /** Transport-death drill; defaults to closing every RTCPeerConnection this world created. */
14
+ killTransport?: () => void;
15
+ /** Synthetic painter fps; 0 disables timers (drive frames via tick() in tests). */
16
+ fps?: number;
17
+ /** Frame factory override for environments without DOM/canvas semantics. */
18
+ frame?: (account: string, n: number) => ConfFrame;
19
+ room?: string;
20
+ };
21
+ export declare function createConferenceWorld(options?: ConferenceWorldOptions): {
22
+ accounts: string[];
23
+ hostAccount: string;
24
+ viewer: string;
25
+ room: string;
26
+ managers: Map<string, {
27
+ ready: Promise<void>;
28
+ call: (other: string, meta?: unknown) => {
29
+ id: string;
30
+ peer: string;
31
+ direction: "out" | "in";
32
+ meta: unknown;
33
+ state: () => Peer.tCallState;
34
+ reason: () => Peer.tCallEnd | null;
35
+ changed: import("wenay-common2").ListenApi<[Peer.tCallState]>;
36
+ ended: Promise<Peer.tCallEnd>;
37
+ accept(): void;
38
+ decline(why?: Peer.tCallEnd): void;
39
+ hangup(): void;
40
+ };
41
+ rings: import("wenay-common2").ListenApi<[{
42
+ id: string;
43
+ peer: string;
44
+ direction: "out" | "in";
45
+ meta: unknown;
46
+ state: () => Peer.tCallState;
47
+ reason: () => Peer.tCallEnd | null;
48
+ changed: import("wenay-common2").ListenApi<[Peer.tCallState]>;
49
+ ended: Promise<Peer.tCallEnd>;
50
+ accept(): void;
51
+ decline(why?: Peer.tCallEnd): void;
52
+ hangup(): void;
53
+ }]>;
54
+ active: () => {
55
+ id: string;
56
+ peer: string;
57
+ direction: "out" | "in";
58
+ meta: unknown;
59
+ state: () => Peer.tCallState;
60
+ reason: () => Peer.tCallEnd | null;
61
+ changed: import("wenay-common2").ListenApi<[Peer.tCallState]>;
62
+ ended: Promise<Peer.tCallEnd>;
63
+ accept(): void;
64
+ decline(why?: Peer.tCallEnd): void;
65
+ hangup(): void;
66
+ } | null;
67
+ close(): void;
68
+ }>;
69
+ relay: {
70
+ publishOf: (account: string) => (line: string, frame: unknown, sentAt: number) => void;
71
+ watch: Record<string, Record<string, {
72
+ emit: import("wenay-common2").Listener<[unknown, number]>;
73
+ head: () => number;
74
+ isStale: () => boolean;
75
+ lastTs: () => number;
76
+ close: () => void;
77
+ getSince: (seq: number) => Replay.ReplayEvent<[unknown, number]>[] | undefined;
78
+ line: import("wenay-common2").ListenApi<[Replay.ReplayEvent<[unknown, number]>]>;
79
+ hasKeyframe: boolean;
80
+ keyframe: () => Replay.ReplayEvent<[unknown, number]> | undefined;
81
+ frame: (sinceSeq: number, hint?: unknown) => Replay.ReplayEvent<[unknown, number]>[];
82
+ on: Replay.ListenOnReplay<[unknown, number]>;
83
+ once: (cb: import("wenay-common2").Listener<[unknown, number]>, opts?: {
84
+ key?: string | symbol;
85
+ current?: import("wenay-common2").ListenCurrent<[unknown, number]> | undefined;
86
+ } | undefined) => () => void;
87
+ has(key: import("wenay-common2").ListenKey): boolean;
88
+ off(keyOrCallback: import("wenay-common2").ListenKey | import("wenay-common2").Listener<[unknown, number]> | null): void;
89
+ count(): number;
90
+ keys(): import("wenay-common2").ListenKey[];
91
+ isRunning(): boolean;
92
+ run(): void;
93
+ onClose(cb: () => void): import("wenay-common2").ListenOff;
94
+ }>>;
95
+ watchOf: (watcher: string) => Record<string, Record<string, {
96
+ emit: import("wenay-common2").Listener<[unknown, number]>;
97
+ head: () => number;
98
+ isStale: () => boolean;
99
+ lastTs: () => number;
100
+ close: () => void;
101
+ getSince: (seq: number) => Replay.ReplayEvent<[unknown, number]>[] | undefined;
102
+ line: import("wenay-common2").ListenApi<[Replay.ReplayEvent<[unknown, number]>]>;
103
+ hasKeyframe: boolean;
104
+ keyframe: () => Replay.ReplayEvent<[unknown, number]> | undefined;
105
+ frame: (sinceSeq: number, hint?: unknown) => Replay.ReplayEvent<[unknown, number]>[];
106
+ on: Replay.ListenOnReplay<[unknown, number]>;
107
+ once: (cb: import("wenay-common2").Listener<[unknown, number]>, opts?: {
108
+ key?: string | symbol;
109
+ current?: import("wenay-common2").ListenCurrent<[unknown, number]> | undefined;
110
+ } | undefined) => () => void;
111
+ has(key: import("wenay-common2").ListenKey): boolean;
112
+ off(keyOrCallback: import("wenay-common2").ListenKey | import("wenay-common2").Listener<[unknown, number]> | null): void;
113
+ count(): number;
114
+ keys(): import("wenay-common2").ListenKey[];
115
+ isRunning(): boolean;
116
+ run(): void;
117
+ onClose(cb: () => void): import("wenay-common2").ListenOff;
118
+ }>>;
119
+ lines: (account: string) => Record<string, {
120
+ emit: import("wenay-common2").Listener<[unknown, number]>;
121
+ head: () => number;
122
+ isStale: () => boolean;
123
+ lastTs: () => number;
124
+ close: () => void;
125
+ getSince: (seq: number) => Replay.ReplayEvent<[unknown, number]>[] | undefined;
126
+ line: import("wenay-common2").ListenApi<[Replay.ReplayEvent<[unknown, number]>]>;
127
+ hasKeyframe: boolean;
128
+ keyframe: () => Replay.ReplayEvent<[unknown, number]> | undefined;
129
+ frame: (sinceSeq: number, hint?: unknown) => Replay.ReplayEvent<[unknown, number]>[];
130
+ on: Replay.ListenOnReplay<[unknown, number]>;
131
+ once: (cb: import("wenay-common2").Listener<[unknown, number]>, opts?: {
132
+ key?: string | symbol;
133
+ current?: import("wenay-common2").ListenCurrent<[unknown, number]> | undefined;
134
+ } | undefined) => () => void;
135
+ has(key: import("wenay-common2").ListenKey): boolean;
136
+ off(keyOrCallback: import("wenay-common2").ListenKey | import("wenay-common2").Listener<[unknown, number]> | null): void;
137
+ count(): number;
138
+ keys(): import("wenay-common2").ListenKey[];
139
+ isRunning(): boolean;
140
+ run(): void;
141
+ onClose(cb: () => void): import("wenay-common2").ListenOff;
142
+ }>;
143
+ accounts: () => string[];
144
+ dropAccount: (account: string) => void;
145
+ close(): void;
146
+ };
147
+ coordinator: {
148
+ pair(a: string, b: string): {
149
+ ref: Replay.RoutePairRef;
150
+ state: () => Replay.tRouteState;
151
+ reason: () => unknown;
152
+ label: () => string;
153
+ metrics: () => {
154
+ relay: {
155
+ rtt?: number;
156
+ pending?: number;
157
+ state: Replay.tConnectorState;
158
+ } | null;
159
+ direct: {
160
+ rtt?: number;
161
+ pending?: number;
162
+ state: Replay.tConnectorState;
163
+ } | null;
164
+ };
165
+ subscribe: (cb: import("wenay-common2").Listener<ConfLine>, opts?: Omit<Replay.ReplayRouteSubscribeOpts, "label">) => (() => void) & {
166
+ ready: Promise<void>;
167
+ seq: () => number;
168
+ label: () => string | undefined;
169
+ active: () => boolean;
170
+ };
171
+ promoteDirect: (opts?: Replay.PromoteDirectOpts) => Promise<Replay.RouteOpResult>;
172
+ reinterposeRelay: (reason?: unknown) => Promise<Replay.RouteOpResult>;
173
+ fallback: (reason?: unknown) => Promise<Replay.RouteOpResult>;
174
+ block: (reason?: unknown) => Promise<Replay.RouteOpResult>;
175
+ close: () => void;
176
+ };
177
+ state: (pairOrKey: string | Replay.RoutePairRef | {
178
+ ref: Replay.RoutePairRef;
179
+ state: () => Replay.tRouteState;
180
+ reason: () => unknown;
181
+ label: () => string;
182
+ metrics: () => {
183
+ relay: {
184
+ rtt?: number;
185
+ pending?: number;
186
+ state: Replay.tConnectorState;
187
+ } | null;
188
+ direct: {
189
+ rtt?: number;
190
+ pending?: number;
191
+ state: Replay.tConnectorState;
192
+ } | null;
193
+ };
194
+ subscribe: (cb: import("wenay-common2").Listener<ConfLine>, opts?: Omit<Replay.ReplayRouteSubscribeOpts, "label">) => (() => void) & {
195
+ ready: Promise<void>;
196
+ seq: () => number;
197
+ label: () => string | undefined;
198
+ active: () => boolean;
199
+ };
200
+ promoteDirect: (opts?: Replay.PromoteDirectOpts) => Promise<Replay.RouteOpResult>;
201
+ reinterposeRelay: (reason?: unknown) => Promise<Replay.RouteOpResult>;
202
+ fallback: (reason?: unknown) => Promise<Replay.RouteOpResult>;
203
+ block: (reason?: unknown) => Promise<Replay.RouteOpResult>;
204
+ close: () => void;
205
+ }) => Replay.tRouteState;
206
+ promoteDirect: (pairOrKey: string | Replay.RoutePairRef | {
207
+ ref: Replay.RoutePairRef;
208
+ state: () => Replay.tRouteState;
209
+ reason: () => unknown;
210
+ label: () => string;
211
+ metrics: () => {
212
+ relay: {
213
+ rtt?: number;
214
+ pending?: number;
215
+ state: Replay.tConnectorState;
216
+ } | null;
217
+ direct: {
218
+ rtt?: number;
219
+ pending?: number;
220
+ state: Replay.tConnectorState;
221
+ } | null;
222
+ };
223
+ subscribe: (cb: import("wenay-common2").Listener<ConfLine>, opts?: Omit<Replay.ReplayRouteSubscribeOpts, "label">) => (() => void) & {
224
+ ready: Promise<void>;
225
+ seq: () => number;
226
+ label: () => string | undefined;
227
+ active: () => boolean;
228
+ };
229
+ promoteDirect: (opts?: Replay.PromoteDirectOpts) => Promise<Replay.RouteOpResult>;
230
+ reinterposeRelay: (reason?: unknown) => Promise<Replay.RouteOpResult>;
231
+ fallback: (reason?: unknown) => Promise<Replay.RouteOpResult>;
232
+ block: (reason?: unknown) => Promise<Replay.RouteOpResult>;
233
+ close: () => void;
234
+ }, opts?: Replay.PromoteDirectOpts) => Promise<Replay.RouteOpResult>;
235
+ reinterposeRelay: (pairOrKey: string | Replay.RoutePairRef | {
236
+ ref: Replay.RoutePairRef;
237
+ state: () => Replay.tRouteState;
238
+ reason: () => unknown;
239
+ label: () => string;
240
+ metrics: () => {
241
+ relay: {
242
+ rtt?: number;
243
+ pending?: number;
244
+ state: Replay.tConnectorState;
245
+ } | null;
246
+ direct: {
247
+ rtt?: number;
248
+ pending?: number;
249
+ state: Replay.tConnectorState;
250
+ } | null;
251
+ };
252
+ subscribe: (cb: import("wenay-common2").Listener<ConfLine>, opts?: Omit<Replay.ReplayRouteSubscribeOpts, "label">) => (() => void) & {
253
+ ready: Promise<void>;
254
+ seq: () => number;
255
+ label: () => string | undefined;
256
+ active: () => boolean;
257
+ };
258
+ promoteDirect: (opts?: Replay.PromoteDirectOpts) => Promise<Replay.RouteOpResult>;
259
+ reinterposeRelay: (reason?: unknown) => Promise<Replay.RouteOpResult>;
260
+ fallback: (reason?: unknown) => Promise<Replay.RouteOpResult>;
261
+ block: (reason?: unknown) => Promise<Replay.RouteOpResult>;
262
+ close: () => void;
263
+ }, reason?: unknown) => Promise<Replay.RouteOpResult>;
264
+ fallback: (pairOrKey: string | Replay.RoutePairRef | {
265
+ ref: Replay.RoutePairRef;
266
+ state: () => Replay.tRouteState;
267
+ reason: () => unknown;
268
+ label: () => string;
269
+ metrics: () => {
270
+ relay: {
271
+ rtt?: number;
272
+ pending?: number;
273
+ state: Replay.tConnectorState;
274
+ } | null;
275
+ direct: {
276
+ rtt?: number;
277
+ pending?: number;
278
+ state: Replay.tConnectorState;
279
+ } | null;
280
+ };
281
+ subscribe: (cb: import("wenay-common2").Listener<ConfLine>, opts?: Omit<Replay.ReplayRouteSubscribeOpts, "label">) => (() => void) & {
282
+ ready: Promise<void>;
283
+ seq: () => number;
284
+ label: () => string | undefined;
285
+ active: () => boolean;
286
+ };
287
+ promoteDirect: (opts?: Replay.PromoteDirectOpts) => Promise<Replay.RouteOpResult>;
288
+ reinterposeRelay: (reason?: unknown) => Promise<Replay.RouteOpResult>;
289
+ fallback: (reason?: unknown) => Promise<Replay.RouteOpResult>;
290
+ block: (reason?: unknown) => Promise<Replay.RouteOpResult>;
291
+ close: () => void;
292
+ }, reason?: unknown) => Promise<Replay.RouteOpResult>;
293
+ block: (pairOrKey: string | Replay.RoutePairRef | {
294
+ ref: Replay.RoutePairRef;
295
+ state: () => Replay.tRouteState;
296
+ reason: () => unknown;
297
+ label: () => string;
298
+ metrics: () => {
299
+ relay: {
300
+ rtt?: number;
301
+ pending?: number;
302
+ state: Replay.tConnectorState;
303
+ } | null;
304
+ direct: {
305
+ rtt?: number;
306
+ pending?: number;
307
+ state: Replay.tConnectorState;
308
+ } | null;
309
+ };
310
+ subscribe: (cb: import("wenay-common2").Listener<ConfLine>, opts?: Omit<Replay.ReplayRouteSubscribeOpts, "label">) => (() => void) & {
311
+ ready: Promise<void>;
312
+ seq: () => number;
313
+ label: () => string | undefined;
314
+ active: () => boolean;
315
+ };
316
+ promoteDirect: (opts?: Replay.PromoteDirectOpts) => Promise<Replay.RouteOpResult>;
317
+ reinterposeRelay: (reason?: unknown) => Promise<Replay.RouteOpResult>;
318
+ fallback: (reason?: unknown) => Promise<Replay.RouteOpResult>;
319
+ block: (reason?: unknown) => Promise<Replay.RouteOpResult>;
320
+ close: () => void;
321
+ }, reason?: unknown) => Promise<Replay.RouteOpResult>;
322
+ onRoute: (cb: (ev: Replay.RouteChangeEvent) => void) => import("wenay-common2").ListenOff;
323
+ pairs: () => {
324
+ ref: Replay.RoutePairRef;
325
+ state: () => Replay.tRouteState;
326
+ reason: () => unknown;
327
+ label: () => string;
328
+ metrics: () => {
329
+ relay: {
330
+ rtt?: number;
331
+ pending?: number;
332
+ state: Replay.tConnectorState;
333
+ } | null;
334
+ direct: {
335
+ rtt?: number;
336
+ pending?: number;
337
+ state: Replay.tConnectorState;
338
+ } | null;
339
+ };
340
+ subscribe: (cb: import("wenay-common2").Listener<ConfLine>, opts?: Omit<Replay.ReplayRouteSubscribeOpts, "label">) => (() => void) & {
341
+ ready: Promise<void>;
342
+ seq: () => number;
343
+ label: () => string | undefined;
344
+ active: () => boolean;
345
+ };
346
+ promoteDirect: (opts?: Replay.PromoteDirectOpts) => Promise<Replay.RouteOpResult>;
347
+ reinterposeRelay: (reason?: unknown) => Promise<Replay.RouteOpResult>;
348
+ fallback: (reason?: unknown) => Promise<Replay.RouteOpResult>;
349
+ block: (reason?: unknown) => Promise<Replay.RouteOpResult>;
350
+ close: () => void;
351
+ }[];
352
+ close(): void;
353
+ };
354
+ focus: (owner: string) => {
355
+ ref: Replay.RoutePairRef;
356
+ state: () => Replay.tRouteState;
357
+ reason: () => unknown;
358
+ label: () => string;
359
+ metrics: () => {
360
+ relay: {
361
+ rtt?: number;
362
+ pending?: number;
363
+ state: Replay.tConnectorState;
364
+ } | null;
365
+ direct: {
366
+ rtt?: number;
367
+ pending?: number;
368
+ state: Replay.tConnectorState;
369
+ } | null;
370
+ };
371
+ subscribe: (cb: import("wenay-common2").Listener<ConfLine>, opts?: Omit<Replay.ReplayRouteSubscribeOpts, "label">) => (() => void) & {
372
+ ready: Promise<void>;
373
+ seq: () => number;
374
+ label: () => string | undefined;
375
+ active: () => boolean;
376
+ };
377
+ promoteDirect: (opts?: Replay.PromoteDirectOpts) => Promise<Replay.RouteOpResult>;
378
+ reinterposeRelay: (reason?: unknown) => Promise<Replay.RouteOpResult>;
379
+ fallback: (reason?: unknown) => Promise<Replay.RouteOpResult>;
380
+ block: (reason?: unknown) => Promise<Replay.RouteOpResult>;
381
+ close: () => void;
382
+ };
383
+ ring: (member: string) => {
384
+ id: string;
385
+ peer: string;
386
+ direction: "out" | "in";
387
+ meta: unknown;
388
+ state: () => Peer.tCallState;
389
+ reason: () => Peer.tCallEnd | null;
390
+ changed: import("wenay-common2").ListenApi<[Peer.tCallState]>;
391
+ ended: Promise<Peer.tCallEnd>;
392
+ accept(): void;
393
+ decline(why?: Peer.tCallEnd): void;
394
+ hangup(): void;
395
+ };
396
+ hostCalls: Map<string, {
397
+ id: string;
398
+ peer: string;
399
+ direction: "out" | "in";
400
+ meta: unknown;
401
+ state: () => Peer.tCallState;
402
+ reason: () => Peer.tCallEnd | null;
403
+ changed: import("wenay-common2").ListenApi<[Peer.tCallState]>;
404
+ ended: Promise<Peer.tCallEnd>;
405
+ accept(): void;
406
+ decline(why?: Peer.tCallEnd): void;
407
+ hangup(): void;
408
+ }>;
409
+ roster: () => string[];
410
+ inRoster: (account: string) => boolean;
411
+ changed: import("wenay-common2").ListenApi<[]>;
412
+ lineOf: (account: string) => {
413
+ emit: import("wenay-common2").Listener<ConfLine>;
414
+ head: () => number;
415
+ isStale: () => boolean;
416
+ lastTs: () => number;
417
+ close: () => void;
418
+ getSince: (seq: number) => Replay.ReplayEvent<ConfLine>[] | undefined;
419
+ line: import("wenay-common2").ListenApi<[Replay.ReplayEvent<ConfLine>]>;
420
+ hasKeyframe: boolean;
421
+ keyframe: () => Replay.ReplayEvent<ConfLine> | undefined;
422
+ frame: (sinceSeq: number, hint?: unknown) => Replay.ReplayEvent<ConfLine>[];
423
+ on: Replay.ListenOnReplay<ConfLine>;
424
+ once: (cb: import("wenay-common2").Listener<ConfLine>, opts?: {
425
+ key?: string | symbol;
426
+ current?: import("wenay-common2").ListenCurrent<ConfLine> | undefined;
427
+ } | undefined) => () => void;
428
+ has(key: import("wenay-common2").ListenKey): boolean;
429
+ off(keyOrCallback: import("wenay-common2").ListenKey | import("wenay-common2").Listener<ConfLine> | null): void;
430
+ count(): number;
431
+ keys(): import("wenay-common2").ListenKey[];
432
+ isRunning(): boolean;
433
+ run(): void;
434
+ onClose(cb: () => void): import("wenay-common2").ListenOff;
435
+ };
436
+ frameNumber: (account: string) => number;
437
+ tick: (only?: string) => void;
438
+ setForceRelay(on: boolean): void;
439
+ setAllowEndpoint(on: boolean): void;
440
+ getPolicy: () => {
441
+ forceRelay: boolean;
442
+ allowEndpoint: boolean;
443
+ };
444
+ revokeDirect: (owner: string) => void;
445
+ killDirect: () => void;
446
+ close: () => void;
447
+ };
448
+ export type ConferenceWorld = ReturnType<typeof createConferenceWorld>;
449
+ export declare const ConferenceCallDemo: () => import("react/jsx-runtime").JSX.Element;