@theoremjs/react 0.3.5-next.980.g83e419d → 0.3.5-next.982.g16b31de
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 +2 -0
- package/package.json +3 -3
- package/ui/ChatComposerBar.js +10 -2
- package/ui/labels.d.ts +8 -0
- package/ui/labels.js +8 -0
package/README.md
CHANGED
|
@@ -545,6 +545,8 @@ function MyChat() {
|
|
|
545
545
|
|
|
546
546
|
`handlePendingMove(id, direction)` moves a pending message among those of its kind. `ChatComposerBar` draws a move only when `composerPendingMoves` from `@theoremjs/agents/interface` says the message can go that way: a message alone in its kind has none.
|
|
547
547
|
|
|
548
|
+
A pending message with `saved` set is one the host saved itself (`intake` on `createTheoremHandler`). `ChatComposerBar` draws it with the label `@theorem.composer.pending.saved`, "Sent", and no actions, because the page cannot change it. It leaves the list when a reply reads it.
|
|
549
|
+
|
|
548
550
|
### Place the pieces yourself
|
|
549
551
|
|
|
550
552
|
`TheoremChat` is built from two pieces in `/ui` that you can place apart: `TheoremChatComposer` and `TheoremChatTranscript`. Each takes the `chat` from `useTheoremChat` (its type is `TheoremChatState`) and the `iface` from `useTheoremInterface`. You decide where each one sits and when each one shows. Theorem moves neither of them.
|
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.982.g16b31de",
|
|
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.982.g16b31de",
|
|
64
|
+
"@theoremjs/web": "^0.3.5-next.982.g16b31de"
|
|
65
65
|
},
|
|
66
66
|
"peerDependenciesMeta": {
|
|
67
67
|
"@astryxdesign/core": {
|
package/ui/ChatComposerBar.js
CHANGED
|
@@ -58,6 +58,15 @@ const SEND_ICON = {
|
|
|
58
58
|
stash: IconArchive,
|
|
59
59
|
};
|
|
60
60
|
function PendingRow(props) {
|
|
61
|
+
const { message } = props;
|
|
62
|
+
const t = useLabels();
|
|
63
|
+
// why: The host saved the message, so the page has no action left on it.
|
|
64
|
+
const state = message.saved ? 'saved' : message.kind;
|
|
65
|
+
const Kind = message.saved ? IconSend : SEND_ICON[message.kind];
|
|
66
|
+
return (_jsxs(HStack, { gap: 1, align: "center", width: "100%", children: [_jsx(HoverTip, { content: t(`@theorem.composer.pending.${state}.description`), children: _jsx(Token, { label: t(`@theorem.composer.pending.${state}`), isLabelHidden: true, color: message.kind === 'steer' ? 'blue' : 'default', icon: _jsx(Kind, { size: 14 }) }) }), _jsx(StackItem, { size: "fill", style: { width: 0 }, children: _jsx(Text, { size: "sm", maxLines: 1, hasTruncateTooltip: true, children: composerPendingPreview(message) }) }), message.saved ? null : _jsx(PendingActions, { ...props })] }));
|
|
67
|
+
}
|
|
68
|
+
/** A waiting message's actions. A message the host saved has none. */
|
|
69
|
+
function PendingActions(props) {
|
|
61
70
|
const { message } = props;
|
|
62
71
|
const t = useLabels();
|
|
63
72
|
const icon = (Glyph) => _jsx(Glyph, { size: 14 });
|
|
@@ -67,8 +76,7 @@ function PendingRow(props) {
|
|
|
67
76
|
const moveUp = t('@theorem.composer.pending.move_up');
|
|
68
77
|
const moveDown = t('@theorem.composer.pending.move_down');
|
|
69
78
|
const remove = t('@theorem.composer.pending.remove');
|
|
70
|
-
|
|
71
|
-
return (_jsxs(HStack, { gap: 1, align: "center", width: "100%", children: [_jsx(HoverTip, { content: t(`@theorem.composer.pending.${message.kind}.description`), children: _jsx(Token, { label: t(`@theorem.composer.pending.${message.kind}`), isLabelHidden: true, color: message.kind === 'steer' ? 'blue' : 'default', icon: _jsx(Kind, { size: 14 }) }) }), _jsx(StackItem, { size: "fill", style: { width: 0 }, children: _jsx(Text, { size: "sm", maxLines: 1, hasTruncateTooltip: true, children: composerPendingPreview(message) }) }), _jsxs(HStack, { gap: 0.5, children: [_jsx(IconButton, { label: edit, tooltip: edit, size: "sm", variant: "ghost", icon: icon(IconPencil), onClick: () => props.onRestore(message.id) }), message.kind === 'stash' ? (_jsx(IconButton, { label: queue, tooltip: queue, size: "sm", variant: "ghost", icon: icon(IconCornerDownLeft), onClick: () => props.onQueue(message.id) })) : null, _jsx(IconButton, { label: sendNow, tooltip: sendNow, size: "sm", variant: "ghost", icon: icon(IconSend), onClick: () => props.onSendNow(message.id) }), props.moves.up ? (_jsx(IconButton, { label: moveUp, tooltip: moveUp, size: "sm", variant: "ghost", icon: icon(IconArrowUp), onClick: () => props.onMove(message.id, 'up') })) : null, props.moves.down ? (_jsx(IconButton, { label: moveDown, tooltip: moveDown, size: "sm", variant: "ghost", icon: icon(IconArrowDown), onClick: () => props.onMove(message.id, 'down') })) : null, _jsx(IconButton, { label: remove, tooltip: remove, size: "sm", variant: "ghost", icon: icon(IconX), onClick: () => props.onRemove(message.id) })] })] }));
|
|
79
|
+
return (_jsxs(HStack, { gap: 0.5, children: [_jsx(IconButton, { label: edit, tooltip: edit, size: "sm", variant: "ghost", icon: icon(IconPencil), onClick: () => props.onRestore(message.id) }), message.kind === 'stash' ? (_jsx(IconButton, { label: queue, tooltip: queue, size: "sm", variant: "ghost", icon: icon(IconCornerDownLeft), onClick: () => props.onQueue(message.id) })) : null, _jsx(IconButton, { label: sendNow, tooltip: sendNow, size: "sm", variant: "ghost", icon: icon(IconSend), onClick: () => props.onSendNow(message.id) }), props.moves.up ? (_jsx(IconButton, { label: moveUp, tooltip: moveUp, size: "sm", variant: "ghost", icon: icon(IconArrowUp), onClick: () => props.onMove(message.id, 'up') })) : null, props.moves.down ? (_jsx(IconButton, { label: moveDown, tooltip: moveDown, size: "sm", variant: "ghost", icon: icon(IconArrowDown), onClick: () => props.onMove(message.id, 'down') })) : null, _jsx(IconButton, { label: remove, tooltip: remove, size: "sm", variant: "ghost", icon: icon(IconX), onClick: () => props.onRemove(message.id) })] }));
|
|
72
80
|
}
|
|
73
81
|
/** The model and effort choices this profile offers; efforts only for a chosen model. */
|
|
74
82
|
export function generationOptions(iface, selectedModel) {
|
package/ui/labels.d.ts
CHANGED
|
@@ -184,6 +184,14 @@ export declare const THEOREM_UI_CATALOG: {
|
|
|
184
184
|
readonly defaultMessage: "Steering: the agent reads it at its next step.";
|
|
185
185
|
readonly description: "Tooltip on a waiting steering message.";
|
|
186
186
|
};
|
|
187
|
+
readonly '@theorem.composer.pending.saved': {
|
|
188
|
+
readonly defaultMessage: "Sent";
|
|
189
|
+
readonly description: "Name of a waiting message the host has saved, read by screen readers on its icon.";
|
|
190
|
+
};
|
|
191
|
+
readonly '@theorem.composer.pending.saved.description': {
|
|
192
|
+
readonly defaultMessage: "Sent: the agent reads it with its next reply.";
|
|
193
|
+
readonly description: "Tooltip on a waiting message the host has saved.";
|
|
194
|
+
};
|
|
187
195
|
readonly '@theorem.composer.pending.queue': {
|
|
188
196
|
readonly defaultMessage: "Queued";
|
|
189
197
|
readonly description: "Name of a waiting queued message, read by screen readers on its icon.";
|
package/ui/labels.js
CHANGED
|
@@ -171,6 +171,14 @@ export const THEOREM_UI_CATALOG = {
|
|
|
171
171
|
defaultMessage: 'Steering: the agent reads it at its next step.',
|
|
172
172
|
description: 'Tooltip on a waiting steering message.',
|
|
173
173
|
},
|
|
174
|
+
'@theorem.composer.pending.saved': {
|
|
175
|
+
defaultMessage: 'Sent',
|
|
176
|
+
description: 'Name of a waiting message the host has saved, read by screen readers on its icon.',
|
|
177
|
+
},
|
|
178
|
+
'@theorem.composer.pending.saved.description': {
|
|
179
|
+
defaultMessage: 'Sent: the agent reads it with its next reply.',
|
|
180
|
+
description: 'Tooltip on a waiting message the host has saved.',
|
|
181
|
+
},
|
|
174
182
|
'@theorem.composer.pending.queue': {
|
|
175
183
|
defaultMessage: 'Queued',
|
|
176
184
|
description: 'Name of a waiting queued message, read by screen readers on its icon.',
|