@q9labsai/chalk-react 5.4.0 → 5.5.0

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.
Files changed (133) hide show
  1. package/README.md +7 -30
  2. package/dist/Board-PPO62QTR.js +80 -0
  3. package/dist/CallCharts-7ZQLN47C.js +114 -0
  4. package/dist/CallDetails-IG57GXT2.js +200 -0
  5. package/dist/CallDialogContent-GST2I23W.js +177 -0
  6. package/dist/CameraBackgroundPicker-AZXKBGRF.js +72 -0
  7. package/dist/ConnectionNotice-NQUBBT46.js +55 -0
  8. package/dist/DeviceAccessCard-MLRBTPRP.js +238 -0
  9. package/dist/DeviceAccessWaiting-MQXXW45M.js +25 -0
  10. package/dist/DeviceSheet-GZTV44UW.js +118 -0
  11. package/dist/InviteQrCode-TNTZA3GS.js +54 -0
  12. package/dist/KnockNotice-CAW4CJ4S.js +181 -0
  13. package/dist/ReactionSheet-ZU6RWC66.js +132 -0
  14. package/dist/chunk-26PBFST5.js +25 -0
  15. package/dist/{chunk-K5DV2OTY.js → chunk-4RSCAIFK.js} +340 -165
  16. package/dist/chunk-ADIDI7AJ.js +10 -0
  17. package/dist/chunk-ALGD3RBI.js +10 -0
  18. package/dist/chunk-CQBYFA2W.js +73 -0
  19. package/dist/chunk-E6HPIMFO.js +44 -0
  20. package/dist/{chunk-LYZ7EBFF.js → chunk-F6QZY5SM.js} +4116 -4605
  21. package/dist/chunk-I6FSUWKG.js +51 -0
  22. package/dist/chunk-JDCFKSGV.js +95 -0
  23. package/dist/chunk-PH3RC6T6.js +476 -0
  24. package/dist/chunk-PMGIER77.js +92 -0
  25. package/dist/chunk-Q36UO2T2.js +363 -0
  26. package/dist/chunk-SBGC5DKV.js +114 -0
  27. package/dist/chunk-SZNV3J4B.js +9 -0
  28. package/dist/{chunk-4U7QZC72.js → chunk-TSBY6C5U.js} +1 -102
  29. package/dist/chunk-XY7WXXME.js +85 -0
  30. package/dist/chunk-YOWY22N7.js +148 -0
  31. package/dist/chunk-Z5AASN4L.js +34 -0
  32. package/dist/components/admission-panel/KnockNotice.d.ts +31 -0
  33. package/dist/components/admission-panel/answer-all.d.ts +2 -0
  34. package/dist/components/call-limbo/CallLimbo.d.ts +5 -1
  35. package/dist/components/chalk/Chalk.d.ts +2 -5
  36. package/dist/components/chalk/StatusSurface.d.ts +3 -3
  37. package/dist/components/chalk-ui/ChalkSheet.d.ts +6 -2
  38. package/dist/components/chalk-ui/InviteLinkButton.d.ts +5 -0
  39. package/dist/components/chalk-ui/InviteQR.d.ts +4 -0
  40. package/dist/components/chalk-ui/InviteQrCode.d.ts +3 -0
  41. package/dist/components/chalk-ui/MenuIcon.d.ts +17 -0
  42. package/dist/components/chalk-ui/invite-qr-path.d.ts +10 -0
  43. package/dist/components/chalk-ui/sheet-drag.d.ts +17 -0
  44. package/dist/components/chalk-ui/useCopyText.d.ts +6 -0
  45. package/dist/components/chalk-ui/useSheetDrag.d.ts +11 -0
  46. package/dist/components/composite/ReactionSheet.d.ts +5 -0
  47. package/dist/components/connection-notice/ConnectionBars.d.ts +4 -0
  48. package/dist/components/connection-notice/ConnectionNotice.d.ts +12 -0
  49. package/dist/components/connection-notice/shown-notice.d.ts +12 -0
  50. package/dist/components/connection-status/ConnectionRing.d.ts +2 -0
  51. package/dist/components/connection-status/ConnectionStatus.d.ts +24 -0
  52. package/dist/components/connection-status/LiveConnectionStatus.d.ts +9 -0
  53. package/dist/components/connection-status/use-connection-phase.d.ts +23 -0
  54. package/dist/components/control-bar/DockLayout.d.ts +2 -1
  55. package/dist/components/control-bar/ShareControl.d.ts +3 -1
  56. package/dist/components/control-bar/ShellIcon.d.ts +18 -6
  57. package/dist/components/control-bar/control-bar-behavior.d.ts +19 -8
  58. package/dist/components/control-bar/control-bar-devices.d.ts +8 -0
  59. package/dist/components/control-bar/useDeviceSheets.d.ts +7 -0
  60. package/dist/components/device-access/DeviceAccessCard.d.ts +17 -0
  61. package/dist/components/device-access/DeviceAccessStyles.d.ts +1 -0
  62. package/dist/components/device-access/DeviceAccessWaiting.d.ts +4 -0
  63. package/dist/components/device-access/LazyDeviceAccessCard.d.ts +7 -0
  64. package/dist/components/device-access/browser-marks.d.ts +5 -0
  65. package/dist/components/device-access/card-copy.d.ts +17 -0
  66. package/dist/components/device-access/load-card.d.ts +2 -0
  67. package/dist/components/device-access/model.d.ts +29 -0
  68. package/dist/components/device-access/ports.d.ts +21 -0
  69. package/dist/components/device-access/resolve.d.ts +31 -0
  70. package/dist/components/device-access/store.d.ts +32 -0
  71. package/dist/components/device-access/useDeviceAccess.d.ts +7 -0
  72. package/dist/components/device-popover/CameraBackgroundPicker.d.ts +23 -0
  73. package/dist/components/device-popover/DevicePopover.d.ts +7 -1
  74. package/dist/components/device-popover/DevicePreview.d.ts +12 -0
  75. package/dist/components/device-popover/DeviceSheet.d.ts +26 -0
  76. package/dist/components/index.js +30 -15
  77. package/dist/components/participant-grid/ParticipantGrid.d.ts +9 -0
  78. package/dist/components/participant-tile/ParticipantTile.d.ts +12 -1
  79. package/dist/components/participant-tile/TileConnection.d.ts +9 -0
  80. package/dist/components/participant-tile/TileShell.d.ts +2 -1
  81. package/dist/components/participant-tile/useFrozenFrame.d.ts +12 -0
  82. package/dist/components/participant-tile/useVideoTileVisibility.d.ts +6 -0
  83. package/dist/components/participants-panel/ParticipantsPanel.d.ts +5 -0
  84. package/dist/components/participants-panel/participant-options-menu.d.ts +4 -1
  85. package/dist/components/participants-panel/participant-order.d.ts +13 -0
  86. package/dist/components/participants-panel/participant-row.d.ts +5 -1
  87. package/dist/components/participants-panel/participant-search.d.ts +4 -0
  88. package/dist/components/space-header/CallCharts.d.ts +22 -0
  89. package/dist/components/space-header/CallDetails.d.ts +5 -13
  90. package/dist/components/space-header/CallDialog.d.ts +5 -0
  91. package/dist/components/space-header/CallDialogContent.d.ts +13 -0
  92. package/dist/components/space-header/CallMenuStyles.d.ts +2 -0
  93. package/dist/components/space-header/RowIcon.d.ts +12 -0
  94. package/dist/components/space-header/call-diagnostics.d.ts +2 -1
  95. package/dist/components/space-header/call-network.d.ts +18 -0
  96. package/dist/components/space-header/space-header-contract.d.ts +8 -1
  97. package/dist/components/space-view/SpacePresentation.d.ts +3 -1
  98. package/dist/components/space-view/SpaceView.d.ts +3 -5
  99. package/dist/components/space-view/useBoardNotices.d.ts +7 -0
  100. package/dist/components/space-view/useMicrophoneNotice.d.ts +11 -0
  101. package/dist/components/toast-stack/ToastStack.d.ts +3 -1
  102. package/dist/components/toast-stack/call-events.d.ts +4 -2
  103. package/dist/index.d.ts +4 -0
  104. package/dist/index.js +298 -28
  105. package/dist/internal/call-width.d.ts +9 -0
  106. package/dist/internal/media-devices.d.ts +11 -0
  107. package/dist/internal/speaker-test.d.ts +2 -0
  108. package/dist/internal/useHandOrder.d.ts +2 -0
  109. package/dist/internal/useHeldWhile.d.ts +2 -0
  110. package/dist/internal/useInputLevel.d.ts +4 -0
  111. package/dist/internal/useLongPress.d.ts +15 -0
  112. package/dist/internal/useSeenConnected.d.ts +9 -0
  113. package/dist/internal/useSilentMicrophone.d.ts +4 -0
  114. package/dist/internal/useTrueFor.d.ts +4 -0
  115. package/dist/participant-options-menu-S3EL6K3M.js +330 -0
  116. package/dist/pre-join/remembered-devices.d.ts +12 -0
  117. package/dist/pre-join/usePreJoinDevices.d.ts +47 -0
  118. package/dist/public-surface.contract.d.ts +1 -1
  119. package/dist/test-support/index.d.ts +1 -1
  120. package/dist/test-support/index.js +41 -10
  121. package/dist/theme.d.ts +32 -32
  122. package/dist/toast.d.ts +1 -0
  123. package/dist/toast.js +7 -0
  124. package/dist/utils/formatClockTime.d.ts +2 -0
  125. package/dist/utils/index.d.ts +1 -0
  126. package/dist/utils/index.js +20 -12
  127. package/package.json +24 -11
  128. package/dist/components/call-limbo/qr-code.d.ts +0 -4
  129. package/dist/components/offline-actions/OfflineActions.d.ts +0 -9
  130. package/dist/components/participants-panel/index.d.ts +0 -2
  131. package/dist/components/reconnecting-overlay/ReconnectingOverlay.d.ts +0 -12
  132. package/dist/components/space-header/share-qr.d.ts +0 -2
  133. package/dist/components/space-view/countdown.d.ts +0 -5
