@theoremjs/react 0.3.5-next.1034.gfe14d6a → 0.3.5-next.1035.g7656c60

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/README.md CHANGED
@@ -613,7 +613,7 @@ To show a snapshot control in `LiveRunner`, give `useLiveCall` an `onSnapshot`.
613
613
 
614
614
  ### Change what the call view draws
615
615
 
616
- Use `slots` when your call view needs other parts than Theorem's. Each slot is a `LiveSlot`:
616
+ Use `slots` when your call view needs other parts than Theorem's. Each slot except `pin` is a `LiveSlot`:
617
617
 
618
618
  - Leave a slot out to keep Theorem's part.
619
619
  - Set it to `null` to draw nothing there.
@@ -621,7 +621,7 @@ Use `slots` when your call view needs other parts than Theorem's. Each slot is a
621
621
 
622
622
  | Component | Slots |
623
623
  | --- | --- |
624
- | `LiveRunner` | `landing`, `header`, `notices`, `waveform`, `controls`, `captions`, `gate` |
624
+ | `LiveRunner` | `landing`, `header`, `notices`, `waveform`, `pin`, `controls`, `captions`, `gate` |
625
625
  | `LiveCallTile` | `media`, `time`, `controls`, `gate` |
626
626
 
627
627
  `controls` is a `LiveControlsSlot`. Its function gets the call and Theorem's controls as `{ id, node }`, in order, so you can reorder, remove, or add one. `captions: null` also removes the captions panel and its toggle. `LiveRunner` also takes `captionsDefaultOpen`. Default: `true`.
@@ -636,6 +636,21 @@ Use `slots` when your call view needs other parts than Theorem's. Each slot is a
636
636
  />
