@poolse/react-ui 3.2.0-dev.1 → 3.2.0-dev.3

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 CHANGED
@@ -4,6 +4,26 @@ All notable changes to `@poolse/react-ui` are documented here. Format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
5
5
  [semver](https://semver.org).
6
6
 
7
+ ## [3.2.0-dev.3] — 2026-11-16 (prerelease, npm tag `dev`)
8
+
9
+ ### Added
10
+
11
+ - Full screen in calls. `RoomStage` has a Full screen button in its header that
12
+ takes the whole room (video, controls) full screen; a shared screen has its
13
+ own button (and double-click) to watch just the screen full screen. On iPhone
14
+ Safari, which has no element full screen, the screen opens in the native video
15
+ player. The button is hidden where neither works.
16
+ - Icons `fullscreen` and `fullscreen-exit`.
17
+
18
+ ## [3.2.0-dev.2] — 2026-11-16 (prerelease, npm tag `dev`)
19
+
20
+ ### Added
21
+
22
+ - Screen sharing in `RoomStage`: a Share button where the browser and the
23
+ workspace allow it, a "You are sharing your screen · Stop sharing" bar, and
24
+ `CallVideoGrid` draws a shared screen large and uncropped with faces in a strip.
25
+ - Icons `screen-share` and `screen-share-off`.
26
+
7
27
  ## [3.2.0-dev.1] — 2026-11-04 (prerelease, npm tag `dev`)
8
28
 
9
29
  ### Added
package/dist/index.cjs CHANGED
@@ -80,6 +80,14 @@ var ICONS = {
80
80
  vb: "0 0 24 24",
81
81
  d: '<circle cx="12" cy="12" r="8.6"/><circle cx="9" cy="10" r="1" fill="currentColor" stroke="none"/><circle cx="15" cy="10" r="1" fill="currentColor" stroke="none"/><path d="M8.4 14.2a4.6 4.6 0 0 0 7.2 0"/>'
82
82
  },
83
+ fullscreen: {
84
+ vb: "0 0 24 24",
85
+ d: '<path d="M4 9V5.5A1.5 1.5 0 0 1 5.5 4H9"/><path d="M15 4h3.5A1.5 1.5 0 0 1 20 5.5V9"/><path d="M20 15v3.5a1.5 1.5 0 0 1-1.5 1.5H15"/><path d="M9 20H5.5A1.5 1.5 0 0 1 4 18.5V15"/>'
86
+ },
87
+ "fullscreen-exit": {
88
+ vb: "0 0 24 24",
89
+ d: '<path d="M9 4v3.5A1.5 1.5 0 0 1 7.5 9H4"/><path d="M20 9h-3.5A1.5 1.5 0 0 1 15 7.5V4"/><path d="M15 20v-3.5a1.5 1.5 0 0 1 1.5-1.5H20"/><path d="M4 15h3.5A1.5 1.5 0 0 1 9 16.5V20"/>'
90
+ },
83
91
  headphones: {
84
92
  vb: "0 0 24 24",
85
93
  d: '<path d="M4 14v-2a8 8 0 0 1 16 0v2"/><path d="M4 14h2.6a1.4 1.4 0 0 1 1.4 1.4v3.2A1.4 1.4 0 0 1 6.6 20H5.4A1.4 1.4 0 0 1 4 18.6Z"/><path d="M20 14h-2.6a1.4 1.4 0 0 0-1.4 1.4v3.2A1.4 1.4 0 0 0 17.4 20h1.2A1.4 1.4 0 0 0 20 18.6Z"/>'
@@ -160,6 +168,14 @@ var ICONS = {
160
168
  vb: "0 0 24 24",
161
169
  d: '<path d="M9 7 4 12l5 5"/><path d="M4 12h9.5a6.5 6.5 0 0 1 6.5 6.5V20"/>'
162
170
  },
171
+ "screen-share": {
172
+ vb: "0 0 24 24",
173
+ d: '<rect x="2.6" y="4" width="18.8" height="12.6" rx="2"/><path d="M8.4 20.4h7.2"/><path d="M12 16.6v3.8"/><path d="M12 13V7.4"/><path d="M9.4 9.8 12 7.2l2.6 2.6"/>'
174
+ },
175
+ "screen-share-off": {
176
+ vb: "0 0 24 24",
177
+ d: '<rect x="2.6" y="4" width="18.8" height="12.6" rx="2"/><path d="M8.4 20.4h7.2"/><path d="M12 16.6v3.8"/><path d="M9.6 8 14.4 12.6"/><path d="M14.4 8 9.6 12.6"/>'
178
+ },
163
179
  search: {
164
180
  vb: "0 0 24 24",
165
181
  d: '<circle cx="11" cy="11" r="6.8"/><path d="M20.8 20.8 16 16"/>'
@@ -262,6 +278,47 @@ function PoolseIcon({
262
278
  }
263
279
  );
264
280
  }
281
+ function fullscreenElement() {
282
+ return document.fullscreenElement ?? document.webkitFullscreenElement ?? null;
283
+ }
284
+ function elementFullscreenEnabled() {
285
+ if (typeof document === "undefined") return false;
286
+ return Boolean(
287
+ document.fullscreenEnabled || document.webkitFullscreenEnabled
288
+ );
289
+ }
290
+ function useFullscreen(target, fallbackVideo) {
291
+ const [active, setActive] = react.useState(false);
292
+ const [supported, setSupported] = react.useState(false);
293
+ react.useEffect(() => {
294
+ setSupported(elementFullscreenEnabled() || Boolean(fallbackVideo));
295
+ const sync = () => setActive(target.current != null && fullscreenElement() === target.current);
296
+ document.addEventListener("fullscreenchange", sync);
297
+ document.addEventListener("webkitfullscreenchange", sync);
298
+ return () => {
299
+ document.removeEventListener("fullscreenchange", sync);
300
+ document.removeEventListener("webkitfullscreenchange", sync);
301
+ };
302
+ }, [target, fallbackVideo]);
303
+ const toggle = react.useCallback(() => {
304
+ const el = target.current;
305
+ if (!el) return;
306
+ if (fullscreenElement() === el) {
307
+ if (document.exitFullscreen) void document.exitFullscreen().catch(() => {
308
+ });
309
+ else document.webkitExitFullscreen?.();
310
+ return;
311
+ }
312
+ if (elementFullscreenEnabled()) {
313
+ if (el.requestFullscreen) void el.requestFullscreen().catch(() => {
314
+ });
315
+ else el.webkitRequestFullscreen?.();
316
+ return;
317
+ }
318
+ fallbackVideo?.current?.webkitEnterFullscreen?.();
319
+ }, [target, fallbackVideo]);
320
+ return { active, supported, toggle };
321
+ }
265
322
 
266
323
  // src/userColor.ts
267
324
  var PALETTE = [
@@ -299,6 +356,14 @@ function CallVideoGrid({
299
356
  const self = participants.find((p) => p.isSelf) ?? null;
300
357
  const others = react.useMemo(() => participants.filter((p) => !p.isSelf), [participants]);
301
358
  if (participants.length === 0) return null;
359
+ const presenter = others.find((p) => p.screenSharing && p.screenTrack) ?? (self?.screenSharing && self.screenTrack ? self : null);
360
+ if (presenter) {
361
+ const faces = [...others, ...self ? [self] : []];
362
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: className ?? "callpresent", children: [
363
+ /* @__PURE__ */ jsxRuntime.jsx(ScreenTile, { participant: presenter, label }),
364
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "callpresent__strip", children: faces.map((participant) => /* @__PURE__ */ jsxRuntime.jsx(CallVideoTile, { participant, label }, participant.userId)) })
365
+ ] });
366
+ }
302
367
  if (others.length <= 1) {
303
368
  const spotlight = others[0] ?? self;
304
369
  if (!spotlight) return null;
@@ -383,6 +448,67 @@ function CallVideoTile({
383
448
  ] })
384
449
  ] });
