@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,92 @@
1
+ // src/components/control-bar/ShellIcon.tsx
2
+ import { useId } from "react";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ var GLYPHS = {
5
+ flip: /* @__PURE__ */ jsxs(Fragment, { children: [
6
+ /* @__PURE__ */ jsx("path", { d: "M3 8h3l2-3h8l2 3h3v12H3z" }),
7
+ /* @__PURE__ */ jsx("path", { d: "M8 14a4 4 0 0 1 7-2l1 1M16 10v3h-3M16 15a4 4 0 0 1-7 2l-1-1M8 19v-3h3" })
8
+ ] }),
9
+ hang: /* @__PURE__ */ jsx(
10
+ "path",
11
+ {
12
+ fill: "currentColor",
13
+ stroke: "none",
14
+ transform: "translate(12 12.4) scale(1.12) translate(-12 -12.4)",
15
+ d: "M12 9c3.6 0 6.9 1.3 9.1 3.4.6.6.6 1.5.1 2.1l-1.3 1.5c-.5.6-1.4.7-2 .3l-2-1.3c-.5-.3-.7-.8-.7-1.4v-1.5a12 12 0 0 0-6.4 0v1.5c0 .6-.2 1.1-.7 1.4l-2 1.3c-.6.4-1.5.3-2-.3l-1.3-1.5c-.5-.6-.5-1.5.1-2.1C5.1 10.3 8.4 9 12 9z"
16
+ }
17
+ ),
18
+ down: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("path", { d: "M6 9l6 6 6-6" }) }),
19
+ up2: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("path", { d: "M18 15l-6-6-6 6" }) }),
20
+ right: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("path", { d: "M9 18l6-6-6-6" }) }),
21
+ grid: /* @__PURE__ */ jsxs(Fragment, { children: [
22
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "3", width: "7.5", height: "7.5", rx: "1.5" }),
23
+ /* @__PURE__ */ jsx("rect", { x: "13.5", y: "3", width: "7.5", height: "7.5", rx: "1.5" }),
24
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "13.5", width: "7.5", height: "7.5", rx: "1.5" }),
25
+ /* @__PURE__ */ jsx("rect", { x: "13.5", y: "13.5", width: "7.5", height: "7.5", rx: "1.5" })
26
+ ] }),
27
+ spot: /* @__PURE__ */ jsxs(Fragment, { children: [
28
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "3", width: "18", height: "12.5", rx: "2" }),
29
+ /* @__PURE__ */ jsx("path", { d: "M4 20.5h3M10.5 20.5h3M17 20.5h3" })
30
+ ] }),
31
+ smile: /* @__PURE__ */ jsxs(Fragment, { children: [
32
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9" }),
33
+ /* @__PURE__ */ jsx("path", { d: "M8.5 14.5s1.3 1.8 3.5 1.8 3.5-1.8 3.5-1.8M9 9.5h.01M15 9.5h.01" })
34
+ ] }),
35
+ hand: /* @__PURE__ */ jsxs(Fragment, { children: [
36
+ /* @__PURE__ */ jsx("path", { d: "M18 11V6a2 2 0 0 0-4 0v5M14 10V4a2 2 0 0 0-4 0v6M10 10.5V6a2 2 0 0 0-4 0v8" }),
37
+ /* @__PURE__ */ jsx("path", { d: "M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.9-6-2.3l-3.6-3.6a2 2 0 0 1 2.8-2.8L7 15" })
38
+ ] }),
39
+ pen: /* @__PURE__ */ jsxs(Fragment, { children: [
40
+ /* @__PURE__ */ jsx("path", { d: "M17 3a2.85 2.85 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5z" }),
41
+ /* @__PURE__ */ jsx("path", { d: "M15 5l4 4" })
42
+ ] }),
43
+ rec: /* @__PURE__ */ jsxs(Fragment, { children: [
44
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9" }),
45
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3.5", fill: "currentColor" })
46
+ ] }),
47
+ chat: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22z" }) }),
48
+ users: /* @__PURE__ */ jsxs(Fragment, { children: [
49
+ /* @__PURE__ */ jsx("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }),
50
+ /* @__PURE__ */ jsx("circle", { cx: "9", cy: "7", r: "4" }),
51
+ /* @__PURE__ */ jsx("path", { d: "M22 21v-2a4 4 0 0 0-3-3.9M16 3.1a4 4 0 0 1 0 7.8" })
52
+ ] }),
53
+ share: /* @__PURE__ */ jsxs(Fragment, { children: [
54
+ /* @__PURE__ */ jsx("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
55
+ /* @__PURE__ */ jsx("path", { d: "M8 21h8M12 17v4M9 10l3-3 3 3M12 7v6" })
56
+ ] }),
57
+ shareOff: /* @__PURE__ */ jsxs(Fragment, { children: [
58
+ /* @__PURE__ */ jsx("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
59
+ /* @__PURE__ */ jsx("path", { d: "M8 21h8M12 17v4M9.5 7.5l5 5M14.5 7.5l-5 5" })
60
+ ] })
61
+ };
62
+ var MEDIA_BODY = {
63
+ mic: (p) => /* @__PURE__ */ jsxs(Fragment, { children: [
64
+ /* @__PURE__ */ jsx("rect", { x: "9", y: "2", width: "6", height: "12", rx: "3", ...p }),
65
+ /* @__PURE__ */ jsx("path", { d: "M19 10v1a7 7 0 0 1-14 0v-1M12 18v4", ...p })
66
+ ] }),
67
+ cam: (p) => /* @__PURE__ */ jsxs(Fragment, { children: [
68
+ /* @__PURE__ */ jsx("path", { d: "M16 10.5l5-3v9l-5-3z", ...p }),
69
+ /* @__PURE__ */ jsx("rect", { x: "2", y: "6", width: "14", height: "12", rx: "2", ...p })
70
+ ] })
71
+ };
72
+ function MediaGlyph({ kind, slashed, busy }) {
73
+ const cut = useId();
74
+ const body = MEDIA_BODY[kind];
75
+ return /* @__PURE__ */ jsxs("svg", { width: 20, height: 20, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", className: "chalk-shell-media", "data-slashed": slashed, "data-busy": busy, "aria-hidden": "true", children: [
76
+ /* @__PURE__ */ jsxs("mask", { id: cut, maskUnits: "userSpaceOnUse", x: "0", y: "0", width: "24", height: "24", children: [
77
+ /* @__PURE__ */ jsx("rect", { width: "24", height: "24", fill: "white", stroke: "none" }),
78
+ /* @__PURE__ */ jsx("path", { className: "chalk-shell-media-cut", d: "M3 3l18 18", pathLength: 1, stroke: "black", strokeWidth: "5" })
79
+ ] }),
80
+ /* @__PURE__ */ jsx("g", { className: "chalk-shell-media-body", mask: `url(#${cut})`, children: body({}) }),
81
+ /* @__PURE__ */ jsx("g", { className: "chalk-shell-media-trace", mask: `url(#${cut})`, children: body({ pathLength: 1 }) }),
82
+ /* @__PURE__ */ jsx("path", { className: "chalk-shell-media-slash", d: "M3 3l18 18", pathLength: 1 })
83
+ ] });
84
+ }
85
+ function ShellIcon({ name, size = 20, className }) {
86
+ return /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", className, "aria-hidden": "true", children: GLYPHS[name] });
87
+ }
88
+
89
+ export {
90
+ MediaGlyph,
91
+ ShellIcon
92
+ };
@@ -0,0 +1,363 @@
1
+ // src/components/device-access/DeviceAccessStyles.tsx
2
+ import { jsx } from "react/jsx-runtime";
3
+ function DeviceAccessStyles() {
4
+ return /* @__PURE__ */ jsx("style", { href: "chalk-device-access", precedence: "default", children: DEVICE_ACCESS_CSS });
5
+ }
6
+ var DEVICE_ACCESS_CSS = `
7
+ .chalk-shell-split[data-blocked],
8
+ .chalk-shell-split[data-blocked][data-off="true"] {
9
+ outline: 1px solid var(--chalk-danger);
10
+ outline-offset: -1px;
11
+ }
12
+ .chalk-shell-split[data-blocked]:has(button:focus-visible) {
13
+ outline: 2px solid var(--chalk-focus);
14
+ outline-offset: 3px;
15
+ }
16
+ .chalk-shell-split[data-blocked] .chalk-shell-main {
17
+ color: var(--chalk-danger-text);
18
+ }
19
+ .chalk-access-badge {
20
+ position: absolute;
21
+ top: -2px;
22
+ inset-inline-start: 34px;
23
+ width: 14px;
24
+ height: 14px;
25
+ border-radius: 50%;
26
+ background: var(--chalk-danger);
27
+ color: var(--chalk-on-overlay);
28
+ font-size: var(--type-micro);
29
+ font-weight: 700;
30
+ line-height: 14px;
31
+ text-align: center;
32
+ box-shadow: var(--elevation-halo-canvas);
33
+ pointer-events: none;
34
+ }
35
+ .chalk-access-positioner {
36
+ z-index: 40;
37
+ }
38
+ .chalk-access-card {
39
+ position: relative;
40
+ width: 320px;
41
+ max-width: 100%;
42
+ padding: var(--space-2);
43
+ border-radius: var(--corner-3xl);
44
+ border: 1px solid var(--chalk-line-strong);
45
+ background: var(--chalk-popover);
46
+ color: var(--chalk-text);
47
+ box-shadow: var(--chalk-shadow);
48
+ display: grid;
49
+ grid-template-columns: minmax(0, 1fr);
50
+ gap: var(--space-2);
51
+ font-family: var(--chalk-font-family);
52
+ }
53
+ .chalk-access-card:focus-visible { outline: none; }
54
+ .chalk-access-arrow {
55
+ width: 12px;
56
+ height: 12px;
57
+ background: var(--chalk-popover);
58
+ border-inline-end: 1px solid var(--chalk-line-strong);
59
+ border-bottom: 1px solid var(--chalk-line-strong);
60
+ translate: -50% 0;
61
+ transform: rotate(45deg);
62
+ }
63
+ .chalk-access-arrow[data-side="top"] { bottom: -7px; }
64
+ .chalk-access-arrow[data-side="bottom"] { top: -7px; transform: rotate(225deg); }
65
+ .chalk-access-sheet-body {
66
+ display: grid;
67
+ gap: var(--space-2);
68
+ padding: var(--space-2) var(--space-3) var(--space-6);
69
+ }
70
+ .chalk-access-head {
71
+ display: grid;
72
+ grid-template-columns: 40px 1fr 32px;
73
+ gap: var(--space-3);
74
+ align-items: start;
75
+ padding: var(--space-2) var(--space-1) 0 var(--space-2);
76
+ }
77
+ .chalk-access-glyph {
78
+ width: 40px;
79
+ height: 40px;
80
+ border-radius: 50%;
81
+ display: grid;
82
+ place-items: center;
83
+ background: var(--chalk-hover);
84
+ }
85
+ .chalk-access-glyph[data-danger] { color: var(--chalk-danger-text); }
86
+ .chalk-access-head h3 { font-size: var(--type-body-lg); font-weight: 600; line-height: 1.3; padding-top: 1px; margin: 0; }
87
+ .chalk-access-head p { font-size: var(--type-body-sm); color: var(--chalk-muted-text); margin: var(--space-0-5) 0 0; line-height: 1.4; }
88
+ .chalk-access-close {
89
+ width: 32px;
90
+ height: 32px;
91
+ border-radius: 50%;
92
+ display: grid;
93
+ place-items: center;
94
+ color: var(--chalk-muted-text);
95
+ margin-block-start: calc(var(--space-1) * -1);
96
+ }
97
+ .chalk-access-close svg { width: 18px; height: 18px; }
98
+ .chalk-access-close:hover { background: var(--chalk-hover); }
99
+ .chalk-access-actions { display: flex; gap: var(--space-2); }
100
+ .chalk-access-actions > * {
101
+ flex: 1;
102
+ height: 40px;
103
+ border-radius: var(--corner-pill);
104
+ font-weight: 600;
105
+ font-size: var(--type-body);
106
+ display: grid;
107
+ place-items: center;
108
+ text-decoration: none;
109
+ cursor: pointer;
110
+ }
111
+ .chalk-access-primary { background: var(--chalk-text); color: var(--chalk-canvas); }
112
+ .chalk-access-secondary { background: var(--chalk-hover); color: var(--chalk-text); }
113
+ .chalk-access-actions > *:focus-visible { outline: 2px solid var(--chalk-focus); outline-offset: 2px; }
114
+ .chalk-access-ill {
115
+ border-radius: var(--corner-2xl);
116
+ background: var(--chalk-hover);
117
+ padding: var(--space-3);
118
+ display: grid;
119
+ gap: var(--space-2);
120
+ grid-template-columns: minmax(0, 1fr);
121
+ }
122
+ .chalk-access-ill svg { width: 16px; height: 16px; flex: none; }
123
+ .chalk-access-bar {
124
+ display: flex;
125
+ align-items: center;
126
+ gap: var(--space-2);
127
+ height: 32px;
128
+ padding: 0 var(--space-2);
129
+ border-radius: var(--corner-pill);
130
+ background: var(--chalk-popover);
131
+ border: 1px solid var(--chalk-line-strong);
132
+ font-size: var(--type-caption);
133
+ color: var(--chalk-muted-text);
134
+ }
135
+ .chalk-access-bar .icon { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: var(--chalk-text); flex: none; }
136
+ .chalk-access-bar .icon[data-hit] { outline: 2px solid var(--chalk-accent); }
137
+ .chalk-access-bar .icon[data-off] { color: var(--chalk-danger-text); }
138
+ .chalk-access-bar .icon svg { width: 14px; height: 14px; }
139
+ .chalk-access-bar .grow, .chalk-access-menu .grow { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
140
+ .chalk-access-menu {
141
+ margin-inline-start: var(--space-4);
142
+ border-radius: var(--corner-xl);
143
+ background: var(--chalk-popover);
144
+ border: 1px solid var(--chalk-line-strong);
145
+ padding: var(--space-1);
146
+ display: grid;
147
+ grid-template-columns: minmax(0, 1fr);
148
+ gap: var(--space-0-5);
149
+ font-size: var(--type-body-sm);
150
+ }
151
+ .chalk-access-menu[data-flush] { margin-inline-start: 0; }
152
+ .chalk-access-row { display: flex; align-items: center; gap: var(--space-2); min-height: 34px; padding: var(--space-1) var(--space-2); border-radius: var(--corner-lg); }
153
+ .chalk-access-row .grow { min-width: 0; white-space: normal; overflow: visible; }
154
+ .chalk-access-row[data-hit] { background: var(--chalk-hover); }
155
+ .chalk-access-row .value { color: var(--chalk-muted-text); display: inline-flex; align-items: center; gap: var(--space-1); }
156
+ .chalk-access-row .value svg { width: 14px; height: 14px; }
157
+ .chalk-access-row img { width: 18px; height: 18px; display: block; }
158
+ .chalk-access-path { font-size: var(--type-caption); color: var(--chalk-muted-text); padding: var(--space-1) var(--space-2) 0; }
159
+ .chalk-access-switch { width: 32px; height: 20px; border-radius: var(--corner-pill); background: var(--chalk-pressed); position: relative; flex: none; }
160
+ .chalk-access-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--chalk-on-overlay); }
161
+ .chalk-access-step {
162
+ width: 18px;
163
+ height: 18px;
164
+ border-radius: 50%;
165
+ background: var(--chalk-accent);
166
+ color: var(--chalk-accent-text);
167
+ font-size: var(--type-micro);
168
+ font-weight: 700;
169
+ display: grid;
170
+ place-items: center;
171
+ flex: none;
172
+ }
173
+ .chalk-access-menubar { display: flex; align-items: center; gap: var(--space-3); font-size: var(--type-caption); padding: 0 var(--space-2); color: var(--chalk-muted-text); }
174
+ .chalk-access-menubar b { color: var(--chalk-text); font-weight: 700; border-radius: var(--corner-sm); padding: 0 var(--space-1); outline: 2px solid var(--chalk-accent); }
175
+ .chalk-access-menubar .chalk-access-step { margin-inline-start: auto; }
176
+ .chalk-access-dim { position: fixed; inset: 0; z-index: 30; background: var(--chalk-canvas); opacity: 0.45; pointer-events: none; }
177
+ .chalk-access-coach {
178
+ position: fixed;
179
+ inset-inline-start: var(--space-8);
180
+ top: 112px;
181
+ z-index: 31;
182
+ display: inline-flex;
183
+ align-items: center;
184
+ gap: var(--space-2);
185
+ height: 36px;
186
+ padding: 0 var(--space-4) 0 var(--space-3);
187
+ border-radius: var(--corner-pill);
188
+ background: var(--chalk-text);
189
+ color: var(--chalk-canvas);
190
+ font-weight: 600;
191
+ font-size: var(--type-body-sm);
192
+ pointer-events: none;
193
+ }
194
+ .chalk-access-coach::before {
195
+ content: "";
196
+ position: absolute;
197
+ top: -5px;
198
+ inset-inline-start: 22px;
199
+ width: 10px;
200
+ height: 10px;
201
+ transform: rotate(45deg);
202
+ background: var(--chalk-text);
203
+ }
204
+ @media (max-width: 640px) {
205
+ .chalk-access-dim, .chalk-access-coach { display: none; }
206
+ .chalk-access-actions > * { height: 48px; }
207
+ }
208
+ @media (prefers-reduced-motion: reduce) {
209
+ .chalk-access-card { transition: none; }
210
+ }
211
+ `;
212
+
213
+ // src/components/device-access/card-copy.ts
214
+ var DEVICE_NAMES = { microphone: "Microphone", camera: "Camera", screen: "Screen sharing" };
215
+ var BROWSER_NAMES = { chrome: "Chrome", edge: "Edge", safari: "Safari", firefox: "Firefox" };
216
+ function systemSettingsLink(device, platform) {
217
+ if (platform === "windows") return device === "microphone" ? "ms-settings:privacy-microphone" : device === "camera" ? "ms-settings:privacy-webcam" : null;
218
+ const pane = device === "microphone" ? "Privacy_Microphone" : device === "camera" ? "Privacy_Camera" : "Privacy_ScreenCapture";
219
+ return `x-apple.systempreferences:com.apple.preference.security?${pane}`;
220
+ }
221
+ function cardCopy(device, reason) {
222
+ const name = DEVICE_NAMES[device];
223
+ switch (reason.kind) {
224
+ case "blocked-browser":
225
+ return { title: `${name} is blocked`, detail: `Allow it for this site in ${BROWSER_NAMES[reason.browser]}.`, danger: true };
226
+ case "blocked-system": {
227
+ const app = BROWSER_NAMES[reason.browser];
228
+ const where = reason.platform === "mac" ? "System Settings" : "Settings";
229
+ return { title: `Blocked by ${reason.platform === "mac" ? "macOS" : "Windows"}`, detail: device === "screen" ? `Turn on ${app}, then reopen it.` : `Turn on ${app} in ${where}.`, danger: true };
230
+ }
231
+ case "busy":
232
+ return { title: `${name} in use`, detail: "Another app has it. Close it there, then try again.", danger: true };
233
+ case "missing":
234
+ return { title: `No ${name.toLowerCase()} found`, detail: "Connect one and Chalk switches to it.", danger: false };
235
+ }
236
+ }
237
+ function accessTooltip(device, reason) {
238
+ const name = DEVICE_NAMES[device];
239
+ if (reason.kind === "busy") return `${name} is in use. Click to fix.`;
240
+ if (reason.kind === "missing") return `No ${name.toLowerCase()} found. Click for details.`;
241
+ return `${name} is blocked. Click to fix.`;
242
+ }
243
+
244
+ // src/components/device-access/resolve.ts
245
+ function browserPorts() {
246
+ return {
247
+ get permissions() {
248
+ return navigator.permissions;
249
+ },
250
+ get mediaDevices() {
251
+ return navigator.mediaDevices;
252
+ },
253
+ get window() {
254
+ return window;
255
+ },
256
+ get userAgent() {
257
+ return navigator.userAgent;
258
+ }
259
+ };
260
+ }
261
+ function answerOf(state) {
262
+ return state === "prompt" || state === "granted" || state === "denied" ? state : "unknown";
263
+ }
264
+ function watchPermission(ports, device, onAnswer) {
265
+ let stopped = false;
266
+ let release = () => {
267
+ };
268
+ void ports.permissions?.query({ name: device }).then(
269
+ (status) => {
270
+ if (stopped) return;
271
+ const changed = () => onAnswer(answerOf(status.state));
272
+ status.addEventListener("change", changed);
273
+ release = () => status.removeEventListener("change", changed);
274
+ changed();
275
+ },
276
+ () => void 0
277
+ );
278
+ return () => {
279
+ stopped = true;
280
+ release();
281
+ };
282
+ }
283
+ async function readPermission(ports, device) {
284
+ if (!ports.permissions) return "unknown";
285
+ try {
286
+ return answerOf((await ports.permissions.query({ name: device })).state);
287
+ } catch {
288
+ return "unknown";
289
+ }
290
+ }
291
+ function deviceAccessReason(failure, device, environment) {
292
+ if (failure.code === "media.device_busy") return { kind: "busy" };
293
+ if (failure.code === "media.device_not_found") return { kind: "missing" };
294
+ const system = failure.permissionBlock === "system" || device !== "screen" && environment.permission === "granted";
295
+ if (device === "screen") return system && environment.platform === "mac" ? { kind: "blocked-system", platform: "mac", browser: environment.browser } : null;
296
+ if (system && environment.platform !== "other") return { kind: "blocked-system", platform: environment.platform, browser: environment.browser };
297
+ return { kind: "blocked-browser", browser: environment.browser };
298
+ }
299
+ function detectBrowser(userAgent) {
300
+ if (/Firefox\/|FxiOS\//.test(userAgent)) return "firefox";
301
+ if (/Edg(?:e|A|iOS)?\//.test(userAgent)) return "edge";
302
+ if (/Safari\//.test(userAgent) && !/Chrome\/|Chromium\/|CriOS\//.test(userAgent)) return "safari";
303
+ return "chrome";
304
+ }
305
+ function detectPlatform(userAgent) {
306
+ if (/iPhone|iPad|iPod|Android/.test(userAgent)) return "other";
307
+ if (/Macintosh|Mac OS X/.test(userAgent)) return "mac";
308
+ if (/Windows/.test(userAgent)) return "windows";
309
+ return "other";
310
+ }
311
+ var KIND_OF = { microphone: "audioinput", camera: "videoinput" };
312
+ var lastLook = {};
313
+ var LOOK_WINDOW_MS = 1e4;
314
+ function watchRecovery(ports, device, reason, observed, recovered) {
315
+ if (device === "screen") return () => {
316
+ };
317
+ if (reason.kind === "blocked-browser") {
318
+ let before = observed;
319
+ return watchPermission(ports, device, (answer) => {
320
+ if (answer === "granted" && before !== "granted") recovered();
321
+ before = answer;
322
+ });
323
+ }
324
+ if (reason.kind === "blocked-system") {
325
+ ports.window.addEventListener("focus", recovered);
326
+ return () => ports.window.removeEventListener("focus", recovered);
327
+ }
328
+ if (reason.kind !== "missing" || !ports.mediaDevices) return () => {
329
+ };
330
+ const mediaDevices = ports.mediaDevices;
331
+ let stopped = false;
332
+ const changed = () => void mediaDevices.enumerateDevices().then(
333
+ (devices) => {
334
+ if (!stopped && devices.some((entry) => entry.kind === KIND_OF[device])) recovered();
335
+ },
336
+ () => void 0
337
+ );
338
+ mediaDevices.addEventListener("devicechange", changed);
339
+ if (Date.now() - (lastLook[device] ?? 0) > LOOK_WINDOW_MS) {
340
+ lastLook[device] = Date.now();
341
+ changed();
342
+ }
343
+ return () => {
344
+ stopped = true;
345
+ mediaDevices.removeEventListener("devicechange", changed);
346
+ };
347
+ }
348
+ async function resolveAccess(given, device, failure) {
349
+ const ports = given ?? browserPorts();
350
+ const permission = device === "screen" ? "unknown" : await readPermission(ports, device);
351
+ const reason = deviceAccessReason(failure, device, { browser: detectBrowser(ports.userAgent), platform: detectPlatform(ports.userAgent), permission });
352
+ return reason && { reason, label: accessTooltip(device, reason), watch: (recovered) => watchRecovery(ports, device, reason, permission, recovered) };
353
+ }
354
+
355
+ export {
356
+ DeviceAccessStyles,
357
+ DEVICE_NAMES,
358
+ systemSettingsLink,
359
+ cardCopy,
360
+ browserPorts,
361
+ watchPermission,
362
+ resolveAccess
363
+ };
@@ -0,0 +1,114 @@
1
+ // src/components/device-popover/DevicePreview.tsx
2
+ import { useEffect as useEffect2, useRef, useState as useState2 } from "react";
3
+
4
+ // src/internal/useInputLevel.ts
5
+ import { useEffect, useState } from "react";
6
+ var SAMPLE_MS = 100;
7
+ function observeInputLevel(track, sample) {
8
+ if (track.readyState !== "live") return;
9
+ let context;
10
+ try {
11
+ context = new AudioContext();
12
+ const source = context.createMediaStreamSource(new MediaStream([track]));
13
+ const analyser = context.createAnalyser();
14
+ analyser.fftSize = 2048;
15
+ source.connect(analyser);
16
+ const samples = new Float32Array(analyser.fftSize);
17
+ const audio = context;
18
+ const resume = () => {
19
+ if (audio.state === "suspended") void audio.resume().catch(() => void 0);
20
+ };
21
+ document.addEventListener("pointerdown", resume);
22
+ document.addEventListener("keydown", resume);
23
+ const timer = window.setInterval(() => {
24
+ if (audio.state !== "running" || !track.enabled || track.muted || track.readyState !== "live") {
25
+ sample(null);
26
+ return;
27
+ }
28
+ analyser.getFloatTimeDomainData(samples);
29
+ const energy = samples.reduce((sum, value) => sum + value * value, 0);
30
+ sample(Math.sqrt(energy / samples.length));
31
+ }, SAMPLE_MS);
32
+ return () => {
33
+ window.clearInterval(timer);
34
+ document.removeEventListener("pointerdown", resume);
35
+ document.removeEventListener("keydown", resume);
36
+ source.disconnect();
37
+ void audio.close().catch(() => void 0);
38
+ };
39
+ } catch {
40
+ void context?.close().catch(() => void 0);
41
+ }
42
+ }
43
+ function useInputLevel(track) {
44
+ const [level, setLevel] = useState(0);
45
+ useEffect(() => {
46
+ setLevel(0);
47
+ if (track) return observeInputLevel(track, (rms) => setLevel(Math.min(100, Math.round((rms ?? 0) * 400))));
48
+ }, [track]);
49
+ return level;
50
+ }
51
+
52
+ // src/components/device-popover/DevicePreview.tsx
53
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
54
+ function InputLevel({ track }) {
55
+ const level = useInputLevel(track);
56
+ return /* @__PURE__ */ jsx("span", { className: "chalk-shell-level", role: "meter", "aria-label": "Input level", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": level, children: /* @__PURE__ */ jsx("i", { style: { transform: `scaleX(${level / 100})` } }) });
57
+ }
58
+ function CameraPreview({
59
+ track,
60
+ mirrored,
61
+ open,
62
+ selectedDeviceId,
63
+ captureCameraPreview,
64
+ onDeviceId
65
+ }) {
66
+ const video = useRef(null);
67
+ const [unavailable, setUnavailable] = useState2(false);
68
+ const trackEnabled = track?.enabled;
69
+ useEffect2(() => {
70
+ const element = video.current;
71
+ if (!element || !open) return;
72
+ let cancelled = false;
73
+ let preview;
74
+ setUnavailable(false);
75
+ onDeviceId(null);
76
+ if (captureCameraPreview) {
77
+ void captureCameraPreview().then(
78
+ (captured) => {
79
+ if (cancelled) {
80
+ captured.release();
81
+ return;
82
+ }
83
+ preview = captured;
84
+ onDeviceId(captured.track.getSettings().deviceId ?? selectedDeviceId ?? "default");
85
+ element.srcObject = new MediaStream([captured.track]);
86
+ },
87
+ () => {
88
+ if (!cancelled) setUnavailable(true);
89
+ }
90
+ );
91
+ } else if (track?.enabled && track.readyState === "live") {
92
+ onDeviceId(track.getSettings().deviceId ?? selectedDeviceId ?? "default");
93
+ element.srcObject = new MediaStream([track]);
94
+ } else {
95
+ setUnavailable(true);
96
+ }
97
+ return () => {
98
+ cancelled = true;
99
+ element.srcObject = null;
100
+ preview?.release();
101
+ };
102
+ }, [track, trackEnabled, open, selectedDeviceId, captureCameraPreview, onDeviceId]);
103
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "chalk-shell-preview", children: [
104
+ /* @__PURE__ */ jsx("video", { ref: video, autoPlay: true, muted: true, playsInline: true, style: { transform: mirrored ? "scaleX(-1)" : void 0 } }),
105
+ /* @__PURE__ */ jsx("small", { children: unavailable ? "Camera preview unavailable. Check camera access." : "Only you see this preview" })
106
+ ] }) });
107
+ }
108
+
109
+ export {
110
+ observeInputLevel,
111
+ useInputLevel,
112
+ InputLevel,
113
+ CameraPreview
114
+ };
@@ -0,0 +1,9 @@
1
+ // src/utils/formatClockTime.ts
2
+ var clockTime = new Intl.DateTimeFormat("en-US", { hour: "numeric", minute: "2-digit", hour12: true });
3
+ function formatClockTime(iso) {
4
+ return clockTime.format(new Date(iso));
5
+ }
6
+
7
+ export {
8
+ formatClockTime
9
+ };