@@ -0,0 +1,330 @@
1
+ import {
2
+ Crown01Icon,
3
+ Edit02Icon,
4
+ Microphone01Icon,
5
+ MicrophoneOff01Icon,
6
+ Monitor01Icon,
7
+ UserRemove01Icon,
8
+ Video01Icon,
9
+ VideoOffIcon,
10
+ VolumeHighIcon,
11
+ VolumeMute01Icon
12
+ } from "./chunk-TSBY6C5U.js";
13
+ import {
14
+ ChalkButton
15
+ } from "./chunk-PH3RC6T6.js";
16
+ import "./chunk-I6FSUWKG.js";
17
+ import {
18
+ cn
19
+ } from "./chunk-ADIDI7AJ.js";
20
+
21
+ // src/components/participants-panel/participant-options-menu.tsx
22
+ import { useState } from "react";
23
+
24
+ // src/components/atomic/VolumeSlider.tsx
25
+ import React from "react";
26
+ import { Slider } from "@base-ui/react/slider";
27
+ import { jsx, jsxs } from "react/jsx-runtime";
28
+ var VolumeSlider = React.memo(({ value, onChange, muted = false, onMuteToggle, showValue = false, size = "md", orientation = "horizontal", className }) => {
29
+ const handleValueChange = (newValue) => {
30
+ const val = Array.isArray(newValue) ? newValue[0] : newValue;
31
+ if (val !== void 0) onChange(val);
32
+ };
33
+ const isVertical = orientation === "vertical";
34
+ const sliderValue = muted ? 0 : value;
35
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2", isVertical ? "flex-col-reverse h-32 w-8" : "flex-row w-full", className), children: [
36
+ /* @__PURE__ */ jsx(
37
+ "button",
38
+ {
39
+ type: "button",
40
+ onClick: onMuteToggle,
41
+ disabled: !onMuteToggle,
42
+ className: cn("flex items-center justify-center rounded-full transition-colors", "hover:bg-[var(--chalk-stage)]", size === "sm" ? "p-1" : "p-1.5", muted ? "text-[var(--chalk-muted-text)]" : "text-[var(--chalk-text)]", !onMuteToggle && "opacity-50 pointer-events-none"),
43
+ "aria-label": muted ? "Unmute volume" : "Mute volume",
44
+ children: muted || value === 0 ? /* @__PURE__ */ jsx(VolumeMute01Icon, { size: size === "sm" ? 14 : 18 }) : /* @__PURE__ */ jsx(VolumeHighIcon, { size: size === "sm" ? 14 : 18 })
45
+ }
46
+ ),
47
+ /* @__PURE__ */ jsx(Slider.Root, { value: sliderValue, onValueChange: handleValueChange, min: 0, max: 100, step: 1, orientation, className: cn("relative flex items-center", isVertical ? "h-full w-2 flex-col" : "w-full"), children: /* @__PURE__ */ jsx(Slider.Control, { className: cn("relative flex items-center touch-none select-none cursor-pointer", isVertical ? "h-full w-2 flex-col" : "w-full h-5"), children: /* @__PURE__ */ jsxs(Slider.Track, { className: cn("relative grow rounded-full bg-[var(--chalk-stage)]", isVertical ? "w-2 h-full" : "h-2 w-full"), children: [
48
+ /* @__PURE__ */ jsx(Slider.Indicator, { className: cn("absolute rounded-full bg-[var(--chalk-accent)]", isVertical ? "w-full bottom-0" : "h-full left-0") }),
49
+ /* @__PURE__ */ jsx(Slider.Thumb, { className: cn("block rounded-full shadow-sm bg-[var(--chalk-accent)]", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--chalk-focus)]", "disabled:pointer-events-none disabled:opacity-50", size === "sm" ? "h-3 w-3" : "h-4 w-4") })
50
+ ] }) }) }),
51
+ showValue && /* @__PURE__ */ jsxs("span", { className: "text-xs text-[var(--chalk-muted-text)] min-w-[2rem] text-center", children: [
52
+ Math.round(sliderValue),
53
+ "%"
54
+ ] })
55
+ ] });
56
+ });
57
+ VolumeSlider.displayName = "VolumeSlider";
58
+
59
+ // src/components/participants-panel/participant-options-menu-contract.ts
60
+ function runParticipantAction(action, onClose, onCommandError) {
61
+ try {
62
+ return Promise.resolve(action()).then(
63
+ () => {
64
+ onCommandError?.(null);
65
+ onClose();
66
+ },
67
+ (cause) => {
68
+ onCommandError?.(cause instanceof Error ? cause.message : "This Participant action could not be completed.");
69
+ }
70
+ );
71
+ } catch (cause) {
72
+ onCommandError?.(cause instanceof Error ? cause.message : "This Participant action could not be completed.");
73
+ return Promise.resolve();
74
+ }
75
+ }
76
+
77
+ // src/components/participants-panel/participant-options-menu.tsx
78
+ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
79
+ var styles = `.chalk-sheet:has(.call-sheet-menu) {
80
+ max-height: 100%;
81
+ overflow-y: auto;
82
+ overscroll-behavior: contain;
83
+ }
84
+ .call-row-menu {
85
+ width: 252px;
86
+ padding: var(--space-1-5);
87
+ }
88
+ .call-menu-item {
89
+ display: flex;
90
+ align-items: center;
91
+ gap: var(--space-3);
92
+ width: 100%;
93
+ height: 40px;
94
+ padding: 0 var(--space-3);
95
+ border-radius: var(--corner-lg);
96
+ font-size: var(--type-body);
97
+ font-weight: 500;
98
+ text-align: start;
99
+ color: var(--chalk-text);
100
+ }
101
+ .call-menu-item:hover {
102
+ background: var(--chalk-hover);
103
+ }
104
+ .call-menu-item svg {
105
+ width: 18px;
106
+ height: 18px;
107
+ flex: none;
108
+ color: var(--chalk-muted-text);
109
+ }
110
+ .call-menu-item.is-danger,
111
+ .call-menu-item.is-danger svg {
112
+ color: var(--chalk-danger-text);
113
+ }
114
+ .call-menu-sep {
115
+ height: 1px;
116
+ margin: var(--space-1-5) var(--space-3);
117
+ background: var(--chalk-line-strong);
118
+ }
119
+ .call-menu-confirm {
120
+ display: grid;
121
+ gap: var(--space-1);
122
+ padding: var(--space-3) var(--space-3) var(--space-2);
123
+ }
124
+ .call-menu-confirm b {
125
+ font-size: var(--type-body-lg);
126
+ font-weight: 600;
127
+ }
128
+ .call-menu-confirm p {
129
+ font-size: var(--type-body-sm);
130
+ line-height: 1.45;
131
+ color: var(--chalk-muted-text);
132
+ }
133
+ .call-menu-confirm-actions {
134
+ display: flex;
135
+ gap: var(--space-2);
136
+ margin-top: var(--space-3);
137
+ }
138
+ .call-menu-confirm-actions .chalk-pill-button {
139
+ flex: 1;
140
+ }
141
+ .call-menu-confirm-actions .chalk-pill-button[data-chalk-tone="danger"] {
142
+ background: var(--chalk-danger);
143
+ color: var(--chalk-on-overlay);
144
+ }
145
+ .call-sheet-menu {
146
+ display: grid;
147
+ }
148
+ .call-sheet-who {
149
+ display: flex;
150
+ align-items: center;
151
+ gap: var(--space-3);
152
+ padding: var(--space-2) var(--space-2) var(--space-3);
153
+ }
154
+ .call-sheet-who b {
155
+ display: block;
156
+ font-size: var(--type-body-lg);
157
+ font-weight: 600;
158
+ }
159
+ .call-sheet-who span {
160
+ font-size: var(--type-body-sm);
161
+ color: var(--chalk-muted-text);
162
+ }
163
+
164
+ @media (max-width: 767px) {
165
+ .call-sheet-menu .call-menu-item { height: 48px; font-size: var(--type-body-lg); }
166
+ .call-sheet-menu .call-menu-item svg { width: 20px; height: 20px; }
167
+ .call-sheet-menu .call-menu-confirm { padding-inline: var(--space-2); }
168
+ .call-sheet-menu .call-menu-confirm-actions .chalk-pill-button { height: 48px; }
169
+ }
170
+ `;
171
+ function ParticipantOptionsMenu({
172
+ header,
173
+ participant,
174
+ variant,
175
+ canManageParticipants,
176
+ onClose,
177
+ onAssignRole,
178
+ onStopParticipantScreenShare,
179
+ onMuteParticipant,
180
+ onRequestUnmute,
181
+ onStopParticipantCamera,
182
+ onRequestStartCamera,
183
+ onRemoveParticipant,
184
+ onEditName,
185
+ participantVolumes,
186
+ onParticipantVolumeChange,
187
+ onCommandError
188
+ }) {
189
+ const hasVolumeControl = !participant.isLocal && !!participantVolumes && !!onParticipantVolumeChange;
190
+ const hasLocalActions = !!onEditName;
191
+ const hasManageActions = canManageParticipants && !participant.isLocal && (!!onMuteParticipant || !!onRequestUnmute || !!onStopParticipantCamera || !!onRequestStartCamera || !!onRemoveParticipant || !!onAssignRole || !!onStopParticipantScreenShare);
192
+ const volume = participantVolumes?.get(participant.id) ?? 100;
193
+ const volumeMuted = volume <= 0;
194
+ const [confirmingRemove, setConfirmingRemove] = useState(false);
195
+ const menuItemClassName = "call-menu-item";
196
+ const dividerClassName = "call-menu-sep";
197
+ const wrap = (content) => /* @__PURE__ */ jsxs2("div", { className: header ? "call-sheet-menu" : void 0, children: [
198
+ /* @__PURE__ */ jsx2("style", { children: styles }),
199
+ header,
200
+ content
201
+ ] });
202
+ if (confirmingRemove && onRemoveParticipant) {
203
+ const firstName = participant.displayName.split(" ")[0] ?? participant.displayName;
204
+ return wrap(
205
+ /* @__PURE__ */ jsxs2("div", { className: "call-menu-confirm", children: [
206
+ /* @__PURE__ */ jsxs2("b", { children: [
207
+ "Remove ",
208
+ /* @__PURE__ */ jsx2("bdi", { children: firstName }),
209
+ " from the call?"
210
+ ] }),
211
+ /* @__PURE__ */ jsxs2("p", { children: [
212
+ /* @__PURE__ */ jsx2("bdi", { children: firstName }),
213
+ " leaves right away. Everyone else stays in the call."
214
+ ] }),
215
+ /* @__PURE__ */ jsxs2("div", { className: "call-menu-confirm-actions", children: [
216
+ /* @__PURE__ */ jsx2(ChalkButton, { onClick: () => setConfirmingRemove(false), children: "Cancel" }),
217
+ /* @__PURE__ */ jsx2(ChalkButton, { variant: "solid", tone: "danger", onClick: () => void runParticipantAction(() => onRemoveParticipant(participant.id), onClose, onCommandError), children: "Remove" })
218
+ ] })
219
+ ] })
220
+ );
221
+ }
222
+ return wrap(
223
+ /* @__PURE__ */ jsxs2(Fragment, { children: [
224
+ hasLocalActions ? /* @__PURE__ */ jsxs2("button", { type: "button", onClick: onEditName, className: menuItemClassName, children: [
225
+ /* @__PURE__ */ jsx2(Edit02Icon, {}),
226
+ "Edit name"
227
+ ] }) : null,
228
+ hasLocalActions && (hasVolumeControl || hasManageActions) ? /* @__PURE__ */ jsx2("div", { className: dividerClassName }) : null,
229
+ hasVolumeControl ? /* @__PURE__ */ jsxs2("div", { className: "px-3.5 py-2.5 text-[var(--chalk-app-text)]", children: [
230
+ /* @__PURE__ */ jsxs2("div", { className: "mb-2 flex items-center justify-between gap-3", children: [
231
+ /* @__PURE__ */ jsx2("span", { className: "text-[var(--chalk-app-text-muted)] text-sm font-medium", children: "Volume" }),
232
+ /* @__PURE__ */ jsx2("button", { type: "button", onClick: () => onParticipantVolumeChange?.(participant.id, 100), className: "text-[var(--chalk-app-text-muted)] text-xs hover:text-[var(--chalk-app-text)]", "aria-label": `Reset volume for ${participant.displayName}`, children: "Reset" })
233
+ ] }),
234
+ /* @__PURE__ */ jsx2(
235
+ VolumeSlider,
236
+ {
237
+ value: volume,
238
+ muted: volumeMuted,
239
+ onChange: (nextVolume) => onParticipantVolumeChange?.(participant.id, nextVolume),
240
+ onMuteToggle: () => onParticipantVolumeChange?.(participant.id, volumeMuted ? 100 : 0),
241
+ size: variant === "mobile" ? "md" : "sm",
242
+ className: "w-48",
243
+ showValue: true
244
+ }
245
+ )
246
+ ] }) : null,
247
+ hasVolumeControl && hasManageActions ? /* @__PURE__ */ jsx2("div", { className: dividerClassName }) : null,
248
+ hasManageActions ? /* @__PURE__ */ jsxs2(Fragment, { children: [
249
+ !participant.isMuted && onMuteParticipant ? /* @__PURE__ */ jsxs2(
250
+ "button",
251
+ {
252
+ type: "button",
253
+ onClick: () => {
254
+ void runParticipantAction(() => onMuteParticipant(participant.id), onClose, onCommandError);
255
+ },
256
+ className: menuItemClassName,
257
+ children: [
258
+ /* @__PURE__ */ jsx2(MicrophoneOff01Icon, {}),
259
+ "Mute"
260
+ ]
261
+ }
262
+ ) : null,
263
+ participant.isMuted && onRequestUnmute ? /* @__PURE__ */ jsxs2(
264
+ "button",
265
+ {
266
+ type: "button",
267
+ onClick: () => {
268
+ void runParticipantAction(() => onRequestUnmute(participant.id), onClose, onCommandError);
269
+ },
270
+ className: menuItemClassName,
271
+ children: [
272
+ /* @__PURE__ */ jsx2(Microphone01Icon, {}),
273
+ "Ask to unmute"
274
+ ]
275
+ }
276
+ ) : null,
277
+ participant.isVideoEnabled && onStopParticipantCamera ? /* @__PURE__ */ jsxs2(
278
+ "button",
279
+ {
280
+ type: "button",
281
+ onClick: () => {
282
+ void runParticipantAction(() => onStopParticipantCamera(participant.id), onClose, onCommandError);
283
+ },
284
+ className: menuItemClassName,
285
+ children: [
286
+ /* @__PURE__ */ jsx2(VideoOffIcon, {}),
287
+ "Stop camera"
288
+ ]
289
+ }
290
+ ) : null,
291
+ !participant.isVideoEnabled && onRequestStartCamera ? /* @__PURE__ */ jsxs2(
292
+ "button",
293
+ {
294
+ type: "button",
295
+ onClick: () => {
296
+ void runParticipantAction(() => onRequestStartCamera(participant.id), onClose, onCommandError);
297
+ },
298
+ className: menuItemClassName,
299
+ children: [
300
+ /* @__PURE__ */ jsx2(Video01Icon, {}),
301
+ "Ask to start camera"
302
+ ]
303
+ }
304
+ ) : null,
305
+ participant.isScreenSharing && onStopParticipantScreenShare ? /* @__PURE__ */ jsxs2("button", { type: "button", className: menuItemClassName, onClick: () => void runParticipantAction(() => onStopParticipantScreenShare(participant.id), onClose, onCommandError), children: [
306
+ /* @__PURE__ */ jsx2(Monitor01Icon, {}),
307
+ "Stop screen share"
308
+ ] }) : null,
309
+ onAssignRole ? participant.eligibleRoles?.filter((role) => role !== participant.role).map((role) => /* @__PURE__ */ jsxs2("button", { type: "button", className: menuItemClassName, onClick: () => void runParticipantAction(() => onAssignRole(participant.id, role), onClose, onCommandError), children: [
310
+ /* @__PURE__ */ jsx2(Crown01Icon, {}),
311
+ /* @__PURE__ */ jsxs2("span", { children: [
312
+ "Make ",
313
+ /* @__PURE__ */ jsx2("bdi", { children: role })
314
+ ] })
315
+ ] }, role)) : null,
316
+ onRemoveParticipant ? /* @__PURE__ */ jsxs2(Fragment, { children: [
317
+ /* @__PURE__ */ jsx2("div", { className: dividerClassName }),
318
+ /* @__PURE__ */ jsxs2("button", { type: "button", onClick: () => setConfirmingRemove(true), className: cn(menuItemClassName, "is-danger"), children: [
319
+ /* @__PURE__ */ jsx2(UserRemove01Icon, {}),
320
+ "Remove"
321
+ ] })
322
+ ] }) : null
323
+ ] }) : null
324
+ ] })
325
+ );
326
+ }
327
+ export {
328
+ ParticipantOptionsMenu,
329
+ runParticipantAction
330
+ };
@@ -0,0 +1,12 @@
1
+ /** What a visitor picked on the pre-join step, kept per browser so the next visit is one click. */
2
+ export type RememberedDevices = {
3
+ readonly microphone: boolean;
4
+ readonly camera: boolean;
5
+ readonly microphoneDeviceId?: string;
6
+ readonly cameraDeviceId?: string;
7
+ readonly speakerDeviceId?: string;
8
+ };
9
+ export declare function readRememberedDevices(): RememberedDevices | null;
10
+ export declare function rememberDevices(devices: RememberedDevices): void;
11
+ /** Drops the remembered device ids the browser no longer lists, so an unplugged headset does not pin the next join to a device that is gone. */
12
+ export declare function listedRememberedDevices(devices: RememberedDevices): Promise<RememberedDevices>;
@@ -0,0 +1,47 @@
1
+ import type { JoinOptions } from "@q9labsai/chalk-client";
2
+ /**
3
+ * `checking` reads the browser's permission, `ask` waits for the visitor to turn devices on, `requesting` waits for the browser prompt,
4
+ * `blocked` means the browser refuses, and `granted` means the preview can run.
5
+ */
6
+ export type PreJoinAccess = "checking" | "ask" | "requesting" | "blocked" | "granted";
7
+ /** The device choice to hand to `client.join()`. Devices that are not live join off. */
8
+ export type PreJoinJoinOptions = Required<Pick<JoinOptions, "microphone" | "camera">> & Pick<JoinOptions, "microphoneDeviceId" | "cameraDeviceId" | "speakerDeviceId">;
9
+ export type PreJoinDevices = {
10
+ readonly access: PreJoinAccess;
11
+ /** Asks the browser for camera and microphone together and turns both on. Also the retry after `blocked`. */
12
+ readonly requestAccess: () => void;
13
+ readonly microphones: readonly MediaDeviceInfo[];
14
+ readonly cameras: readonly MediaDeviceInfo[];
15
+ readonly speakers: readonly MediaDeviceInfo[];
16
+ readonly microphoneId: string | undefined;
17
+ readonly cameraId: string | undefined;
18
+ readonly speakerId: string | undefined;
19
+ /** Live and wanted: what the visitor would join with. */
20
+ readonly microphoneOn: boolean;
21
+ readonly cameraOn: boolean;
22
+ /** Access is granted but the browser has no device, or could not open it. */
23
+ readonly microphoneMissing: boolean;
24
+ readonly cameraMissing: boolean;
25
+ readonly setMicrophoneOn: (on: boolean) => void;
26
+ readonly setCameraOn: (on: boolean) => void;
27
+ readonly selectMicrophone: (deviceId: string) => void;
28
+ readonly selectCamera: (deviceId: string) => void;
29
+ readonly selectSpeaker: (deviceId: string) => void;
30
+ readonly cameraTrack: MediaStreamTrack | null;
31
+ /** The microphone's loudness from 0 to 100. */
32
+ readonly microphoneLevel: number;
33
+ readonly mirrored: boolean;
34
+ /** Safari and iOS cannot pick an output, so the speaker row stays hidden there. */
35
+ readonly canChooseSpeaker: boolean;
36
+ readonly speakerTesting: boolean;
37
+ /** Plays the test tone through the chosen speaker. Never rejects: a tone the browser refuses leaves nothing for the visitor to fix. */
38
+ readonly testSpeaker: () => Promise<void>;
39
+ readonly joinOptions: PreJoinJoinOptions;
40
+ /** Remembers the choice, so the next visit can skip this step, and returns what to join with. */
41
+ readonly commit: () => PreJoinJoinOptions;
42
+ };
43
+ /**
44
+ * Owns the one preview stream shown before joining: it opens the camera and microphone the visitor wants, follows device changes,
45
+ * remembers the choice per browser, and stops every track when the component unmounts, so the camera light goes off.
46
+ */
47
+ export declare function usePreJoinDevices(): PreJoinDevices;
@@ -5,7 +5,7 @@ import * as bindings from "./index";
5
5
  type Assert<TCondition extends true> = TCondition;
