@theoremjs/react 0.3.5-next.1033.g5c598ea → 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 +30 -16
- package/live.d.ts +1 -1
- package/package.json +3 -3
- package/ui/LiveRunner.d.ts +3 -1
- package/ui/LiveRunner.js +2 -2
- package/ui/TheoremChat.d.ts +13 -2
- package/ui/TheoremChat.js +4 -4
- package/ui/index.d.ts +1 -1
- package/ui/live-slots.d.ts +8 -0
- package/ui/live-slots.js +4 -0
package/README.md
CHANGED
|
@@ -183,6 +183,7 @@ To draw your own figures like the trace panel does, `@theoremjs/react/ui` also e
|
|
|
183
183
|
| `media` | Which media from tools the chat shows. `'sent'` shows only what a tool sent to the person. `'all'` also shows what only the model read, for an evaluation view. Default: `'sent'`. See [Tool media](#tool-media). |
|
|
184
184
|
| `resolveMedia` | Turns a tool's reference into an address the page can load. See [Tool media](#tool-media). |
|
|
185
185
|
| `mediaViewer` | The viewer every picture and video opens in. Default: Astryx's Lightbox, with zoom. See [Your own media viewer](#your-own-media-viewer). |
|
|
186
|
+
| `transcript` | The options of `TheoremChatTranscript` that the chat does not set itself, given to its transcript as they are: `slots`, `dividers`, `bodyKindPlacement`, `stepLayout`, `showToolDurations`, `showWorkStatus`, and `showResumedNotice`. Its type is `TheoremChatTranscriptOptions`. See [Draw under a reply](#draw-under-a-reply). |
|
|
186
187
|
|
|
187
188
|
### The row composer's look
|
|
188
189
|
|
|
@@ -612,7 +613,7 @@ To show a snapshot control in `LiveRunner`, give `useLiveCall` an `onSnapshot`.
|
|
|
612
613
|
|
|
613
614
|
### Change what the call view draws
|
|
614
615
|
|
|
615
|
-
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`:
|
|
616
617
|
|
|
617
618
|
- Leave a slot out to keep Theorem's part.
|
|
618
619
|
- Set it to `null` to draw nothing there.
|
|
@@ -620,7 +621,7 @@ Use `slots` when your call view needs other parts than Theorem's. Each slot is a
|
|
|
620
621
|
|
|
621
622
|
| Component | Slots |
|
|
622
623
|
| --- | --- |
|
|
623
|
-
| `LiveRunner` | `landing`, `header`, `notices`, `waveform`, `controls`, `captions`, `gate` |
|
|
624
|
+
| `LiveRunner` | `landing`, `header`, `notices`, `waveform`, `pin`, `controls`, `captions`, `gate` |
|
|
624
625
|
| `LiveCallTile` | `media`, `time`, `controls`, `gate` |
|
|
625
626
|
|
|
626
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`.
|
|
@@ -635,6 +636,21 @@ Use `slots` when your call view needs other parts than Theorem's. Each slot is a
|
|
|
635
636
|
/>
|
|
636
637
|
```
|
|
637
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
|
+
|
|
638
654
|
`LiveRunner` and `LiveCallTile` take `video` for the camera preview:
|
|
639
655
|
|
|
640
656
|
- `aspectRatio`: the box's width over its height. Default: `4 / 3`.
|
|
@@ -718,7 +734,7 @@ function Dock({ chat, iface }) {
|
|
|
718
734
|
}
|
|
719
735
|
```
|
|
720
736
|
|
|
721
|
-
`TheoremChatComposer` takes `layout`, `icons`, `pills`, `placeholder`, `inputRef`, `inputComponent`, `triggers`, `refText`, and `renderRef`. Pass it the `refText` you gave `useTheoremChat`. `TheoremChatTranscript` takes the props of `ChatTranscript` that the chat does not give: `handle`, `emptyState`, `dividers`, `usage`, `bodyKindPlacement`, `stepLayout`, `showToolDurations`, `showWorkStatus`, `renderRef`, and `slots`. Its `handle` is the handle of the profile when you leave it out. Put both pieces inside one `TheoremSurface`. It takes what `TheoremChat` takes for the look and the media: `theme`, `mode`, `labels`, `detectCodeLanguage`, `media`, `resolveMedia`, and `mediaViewer`.
|
|
737
|
+
`TheoremChatComposer` takes `layout`, `icons`, `pills`, `placeholder`, `inputRef`, `inputComponent`, `triggers`, `refText`, and `renderRef`. Pass it the `refText` you gave `useTheoremChat`. `TheoremChatTranscript` takes the props of `ChatTranscript` that the chat does not give: `handle`, `emptyState`, `dividers`, `usage`, `bodyKindPlacement`, `stepLayout`, `showToolDurations`, `showWorkStatus`, `showResumedNotice`, `renderRef`, and `slots`. Its `handle` is the handle of the profile when you leave it out. Put both pieces inside one `TheoremSurface`. It takes what `TheoremChat` takes for the look and the media: `theme`, `mode`, `labels`, `detectCodeLanguage`, `media`, `resolveMedia`, and `mediaViewer`.
|
|
722
738
|
|
|
723
739
|
Use `pills` to show your own notice in the pill row of the `row` layout, for example "New from your agent" while the chat is closed. Each pill is `{ id, label, icon?, onSelect? }`. It comes after the working pill and the background calls, and looks like them. The icon goes before the words. A click calls `onSelect`. A pill without `onSelect` only shows.
|
|
724
740
|
|
|
@@ -754,7 +770,7 @@ The hooks and the client write no English text. They return kinds, codes, and st
|
|
|
754
770
|
|
|
755
771
|
### Draw under a reply
|
|
756
772
|
|
|
757
|
-
To draw your own part under a reply, such as a card that a tool's result asks for, pass `slots={{ reply }}` to `ChatTranscript` or `TheoremChatTranscript`. `reply` is called for each reply and draws inside its message, under what the reply wrote. Without it, or with `reply: null`, nothing is drawn.
|
|
773
|
+
To draw your own part under a reply, such as a card that a tool's result asks for, pass `slots={{ reply }}` to `ChatTranscript` or `TheoremChatTranscript`, or `transcript={{ slots: { reply } }}` to `TheoremChat`. `reply` is called for each reply and draws inside its message, under what the reply wrote. Without it, or with `reply: null`, nothing is drawn.
|
|
758
774
|
|
|
759
775
|
`reply` receives a `ChatReply`:
|
|
760
776
|
|
|
@@ -780,20 +796,18 @@ beforeSave: async (at, reply) => ({
|
|
|
780
796
|
// page
|
|
781
797
|
type JoinCard = { card: 'join'; room: string };
|
|
782
798
|
|
|
783
|
-
<
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
) : null;
|
|
792
|
-
},
|
|
793
|
-
}}
|
|
794
|
-
/>
|
|
799
|
+
const drawJoinCard = ({ host }: ChatReply<JoinCard>) => {
|
|
800
|
+
const join = host.find((value) => value.card === 'join');
|
|
801
|
+
return join ? (
|
|
802
|
+
<ActionCard title={`Join ${join.room}`} actions={<Button label="Join" onClick={() => open(join.room)} />} />
|
|
803
|
+
) : null;
|
|
804
|
+
};
|
|
805
|
+
|
|
806
|
+
<TheoremChat<JoinCard> endpoint="/api/theorem" transcript={{ slots: { reply: drawJoinCard } }} />
|
|
795
807
|
```
|
|
796
808
|
|
|
809
|
+
`TheoremChatTranscript` takes the slot as `slots={{ reply: drawJoinCard }}`, with the same type argument.
|
|
810
|
+
|
|
797
811
|
The type argument is the type of your values, a JSON object type. Theorem does not check their shape against it.
|
|
798
812
|
|
|
799
813
|
These rules apply:
|
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.
|
|
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.
|
|
64
|
-
"@theoremjs/web": "^0.3.5-next.
|
|
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": {
|
package/ui/LiveRunner.d.ts
CHANGED
|
@@ -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 }) {
|
package/ui/TheoremChat.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { type ChatTranscriptProps } from './ChatTranscript.js';
|
|
|
14
14
|
import type { TheoremLabels } from './labels.js';
|
|
15
15
|
import type { MediaViewer } from './media-viewer.js';
|
|
16
16
|
import type { ResolveMedia, ToolMediaShown } from './tool-media.js';
|
|
17
|
-
export type TheoremChatProps = {
|
|
17
|
+
export type TheoremChatProps<Host extends JsonObject = JsonObject> = {
|
|
18
18
|
/** Where `createTheoremHandler` is mounted. Default `/api/theorem`. Ignored when `transport` is set. */
|
|
19
19
|
endpoint?: string;
|
|
20
20
|
/** Extra fetch options for the default HTTP transport (auth headers, custom fetch). */
|
|
@@ -160,7 +160,18 @@ export type TheoremChatProps = {
|
|
|
160
160
|
renderRef?: (ref: UserRef) => ReactNode;
|
|
161
161
|
/** Stands in for the send button while the composer is empty; see `ChatComposerBarProps.emptyAction`. */
|
|
162
162
|
composerEmptyAction?: ReactNode;
|
|
163
|
+
/**
|
|
164
|
+
* The transcript's own options, given to {@link TheoremChatTranscript} as they are: its `slots`,
|
|
165
|
+
* such as the `reply` slot, and how it lays out a reply. `Host` is the type of the values your
|
|
166
|
+
* server sets on a reply's blocks in `beforeSave`.
|
|
167
|
+
*/
|
|
168
|
+
transcript?: TheoremChatTranscriptOptions<Host>;
|
|
163
169
|
};
|
|
170
|
+
/**
|
|
171
|
+
* What {@link TheoremChat} gives its transcript from the `transcript` prop: every option of
|
|
172
|
+
* {@link TheoremChatTranscript} that the chat does not set itself.
|
|
173
|
+
*/
|
|
174
|
+
export type TheoremChatTranscriptOptions<Host extends JsonObject = JsonObject> = Omit<TheoremChatTranscriptProps<Host>, 'chat' | 'iface' | 'handle' | 'usage' | 'renderRef' | 'emptyState'>;
|
|
164
175
|
/** What a host can do to a mounted {@link TheoremChat}. */
|
|
165
176
|
export type TheoremChatHandle = {
|
|
166
177
|
/**
|
|
@@ -233,4 +244,4 @@ export declare function TheoremChatTranscript<Host extends JsonObject = JsonObje
|
|
|
233
244
|
* <TheoremChat endpoint="/api/theorem" />
|
|
234
245
|
* ```
|
|
235
246
|
*/
|
|
236
|
-
export declare function TheoremChat({ endpoint, http, transport, theme, mode, labels, detectCodeLanguage, media, resolveMedia, mediaViewer, ...rest }: TheoremChatProps): import("react").JSX.Element;
|
|
247
|
+
export declare function TheoremChat<Host extends JsonObject = JsonObject>({ endpoint, http, transport, theme, mode, labels, detectCodeLanguage, media, resolveMedia, mediaViewer, ...rest }: TheoremChatProps<Host>): import("react").JSX.Element;
|
package/ui/TheoremChat.js
CHANGED
|
@@ -76,7 +76,7 @@ function ChatBodyComposer({ body, chat, inputRef, }) {
|
|
|
76
76
|
return failure ? _jsx(Banner, { status: "error", role: "alert", title: failure.error }) : null;
|
|
77
77
|
}
|
|
78
78
|
function ChatBody(props) {
|
|
79
|
-
const { transport, iface, emptyState, density, maxWidth = DEFAULT_CHAT_MAX_WIDTH, scrollRef, trace, usage, className, style, conversation, conversationView, initialText, initialFiles, initialVoice, initialPending, onConversationChange, chatRef, refText, renderRef, options, onOptionsChange, stated, context, pageTools, onTurnEvent, } = props;
|
|
79
|
+
const { transport, iface, emptyState, density, maxWidth = DEFAULT_CHAT_MAX_WIDTH, scrollRef, trace, usage, className, style, conversation, conversationView, initialText, initialFiles, initialVoice, initialPending, onConversationChange, chatRef, refText, renderRef, options, onOptionsChange, stated, context, pageTools, onTurnEvent, transcript, } = props;
|
|
80
80
|
const t = useLabels();
|
|
81
81
|
const chat = useTheoremChat({
|
|
82
82
|
transport,
|
|
@@ -104,7 +104,7 @@ function ChatBody(props) {
|
|
|
104
104
|
const header = _jsx(SidePanelHeader, { floating: true, children: inspector.toggle });
|
|
105
105
|
const composer = _jsx(ChatBodyComposer, { body: props, chat: chat, inputRef: inputRef });
|
|
106
106
|
const docked = { composer, composerRef, maxWidth };
|
|
107
|
-
return (_jsx(WithTrace, { inspector: inspector, children: _jsx(Layout, { height: "fill", className: className, style: { position: 'relative', ...style }, header: header, content: _jsx(LayoutContent, { padding: 0, isScrollable: landing, children: landing ? (_jsx(ChatLanding, { ...docked, handle: handle, emptyState: emptyState })) : (_jsx(ChatThread, { ...docked, chat: chat, iface: iface, handle: handle, density: density, scrollRef: scrollRef, usage: usage, renderRef: renderRef })) }) }) }));
|
|
107
|
+
return (_jsx(WithTrace, { inspector: inspector, children: _jsx(Layout, { height: "fill", className: className, style: { position: 'relative', ...style }, header: header, content: _jsx(LayoutContent, { padding: 0, isScrollable: landing, children: landing ? (_jsx(ChatLanding, { ...docked, handle: handle, emptyState: emptyState })) : (_jsx(ChatThread, { ...docked, chat: chat, iface: iface, handle: handle, density: density, scrollRef: scrollRef, usage: usage, renderRef: renderRef, transcript: transcript })) }) }) }));
|
|
108
108
|
}
|
|
109
109
|
const CHAT_SCROLL = { overscrollBehavior: 'none' };
|
|
110
110
|
/**
|
|
@@ -120,10 +120,10 @@ function ChatLanding({ composer, composerRef, maxWidth, handle, emptyState, }) {
|
|
|
120
120
|
* why: the dock leaves 12px under the composer; paddingBlockEnd={3} adds 12px more for a 24px
|
|
121
121
|
* bottom margin.
|
|
122
122
|
*/
|
|
123
|
-
function ChatThread({ composer, composerRef, maxWidth, chat, iface, handle, density, scrollRef, usage, renderRef, }) {
|
|
123
|
+
function ChatThread({ composer, composerRef, maxWidth, chat, iface, handle, density, scrollRef, usage, renderRef, transcript, }) {
|
|
124
124
|
return (_jsxs(VStack, { height: "100%", children: [_jsx("style", { href: "theorem-chat-thread", precedence: "default", children: '.theorem-chat-thread > :last-child > div:empty { display: none; }' }), _jsx(ChatLayout, { className: "theorem-chat-thread", density: density, scrollRef: scrollRef,
|
|
125
125
|
// why: Scrolling past either end does not bounce the transcript and its docked composer.
|
|
126
|
-
style: CHAT_SCROLL, composer: composer && (_jsx(VStack, { paddingBlockEnd: 3, children: _jsx(ChatColumn, { ref: composerRef, maxWidth: maxWidth, children: composer }) })), children: _jsx(ChatColumn, { maxWidth: maxWidth, children: _jsx(TheoremChatTranscript, { chat: chat, iface: iface, handle: handle, usage: usage, renderRef: renderRef }) }) })] }));
|
|
126
|
+
style: CHAT_SCROLL, composer: composer && (_jsx(VStack, { paddingBlockEnd: 3, children: _jsx(ChatColumn, { ref: composerRef, maxWidth: maxWidth, children: composer }) })), children: _jsx(ChatColumn, { maxWidth: maxWidth, children: _jsx(TheoremChatTranscript, { ...transcript, chat: chat, iface: iface, handle: handle, usage: usage, renderRef: renderRef }) }) })] }));
|
|
127
127
|
}
|
|
128
128
|
/**
|
|
129
129
|
* The transcript bound to a chat: its blocks as they stream, its gates answered through the chat,
|
package/ui/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export { RadialBars, Sunburst, type SunburstNode } from './RadialCharts.js';
|
|
|
33
33
|
export { type RankedBar, RankedBars } from './RankedBars.js';
|
|
34
34
|
export type { ChatReply, ChatReplySlot, ChatTranscriptSlots } from './reply-slot.js';
|
|
35
35
|
export { InPlace, PaneLayout, PanePanel, Prose, RaisedPane } from './SidePanel.js';
|
|
36
|
-
export { DEFAULT_CHAT_MAX_WIDTH, TheoremChat, TheoremChatComposer, type TheoremChatComposerProps, type TheoremChatHandle, type TheoremChatProps, TheoremChatTranscript, type TheoremChatTranscriptProps, } from './TheoremChat.js';
|
|
36
|
+
export { DEFAULT_CHAT_MAX_WIDTH, TheoremChat, TheoremChatComposer, type TheoremChatComposerProps, type TheoremChatHandle, type TheoremChatProps, TheoremChatTranscript, type TheoremChatTranscriptOptions, type TheoremChatTranscriptProps, } from './TheoremChat.js';
|
|
37
37
|
export { TheoremDecision, type TheoremDecisionProps } from './TheoremDecision.js';
|
|
38
38
|
export { TheoremEmbedding, type TheoremEmbeddingProps } from './TheoremEmbedding.js';
|
|
39
39
|
export { TheoremHost, type TheoremHostProps } from './TheoremHost.js';
|
package/ui/live-slots.d.ts
CHANGED
|
@@ -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)
|