385
450
  }
451
+ function ScreenTile({
452
+ participant,
453
+ label
454
+ }) {
455
+ const ref = react.useRef(null);
456
+ const tile = react.useRef(null);
457
+ const fullscreen = useFullscreen(tile, ref);
458
+ const track = participant.screenTrack;
459
+ const name = participant.isSelf ? "Your screen" : `${participant.name ?? label(participant.userId)}'s screen`;
460
+ react.useEffect(() => {
461
+ const element = ref.current;
462
+ if (!element || !track) return;
463
+ track.attach(element);
464
+ return () => {
465
+ track.detach(element);
466
+ };
467
+ }, [track]);
468
+ return /* @__PURE__ */ jsxRuntime.jsxs(
469
+ "div",
470
+ {
471
+ ref: tile,
472
+ className: "callpresent__screen",
473
+ onDoubleClick: fullscreen.supported ? fullscreen.toggle : void 0,
474
+ children: [
475
+ /* @__PURE__ */ jsxRuntime.jsx(
476
+ "video",
477
+ {
478
+ ref,
479
+ className: "callgrid__video",
480
+ autoPlay: true,
481
+ playsInline: true,
482
+ muted: true,
483
+ style: { objectFit: "contain" }
484
+ }
485
+ ),
486
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "callgrid__caption", children: [
487
+ /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "screen-share", size: 13, label: null }),
488
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "callgrid__name", children: name })
489
+ ] }),
490
+ fullscreen.supported && /* @__PURE__ */ jsxRuntime.jsx(
491
+ "button",
492
+ {
493
+ type: "button",
494
+ className: "callpresent__fullscreen",
495
+ onClick: fullscreen.toggle,
496
+ "aria-label": fullscreen.active ? "Exit full screen" : "Full screen",
497
+ title: fullscreen.active ? "Exit full screen" : "Full screen",
498
+ children: /* @__PURE__ */ jsxRuntime.jsx(
499
+ PoolseIcon,
500
+ {
501
+ name: fullscreen.active ? "fullscreen-exit" : "fullscreen",
502
+ size: 18,
503
+ label: null
504
+ }
505
+ )
506
+ }
507
+ )
508
+ ]
509
+ }
510
+ );
511
+ }
386
512
  function FloatingSelf({
387
513
  children,
388
514
  onClick
@@ -3507,6 +3633,8 @@ function RoomJoinBar({ room, allowStart = true }) {
3507
3633
  }
3508
3634
  function RoomStage({ room, title, labelFor, className }) {
3509
3635
  const media = room.media;
3636
+ const stage = react.useRef(null);
3637
+ const fullscreen = useFullscreen(stage);
3510
3638
  const [menu, setMenu] = react.useState(null);
3511
3639
  const elapsed = useElapsed(room.live?.started_at ?? null, media.status === "connected");
3512
3640
  const openMenu = react.useCallback(
@@ -3517,101 +3645,142 @@ function RoomStage({ room, title, labelFor, className }) {
3517
3645
  [media]
3518
3646
  );
3519
3647
  const count = media.participants.length;
3648
+ const canShare = media.canShareScreen && room.live?.screen_share_allowed !== false;
3520
3649
  const status = media.status === "connecting" || room.joining ? "Connecting\u2026" : `${count} in the room${elapsed ? ` \xB7 ${elapsed}` : ""}`;
3521
- return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: ["poolse-room", className].filter(Boolean).join(" "), "aria-label": "Room", children: [
3522
- /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "poolse-room__head", children: [
3523
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-room__title", children: title ?? "Room" }),
3524
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-room__status", children: status })
3525
- ] }),
3526
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-room__stage", children: count > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
3527
- CallVideoGrid,
3528
- {
3529
- participants: media.participants,
3530
- ...labelFor ? { labelFor } : {},
3531
- onLocalClick: media.cameraEnabled ? () => void media.switchCamera() : void 0
3532
- }
3533
- ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-room__waiting", children: "Connecting\u2026" }) }),
3534
- room.error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "poolse-room__error", children: room.error.message }),
3535
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-room__bar", children: [
3536
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
3537
- /* @__PURE__ */ jsxRuntime.jsx(
3538
- CallControlButton,
3539
- {
3540
- icon: media.micEnabled ? "mic" : "mic-off",
3541
- active: !media.micEnabled,
3542
- label: media.micEnabled ? "Mute" : "Unmute",
3543
- onClick: () => void media.toggleMic(),
3544
- hasMenu: media.devices.audioinput.length > 0,
3545
- onMenuClick: () => openMenu("audioinput")
3546
- }
3547
- ),
3548
- menu === "audioinput" && /* @__PURE__ */ jsxRuntime.jsx(
3549
- CallDeviceMenu,
3550
- {
3551
- title: "Microphone",
3552
- devices: media.devices.audioinput,
3553
- activeId: media.activeDevices.audioinput,
3554
- onSelect: (kind, id) => void media.selectDevice(kind, id),
3555
- onClose: () => setMenu(null)
3556
- }
3557
- )
3558
- ] }),
3559
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
3560
- /* @__PURE__ */ jsxRuntime.jsx(
3561
- CallControlButton,
3562
- {
3563
- icon: media.cameraEnabled ? "video" : "video-off",
3564
- active: !media.cameraEnabled,
3565
- label: media.cameraEnabled ? "Camera" : "Camera off",
3566
- onClick: () => void media.toggleCamera(),
3567
- disabled: media.devices.videoinput.length === 0 && !media.cameraEnabled,
3568
- hasMenu: media.devices.videoinput.length > 0,
3569
- onMenuClick: () => openMenu("videoinput")
3570
- }
3571
- ),
3572
- menu === "videoinput" && /* @__PURE__ */ jsxRuntime.jsx(
3573
- CallDeviceMenu,
3574
- {
3575
- title: "Camera",
3576
- devices: media.devices.videoinput,
3577
- activeId: media.activeDevices.videoinput,
3578
- onSelect: (kind, id) => void media.selectDevice(kind, id),
3579
- onClose: () => setMenu(null)
3580
- }
3581
- )
3582
- ] }),
3583
- media.devices.audiooutput.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
3584
- /* @__PURE__ */ jsxRuntime.jsx(
3585
- CallControlButton,
3586
- {
3587
- icon: "speaker",
3588
- label: "Speaker",
3589
- onClick: () => openMenu("audiooutput")
3590
- }
3591
- ),
3592
- menu === "audiooutput" && /* @__PURE__ */ jsxRuntime.jsx(
3593
- CallDeviceMenu,
3650
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3651
+ "section",
3652
+ {
3653
+ ref: stage,
3654
+ className: ["poolse-room", className].filter(Boolean).join(" "),
3655
+ "aria-label": "Room",
3656
+ children: [
3657
+ /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "poolse-room__head", children: [
3658
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-room__title", children: title ?? "Room" }),
3659
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-room__status", children: status }),
3660
+ fullscreen.supported && /* @__PURE__ */ jsxRuntime.jsx(
3661
+ "button",
3662
+ {
3663
+ type: "button",
3664
+ className: "poolse-room__fullscreen",
3665
+ onClick: fullscreen.toggle,
3666
+ "aria-label": fullscreen.active ? "Exit full screen" : "Full screen",
3667
+ title: fullscreen.active ? "Exit full screen" : "Full screen",
3668
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3669
+ PoolseIcon,
3670
+ {
3671
+ name: fullscreen.active ? "fullscreen-exit" : "fullscreen",
3672
+ size: 17,
3673
+ label: null
3674
+ }
3675
+ )
3676
+ }
3677
+ )
3678
+ ] }),
3679
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-room__stage", children: count > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
3680
+ CallVideoGrid,
3594
3681
  {
3595
- title: "Speaker",
3596
- devices: media.devices.audiooutput,
3597
- activeId: media.activeDevices.audiooutput,
3598
- onSelect: (kind, id) => void media.selectDevice(kind, id),
3599
- onClose: () => setMenu(null)
3682
+ participants: media.participants,
3683
+ ...labelFor ? { labelFor } : {},
3684
+ onLocalClick: media.cameraEnabled ? () => void media.switchCamera() : void 0
3600
3685
  }