6
6
  type Equal<TLeft, TRight> = (<T>() => T extends TLeft ? 1 : 2) extends <T>() => (T extends TRight ? 1 : 2) ? true : false;
7
7
  type PublicHooks = Extract<keyof typeof bindings, `use${string}`>;
8
- type ExpectedHooks = "useSpaceClient" | "useConnection" | "useSelf" | "useParticipants" | "useMedia" | "useScreenShare" | "useOffline" | "useChat" | "useReactions" | "useRecording" | "useWhiteboard" | "useCan";
8
+ type ExpectedHooks = "useSpaceClient" | "useConnection" | "useSelf" | "useParticipants" | "useMedia" | "useScreenShare" | "useOffline" | "useChat" | "useReactions" | "useRecording" | "useWhiteboard" | "useCan" | "usePreJoinDevices";
9
9
  type ExpectedLayout = "focus" | "grid";
10
10
  type ExpectedTokenKeys = "canvas" | "surface" | "raised" | "hover" | "pressed" | "tile" | "popover" | "line" | "lineStrong" | "text" | "textStrong" | "mutedText" | "softText" | "danger" | "dangerHover" | "dangerPressed" | "dangerText" | "positive" | "warning" | "accent" | "wash" | "washStrong" | "chrome" | "stage" | "accentText" | "dangerSurface" | "focus" | "shadow" | "overlay" | "overlayStrong" | "overlayHover" | "onOverlay" | "overlayWarning" | "overlayDanger" | "scrim";
