@poolse/react-ui 3.2.0-dev.2 → 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,17 @@ 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
+
7
18
  ## [3.2.0-dev.2] — 2026-11-16 (prerelease, npm tag `dev`)
8
19
 
9
20
  ### 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"/>'
@@ -270,6 +278,47 @@ function PoolseIcon({
270
278
  }
271
279
  );
272
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
+ }
273
322
 
274
323
  // src/userColor.ts
275
324
  var PALETTE = [
@@ -404,6 +453,8 @@ function ScreenTile({
404
453
  label
405
454
  }) {
406
455
  const ref = react.useRef(null);
456
+ const tile = react.useRef(null);
457
+ const fullscreen = useFullscreen(tile, ref);
407
458
  const track = participant.screenTrack;
408
459
  const name = participant.isSelf ? "Your screen" : `${participant.name ?? label(participant.userId)}'s screen`;
409
460
  react.useEffect(() => {
@@ -414,23 +465,49 @@ function ScreenTile({
414
465
  track.detach(element);
415
466
  };
416
467
  }, [track]);
417
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "callpresent__screen", children: [
418
- /* @__PURE__ */ jsxRuntime.jsx(
419
- "video",
420
- {
421
- ref,
422
- className: "callgrid__video",
423
- autoPlay: true,
424
- playsInline: true,
425
- muted: true,
426
- style: { objectFit: "contain" }
427
- }
428
- ),
429
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "callgrid__caption", children: [
430
- /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "screen-share", size: 13, label: null }),
431
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "callgrid__name", children: name })
432
- ] })
433
- ] });
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
+ );
434
511
  }
435
512
  function FloatingSelf({
436
513
  children,
@@ -3556,6 +3633,8 @@ function RoomJoinBar({ room, allowStart = true }) {
3556
3633
  }
3557
3634
  function RoomStage({ room, title, labelFor, className }) {
3558
3635
  const media = room.media;
3636
+ const stage = react.useRef(null);
3637
+ const fullscreen = useFullscreen(stage);
3559
3638
  const [menu, setMenu] = react.useState(null);
3560
3639
  const elapsed = useElapsed(room.live?.started_at ?? null, media.status === "connected");
3561
3640
  const openMenu = react.useCallback(
@@ -3568,114 +3647,140 @@ function RoomStage({ room, title, labelFor, className }) {
3568
3647
  const count = media.participants.length;
3569
3648
  const canShare = media.canShareScreen && room.live?.screen_share_allowed !== false;
3570
3649
  const status = media.status === "connecting" || room.joining ? "Connecting\u2026" : `${count} in the room${elapsed ? ` \xB7 ${elapsed}` : ""}`;
3571
- return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: ["poolse-room", className].filter(Boolean).join(" "), "aria-label": "Room", children: [
3572
- /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "poolse-room__head", children: [
3573
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-room__title", children: title ?? "Room" }),
3574
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-room__status", children: status })
3575
- ] }),
3576
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-room__stage", children: count > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
3577
- CallVideoGrid,
3578
- {
3579
- participants: media.participants,
3580
- ...labelFor ? { labelFor } : {},
3581
- onLocalClick: media.cameraEnabled ? () => void media.switchCamera() : void 0
3582
- }
3583
- ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-room__waiting", children: "Connecting\u2026" }) }),
3584
- media.screenSharing && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-room__sharing", role: "status", children: [
3585
- /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "screen-share", size: 15, label: null }),
3586
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "You are sharing your screen" }),
3587
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: () => void media.setScreenShareEnabled(false), children: "Stop sharing" })
3588
- ] }),
3589
- room.error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "poolse-room__error", children: room.error.message }),
3590
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-room__bar", children: [
3591
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
3592
- /* @__PURE__ */ jsxRuntime.jsx(
3593
- CallControlButton,
3594
- {
3595
- icon: media.micEnabled ? "mic" : "mic-off",
3596
- active: !media.micEnabled,
3597
- label: media.micEnabled ? "Mute" : "Unmute",
3598
- onClick: () => void media.toggleMic(),
3599
- hasMenu: media.devices.audioinput.length > 0,
3600
- onMenuClick: () => openMenu("audioinput")
3601
- }
3602
- ),
3603
- menu === "audioinput" && /* @__PURE__ */ jsxRuntime.jsx(
3604
- CallDeviceMenu,
3605
- {
3606
- title: "Microphone",
3607
- devices: media.devices.audioinput,
3608
- activeId: media.activeDevices.audioinput,
3609
- onSelect: (kind, id) => void media.selectDevice(kind, id),
3610
- onClose: () => setMenu(null)
3611
- }
3612
- )
3613
- ] }),
3614
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
3615
- /* @__PURE__ */ jsxRuntime.jsx(
3616
- CallControlButton,
3617
- {
3618
- icon: media.cameraEnabled ? "video" : "video-off",
3619
- active: !media.cameraEnabled,
3620
- label: media.cameraEnabled ? "Camera" : "Camera off",
3621
- onClick: () => void media.toggleCamera(),
3622
- disabled: media.devices.videoinput.length === 0 && !media.cameraEnabled,
3623
- hasMenu: media.devices.videoinput.length > 0,
3624
- onMenuClick: () => openMenu("videoinput")
3625
- }
3626
- ),
3627
- menu === "videoinput" && /* @__PURE__ */ jsxRuntime.jsx(
3628
- CallDeviceMenu,
3629
- {
3630
- title: "Camera",
3631
- devices: media.devices.videoinput,
3632
- activeId: media.activeDevices.videoinput,
3633
- onSelect: (kind, id) => void media.selectDevice(kind, id),
3634
- onClose: () => setMenu(null)
3635
- }
3636
- )
3637
- ] }),
3638
- (canShare || media.screenSharing) && /* @__PURE__ */ jsxRuntime.jsx(
3639
- CallControlButton,
3640
- {
3641
- icon: media.screenSharing ? "screen-share-off" : "screen-share",
3642
- active: media.screenSharing,
3643
- label: media.screenSharing ? "Stop sharing" : "Share screen",
3644
- onClick: () => void media.toggleScreenShare()
3645
- }
3646
- ),
3647
- media.devices.audiooutput.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
3648
- /* @__PURE__ */ jsxRuntime.jsx(
3649
- CallControlButton,
3650
- {
3651
- icon: "speaker",
3652
- label: "Speaker",
3653
- onClick: () => openMenu("audiooutput")
3654
- }
3655
- ),
3656
- menu === "audiooutput" && /* @__PURE__ */ jsxRuntime.jsx(
3657
- 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,
3658
3681
  {
3659
- title: "Speaker",
3660
- devices: media.devices.audiooutput,
3661
- activeId: media.activeDevices.audiooutput,
3662
- onSelect: (kind, id) => void media.selectDevice(kind, id),
3663
- onClose: () => setMenu(null)
3682
+ participants: media.participants,
3683
+ ...labelFor ? { labelFor } : {},
3684
+ onLocalClick: media.cameraEnabled ? () => void media.switchCamera() : void 0
3664
3685
  }
3665
- )
3666
- ] }),
3667
- /* @__PURE__ */ jsxRuntime.jsx(
3668
- CallControlButton,
3669
- {
3670
- icon: "phone-off",
3671
- tone: "danger",
3672
- large: true,
3673
- label: "Leave",
3674
- onClick: room.leave
3675
- }
3676
- )
3677
- ] })
3678
- ] });
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
+ );
3679
3784
  }
3680
3785
  function useElapsed(startedAt, running) {
3681
3786
  const [, tick] = react.useState(0);