@celljs/ta-web 4.22.0 → 4.23.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.
- package/esm/browser/assistant/assistant-conversation.js +1 -1
- package/esm/browser/assistant/assistant-initiative.d.ts +5 -1
- package/esm/browser/assistant/assistant-initiative.js +11 -3
- package/esm/browser/assistant/call-keeper.d.ts +2 -1
- package/esm/browser/assistant/call-keeper.js +4 -2
- package/esm/browser/assistant/call-screen.d.ts +1 -1
- package/esm/browser/assistant/call-turn-end.d.ts +11 -2
- package/esm/browser/assistant/call-turn-end.js +21 -5
- package/esm/browser/assistant/read-aloud.d.ts +1 -1
- package/esm/browser/assistant/realtime-voice.d.ts +1 -1
- package/esm/browser/assistant/voice-call-bar.d.ts +5 -2
- package/esm/browser/assistant/voice-call-bar.js +12 -0
- package/esm/browser/assistant/voice-call-protocol.d.ts +78 -0
- package/esm/browser/assistant/voice-call-protocol.js +2 -0
- package/esm/browser/assistant/voice-call.d.ts +17 -65
- package/esm/browser/assistant/voice-call.js +45 -1
- package/esm/browser/assistant/voice-reopen.d.ts +1 -1
- package/esm/browser/components/account-menu.js +28 -7
- package/esm/browser/components/chat-home.d.ts +3 -1
- package/esm/browser/components/chat-home.js +3 -2
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/earlier-messages.d.ts +4 -0
- package/esm/browser/components/earlier-messages.js +10 -2
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/message-footer.d.ts +0 -2
- package/esm/browser/components/message-footer.js +1 -8
- package/esm/browser/components/message-images.d.ts +22 -0
- package/esm/browser/components/message-images.js +90 -1
- package/esm/browser/components/message-steps.js +9 -0
- package/esm/browser/components/message-user.js +8 -1
- package/esm/browser/components/partner-row-util.d.ts +28 -0
- package/esm/browser/components/partner-row-util.js +45 -0
- package/esm/browser/components/partner-row.d.ts +4 -3
- package/esm/browser/components/partner-row.js +21 -9
- package/esm/browser/components/profile-view.d.ts +2 -2
- package/esm/browser/components/profile-view.js +6 -3
- package/esm/browser/components/web-composer.d.ts +5 -2
- package/esm/browser/components/web-composer.js +10 -5
- package/esm/browser/extension/extension-view.js +2 -2
- package/esm/browser/extension/icons.js +4 -1
- package/esm/browser/extension/web-api-call.d.ts +45 -0
- package/esm/browser/extension/web-api-call.js +2 -0
- package/esm/browser/extension/web-api-components.d.ts +37 -2
- package/esm/browser/extension/web-api-contributions.d.ts +2 -31
- package/esm/browser/extension/web-api-partners.d.ts +18 -1
- package/esm/browser/extension/web-extension-api.d.ts +9 -12
- package/esm/browser/extension/web-extension-context.d.ts +2 -3
- package/esm/browser/extension/web-extension-context.js +5 -5
- package/esm/browser/i18n/locales.d.ts +9 -1
- package/esm/browser/i18n/messages-ja.js +8 -0
- package/esm/browser/i18n/messages-zh-tw.js +8 -0
- package/esm/browser/i18n/messages.d.ts +8 -0
- package/esm/browser/i18n/messages.js +16 -0
- package/esm/browser/partners/partners-extension.js +17 -0
- package/esm/browser/style/chat-list.d.ts +1 -1
- package/esm/browser/style/chat-list.js +3 -0
- package/esm/browser/style/conversation-column.d.ts +1 -1
- package/esm/browser/style/conversation-column.js +21 -0
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +2 -2
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +1 -1
- package/esm/browser/util/image-shrink.d.ts +26 -0
- package/esm/browser/util/image-shrink.js +60 -0
- package/esm/browser/util/process.d.ts +7 -3
- package/esm/browser/util/process.js +18 -18
- package/lib/browser/assistant/assistant-conversation.js +1 -1
- package/lib/browser/assistant/assistant-initiative.d.ts +5 -1
- package/lib/browser/assistant/assistant-initiative.js +11 -3
- package/lib/browser/assistant/call-keeper.d.ts +2 -1
- package/lib/browser/assistant/call-keeper.js +4 -2
- package/lib/browser/assistant/call-screen.d.ts +1 -1
- package/lib/browser/assistant/call-turn-end.d.ts +11 -2
- package/lib/browser/assistant/call-turn-end.js +22 -6
- package/lib/browser/assistant/read-aloud.d.ts +1 -1
- package/lib/browser/assistant/realtime-voice.d.ts +1 -1
- package/lib/browser/assistant/voice-call-bar.d.ts +5 -2
- package/lib/browser/assistant/voice-call-bar.js +12 -0
- package/lib/browser/assistant/voice-call-protocol.d.ts +79 -0
- package/lib/browser/assistant/voice-call-protocol.js +3 -0
- package/lib/browser/assistant/voice-call.d.ts +17 -65
- package/lib/browser/assistant/voice-call.js +45 -1
- package/lib/browser/assistant/voice-reopen.d.ts +1 -1
- package/lib/browser/components/account-menu.js +27 -6
- package/lib/browser/components/chat-home.d.ts +3 -1
- package/lib/browser/components/chat-home.js +3 -2
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/earlier-messages.d.ts +4 -0
- package/lib/browser/components/earlier-messages.js +10 -2
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/message-footer.d.ts +0 -2
- package/lib/browser/components/message-footer.js +0 -8
- package/lib/browser/components/message-images.d.ts +22 -0
- package/lib/browser/components/message-images.js +92 -2
- package/lib/browser/components/message-steps.js +9 -0
- package/lib/browser/components/message-user.js +7 -0
- package/lib/browser/components/partner-row-util.d.ts +29 -0
- package/lib/browser/components/partner-row-util.js +48 -0
- package/lib/browser/components/partner-row.d.ts +4 -3
- package/lib/browser/components/partner-row.js +21 -9
- package/lib/browser/components/profile-view.d.ts +2 -2
- package/lib/browser/components/profile-view.js +6 -3
- package/lib/browser/components/web-composer.d.ts +5 -2
- package/lib/browser/components/web-composer.js +10 -5
- package/lib/browser/extension/extension-view.js +2 -2
- package/lib/browser/extension/icons.js +3 -0
- package/lib/browser/extension/web-api-call.d.ts +46 -0
- package/lib/browser/extension/web-api-call.js +3 -0
- package/lib/browser/extension/web-api-components.d.ts +37 -2
- package/lib/browser/extension/web-api-contributions.d.ts +2 -31
- package/lib/browser/extension/web-api-partners.d.ts +18 -1
- package/lib/browser/extension/web-extension-api.d.ts +9 -12
- package/lib/browser/extension/web-extension-context.d.ts +2 -3
- package/lib/browser/extension/web-extension-context.js +5 -5
- package/lib/browser/i18n/locales.d.ts +9 -1
- package/lib/browser/i18n/messages-ja.js +8 -0
- package/lib/browser/i18n/messages-zh-tw.js +8 -0
- package/lib/browser/i18n/messages.d.ts +8 -0
- package/lib/browser/i18n/messages.js +16 -0
- package/lib/browser/partners/partners-extension.js +17 -0
- package/lib/browser/style/chat-list.d.ts +1 -1
- package/lib/browser/style/chat-list.js +3 -0
- package/lib/browser/style/conversation-column.d.ts +1 -1
- package/lib/browser/style/conversation-column.js +21 -0
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +2 -2
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +1 -1
- package/lib/browser/util/image-shrink.d.ts +27 -0
- package/lib/browser/util/image-shrink.js +63 -0
- package/lib/browser/util/process.d.ts +7 -3
- package/lib/browser/util/process.js +18 -18
- package/package.json +7 -7
|
@@ -28,6 +28,11 @@ export declare namespace UserImageUtil {
|
|
|
28
28
|
height: number;
|
|
29
29
|
} | undefined): React.CSSProperties | undefined;
|
|
30
30
|
}
|
|
31
|
+
/** From this many pictures at once, a message shows them stacked, as WeChat does, until the user unfolds them. */
|
|
32
|
+
export declare const STACK_FROM = 4;
|
|
33
|
+
export declare namespace ImageStackUtil {
|
|
34
|
+
function stacked(count: number, key: string | undefined): boolean;
|
|
35
|
+
}
|
|
31
36
|
/**
|
|
32
37
|
* The images of a message of the user: one keeps its own shape at the size of a bubble, a few stand as
|
|
33
38
|
* squares of one size, and a click on any of them opens it full size over the page. Each has its place
|
|
@@ -38,4 +43,21 @@ export declare function UserImages({ blocks, timestamp }: {
|
|
|
38
43
|
blocks: Blocks;
|
|
39
44
|
timestamp?: number;
|
|
40
45
|
}): React.JSX.Element | null;
|
|
46
|
+
/** A picture of a chat of an extension (`ui.ChatImages`): its bytes as a URL once they are here, a thumbnail meanwhile. */
|
|
47
|
+
export interface ChatImage {
|
|
48
|
+
key: string;
|
|
49
|
+
src?: string;
|
|
50
|
+
thumb?: string;
|
|
51
|
+
width: number;
|
|
52
|
+
height: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The pictures of a message of a chat an extension draws (a group chat, a channel), as those of the user in a
|
|
56
|
+
* conversation: one alone in its shape, more in squares, full size over the page on a click, those still on their way
|
|
57
|
+
* blurred from their thumbnail.
|
|
58
|
+
*/
|
|
59
|
+
export declare function ChatImages({ images, alt }: {
|
|
60
|
+
images: readonly ChatImage[];
|
|
61
|
+
alt?: string;
|
|
62
|
+
}): React.JSX.Element | null;
|
|
41
63
|
export {};
|
|
@@ -90,6 +90,38 @@ function useImageSources(images, timestamp) {
|
|
|
90
90
|
});
|
|
91
91
|
return images.map(({ index }, at) => { var _a; return (_a = own[at]) !== null && _a !== void 0 ? _a : loaded[index]; });
|
|
92
92
|
}
|
|
93
|
+
/** From this many pictures at once, a message shows them stacked, as WeChat does, until the user unfolds them. */
|
|
94
|
+
export const STACK_FROM = 4;
|
|
95
|
+
/** The messages whose pictures the user unfolded, by a key of each: they stay unfolded while the page lives. */
|
|
96
|
+
const unfolded = new Set();
|
|
97
|
+
export var ImageStackUtil;
|
|
98
|
+
(function (ImageStackUtil) {
|
|
99
|
+
function stacked(count, key) {
|
|
100
|
+
return count >= STACK_FROM && !(key !== undefined && unfolded.has(key));
|
|
101
|
+
}
|
|
102
|
+
ImageStackUtil.stacked = stacked;
|
|
103
|
+
})(ImageStackUtil || (ImageStackUtil = {}));
|
|
104
|
+
/**
|
|
105
|
+
* Pictures sent together, folded as WeChat folds them: the first in its own shape, two more peeking from behind it, and
|
|
106
|
+
* beside it a pill that unfolds them all (`展开 N`). A tap on the stack opens the first full size, the others beside it.
|
|
107
|
+
*/
|
|
108
|
+
function ImageStack({ sources, first, count, onOpen, onUnfold, }) {
|
|
109
|
+
var _a;
|
|
110
|
+
const t = useT();
|
|
111
|
+
const box = (_a = UserImageUtil.box(first)) !== null && _a !== void 0 ? _a : { width: 160, aspectRatio: '4 / 3' };
|
|
112
|
+
const card = (at, className) => sources[at] ? React.createElement("img", { className: className, src: sources[at], alt: "", style: box }) : React.createElement("span", { className: `${className} ta-thumb-waiting`, style: box });
|
|
113
|
+
return (React.createElement("div", { className: "ta-image-stack" },
|
|
114
|
+
React.createElement("button", { type: "button", className: "ta-stack-unfold", onClick: onUnfold }, t('ta.images.expand', { count })),
|
|
115
|
+
React.createElement("button", { type: "button", className: "ta-stack-cards", title: t('ta.markdown.enlarge'), disabled: !sources[0], onClick: onOpen },
|
|
116
|
+
card(2, 'ta-stack-card ta-stack-right'),
|
|
117
|
+
card(1, 'ta-stack-card ta-stack-left'),
|
|
118
|
+
card(0, 'ta-stack-card ta-stack-front'))));
|
|
119
|
+
}
|
|
120
|
+
/** Folds pictures unfolded before, under the grid of them. */
|
|
121
|
+
function FoldButton({ onFold }) {
|
|
122
|
+
const t = useT();
|
|
123
|
+
return (React.createElement("button", { type: "button", className: "ta-stack-fold", onClick: onFold }, t('ta.images.collapse')));
|
|
124
|
+
}
|
|
93
125
|
/**
|
|
94
126
|
* The images of a message of the user: one keeps its own shape at the size of a bubble, a few stand as
|
|
95
127
|
* squares of one size, and a click on any of them opens it full size over the page. Each has its place
|
|
@@ -102,11 +134,26 @@ export function UserImages({ blocks, timestamp }) {
|
|
|
102
134
|
const [menu, openMenu] = useImageMenu();
|
|
103
135
|
const images = UserImageUtil.images(blocks);
|
|
104
136
|
const sources = useImageSources(images, timestamp);
|
|
137
|
+
const fold = timestamp === undefined ? undefined : `user:${timestamp}`;
|
|
138
|
+
const [, redraw] = React.useReducer((n) => n + 1, 0);
|
|
105
139
|
if (images.length === 0) {
|
|
106
140
|
return null;
|
|
107
141
|
}
|
|
108
142
|
const single = images.length === 1 ? UserImageUtil.box(UserImageUtil.size(images[0].block)) : undefined;
|
|
109
143
|
const shown = open !== undefined ? sources[open] : undefined;
|
|
144
|
+
const lightbox = open !== undefined && shown && (React.createElement(Lightbox, { src: shown, alt: "", count: { at: open, of: images.length }, onClose: () => setOpen(undefined), onPrevious: open > 0 && sources[open - 1] ? () => setOpen(open - 1) : undefined, onNext: open < images.length - 1 && sources[open + 1] ? () => setOpen(open + 1) : undefined, previousSrc: open > 0 ? sources[open - 1] : undefined, nextSrc: sources[open + 1] }));
|
|
145
|
+
if (ImageStackUtil.stacked(images.length, fold)) {
|
|
146
|
+
return (React.createElement(React.Fragment, null,
|
|
147
|
+
React.createElement(ImageStack, { sources: sources, first: UserImageUtil.size(images[0].block), count: images.length, onOpen: () => setOpen(0), onUnfold: () => {
|
|
148
|
+
unfolded.add(fold !== null && fold !== void 0 ? fold : '');
|
|
149
|
+
redraw();
|
|
150
|
+
} }),
|
|
151
|
+
lightbox));
|
|
152
|
+
}
|
|
153
|
+
const folding = images.length >= STACK_FROM && fold ? (React.createElement(FoldButton, { onFold: () => {
|
|
154
|
+
unfolded.delete(fold);
|
|
155
|
+
redraw();
|
|
156
|
+
} })) : null;
|
|
110
157
|
return (React.createElement("div", { className: "ta-user-images", "data-count": Math.min(images.length, 3), style: { '--ta-user-image-columns': GalleryUtil.columns(images.length) } },
|
|
111
158
|
images.map(({ index }, at) => (React.createElement("button", { key: index, type: "button", className: "ta-user-image", title: t('ta.markdown.enlarge'), disabled: !sources[at], onClick: () => setOpen(at), onContextMenu: event => {
|
|
112
159
|
const source = sources[at];
|
|
@@ -115,6 +162,48 @@ export function UserImages({ blocks, timestamp }) {
|
|
|
115
162
|
}
|
|
116
163
|
} }, sources[at] ? (React.createElement("img", { className: "ta-thumb", src: sources[at], alt: "", style: single })) : (React.createElement("span", { className: "ta-thumb ta-thumb-waiting", style: single }))))),
|
|
117
164
|
menu,
|
|
118
|
-
|
|
165
|
+
lightbox,
|
|
166
|
+
folding));
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* The pictures of a message of a chat an extension draws (a group chat, a channel), as those of the user in a
|
|
170
|
+
* conversation: one alone in its shape, more in squares, full size over the page on a click, those still on their way
|
|
171
|
+
* blurred from their thumbnail.
|
|
172
|
+
*/
|
|
173
|
+
export function ChatImages({ images, alt = '' }) {
|
|
174
|
+
var _a, _b, _c, _d, _e;
|
|
175
|
+
const t = useT();
|
|
176
|
+
const [open, setOpen] = React.useState();
|
|
177
|
+
const [menu, openMenu] = useImageMenu();
|
|
178
|
+
const [, redraw] = React.useReducer((n) => n + 1, 0);
|
|
179
|
+
if (images.length === 0) {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
const fold = `chat:${images[0].key}`;
|
|
183
|
+
const single = images.length === 1 ? UserImageUtil.box({ width: images[0].width, height: images[0].height }) : undefined;
|
|
184
|
+
const shown = open !== undefined ? (_a = images[open]) === null || _a === void 0 ? void 0 : _a.src : undefined;
|
|
185
|
+
const lightbox = open !== undefined && shown && (React.createElement(Lightbox, { src: shown, alt: alt, count: { at: open, of: images.length }, onClose: () => setOpen(undefined), onPrevious: open > 0 && ((_b = images[open - 1]) === null || _b === void 0 ? void 0 : _b.src) ? () => setOpen(open - 1) : undefined, onNext: open < images.length - 1 && ((_c = images[open + 1]) === null || _c === void 0 ? void 0 : _c.src) ? () => setOpen(open + 1) : undefined, previousSrc: open > 0 ? (_d = images[open - 1]) === null || _d === void 0 ? void 0 : _d.src : undefined, nextSrc: (_e = images[open + 1]) === null || _e === void 0 ? void 0 : _e.src }));
|
|
186
|
+
if (ImageStackUtil.stacked(images.length, fold)) {
|
|
187
|
+
return (React.createElement(React.Fragment, null,
|
|
188
|
+
React.createElement(ImageStack, { sources: images.map(image => { var _a; return (_a = image.src) !== null && _a !== void 0 ? _a : image.thumb; }), first: { width: images[0].width, height: images[0].height }, count: images.length, onOpen: () => setOpen(0), onUnfold: () => {
|
|
189
|
+
unfolded.add(fold);
|
|
190
|
+
redraw();
|
|
191
|
+
} }),
|
|
192
|
+
lightbox));
|
|
193
|
+
}
|
|
194
|
+
return (React.createElement("div", { className: "ta-user-images ta-chat-images", "data-count": Math.min(images.length, 3), style: { '--ta-user-image-columns': GalleryUtil.columns(images.length) } },
|
|
195
|
+
images.map((image, at) => (React.createElement("button", { key: image.key, type: "button", className: "ta-user-image", title: image.src ? t('ta.markdown.enlarge') : alt, disabled: !image.src, onClick: () => setOpen(at), onContextMenu: event => {
|
|
196
|
+
const source = image.src;
|
|
197
|
+
if (source) {
|
|
198
|
+
openMenu(event, { full: () => source, enlarge: () => setOpen(at) });
|
|
199
|
+
}
|
|
200
|
+
} }, image.src ? (React.createElement("img", { className: "ta-thumb", src: image.src, alt: alt, style: single })) : image.thumb ? (React.createElement("span", { className: "ta-thumb ta-thumb-blurred", style: single },
|
|
201
|
+
React.createElement("img", { src: image.thumb, alt: "" }))) : (React.createElement("span", { className: "ta-thumb ta-thumb-waiting", style: single }))))),
|
|
202
|
+
menu,
|
|
203
|
+
lightbox,
|
|
204
|
+
images.length >= STACK_FROM && (React.createElement(FoldButton, { onFold: () => {
|
|
205
|
+
unfolded.delete(fold);
|
|
206
|
+
redraw();
|
|
207
|
+
} }))));
|
|
119
208
|
}
|
|
120
209
|
//# sourceMappingURL=message-images.js.map
|
|
@@ -48,6 +48,13 @@ const SaidStep = React.memo(function SaidStep({ message }) {
|
|
|
48
48
|
React.createElement(MessageOrigin, { blocks: blocks })),
|
|
49
49
|
React.createElement(UserSaid, { blocks: blocks, text: text, bubble: "ta-said-bubble", timestamp: message.timestamp })));
|
|
50
50
|
});
|
|
51
|
+
/** Where Ta restarted in the middle of the work and went on with it: one quiet line on the string of the steps. */
|
|
52
|
+
function ResumedStep() {
|
|
53
|
+
const t = useT();
|
|
54
|
+
return (React.createElement("div", { className: "ta-step-resumed" },
|
|
55
|
+
React.createElement("span", { className: "ta-status ta-status-thought" }),
|
|
56
|
+
React.createElement("span", null, t('ta.message.resumed'))));
|
|
57
|
+
}
|
|
51
58
|
const TextStep = React.memo(function TextStep({ text, streaming }) {
|
|
52
59
|
return (React.createElement("div", { className: "ta-step-text" },
|
|
53
60
|
React.createElement("span", { className: "ta-status ta-status-thought" }),
|
|
@@ -65,6 +72,8 @@ function Step({ step, results, tools, tagged, streaming, }) {
|
|
|
65
72
|
return React.createElement(ErrorStep, { text: step.text });
|
|
66
73
|
case 'said':
|
|
67
74
|
return React.createElement(SaidStep, { message: step.message });
|
|
75
|
+
case 'resumed':
|
|
76
|
+
return React.createElement(ResumedStep, null);
|
|
68
77
|
default:
|
|
69
78
|
return React.createElement(ActView, { act: step, results: results, runs: tools });
|
|
70
79
|
}
|
|
@@ -10,7 +10,7 @@ import { Face } from './face.js';
|
|
|
10
10
|
import { Icon } from './icon.js';
|
|
11
11
|
import { Markdown } from './markdown.js';
|
|
12
12
|
import { UserFooter } from './message-footer.js';
|
|
13
|
-
import { UserImages, UserImageUtil } from './message-images.js';
|
|
13
|
+
import { STACK_FROM, UserImages, UserImageUtil } from './message-images.js';
|
|
14
14
|
import { useMessageMenu } from './message-menu.js';
|
|
15
15
|
import { MessagePeople } from './people.js';
|
|
16
16
|
import { SaidText } from './said-text.js';
|
|
@@ -50,6 +50,13 @@ export function UserSaid({ blocks, text, bubble = 'ta-bubble', timestamp }) {
|
|
|
50
50
|
return text ? (React.createElement("div", { className: bubble },
|
|
51
51
|
React.createElement(SaidText, { text: text }))) : null;
|
|
52
52
|
}
|
|
53
|
+
// Many pictures stand on their own (folded, ImageStack, or unfolded), the words in a bubble of their own under them.
|
|
54
|
+
if (UserImageUtil.images(blocks).length >= STACK_FROM) {
|
|
55
|
+
return (React.createElement(React.Fragment, null,
|
|
56
|
+
React.createElement(UserImages, { blocks: blocks, timestamp: timestamp }),
|
|
57
|
+
text && (React.createElement("div", { className: bubble },
|
|
58
|
+
React.createElement(SaidText, { text: text })))));
|
|
59
|
+
}
|
|
53
60
|
return (React.createElement("div", { className: `${bubble} ta-bubble-media${text ? '' : ' ta-bubble-bare'}` },
|
|
54
61
|
React.createElement(UserImages, { blocks: blocks, timestamp: timestamp }),
|
|
55
62
|
text && React.createElement(SaidText, { text: text, className: "ta-bubble-text" })));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { WebSwipeAction } from '../extension/web-api-components.js';
|
|
2
|
+
import type { WebMenuItem } from '../extension/web-api-contributions.js';
|
|
3
|
+
import type { WebPartner, WebPartnerKind } from '../extension/web-api-partners.js';
|
|
4
|
+
import type { MessageId } from '../i18n/messages.js';
|
|
5
|
+
/** An action of a row, as its menu and its swipe take it. */
|
|
6
|
+
interface RowAction {
|
|
7
|
+
label: string;
|
|
8
|
+
/** Behind the row, where the label is too long. */
|
|
9
|
+
short?: string;
|
|
10
|
+
run(): void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* What a partner's row offers, the same for every kind (docs/design/ta-partners.md): its menu is Open, Pin (a
|
|
14
|
+
* conversation of the double's list), its info; then its own; then what takes it away, in red. A swipe shows the first
|
|
15
|
+
* of these and that last: Pin and Delete chat in the double's list, Info and Remove on the page of the partners.
|
|
16
|
+
*/
|
|
17
|
+
export declare namespace PartnerRowUtil {
|
|
18
|
+
function infoLabel(kind: WebPartnerKind): MessageId;
|
|
19
|
+
function infoShort(kind: WebPartnerKind): MessageId;
|
|
20
|
+
/**
|
|
21
|
+
* What takes it away where it is listed: in the double's list its conversation (a chat of two closed; a group chat
|
|
22
|
+
* left, its conversation being all of it); among the partners, the partner. None for one not a partner yet.
|
|
23
|
+
*/
|
|
24
|
+
function away(partner: Pick<WebPartner, 'kind' | 'status' | 'chat' | 'remove'>, asChat: boolean): WebMenuItem | undefined;
|
|
25
|
+
/** Behind the row: Pin or Info first, what takes it away at the edge, in red. */
|
|
26
|
+
function swipe(pin: RowAction | undefined, info: RowAction | undefined, away: WebMenuItem | undefined): WebSwipeAction[];
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a partner's row offers, the same for every kind (docs/design/ta-partners.md): its menu is Open, Pin (a
|
|
3
|
+
* conversation of the double's list), its info; then its own; then what takes it away, in red. A swipe shows the first
|
|
4
|
+
* of these and that last: Pin and Delete chat in the double's list, Info and Remove on the page of the partners.
|
|
5
|
+
*/
|
|
6
|
+
export var PartnerRowUtil;
|
|
7
|
+
(function (PartnerRowUtil) {
|
|
8
|
+
const INFO = {
|
|
9
|
+
agent: 'ta.partners.infoAgent',
|
|
10
|
+
friend: 'ta.partners.infoFriend',
|
|
11
|
+
group: 'ta.partners.infoGroup',
|
|
12
|
+
};
|
|
13
|
+
function infoLabel(kind) {
|
|
14
|
+
return INFO[kind];
|
|
15
|
+
}
|
|
16
|
+
PartnerRowUtil.infoLabel = infoLabel;
|
|
17
|
+
function infoShort(kind) {
|
|
18
|
+
return kind === 'group' ? 'ta.partners.infoShortGroup' : 'ta.partners.infoShort';
|
|
19
|
+
}
|
|
20
|
+
PartnerRowUtil.infoShort = infoShort;
|
|
21
|
+
/**
|
|
22
|
+
* What takes it away where it is listed: in the double's list its conversation (a chat of two closed; a group chat
|
|
23
|
+
* left, its conversation being all of it); among the partners, the partner. None for one not a partner yet.
|
|
24
|
+
*/
|
|
25
|
+
function away(partner, asChat) {
|
|
26
|
+
var _a;
|
|
27
|
+
var _b;
|
|
28
|
+
if (partner.status) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
if (asChat) {
|
|
32
|
+
return (_b = (_a = partner.chat) === null || _a === void 0 ? void 0 : _a.close) !== null && _b !== void 0 ? _b : (partner.kind === 'group' ? partner.remove : undefined);
|
|
33
|
+
}
|
|
34
|
+
return partner.remove;
|
|
35
|
+
}
|
|
36
|
+
PartnerRowUtil.away = away;
|
|
37
|
+
/** Behind the row: Pin or Info first, what takes it away at the edge, in red. */
|
|
38
|
+
function swipe(pin, info, away) {
|
|
39
|
+
var _a;
|
|
40
|
+
const first = pin ? { key: 'pin', label: pin.label, run: pin.run } : info ? { key: 'info', label: (_a = info.short) !== null && _a !== void 0 ? _a : info.label, run: info.run } : undefined;
|
|
41
|
+
return [...(first ? [first] : []), ...(away ? [{ key: `away-${away.key}`, label: away.label, danger: true, run: away.run }] : [])];
|
|
42
|
+
}
|
|
43
|
+
PartnerRowUtil.swipe = swipe;
|
|
44
|
+
})(PartnerRowUtil || (PartnerRowUtil = {}));
|
|
45
|
+
//# sourceMappingURL=partner-row-util.js.map
|
|
@@ -2,9 +2,10 @@ import * as React from 'react';
|
|
|
2
2
|
import type { WebPartnerEntry } from '../extension/web-api-partners.js';
|
|
3
3
|
/**
|
|
4
4
|
* A partner (docs/design/ta-partners.md), the same row wherever it is: on the page of the partners as a contact, in the
|
|
5
|
-
* double's list as a conversation. Its face (or its icon on a tile of its tint), its name, what was said
|
|
6
|
-
* what it is), when; an amber dot for what the user has not seen or one asking, a blue ? while it waits for
|
|
7
|
-
* spinner while it answers. Its menu
|
|
5
|
+
* double's list as a conversation (`onPin` given). Its face (or its icon on a tile of its tint), its name, what was said
|
|
6
|
+
* last (else what it is), when; an amber dot for what the user has not seen or one asking, a blue ? while it waits for
|
|
7
|
+
* them, a spinner while it answers. Its menu (a right click, a long press) and what a swipe shows behind it are the
|
|
8
|
+
* same for every kind (PartnerRowUtil).
|
|
8
9
|
*/
|
|
9
10
|
export declare function PartnerRow({ partner, time, selected, open, pinned, onPin, }: {
|
|
10
11
|
partner: WebPartnerEntry;
|
|
@@ -6,12 +6,14 @@ import { ChatHomeUtil } from './chat-home-util.js';
|
|
|
6
6
|
import { ChatDot } from './chat-list-row.js';
|
|
7
7
|
import { ContextMenuUtil, useContextMenu } from './context-menu.js';
|
|
8
8
|
import { HostTag } from './host-tag.js';
|
|
9
|
+
import { PartnerRowUtil } from './partner-row-util.js';
|
|
9
10
|
import { SwipeRow } from './swipe-row.js';
|
|
10
11
|
/**
|
|
11
12
|
* A partner (docs/design/ta-partners.md), the same row wherever it is: on the page of the partners as a contact, in the
|
|
12
|
-
* double's list as a conversation. Its face (or its icon on a tile of its tint), its name, what was said
|
|
13
|
-
* what it is), when; an amber dot for what the user has not seen or one asking, a blue ? while it waits for
|
|
14
|
-
* spinner while it answers. Its menu
|
|
13
|
+
* double's list as a conversation (`onPin` given). Its face (or its icon on a tile of its tint), its name, what was said
|
|
14
|
+
* last (else what it is), when; an amber dot for what the user has not seen or one asking, a blue ? while it waits for
|
|
15
|
+
* them, a spinner while it answers. Its menu (a right click, a long press) and what a swipe shows behind it are the
|
|
16
|
+
* same for every kind (PartnerRowUtil).
|
|
15
17
|
*/
|
|
16
18
|
export function PartnerRow({ partner, time, selected, open, pinned, onPin, }) {
|
|
17
19
|
var _a, _b;
|
|
@@ -29,12 +31,22 @@ export function PartnerRow({ partner, time, selected, open, pinned, onPin, }) {
|
|
|
29
31
|
.finally(() => setOpening(false));
|
|
30
32
|
};
|
|
31
33
|
const pin = onPin && { label: t(pinned ? 'ta.chat.unpin' : 'ta.chat.pin'), run: () => onPin(!pinned) };
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
// Opened as the row opens what it is (TaWebExtensions.openHome): a page it shows is the row's, as its conversation is.
|
|
35
|
+
const info = partner.info && {
|
|
36
|
+
label: t(PartnerRowUtil.infoLabel(partner.kind)),
|
|
37
|
+
short: t(PartnerRowUtil.infoShort(partner.kind)),
|
|
38
|
+
run: () => void open({ ...partner, open: () => { var _a; return (_a = partner.info) === null || _a === void 0 ? void 0 : _a.call(partner); } }).catch(error => console.error(`The info of a partner of ${partner.extension} failed to open:`, error)),
|
|
39
|
+
};
|
|
40
|
+
const away = PartnerRowUtil.away(partner, !!onPin);
|
|
41
|
+
const swipe = PartnerRowUtil.swipe(pin, info, away);
|
|
42
|
+
return (React.createElement(SwipeRow, { as: "li", className: `ta-chat-row ta-partner-row${selected ? ' ta-selected' : ''}`, "data-unseen": unseen && !asks ? '' : undefined, "data-asks": asks ? '' : undefined, actions: swipe.length ? swipe : undefined, overlay: menu, onContextMenu: event => {
|
|
43
|
+
const own = partner.menu ? ChatHomeUtil.menu(partner.menu()) : [];
|
|
44
|
+
const first = [{ label: t('ta.chat.open'), run: go }, ...(pin ? [pin] : []), ...(info ? [{ label: info.label, run: info.run }] : [])];
|
|
45
|
+
const last = away ? [{ label: away.label, run: away.run, danger: true }] : [];
|
|
35
46
|
openMenu(event, [
|
|
36
|
-
...ContextMenuUtil.sections(
|
|
37
|
-
...(
|
|
47
|
+
...ContextMenuUtil.sections(first),
|
|
48
|
+
...(own.length ? ['-', ...own] : []),
|
|
49
|
+
...(last.length ? ['-', ...last] : []),
|
|
38
50
|
]);
|
|
39
51
|
} },
|
|
40
52
|
React.createElement("button", { type: "button", className: "ta-chat-item", title: partner.name, "aria-current": selected ? 'true' : undefined, onClick: go },
|
|
@@ -43,6 +55,6 @@ export function PartnerRow({ partner, time, selected, open, pinned, onPin, }) {
|
|
|
43
55
|
React.createElement(Own, { size: 38 }))) : (React.createElement("span", { className: "ta-chat-avatar ta-chat-icon", style: { background: `var(--ta-tint-${partner.tone})`, color: `var(--ta-tint-ink-${partner.tone})`, width: 38, height: 38 }, "aria-hidden": "true" }, opening ? React.createElement("span", { className: "ta-spinner" }) : React.createElement(Glyph, { size: 18, strokeWidth: 1.8 }))),
|
|
44
56
|
partner.online && React.createElement("span", { className: "ta-partner-online", "aria-hidden": "true" }),
|
|
45
57
|
React.createElement(ChatDot, { unseen: unseen, asks: asks })),
|
|
46
|
-
React.createElement(RowText, { title: partner.name, time: time, line: PartnersUtil.line(partner, t('ta.partners.waiting')), unseen: unseen, busy: !partner.status && !!((_b = partner.chat) === null || _b === void 0 ? void 0 : _b.busy), tag: partner.location ? React.createElement(HostTag, { location: partner.location }) : undefined }))));
|
|
58
|
+
React.createElement(RowText, { title: partner.name, time: time, line: PartnersUtil.line(partner, t('ta.partners.waiting')), unseen: unseen, busy: !partner.status && !!((_b = partner.chat) === null || _b === void 0 ? void 0 : _b.busy), tag: partner.location ? React.createElement(HostTag, { location: partner.location }) : undefined, badge: partner.friends ? t('ta.partners.withFriends') : undefined }))));
|
|
47
59
|
}
|
|
48
60
|
//# sourceMappingURL=partner-row.js.map
|
|
@@ -2,8 +2,8 @@ import type { TaIdentity } from '@celljs/ta-protocol';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
/** The identity of the computer in use, its name and picture: read once connected, and again when it changes. */
|
|
4
4
|
export declare function useIdentity(): TaIdentity | undefined;
|
|
5
|
-
/** The account in use as a line: "Company account · su"
|
|
6
|
-
export declare function useAccountLine(): string | undefined;
|
|
5
|
+
/** The account in use as a line: "Company account · su"; null while signed out, undefined until read. */
|
|
6
|
+
export declare function useAccountLine(): string | null | undefined;
|
|
7
7
|
/** The profile, over the page: the picture, the name, and the account, which opens My devices. */
|
|
8
8
|
export declare function ProfileDialog({ onClose, onDevices }: {
|
|
9
9
|
onClose(): void;
|
|
@@ -38,12 +38,15 @@ export function useIdentity() {
|
|
|
38
38
|
}, [online, workbench]);
|
|
39
39
|
return identity;
|
|
40
40
|
}
|
|
41
|
-
/** The account in use as a line: "Company account · su"
|
|
41
|
+
/** The account in use as a line: "Company account · su"; null while signed out, undefined until read. */
|
|
42
42
|
export function useAccountLine() {
|
|
43
43
|
const side = useAccountSide();
|
|
44
|
-
const { info } = useAccountInfo(side, 15000);
|
|
44
|
+
const { info, failed } = useAccountInfo(side, 15000);
|
|
45
45
|
const way = useAccountWay();
|
|
46
|
-
|
|
46
|
+
if ((info === null || info === void 0 ? void 0 : info.account) && !info.waiting) {
|
|
47
|
+
return `${way(info.account.id)} · ${accountName(info.account)}`;
|
|
48
|
+
}
|
|
49
|
+
return info || failed ? null : undefined;
|
|
47
50
|
}
|
|
48
51
|
/** The profile, over the page: the picture, the name, and the account, which opens My devices. */
|
|
49
52
|
export function ProfileDialog({ onClose, onDevices }) {
|
|
@@ -15,5 +15,8 @@ export interface WebComposerHostProps extends WebComposerProps {
|
|
|
15
15
|
/** The hosts of ssh, which the button offers too. */
|
|
16
16
|
remote?: FolderPickerRemote;
|
|
17
17
|
}
|
|
18
|
-
/**
|
|
19
|
-
|
|
18
|
+
/**
|
|
19
|
+
* The message box as web extensions get it (`pi.ui.Composer`): text, and pictures when it takes them (shrunk within
|
|
20
|
+
* the limits given), `@` for the names they give; a failure is a notice of the page.
|
|
21
|
+
*/
|
|
22
|
+
export declare function WebComposer({ notices, placeholder, onSend, images, mentions, mentionLabel, actions, cwd, onPickCwd, commands, working, onStop, voiceSends, onTalkSent, onListening, after, draft, server, listDirectory, serverCwd, remote, }: WebComposerHostProps): React.JSX.Element;
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useLanguage, useT } from '../i18n/use-t.js';
|
|
3
3
|
import { ComposerUtil } from '../util/composer.js';
|
|
4
|
+
import { ImageShrink } from '../util/image-shrink.js';
|
|
4
5
|
import { ComposerAddonUtil } from './composer-addon-util.js';
|
|
5
6
|
import { ComposerBox } from './composer-box.js';
|
|
6
7
|
import { useDirectoryCommands } from './directory-commands.js';
|
|
7
8
|
import { DirectoryButton } from './folder-picker.js';
|
|
8
|
-
/**
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The message box as web extensions get it (`pi.ui.Composer`): text, and pictures when it takes them (shrunk within
|
|
11
|
+
* the limits given), `@` for the names they give; a failure is a notice of the page.
|
|
12
|
+
*/
|
|
13
|
+
export function WebComposer({ notices, placeholder, onSend, images, mentions, mentionLabel, actions, cwd, onPickCwd, commands, working, onStop, voiceSends, onTalkSent, onListening, after, draft, server, listDirectory, serverCwd, remote, }) {
|
|
10
14
|
const t = useT();
|
|
11
15
|
const language = useLanguage();
|
|
12
16
|
const [query, setQuery] = React.useState();
|
|
13
17
|
const found = useDirectoryCommands(server, commands ? cwd || serverCwd : undefined);
|
|
14
18
|
const listed = React.useMemo(() => found.map(command => ({ name: command.name, description: ComposerUtil.commandDescription(command, language, t) })), [found, language, t]);
|
|
15
|
-
return (React.createElement(ComposerBox, { placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t('ta.composer.label'), onSend: async (text) => {
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
return (React.createElement(ComposerBox, { placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t('ta.composer.label'), onSend: async (text, attached) => {
|
|
20
|
+
const limits = typeof images === 'object' ? images : undefined;
|
|
21
|
+
await onSend(text, limits ? await Promise.all(attached.map(image => ImageShrink.shrink(image, limits))) : attached);
|
|
22
|
+
}, images: !!images, commands: listed, onMentionQuery: mentions ? setQuery : undefined, mentions: mentions && query !== undefined
|
|
18
23
|
? {
|
|
19
24
|
items: ComposerUtil.commands(mentions, query).map(mention => ({
|
|
20
25
|
key: mention.name,
|
|
@@ -2,7 +2,6 @@ import { TA_RESUME_MESSAGE } from '@celljs/ta-protocol';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Callout } from '../components/callout.js';
|
|
4
4
|
import { Markdown } from '../components/markdown.js';
|
|
5
|
-
import { ResumeBreak } from '../components/message-footer.js';
|
|
6
5
|
import { useT } from '../i18n/use-t.js';
|
|
7
6
|
import { MessageUtil } from '../util/message.js';
|
|
8
7
|
/** The renderers of custom messages that web extensions registered. */
|
|
@@ -49,8 +48,9 @@ function ExtensionError({ name, error }) {
|
|
|
49
48
|
/** A custom message of pi: with the renderer of its type, or as text when it is to be shown. */
|
|
50
49
|
export function CustomMessage({ message }) {
|
|
51
50
|
const Renderer = React.useContext(MessageRenderers)[message.customType];
|
|
51
|
+
// A step of the turn it went on with (ProcessUtil.items), not a message of its own.
|
|
52
52
|
if (message.customType === TA_RESUME_MESSAGE) {
|
|
53
|
-
return
|
|
53
|
+
return null;
|
|
54
54
|
}
|
|
55
55
|
if (Renderer) {
|
|
56
56
|
return (React.createElement(ExtensionBoundary, { name: message.customType, resetKey: Renderer },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlarmClock, Aperture, ArrowDown, ArrowLeft, ArrowRight, ArrowUp, ArrowUpDown, Bell, BellOff, BookOpen, Bot, Box, Bug, Building2, Calendar, CaseSensitive, ChartSpline, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsDownUp, ChevronsUpDown, ChevronUp, Circle, CircleAlert, CircleArrowRight, CircleHelp, Clipboard, ClipboardPaste, Clock, Cloud, Code, Coins, Columns2, Contact, Copy, CopyMinus, CornerDownRight, CornerUpLeft, Cpu, Crown, Database, Download, Ellipsis, ExternalLink, Eye, File, FileArchive, FileDiff, FilePlus, Files, FileText, Film, FlaskConical, Folder, FolderInput, FolderOpen, FolderPlus, FolderSearch, FolderTree, Forward, Gamepad2, Gauge, GitBranch, GitCommitHorizontal, Globe, Grip, HardDrive, Hash, Heart, House, Image, ImagePlus, Info, Keyboard, KeyRound, Laptop, LayoutDashboard, Lightbulb, Link, List, ListChecks, ListTodo, ListTree, ListX, LoaderCircle, LocateFixed, Lock, MapIcon, Maximize, Megaphone, MemoryStick, MessageCircle, MessageSquareDot, MessageSquareText, MessagesSquare, Mic, Minus, Monitor, MonitorSmartphone, MousePointer2, MousePointerClick, Package, PackageOpen, Paperclip, Pencil, Phone, Pin, PinOff, Play, Plus, Pointer, Power, Puzzle, QrCode, Radar, RefreshCw, Regex, Replace, ReplaceAll, Rocket, RotateCcw, Rows2, Save, ScanLine, ScrollText, Search, Send, Server, Share2, Shield, ShieldCheck, SlidersHorizontal, Smartphone, Sparkles, Square, SquareMinus, SquarePlus, SquareTerminal, Star, StarOff, Store, Target, Text, Timer, Trash2, TrendingDown, TrendingUp, Trophy, Undo2, Unplug, Upload, User, UserPlus, Users, Volume2, WholeWord, Wrench, X, Zap, } from 'lucide-react';
|
|
1
|
+
import { AlarmClock, Aperture, ArrowDown, ArrowLeft, ArrowRight, ArrowUp, ArrowUpDown, Bell, BellOff, BookOpen, Bot, Box, Bug, Building2, Calendar, CaseSensitive, ChartSpline, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsDownUp, ChevronsUpDown, ChevronUp, Circle, CircleAlert, CircleArrowRight, CircleHelp, Clipboard, ClipboardPaste, Clock, Cloud, Code, Coins, Columns2, Contact, Copy, CopyMinus, CornerDownRight, CornerUpLeft, Cpu, Crown, Database, Download, Ellipsis, ExternalLink, Eye, File, FileArchive, FileDiff, FilePlus, Files, FileText, Film, FlaskConical, Folder, FolderInput, FolderOpen, FolderPlus, FolderSearch, FolderTree, Forward, Gamepad2, Gauge, GitBranch, GitCommitHorizontal, Globe, Grip, HardDrive, Hash, Heart, House, Image, ImagePlus, Info, Keyboard, KeyRound, Laptop, LayoutDashboard, Lightbulb, Link, List, ListChecks, ListTodo, ListTree, ListX, LoaderCircle, LocateFixed, Lock, MapIcon, Maximize, Maximize2, Megaphone, MemoryStick, MessageCircle, MessageSquareDot, MessageSquareText, MessagesSquare, Mic, Minimize2, Minus, Monitor, MonitorSmartphone, MousePointer2, MousePointerClick, Package, PackageOpen, Paperclip, Pencil, Phone, Pin, PinOff, Play, Plus, Pointer, Power, Puzzle, QrCode, Radar, RefreshCw, Regex, Replace, ReplaceAll, Rocket, RotateCcw, Rows2, Save, Scan, ScanLine, ScrollText, Search, Send, Server, Share2, Shield, ShieldCheck, SlidersHorizontal, Smartphone, Sparkles, Square, SquareMinus, SquarePlus, SquareTerminal, Star, StarOff, Store, Target, Text, Timer, Trash2, TrendingDown, TrendingUp, Trophy, Undo2, Unplug, Upload, User, UserPlus, Users, Volume2, WholeWord, Wrench, X, Zap, } from 'lucide-react';
|
|
2
2
|
/** The icons a web extension gets as `pi.ui.icons`; names are lucide's. Only add: removing one breaks extensions. */
|
|
3
3
|
export const WEB_ICONS = Object.freeze({
|
|
4
4
|
AlarmClock,
|
|
@@ -92,6 +92,7 @@ export const WEB_ICONS = Object.freeze({
|
|
|
92
92
|
Lock,
|
|
93
93
|
Map: MapIcon,
|
|
94
94
|
Maximize,
|
|
95
|
+
Maximize2,
|
|
95
96
|
Megaphone,
|
|
96
97
|
MemoryStick,
|
|
97
98
|
MessageCircle,
|
|
@@ -99,6 +100,7 @@ export const WEB_ICONS = Object.freeze({
|
|
|
99
100
|
MessageSquareText,
|
|
100
101
|
MessagesSquare,
|
|
101
102
|
Mic,
|
|
103
|
+
Minimize2,
|
|
102
104
|
Minus,
|
|
103
105
|
Monitor,
|
|
104
106
|
MonitorSmartphone,
|
|
@@ -126,6 +128,7 @@ export const WEB_ICONS = Object.freeze({
|
|
|
126
128
|
RotateCcw,
|
|
127
129
|
Rows2,
|
|
128
130
|
Save,
|
|
131
|
+
Scan,
|
|
129
132
|
ScanLine,
|
|
130
133
|
ScrollText,
|
|
131
134
|
Search,
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** The conversation a call is with (WebCallPartner.open). */
|
|
2
|
+
export interface WebCallTarget {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
sessionFile?: string;
|
|
5
|
+
cwd?: string;
|
|
6
|
+
/** The conversation of the double, which hands out tasks of its own. */
|
|
7
|
+
double: boolean;
|
|
8
|
+
/** The language the user speaks in the call. */
|
|
9
|
+
language: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Who answers in a call in place of the conversation (WebExtensionAPI.registerCallPartner): a front that talks at
|
|
13
|
+
* once, whatever the conversation does, and hands it the work (docs/design/ta-call.md).
|
|
14
|
+
*/
|
|
15
|
+
export interface WebCallPartner {
|
|
16
|
+
/** Its side of a call with the conversation; undefined to leave the call to the conversation itself. */
|
|
17
|
+
open(target: WebCallTarget): Promise<WebCallSession | undefined>;
|
|
18
|
+
}
|
|
19
|
+
/** A call as its partner answers it, from when it starts until it ends. */
|
|
20
|
+
export interface WebCallSession {
|
|
21
|
+
/** What the user said; the reply to say. `sent`: it went to the conversation already, as it began the call. */
|
|
22
|
+
say(text: string, options?: {
|
|
23
|
+
sent?: boolean;
|
|
24
|
+
}): Promise<string | undefined>;
|
|
25
|
+
/**
|
|
26
|
+
* What the user said so far, as they paused where they may be done: the partner answers it at once, to be said only
|
|
27
|
+
* if they were done (`keep`), dropped as they say more (`drop`), doing nothing until kept (docs/design/ta-call.md
|
|
28
|
+
* 10). Newer than some partners.
|
|
29
|
+
*/
|
|
30
|
+
draft?(text: string): WebCallDraft;
|
|
31
|
+
/** Whether the partner ended the call (asked to hang up): it ends once its last reply is said. */
|
|
32
|
+
ending?(): boolean;
|
|
33
|
+
/** What the partner says by itself (news of the work), asked again and again in a call; undefined after a while. */
|
|
34
|
+
next?(): Promise<string | undefined>;
|
|
35
|
+
close(): void;
|
|
36
|
+
}
|
|
37
|
+
/** An answer begun before the user was known to be done (WebCallSession.draft). */
|
|
38
|
+
export interface WebCallDraft {
|
|
39
|
+
/** The reply to say, as `say` gives it; undefined once dropped. */
|
|
40
|
+
reply: Promise<string | undefined>;
|
|
41
|
+
/** The user was done with these words: its reply is said, and what it does is done. */
|
|
42
|
+
keep(): void;
|
|
43
|
+
/** The user said more: it stops and does nothing. */
|
|
44
|
+
drop(): void;
|
|
45
|
+
}
|
|
@@ -197,6 +197,18 @@ export interface WebPictureCard {
|
|
|
197
197
|
disabled?: boolean;
|
|
198
198
|
onPick(): void;
|
|
199
199
|
}
|
|
200
|
+
/** WebExtensionUI.ChatImages: the pictures of one message. */
|
|
201
|
+
export interface WebChatImagesProps {
|
|
202
|
+
images: readonly {
|
|
203
|
+
key: string;
|
|
204
|
+
src?: string;
|
|
205
|
+
thumb?: string;
|
|
206
|
+
width: number;
|
|
207
|
+
height: number;
|
|
208
|
+
}[];
|
|
209
|
+
/** What they are, for who cannot see them. */
|
|
210
|
+
alt?: string;
|
|
211
|
+
}
|
|
200
212
|
export interface WebImageViewerProps {
|
|
201
213
|
src: string;
|
|
202
214
|
alt?: string;
|
|
@@ -298,8 +310,17 @@ export interface WebVoice {
|
|
|
298
310
|
}
|
|
299
311
|
export interface WebComposerProps {
|
|
300
312
|
placeholder?: string;
|
|
301
|
-
/**
|
|
302
|
-
|
|
313
|
+
/**
|
|
314
|
+
* Sends what was typed, and the pictures added when the box takes them (`images`), the text empty for pictures
|
|
315
|
+
* alone; when it fails, both come back into the box and the reason is a notice of the page.
|
|
316
|
+
*/
|
|
317
|
+
onSend(text: string, images: WebComposerImage[]): Promise<void> | void;
|
|
318
|
+
/**
|
|
319
|
+
* Pictures can be added, as in a conversation: the album and the camera in the + (a picture on a computer), pasted,
|
|
320
|
+
* dropped. With limits, each comes shrunk within them (a JPEG, unless it fits as it is), its size in pixels said.
|
|
321
|
+
* Newer than some Ta apps, which take none.
|
|
322
|
+
*/
|
|
323
|
+
images?: boolean | WebComposerImageLimits;
|
|
303
324
|
/** What `@` lists, by name; and the + menu entry that starts an `@`. */
|
|
304
325
|
mentions?: {
|
|
305
326
|
name: string;
|
|
@@ -335,6 +356,20 @@ export interface WebComposerProps {
|
|
|
335
356
|
*/
|
|
336
357
|
draft?: string;
|
|
337
358
|
}
|
|
359
|
+
/** A picture sent from the message box (WebComposerProps.images): JPEG, PNG, GIF or WebP, in base64. */
|
|
360
|
+
export interface WebComposerImage {
|
|
361
|
+
type: 'image';
|
|
362
|
+
data: string;
|
|
363
|
+
mimeType: string;
|
|
364
|
+
/** In pixels, when the box shrank it (`images` with limits). */
|
|
365
|
+
width?: number;
|
|
366
|
+
height?: number;
|
|
367
|
+
}
|
|
368
|
+
/** How the message box shrinks the pictures it hands on: their longest side in pixels, their bytes at most. */
|
|
369
|
+
export interface WebComposerImageLimits {
|
|
370
|
+
side: number;
|
|
371
|
+
bytes: number;
|
|
372
|
+
}
|
|
338
373
|
/** An entry of the + menu of the message box. */
|
|
339
374
|
export interface WebComposerAction {
|
|
340
375
|
key: string;
|