11
11
  type ExpectedChalkProps = "shareUrl" | "onReportProblem" | "onOpenReportProblem" | "reportUnavailableReason" | "client" | "space" | "getAccess" | "defaults" | "displayName" | "features" | "theme" | "onColorSchemeChange" | "pickChatFiles" | "spaceName" | "layout" | "onLayoutChange" | "onRejoin" | "onHome" | "timeLimit" | "terminalState" | "inviteLink" | "onJoined" | "onLeft" | "onEpisodeEnded" | "onParticipantJoined" | "onParticipantLeft" | "onScreenShareStarted" | "onScreenShareStopped" | "onError";
@@ -5,10 +5,10 @@ export { createPreviewClient, createSnapshot } from "./preview-client";
5
5
  export { PREVIEW_DEVICE_FIXTURES, createPreviewMediaDevices } from "./preview-devices";
6
6
  export { CommandErrorAlert, PreviewSpaceView } from "./preview-fixtures";
7
7
  export type { Participant } from "../components/participant-grid/ParticipantGrid";
8
- export type { ReconnectingOverlayProps } from "../components/reconnecting-overlay/ReconnectingOverlay";
9
8
  export type { SpaceViewFeatures, SpaceViewWhiteboard } from "../components/space-view/SpaceView";
10
9
  export type { Toast } from "../components/toast-stack/ToastStack";
