@celljs/ta-web 4.43.0 → 4.45.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/apps/app-window.js +2 -2
- package/esm/browser/assistant/assistant-chat-list.js +2 -1
- package/esm/browser/assistant/assistant-extension.js +16 -2
- package/esm/browser/assistant/assistant-protocol.d.ts +6 -0
- package/esm/browser/assistant/assistant-task-source.js +3 -0
- package/esm/browser/assistant/assistant-task-util.d.ts +2 -0
- package/esm/browser/assistant/assistant-task-util.js +5 -0
- package/esm/browser/assistant/assistant.d.ts +3 -0
- package/esm/browser/assistant/assistant.js +26 -2
- package/esm/browser/components/app-shell-hooks.d.ts +2 -1
- package/esm/browser/components/app-shell-hooks.js +4 -3
- package/esm/browser/components/app-shell-state.js +2 -2
- package/esm/browser/components/chat-list-row.js +4 -4
- package/esm/browser/components/chat-list-util.d.ts +2 -2
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/custom-host.d.ts +4 -1
- package/esm/browser/components/custom-host.js +8 -2
- package/esm/browser/components/earlier-messages.d.ts +4 -1
- package/esm/browser/components/earlier-messages.js +5 -2
- package/esm/browser/components/hearing-host.d.ts +2 -1
- package/esm/browser/components/hearing-host.js +10 -7
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/message-list.js +2 -1
- package/esm/browser/components/message-steps.js +8 -5
- package/esm/browser/components/settings-choices.d.ts +2 -1
- package/esm/browser/components/settings-choices.js +2 -1
- package/esm/browser/components/settings-parts.js +23 -3
- package/esm/browser/components/share-dialog.js +1 -1
- package/esm/browser/components/share-friends.d.ts +18 -2
- package/esm/browser/components/share-friends.js +62 -4
- package/esm/browser/components/share-sheet.d.ts +4 -3
- package/esm/browser/components/share-sheet.js +11 -3
- package/esm/browser/extension/web-api-chats.d.ts +23 -0
- package/esm/browser/extension/web-api-desktop.d.ts +14 -0
- package/esm/browser/extension/web-api-skins.d.ts +95 -0
- package/esm/browser/extension/web-api-skins.js +2 -0
- package/esm/browser/extension/web-api-spec.js +3 -0
- package/esm/browser/extension/web-extension-api.d.ts +11 -26
- package/esm/browser/extension/web-extension-context.js +4 -0
- package/esm/browser/extension/web-extension-protocol.d.ts +3 -1
- package/esm/browser/extension/web-extension-protocol.js +1 -0
- package/esm/browser/extension/web-extension-run.d.ts +3 -2
- package/esm/browser/extension/web-extension-run.js +3 -0
- package/esm/browser/extension/web-share-ui.js +6 -1
- package/esm/browser/i18n/en/assistant.d.ts +4 -0
- package/esm/browser/i18n/en/assistant.js +4 -0
- package/esm/browser/i18n/en/chat.d.ts +1 -0
- package/esm/browser/i18n/en/chat.js +1 -0
- package/esm/browser/i18n/en/common.d.ts +0 -3
- package/esm/browser/i18n/en/common.js +0 -3
- package/esm/browser/i18n/en/discover.d.ts +4 -1
- package/esm/browser/i18n/en/discover.js +4 -1
- package/esm/browser/i18n/en/service.js +1 -1
- package/esm/browser/i18n/en/settings.d.ts +8 -0
- package/esm/browser/i18n/en/settings.js +8 -0
- package/esm/browser/i18n/en/tools.d.ts +5 -0
- package/esm/browser/i18n/en/tools.js +5 -0
- package/esm/browser/i18n/ja/assistant.js +4 -0
- package/esm/browser/i18n/ja/chat.js +1 -0
- package/esm/browser/i18n/ja/common.js +0 -3
- package/esm/browser/i18n/ja/discover.js +4 -1
- package/esm/browser/i18n/ja/service.js +1 -1
- package/esm/browser/i18n/ja/settings.js +8 -0
- package/esm/browser/i18n/ja/tools.js +5 -0
- package/esm/browser/i18n/locales.d.ts +23 -5
- package/esm/browser/i18n/messages.d.ts +22 -4
- package/esm/browser/i18n/zh/assistant.js +4 -0
- package/esm/browser/i18n/zh/chat.js +1 -0
- package/esm/browser/i18n/zh/common.js +0 -3
- package/esm/browser/i18n/zh/discover.js +4 -1
- package/esm/browser/i18n/zh/service.js +1 -1
- package/esm/browser/i18n/zh/settings.js +8 -0
- package/esm/browser/i18n/zh/tools.js +5 -0
- package/esm/browser/i18n/zh-tw/assistant.js +4 -0
- package/esm/browser/i18n/zh-tw/chat.js +1 -0
- package/esm/browser/i18n/zh-tw/common.js +0 -3
- package/esm/browser/i18n/zh-tw/discover.js +4 -1
- package/esm/browser/i18n/zh-tw/service.js +1 -1
- package/esm/browser/i18n/zh-tw/settings.js +8 -0
- package/esm/browser/i18n/zh-tw/tools.js +5 -0
- package/esm/browser/links/clipboard-links.d.ts +4 -8
- package/esm/browser/links/clipboard-links.js +9 -51
- package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/esm/browser/settings/settings-protocol.d.ts +24 -0
- package/esm/browser/settings/settings-protocol.js +9 -0
- package/esm/browser/settings/settings.d.ts +4 -1
- package/esm/browser/settings/settings.js +16 -3
- package/esm/browser/skin/skin-layer.d.ts +8 -0
- package/esm/browser/skin/skin-layer.js +118 -0
- package/esm/browser/skin/skin-util.d.ts +40 -0
- package/esm/browser/skin/skin-util.js +120 -0
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +3 -2
- package/esm/browser/style/skins.d.ts +9 -0
- package/esm/browser/style/skins.js +107 -0
- package/esm/browser/style/surfaces.d.ts +1 -1
- package/esm/browser/style/surfaces.js +8 -0
- package/esm/browser/style.js +2 -0
- package/esm/browser/util/desktop.d.ts +11 -1
- package/esm/browser/util/desktop.js +30 -0
- package/esm/browser/util/fresh-rows.d.ts +21 -0
- package/esm/browser/util/fresh-rows.js +36 -0
- package/esm/browser/util/process.d.ts +12 -22
- package/esm/browser/util/process.js +49 -39
- package/esm/browser/util/tool.js +15 -5
- package/esm/browser/util/voice.js +10 -2
- package/lib/browser/apps/app-window.js +2 -2
- package/lib/browser/assistant/assistant-chat-list.js +2 -1
- package/lib/browser/assistant/assistant-extension.js +15 -1
- package/lib/browser/assistant/assistant-protocol.d.ts +6 -0
- package/lib/browser/assistant/assistant-task-source.js +3 -0
- package/lib/browser/assistant/assistant-task-util.d.ts +2 -0
- package/lib/browser/assistant/assistant-task-util.js +5 -0
- package/lib/browser/assistant/assistant.d.ts +3 -0
- package/lib/browser/assistant/assistant.js +26 -2
- package/lib/browser/components/app-shell-hooks.d.ts +2 -1
- package/lib/browser/components/app-shell-hooks.js +4 -3
- package/lib/browser/components/app-shell-state.js +2 -2
- package/lib/browser/components/chat-list-row.js +4 -4
- package/lib/browser/components/chat-list-util.d.ts +2 -2
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/custom-host.d.ts +4 -1
- package/lib/browser/components/custom-host.js +8 -2
- package/lib/browser/components/earlier-messages.d.ts +4 -1
- package/lib/browser/components/earlier-messages.js +5 -2
- package/lib/browser/components/hearing-host.d.ts +2 -1
- package/lib/browser/components/hearing-host.js +9 -6
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/message-list.js +2 -1
- package/lib/browser/components/message-steps.js +8 -5
- package/lib/browser/components/settings-choices.d.ts +2 -1
- package/lib/browser/components/settings-choices.js +2 -1
- package/lib/browser/components/settings-parts.js +21 -1
- package/lib/browser/components/share-dialog.js +1 -1
- package/lib/browser/components/share-friends.d.ts +18 -2
- package/lib/browser/components/share-friends.js +65 -4
- package/lib/browser/components/share-sheet.d.ts +4 -3
- package/lib/browser/components/share-sheet.js +10 -2
- package/lib/browser/extension/web-api-chats.d.ts +23 -0
- package/lib/browser/extension/web-api-desktop.d.ts +14 -0
- package/lib/browser/extension/web-api-skins.d.ts +96 -0
- package/lib/browser/extension/web-api-skins.js +3 -0
- package/lib/browser/extension/web-api-spec.js +3 -0
- package/lib/browser/extension/web-extension-api.d.ts +11 -26
- package/lib/browser/extension/web-extension-context.js +4 -0
- package/lib/browser/extension/web-extension-protocol.d.ts +3 -1
- package/lib/browser/extension/web-extension-protocol.js +1 -0
- package/lib/browser/extension/web-extension-run.d.ts +3 -2
- package/lib/browser/extension/web-extension-run.js +3 -0
- package/lib/browser/extension/web-share-ui.js +6 -1
- package/lib/browser/i18n/en/assistant.d.ts +4 -0
- package/lib/browser/i18n/en/assistant.js +4 -0
- package/lib/browser/i18n/en/chat.d.ts +1 -0
- package/lib/browser/i18n/en/chat.js +1 -0
- package/lib/browser/i18n/en/common.d.ts +0 -3
- package/lib/browser/i18n/en/common.js +0 -3
- package/lib/browser/i18n/en/discover.d.ts +4 -1
- package/lib/browser/i18n/en/discover.js +4 -1
- package/lib/browser/i18n/en/service.js +1 -1
- package/lib/browser/i18n/en/settings.d.ts +8 -0
- package/lib/browser/i18n/en/settings.js +8 -0
- package/lib/browser/i18n/en/tools.d.ts +5 -0
- package/lib/browser/i18n/en/tools.js +5 -0
- package/lib/browser/i18n/ja/assistant.js +4 -0
- package/lib/browser/i18n/ja/chat.js +1 -0
- package/lib/browser/i18n/ja/common.js +0 -3
- package/lib/browser/i18n/ja/discover.js +4 -1
- package/lib/browser/i18n/ja/service.js +1 -1
- package/lib/browser/i18n/ja/settings.js +8 -0
- package/lib/browser/i18n/ja/tools.js +5 -0
- package/lib/browser/i18n/locales.d.ts +23 -5
- package/lib/browser/i18n/messages.d.ts +22 -4
- package/lib/browser/i18n/zh/assistant.js +4 -0
- package/lib/browser/i18n/zh/chat.js +1 -0
- package/lib/browser/i18n/zh/common.js +0 -3
- package/lib/browser/i18n/zh/discover.js +4 -1
- package/lib/browser/i18n/zh/service.js +1 -1
- package/lib/browser/i18n/zh/settings.js +8 -0
- package/lib/browser/i18n/zh/tools.js +5 -0
- package/lib/browser/i18n/zh-tw/assistant.js +4 -0
- package/lib/browser/i18n/zh-tw/chat.js +1 -0
- package/lib/browser/i18n/zh-tw/common.js +0 -3
- package/lib/browser/i18n/zh-tw/discover.js +4 -1
- package/lib/browser/i18n/zh-tw/service.js +1 -1
- package/lib/browser/i18n/zh-tw/settings.js +8 -0
- package/lib/browser/i18n/zh-tw/tools.js +5 -0
- package/lib/browser/links/clipboard-links.d.ts +4 -8
- package/lib/browser/links/clipboard-links.js +10 -52
- package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/lib/browser/settings/settings-protocol.d.ts +24 -0
- package/lib/browser/settings/settings-protocol.js +10 -1
- package/lib/browser/settings/settings.d.ts +4 -1
- package/lib/browser/settings/settings.js +16 -3
- package/lib/browser/skin/skin-layer.d.ts +9 -0
- package/lib/browser/skin/skin-layer.js +154 -0
- package/lib/browser/skin/skin-util.d.ts +41 -0
- package/lib/browser/skin/skin-util.js +123 -0
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +3 -2
- package/lib/browser/style/skins.d.ts +10 -0
- package/lib/browser/style/skins.js +110 -0
- package/lib/browser/style/surfaces.d.ts +1 -1
- package/lib/browser/style/surfaces.js +8 -0
- package/lib/browser/style.js +2 -0
- package/lib/browser/util/desktop.d.ts +11 -1
- package/lib/browser/util/desktop.js +30 -0
- package/lib/browser/util/fresh-rows.d.ts +22 -0
- package/lib/browser/util/fresh-rows.js +40 -0
- package/lib/browser/util/process.d.ts +12 -22
- package/lib/browser/util/process.js +49 -40
- package/lib/browser/util/tool.js +15 -5
- package/lib/browser/util/voice.js +10 -2
- package/package.json +7 -7
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
import type { TaFriend, TaRoomServer } from '@celljs/ta-protocol';
|
|
1
|
+
import type { TaFriend, TaFriendSent, TaRoomEvent, TaRoomServer } from '@celljs/ta-protocol';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import type { TaNotices } from '../notices/notices-protocol.js';
|
|
4
4
|
/** The friends of this Ta, once read; undefined while read, or where they cannot be. */
|
|
5
5
|
export declare function useShareFriends(rooms: TaRoomServer): TaFriend[] | undefined;
|
|
6
|
+
type Sent = TaFriendSent['to'][number];
|
|
7
|
+
/**
|
|
8
|
+
* The friends this link went to and how far it got with each (TaRoomServer.listFriendSends), read again as the rooms
|
|
9
|
+
* change and when `again` does: the furthest each got, the latest sent first. None from a Ta service of before.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useFriendSends(rooms: TaRoomServer, link: string | undefined, again: number, onRoomEvent?: (listener: (event: TaRoomEvent) => void) => () => void): Sent[];
|
|
12
|
+
export declare namespace FriendSendsUtil {
|
|
13
|
+
/** Each friend once, the furthest any of the sends got with them, in the order they were sent to. */
|
|
14
|
+
function merge(list: readonly TaFriendSent[]): Sent[];
|
|
15
|
+
}
|
|
16
|
+
/** Who the link went to, a line each with how far it got: so the user knows it arrived, and whether it was opened. */
|
|
17
|
+
export declare function FriendSends({ sent }: {
|
|
18
|
+
sent: readonly Sent[];
|
|
19
|
+
}): React.JSX.Element | null;
|
|
6
20
|
/**
|
|
7
21
|
* Send to Ta friends, in the share sheet: the friends to tick, then Send; the link goes sealed for each, into their
|
|
8
22
|
* Ta, where it waits among the partners till opened (TaRoomServer.sendToFriends). What is sent is the link alone, and
|
|
@@ -14,5 +28,7 @@ export declare function ShareToFriends({ rooms, notices, friends, link, title, o
|
|
|
14
28
|
friends: TaFriend[];
|
|
15
29
|
link: string;
|
|
16
30
|
title: string;
|
|
17
|
-
|
|
31
|
+
/** Back to the sheet; `sent` once it went, where the sheet then says to whom and how far it got. */
|
|
32
|
+
onDone(sent?: boolean): void;
|
|
18
33
|
}): React.JSX.Element;
|
|
34
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useT } from '../i18n/use-t.js';
|
|
3
|
+
import { Face } from './face.js';
|
|
3
4
|
import { PeoplePicker } from './people-picker.js';
|
|
4
5
|
/** The friends of this Ta, once read; undefined while read, or where they cannot be. */
|
|
5
6
|
export function useShareFriends(rooms) {
|
|
@@ -16,6 +17,64 @@ export function useShareFriends(rooms) {
|
|
|
16
17
|
}, [rooms]);
|
|
17
18
|
return friends;
|
|
18
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* The friends this link went to and how far it got with each (TaRoomServer.listFriendSends), read again as the rooms
|
|
22
|
+
* change and when `again` does: the furthest each got, the latest sent first. None from a Ta service of before.
|
|
23
|
+
*/
|
|
24
|
+
export function useFriendSends(rooms, link, again, onRoomEvent) {
|
|
25
|
+
const [sent, setSent] = React.useState([]);
|
|
26
|
+
const hear = React.useRef(onRoomEvent);
|
|
27
|
+
hear.current = onRoomEvent;
|
|
28
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: read again once the user sent it
|
|
29
|
+
React.useEffect(() => {
|
|
30
|
+
var _a;
|
|
31
|
+
if (!link) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
let live = true;
|
|
35
|
+
const read = () => { var _a; return void Promise.resolve((_a = rooms.listFriendSends) === null || _a === void 0 ? void 0 : _a.call(rooms, link))
|
|
36
|
+
.then(list => live && list && setSent(FriendSendsUtil.merge(list)))
|
|
37
|
+
.catch(() => undefined); };
|
|
38
|
+
read();
|
|
39
|
+
const stop = (_a = hear.current) === null || _a === void 0 ? void 0 : _a.call(hear, event => event.type === 'rooms' && read());
|
|
40
|
+
return () => {
|
|
41
|
+
live = false;
|
|
42
|
+
stop === null || stop === void 0 ? void 0 : stop();
|
|
43
|
+
};
|
|
44
|
+
}, [rooms, link, again]);
|
|
45
|
+
return sent;
|
|
46
|
+
}
|
|
47
|
+
export var FriendSendsUtil;
|
|
48
|
+
(function (FriendSendsUtil) {
|
|
49
|
+
const RANK = { sent: 0, got: 1, opened: 2 };
|
|
50
|
+
/** Each friend once, the furthest any of the sends got with them, in the order they were sent to. */
|
|
51
|
+
function merge(list) {
|
|
52
|
+
const byFriend = new Map();
|
|
53
|
+
for (const one of list) {
|
|
54
|
+
for (const friend of one.to) {
|
|
55
|
+
const known = byFriend.get(friend.id);
|
|
56
|
+
if (!known || RANK[friend.state] > RANK[known.state]) {
|
|
57
|
+
byFriend.set(friend.id, { ...friend, ...(known && RANK[known.state] > RANK[friend.state] ? { state: known.state } : {}) });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return [...byFriend.values()];
|
|
62
|
+
}
|
|
63
|
+
FriendSendsUtil.merge = merge;
|
|
64
|
+
})(FriendSendsUtil || (FriendSendsUtil = {}));
|
|
65
|
+
/** Who the link went to, a line each with how far it got: so the user knows it arrived, and whether it was opened. */
|
|
66
|
+
export function FriendSends({ sent }) {
|
|
67
|
+
const t = useT();
|
|
68
|
+
if (!sent.length) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
return (React.createElement("div", { className: "ta-share-sent" },
|
|
72
|
+
React.createElement("span", { className: "ta-share-sent-title" }, t('ta.share.sentTitle')),
|
|
73
|
+
React.createElement("ul", null, sent.map(friend => (React.createElement("li", { key: friend.id },
|
|
74
|
+
React.createElement(Face, { seed: friend.id, look: friend.look, size: 24 }),
|
|
75
|
+
React.createElement("span", { className: "ta-share-sent-name" }, friend.name),
|
|
76
|
+
React.createElement("span", { className: `ta-share-sent-state ta-share-sent-${friend.state}` }, friend.state === 'opened' ? t('ta.share.opened') : friend.state === 'got' ? t('ta.share.got') : t('ta.share.sent'))))))));
|
|
77
|
+
}
|
|
19
78
|
/**
|
|
20
79
|
* Send to Ta friends, in the share sheet: the friends to tick, then Send; the link goes sealed for each, into their
|
|
21
80
|
* Ta, where it waits among the partners till opened (TaRoomServer.sendToFriends). What is sent is the link alone, and
|
|
@@ -28,9 +87,8 @@ export function ShareToFriends({ rooms, notices, friends, link, title, onDone, }
|
|
|
28
87
|
const send = async () => {
|
|
29
88
|
setBusy(true);
|
|
30
89
|
try {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
onDone();
|
|
90
|
+
await rooms.sendToFriends(chosen, { link, title });
|
|
91
|
+
onDone(true);
|
|
34
92
|
}
|
|
35
93
|
catch (reason) {
|
|
36
94
|
notices.error(reason);
|
|
@@ -41,7 +99,7 @@ export function ShareToFriends({ rooms, notices, friends, link, title, onDone, }
|
|
|
41
99
|
return (React.createElement("div", { className: "ta-share-friends" },
|
|
42
100
|
React.createElement(PeoplePicker, { people: people, value: chosen, onChange: setChosen, disabled: busy }),
|
|
43
101
|
React.createElement("div", { className: "ta-share-friends-actions" },
|
|
44
|
-
React.createElement("button", { type: "button", className: "ta-button", onClick: onDone }, t('ta.cancel')),
|
|
102
|
+
React.createElement("button", { type: "button", className: "ta-button", onClick: () => onDone() }, t('ta.cancel')),
|
|
45
103
|
React.createElement("button", { type: "button", className: `ta-button ta-primary${busy ? ' ta-busy' : ''}`, disabled: busy || chosen.length === 0, onClick: () => void send() },
|
|
46
104
|
busy && React.createElement("span", { className: "ta-spinner ta-busy-mark" }),
|
|
47
105
|
React.createElement("span", null, chosen.length ? t('ta.share.sendN', { n: chosen.length }) : t('ta.share.pickFriends'))))));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TaRoomServer } from '@celljs/ta-protocol';
|
|
1
|
+
import type { TaRoomEvent, TaRoomServer } from '@celljs/ta-protocol';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import type { WebIcon, WebShareSheetProps } from '../extension/web-extension-api.js';
|
|
4
4
|
import type { TaNotices } from '../notices/notices-protocol.js';
|
|
@@ -14,9 +14,10 @@ export declare function Tile({ icon: Icon, label, onClick, disabled }: {
|
|
|
14
14
|
* the other gets over its code, the link, and the actions in one row: Send to Ta friends, Copy, the system's other apps
|
|
15
15
|
* (where it has them), New link; Stop under the notes. Every package shares through it, so a share looks and works the same wherever it is made.
|
|
16
16
|
*/
|
|
17
|
-
/** What the sheet uses of the page: its notices,
|
|
17
|
+
/** What the sheet uses of the page: its notices, the rooms to send to friends by, and what happens in them (how far a send got). */
|
|
18
18
|
export interface ShareSheetServices {
|
|
19
19
|
notices: TaNotices;
|
|
20
20
|
rooms: TaRoomServer;
|
|
21
|
+
onRoomEvent?(listener: (event: TaRoomEvent) => void): () => void;
|
|
21
22
|
}
|
|
22
|
-
export declare function ShareSheet({ title, link, error, face, name, gets, invite, notes, password, own, onRenew, onStop, stop, onClose, children, notices, rooms, }: WebShareSheetProps & ShareSheetServices): React.JSX.Element;
|
|
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;
|
|
@@ -4,7 +4,7 @@ import { shareMessage } from '../extension/share-sheet-compat.js';
|
|
|
4
4
|
import { useT } from '../i18n/use-t.js';
|
|
5
5
|
import { EmptyState } from './empty-state.js';
|
|
6
6
|
import { QrView } from './qr-view.js';
|
|
7
|
-
import { ShareToFriends, useShareFriends } from './share-friends.js';
|
|
7
|
+
import { FriendSends, ShareToFriends, useFriendSends, useShareFriends } from './share-friends.js';
|
|
8
8
|
import { WebDialog } from './web-dialog.js';
|
|
9
9
|
/** Copies a text, saying so on the control that did it for a moment. */
|
|
10
10
|
function useCopied() {
|
|
@@ -26,12 +26,14 @@ export function Tile({ icon: Icon, label, onClick, disabled }) {
|
|
|
26
26
|
React.createElement(Icon, { size: 20 })),
|
|
27
27
|
React.createElement("span", { className: "ta-share-tile-label" }, label)));
|
|
28
28
|
}
|
|
29
|
-
export function ShareSheet({ title, link, error, face, name, gets, invite, notes, password, own, onRenew, onStop, stop, onClose, children, notices, rooms, }) {
|
|
29
|
+
export function ShareSheet({ title, link, error, face, name, gets, invite, notes, password, own, onRenew, onStop, stop, onClose, children, notices, rooms, onRoomEvent, }) {
|
|
30
30
|
const t = useT();
|
|
31
31
|
const [copied, copy] = useCopied();
|
|
32
32
|
const [stopping, setStopping] = React.useState(false);
|
|
33
33
|
const [picking, setPicking] = React.useState(false);
|
|
34
34
|
const friends = useShareFriends(rooms);
|
|
35
|
+
const [sends, setSends] = React.useState(0);
|
|
36
|
+
const sent = useFriendSends(rooms, own ? undefined : link, sends, onRoomEvent);
|
|
35
37
|
const canFriends = !own && !!(friends === null || friends === void 0 ? void 0 : friends.length);
|
|
36
38
|
const canSend = !own && typeof navigator !== 'undefined' && typeof navigator.share === 'function';
|
|
37
39
|
const end = async () => {
|
|
@@ -66,11 +68,17 @@ export function ShareSheet({ title, link, error, face, name, gets, invite, notes
|
|
|
66
68
|
" ",
|
|
67
69
|
React.createElement("code", null, password)),
|
|
68
70
|
React.createElement("button", { type: "button", className: "ta-button", onClick: () => copy(password, 'password') }, copied === 'password' ? t('ta.share.copied') : t('ta.share.copyPassword')))),
|
|
69
|
-
picking && link && friends ? (React.createElement(ShareToFriends, { rooms: rooms, notices: notices, friends: friends, link: link, title: name || title, onDone:
|
|
71
|
+
picking && link && friends ? (React.createElement(ShareToFriends, { rooms: rooms, notices: notices, friends: friends, link: link, title: name || title, onDone: done => {
|
|
72
|
+
setPicking(false);
|
|
73
|
+
if (done) {
|
|
74
|
+
setSends(n => n + 1);
|
|
75
|
+
}
|
|
76
|
+
} })) : (React.createElement("div", { className: "ta-share-tiles" },
|
|
70
77
|
canFriends && React.createElement(Tile, { icon: Send, label: t('ta.share.friends'), disabled: !link, onClick: () => setPicking(true) }),
|
|
71
78
|
React.createElement(Tile, { icon: copied === 'link' ? Check : Copy, label: copied === 'link' ? t('ta.share.copied') : t('ta.share.copy'), disabled: !link, onClick: () => link && copy(shareMessage(invite, link), 'link') }),
|
|
72
79
|
canSend && (React.createElement(Tile, { icon: Share2, label: t('ta.share.apps'), disabled: !link, onClick: () => link && void navigator.share({ title: name || title, text: invite, url: link }).catch(() => undefined) })),
|
|
73
80
|
onRenew && React.createElement(Tile, { icon: RefreshCw, label: t('ta.share.renew'), disabled: !link, onClick: onRenew }))),
|
|
81
|
+
!picking && React.createElement(FriendSends, { sent: sent }),
|
|
74
82
|
children,
|
|
75
83
|
lines.length > 0 && (React.createElement("div", { className: "ta-share-notes" }, lines.map(line => (React.createElement("p", { key: line }, line))))),
|
|
76
84
|
onStop && link && (React.createElement("button", { type: "button", className: `ta-share-stop${stopping ? ' ta-busy' : ''}`, disabled: stopping, onClick: () => void end() },
|
|
@@ -78,3 +78,26 @@ export interface WebChatIconSource {
|
|
|
78
78
|
/** What `icon` answers changed: the lists draw their rows again. */
|
|
79
79
|
subscribe?(listener: () => void): () => void;
|
|
80
80
|
}
|
|
81
|
+
/** What a session still opening is shown as (`switchSession`): the head of its conversation, till it comes. */
|
|
82
|
+
export interface WebSessionOpening {
|
|
83
|
+
title?: string;
|
|
84
|
+
cwd?: string;
|
|
85
|
+
/** Its session file, when known: what the device kept of the conversation shows while it opens, and while the computer cannot be reached. */
|
|
86
|
+
sessionFile?: string;
|
|
87
|
+
}
|
|
88
|
+
/** What a notice of an extension has besides its message (WebExtensionUI.notify). */
|
|
89
|
+
export interface WebNotifyOptions {
|
|
90
|
+
action?: {
|
|
91
|
+
label: string;
|
|
92
|
+
run(): void;
|
|
93
|
+
};
|
|
94
|
+
key?: string;
|
|
95
|
+
/** Ta did it for the user: drawn with the double's face, the message as its head (`修改了设置`). */
|
|
96
|
+
ta?: boolean;
|
|
97
|
+
/** What it changed, a row each under the message: `{ label: '通话字幕', before: '关', after: '开' }`, or a name alone. */
|
|
98
|
+
changes?: {
|
|
99
|
+
label?: string;
|
|
100
|
+
before?: string;
|
|
101
|
+
after: string;
|
|
102
|
+
}[];
|
|
103
|
+
}
|
|
@@ -20,6 +20,20 @@ export interface WebDeviceUI {
|
|
|
20
20
|
*/
|
|
21
21
|
readonly apps?: WebApps;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* A tab the browser view should open or close, as Ta Desktop tells it (`ui.onWebviewTab`): a page of a webview opened a
|
|
25
|
+
* link as a new tab (`target="_blank"`, Cmd+click, the middle button, Open Link in New Tab), behind when `background`;
|
|
26
|
+
* or the user pressed Cmd+T or Cmd+W in it. `from` is that webview's `getWebContentsId()`.
|
|
27
|
+
*/
|
|
28
|
+
export type WebviewTabEvent = {
|
|
29
|
+
type: 'open';
|
|
30
|
+
url: string;
|
|
31
|
+
background: boolean;
|
|
32
|
+
from: number;
|
|
33
|
+
} | {
|
|
34
|
+
type: 'new' | 'close';
|
|
35
|
+
from: number;
|
|
36
|
+
};
|
|
23
37
|
export interface WebDesktop {
|
|
24
38
|
/** Node's `process.platform` of the machine (`darwin`, `win32`, `linux`): what its file manager is called. */
|
|
25
39
|
readonly platform: string;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { SkinGlass } from '../settings/settings-protocol.js';
|
|
3
|
+
import type { WebLabel } from './web-api-contributions.js';
|
|
4
|
+
/** Light glass with dark words, or dark glass with light words. */
|
|
5
|
+
export type WebSkinTone = 'light' | 'dark';
|
|
6
|
+
/** How much of the picture the columns of Ta let through: clear, soft (the default), or focus, nearly solid (Settings → Appearance). */
|
|
7
|
+
export type WebSkinGlass = SkinGlass;
|
|
8
|
+
/**
|
|
9
|
+
* The colours of a tone of a skin, each a CSS colour without alpha; Ta makes every surface, word and line of its
|
|
10
|
+
* columns from them (docs/design/ta-skins.md 3). Any it leaves out is Ta's own.
|
|
11
|
+
*/
|
|
12
|
+
export interface WebSkinColors {
|
|
13
|
+
/** What the picture shows before it draws (it loads, it starts again), under it, and the window's own colour. */
|
|
14
|
+
base: string;
|
|
15
|
+
/** The glass of the columns, made more or less clear by the user's choice (WebSkinGlass). */
|
|
16
|
+
glass?: string;
|
|
17
|
+
/** Words: titles in it, the body and the quieter lines mixed toward the glass. */
|
|
18
|
+
ink?: string;
|
|
19
|
+
/** What stands out: the brand buttons, links, what is chosen. */
|
|
20
|
+
accent?: string;
|
|
21
|
+
}
|
|
22
|
+
/** A rectangle of the window, in CSS pixels. */
|
|
23
|
+
export interface WebSkinRect {
|
|
24
|
+
left: number;
|
|
25
|
+
top: number;
|
|
26
|
+
right: number;
|
|
27
|
+
bottom: number;
|
|
28
|
+
}
|
|
29
|
+
/** Where the picture is under Ta now (WebSkinBackdropProps.areas). */
|
|
30
|
+
export interface WebSkinAreas {
|
|
31
|
+
/** Where words are read (the conversation, the message box, the settings): the picture is calmest behind them. */
|
|
32
|
+
read: WebSkinRect[];
|
|
33
|
+
/** Where columns cover it (the list of chats, the workbench, the navigation): what matters is not put there. */
|
|
34
|
+
cover: WebSkinRect[];
|
|
35
|
+
}
|
|
36
|
+
/** What a backdrop is given: it draws the whole window, behind every column of Ta, and never takes the pointer. */
|
|
37
|
+
export interface WebSkinBackdropProps {
|
|
38
|
+
/** The tone Ta shows in now. */
|
|
39
|
+
tone: WebSkinTone;
|
|
40
|
+
/** How clear the user wants the glass. */
|
|
41
|
+
glass: WebSkinGlass;
|
|
42
|
+
/**
|
|
43
|
+
* Sets the tone of Ta while the skin shows (its night, its day), as a theme of the settings would; undefined gives
|
|
44
|
+
* it back to `WebSkin.tone`, else the user's theme. Ta switches once, not to and fro: tell it a new tone only past a margin.
|
|
45
|
+
*/
|
|
46
|
+
setTone(tone: WebSkinTone | undefined): void;
|
|
47
|
+
/** Where words are read and where columns cover the picture, now: read it each frame, it costs little. */
|
|
48
|
+
areas(): WebSkinAreas;
|
|
49
|
+
/** It has drawn its first frame: Ta fades it in over its picture (`keep`) and lets the one before go. */
|
|
50
|
+
ready(): void;
|
|
51
|
+
/**
|
|
52
|
+
* A small picture of how it looks now (a `data:` URL of a JPEG some 480 pixels wide): kept on this device, shown
|
|
53
|
+
* under it the next time while it loads, or while it starts again, so that the window never shows blank.
|
|
54
|
+
*/
|
|
55
|
+
keep(picture: string): void;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A look of Ta: a picture behind it, which its columns show through as glass (`registerSkin`). The user picks it
|
|
59
|
+
* in Settings → Appearance, as the theme; Ta draws the glass, the words, the title bar and the window in its colours,
|
|
60
|
+
* so a skin is its picture and a few colours, never styles of Ta's own classes.
|
|
61
|
+
*/
|
|
62
|
+
export interface WebSkin {
|
|
63
|
+
/** Unique among the skins of the extension. */
|
|
64
|
+
id: string;
|
|
65
|
+
title: WebLabel;
|
|
66
|
+
/** Drawn behind Ta, the size of the window: a picture, a 3D world (`ui.Game3D`), anything. */
|
|
67
|
+
backdrop: React.ComponentType<WebSkinBackdropProps>;
|
|
68
|
+
/** Its colours in each tone. */
|
|
69
|
+
colors: {
|
|
70
|
+
light: WebSkinColors;
|
|
71
|
+
dark: WebSkinColors;
|
|
72
|
+
};
|
|
73
|
+
/** Its tone while its backdrop sets none; default the user's theme. */
|
|
74
|
+
tone?: WebSkinTone;
|
|
75
|
+
/**
|
|
76
|
+
* Its backdrop softens itself behind the columns and the words (`areas`), as a 3D world does in its last pass: the
|
|
77
|
+
* page does not blur it again, which would cost a blur of the window at each of its frames. Without, the page blurs
|
|
78
|
+
* what is behind its columns, which a still picture costs nothing.
|
|
79
|
+
*/
|
|
80
|
+
softens?: boolean;
|
|
81
|
+
}
|
|
82
|
+
export interface WebSkinsAPI {
|
|
83
|
+
/**
|
|
84
|
+
* A look of Ta: a picture behind it and the colours of its glass (docs/design/ta-skins.md), which the user picks in
|
|
85
|
+
* Settings → Appearance. Newer than some Ta apps: `pi.registerSkin?.(…)`.
|
|
86
|
+
*/
|
|
87
|
+
registerSkin(skin: WebSkin): void;
|
|
88
|
+
}
|
|
89
|
+
/** A skin of an extension, as Ta lists them. */
|
|
90
|
+
export interface WebSkinEntry {
|
|
91
|
+
/** `<package name>/<skin id>`: what the settings keep, the same on every device. */
|
|
92
|
+
id: string;
|
|
93
|
+
extension: string;
|
|
94
|
+
skin: WebSkin;
|
|
95
|
+
}
|
|
@@ -130,6 +130,7 @@ export const WEB_UI_SPEC = {
|
|
|
130
130
|
pinChat: page,
|
|
131
131
|
desktop: page,
|
|
132
132
|
debugWebview: page,
|
|
133
|
+
onWebviewTab: page,
|
|
133
134
|
useCwd: page,
|
|
134
135
|
useSessionId: page,
|
|
135
136
|
useSessions: page,
|
|
@@ -181,6 +182,8 @@ export const WEB_API_SPEC = {
|
|
|
181
182
|
registerToolRenderer: page,
|
|
182
183
|
registerComposerAddon: page,
|
|
183
184
|
registerRoomAddon: page,
|
|
185
|
+
// Its backdrop is drawn behind the page, given functions: only in the page.
|
|
186
|
+
registerSkin: page,
|
|
184
187
|
registerOpener: page,
|
|
185
188
|
registerSearch: page,
|
|
186
189
|
registerPartners: page,
|
|
@@ -6,8 +6,8 @@ import type { ScreenPartSpec, TaScreen } from '../screen/screen-protocol.js';
|
|
|
6
6
|
import type { Language, Theme } from '../settings/settings-protocol.js';
|
|
7
7
|
import type { WebCodeRendererOptions, WebCodeRendererProps } from './web-api-code.js';
|
|
8
8
|
import type { CodeEditorProps, DiffEditorProps, WebAvatarProps, WebChatImagesProps, WebComposerProps, WebConversationViewProps, WebDialogProps, WebEmptyProps, WebFaceProps, WebFolderPickerProps, WebFullScreenProps, WebGroupFaceProps, WebHoldToTalkProps, WebImageViewerProps, WebLoadingProps, WebModelPickerProps, WebPictureCardsProps, WebPictureProps, WebSelectBarProps, WebSelectCheckProps, WebShareSheetProps, WebStackProps, WebSwipeRowProps, WebSwitchProps, WebTaskIconProps, WebVoice } from './web-api-components.js';
|
|
9
|
-
import type { WebAsk, WebCallsAPI, WebChatIconSource, WebChatTagsAPI, WebComposerAddon, WebCustomMessage, WebHomeSource, WebInitiative, WebMenuItem, WebOpener, WebOpenerOptions, WebRoomAddon, WebRoomAddonEntry, WebSearchSource, WebSessionNotice, WebSettingsSection, WebShareTarget, WebTaskEntry, WebTaskRemoval, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WebViewInfo, WidgetOptions } from './web-api-contributions.js';
|
|
10
|
-
import type { WebDesktop, WebDeviceUI, WebFileDrag } from './web-api-desktop.js';
|
|
9
|
+
import type { WebAsk, WebCallsAPI, WebChatIconSource, WebChatTagsAPI, WebComposerAddon, WebCustomMessage, WebHomeSource, WebInitiative, WebMenuItem, WebNotifyOptions, WebOpener, WebOpenerOptions, WebRoomAddon, WebRoomAddonEntry, WebSearchSource, WebSessionNotice, WebSessionOpening, WebSettingsSection, WebShareTarget, WebTaskEntry, WebTaskRemoval, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WebViewInfo, WidgetOptions } from './web-api-contributions.js';
|
|
10
|
+
import type { WebDesktop, WebDeviceUI, WebFileDrag, WebviewTabEvent } from './web-api-desktop.js';
|
|
11
11
|
import type { WebEditorsUI } from './web-api-editors.js';
|
|
12
12
|
import type { WebFileViews, WebFileViewsUI } from './web-api-file-views.js';
|
|
13
13
|
import type { WebHomeUI, WebPartnersAPI, WebPartnersUI } from './web-api-home.js';
|
|
@@ -16,6 +16,7 @@ import type { WebHosts } from './web-api-hosts.js';
|
|
|
16
16
|
import type { WebFileRef, WebMenus, WebShareUI } from './web-api-menus.js';
|
|
17
17
|
import type { WebPlayUI } from './web-api-play.js';
|
|
18
18
|
import type { WebServices } from './web-api-services.js';
|
|
19
|
+
import type { WebSkinsAPI } from './web-api-skins.js';
|
|
19
20
|
import type { WebPackageStorage } from './web-api-storage.js';
|
|
20
21
|
import type { WebTargetsAPI } from './web-api-targets.js';
|
|
21
22
|
import type { WebTerminal, WebTerminalOptions } from './web-api-terminal.js';
|
|
@@ -39,6 +40,7 @@ export type * from './web-api-hosts.js';
|
|
|
39
40
|
export type * from './web-api-menus.js';
|
|
40
41
|
export type * from './web-api-play.js';
|
|
41
42
|
export type * from './web-api-services.js';
|
|
43
|
+
export type * from './web-api-skins.js';
|
|
42
44
|
export type * from './web-api-storage.js';
|
|
43
45
|
export type * from './web-api-targets.js';
|
|
44
46
|
export type * from './web-api-terminal.js';
|
|
@@ -47,7 +49,7 @@ export type { WebPageInfo, WebPageState } from './web-pages.js';
|
|
|
47
49
|
* What a web extension gets: the web client's side of pi's extension API, its names where they mean the same. A web
|
|
48
50
|
* extension is one ES module without imports, the `web` part of a pi package (TaWebExtensionInfo): a {@link WebExtensionFactory}.
|
|
49
51
|
*/
|
|
50
|
-
export interface WebExtensionAPI extends WebServices, WebPartnersAPI, WebMenus, WebFileViews, WebCallsAPI, WebChatTagsAPI, WebTargetsAPI, WebHostAPI {
|
|
52
|
+
export interface WebExtensionAPI extends WebServices, WebPartnersAPI, WebMenus, WebFileViews, WebCallsAPI, WebChatTagsAPI, WebTargetsAPI, WebHostAPI, WebSkinsAPI {
|
|
51
53
|
/** The React of the page: an extension brings no React of its own. */
|
|
52
54
|
readonly React: typeof React;
|
|
53
55
|
readonly ui: WebExtensionUI;
|
|
@@ -179,34 +181,11 @@ export interface WebExtensionAPI extends WebServices, WebPartnersAPI, WebMenus,
|
|
|
179
181
|
/** Output of the terminals this page opened (terminals.openTerminal); with `exitCode`, the terminal ended. Stops when the extension unloads. */
|
|
180
182
|
onTerminalData(listener: (terminalId: string, data: string, exitCode?: number) => void): () => void;
|
|
181
183
|
}
|
|
182
|
-
/** What a session still opening is shown as (`switchSession`): the head of its conversation, till it comes. */
|
|
183
|
-
export interface WebSessionOpening {
|
|
184
|
-
title?: string;
|
|
185
|
-
cwd?: string;
|
|
186
|
-
/** Its session file, when known: what the device kept of the conversation shows while it opens, and while the computer cannot be reached. */
|
|
187
|
-
sessionFile?: string;
|
|
188
|
-
}
|
|
189
184
|
/** An icon, drawn at `size` pixels in `currentColor`. */
|
|
190
185
|
export type WebIcon = React.ComponentType<{
|
|
191
186
|
size?: number | string;
|
|
192
187
|
strokeWidth?: number | string;
|
|
193
188
|
}>;
|
|
194
|
-
/** What a notice of an extension has besides its message (WebExtensionUI.notify). */
|
|
195
|
-
export interface WebNotifyOptions {
|
|
196
|
-
action?: {
|
|
197
|
-
label: string;
|
|
198
|
-
run(): void;
|
|
199
|
-
};
|
|
200
|
-
key?: string;
|
|
201
|
-
/** Ta did it for the user: drawn with the double's face, the message as its head (`修改了设置`). */
|
|
202
|
-
ta?: boolean;
|
|
203
|
-
/** What it changed, a row each under the message: `{ label: '通话字幕', before: '关', after: '开' }`, or a name alone. */
|
|
204
|
-
changes?: {
|
|
205
|
-
label?: string;
|
|
206
|
-
before?: string;
|
|
207
|
-
after: string;
|
|
208
|
-
}[];
|
|
209
|
-
}
|
|
210
189
|
/** What web extensions see of TaScreen. */
|
|
211
190
|
export type WebScreen = Pick<TaScreen, 'agent' | 'parts' | 'act' | 'element' | 'where' | 'places' | 'go' | 'pageScroll' | 'scroll'>;
|
|
212
191
|
export interface WebExtensionUI extends WebHomeUI, WebPartnersUI, WebEditorsUI, WebDeviceUI, WebPlayUI, WebShareUI, WebFileViewsUI, WebHostUI {
|
|
@@ -283,6 +262,12 @@ export interface WebExtensionUI extends WebHomeUI, WebPartnersUI, WebEditorsUI,
|
|
|
283
262
|
* element's `loadURL`); the app refuses the rest.
|
|
284
263
|
*/
|
|
285
264
|
readonly debugWebview?: (webContentsId: number, method: string, params?: Record<string, unknown>) => Promise<unknown>;
|
|
265
|
+
/**
|
|
266
|
+
* Ta Desktop: hears the tabs the pages of this page's `<webview>`s open or close (WebviewTabEvent); returns how to
|
|
267
|
+
* stop. Hearing tells the app the view has tabs: until then, and in an older app, a page opens its new tabs in place
|
|
268
|
+
* and Cmd+W goes to the app. `undefined` elsewhere.
|
|
269
|
+
*/
|
|
270
|
+
readonly onWebviewTab?: (listener: (event: WebviewTabEvent) => void) => () => void;
|
|
286
271
|
/**
|
|
287
272
|
* Into the message box in front (a conversation's, or `ui.Composer` of a page): `quote` before what it holds, `images`
|
|
288
273
|
* (base64) as if pasted; false when none shows.
|
|
@@ -196,6 +196,7 @@ export class WebExtensionContext {
|
|
|
196
196
|
registerSearch: source => register(() => run.searches.push(source)),
|
|
197
197
|
registerComposerAddon: addon => register(() => run.composerAddons.push(addon)),
|
|
198
198
|
registerRoomAddon: addon => register(() => run.roomAddons.push(addon)),
|
|
199
|
+
registerSkin: skin => register(() => run.skins.push(skin)),
|
|
199
200
|
registerSettings: section => register(() => run.settingsSections.push(section)),
|
|
200
201
|
registerSessionMenu: menu => register(() => run.sessionMenus.push(WebExtensionRunUtil.menu(run, menu))),
|
|
201
202
|
registerFileMenu: menu => register(() => run.fileMenus.push(WebExtensionRunUtil.menu(run, menu))),
|
|
@@ -235,6 +236,7 @@ export class WebExtensionContext {
|
|
|
235
236
|
const { host } = this;
|
|
236
237
|
const { workbench, settings, notices } = host;
|
|
237
238
|
const subscribe = (listener) => host.extensions.subscribe(listener);
|
|
239
|
+
const webviewTabs = DesktopUtil.webviewTabs();
|
|
238
240
|
return {
|
|
239
241
|
setWidget: (key, component, options = {}) => register(() => (component ? run.widgets.set(key, { component, options }) : run.widgets.delete(key))),
|
|
240
242
|
notify: (message, type = 'info', options = {}) => {
|
|
@@ -275,6 +277,8 @@ export class WebExtensionContext {
|
|
|
275
277
|
desktop: DesktopUtil.fileManager(),
|
|
276
278
|
fileDrag: WEB_FILE_DRAG,
|
|
277
279
|
debugWebview: DesktopUtil.debugWebview(),
|
|
280
|
+
// Heard while the extension runs, as `hear` of the API.
|
|
281
|
+
onWebviewTab: webviewTabs && (listener => WebExtensionRunUtil.track(run, () => webviewTabs(event => host.guard(run, () => listener(event))))),
|
|
278
282
|
addToComposer: draft => !run.stopped && ComposerTarget.add(draft),
|
|
279
283
|
// An extension opens, closes and marks only tabs of its own.
|
|
280
284
|
openEditor: (editor, options) => !run.stopped && host.tabs.open({ ...editor, extension: run.loaded.id, preview: (options === null || options === void 0 ? void 0 : options.preview) === true }, (options === null || options === void 0 ? void 0 : options.preserveFocus) === true),
|
|
@@ -2,7 +2,7 @@ import type { TaEvent, TaTemporaryFrom, TaWebExtensionInfo } from '@celljs/ta-pr
|
|
|
2
2
|
import type * as React from 'react';
|
|
3
3
|
import type { MessageId } from '../i18n/messages.js';
|
|
4
4
|
import type { BlockSpeech } from '../util/spoken.js';
|
|
5
|
-
import type { WebAvatarProps, WebCallMouth, WebCallMoves, WebCallPartner, WebChatIconSource, WebChatTagSource, WebCodeMenu, WebCodeRendererProps, WebComposerAddon, WebCustomMessage, WebEditor, WebExtensionFactory, WebFileMenu, WebFileView, WebHomeEntry, WebIcon, WebImage, WebInitiative, WebLabel, WebLinkDescriber, WebMenuItem, WebOpener, WebPageGroup, WebRoomAddonEntry, WebSearchSource, WebSessionMenu, WebSessionOpening, WebSettingsSection, WebShareItem, WebShareTarget, WebShareWay, WebTool, WebToolRendererResolver, WebViewLocation, WebViewPreview, WidgetOptions } from './web-extension-api.js';
|
|
5
|
+
import type { WebAvatarProps, WebCallMouth, WebCallMoves, WebCallPartner, WebChatIconSource, WebChatTagSource, WebCodeMenu, WebCodeRendererProps, WebComposerAddon, WebCustomMessage, WebEditor, WebExtensionFactory, WebFileMenu, WebFileView, WebHomeEntry, WebIcon, WebImage, WebInitiative, WebLabel, WebLinkDescriber, WebMenuItem, WebOpener, WebPageGroup, WebRoomAddonEntry, WebSearchSource, WebSessionMenu, WebSessionOpening, WebSettingsSection, WebShareItem, WebShareTarget, WebShareWay, WebSkinEntry, WebTool, WebToolRendererResolver, WebViewLocation, WebViewPreview, WidgetOptions } from './web-extension-api.js';
|
|
6
6
|
import type { WebHomeBoard } from './web-home.js';
|
|
7
7
|
import type { PageUsage, WebPageInfo } from './web-pages.js';
|
|
8
8
|
import type { WebPartnerBoard } from './web-partners.js';
|
|
@@ -117,6 +117,8 @@ export interface WebExtensionsState {
|
|
|
117
117
|
composerAddons: WebComposerAddonEntry[];
|
|
118
118
|
/** What extensions add to the rooms (WebExtensionAPI.registerRoomAddon). */
|
|
119
119
|
roomAddons: WebRoomAddonEntry[];
|
|
120
|
+
/** The looks extensions give Ta (WebExtensionAPI.registerSkin), in the order they loaded. */
|
|
121
|
+
skins: WebSkinEntry[];
|
|
120
122
|
/** The sections extensions add to the settings (WebExtensionAPI.registerSettings). */
|
|
121
123
|
settingsSections: WebSettingsEntry[];
|
|
122
124
|
renderers: Record<string, React.ComponentType<{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TaEvent } from '@celljs/ta-protocol';
|
|
2
2
|
import type * as React from 'react';
|
|
3
|
-
import type { WebCallMouth, WebCallMoves, WebCallPartner, WebChatIconSource, WebChatTagSource, WebCodeMenu, WebCodeRendererOptions, WebComposerAddon, WebFileMenu, WebFileView, WebHomeSource, WebInitiative, WebLinkDescriber, WebMenuItem, WebOpener, WebOpenerOptions, WebPartnerSource, WebRoomAddon, WebSearchSource, WebSessionMenu, WebSettingsSection, WebShareWay, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WebVoice, WidgetOptions } from './web-extension-api.js';
|
|
3
|
+
import type { WebCallMouth, WebCallMoves, WebCallPartner, WebChatIconSource, WebChatTagSource, WebCodeMenu, WebCodeRendererOptions, WebComposerAddon, WebFileMenu, WebFileView, WebHomeSource, WebInitiative, WebLinkDescriber, WebMenuItem, WebOpener, WebOpenerOptions, WebPartnerSource, WebRoomAddon, WebSearchSource, WebSessionMenu, WebSettingsSection, WebShareWay, WebSkin, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WebVoice, WidgetOptions } from './web-extension-api.js';
|
|
4
4
|
import type { LoadedWebExtension, WebExtensionsState } from './web-extension-protocol.js';
|
|
5
5
|
/** What an extension registered through its API: all of it goes when it stops. */
|
|
6
6
|
export interface WebRegistrations {
|
|
@@ -37,6 +37,7 @@ export interface WebRegistrations {
|
|
|
37
37
|
searches: WebSearchSource[];
|
|
38
38
|
composerAddons: WebComposerAddon[];
|
|
39
39
|
roomAddons: WebRoomAddon[];
|
|
40
|
+
skins: WebSkin[];
|
|
40
41
|
fileViews: WebFileView[];
|
|
41
42
|
settingsSections: WebSettingsSection[];
|
|
42
43
|
handlers: {
|
|
@@ -83,5 +84,5 @@ export declare namespace WebExtensionRunUtil {
|
|
|
83
84
|
*/
|
|
84
85
|
function voice(run: WebExtensionRun, voice: WebVoice): WebVoice;
|
|
85
86
|
/** What the extensions that run registered, as the page shows it: the first of a message type or a tool name wins. */
|
|
86
|
-
function collect(runs: readonly WebExtensionRun[], onOpen: (id: string) => boolean): Pick<WebExtensionsState, 'openers' | 'specificOpeners' | 'linkDescribers' | 'sessionMenus' | 'fileMenus' | 'fileViews' | 'codeMenus' | 'shareWays' | 'extensions' | 'views' | 'widgets' | 'composerAddons' | 'roomAddons' | 'settingsSections' | 'renderers' | 'codeRenderers' | 'codeSpeech' | 'codePointable' | 'callPartner' | 'callGroup' | 'callMouth' | 'callMoves' | 'avatars' | 'chatIcons' | 'chatTags' | 'initiatives' | 'tools' | 'toolRenderers' | 'searches'>;
|
|
87
|
+
function collect(runs: readonly WebExtensionRun[], onOpen: (id: string) => boolean): Pick<WebExtensionsState, 'openers' | 'specificOpeners' | 'linkDescribers' | 'sessionMenus' | 'fileMenus' | 'fileViews' | 'codeMenus' | 'shareWays' | 'extensions' | 'views' | 'widgets' | 'composerAddons' | 'roomAddons' | 'skins' | 'settingsSections' | 'renderers' | 'codeRenderers' | 'codeSpeech' | 'codePointable' | 'callPartner' | 'callGroup' | 'callMouth' | 'callMoves' | 'avatars' | 'chatIcons' | 'chatTags' | 'initiatives' | 'tools' | 'toolRenderers' | 'searches'>;
|
|
87
88
|
}
|
|
@@ -115,6 +115,7 @@ export var WebExtensionRunUtil;
|
|
|
115
115
|
searches: [],
|
|
116
116
|
composerAddons: [],
|
|
117
117
|
roomAddons: [],
|
|
118
|
+
skins: [],
|
|
118
119
|
fileViews: [],
|
|
119
120
|
settingsSections: [],
|
|
120
121
|
handlers: [],
|
|
@@ -258,6 +259,8 @@ export var WebExtensionRunUtil;
|
|
|
258
259
|
}); })),
|
|
259
260
|
composerAddons: runs.flatMap(run => run.composerAddons.map((addon, index) => ({ id: `${run.loaded.id}/${index}`, extension: run.loaded.id, addon }))),
|
|
260
261
|
roomAddons: runs.flatMap(run => run.roomAddons.map((addon, index) => ({ id: `${run.loaded.id}/${index}`, extension: run.loaded.id, addon }))),
|
|
262
|
+
// By the name of the package, which the settings keep: the same on every device.
|
|
263
|
+
skins: runs.flatMap(run => run.skins.map(skin => ({ id: `${run.loaded.name}/${skin.id}`, extension: run.loaded.name, skin }))),
|
|
261
264
|
settingsSections: runs.flatMap(run => run.settingsSections.map((section, index) => ({ id: `${run.loaded.id}/${index}`, extension: run.loaded.id, section }))),
|
|
262
265
|
renderers,
|
|
263
266
|
codeRenderers,
|
|
@@ -5,7 +5,12 @@ import { ShareSheet } from '../components/share-sheet.js';
|
|
|
5
5
|
* (`share`, its tiles the ways to share), and handing an extension on. None of it does anything once it stopped.
|
|
6
6
|
*/
|
|
7
7
|
export function shareUI(host, stopped) {
|
|
8
|
-
const sheet = (props) => React.createElement(ShareSheet, {
|
|
8
|
+
const sheet = (props) => React.createElement(ShareSheet, {
|
|
9
|
+
...props,
|
|
10
|
+
notices: host.notices,
|
|
11
|
+
rooms: host.workbench.rooms,
|
|
12
|
+
onRoomEvent: listener => host.workbench.onRoomEvent(listener, { messages: false }),
|
|
13
|
+
});
|
|
9
14
|
return {
|
|
10
15
|
shareExtension: target => !stopped() && host.extensions.share(target),
|
|
11
16
|
share: item => !stopped() && host.extensions.shareItem(item),
|
|
@@ -24,6 +24,9 @@ export declare const ASSISTANT_EN: {
|
|
|
24
24
|
'ta.assistant.speakStopShort': string;
|
|
25
25
|
'ta.assistant.poke': string;
|
|
26
26
|
'ta.assistant.stop': string;
|
|
27
|
+
'ta.assistant.pauseTasks': string;
|
|
28
|
+
'ta.assistant.resumeTasks': string;
|
|
29
|
+
'ta.assistant.pausedTasks': string;
|
|
27
30
|
'ta.assistant.restart': string;
|
|
28
31
|
'ta.assistant.restartTitle': string;
|
|
29
32
|
'ta.assistant.restartHint': string;
|
|
@@ -78,6 +81,7 @@ export declare const ASSISTANT_EN: {
|
|
|
78
81
|
'ta.task.verdictFail': string;
|
|
79
82
|
'ta.task.branch': string;
|
|
80
83
|
'ta.task.stopped': string;
|
|
84
|
+
'ta.task.paused': string;
|
|
81
85
|
'ta.task.waiting': string;
|
|
82
86
|
'ta.task.waitingPermission': string;
|
|
83
87
|
'ta.task.waitingQuestion': string;
|
|
@@ -24,6 +24,9 @@ export const ASSISTANT_EN = {
|
|
|
24
24
|
'ta.assistant.speakStopShort': 'Stop',
|
|
25
25
|
'ta.assistant.poke': 'Poke Ta',
|
|
26
26
|
'ta.assistant.stop': 'Stop',
|
|
27
|
+
'ta.assistant.pauseTasks': 'Pause all tasks',
|
|
28
|
+
'ta.assistant.resumeTasks': 'Resume paused tasks ({count})',
|
|
29
|
+
'ta.assistant.pausedTasks': 'Paused {count} tasks',
|
|
27
30
|
'ta.assistant.restart': 'Start over',
|
|
28
31
|
'ta.assistant.restartTitle': 'Start a new conversation with the double?',
|
|
29
32
|
'ta.assistant.restartHint': 'The current one stays in its session file; the tasks go on.',
|
|
@@ -78,6 +81,7 @@ export const ASSISTANT_EN = {
|
|
|
78
81
|
'ta.task.verdictFail': 'Check failed',
|
|
79
82
|
'ta.task.branch': 'Branch {branch}',
|
|
80
83
|
'ta.task.stopped': 'Stopped',
|
|
84
|
+
'ta.task.paused': 'Paused',
|
|
81
85
|
'ta.task.waiting': 'Waiting for you',
|
|
82
86
|
'ta.task.waitingPermission': 'Waiting for you to allow',
|
|
83
87
|
'ta.task.waitingQuestion': 'Waiting for your answer',
|
|
@@ -172,6 +172,7 @@ export declare const CHAT_EN: {
|
|
|
172
172
|
'ta.hear.getting': string;
|
|
173
173
|
'ta.hear.failed': string;
|
|
174
174
|
'ta.hear.retry': string;
|
|
175
|
+
'ta.hear.service': string;
|
|
175
176
|
'ta.hear.unsupported': string;
|
|
176
177
|
'ta.hear.unavailable': string;
|
|
177
178
|
'ta.hear.unavailableHint': string;
|
|
@@ -172,6 +172,7 @@ export const CHAT_EN = {
|
|
|
172
172
|
'ta.hear.getting': 'Your computer is downloading the speech model ({percent}%); speak again once it is ready',
|
|
173
173
|
'ta.hear.failed': 'The speech recognition of your computer is not ready',
|
|
174
174
|
'ta.hear.retry': 'Try again',
|
|
175
|
+
'ta.hear.service': 'Use a voice service',
|
|
175
176
|
'ta.hear.unsupported': "This device cannot recognize speech, nor can your computer run Ta's",
|
|
176
177
|
'ta.hear.unavailable': "This device cannot recognize speech, and Ta's speech recognition is off",
|
|
177
178
|
'ta.hear.unavailableHint': 'Turn on Real-time voice and Local models in Settings → Extensions.',
|
|
@@ -57,9 +57,6 @@ export declare const COMMON_EN: {
|
|
|
57
57
|
'ta.clip.pasteMany': string;
|
|
58
58
|
'ta.clip.pick': string;
|
|
59
59
|
'ta.clip.open': string;
|
|
60
|
-
'ta.clip.maybe': string;
|
|
61
|
-
'ta.clip.maybeDetail': string;
|
|
62
|
-
'ta.clip.none': string;
|
|
63
60
|
'ta.link.notFound': string;
|
|
64
61
|
'ta.terminal.openLink': string;
|
|
65
62
|
'ta.terminal.openLinkMac': string;
|
|
@@ -58,9 +58,6 @@ export const COMMON_EN = {
|
|
|
58
58
|
'ta.clip.pasteMany': '{count} links of Ta in what you pasted',
|
|
59
59
|
'ta.clip.pick': 'Tap one to open it',
|
|
60
60
|
'ta.clip.open': 'Open',
|
|
61
|
-
'ta.clip.maybe': 'There is a link in the clipboard',
|
|
62
|
-
'ta.clip.maybeDetail': 'An invite or a share of Ta opens with Open',
|
|
63
|
-
'ta.clip.none': 'No link of Ta in the clipboard',
|
|
64
61
|
'ta.link.notFound': '{path} is not there.',
|
|
65
62
|
'ta.terminal.openLink': 'Ctrl + click to open',
|
|
66
63
|
'ta.terminal.openLinkMac': 'Cmd + click to open',
|