3601
- )
3602
- ] }),
3603
- /* @__PURE__ */ jsxRuntime.jsx(
3604
- CallControlButton,
3605
- {
3606
- icon: "phone-off",
3607
- tone: "danger",
3608
- large: true,
3609
- label: "Leave",
3610
- onClick: room.leave
3611
- }
3612
- )
3613
- ] })
3614
- ] });
3686
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-room__waiting", children: "Connecting\u2026" }) }),
3687
+ media.screenSharing && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-room__sharing", role: "status", children: [
3688
+ /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "screen-share", size: 15, label: null }),
3689
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "You are sharing your screen" }),
3690
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: () => void media.setScreenShareEnabled(false), children: "Stop sharing" })
3691
+ ] }),
3692
+ room.error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "poolse-room__error", children: room.error.message }),
3693
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-room__bar", children: [
3694
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
3695
+ /* @__PURE__ */ jsxRuntime.jsx(
3696
+ CallControlButton,
3697
+ {
3698
+ icon: media.micEnabled ? "mic" : "mic-off",
3699
+ active: !media.micEnabled,
3700
+ label: media.micEnabled ? "Mute" : "Unmute",
3701
+ onClick: () => void media.toggleMic(),
3702
+ hasMenu: media.devices.audioinput.length > 0,
3703
+ onMenuClick: () => openMenu("audioinput")
3704
+ }
3705
+ ),
3706
+ menu === "audioinput" && /* @__PURE__ */ jsxRuntime.jsx(
3707
+ CallDeviceMenu,
3708
+ {
3709
+ title: "Microphone",
3710
+ devices: media.devices.audioinput,
3711
+ activeId: media.activeDevices.audioinput,
3712
+ onSelect: (kind, id) => void media.selectDevice(kind, id),
3713
+ onClose: () => setMenu(null)
3714
+ }
3715
+ )
3716
+ ] }),
3717
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
3718
+ /* @__PURE__ */ jsxRuntime.jsx(
3719
+ CallControlButton,
3720
+ {
3721
+ icon: media.cameraEnabled ? "video" : "video-off",
3722
+ active: !media.cameraEnabled,
3723
+ label: media.cameraEnabled ? "Camera" : "Camera off",
3724
+ onClick: () => void media.toggleCamera(),
3725
+ disabled: media.devices.videoinput.length === 0 && !media.cameraEnabled,
3726
+ hasMenu: media.devices.videoinput.length > 0,
3727
+ onMenuClick: () => openMenu("videoinput")
3728
+ }
3729
+ ),
3730
+ menu === "videoinput" && /* @__PURE__ */ jsxRuntime.jsx(
3731
+ CallDeviceMenu,
3732
+ {
3733
+ title: "Camera",
3734
+ devices: media.devices.videoinput,
3735
+ activeId: media.activeDevices.videoinput,
3736
+ onSelect: (kind, id) => void media.selectDevice(kind, id),
3737
+ onClose: () => setMenu(null)
3738
+ }
3739
+ )
3740
+ ] }),
3741
+ (canShare || media.screenSharing) && /* @__PURE__ */ jsxRuntime.jsx(
3742
+ CallControlButton,
3743
+ {
3744
+ icon: media.screenSharing ? "screen-share-off" : "screen-share",
3745
+ active: media.screenSharing,
3746
+ label: media.screenSharing ? "Stop sharing" : "Share screen",
3747
+ onClick: () => void media.toggleScreenShare()
3748
+ }
3749
+ ),
3750
+ media.devices.audiooutput.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
3751
+ /* @__PURE__ */ jsxRuntime.jsx(
3752
+ CallControlButton,
3753
+ {
3754
+ icon: "speaker",
3755
+ label: "Speaker",
3756
+ onClick: () => openMenu("audiooutput")
3757
+ }
3758
+ ),
3759
+ menu === "audiooutput" && /* @__PURE__ */ jsxRuntime.jsx(
3760
+ CallDeviceMenu,
3761
+ {
3762
+ title: "Speaker",
3763
+ devices: media.devices.audiooutput,
3764
+ activeId: media.activeDevices.audiooutput,
3765
+ onSelect: (kind, id) => void media.selectDevice(kind, id),
3766
+ onClose: () => setMenu(null)
3767
+ }
3768
+ )
3769
+ ] }),
3770
+ /* @__PURE__ */ jsxRuntime.jsx(
3771
+ CallControlButton,
3772
+ {
3773
+ icon: "phone-off",
3774
+ tone: "danger",
3775
+ large: true,
3776
+ label: "Leave",
3777
+ onClick: room.leave
3778
+ }
3779
+ )
3780
+ ] })
3781
+ ]
3782
+ }
3783
+ );
3615
3784
  }
3616
3785
  function useElapsed(startedAt, running) {
3617
3786
  const [, tick] = react.useState(0);