@poolse/react-ui 3.2.0-dev.1 → 3.2.0-dev.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/CHANGELOG.md CHANGED
@@ -4,6 +4,15 @@ 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.2] — 2026-11-16 (prerelease, npm tag `dev`)
8
+
9
+ ### Added
10
+
11
+ - Screen sharing in `RoomStage`: a Share button where the browser and the
12
+ workspace allow it, a "You are sharing your screen · Stop sharing" bar, and
13
+ `CallVideoGrid` draws a shared screen large and uncropped with faces in a strip.
14
+ - Icons `screen-share` and `screen-share-off`.
15
+
7
16
  ## [3.2.0-dev.1] — 2026-11-04 (prerelease, npm tag `dev`)
8
17
 
9
18
  ### Added
package/dist/index.cjs CHANGED
@@ -160,6 +160,14 @@ var ICONS = {
160
160
  vb: "0 0 24 24",
161
161
  d: '<path d="M9 7 4 12l5 5"/><path d="M4 12h9.5a6.5 6.5 0 0 1 6.5 6.5V20"/>'
162
162
  },
163
+ "screen-share": {
164
+ vb: "0 0 24 24",
165
+ 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"/>'
166
+ },
167
+ "screen-share-off": {
168
+ vb: "0 0 24 24",
169
+ 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"/>'
170
+ },
163
171
  search: {
164
172
  vb: "0 0 24 24",
165
173
  d: '<circle cx="11" cy="11" r="6.8"/><path d="M20.8 20.8 16 16"/>'
@@ -299,6 +307,14 @@ function CallVideoGrid({
299
307
  const self = participants.find((p) => p.isSelf) ?? null;
300
308
  const others = react.useMemo(() => participants.filter((p) => !p.isSelf), [participants]);
301
309
  if (participants.length === 0) return null;
310
+ const presenter = others.find((p) => p.screenSharing && p.screenTrack) ?? (self?.screenSharing && self.screenTrack ? self : null);
311
+ if (presenter) {
312
+ const faces = [...others, ...self ? [self] : []];
313
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: className ?? "callpresent", children: [
314
+ /* @__PURE__ */ jsxRuntime.jsx(ScreenTile, { participant: presenter, label }),
315
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "callpresent__strip", children: faces.map((participant) => /* @__PURE__ */ jsxRuntime.jsx(CallVideoTile, { participant, label }, participant.userId)) })
316
+ ] });
317
+ }
302
318
  if (others.length <= 1) {
303
319
  const spotlight = others[0] ?? self;
304
320
  if (!spotlight) return null;
@@ -383,6 +399,39 @@ function CallVideoTile({
383
399
  ] })
384
400
  ] });
385
401
  }
402
+ function ScreenTile({
403
+ participant,
404
+ label
405
+ }) {
406
+ const ref = react.useRef(null);
407
+ const track = participant.screenTrack;
408
+ const name = participant.isSelf ? "Your screen" : `${participant.name ?? label(participant.userId)}'s screen`;
409
+ react.useEffect(() => {
410
+ const element = ref.current;
411
+ if (!element || !track) return;
412
+ track.attach(element);
413
+ return () => {
414
+ track.detach(element);
415
+ };
416
+ }, [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
+ ] });
434
+ }
386
435
  function FloatingSelf({
387
436
  children,
388
437
  onClick
@@ -3517,6 +3566,7 @@ function RoomStage({ room, title, labelFor, className }) {
3517
3566
  [media]
3518
3567
  );
3519
3568
  const count = media.participants.length;
3569
+ const canShare = media.canShareScreen && room.live?.screen_share_allowed !== false;
3520
3570
  const status = media.status === "connecting" || room.joining ? "Connecting\u2026" : `${count} in the room${elapsed ? ` \xB7 ${elapsed}` : ""}`;
3521
3571
  return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: ["poolse-room", className].filter(Boolean).join(" "), "aria-label": "Room", children: [
3522
3572
  /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "poolse-room__head", children: [
@@ -3531,6 +3581,11 @@ function RoomStage({ room, title, labelFor, className }) {
3531
3581
  onLocalClick: media.cameraEnabled ? () => void media.switchCamera() : void 0
3532
3582
  }
3533
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
+ ] }),
3534
3589
  room.error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "poolse-room__error", children: room.error.message }),
3535
3590
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-room__bar", children: [
3536
3591
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
@@ -3580,6 +3635,15 @@ function RoomStage({ room, title, labelFor, className }) {
3580
3635
  }
3581
3636
  )
3582
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
+ ),
3583
3647
  media.devices.audiooutput.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
3584
3648
  /* @__PURE__ */ jsxRuntime.jsx(
3585
3649
  CallControlButton,