@celljs/ta-web 4.47.1 → 4.48.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-role.d.ts +1 -1
- package/esm/browser/assistant/assistant-role.js +1 -1
- package/esm/browser/assistant/assistant-task-source.js +6 -1
- package/esm/browser/assistant/assistant-task-util.d.ts +1 -0
- package/esm/browser/assistant/assistant-task-util.js +9 -3
- package/esm/browser/assistant/assistant-view.js +4 -2
- package/esm/browser/cloud/cloud-sign-in.d.ts +26 -4
- package/esm/browser/cloud/cloud-sign-in.js +88 -18
- package/esm/browser/components/app-nav.d.ts +3 -1
- package/esm/browser/components/app-nav.js +3 -3
- package/esm/browser/components/app-view.js +16 -6
- package/esm/browser/components/asks-badge.d.ts +12 -0
- package/esm/browser/components/asks-badge.js +17 -1
- package/esm/browser/components/chat-list-row.d.ts +4 -1
- package/esm/browser/components/chat-list-row.js +7 -1
- package/esm/browser/components/chats-dot.d.ts +4 -1
- package/esm/browser/components/chats-dot.js +6 -2
- package/esm/browser/components/cloud-sign-in-view.d.ts +2 -1
- package/esm/browser/components/cloud-sign-in-view.js +28 -5
- package/esm/browser/components/composer-box-protocol.d.ts +5 -3
- package/esm/browser/components/composer-box.js +11 -11
- package/esm/browser/components/composer.d.ts +8 -1
- package/esm/browser/components/composer.js +57 -34
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/lightbox.d.ts +15 -1
- package/esm/browser/components/lightbox.js +14 -2
- package/esm/browser/components/link.js +8 -3
- package/esm/browser/components/markdown.d.ts +4 -2
- package/esm/browser/components/markdown.js +13 -4
- package/esm/browser/components/media.d.ts +6 -0
- package/esm/browser/components/media.js +9 -1
- package/esm/browser/components/message-images.d.ts +5 -0
- package/esm/browser/components/message-images.js +40 -4
- package/esm/browser/components/message-user.js +4 -2
- package/esm/browser/components/partner-row.js +4 -4
- package/esm/browser/components/phone-shell.d.ts +2 -0
- package/esm/browser/components/phone-shell.js +2 -2
- package/esm/browser/components/sending.d.ts +19 -0
- package/esm/browser/components/sending.js +27 -0
- package/esm/browser/components/session-view.js +4 -3
- package/esm/browser/components/settings-choices.js +1 -0
- package/esm/browser/components/settings-parts.js +28 -17
- package/esm/browser/components/share-dialog.js +3 -2
- package/esm/browser/components/share-item-sheet.js +1 -1
- package/esm/browser/components/share-sheet.d.ts +4 -2
- package/esm/browser/components/share-sheet.js +16 -2
- package/esm/browser/components/sign-in-accounts.js +7 -1
- package/esm/browser/components/unseen-drop.d.ts +2 -2
- package/esm/browser/components/unseen-drop.js +1 -1
- package/esm/browser/device/app-badge.d.ts +8 -0
- package/esm/browser/device/app-badge.js +28 -0
- package/esm/browser/device/code-scan.js +1 -1
- package/esm/browser/extension/web-api-code.d.ts +26 -0
- package/esm/browser/extension/web-api-components.d.ts +31 -0
- package/esm/browser/extension/web-api-menus.d.ts +15 -0
- package/esm/browser/extension/web-api-messages.d.ts +15 -0
- package/esm/browser/extension/web-api-messages.js +2 -0
- package/esm/browser/extension/web-api-partners.d.ts +16 -0
- package/esm/browser/extension/web-api-spec.js +1 -0
- package/esm/browser/extension/web-extension-api.d.ts +7 -13
- package/esm/browser/extension/web-extension-context.js +2 -0
- package/esm/browser/extension/web-session-notices.js +11 -2
- package/esm/browser/extension/web-share-ui.js +1 -0
- package/esm/browser/extension/web-share.js +3 -3
- package/esm/browser/extension/web-sharing.js +1 -1
- package/esm/browser/i18n/en/assistant.d.ts +2 -0
- package/esm/browser/i18n/en/assistant.js +2 -0
- package/esm/browser/i18n/en/chat.d.ts +11 -0
- package/esm/browser/i18n/en/chat.js +13 -2
- package/esm/browser/i18n/en/common.d.ts +4 -0
- package/esm/browser/i18n/en/common.js +4 -0
- package/esm/browser/i18n/en/service.d.ts +5 -0
- package/esm/browser/i18n/en/service.js +5 -0
- package/esm/browser/i18n/en/settings.d.ts +6 -0
- package/esm/browser/i18n/en/settings.js +8 -2
- package/esm/browser/i18n/ja/assistant.js +2 -0
- package/esm/browser/i18n/ja/chat.js +13 -2
- package/esm/browser/i18n/ja/common.js +4 -0
- package/esm/browser/i18n/ja/service.js +5 -0
- package/esm/browser/i18n/ja/settings.js +10 -4
- package/esm/browser/i18n/locales.d.ts +29 -1
- package/esm/browser/i18n/messages.d.ts +28 -0
- package/esm/browser/i18n/zh/assistant.js +2 -0
- package/esm/browser/i18n/zh/chat.js +13 -2
- package/esm/browser/i18n/zh/common.js +4 -0
- package/esm/browser/i18n/zh/service.js +5 -0
- package/esm/browser/i18n/zh/settings.js +8 -2
- package/esm/browser/i18n/zh-tw/assistant.js +2 -0
- package/esm/browser/i18n/zh-tw/chat.js +13 -2
- package/esm/browser/i18n/zh-tw/common.js +4 -0
- package/esm/browser/i18n/zh-tw/service.js +5 -0
- package/esm/browser/i18n/zh-tw/settings.js +8 -2
- package/esm/browser/links/links.js +1 -1
- package/esm/browser/notices/session-notices.d.ts +4 -4
- package/esm/browser/notices/session-notices.js +3 -6
- package/esm/browser/partners/partners-util.d.ts +6 -0
- package/esm/browser/partners/partners-util.js +22 -0
- package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/esm/browser/settings/agent-settings.d.ts +2 -0
- package/esm/browser/settings/agent-settings.js +2 -0
- package/esm/browser/settings/settings-protocol.d.ts +8 -0
- package/esm/browser/settings/settings-protocol.js +5 -0
- package/esm/browser/style/base.d.ts +1 -1
- package/esm/browser/style/base.js +3 -0
- package/esm/browser/style/chat-list.d.ts +1 -1
- package/esm/browser/style/chat-list.js +8 -3
- package/esm/browser/style/conversation-column.d.ts +1 -1
- package/esm/browser/style/conversation-column.js +6 -1
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +18 -0
- package/esm/browser/style/phone.d.ts +1 -1
- package/esm/browser/style/phone.js +2 -0
- package/esm/browser/util/composer.d.ts +18 -3
- package/esm/browser/util/composer.js +31 -5
- package/esm/browser/util/desktop.d.ts +8 -1
- package/esm/browser/util/desktop.js +10 -0
- package/esm/browser/util/image-shrink.d.ts +5 -1
- package/esm/browser/util/image-shrink.js +1 -1
- package/esm/browser/util/markdown.d.ts +3 -5
- package/esm/browser/util/markdown.js +5 -29
- package/esm/browser/util/process.js +2 -2
- package/lib/browser/assistant/assistant-role.d.ts +1 -1
- package/lib/browser/assistant/assistant-role.js +1 -1
- package/lib/browser/assistant/assistant-task-source.js +5 -0
- package/lib/browser/assistant/assistant-task-util.d.ts +1 -0
- package/lib/browser/assistant/assistant-task-util.js +8 -2
- package/lib/browser/assistant/assistant-view.js +4 -2
- package/lib/browser/cloud/cloud-sign-in.d.ts +26 -4
- package/lib/browser/cloud/cloud-sign-in.js +89 -19
- package/lib/browser/components/app-nav.d.ts +3 -1
- package/lib/browser/components/app-nav.js +2 -2
- package/lib/browser/components/app-view.js +16 -6
- package/lib/browser/components/asks-badge.d.ts +12 -0
- package/lib/browser/components/asks-badge.js +19 -1
- package/lib/browser/components/chat-list-row.d.ts +4 -1
- package/lib/browser/components/chat-list-row.js +7 -1
- package/lib/browser/components/chats-dot.d.ts +4 -1
- package/lib/browser/components/chats-dot.js +6 -2
- package/lib/browser/components/cloud-sign-in-view.d.ts +2 -1
- package/lib/browser/components/cloud-sign-in-view.js +28 -5
- package/lib/browser/components/composer-box-protocol.d.ts +5 -3
- package/lib/browser/components/composer-box.js +11 -11
- package/lib/browser/components/composer.d.ts +8 -1
- package/lib/browser/components/composer.js +56 -33
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/lightbox.d.ts +15 -1
- package/lib/browser/components/lightbox.js +15 -2
- package/lib/browser/components/link.js +8 -3
- package/lib/browser/components/markdown.d.ts +4 -2
- package/lib/browser/components/markdown.js +11 -2
- package/lib/browser/components/media.d.ts +6 -0
- package/lib/browser/components/media.js +10 -2
- package/lib/browser/components/message-images.d.ts +5 -0
- package/lib/browser/components/message-images.js +40 -4
- package/lib/browser/components/message-user.js +4 -2
- package/lib/browser/components/partner-row.js +4 -4
- package/lib/browser/components/phone-shell.d.ts +2 -0
- package/lib/browser/components/phone-shell.js +1 -1
- package/lib/browser/components/sending.d.ts +20 -0
- package/lib/browser/components/sending.js +63 -0
- package/lib/browser/components/session-view.js +4 -3
- package/lib/browser/components/settings-choices.js +1 -0
- package/lib/browser/components/settings-parts.js +26 -15
- package/lib/browser/components/share-dialog.js +3 -2
- package/lib/browser/components/share-item-sheet.js +1 -1
- package/lib/browser/components/share-sheet.d.ts +4 -2
- package/lib/browser/components/share-sheet.js +16 -2
- package/lib/browser/components/sign-in-accounts.js +7 -1
- package/lib/browser/components/unseen-drop.d.ts +2 -2
- package/lib/browser/components/unseen-drop.js +1 -1
- package/lib/browser/device/app-badge.d.ts +9 -0
- package/lib/browser/device/app-badge.js +31 -0
- package/lib/browser/device/code-scan.js +1 -1
- package/lib/browser/extension/web-api-code.d.ts +26 -0
- package/lib/browser/extension/web-api-components.d.ts +31 -0
- package/lib/browser/extension/web-api-menus.d.ts +15 -0
- package/lib/browser/extension/web-api-messages.d.ts +16 -0
- package/lib/browser/extension/web-api-messages.js +3 -0
- package/lib/browser/extension/web-api-partners.d.ts +16 -0
- package/lib/browser/extension/web-api-spec.js +1 -0
- package/lib/browser/extension/web-extension-api.d.ts +7 -13
- package/lib/browser/extension/web-extension-context.js +2 -0
- package/lib/browser/extension/web-session-notices.js +10 -1
- package/lib/browser/extension/web-share-ui.js +1 -0
- package/lib/browser/extension/web-share.js +3 -3
- package/lib/browser/extension/web-sharing.js +1 -1
- package/lib/browser/i18n/en/assistant.d.ts +2 -0
- package/lib/browser/i18n/en/assistant.js +2 -0
- package/lib/browser/i18n/en/chat.d.ts +11 -0
- package/lib/browser/i18n/en/chat.js +13 -2
- package/lib/browser/i18n/en/common.d.ts +4 -0
- package/lib/browser/i18n/en/common.js +4 -0
- package/lib/browser/i18n/en/service.d.ts +5 -0
- package/lib/browser/i18n/en/service.js +5 -0
- package/lib/browser/i18n/en/settings.d.ts +6 -0
- package/lib/browser/i18n/en/settings.js +8 -2
- package/lib/browser/i18n/ja/assistant.js +2 -0
- package/lib/browser/i18n/ja/chat.js +13 -2
- package/lib/browser/i18n/ja/common.js +4 -0
- package/lib/browser/i18n/ja/service.js +5 -0
- package/lib/browser/i18n/ja/settings.js +10 -4
- package/lib/browser/i18n/locales.d.ts +29 -1
- package/lib/browser/i18n/messages.d.ts +28 -0
- package/lib/browser/i18n/zh/assistant.js +2 -0
- package/lib/browser/i18n/zh/chat.js +13 -2
- package/lib/browser/i18n/zh/common.js +4 -0
- package/lib/browser/i18n/zh/service.js +5 -0
- package/lib/browser/i18n/zh/settings.js +8 -2
- package/lib/browser/i18n/zh-tw/assistant.js +2 -0
- package/lib/browser/i18n/zh-tw/chat.js +13 -2
- package/lib/browser/i18n/zh-tw/common.js +4 -0
- package/lib/browser/i18n/zh-tw/service.js +5 -0
- package/lib/browser/i18n/zh-tw/settings.js +8 -2
- package/lib/browser/links/links.js +1 -1
- package/lib/browser/notices/session-notices.d.ts +4 -4
- package/lib/browser/notices/session-notices.js +3 -6
- package/lib/browser/partners/partners-util.d.ts +6 -0
- package/lib/browser/partners/partners-util.js +22 -0
- package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/lib/browser/settings/agent-settings.d.ts +2 -0
- package/lib/browser/settings/agent-settings.js +3 -1
- package/lib/browser/settings/settings-protocol.d.ts +8 -0
- package/lib/browser/settings/settings-protocol.js +6 -1
- package/lib/browser/style/base.d.ts +1 -1
- package/lib/browser/style/base.js +3 -0
- package/lib/browser/style/chat-list.d.ts +1 -1
- package/lib/browser/style/chat-list.js +8 -3
- package/lib/browser/style/conversation-column.d.ts +1 -1
- package/lib/browser/style/conversation-column.js +6 -1
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +18 -0
- package/lib/browser/style/phone.d.ts +1 -1
- package/lib/browser/style/phone.js +2 -0
- package/lib/browser/util/composer.d.ts +18 -3
- package/lib/browser/util/composer.js +31 -5
- package/lib/browser/util/desktop.d.ts +8 -1
- package/lib/browser/util/desktop.js +10 -0
- package/lib/browser/util/image-shrink.d.ts +5 -1
- package/lib/browser/util/image-shrink.js +1 -1
- package/lib/browser/util/markdown.d.ts +3 -5
- package/lib/browser/util/markdown.js +5 -29
- package/lib/browser/util/process.js +1 -1
- package/package.json +7 -7
- package/esm/browser/util/share-link.d.ts +0 -21
- package/esm/browser/util/share-link.js +0 -61
- package/lib/browser/util/share-link.d.ts +0 -22
- package/lib/browser/util/share-link.js +0 -64
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { WebCodeRendererProps } from '../extension/web-api-code';
|
|
2
|
+
import type { WebCodeRendererProps, WebMarkdownFiles } from '../extension/web-api-code';
|
|
3
3
|
export declare function CodeBlock({ code, language }: {
|
|
4
4
|
code: string;
|
|
5
5
|
language?: string;
|
|
@@ -12,12 +12,14 @@ export declare function CodeBlock({ code, language }: {
|
|
|
12
12
|
* text a page shows of a conversation of its own (a group chat); else those of the conversation it is in, if any.
|
|
13
13
|
* `whole`: its blocks are what the page shows, never folded (WebCodeRendererProps.whole).
|
|
14
14
|
*/
|
|
15
|
-
export declare function Markdown({ text, streaming, inline, send, answer, whole, }: {
|
|
15
|
+
export declare function Markdown({ text, streaming, inline, send, answer, whole, files, }: {
|
|
16
16
|
text: string;
|
|
17
17
|
streaming?: boolean;
|
|
18
18
|
inline?: boolean;
|
|
19
19
|
send?: WebCodeRendererProps['send'];
|
|
20
20
|
answer?: string;
|
|
21
21
|
whole?: boolean;
|
|
22
|
+
/** Of a text said on another computer, the files that came with it (WebMarkdownFiles): none of this computer. */
|
|
23
|
+
files?: WebMarkdownFiles;
|
|
22
24
|
}): React.JSX.Element;
|
|
23
25
|
//# sourceMappingURL=markdown.d.ts.map
|
|
@@ -310,10 +310,19 @@ const MarkdownBody = React.memo(function MarkdownBody({ text, streaming }) {
|
|
|
310
310
|
* text a page shows of a conversation of its own (a group chat); else those of the conversation it is in, if any.
|
|
311
311
|
* `whole`: its blocks are what the page shows, never folded (WebCodeRendererProps.whole).
|
|
312
312
|
*/
|
|
313
|
-
function Markdown({ text, streaming = false, inline = false, send, answer, whole, }) {
|
|
313
|
+
function Markdown({ text, streaming = false, inline = false, send, answer, whole, files, }) {
|
|
314
|
+
const open = React.useContext(link_1.OpenLink);
|
|
315
|
+
const elsewhere = React.useMemo(() => files && {
|
|
316
|
+
url: (path) => (files.has(path) ? files.url(path) : Promise.reject(new Error(`${path} did not come with the text.`))),
|
|
317
|
+
open: (target, external) => target.type === 'path' ? files.has(target.path) && files.open(target.path) : open === null || open === void 0 ? void 0 : open(target, external),
|
|
318
|
+
}, [files, open]);
|
|
314
319
|
const body = inline ? (React.createElement("span", { className: "ta-markdown ta-markdown-inline" },
|
|
315
320
|
React.createElement(Text, { text: text }))) : (React.createElement(MarkdownBody, { text: text, streaming: streaming }));
|
|
316
|
-
const
|
|
321
|
+
const own = whole === undefined ? body : React.createElement(code_renderers_1.CodeWhole.Provider, { value: whole }, body);
|
|
322
|
+
const drawn = files && elsewhere ? (React.createElement(media_1.ElsewhereFiles.Provider, { value: files },
|
|
323
|
+
React.createElement(media_1.FileUrls.Provider, { value: elsewhere.url },
|
|
324
|
+
React.createElement(link_1.OpenLink.Provider, { value: elsewhere.open },
|
|
325
|
+
React.createElement(link_1.FileMenu.Provider, { value: undefined }, own))))) : (own);
|
|
317
326
|
return send ? (React.createElement(code_renderers_1.CodeReply.Provider, { value: send },
|
|
318
327
|
React.createElement(code_renderers_1.CodeAnswer.Provider, { value: answer }, drawn))) : (drawn);
|
|
319
328
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import type { WebMarkdownFiles } from '../extension/web-api-code';
|
|
2
3
|
import { ThumbnailUtil } from '../util/thumbnail';
|
|
3
4
|
/**
|
|
4
5
|
* Where the page loads a file of the workspace from (TaWorkspaceServer.fileUrl), in the directory of the
|
|
@@ -7,6 +8,11 @@ import { ThumbnailUtil } from '../util/thumbnail';
|
|
|
7
8
|
* the file before.
|
|
8
9
|
*/
|
|
9
10
|
export declare const FileUrls: React.Context<((path: string, box?: ThumbnailUtil.Box) => Promise<string>) | undefined>;
|
|
11
|
+
/**
|
|
12
|
+
* The files that came with a text said on another computer (WebMarkdownFiles), where one is drawn: its paths are of that
|
|
13
|
+
* computer, and one that did not come is said to be there, not missing, nor a link.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ElsewhereFiles: React.Context<WebMarkdownFiles | undefined>;
|
|
10
16
|
/**
|
|
11
17
|
* Asks every picture that could not load to load again: one may not have come for a while (a phone whose network
|
|
12
18
|
* changed, the app in the background, the relay of the computer reconnecting), not be missing.
|
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.FileUrls = void 0;
|
|
36
|
+
exports.ElsewhereFiles = exports.FileUrls = void 0;
|
|
37
37
|
exports.askAgain = askAgain;
|
|
38
38
|
exports.useMediaUrl = useMediaUrl;
|
|
39
39
|
exports.useFullUrl = useFullUrl;
|
|
@@ -55,6 +55,11 @@ const lightbox_1 = require("./lightbox");
|
|
|
55
55
|
* the file before.
|
|
56
56
|
*/
|
|
57
57
|
exports.FileUrls = React.createContext(undefined);
|
|
58
|
+
/**
|
|
59
|
+
* The files that came with a text said on another computer (WebMarkdownFiles), where one is drawn: its paths are of that
|
|
60
|
+
* computer, and one that did not come is said to be there, not missing, nor a link.
|
|
61
|
+
*/
|
|
62
|
+
exports.ElsewhereFiles = React.createContext(undefined);
|
|
58
63
|
/**
|
|
59
64
|
* What the targets replies showed came to, kept on the device: shown again, even after the page loaded again, an
|
|
60
65
|
* image has its place before it loads and one that could not show says so at once, so that nothing under them moves.
|
|
@@ -189,6 +194,7 @@ function MediaView({ src, alt }) {
|
|
|
189
194
|
const [full] = useMediaUrl(open && kind === 'image' ? src : undefined);
|
|
190
195
|
const [loaded, setLoaded] = React.useState(false);
|
|
191
196
|
const fullUrl = useFullUrl();
|
|
197
|
+
const elsewhere = React.useContext(exports.ElsewhereFiles);
|
|
192
198
|
const [menu, openMenu] = (0, image_menu_1.useImageMenu)();
|
|
193
199
|
const known = shown.get(src);
|
|
194
200
|
// One that could not show before says so at once while it is asked again: it may only not have come then.
|
|
@@ -214,9 +220,11 @@ function MediaView({ src, alt }) {
|
|
|
214
220
|
}
|
|
215
221
|
if (!url || failed) {
|
|
216
222
|
const name = alt || src.split(/[?#]/)[0].split('/').pop() || src;
|
|
223
|
+
const path = markdown_1.MarkdownUtil.localPath(src);
|
|
224
|
+
const away = elsewhere && path !== undefined && !elsewhere.has(path);
|
|
217
225
|
return (React.createElement("button", { type: "button", className: "ta-media-missing", title: `${src}\n${t('ta.markdown.retry')}`, onClick: askAgain },
|
|
218
226
|
React.createElement(icon_1.Icon, { icon: lucide_react_1.ImageOff, size: 14 }),
|
|
219
|
-
t('ta.markdown.missing', { name })));
|
|
227
|
+
t(away ? 'ta.markdown.elsewhere' : 'ta.markdown.missing', { name })));
|
|
220
228
|
}
|
|
221
229
|
switch (kind) {
|
|
222
230
|
case 'video':
|
|
@@ -50,6 +50,11 @@ export interface ChatImage {
|
|
|
50
50
|
thumb?: string;
|
|
51
51
|
width: number;
|
|
52
52
|
height: number;
|
|
53
|
+
/** The picture as it was picked, of one shown made smaller: loaded when the user asks for it (查看原图). */
|
|
54
|
+
original?: {
|
|
55
|
+
bytes: number;
|
|
56
|
+
load(): Promise<string | undefined>;
|
|
57
|
+
};
|
|
53
58
|
}
|
|
54
59
|
/**
|
|
55
60
|
* The pictures of a message of a chat an extension draws (a group chat, a channel), as those of the user in a
|
|
@@ -203,24 +203,60 @@ function UserImages({ blocks, timestamp }) {
|
|
|
203
203
|
lightbox,
|
|
204
204
|
folding));
|
|
205
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* The originals of pictures shown made smaller, as the user asks for them over the page (查看原图): the URL of each
|
|
208
|
+
* come, by key, how the loading of each goes, and the 查看原图 of the Lightbox of one not come yet.
|
|
209
|
+
*/
|
|
210
|
+
function useOriginals() {
|
|
211
|
+
const [loaded, setLoaded] = React.useState({});
|
|
212
|
+
const [states, setStates] = React.useState({});
|
|
213
|
+
const live = React.useRef(true);
|
|
214
|
+
React.useEffect(() => {
|
|
215
|
+
live.current = true;
|
|
216
|
+
return () => {
|
|
217
|
+
live.current = false;
|
|
218
|
+
};
|
|
219
|
+
}, []);
|
|
220
|
+
const of = (image) => {
|
|
221
|
+
const original = image === null || image === void 0 ? void 0 : image.original;
|
|
222
|
+
if (!image || !original || loaded[image.key]) {
|
|
223
|
+
return undefined;
|
|
224
|
+
}
|
|
225
|
+
return {
|
|
226
|
+
bytes: original.bytes,
|
|
227
|
+
state: states[image.key],
|
|
228
|
+
onLoad: () => {
|
|
229
|
+
setStates(current => ({ ...current, [image.key]: 'loading' }));
|
|
230
|
+
original.load().then(url => {
|
|
231
|
+
if (live.current) {
|
|
232
|
+
url && setLoaded(current => ({ ...current, [image.key]: url }));
|
|
233
|
+
setStates(({ [image.key]: _, ...rest }) => (url ? rest : { ...rest, [image.key]: 'failed' }));
|
|
234
|
+
}
|
|
235
|
+
}, () => live.current && setStates(current => ({ ...current, [image.key]: 'failed' })));
|
|
236
|
+
},
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
return { src: (image) => { var _a; return (image ? ((_a = loaded[image.key]) !== null && _a !== void 0 ? _a : image.src) : undefined); }, of };
|
|
240
|
+
}
|
|
206
241
|
/**
|
|
207
242
|
* The pictures of a message of a chat an extension draws (a group chat, a channel), as those of the user in a
|
|
208
243
|
* conversation: one alone in its shape, more in squares, full size over the page on a click, those still on their way
|
|
209
244
|
* blurred from their thumbnail.
|
|
210
245
|
*/
|
|
211
246
|
function ChatImages({ images, alt = '' }) {
|
|
212
|
-
var _a, _b
|
|
247
|
+
var _a, _b;
|
|
213
248
|
const t = (0, use_t_1.useT)();
|
|
214
249
|
const [open, setOpen] = React.useState();
|
|
215
250
|
const [menu, openMenu] = (0, image_menu_1.useImageMenu)();
|
|
216
251
|
const [, redraw] = React.useReducer((n) => n + 1, 0);
|
|
252
|
+
const originals = useOriginals();
|
|
217
253
|
if (images.length === 0) {
|
|
218
254
|
return null;
|
|
219
255
|
}
|
|
220
256
|
const fold = `chat:${images[0].key}`;
|
|
221
257
|
const single = images.length === 1 ? UserImageUtil.box({ width: images[0].width, height: images[0].height }) : undefined;
|
|
222
|
-
const shown = open !== undefined ? (
|
|
223
|
-
const lightbox = open !== undefined && shown && (React.createElement(lightbox_1.Lightbox, { src: shown, alt: alt, count: { at: open, of: images.length }, onClose: () => setOpen(undefined), onPrevious: open > 0 && ((
|
|
258
|
+
const shown = open !== undefined ? originals.src(images[open]) : undefined;
|
|
259
|
+
const lightbox = open !== undefined && shown && (React.createElement(lightbox_1.Lightbox, { src: shown, alt: alt, count: { at: open, of: images.length }, onClose: () => setOpen(undefined), onPrevious: open > 0 && ((_a = images[open - 1]) === null || _a === void 0 ? void 0 : _a.src) ? () => setOpen(open - 1) : undefined, onNext: open < images.length - 1 && ((_b = images[open + 1]) === null || _b === void 0 ? void 0 : _b.src) ? () => setOpen(open + 1) : undefined, previousSrc: open > 0 ? originals.src(images[open - 1]) : undefined, nextSrc: originals.src(images[open + 1]), original: originals.of(images[open]) }));
|
|
224
260
|
if (ImageStackUtil.stacked(images.length, fold)) {
|
|
225
261
|
return (React.createElement(React.Fragment, null,
|
|
226
262
|
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: () => {
|
|
@@ -231,7 +267,7 @@ function ChatImages({ images, alt = '' }) {
|
|
|
231
267
|
}
|
|
232
268
|
return (React.createElement("div", { className: "ta-user-images ta-chat-images", "data-count": Math.min(images.length, 3), style: { '--ta-user-image-columns': gallery_1.GalleryUtil.columns(images.length) } },
|
|
233
269
|
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 => {
|
|
234
|
-
const source =
|
|
270
|
+
const source = originals.src(image);
|
|
235
271
|
if (source) {
|
|
236
272
|
openMenu(event, { full: () => source, enlarge: () => setOpen(at) });
|
|
237
273
|
}
|
|
@@ -58,6 +58,7 @@ const message_images_1 = require("./message-images");
|
|
|
58
58
|
const message_menu_1 = require("./message-menu");
|
|
59
59
|
const people_1 = require("./people");
|
|
60
60
|
const said_text_1 = require("./said-text");
|
|
61
|
+
const sending_1 = require("./sending");
|
|
61
62
|
/** The messages of the conversation still on their way from here, by message, with what can be done with those that failed. */
|
|
62
63
|
exports.Outbox = React.createContext({ of: new Map() });
|
|
63
64
|
/** A message that did not go: marked as such, with a way to send it again or take it back, as in a messenger. */
|
|
@@ -246,8 +247,9 @@ function UserBubble({ message, blocks, text, copied, skill, queued, }) {
|
|
|
246
247
|
// Not in the session yet: nothing to branch from or rewind to.
|
|
247
248
|
return (React.createElement("div", { className: `ta-message ta-user ${sent.failed ? 'ta-user-failed' : 'ta-user-sending'}` },
|
|
248
249
|
marks,
|
|
249
|
-
React.createElement(
|
|
250
|
-
|
|
250
|
+
React.createElement(sending_1.Sending, { failed: sent.failed, onResend: sent.code === ta_protocol_1.TaErrorCode.NOT_SIGNED_IN ? undefined : outbox.actions && (() => { var _a; return (_a = outbox.actions) === null || _a === void 0 ? void 0 : _a.resend(sent.id); }), line: React.createElement(SendFailed, { sent: sent, actions: outbox.actions }) },
|
|
251
|
+
React.createElement(UserSaid, { blocks: blocks, text: text, timestamp: message.timestamp })),
|
|
252
|
+
!sent.failed && React.createElement("div", { className: "ta-footer" })));
|
|
251
253
|
}
|
|
252
254
|
return (React.createElement("div", { className: "ta-message ta-user", onContextMenu: onContextMenu },
|
|
253
255
|
marks,
|
|
@@ -52,8 +52,8 @@ const swipe_row_1 = require("./swipe-row");
|
|
|
52
52
|
* same for every kind (PartnerRowUtil).
|
|
53
53
|
*/
|
|
54
54
|
function PartnerRow({ partner, time, selected, open, pinned, onPin, }) {
|
|
55
|
-
var _a, _b;
|
|
56
|
-
var
|
|
55
|
+
var _a, _b, _c, _d;
|
|
56
|
+
var _e;
|
|
57
57
|
const t = (0, use_t_1.useT)();
|
|
58
58
|
const [menu, openMenu] = (0, context_menu_1.useContextMenu)();
|
|
59
59
|
const [opening, setOpening] = React.useState(false);
|
|
@@ -91,7 +91,7 @@ function PartnerRow({ partner, time, selected, open, pinned, onPin, }) {
|
|
|
91
91
|
Own && !opening ? (React.createElement("span", { className: "ta-chat-face", style: { width: 38, height: 38 }, "aria-hidden": "true" },
|
|
92
92
|
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 }))),
|
|
93
93
|
partner.online && React.createElement("span", { className: "ta-partner-online", "aria-hidden": "true" }),
|
|
94
|
-
React.createElement(chat_list_row_1.ChatDot, { unseen: unseen, asks: asks })),
|
|
95
|
-
React.createElement(chat_home_1.RowText, { title: partner.name, time: time, line: partners_util_1.PartnersUtil.line(partner, t('ta.partners.waiting')), unseen: unseen, busy: !partner.status && !!((
|
|
94
|
+
React.createElement(chat_list_row_1.ChatDot, { unseen: unseen, asks: asks, count: partners_util_1.PartnersUtil.count(partner), onSee: selected || partner.status ? undefined : (_b = partner.chat) === null || _b === void 0 ? void 0 : _b.see })),
|
|
95
|
+
React.createElement(chat_home_1.RowText, { title: partner.name, time: time, line: partners_util_1.PartnersUtil.line(partner, t('ta.partners.waiting')), unseen: unseen, flag: !partner.status && ((_c = partner.chat) === null || _c === void 0 ? void 0 : _c.flag) ? React.createElement("span", { className: "ta-chat-flag ta-alert" }, partner.chat.flag) : undefined, busy: !partner.status && !!((_d = partner.chat) === null || _d === void 0 ? void 0 : _d.busy), tag: partner.location ? React.createElement(host_tag_1.HostTag, { location: partner.location }) : undefined, badge: (_e = partner.label) !== null && _e !== void 0 ? _e : (partner.friends ? t('ta.partners.withFriends') : undefined) }))));
|
|
96
96
|
}
|
|
97
97
|
//# sourceMappingURL=partner-row.js.map
|
|
@@ -19,6 +19,8 @@ export interface PhoneTab {
|
|
|
19
19
|
onSeeAll?(): void;
|
|
20
20
|
/** How many wait for the user to decide (the double's tab): a blue count, in place of the amber dot. */
|
|
21
21
|
asks?: number;
|
|
22
|
+
/** How many messages people sent the user has not seen (the chats' tab): a red number, before all else. */
|
|
23
|
+
count?: number;
|
|
22
24
|
}
|
|
23
25
|
export interface PhoneShellProps {
|
|
24
26
|
tabs: PhoneTab[];
|
|
@@ -283,7 +283,7 @@ function TabBar({ tabs, tab, onTab }) {
|
|
|
283
283
|
return (React.createElement("button", { key: item.id, type: "button", className: `ta-tabbar-item${active ? ' ta-active' : ''}`, "aria-current": active ? 'page' : undefined, onClick: event => (active ? again(item.id, event.currentTarget.closest('.ta-phone-home')) : onTab(item.id)), onContextMenu: item.menu ? event => { var _a; return openMenu(event, (_a = item.menu) !== null && _a !== void 0 ? _a : []); } : undefined, ...held(item.hold) },
|
|
284
284
|
React.createElement("span", { className: "ta-tabbar-icon" },
|
|
285
285
|
item.double ? React.createElement(ta_avatar_1.DinoFace, { size: 24, className: "ta-nav-face" }) : React.createElement(Glyph, { size: 22, strokeWidth: active ? 2 : 1.6 }),
|
|
286
|
-
item.asks ? (React.createElement(asks_badge_1.AsksBadge, { count: item.asks, onDismiss: item.onSeeAll })) : (item.unseen && React.createElement(unseen_drop_1.UnseenDrop, { label: t('ta.chat.unseen'), onDismiss: item.onSeeAll }))),
|
|
286
|
+
item.count ? (React.createElement(asks_badge_1.PeopleBadge, { count: item.count, onDismiss: item.onSeeAll })) : item.asks ? (React.createElement(asks_badge_1.AsksBadge, { count: item.asks, onDismiss: item.onSeeAll })) : (item.unseen && React.createElement(unseen_drop_1.UnseenDrop, { label: t('ta.chat.unseen'), onDismiss: item.onSeeAll }))),
|
|
287
287
|
React.createElement("span", null, item.label)));
|
|
288
288
|
}),
|
|
289
289
|
menu));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/** How a message of the user on its way shows (WebSendingProps). */
|
|
3
|
+
export interface SendingProps {
|
|
4
|
+
/** Why it did not go: a red mark beside it, and under it the line `line`, else 发送失败 · 重发 · 删除. */
|
|
5
|
+
failed?: string;
|
|
6
|
+
/** How far it went, 0 to 1, when known: said beside the spinner. */
|
|
7
|
+
progress?: number;
|
|
8
|
+
onResend?(): void;
|
|
9
|
+
onDiscard?(): void;
|
|
10
|
+
/** In place of the line under one that did not go. */
|
|
11
|
+
line?: React.ReactNode;
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A message of the user on its way, as a messenger shows it: drawn at once, a spinner beside it while it goes, a red
|
|
16
|
+
* mark beside it and a way to send it again or take it back under it once it did not go. Conversations and the chats
|
|
17
|
+
* of extensions (`ui.Sending`) show their messages on their way so alike.
|
|
18
|
+
*/
|
|
19
|
+
export declare function Sending({ failed, progress, onResend, onDiscard, line, children }: SendingProps): React.JSX.Element;
|
|
20
|
+
//# sourceMappingURL=sending.d.ts.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.Sending = Sending;
|
|
37
|
+
const lucide_react_1 = require("lucide-react");
|
|
38
|
+
const React = __importStar(require("react"));
|
|
39
|
+
const use_t_1 = require("../i18n/use-t");
|
|
40
|
+
const icon_1 = require("./icon");
|
|
41
|
+
/**
|
|
42
|
+
* A message of the user on its way, as a messenger shows it: drawn at once, a spinner beside it while it goes, a red
|
|
43
|
+
* mark beside it and a way to send it again or take it back under it once it did not go. Conversations and the chats
|
|
44
|
+
* of extensions (`ui.Sending`) show their messages on their way so alike.
|
|
45
|
+
*/
|
|
46
|
+
function Sending({ failed, progress, onResend, onDiscard, line, children }) {
|
|
47
|
+
const t = (0, use_t_1.useT)();
|
|
48
|
+
const percent = progress !== undefined && progress >= 0 && progress < 1 ? Math.floor(progress * 100) : undefined;
|
|
49
|
+
return (React.createElement(React.Fragment, null,
|
|
50
|
+
React.createElement("div", { className: `ta-sending${failed ? ' ta-sending-failed' : ''}` },
|
|
51
|
+
failed ? (React.createElement("button", { type: "button", className: "ta-sending-mark", title: failed, "aria-label": t('ta.message.resend'), disabled: !onResend, onClick: onResend },
|
|
52
|
+
React.createElement(icon_1.Icon, { icon: lucide_react_1.CircleAlert, size: 18 }))) : (React.createElement("span", { className: "ta-sending-mark", role: "status", "aria-label": t('ta.message.sending') },
|
|
53
|
+
percent !== undefined && React.createElement("span", { className: "ta-sending-percent" }, `${percent}%`),
|
|
54
|
+
React.createElement("span", { className: "ta-spinner" }))),
|
|
55
|
+
React.createElement("div", { className: "ta-sending-body" }, children)),
|
|
56
|
+
failed &&
|
|
57
|
+
(line !== null && line !== void 0 ? line : (React.createElement("div", { className: "ta-send-failed", title: failed },
|
|
58
|
+
React.createElement(icon_1.Icon, { icon: lucide_react_1.CircleAlert, size: 14 }),
|
|
59
|
+
React.createElement("span", null, t('ta.message.sendFailed')),
|
|
60
|
+
onResend && (React.createElement("button", { type: "button", className: "ta-link-button", onClick: onResend }, t('ta.message.resend'))),
|
|
61
|
+
onDiscard && (React.createElement("button", { type: "button", className: "ta-link-button", onClick: onDiscard }, t('ta.message.discard'))))))));
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=sending.js.map
|
|
@@ -49,6 +49,7 @@ const code_renderers_1 = require("../markdown/code-renderers");
|
|
|
49
49
|
const screen_protocol_1 = require("../screen/screen-protocol");
|
|
50
50
|
const screen_scroll_1 = require("../screen/screen-scroll");
|
|
51
51
|
const use_screen_part_1 = require("../screen/use-screen-part");
|
|
52
|
+
const agent_settings_1 = require("../settings/agent-settings");
|
|
52
53
|
const link_1 = require("../util/link");
|
|
53
54
|
const message_1 = require("../util/message");
|
|
54
55
|
const terminal_text_1 = require("../util/terminal-text");
|
|
@@ -190,7 +191,7 @@ function SessionView({ store, server, workspace, info, onClosed, onActivity, lea
|
|
|
190
191
|
const { settings, actions } = (0, session_settings_1.useSessionSettings)(server, (0, hooks_1.useSettingsServer)(), store, state, t, fail, contextAct);
|
|
191
192
|
const composer = React.useRef(null);
|
|
192
193
|
const [settingsState] = (0, hooks_1.useSettings)();
|
|
193
|
-
const recentShots = settingsState.settings
|
|
194
|
+
const { recentShots, sendWhileWorking } = settingsState.settings;
|
|
194
195
|
// A call: the conversation listens, answers aloud, and listens again (VoiceCall); not in a tab of the workbench.
|
|
195
196
|
const [callState, call] = (0, voice_call_bar_1.useVoiceCall)({
|
|
196
197
|
language: () => settingsState.language,
|
|
@@ -243,7 +244,7 @@ function SessionView({ store, server, workspace, info, onClosed, onActivity, lea
|
|
|
243
244
|
const fileUrl = React.useCallback(async (path, box) => files.loadable(thumbnail_1.ThumbnailUtil.boxed(await workspace.fileUrl(path, cwd), box)), [workspace, cwd, files]);
|
|
244
245
|
const namedPaths = React.useCallback(() => message_1.MessageUtil.namedPaths(store.state.messages), [store]);
|
|
245
246
|
const openLink = (0, hooks_1.useOpenLink)(cwd, namedPaths);
|
|
246
|
-
const [{ fileMenus }] = (0, hooks_1.useWebExtensions)();
|
|
247
|
+
const [{ fileMenus }, extensions] = (0, hooks_1.useWebExtensions)();
|
|
247
248
|
const fileMenu = React.useCallback((path) => (cwd ? fileMenus.flatMap(menu => menu(link_1.LinkUtil.fileRef(cwd, path))) : []), [cwd, fileMenus]);
|
|
248
249
|
// biome-ignore lint/correctness/useExhaustiveDependencies: runs when a run starts or settles
|
|
249
250
|
React.useEffect(() => onActivity(), [state.working, onActivity]);
|
|
@@ -427,7 +428,7 @@ function SessionView({ store, server, workspace, info, onClosed, onActivity, lea
|
|
|
427
428
|
widgetsAt('aboveEditor'),
|
|
428
429
|
addons.above,
|
|
429
430
|
React.createElement(voice_call_bar_1.CallBar, { state: callState, call: call })),
|
|
430
|
-
React.createElement(composer_1.Composer, { above: React.createElement(phone_hint_1.PhoneHint, null), ref: composer, store: store, server: server, workspace: workspace, working: state.working, compacting: !!state.compacting, commands: settings.commands, cwd: info === null || info === void 0 ? void 0 : info.cwd, actions: composerActions, recentShots: recentShots, onStopTimed: stopTimed, onTyping: onTyping, draft: (info === null || info === void 0 ? void 0 : info.sessionFile) ? drafts_protocol_1.DraftPlaces.chat(info.sessionFile) : undefined, onTalkCall: callable && !callState.active ? (0, voice_call_bar_1.talkCall)(call) : undefined, talkCalls: talkCalls, onError: fail }),
|
|
431
|
+
React.createElement(composer_1.Composer, { above: React.createElement(phone_hint_1.PhoneHint, null), ref: composer, store: store, server: server, workspace: workspace, working: state.working, compacting: !!state.compacting, commands: settings.commands, cwd: info === null || info === void 0 ? void 0 : info.cwd, actions: composerActions, recentShots: recentShots, sendWhileWorking: sendWhileWorking, onQueueSettings: () => extensions.openSettings(agent_settings_1.QUEUE_SETTINGS), onStopTimed: stopTimed, onTyping: onTyping, draft: (info === null || info === void 0 ? void 0 : info.sessionFile) ? drafts_protocol_1.DraftPlaces.chat(info.sessionFile) : undefined, onTalkCall: callable && !callState.active ? (0, voice_call_bar_1.talkCall)(call) : undefined, talkCalls: talkCalls, onError: fail }),
|
|
431
432
|
belowComposer,
|
|
432
433
|
widgetsAt('belowEditor'),
|
|
433
434
|
statuses.length > 0 && (React.createElement("div", { className: "ta-statusline" }, statuses.map(([key, text]) => (React.createElement(StatusChip, { key: key, text: text })))))))));
|
|
@@ -82,6 +82,7 @@ exports.SHORTCUTS = [
|
|
|
82
82
|
{ keys: 'Enter', label: 'ta.shortcut.send' },
|
|
83
83
|
{ keys: 'Shift+Enter', label: 'ta.shortcut.newline' },
|
|
84
84
|
{ keys: 'Alt+Enter', label: 'ta.shortcut.followUp' },
|
|
85
|
+
{ keys: 'Mod+Enter', label: 'ta.shortcut.sendNow' },
|
|
85
86
|
{ keys: 'Esc', label: 'ta.shortcut.stop' },
|
|
86
87
|
{ keys: '/', label: 'ta.shortcut.commands' },
|
|
87
88
|
{ keys: '@', label: 'ta.shortcut.files' },
|
|
@@ -44,6 +44,7 @@ const use_t_1 = require("../i18n/use-t");
|
|
|
44
44
|
const agent_settings_1 = require("../settings/agent-settings");
|
|
45
45
|
const settings_protocol_1 = require("../settings/settings-protocol");
|
|
46
46
|
const skin_util_1 = require("../skin/skin-util");
|
|
47
|
+
const composer_1 = require("../util/composer");
|
|
47
48
|
const voice_1 = require("../util/voice");
|
|
48
49
|
const agent_settings_view_1 = require("./agent-settings-view");
|
|
49
50
|
const app_nav_1 = require("./app-nav");
|
|
@@ -217,27 +218,37 @@ function useParts(scope, onScope, onDialog) {
|
|
|
217
218
|
!agent.offline && !snapshot && !agent.error && React.createElement(loading_1.Loading, { compact: true, label: t('ta.settings.loading') }),
|
|
218
219
|
locked && React.createElement("div", { className: "ta-settings-note" }, t('ta.settings.untrusted')),
|
|
219
220
|
agent.error && React.createElement("div", { className: "ta-banner ta-banner-error" }, t('ta.settings.failed', { error: agent.error }))));
|
|
220
|
-
|
|
221
|
+
// Of this device, in the section of what pi does with the messages sent while Ta works: one place for the queue.
|
|
222
|
+
const own = {
|
|
223
|
+
[agent_settings_1.QUEUE_SETTINGS]: [
|
|
224
|
+
(0, settings_controls_1.row)('send-while-working', [t('ta.settings.sendWhileWorking'), t('ta.settings.sendWhileWorkingHint', composer_1.ComposerUtil.keyNames(agent_settings_1.ShortcutUtil.isMac()))], React.createElement(settings_controls_1.Row, { label: t('ta.settings.sendWhileWorking'), description: t('ta.settings.sendWhileWorkingHint', composer_1.ComposerUtil.keyNames(agent_settings_1.ShortcutUtil.isMac())), stacked: true },
|
|
225
|
+
React.createElement(settings_controls_1.Segmented, { label: t('ta.settings.sendWhileWorking'), value: settings.sendWhileWorking, choices: settings_protocol_1.SEND_WHILE_WORKING.map(value => ({ value, label: t(`ta.settings.sendWhileWorking.${value}`) })), onChange: value => store.update({ sendWhileWorking: value }) }))),
|
|
226
|
+
],
|
|
227
|
+
};
|
|
228
|
+
const ta = agent_settings_1.AGENT_SETTINGS_GROUPS.map(group => { var _a, _b; return ({
|
|
221
229
|
id: group.id,
|
|
222
230
|
title: t(group.title),
|
|
223
231
|
icon: (_a = settings_choices_1.GROUP_ICONS[group.id]) !== null && _a !== void 0 ? _a : lucide_react_1.Wrench,
|
|
224
232
|
group: 'ta',
|
|
225
233
|
scoped: true,
|
|
226
234
|
...(group.id === 'model' ? { tier: 'common' } : {}),
|
|
227
|
-
rows:
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
235
|
+
rows: [
|
|
236
|
+
...((_b = own[group.id]) !== null && _b !== void 0 ? _b : []),
|
|
237
|
+
...(snapshot
|
|
238
|
+
? group.keys.flatMap(key => {
|
|
239
|
+
const spec = agent_settings_1.AgentSettingsUtil.spec(key);
|
|
240
|
+
if (!spec) {
|
|
241
|
+
return [];
|
|
242
|
+
}
|
|
243
|
+
const label = t(agent_settings_1.AgentSettingsUtil.label(key));
|
|
244
|
+
const hint = agent_settings_1.AgentSettingsUtil.hint(key);
|
|
245
|
+
return [
|
|
246
|
+
(0, settings_controls_1.row)(key, [label, hint && t(hint), key], React.createElement(settings_controls_1.Row, { label: label, description: hint && t(hint), modified: snapshot[scope][key] !== undefined },
|
|
247
|
+
React.createElement(agent_settings_view_1.AgentControl, { spec: spec, scope: scope, snapshot: snapshot, disabled: locked, onChange: changes => agent.update(scope, changes) }))),
|
|
248
|
+
];
|
|
249
|
+
})
|
|
250
|
+
: []),
|
|
251
|
+
],
|
|
241
252
|
}); });
|
|
242
253
|
// Ta's scoped sections first in its part, under their scope; each part's own sections before those of extensions.
|
|
243
254
|
const sections = [...web.filter(entry => entry.group !== 'ta'), ...ta, ...web.filter(entry => entry.group === 'ta'), ...more];
|
|
@@ -35,11 +35,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.ShareDialog = ShareDialog;
|
|
37
37
|
exports.ShareHost = ShareHost;
|
|
38
|
+
const share_link_1 = require("@celljs/ta-protocol/lib/common/share-link");
|
|
38
39
|
const lucide_react_1 = require("lucide-react");
|
|
39
40
|
const React = __importStar(require("react"));
|
|
40
41
|
const hooks_1 = require("../hooks");
|
|
41
42
|
const use_t_1 = require("../i18n/use-t");
|
|
42
|
-
const share_link_1 = require("../util/share-link");
|
|
43
43
|
const share_item_sheet_1 = require("./share-item-sheet");
|
|
44
44
|
const share_sheet_1 = require("./share-sheet");
|
|
45
45
|
/** The link of an extension: of its source when it is published, else of the relay, made by this computer. */
|
|
@@ -72,10 +72,11 @@ function ShareDialog({ target, onClose }) {
|
|
|
72
72
|
const t = (0, use_t_1.useT)();
|
|
73
73
|
const [, bench] = (0, hooks_1.useWorkbench)();
|
|
74
74
|
const [, notices] = (0, hooks_1.useNotices)();
|
|
75
|
+
const [{ shareWays }] = (0, hooks_1.useWebExtensions)();
|
|
75
76
|
const [shared, error] = useShared(target);
|
|
76
77
|
const packageId = target.packageId;
|
|
77
78
|
const days = (shared === null || shared === void 0 ? void 0 : shared.relayed) ? Math.max(1, Math.round((shared.expiresAt - Date.now()) / 86400000)) : 0;
|
|
78
|
-
return (React.createElement(share_sheet_1.ShareSheet, { title: t('ta.share.title', { name: target.title }), link: shared === null || shared === void 0 ? void 0 : shared.link, error: error === undefined ? undefined : error || t('ta.share.cannot'), face: React.createElement(lucide_react_1.Package, { size: 22 }), name: target.title, gets: t('ta.share.extensionGets'), invite: t('ta.share.extensionInvite', { name: target.title }), notes: [(shared === null || shared === void 0 ? void 0 : shared.relayed) ? t('ta.share.relayed', { days, size: Math.round(shared.maxBytes / 1024 / 1024) }) : t('ta.share.published')], onStop: (shared === null || shared === void 0 ? void 0 : shared.relayed) && packageId ? () => bench.relay.unsharePackage(packageId) : undefined, stop: { title: t('ta.share.stopTitle', { name: target.title }), message: t('ta.share.stopHint') }, onClose: onClose, notices: notices, rooms: bench.rooms, onRoomEvent: listener => bench.onRoomEvent(listener, { messages: false }) }));
|
|
79
|
+
return (React.createElement(share_sheet_1.ShareSheet, { title: t('ta.share.title', { name: target.title }), link: shared === null || shared === void 0 ? void 0 : shared.link, error: error === undefined ? undefined : error || t('ta.share.cannot'), face: React.createElement(lucide_react_1.Package, { size: 22 }), name: target.title, icon: "Package", gets: t('ta.share.extensionGets'), invite: t('ta.share.extensionInvite', { name: target.title }), notes: [(shared === null || shared === void 0 ? void 0 : shared.relayed) ? t('ta.share.relayed', { days, size: Math.round(shared.maxBytes / 1024 / 1024) }) : t('ta.share.published')], onStop: (shared === null || shared === void 0 ? void 0 : shared.relayed) && packageId ? () => bench.relay.unsharePackage(packageId) : undefined, stop: { title: t('ta.share.stopTitle', { name: target.title }), message: t('ta.share.stopHint') }, onClose: onClose, notices: notices, rooms: bench.rooms, onRoomEvent: listener => bench.onRoomEvent(listener, { messages: false }), ways: () => shareWays }));
|
|
79
80
|
}
|
|
80
81
|
/** The share asked for by a web extension, over the page: an extension handed on, or the share sheet of something. */
|
|
81
82
|
function ShareHost() {
|
|
@@ -69,7 +69,7 @@ function ShareItemSheet({ item, ways, onClose }) {
|
|
|
69
69
|
React.createElement(Icon, { size: 22 })),
|
|
70
70
|
React.createElement("span", { className: "ta-share-who-text" },
|
|
71
71
|
React.createElement("strong", { className: "ta-share-name" }, name),
|
|
72
|
-
React.createElement("span", { className: "ta-share-gets" }, item.kind === 'file' ? t('ta.share.itemFile') : t('ta.share.itemWork'))))),
|
|
72
|
+
React.createElement("span", { className: "ta-share-gets" }, item.kind === 'file' ? t('ta.share.itemFile') : item.kind === 'link' ? item.gets : t('ta.share.itemWork'))))),
|
|
73
73
|
taking.length ? (React.createElement("div", { className: "ta-share-tiles" }, taking.map(way => (React.createElement(share_sheet_1.Tile, { key: way.key, icon: way.icon, label: web_share_1.WebShareUtil.label(way), onClick: () => pick(way) }))))) : (React.createElement(empty_state_1.EmptyState, { title: t('ta.share.noWay'), compact: true })))));
|
|
74
74
|
}
|
|
75
75
|
//# sourceMappingURL=share-item-sheet.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TaRoomEvent, TaRoomServer } from '@celljs/ta-protocol';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import type { WebIcon, WebShareSheetProps } from '../extension/web-extension-api';
|
|
3
|
+
import type { WebIcon, WebShareSheetProps, WebShareWay } from '../extension/web-extension-api';
|
|
4
4
|
import type { TaNotices } from '../notices/notices-protocol';
|
|
5
5
|
/** One of the actions under the code, as the share sheets of phones: a round icon over a word. */
|
|
6
6
|
export declare function Tile({ icon: Icon, label, onClick, disabled }: {
|
|
@@ -19,6 +19,8 @@ export interface ShareSheetServices {
|
|
|
19
19
|
notices: TaNotices;
|
|
20
20
|
rooms: TaRoomServer;
|
|
21
21
|
onRoomEvent?(listener: (event: TaRoomEvent) => void): () => void;
|
|
22
|
+
/** The ways to share (registerShareWay): one that takes a link sends it into chats, friends' and group chats alike. */
|
|
23
|
+
ways?(): readonly WebShareWay[];
|
|
22
24
|
}
|
|
23
|
-
export declare function ShareSheet({ title, link, error, face, name, gets, invite, notes, password, own, onRenew, onStop, stop, onClose, children, notices, rooms, onRoomEvent, }: WebShareSheetProps & ShareSheetServices): React.JSX.Element;
|
|
25
|
+
export declare function ShareSheet({ title, link, error, face, name, icon, gets, invite, notes, password, own, onRenew, onStop, stop, onClose, children, notices, rooms, onRoomEvent, ways, }: WebShareSheetProps & ShareSheetServices): React.JSX.Element;
|
|
24
26
|
//# sourceMappingURL=share-sheet.d.ts.map
|
|
@@ -38,6 +38,7 @@ exports.ShareSheet = ShareSheet;
|
|
|
38
38
|
const lucide_react_1 = require("lucide-react");
|
|
39
39
|
const React = __importStar(require("react"));
|
|
40
40
|
const share_sheet_compat_1 = require("../extension/share-sheet-compat");
|
|
41
|
+
const web_share_1 = require("../extension/web-share");
|
|
41
42
|
const use_t_1 = require("../i18n/use-t");
|
|
42
43
|
const busy_1 = require("./busy");
|
|
43
44
|
const empty_state_1 = require("./empty-state");
|
|
@@ -64,7 +65,7 @@ function Tile({ icon: Icon, label, onClick, disabled }) {
|
|
|
64
65
|
React.createElement(Icon, { size: 20 })),
|
|
65
66
|
React.createElement("span", { className: "ta-share-tile-label" }, label)));
|
|
66
67
|
}
|
|
67
|
-
function ShareSheet({ title, link, error, face, name, gets, invite, notes, password, own, onRenew, onStop, stop, onClose, children, notices, rooms, onRoomEvent, }) {
|
|
68
|
+
function ShareSheet({ title, link, error, face, name, icon, gets, invite, notes, password, own, onRenew, onStop, stop, onClose, children, notices, rooms, onRoomEvent, ways, }) {
|
|
68
69
|
const t = (0, use_t_1.useT)();
|
|
69
70
|
const [copied, copy] = useCopied();
|
|
70
71
|
const [stopping, run] = (0, busy_1.useBusy)();
|
|
@@ -72,7 +73,19 @@ function ShareSheet({ title, link, error, face, name, gets, invite, notes, passw
|
|
|
72
73
|
const friends = (0, share_friends_1.useShareFriends)(rooms);
|
|
73
74
|
const [sends, setSends] = React.useState(0);
|
|
74
75
|
const sent = (0, share_friends_1.useFriendSends)(rooms, own ? undefined : link, sends, onRoomEvent);
|
|
75
|
-
|
|
76
|
+
// Sent into chats as a card, to friends and group chats alike, where a way takes a link (ta-rooms); else sealed for friends alone.
|
|
77
|
+
const chatItem = link && !own ? { kind: 'link', link, title: name || title, invite, ...(gets ? { gets } : {}), ...(icon ? { icon } : {}) } : undefined;
|
|
78
|
+
const chatWay = chatItem ? ways === null || ways === void 0 ? void 0 : ways().find(way => way.accepts(chatItem)) : undefined;
|
|
79
|
+
const toChats = () => {
|
|
80
|
+
if (!chatWay || !chatItem) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
onClose();
|
|
84
|
+
Promise.resolve()
|
|
85
|
+
.then(() => chatWay.share(chatItem))
|
|
86
|
+
.catch(reason => notices.error(reason));
|
|
87
|
+
};
|
|
88
|
+
const canFriends = !own && !chatWay && !!(friends === null || friends === void 0 ? void 0 : friends.length);
|
|
76
89
|
const canSend = !own && typeof navigator !== 'undefined' && typeof navigator.share === 'function';
|
|
77
90
|
const end = async () => {
|
|
78
91
|
if (!onStop || (stop && !(await notices.confirm({ title: stop.title, message: stop.message, confirmLabel: t('ta.share.stop'), danger: true })))) {
|
|
@@ -110,6 +123,7 @@ function ShareSheet({ title, link, error, face, name, gets, invite, notes, passw
|
|
|
110
123
|
setSends(n => n + 1);
|
|
111
124
|
}
|
|
112
125
|
} })) : (React.createElement("div", { className: "ta-share-tiles" },
|
|
126
|
+
chatWay && React.createElement(Tile, { icon: chatWay.icon, label: web_share_1.WebShareUtil.label(chatWay), onClick: toChats }),
|
|
113
127
|
canFriends && React.createElement(Tile, { icon: lucide_react_1.Send, label: t('ta.share.friends'), disabled: !link, onClick: () => setPicking(true) }),
|
|
114
128
|
React.createElement(Tile, { icon: copied === 'link' ? lucide_react_1.Check : lucide_react_1.Copy, label: copied === 'link' ? t('ta.share.copied') : t('ta.share.copy'), disabled: !link, onClick: () => link && copy((0, share_sheet_compat_1.shareMessage)(invite, link), 'link') }),
|
|
115
129
|
canSend && (React.createElement(Tile, { icon: lucide_react_1.Share2, label: t('ta.share.apps'), disabled: !link, onClick: () => link && void navigator.share({ title: name || title, text: invite, url: link }).catch(() => undefined) })),
|
|
@@ -116,7 +116,13 @@ function usePolledSignIn(onFailed) {
|
|
|
116
116
|
window.open(url, '_blank');
|
|
117
117
|
}
|
|
118
118
|
},
|
|
119
|
-
|
|
119
|
+
// Refused or too late there: this page says so, and the button signs in anew.
|
|
120
|
+
onProgress: progress => {
|
|
121
|
+
if (progress.failed) {
|
|
122
|
+
signIn.stop();
|
|
123
|
+
onFailed();
|
|
124
|
+
}
|
|
125
|
+
},
|
|
120
126
|
});
|
|
121
127
|
running.current = signIn;
|
|
122
128
|
void signIn
|
|
@@ -27,8 +27,8 @@ export declare namespace UnseenDropUtil {
|
|
|
27
27
|
function neck(from: Point, r: number, to: Point, R: number): string;
|
|
28
28
|
function distance(a: Point, b: Point): number;
|
|
29
29
|
}
|
|
30
|
-
/** The colour of what is dragged: amber of something unseen, blue of what waits for the user to decide. */
|
|
31
|
-
export type DropTone = 'unseen' | 'asks';
|
|
30
|
+
/** The colour of what is dragged: amber of something unseen, blue of what waits for the user to decide, red of what people said. */
|
|
31
|
+
export type DropTone = 'unseen' | 'asks' | 'people';
|
|
32
32
|
/**
|
|
33
33
|
* The amber dot of a tab that has something unseen, or the blue count of what waits for the user (AsksBadge, its
|
|
34
34
|
* `children`). A finger, or the mouse, drags it off as a drop of water, as QQ's unread: stretched past its neck and
|
|
@@ -98,7 +98,7 @@ class DropOverlay {
|
|
|
98
98
|
this.dot = document.createElementNS(SVG, 'circle');
|
|
99
99
|
this.bridge = document.createElementNS(SVG, 'path');
|
|
100
100
|
this.drop = document.createElementNS(SVG, 'circle');
|
|
101
|
-
this.svg.setAttribute('class', tone === '
|
|
101
|
+
this.svg.setAttribute('class', tone === 'unseen' ? 'ta-unseen-drag' : `ta-unseen-drag ta-${tone}`);
|
|
102
102
|
this.svg.setAttribute('aria-hidden', 'true');
|
|
103
103
|
this.dot.setAttribute('cx', String(origin.x));
|
|
104
104
|
this.dot.setAttribute('cy', String(origin.y));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The number on the icon of Ta, as a messenger's: the messages of people the user has not seen, the red number of the
|
|
3
|
+
* chats' tab. Ta Desktop's Dock, the app on iOS (TaPush.swift, which the computer's pushes set too while the app is
|
|
4
|
+
* closed), or an installed web page (the Badging API); 0 takes it off. Nothing where there is no icon.
|
|
5
|
+
*/
|
|
6
|
+
export declare namespace AppBadge {
|
|
7
|
+
function set(count: number, scope?: object): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=app-badge.d.ts.map
|