11
10
  export type { WhiteboardViewProps } from "../components/whiteboard-view/WhiteboardView";
12
11
  export type { PreviewClientCommand } from "./preview-client";
13
12
  export type { PreviewMediaDevices } from "./preview-devices";
14
13
  export type { SpaceLayout, SpacePanel } from "./preview-fixtures";
14
+ export { DevicePopover as PreviewDevicePopover } from "../components/device-popover/DevicePopover";
@@ -1,14 +1,28 @@
1
1
  "use client";
2
2
  import {
3
- ChalkProvider,
4
3
  CommandErrorAlert,
4
+ DevicePopover,
5
5
  MediaRequestDialog,
6
6
  SpaceView,
7
7
  ToastStack,
8
8
  WhiteboardView
9
- } from "../chunk-LYZ7EBFF.js";
9
+ } from "../chunk-F6QZY5SM.js";
10
+ import "../chunk-CQBYFA2W.js";
11
+ import "../chunk-26PBFST5.js";
12
+ import "../chunk-ALGD3RBI.js";
13
+ import {
14
+ ChalkProvider
15
+ } from "../chunk-YOWY22N7.js";
16
+ import "../chunk-SBGC5DKV.js";
10
17
  import "../chunk-ES7AECAD.js";
11
- import "../chunk-4U7QZC72.js";
18
+ import "../chunk-SZNV3J4B.js";
19
+ import "../chunk-JDCFKSGV.js";
20
+ import "../chunk-TSBY6C5U.js";
21
+ import "../chunk-E6HPIMFO.js";
22
+ import "../chunk-PMGIER77.js";
23
+ import "../chunk-PH3RC6T6.js";
24
+ import "../chunk-I6FSUWKG.js";
25
+ import "../chunk-ADIDI7AJ.js";
12
26
 
