@signalwire/web-components 4.0.0-beta.0 → 4.0.0-beta.2

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/README.md CHANGED
@@ -29,7 +29,7 @@ import { CallMedia, CallControls, SelfMedia } from '@signalwire/web-components';
29
29
 
30
30
  ```html
31
31
  <!-- Basic video call layout -->
32
- <sw-call-media .call=${call}>
32
+ <sw-call-media .call="${call}">
33
33
  <sw-participants>
34
34
  <sw-self-media mirror></sw-self-media>
35
35
  </sw-participants>
@@ -51,6 +51,7 @@ Root container component that renders the remote video stream and provides call
51
51
  | `call` | `Call` | - | Call object with streams and layout data |
52
52
 
53
53
  **CSS Custom Properties:**
54
+
54
55
  ```css
55
56
  sw-call-media {
56
57
  --sw-color-primary: #044cf6;
@@ -62,12 +63,13 @@ sw-call-media {
62
63
  **CSS Parts:** `container`, `video`, `layers`
63
64
 
64
65
  **Usage:**
66
+
65
67
  ```html
66
68
  <!-- Basic usage -->
67
- <sw-call-media .call=${call}></sw-call-media>
69
+ <sw-call-media .call="${call}"></sw-call-media>
68
70
 
69
71
  <!-- With child components -->
70
- <sw-call-media .call=${call}>
72
+ <sw-call-media .call="${call}">
71
73
  <sw-participants>
72
74
  <sw-self-media></sw-self-media>
73
75
  </sw-participants>
@@ -96,6 +98,7 @@ Renders the local video stream as an overlay with positioning from layout layers
96
98
  **Context:** Consumes `callContext` from parent `sw-call-media`
97
99
 
98
100
  **Usage:**
101
+
99
102
  ```html
100
103
  <!-- Basic usage (inside sw-participants) -->
101
104
  <sw-participants>
@@ -119,14 +122,15 @@ Renders overlay containers for all remote participants based on layout layer dat
119
122
  **Context:** Consumes `callContext` from parent `sw-call-media`
120
123
 
121
124
  **Usage:**
125
+
122
126
  ```html
123
127
  <!-- Basic usage -->
124
- <sw-call-media .call=${call}>
128
+ <sw-call-media .call="${call}">
125
129
  <sw-participants></sw-participants>
126
130
  </sw-call-media>
127
131
 
128
132
  <!-- With local video as child -->
129
- <sw-call-media .call=${call}>
133
+ <sw-call-media .call="${call}">
130
134
  <sw-participants>
131
135
  <sw-self-media mirror></sw-self-media>
132
136
  </sw-participants>
@@ -155,6 +159,7 @@ Responsive button bar for call actions: mute audio, mute video, screen share, an
155
159
  | `sw-hangup` | - | Call ended |
156
160
 
157
161
  **CSS Custom Properties:**
162
+
158
163
  ```css
159
164
  sw-call-controls {
160
165
  --sw-color-primary: #044cf6;
@@ -168,15 +173,16 @@ sw-call-controls {
168
173
  **CSS Parts:** `container`, `button`, `button-active`, `button-disabled`, `tooltip`
169
174
 
170
175
  **Usage:**
176
+
171
177
  ```html
172
178
  <!-- Basic usage (uses context from sw-call-media) -->
173
- <sw-call-media .call=${call}>
179
+ <sw-call-media .call="${call}">
174
180
  <!-- ... -->
175
181
  </sw-call-media>
176
182
  <sw-call-controls></sw-call-controls>
177
183
 
178
184
  <!-- With explicit call property -->
179
- <sw-call-controls .call=${call} orientation="vertical"></sw-call-controls>
185
+ <sw-call-controls .call="${call}" orientation="vertical"></sw-call-controls>
180
186
 
181
187
  <!-- Without tooltips -->
182
188
  <sw-call-controls show-tooltips="false"></sw-call-controls>
@@ -209,6 +215,7 @@ Displays call state, status text, and duration timer.
209
215
  **Status Values:** `idle`, `connecting`, `ringing`, `connected`, `disconnecting`, `disconnected`
210
216
 
211
217
  **CSS Custom Properties:**
218
+
212
219
  ```css
213
220
  sw-call-status {
214
221
  --sw-color-primary: #044cf6;
@@ -221,12 +228,13 @@ sw-call-status {
221
228
  **CSS Parts:** `container`, `status-text`, `duration`
222
229
 
223
230
  **Usage:**
231
+
224
232
  ```html
225
233
  <!-- Basic usage (uses context) -->
226
234
  <sw-call-status></sw-call-status>
227
235
 
228
236
  <!-- With explicit call -->
229
- <sw-call-status .call=${call}></sw-call-status>
237
+ <sw-call-status .call="${call}"></sw-call-status>
230
238
  ```
231
239
 
232
240
  ---
@@ -250,6 +258,7 @@ sw-call-status {
250
258
  | `sw-dial` | `{ digits: string }` | Call button clicked |
251
259
 
252
260
  **CSS Custom Properties:**
261
+
253
262
  ```css
254
263
  sw-dialpad {
255
264
  --sw-color-primary: #044cf6;
@@ -262,6 +271,7 @@ sw-dialpad {
262
271
  **CSS Parts:** `container`, `display`, `keypad`, `key`, `key-pressed`, `call-button`
263
272
 
264
273
  **Usage:**
274
+
265
275
  ```html
266
276
  <!-- Basic DTMF dialpad (uses context) -->
267
277
  <sw-dialpad></sw-dialpad>
@@ -270,7 +280,7 @@ sw-dialpad {
270
280
  <sw-dialpad show-call-button placeholder="Phone number"></sw-dialpad>
271
281
 
272
282
  <!-- With explicit call -->
273
- <sw-dialpad .call=${call}></sw-dialpad>
283
+ <sw-dialpad .call="${call}"></sw-dialpad>
274
284
  ```
275
285
 
276
286
  ```typescript
@@ -306,6 +316,7 @@ Dropdown for selecting audio/video input and output devices.
306
316
  | `sw-test-speaker` | - | Speaker test triggered |
307
317
 
308
318
  **CSS Custom Properties:**
319
+
309
320
  ```css
310
321
  sw-device-selector {
311
322
  --sw-color-primary: #044cf6;
@@ -317,15 +328,13 @@ sw-device-selector {
317
328
  **CSS Parts:** `container`, `tabs`, `device-list`, `device-item`, `device-item-selected`, `preview`
318
329
 
319
330
  **Usage:**
331
+
320
332
  ```html
321
333
  <!-- Basic usage -->
322
- <sw-device-selector .deviceController=${deviceController}></sw-device-selector>
334
+ <sw-device-selector .deviceController="${deviceController}"></sw-device-selector>
323
335
 
324
336
  <!-- With preview panel -->
325
- <sw-device-selector
326
- .deviceController=${deviceController}
327
- show-preview>
328
- </sw-device-selector>
337
+ <sw-device-selector .deviceController="${deviceController}" show-preview> </sw-device-selector>
329
338
  ```
330
339
 
331
340
  ```typescript
@@ -353,6 +362,7 @@ Real-time audio level indicator using Web Audio API.
353
362
  | `maxSize` | `number` | `32` | Maximum bar height/width in pixels |
354
363
 
355
364
  **CSS Custom Properties:**
365
+
356
366
  ```css
357
367
  sw-audio-level {
358
368
  --sw-color-success: #10b981;
@@ -368,16 +378,13 @@ sw-audio-level {
368
378
  **CSS Parts:** `container`, `bar`, `bar-active`
369
379
 
370
380
  **Usage:**
381
+
371
382
  ```html
372
383
  <!-- Basic usage -->
373
- <sw-audio-level .stream=${localStream}></sw-audio-level>
384
+ <sw-audio-level .stream="${localStream}"></sw-audio-level>
374
385
 
375
386
  <!-- Horizontal with more bars -->
376
- <sw-audio-level
377
- .stream=${localStream}
378
- orientation="horizontal"
379
- bars="10"
380
- maxSize="48">
387
+ <sw-audio-level .stream="${localStream}" orientation="horizontal" bars="10" maxSize="48">
381
388
  </sw-audio-level>
382
389
  ```
383
390
 
@@ -403,6 +410,7 @@ Single button widget for calling a preconfigured destination.
403
410
  | `sw-hangup` | - | Call ended |
404
411
 
405
412
  **CSS Custom Properties:**
413
+
406
414
  ```css
407
415
  sw-click-to-call {
408
416
  --sw-color-primary: #044cf6;
@@ -414,20 +422,19 @@ sw-click-to-call {
414
422
  **CSS Parts:** `container`, `button`, `controls`, `status`, `duration`
415
423
 
416
424
  **Usage:**
425
+
417
426
  ```html
418
427
  <!-- Basic click-to-call button -->
419
- <sw-click-to-call
420
- .client=${client}
421
- destination="sip:support@example.com"
422
- label="Contact Support">
428
+ <sw-click-to-call .client="${client}" destination="sip:support@example.com" label="Contact Support">
423
429
  </sw-click-to-call>
424
430
 
425
431
  <!-- Audio/video call -->
426
432
  <sw-click-to-call
427
- .client=${client}
433
+ .client="${client}"
428
434
  destination="+15551234567"
429
435
  label="Call Sales"
430
- audio-only="false">
436
+ audio-only="false"
437
+ >
431
438
  </sw-click-to-call>
432
439
  ```
433
440
 
@@ -461,6 +468,7 @@ Searchable list of directory addresses for selecting call destinations.
461
468
  | `sw-dial` | `{ address: Address }` | Address dialed (double-click) |
462
469
 
463
470
  **CSS Custom Properties:**
471
+
464
472
  ```css
465
473
  sw-directory {
466
474
  --sw-color-primary: #044cf6;
@@ -472,9 +480,10 @@ sw-directory {
472
480
  **CSS Parts:** `container`, `search`, `list`, `item`, `item-selected`, `item-name`, `item-type`, `item-channels`
473
481
 
474
482
  **Usage:**
483
+
475
484
  ```html
476
485
  <!-- Basic directory list -->
477
- <sw-directory .directory=${directoryService}></sw-directory>
486
+ <sw-directory .directory="${directoryService}"></sw-directory>
478
487
  ```
479
488
 
480
489
  ```typescript
@@ -517,6 +526,7 @@ Control panel for individual participant actions (mute, volume, pin, remove).
517
526
  **CSS Parts:** `container`, `action-button`, `slider`
518
527
 
519
528
  **Usage:**
529
+
520
530
  ```html
521
531
  <!-- Basic participant controls -->
522
532
  <sw-participant-controls
@@ -564,6 +574,7 @@ Simple example button component for demonstration purposes.
564
574
  **CSS Parts:** `button`
565
575
 
566
576
  **Usage:**
577
+
567
578
  ```html
568
579
  <!-- Primary button -->
569
580
  <sw-example-button>Click Me</sw-example-button>
@@ -580,7 +591,7 @@ The components use Lit context (`@lit/context`) to share call state. The `sw-cal
580
591
 
581
592
  ```html
582
593
  <!-- sw-call-media provides context -->
583
- <sw-call-media .call=${call}>
594
+ <sw-call-media .call="${call}">
584
595
  <!-- These components consume context automatically -->
585
596
  <sw-participants>
586
597
  <sw-self-media></sw-self-media>
@@ -588,8 +599,8 @@ The components use Lit context (`@lit/context`) to share call state. The `sw-cal
588
599
  </sw-call-media>
589
600
 
590
601
  <!-- Components outside sw-call-media need explicit call property -->
591
- <sw-call-controls .call=${call}></sw-call-controls>
592
- <sw-call-status .call=${call}></sw-call-status>
602
+ <sw-call-controls .call="${call}"></sw-call-controls>
603
+ <sw-call-status .call="${call}"></sw-call-status>
593
604
  ```
594
605
 
595
606
  ---
@@ -655,12 +666,7 @@ sw-call-media::part(video) {
655
666
  ## TypeScript Interfaces
656
667
 
657
668
  ```typescript
658
- import type {
659
- Call,
660
- LayoutLayer,
661
- DeviceInfo,
662
- Address
663
- } from '@signalwire/web-components';
669
+ import type { Call, LayoutLayer, DeviceInfo, Address } from '@signalwire/web-components';
664
670
 
665
671
  // Call object interface
666
672
  interface Call {
@@ -714,68 +720,68 @@ interface Address {
714
720
  ```html
715
721
  <!DOCTYPE html>
716
722
  <html>
717
- <head>
718
- <style>
719
- .call-container {
720
- display: flex;
721
- flex-direction: column;
722
- height: 100vh;
723
- background: #000;
724
- }
725
-
726
- .video-area {
727
- flex: 1;
728
- position: relative;
729
- }
730
-
731
- .controls-bar {
732
- padding: 16px;
733
- display: flex;
734
- justify-content: center;
735
- gap: 16px;
736
- background: rgba(0, 0, 0, 0.8);
737
- }
738
- </style>
739
- </head>
740
- <body>
741
- <div class="call-container">
742
- <sw-call-status></sw-call-status>
743
-
744
- <div class="video-area">
745
- <sw-call-media id="call-media">
746
- <sw-participants>
747
- <sw-self-media mirror></sw-self-media>
748
- </sw-participants>
749
- </sw-call-media>
750
- </div>
751
-
752
- <div class="controls-bar">
753
- <sw-call-controls></sw-call-controls>
754
- <sw-dialpad></sw-dialpad>
723
+ <head>
724
+ <style>
725
+ .call-container {
726
+ display: flex;
727
+ flex-direction: column;
728
+ height: 100vh;
729
+ background: #000;
730
+ }
731
+
732
+ .video-area {
733
+ flex: 1;
734
+ position: relative;
735
+ }
736
+
737
+ .controls-bar {
738
+ padding: 16px;
739
+ display: flex;
740
+ justify-content: center;
741
+ gap: 16px;
742
+ background: rgba(0, 0, 0, 0.8);
743
+ }
744
+ </style>
745
+ </head>
746
+ <body>
747
+ <div class="call-container">
748
+ <sw-call-status></sw-call-status>
749
+
750
+ <div class="video-area">
751
+ <sw-call-media id="call-media">
752
+ <sw-participants>
753
+ <sw-self-media mirror></sw-self-media>
754
+ </sw-participants>
755
+ </sw-call-media>
756
+ </div>
757
+
758
+ <div class="controls-bar">
759
+ <sw-call-controls></sw-call-controls>
760
+ <sw-dialpad></sw-dialpad>
761
+ </div>
755
762
  </div>
756
- </div>
757
763
 
758
- <script type="module">
759
- import '@signalwire/web-components';
760
- import { SignalWire } from '@signalwire/signalwire-js';
764
+ <script type="module">
765
+ import '@signalwire/web-components';
766
+ import { SignalWire } from '@signalwire/js';
761
767
 
762
- const client = new SignalWire({
763
- host: 'your-signalwire-space.signalwire.com',
764
- token: 'your-token'
765
- });
768
+ const client = new SignalWire({
769
+ host: 'your-signalwire-space.signalwire.com',
770
+ token: 'your-token'
771
+ });
766
772
 
767
- await client.connect();
773
+ await client.connect();
768
774
 
769
- const call = await client.call({
770
- destination: 'sip:room@example.com',
771
- audio: true,
772
- video: true
773
- });
775
+ const call = await client.call({
776
+ destination: 'sip:room@example.com',
777
+ audio: true,
778
+ video: true
779
+ });
774
780
 
775
- // Set the call on the media component (provides context)
776
- document.getElementById('call-media').call = call;
777
- </script>
778
- </body>
781
+ // Set the call on the media component (provides context)
782
+ document.getElementById('call-media').call = call;
783
+ </script>
784
+ </body>
779
785
  </html>
780
786
  ```
781
787