637
637
  ```
638
638
 
639
+ `pin` is your own part on the call screen, between the waveform and the controls. It shows whether the captions panel is open or closed. It is a `LivePin`: any `ReactNode`, or a function that gets the call and returns one. Theorem draws nothing there by default. Your code decides what shows, what replaces it, and when it goes: to remove it, pass `null` or leave it out.
640
+
641
+ ```tsx
642
+ const [pinned, setPinned] = useState<string | null>(null);
643
+
644
+ <LiveRunner
645
+ call={call}
646
+ slots={{
647
+ pin: pinned ? (
648
+ <ActionCard title={pinned} actions={<Button label="Close" onClick={() => setPinned(null)} />} />
649
+ ) : null,
650
+ }}
651
+ />
652
+ ```
653
+
639
654
  `LiveRunner` and `LiveCallTile` take `video` for the camera preview:
640
655
 
641
656
  - `aspectRatio`: the box's width over its height. Default: `4 / 3`.
package/live.d.ts CHANGED
@@ -11,4 +11,4 @@ export { LiveCallTile, type LiveCallTileProps, type LiveCallTileSlots, } from '.
11
11
  export type { LiveRunnerProps, LiveRunnerSlots } from './ui/LiveRunner.js';
12
12
  export { LiveRunner } from './ui/LiveRunner.js';
13
13
  export { LiveVideoPreview, type LiveVideoPreviewProps } from './ui/LiveVideoPreview.js';
14
- export type { LiveControl, LiveControlId, LiveControlsSlot, LiveSlot, LiveVideoPreviewOptions, } from './ui/live-slots.js';
14
+ export type { LiveControl, LiveControlId, LiveControlsSlot, LivePin, LiveSlot, LiveVideoPreviewOptions, } from './ui/live-slots.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theoremjs/react",
3
- "version": "0.3.5-next.1034.gfe14d6a",
3
+ "version": "0.3.5-next.1035.g7656c60",
4
4
  "description": "React bindings for Theorem: headless hooks + transport, an Astryx chat UI, and a Web-standard server handler.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -60,8 +60,8 @@
60
60
  "@stylexjs/stylex": "0.19.0",
61
61
  "react": "^19.0.0",
62
62
  "react-dom": "^19.0.0",
63
- "@theoremjs/agents": "^0.3.5-next.1034.gfe14d6a",
64
- "@theoremjs/web": "^0.3.5-next.1034.gfe14d6a"
63
+ "@theoremjs/agents": "^0.3.5-next.1035.g7656c60",
64
+ "@theoremjs/web": "^0.3.5-next.1035.g7656c60"
65
65
  },
66
66
  "peerDependenciesMeta": {
67
67
  "@astryxdesign/core": {
@@ -1,7 +1,7 @@
1
1
  import type { DefinedTheme } from '@astryxdesign/core/theme';
2
2
  import type { LiveCall } from '../components/live/use-live-call.js';
3
3
  import { type TheoremLabels } from './labels.js';
4
- import { type LiveControlsSlot, type LiveSlot, type LiveVideoPreviewOptions } from './live-slots.js';
4
+ import { type LiveControlsSlot, type LivePin, type LiveSlot, type LiveVideoPreviewOptions } from './live-slots.js';
5
5
  import { type TheoremChatProps } from './TheoremChat.js';
6
6
  /** The parts of `LiveRunner` a host can change; see {@link LiveSlot}. */
7
7
  export type LiveRunnerSlots = {
@@ -12,6 +12,8 @@ export type LiveRunnerSlots = {
12
12
  /** The failure and session-ended banners. */
13
13
  notices?: LiveSlot;
14
14
  waveform?: LiveSlot;
15
+ /** The host's own part, between the waveform and the controls, whether the captions are open or closed; see {@link LivePin}. */
16
+ pin?: LivePin;
15
17
  controls?: LiveControlsSlot;
16
18
  /** The captions panel's content. `null` also removes the panel and its toggle. */
17
19
  captions?: LiveSlot;
package/ui/LiveRunner.js CHANGED
@@ -20,7 +20,7 @@ import { LiveToolGateDialog } from "./LiveToolGateDialog.js";
20
20
  import { LiveVideoPreview } from "./LiveVideoPreview.js";
21
21
  import { liveStateLabel } from "./labels.js";
22
22
  import { useLabels } from "./labels-provider.js";
23
- import { liveControlIds, renderLiveControls, renderLiveSlot, } from "./live-slots.js";
23
+ import { liveControlIds, renderLiveControls, renderLivePin, renderLiveSlot, } from "./live-slots.js";
24
24
  import { PANEL_EDGE, SidePanel, SidePanelHeader, SidePanelToggle, useSidePanel, } from "./SidePanel.js";
25
25
  import { DEFAULT_CHAT_MAX_WIDTH } from "./TheoremChat.js";
26
26
  import { TheoremSurface } from "./TheoremSurface.js";
@@ -72,7 +72,7 @@ function LiveLanding({ call }) {
72
72
  function LiveStage({ call, captionsToggle, onMinimize, slots, }) {
73
73
  const t = useLabels();
74
74
  const ref = useEnterMotion();
75
- return (_jsx(VStack, { ref: ref, height: "100%", hAlign: "center", children: _jsxs(VStack, { width: "100%", maxWidth: WAVE_MAX_WIDTH, height: "100%", gap: 3, children: [renderLiveSlot(slots.header, call, _jsxs(VStack, { gap: 0.5, children: [_jsx(Text, { type: "label", color: "secondary", children: t('@theorem.agent.handle', { handle: call.handle }) }), _jsx(Text, { size: "sm", color: "secondary", children: liveStateLabel(t, call.liveState, call.activeTool) })] })), renderLiveSlot(slots.notices, call, _jsx(LiveNotices, { call: call })), _jsx(StackItem, { size: "fill", children: _jsx(VStack, { height: "100%", vAlign: "end", children: renderLiveSlot(slots.waveform, call, _jsx(VStack, { width: "100%", height: WAVE_HEIGHT, style: { color: 'var(--color-icon-primary)' }, "aria-hidden": "true", children: _jsx(InkWaveform, { status: call.status, levelsRef: call.levelsRef, toolActive: call.toolActive, variant: "hero" }) })) }) }), slots.controls === null ? null : (_jsx(LiveControls, { call: call, captionsToggle: captionsToggle, onMinimize: onMinimize, slot: slots.controls }))] }) }));
75
+ return (_jsx(VStack, { ref: ref, height: "100%", hAlign: "center", children: _jsxs(VStack, { width: "100%", maxWidth: WAVE_MAX_WIDTH, height: "100%", gap: 3, children: [renderLiveSlot(slots.header, call, _jsxs(VStack, { gap: 0.5, children: [_jsx(Text, { type: "label", color: "secondary", children: t('@theorem.agent.handle', { handle: call.handle }) }), _jsx(Text, { size: "sm", color: "secondary", children: liveStateLabel(t, call.liveState, call.activeTool) })] })), renderLiveSlot(slots.notices, call, _jsx(LiveNotices, { call: call })), _jsx(StackItem, { size: "fill", children: _jsx(VStack, { height: "100%", vAlign: "end", children: renderLiveSlot(slots.waveform, call, _jsx(VStack, { width: "100%", height: WAVE_HEIGHT, style: { color: 'var(--color-icon-primary)' }, "aria-hidden": "true", children: _jsx(InkWaveform, { status: call.status, levelsRef: call.levelsRef, toolActive: call.toolActive, variant: "hero" }) })) }) }), renderLivePin(slots.pin, call), slots.controls === null ? null : (_jsx(LiveControls, { call: call, captionsToggle: captionsToggle, onMinimize: onMinimize, slot: slots.controls }))] }) }));
76
76
  }
77
77
  /** The failure and session-ended banners. */
78
78
  function LiveNotices({ call }) {
@@ -7,6 +7,12 @@ import type { LiveCall } from '../components/live/use-live-call.js';
7
7
  * wrap, or leave out.
8
8
  */
9
9
  export type LiveSlot = null | ((call: LiveCall, standard: ReactNode) => ReactNode);
10
+ /**
11
+ * What a host pins on the call screen, above the controls: a node, or a function of the call that
12
+ * returns one. Theorem draws nothing there by default. The host decides what shows, what replaces
13
+ * it, and when it goes.
14
+ */
15
+ export type LivePin = ReactNode | ((call: LiveCall) => ReactNode);
10
16
  /** The controls a live view draws, by name. */
11
17
  export type LiveControlId = 'mic' | 'video' | 'snapshot' | 'minimize' | 'captions' | 'call' | 'expand';
12
18
  /** One of Theorem's call controls, for a host that reorders, drops, or adds to them. */
@@ -32,6 +38,8 @@ export type LiveVideoPreviewOptions = {
32
38
  };
33
39
  /** What a slot draws: Theorem's part when left out, nothing for `null`, else the host's. */
34
40
  export declare function renderLiveSlot(slot: LiveSlot | undefined, call: LiveCall, standard: ReactNode): ReactNode;
41
+ /** What a pin draws: the host's node, or what its function returns for the call. */
42
+ export declare function renderLivePin(pin: LivePin, call: LiveCall): ReactNode;
35
43
  /** What the controls slot draws, as `renderLiveSlot` does for one part. */
36
44
  export declare function renderLiveControls(slot: LiveControlsSlot | undefined, call: LiveCall, controls: readonly LiveControl[]): ReactNode;
37
45
  /** The controls a call shows, in Theorem's order. */
package/ui/live-slots.js CHANGED
@@ -6,6 +6,10 @@ export function renderLiveSlot(slot, call, standard) {
6
6
  return null;
7
7
  return slot(call, standard);
8
8
  }
9
+ /** What a pin draws: the host's node, or what its function returns for the call. */
10
+ export function renderLivePin(pin, call) {
11
+ return typeof pin === 'function' ? pin(call) : pin;
12
+ }
9
13
  /** What the controls slot draws, as `renderLiveSlot` does for one part. */
10
14
  export function renderLiveControls(slot, call, controls) {
11
15
  if (slot === undefined)