13
27
  // src/test-support/preview-devices.ts
14
28
  var PREVIEW_DEVICE_FIXTURES = Object.freeze({
@@ -25,17 +39,20 @@ function createPreviewMediaDevices() {
25
39
  }
26
40
 
27
41
  // src/test-support/preview-client.ts
28
- import { createSpaceClient } from "@q9labsai/chalk-client";
42
+ import { callEvents, createSpaceClient } from "@q9labsai/chalk-client";
29
43
  function createPreviewClient(initialSnapshot = createSnapshot(), options = {}) {
30
44
  let snapshot = initialSnapshot;
31
45
  let requestSequence = 0;
32
46
  let attachmentSequence = 0;
33
47
  let recordingSequence = 0;
34
48
  const listeners = /* @__PURE__ */ new Set();
49
+ const callEventHandlers = /* @__PURE__ */ new Set();
35
50
  let cameraPreviewClient;
36
51
  const setSnapshot = (nextSnapshot) => {
52
+ const previous = snapshot;
37
53
  snapshot = nextSnapshot;
38
54
  for (const listener of listeners) listener();
55
+ for (const event of callEvents(previous, nextSnapshot)) for (const handler of callEventHandlers) handler({ event });
39
56
  };
40
57
  const updateSnapshot = (update) => setSnapshot(update(snapshot));
41
58
  const dispatch = async (command) => {
@@ -43,8 +60,16 @@ function createPreviewClient(initialSnapshot = createSnapshot(), options = {}) {
43
60
  setSnapshot(nextSnapshot);
44
61
  options.onCommand?.(command, nextSnapshot);
45
62
  };
63
+ const dispose = () => {
64
+ cameraPreviewClient?.dispose();
65
+ listeners.clear();
66
+ callEventHandlers.clear();
67
+ };
46
68
  const client = {
47
69
  media: {
70
+ observeAudioElement: () => ({ played: () => {
71
+ }, detach: () => {
72
+ } }),
48
73
  captureCameraPreview: async () => {
49
74
  const current = snapshot.media.local.camera.track;
50
75
  if (snapshot.media.local.camera.state === "enabled" && current?.enabled && current.readyState === "live") return { track: current, release: () => {
@@ -136,12 +161,11 @@ function createPreviewClient(initialSnapshot = createSnapshot(), options = {}) {
136
161
  setPolicy: async (policy) => updateSnapshot((current) => ({ ...current, offline: { ...current.offline, policy } }))
137
162
  },
138
163
  whiteboard: { transport: () => null },
164
+ telemetry: { sessionId: "", problemReported: () => void 0, renderCrashed: () => void 0 },
139
165
  join: () => dispatch({ type: "join" }),
140
166
  leave: () => dispatch({ type: "leave" }),
141
- dispose: () => {
142
- cameraPreviewClient?.dispose();
143
- listeners.clear();
144
- },
167
+ close: async () => dispose(),
168
+ dispose,
145
169
  subscribe: (listener) => {
146
170
  listeners.add(listener);
147
171
  return () => listeners.delete(listener);
@@ -149,13 +173,19 @@ function createPreviewClient(initialSnapshot = createSnapshot(), options = {}) {
149
173
  getSnapshot: () => snapshot,
150
174
  endEpisode: () => dispatch({ type: "endEpisode" }),
151
175
  extendEpisode: (minutes) => dispatch({ type: "extendEpisode", minutes }),
152
- on: (_event, _handler) => () => void 0
176
+ // Only call events are real: a preview announces what a snapshot change would announce in a live call.
177
+ on: (event, handler) => {
178
+ if (event !== "callEvent") return () => void 0;
179
+ const callEventHandler = handler;
180
+ callEventHandlers.add(callEventHandler);
181
+ return () => callEventHandlers.delete(callEventHandler);
182
+ }
153
183
  };
154
184
  return Object.assign(client, { setSnapshot, updateSnapshot, dispatch });
155
185
  }
156
186
  function createSnapshot(capabilities = ["sendChat"]) {
157
187
  return {
158
- connection: { status: "idle", episode: null, lastError: null, episodeEnded: false, removedByHost: false },
188
+ connection: { status: "idle", episode: null, lastError: null, episodeEnded: false, removedByHost: false, timedOut: false },
159
189
  self: { participantId: null, displayName: null, role: null, capabilities, handRaised: false, can: (capability) => capabilities.includes(capability) },
160
190
  participants: { roster: [], admissionQueue: [] },
161
191
  media: {
@@ -355,6 +385,7 @@ export {
355
385
  CommandErrorAlert,
356
386
  MediaRequestDialog,
357
387
  PREVIEW_DEVICE_FIXTURES,
388
+ DevicePopover as PreviewDevicePopover,
358
389
  PreviewSpaceView,
359
390
  ToastStack,
360
391
  WhiteboardView,
package/dist/theme.d.ts CHANGED
@@ -37,13 +37,13 @@ export declare const LIGHT_CHALK_THEME_TOKENS: {
37
37
  readonly scrim: "rgba(0,0,0,0.55)";
38
38
  };
39
39
  export declare const DARK_CHALK_THEME_TOKENS: {
40
- readonly canvas: "#0b0c0e";
41
- readonly surface: "#151619";
42
- readonly raised: "#1d1f23";
43
- readonly hover: "#272a2f";
44
- readonly pressed: "#30333a";
45
- readonly line: "rgba(255,255,255,.08)";
46
- readonly lineStrong: "rgba(255,255,255,.14)";
40
+ readonly canvas: "#000000";
41
+ readonly surface: "#060606";
42
+ readonly raised: "#0c0c0c";
43
+ readonly hover: "#161616";
44
+ readonly pressed: "#1f1f1f";
45
+ readonly line: "rgba(255,255,255,0.045)";
46
+ readonly lineStrong: "rgba(255,255,255,0.08)";
47
47
  readonly text: "#ececee";
48
48
  readonly mutedText: "#9a9ca3";
49
49
  readonly danger: "#e5484d";
@@ -53,34 +53,34 @@ export declare const DARK_CHALK_THEME_TOKENS: {
53
53
  readonly positive: "#80b879";
54
54
  readonly warning: "#d9b641";
55
55
  readonly accent: "#55aac9";
56
- readonly tile: "#151619";
57
- readonly popover: "#1d1f23";
56
+ readonly tile: "#060606";
57
+ readonly popover: "#0c0c0c";
58
58
  readonly textStrong: "#fff";
59
59
  readonly softText: "#c4c6cc";
60
60
  readonly wash: "rgba(255,255,255,.05)";
61
61
  readonly washStrong: "rgba(255,255,255,.08)";
62
- readonly chrome: "#0b0c0e";
63
- readonly stage: "#0b0c0e";
64
- readonly accentText: "#0b0c0e";
65
- readonly dangerSurface: "#1d1f23";
62
+ readonly chrome: "#000000";
63
+ readonly stage: "#000000";
64
+ readonly accentText: "#000000";
65
+ readonly dangerSurface: "#0c0c0c";
66
66
  readonly focus: "#ececee";
67
67
  readonly shadow: "0 12px 32px rgba(0,0,0,0.5)";
68
- readonly overlay: "rgba(12,14,18,0.75)";
69
- readonly overlayStrong: "rgba(12,14,18,0.82)";
70
- readonly overlayHover: "rgba(40,42,48,0.95)";
68
+ readonly overlay: "rgba(0,0,0,0.75)";
69
+ readonly overlayStrong: "rgba(0,0,0,0.82)";
70
+ readonly overlayHover: "rgba(34,34,34,0.95)";
71
71
  readonly onOverlay: "#ffffff";
72
72
  readonly overlayWarning: "#e2bd3a";
73
73
  readonly overlayDanger: "#ff6b6b";
74
74
  readonly scrim: "rgba(0,0,0,0.55)";
75
75
  };
76
76
  export declare const CHALK_THEME_TOKENS: {
77
- readonly canvas: "#0b0c0e";
78
- readonly surface: "#151619";
79
- readonly raised: "#1d1f23";
80
- readonly hover: "#272a2f";
81
- readonly pressed: "#30333a";
82
- readonly line: "rgba(255,255,255,.08)";
83
- readonly lineStrong: "rgba(255,255,255,.14)";
77
+ readonly canvas: "#000000";
78
+ readonly surface: "#060606";
79
+ readonly raised: "#0c0c0c";
80
+ readonly hover: "#161616";
81
+ readonly pressed: "#1f1f1f";
82
+ readonly line: "rgba(255,255,255,0.045)";
83
+ readonly lineStrong: "rgba(255,255,255,0.08)";
84
84
  readonly text: "#ececee";
85
85
  readonly mutedText: "#9a9ca3";
86
86
  readonly danger: "#e5484d";
@@ -90,21 +90,21 @@ export declare const CHALK_THEME_TOKENS: {
90
90
  readonly positive: "#80b879";
91
91
  readonly warning: "#d9b641";
92
92
  readonly accent: "#55aac9";
93
- readonly tile: "#151619";
94
- readonly popover: "#1d1f23";
93
+ readonly tile: "#060606";
94
+ readonly popover: "#0c0c0c";
95
95
  readonly textStrong: "#fff";
96
96
  readonly softText: "#c4c6cc";
97
97
  readonly wash: "rgba(255,255,255,.05)";
98
98
  readonly washStrong: "rgba(255,255,255,.08)";
99
- readonly chrome: "#0b0c0e";
100
- readonly stage: "#0b0c0e";
101
- readonly accentText: "#0b0c0e";
102
- readonly dangerSurface: "#1d1f23";
99
+ readonly chrome: "#000000";
100
+ readonly stage: "#000000";
101
+ readonly accentText: "#000000";
102
+ readonly dangerSurface: "#0c0c0c";
103
103
  readonly focus: "#ececee";
104
104
  readonly shadow: "0 12px 32px rgba(0,0,0,0.5)";
105
- readonly overlay: "rgba(12,14,18,0.75)";
106
- readonly overlayStrong: "rgba(12,14,18,0.82)";
107
- readonly overlayHover: "rgba(40,42,48,0.95)";
105
+ readonly overlay: "rgba(0,0,0,0.75)";
106
+ readonly overlayStrong: "rgba(0,0,0,0.82)";
107
+ readonly overlayHover: "rgba(34,34,34,0.95)";
108
108
  readonly onOverlay: "#ffffff";
109
109
  readonly overlayWarning: "#e2bd3a";
110
110
  readonly overlayDanger: "#ff6b6b";
@@ -0,0 +1 @@
1
+ export { ChalkToast, type ChalkToastProps } from "./components/chalk-ui/ChalkToast";
package/dist/toast.js ADDED
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import {
3
+ ChalkToast
4
+ } from "./chunk-I6FSUWKG.js";
5
+ export {
6
+ ChalkToast
7
+ };
@@ -0,0 +1,2 @@
1
+ /** Clock time in the viewer's time zone, with AM/PM in every locale. */
2
+ export declare function formatClockTime(iso: string): string;
@@ -2,3 +2,4 @@ export * from "./cn";
2
2
  export * from "./colorGenerator";
3
3
  export * from "./icons";
4
4
  export * from "./theme";
5
+ export { formatClockTime } from "./formatClockTime";