@celljs/ta-web 4.24.1 → 4.26.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/README.en.md +1 -1
- package/README.md +1 -1
- package/esm/browser/account/account-side.js +3 -1
- package/esm/browser/assistant/assistant-task-source.js +3 -1
- package/esm/browser/assistant/assistant-thread.d.ts +5 -2
- package/esm/browser/assistant/assistant-thread.js +70 -46
- package/esm/browser/assistant/assistant-view.js +9 -3
- package/esm/browser/components/account-menu.d.ts +2 -1
- package/esm/browser/components/account-menu.js +12 -3
- package/esm/browser/components/app-nav.js +5 -5
- package/esm/browser/components/chat-asks.js +16 -1
- package/esm/browser/components/chat-home.d.ts +7 -2
- package/esm/browser/components/chat-home.js +2 -2
- package/esm/browser/components/chat-icon.d.ts +6 -1
- package/esm/browser/components/chat-icon.js +45 -4
- package/esm/browser/components/chat-list-hooks.d.ts +10 -0
- package/esm/browser/components/chat-list-hooks.js +15 -0
- package/esm/browser/components/chat-list.js +7 -9
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/composer-addon-util.d.ts +5 -0
- package/esm/browser/components/composer-addon-util.js +17 -0
- package/esm/browser/components/composer-addons.d.ts +3 -1
- package/esm/browser/components/composer-addons.js +5 -2
- package/esm/browser/components/editor-actions.d.ts +10 -0
- package/esm/browser/components/editor-actions.js +13 -0
- package/esm/browser/components/editor-area.js +8 -4
- package/esm/browser/components/fold-text.d.ts +4 -2
- package/esm/browser/components/fold-text.js +5 -4
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/image-swipe.d.ts +20 -0
- package/esm/browser/components/image-swipe.js +75 -0
- package/esm/browser/components/image-viewer.d.ts +2 -2
- package/esm/browser/components/image-viewer.js +2 -2
- package/esm/browser/components/message-footer.d.ts +2 -2
- package/esm/browser/components/message-footer.js +2 -2
- package/esm/browser/components/message-list.d.ts +12 -0
- package/esm/browser/components/message-list.js +31 -18
- package/esm/browser/components/message-user.js +5 -3
- package/esm/browser/components/nav-places.d.ts +2 -1
- package/esm/browser/components/nav-places.js +3 -2
- package/esm/browser/components/relay-services.d.ts +1 -1
- package/esm/browser/components/relay-services.js +11 -91
- package/esm/browser/components/said-text.d.ts +6 -2
- package/esm/browser/components/said-text.js +8 -2
- package/esm/browser/components/serve-restart.d.ts +11 -2
- package/esm/browser/components/serve-restart.js +64 -3
- package/esm/browser/components/session-view.js +3 -2
- package/esm/browser/components/settings-more.js +7 -4
- package/esm/browser/components/workbench-tabs.d.ts +4 -2
- package/esm/browser/components/workbench-tabs.js +5 -3
- package/esm/browser/extension/extension-view.d.ts +9 -1
- package/esm/browser/extension/extension-view.js +12 -1
- package/esm/browser/extension/icons.js +10 -1
- package/esm/browser/extension/web-api-contributions.d.ts +19 -14
- package/esm/browser/extension/web-api-editors.d.ts +32 -0
- package/esm/browser/extension/web-api-editors.js +2 -0
- package/esm/browser/extension/web-api-menus.d.ts +40 -0
- package/esm/browser/extension/web-api-menus.js +2 -0
- package/esm/browser/extension/web-api-partners.d.ts +6 -0
- package/esm/browser/extension/web-extension-api.d.ts +9 -26
- package/esm/browser/extension/web-extension-context.js +5 -9
- 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 +5 -2
- package/esm/browser/extension/web-extension-run.js +15 -0
- package/esm/browser/extension/web-home.js +8 -0
- package/esm/browser/extension/web-session-notices.js +8 -0
- package/esm/browser/i18n/locales.d.ts +12 -1
- package/esm/browser/i18n/messages-ja.js +13 -2
- package/esm/browser/i18n/messages-zh-tw.js +13 -2
- package/esm/browser/i18n/messages.d.ts +11 -0
- package/esm/browser/i18n/messages.js +27 -5
- package/esm/browser/notices/chime.d.ts +16 -0
- package/esm/browser/notices/chime.js +67 -0
- package/esm/browser/notices/session-notices.d.ts +8 -0
- package/esm/browser/notices/session-notices.js +23 -2
- package/esm/browser/share/shared-page.js +2 -1
- package/esm/browser/style/base.d.ts +1 -1
- package/esm/browser/style/base.js +5 -3
- package/esm/browser/style/conversation-column.d.ts +1 -1
- package/esm/browser/style/conversation-column.js +2 -2
- package/esm/browser/style/device.js +2 -2
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +9 -1
- package/esm/browser/style/shared.d.ts +1 -1
- package/esm/browser/style/shared.js +1 -0
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +7 -4
- package/esm/browser/style/tasks.d.ts +1 -1
- package/esm/browser/style/tasks.js +1 -1
- package/esm/browser/util/image-swipe.d.ts +14 -3
- package/esm/browser/util/image-swipe.js +26 -3
- package/esm/browser/util/process.d.ts +5 -0
- package/esm/browser/util/process.js +22 -1
- package/esm/browser/workbench-protocol.d.ts +5 -0
- package/esm/browser/workbench.d.ts +1 -0
- package/esm/browser/workbench.js +20 -0
- package/lib/browser/account/account-side.js +3 -1
- package/lib/browser/assistant/assistant-task-source.js +3 -1
- package/lib/browser/assistant/assistant-thread.d.ts +5 -2
- package/lib/browser/assistant/assistant-thread.js +70 -46
- package/lib/browser/assistant/assistant-view.js +8 -2
- package/lib/browser/components/account-menu.d.ts +2 -1
- package/lib/browser/components/account-menu.js +10 -1
- package/lib/browser/components/app-nav.js +4 -4
- package/lib/browser/components/chat-asks.js +16 -1
- package/lib/browser/components/chat-home.d.ts +7 -2
- package/lib/browser/components/chat-home.js +2 -2
- package/lib/browser/components/chat-icon.d.ts +6 -1
- package/lib/browser/components/chat-icon.js +45 -4
- package/lib/browser/components/chat-list-hooks.d.ts +10 -0
- package/lib/browser/components/chat-list-hooks.js +16 -0
- package/lib/browser/components/chat-list.js +6 -8
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/composer-addon-util.d.ts +5 -0
- package/lib/browser/components/composer-addon-util.js +17 -0
- package/lib/browser/components/composer-addons.d.ts +3 -1
- package/lib/browser/components/composer-addons.js +5 -2
- package/lib/browser/components/editor-actions.d.ts +11 -0
- package/lib/browser/components/editor-actions.js +50 -0
- package/lib/browser/components/editor-area.js +7 -3
- package/lib/browser/components/fold-text.d.ts +4 -2
- package/lib/browser/components/fold-text.js +5 -4
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/image-swipe.d.ts +20 -0
- package/lib/browser/components/image-swipe.js +75 -0
- package/lib/browser/components/image-viewer.d.ts +2 -2
- package/lib/browser/components/image-viewer.js +2 -2
- package/lib/browser/components/message-footer.d.ts +2 -2
- package/lib/browser/components/message-footer.js +3 -4
- package/lib/browser/components/message-list.d.ts +12 -0
- package/lib/browser/components/message-list.js +32 -18
- package/lib/browser/components/message-user.js +5 -3
- package/lib/browser/components/nav-places.d.ts +2 -1
- package/lib/browser/components/nav-places.js +3 -2
- package/lib/browser/components/relay-services.d.ts +1 -1
- package/lib/browser/components/relay-services.js +9 -89
- package/lib/browser/components/said-text.d.ts +6 -2
- package/lib/browser/components/said-text.js +8 -2
- package/lib/browser/components/serve-restart.d.ts +11 -2
- package/lib/browser/components/serve-restart.js +64 -3
- package/lib/browser/components/session-view.js +3 -2
- package/lib/browser/components/settings-more.js +7 -4
- package/lib/browser/components/workbench-tabs.d.ts +4 -2
- package/lib/browser/components/workbench-tabs.js +5 -3
- package/lib/browser/extension/extension-view.d.ts +9 -1
- package/lib/browser/extension/extension-view.js +12 -0
- package/lib/browser/extension/icons.js +9 -0
- package/lib/browser/extension/web-api-contributions.d.ts +19 -14
- package/lib/browser/extension/web-api-editors.d.ts +33 -0
- package/lib/browser/extension/web-api-editors.js +3 -0
- package/lib/browser/extension/web-api-menus.d.ts +41 -0
- package/lib/browser/extension/web-api-menus.js +3 -0
- package/lib/browser/extension/web-api-partners.d.ts +6 -0
- package/lib/browser/extension/web-extension-api.d.ts +9 -26
- package/lib/browser/extension/web-extension-context.js +5 -9
- 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 +5 -2
- package/lib/browser/extension/web-extension-run.js +15 -0
- package/lib/browser/extension/web-home.js +8 -0
- package/lib/browser/extension/web-session-notices.js +8 -0
- package/lib/browser/i18n/locales.d.ts +12 -1
- package/lib/browser/i18n/messages-ja.js +13 -2
- package/lib/browser/i18n/messages-zh-tw.js +13 -2
- package/lib/browser/i18n/messages.d.ts +11 -0
- package/lib/browser/i18n/messages.js +27 -5
- package/lib/browser/notices/chime.d.ts +17 -0
- package/lib/browser/notices/chime.js +71 -0
- package/lib/browser/notices/session-notices.d.ts +8 -0
- package/lib/browser/notices/session-notices.js +23 -2
- package/lib/browser/share/shared-page.js +2 -1
- package/lib/browser/style/base.d.ts +1 -1
- package/lib/browser/style/base.js +5 -3
- package/lib/browser/style/conversation-column.d.ts +1 -1
- package/lib/browser/style/conversation-column.js +2 -2
- package/lib/browser/style/device.js +2 -2
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +9 -1
- package/lib/browser/style/shared.d.ts +1 -1
- package/lib/browser/style/shared.js +1 -0
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +7 -4
- package/lib/browser/style/tasks.d.ts +1 -1
- package/lib/browser/style/tasks.js +1 -1
- package/lib/browser/util/image-swipe.d.ts +14 -3
- package/lib/browser/util/image-swipe.js +26 -3
- package/lib/browser/util/process.d.ts +5 -0
- package/lib/browser/util/process.js +22 -1
- package/lib/browser/workbench-protocol.d.ts +5 -0
- package/lib/browser/workbench.d.ts +1 -0
- package/lib/browser/workbench.js +20 -0
- package/package.json +7 -7
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Building2, Cloud, Database, ExternalLink, FileJson, Folder, GitBranch, HardDrive, Plus, Server, ShieldCheck, Trash2, } from 'lucide-react';
|
|
1
|
+
import { Building2, Cloud, Database, ExternalLink, FileJson, Folder, GitBranch, HardDrive, Plus, RefreshCw, Server, ShieldCheck, Trash2, } from 'lucide-react';
|
|
3
2
|
import * as React from 'react';
|
|
4
3
|
import { useNotices, useWorkbench } from '../hooks.js';
|
|
5
|
-
import {
|
|
4
|
+
import { useT } from '../i18n/use-t.js';
|
|
6
5
|
import { Icon, IconButton } from './icon.js';
|
|
7
6
|
import { AddCloudHost } from './remote-hosts.js';
|
|
8
7
|
import { Row } from './settings-controls.js';
|
|
9
|
-
/** The features that go through a relay, in the order the settings list them. */
|
|
10
|
-
const FEATURES = ['devices', 'share', 'rooms'
|
|
8
|
+
/** The features that go through a relay, in the order the settings list them; where sync goes is chosen in its own settings (ta-sync). */
|
|
9
|
+
const FEATURES = ['devices', 'share', 'rooms'];
|
|
11
10
|
export var RelayServicesUtil;
|
|
12
11
|
(function (RelayServicesUtil) {
|
|
13
12
|
/** What a service is called: the official relay, its name, else its host or its folder. */
|
|
@@ -116,7 +115,7 @@ export var RelayServicesUtil;
|
|
|
116
115
|
* made before (a device, a room, a link) stays on its relay when the choice changes.
|
|
117
116
|
*/
|
|
118
117
|
export function RelayServices() {
|
|
119
|
-
var _a
|
|
118
|
+
var _a;
|
|
120
119
|
const t = useT();
|
|
121
120
|
const [workbench, bench] = useWorkbench();
|
|
122
121
|
const [, notices] = useNotices();
|
|
@@ -124,8 +123,6 @@ export function RelayServices() {
|
|
|
124
123
|
const [probes, setProbes] = React.useState({});
|
|
125
124
|
const [url, setUrl] = React.useState('');
|
|
126
125
|
const [busy, setBusy] = React.useState();
|
|
127
|
-
const [form, setForm] = React.useState();
|
|
128
|
-
const language = useLanguage();
|
|
129
126
|
const read = React.useCallback(async () => {
|
|
130
127
|
const listed = await bench.relay.listRelays();
|
|
131
128
|
setRelays(listed);
|
|
@@ -160,33 +157,19 @@ export function RelayServices() {
|
|
|
160
157
|
await read().catch(() => undefined);
|
|
161
158
|
}
|
|
162
159
|
};
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const value = text.trim();
|
|
166
|
-
const id = /^[/~]/.test(value) ? await bench.relay.addFolder(value, name) : await bench.relay.addRelay(value);
|
|
160
|
+
const add = (text = url) => run('add', async () => {
|
|
161
|
+
const id = await bench.relay.addRelay(text.trim());
|
|
167
162
|
setUrl('');
|
|
168
163
|
const probe = await bench.relay.probeRelay(id);
|
|
169
164
|
setProbes(before => ({ ...before, [id]: probe }));
|
|
170
165
|
});
|
|
171
|
-
/** A drive found here: its folder added, and sync goes there. */
|
|
172
|
-
const takeDrive = (drive) => run(`drive:${drive.path}`, async () => {
|
|
173
|
-
const id = await bench.relay.addFolder(drive.path, drive.name);
|
|
174
|
-
setRelays(await bench.relay.chooseRelay('sync', id));
|
|
175
|
-
const probe = await bench.relay.probeRelay(id);
|
|
176
|
-
setProbes(before => ({ ...before, [id]: probe }));
|
|
177
|
-
});
|
|
178
|
-
/** A store just added: sync goes there. */
|
|
179
|
-
const stored = async (id) => {
|
|
180
|
-
setRelays(await bench.relay.chooseRelay('sync', id));
|
|
181
|
-
setForm(undefined);
|
|
182
|
-
const probe = await bench.relay.probeRelay(id);
|
|
183
|
-
setProbes(before => ({ ...before, [id]: probe }));
|
|
184
|
-
};
|
|
185
166
|
if (!relays) {
|
|
186
167
|
return null;
|
|
187
168
|
}
|
|
188
169
|
const used = new Set(Object.values(relays.use));
|
|
189
170
|
const types = (_a = relays.types) !== null && _a !== void 0 ? _a : [];
|
|
171
|
+
// Folders and stores are places of sync, chosen and removed there.
|
|
172
|
+
const shown = relays.relays.filter(relay => relay.type === 'ta-relay');
|
|
190
173
|
return (React.createElement(React.Fragment, null,
|
|
191
174
|
React.createElement(Deployment, { relays: relays, changed: listed => {
|
|
192
175
|
var _a;
|
|
@@ -201,22 +184,9 @@ export function RelayServices() {
|
|
|
201
184
|
React.createElement("select", { className: "ta-input ta-select", "aria-label": t(`ta.relays.feature.${feature}`), disabled: busy !== undefined, value: (_a = relays.use[feature]) !== null && _a !== void 0 ? _a : '', onChange: event => void run(feature, async () => setRelays(await bench.relay.chooseRelay(feature, event.target.value || null))) }, relays.relays
|
|
202
185
|
.filter(relay => RelayServicesUtil.serves(relay, feature) || relays.use[feature] === relay.id)
|
|
203
186
|
.map(relay => (React.createElement("option", { key: relay.id, value: relay.id }, RelayServicesUtil.label(relay, t))))))); }),
|
|
204
|
-
|
|
187
|
+
shown.map(relay => { var _a; return (React.createElement(Row, { key: relay.id, icon: RelayServicesUtil.icon(relay, types), label: RelayServicesUtil.label(relay, t), description: React.createElement("span", { className: "ta-remote-state" },
|
|
205
188
|
React.createElement("span", { className: `ta-remote-light${((_a = probes[relay.id]) === null || _a === void 0 ? void 0 : _a.online) ? ' ta-on' : ''}` }),
|
|
206
189
|
RelayServicesUtil.line(relay, probes[relay.id], t)) }, !relay.builtin && relay.id !== 'relay-json' && !used.has(relay.id) && (React.createElement(IconButton, { icon: Trash2, label: t('ta.relays.remove', { name: RelayServicesUtil.label(relay, t) }), disabled: busy !== undefined, onClick: () => void run(relay.id, () => bench.relay.removeRelay(relay.id)) })))); }),
|
|
207
|
-
((_b = relays.drives) !== null && _b !== void 0 ? _b : []).map(drive => (React.createElement(Row, { key: drive.path, icon: Cloud, label: t('ta.relays.drive', { name: drive.name }), description: t('ta.relays.driveHint', { path: drive.path }) },
|
|
208
|
-
React.createElement("button", { type: "button", className: `ta-button${busy === `drive:${drive.path}` ? ' ta-busy' : ''}`, disabled: busy !== undefined, onClick: () => void takeDrive(drive) },
|
|
209
|
-
busy === `drive:${drive.path}` && React.createElement("span", { className: "ta-spinner ta-busy-mark" }),
|
|
210
|
-
React.createElement("span", null, t('ta.relays.driveUse')))))),
|
|
211
|
-
types.map(type => {
|
|
212
|
-
var _a;
|
|
213
|
-
const title = (_a = TaPackageTextUtil.pick(type.title, language)) !== null && _a !== void 0 ? _a : type.type;
|
|
214
|
-
const open = form === type.type;
|
|
215
|
-
return (React.createElement(React.Fragment, { key: `type:${type.type}` },
|
|
216
|
-
React.createElement(Row, { icon: RelayServicesUtil.iconNamed(type.icon), label: t('ta.relays.storeType', { name: title }), description: TaPackageTextUtil.pick(type.hint, language) }, !open && (React.createElement("button", { type: "button", className: "ta-button", disabled: busy !== undefined, onClick: () => setForm(type.type) }, t('ta.relays.storeOpen')))),
|
|
217
|
-
open && (React.createElement(Row, { label: "", stacked: true },
|
|
218
|
-
React.createElement(StoreForm, { type: type, title: title, close: () => setForm(undefined), added: stored })))));
|
|
219
|
-
}),
|
|
220
190
|
React.createElement(Row, { label: t('ta.relays.add'), description: t('ta.relays.addHint'), stacked: true },
|
|
221
191
|
React.createElement("form", { className: "ta-trusted-add", onSubmit: event => {
|
|
222
192
|
event.preventDefault();
|
|
@@ -227,6 +197,7 @@ export function RelayServices() {
|
|
|
227
197
|
busy === 'add' ? React.createElement("span", { className: "ta-spinner ta-busy-mark" }) : React.createElement(Icon, { icon: Plus, size: 14 }),
|
|
228
198
|
" ",
|
|
229
199
|
t('ta.relays.addButton')))),
|
|
200
|
+
React.createElement(Row, { icon: RefreshCw, label: t('ta.relays.syncElsewhere'), description: t('ta.relays.syncElsewhereHint') }),
|
|
230
201
|
React.createElement(Row, { icon: FileJson, label: t('ta.relays.file'), description: React.createElement("span", { className: "ta-path" }, relays.file) })));
|
|
231
202
|
}
|
|
232
203
|
/**
|
|
@@ -302,55 +273,4 @@ function Deployment({ relays, changed }) {
|
|
|
302
273
|
t('ta.deploy.open')),
|
|
303
274
|
clouds && !added && React.createElement(AddCloudHost, { url: gateway, name: RelayServicesUtil.cloudName(gateway), onAdded: readClouds }))))));
|
|
304
275
|
}
|
|
305
|
-
/**
|
|
306
|
-
* The form of a type of service a package registered (WebDAV, S3, git): its fields as the package said, secrets as
|
|
307
|
-
* passwords, and a name. Ta tries the store before it adds it; then sync goes there.
|
|
308
|
-
*/
|
|
309
|
-
function StoreForm({ type, title, close, added }) {
|
|
310
|
-
const t = useT();
|
|
311
|
-
const language = useLanguage();
|
|
312
|
-
const [, bench] = useWorkbench();
|
|
313
|
-
const [, notices] = useNotices();
|
|
314
|
-
const [values, setValues] = React.useState({});
|
|
315
|
-
const [name, setName] = React.useState('');
|
|
316
|
-
const [busy, setBusy] = React.useState(false);
|
|
317
|
-
const missing = type.options.some(option => { var _a; return !option.optional && !((_a = values[option.key]) === null || _a === void 0 ? void 0 : _a.trim()); });
|
|
318
|
-
const submit = async () => {
|
|
319
|
-
setBusy(true);
|
|
320
|
-
try {
|
|
321
|
-
const given = Object.fromEntries(Object.entries(values).map(([key, value]) => [key, value.trim()]));
|
|
322
|
-
await added(await bench.relay.addStore(type.type, given, name.trim() || title));
|
|
323
|
-
}
|
|
324
|
-
catch (error) {
|
|
325
|
-
notices.error(error);
|
|
326
|
-
}
|
|
327
|
-
finally {
|
|
328
|
-
setBusy(false);
|
|
329
|
-
}
|
|
330
|
-
};
|
|
331
|
-
return (React.createElement("form", { className: "ta-store-form", onSubmit: event => {
|
|
332
|
-
event.preventDefault();
|
|
333
|
-
void submit();
|
|
334
|
-
} },
|
|
335
|
-
type.options.map(option => { var _a, _b; return (React.createElement("label", { key: option.key, className: "ta-store-field" },
|
|
336
|
-
React.createElement("span", { className: "ta-store-field-label" }, (_a = TaPackageTextUtil.pick(option.label, language)) !== null && _a !== void 0 ? _a : option.key,
|
|
337
|
-
option.optional && React.createElement("span", { className: "ta-store-field-optional" }, t('ta.relays.optional'))),
|
|
338
|
-
React.createElement("input", { className: "ta-input", type: option.secret ? 'password' : 'text', autoComplete: option.secret ? 'new-password' : 'off', spellCheck: false, placeholder: option.placeholder, value: (_b = values[option.key]) !== null && _b !== void 0 ? _b : '', onChange: event => {
|
|
339
|
-
const value = event.target.value;
|
|
340
|
-
setValues(before => ({ ...before, [option.key]: value }));
|
|
341
|
-
} }))); }),
|
|
342
|
-
React.createElement("label", { className: "ta-store-field" },
|
|
343
|
-
React.createElement("span", { className: "ta-store-field-label" },
|
|
344
|
-
t('ta.relays.storeName'),
|
|
345
|
-
React.createElement("span", { className: "ta-store-field-optional" }, t('ta.relays.optional'))),
|
|
346
|
-
React.createElement("input", { className: "ta-input", value: name, placeholder: title, spellCheck: false, onChange: event => setName(event.target.value) })),
|
|
347
|
-
React.createElement("p", { className: "ta-store-form-note" },
|
|
348
|
-
React.createElement(Icon, { icon: ShieldCheck, size: 13 }),
|
|
349
|
-
React.createElement("span", null, t('ta.relays.storeNote'))),
|
|
350
|
-
React.createElement("div", { className: "ta-store-form-actions" },
|
|
351
|
-
React.createElement("button", { type: "button", className: "ta-button", disabled: busy, onClick: close }, t('ta.cancel')),
|
|
352
|
-
React.createElement("button", { type: "submit", className: `ta-button ta-primary${busy ? ' ta-busy' : ''}`, disabled: missing || busy },
|
|
353
|
-
busy && React.createElement("span", { className: "ta-spinner ta-busy-mark" }),
|
|
354
|
-
React.createElement("span", null, t('ta.relays.storeAdd'))))));
|
|
355
|
-
}
|
|
356
276
|
//# sourceMappingURL=relay-services.js.map
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* What the user wrote, in their bubble: the quote it starts with (QuoteUtil) set apart above the rest, as WeChat's.
|
|
4
|
+
* What a part of Ta wrote for them (`markdown`) is drawn as Markdown.
|
|
5
|
+
*/
|
|
6
|
+
export declare function SaidText({ text, className, markdown }: {
|
|
4
7
|
text: string;
|
|
5
8
|
className?: string;
|
|
9
|
+
markdown?: boolean;
|
|
6
10
|
}): React.JSX.Element;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { QuoteUtil } from '../util/quote.js';
|
|
3
3
|
import { FoldText } from './fold-text.js';
|
|
4
|
-
/**
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* What the user wrote, in their bubble: the quote it starts with (QuoteUtil) set apart above the rest, as WeChat's.
|
|
6
|
+
* What a part of Ta wrote for them (`markdown`) is drawn as Markdown.
|
|
7
|
+
*/
|
|
8
|
+
export function SaidText({ text, className, markdown }) {
|
|
9
|
+
if (markdown) {
|
|
10
|
+
return React.createElement(FoldText, { text: text, className: className, markdown: true });
|
|
11
|
+
}
|
|
6
12
|
const { quote, rest } = QuoteUtil.split(text);
|
|
7
13
|
if (!quote) {
|
|
8
14
|
return React.createElement(FoldText, { text: text, className: className });
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { TaServerInfo, TaServerUpdate } from '@celljs/ta-protocol';
|
|
1
|
+
import type { TaServerInfo, TaServerRelease, TaServerUpdate } from '@celljs/ta-protocol';
|
|
2
|
+
import { useT } from '../i18n/use-t.js';
|
|
3
|
+
import type { NoticeAction, TaNotices } from '../notices/notices-protocol.js';
|
|
2
4
|
export declare namespace ServeRestartUtil {
|
|
3
5
|
/** `v4.16.0`, with the commit of a build of the development channel: `v4.16.0 (695fbe1)`. */
|
|
4
6
|
function label(build: {
|
|
@@ -6,6 +8,8 @@ export declare namespace ServeRestartUtil {
|
|
|
6
8
|
build?: string;
|
|
7
9
|
}): string;
|
|
8
10
|
function key(update: TaServerUpdate): string;
|
|
11
|
+
/** The button that copies the command that installs a version, for the user to run it in a terminal. */
|
|
12
|
+
function copyCommand(command: string, notices: TaNotices, t: ReturnType<typeof useT>): NoticeAction;
|
|
9
13
|
/** Whether the page may restart Ta: the owner, of a Ta service that can restart itself. */
|
|
10
14
|
function restartable(server: TaServerInfo | undefined): boolean;
|
|
11
15
|
}
|
|
@@ -17,10 +21,15 @@ export interface RestartTa {
|
|
|
17
21
|
update?: TaServerUpdate;
|
|
18
22
|
/** Asks the user first, unless they already said so (the button of the notice of an update). */
|
|
19
23
|
restart(ask?: boolean): Promise<void>;
|
|
24
|
+
/** A newer version published, for the owner to install. */
|
|
25
|
+
release?: TaServerRelease;
|
|
26
|
+
/** Installs it, then restarts Ta to it where it can; a failure is told with the command to run by hand. */
|
|
27
|
+
install(): Promise<void>;
|
|
20
28
|
}
|
|
21
29
|
export declare function useRestartTa(): RestartTa;
|
|
22
30
|
/**
|
|
23
|
-
* Tells of
|
|
31
|
+
* Tells of a newer version published (TaServerInfo.release), with the command that installs it, once for each version;
|
|
32
|
+
* and of what restarting Ta is about, in a corner: another build installed (an update of Ta Desktop, `npm i -g`, a
|
|
24
33
|
* build of the repository), with Restart and Later, once for each build; Ta restarting, then back with its version.
|
|
25
34
|
*/
|
|
26
35
|
export declare function ServeRestartNotices(): null;
|
|
@@ -4,6 +4,8 @@ import { useT } from '../i18n/use-t.js';
|
|
|
4
4
|
import { storage } from '../workbench-util.js';
|
|
5
5
|
/** The build installed that the user put off restarting for (Later): not asked about again on this device. */
|
|
6
6
|
const LATER_KEY = 'ta.update.later';
|
|
7
|
+
/** The version published that the user put off installing (Later): not told of again on this device. */
|
|
8
|
+
const RELEASE_LATER_KEY = 'ta.release.later';
|
|
7
9
|
export var ServeRestartUtil;
|
|
8
10
|
(function (ServeRestartUtil) {
|
|
9
11
|
/** `v4.16.0`, with the commit of a build of the development channel: `v4.16.0 (695fbe1)`. */
|
|
@@ -16,6 +18,14 @@ export var ServeRestartUtil;
|
|
|
16
18
|
return `${update.version}+${(_a = update.build) !== null && _a !== void 0 ? _a : ''}`;
|
|
17
19
|
}
|
|
18
20
|
ServeRestartUtil.key = key;
|
|
21
|
+
/** The button that copies the command that installs a version, for the user to run it in a terminal. */
|
|
22
|
+
function copyCommand(command, notices, t) {
|
|
23
|
+
return {
|
|
24
|
+
label: t('ta.release.copy'),
|
|
25
|
+
run: () => { var _a; return void ((_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.writeText(command).then(() => notices.notify(t('ta.copied'), { level: 'success', key: 'ta-serve-release-copied' })).catch(() => undefined)); },
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
ServeRestartUtil.copyCommand = copyCommand;
|
|
19
29
|
/** Whether the page may restart Ta: the owner, of a Ta service that can restart itself. */
|
|
20
30
|
function restartable(server) {
|
|
21
31
|
return !!server && !server.member && server.restartable === true;
|
|
@@ -32,18 +42,32 @@ export function useRestartTa() {
|
|
|
32
42
|
}
|
|
33
43
|
await workbench.restartServer().catch(error => notices.error(error));
|
|
34
44
|
}, [t, notices, workbench]);
|
|
45
|
+
const release = (server === null || server === void 0 ? void 0 : server.member) ? undefined : server === null || server === void 0 ? void 0 : server.release;
|
|
46
|
+
const install = React.useCallback(async () => {
|
|
47
|
+
if (!release || release.installing) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
await workbench.installRelease().catch(error => notices.notify(t('ta.release.failed', { version: `v${release.version}` }), {
|
|
51
|
+
level: 'error',
|
|
52
|
+
key: 'ta-serve-release-failed',
|
|
53
|
+
sticky: true,
|
|
54
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
55
|
+
action: ServeRestartUtil.copyCommand(release.command, notices, t),
|
|
56
|
+
}));
|
|
57
|
+
}, [release, workbench, notices, t]);
|
|
35
58
|
const can = ServeRestartUtil.restartable(server);
|
|
36
|
-
return { can, restarting: !!restarting, update: can ? server === null || server === void 0 ? void 0 : server.update : undefined, restart };
|
|
59
|
+
return { can, restarting: !!restarting, update: can ? server === null || server === void 0 ? void 0 : server.update : undefined, restart, release, install };
|
|
37
60
|
}
|
|
38
61
|
/**
|
|
39
|
-
* Tells of
|
|
62
|
+
* Tells of a newer version published (TaServerInfo.release), with the command that installs it, once for each version;
|
|
63
|
+
* and of what restarting Ta is about, in a corner: another build installed (an update of Ta Desktop, `npm i -g`, a
|
|
40
64
|
* build of the repository), with Restart and Later, once for each build; Ta restarting, then back with its version.
|
|
41
65
|
*/
|
|
42
66
|
export function ServeRestartNotices() {
|
|
43
67
|
const t = useT();
|
|
44
68
|
const [{ server }] = useWorkbench();
|
|
45
69
|
const [, notices] = useNotices();
|
|
46
|
-
const { update, restarting, restart } = useRestartTa();
|
|
70
|
+
const { update, restarting, restart, release, install, can } = useRestartTa();
|
|
47
71
|
const told = React.useRef(undefined);
|
|
48
72
|
const key = update && ServeRestartUtil.key(update);
|
|
49
73
|
React.useEffect(() => {
|
|
@@ -69,6 +93,43 @@ export function ServeRestartNotices() {
|
|
|
69
93
|
told.current = undefined;
|
|
70
94
|
}
|
|
71
95
|
}, [key, notices]);
|
|
96
|
+
const releaseTold = React.useRef(undefined);
|
|
97
|
+
React.useEffect(() => {
|
|
98
|
+
var _a, _b;
|
|
99
|
+
const releaseKey = release && `${release.version}${release.installing ? ':installing' : ''}`;
|
|
100
|
+
if (((_a = releaseTold.current) === null || _a === void 0 ? void 0 : _a.key) === releaseKey) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (releaseTold.current) {
|
|
104
|
+
notices.dismiss(releaseTold.current.id);
|
|
105
|
+
releaseTold.current = undefined;
|
|
106
|
+
}
|
|
107
|
+
// Installed, or none published after all: nothing to tell of any more.
|
|
108
|
+
if (!release || !releaseKey) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const version = `v${release.version}`;
|
|
112
|
+
if (release.installing) {
|
|
113
|
+
releaseTold.current = { key: releaseKey, id: notices.notify(t('ta.release.installing', { version }), { key: 'ta-serve-release', sticky: true }) };
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (((_b = storage()) === null || _b === void 0 ? void 0 : _b.getItem(RELEASE_LATER_KEY)) === release.version) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
releaseTold.current = {
|
|
120
|
+
key: releaseKey,
|
|
121
|
+
id: notices.notify(t('ta.release.available', { version }), {
|
|
122
|
+
detail: t('ta.release.detail', { command: release.command }),
|
|
123
|
+
key: 'ta-serve-release',
|
|
124
|
+
sticky: true,
|
|
125
|
+
actions: [
|
|
126
|
+
{ label: t('ta.update.later'), run: () => { var _a; return (_a = storage()) === null || _a === void 0 ? void 0 : _a.setItem(RELEASE_LATER_KEY, release.version); } },
|
|
127
|
+
ServeRestartUtil.copyCommand(release.command, notices, t),
|
|
128
|
+
],
|
|
129
|
+
action: { label: t(can ? 'ta.release.install' : 'ta.release.installOnly'), run: () => void install() },
|
|
130
|
+
}),
|
|
131
|
+
};
|
|
132
|
+
}, [release, can, install, notices, t]);
|
|
72
133
|
const restartingId = React.useRef(undefined);
|
|
73
134
|
// Read once the restart ended: a server read again meanwhile says nothing.
|
|
74
135
|
const serverNow = React.useRef(server);
|
|
@@ -128,7 +128,7 @@ function useMessagePeople() {
|
|
|
128
128
|
return React.useMemo(() => ({ me, ownerName }), [me, ownerName]);
|
|
129
129
|
}
|
|
130
130
|
export function SessionView({ store, server, workspace, info, onClosed, onActivity, leading, trailing, empty, notice, aboveComposer, belowComposer, draftText, compact = false, }) {
|
|
131
|
-
var _a;
|
|
131
|
+
var _a, _b, _c;
|
|
132
132
|
const t = useT();
|
|
133
133
|
const state = useSessionState(store);
|
|
134
134
|
const [, notices] = useNotices();
|
|
@@ -349,7 +349,8 @@ export function SessionView({ store, server, workspace, info, onClosed, onActivi
|
|
|
349
349
|
React.createElement("div", { className: "ta-thread" },
|
|
350
350
|
state.start > 0 && (React.createElement("div", { className: `ta-earlier ${state.loadingEarlier ? '' : 'ta-earlier-idle'}`, role: "status", "aria-label": state.loadingEarlier ? t('ta.session.earlier') : undefined, ...SCROLL_SKIP },
|
|
351
351
|
React.createElement("span", { className: "ta-spinner" }))),
|
|
352
|
-
state.messages.length === 0 &&
|
|
352
|
+
state.messages.length === 0 &&
|
|
353
|
+
((_b = (_a = addons.empty) !== null && _a !== void 0 ? _a : empty) !== null && _b !== void 0 ? _b : React.createElement("div", { className: "ta-empty" }, t('ta.session.empty', { cwd: (_c = info === null || info === void 0 ? void 0 : info.cwd) !== null && _c !== void 0 ? _c : '.' }))),
|
|
353
354
|
React.createElement(ConversationSession.Provider, { value: info },
|
|
354
355
|
React.createElement(MessageActions.Provider, { value: messageActions },
|
|
355
356
|
React.createElement(FileUrls.Provider, { value: fileUrl },
|
|
@@ -24,6 +24,7 @@ import { SignInSetupSettings, useSignInConfig } from './sign-in-setup.js';
|
|
|
24
24
|
* keys, and what is about Ta and this computer.
|
|
25
25
|
*/
|
|
26
26
|
export function useMoreSections(onClose, onDialog) {
|
|
27
|
+
var _a, _b;
|
|
27
28
|
const t = useT();
|
|
28
29
|
const language = useLanguage();
|
|
29
30
|
const [{ settings }, store] = useSettings();
|
|
@@ -194,15 +195,17 @@ export function useMoreSections(onClose, onDialog) {
|
|
|
194
195
|
icon: Info,
|
|
195
196
|
rows: workbench.server
|
|
196
197
|
? [
|
|
197
|
-
row('version', [t('ta.settings.version'), 'version'], React.createElement(Row, { label: t('ta.settings.version'), description: restartTa.update
|
|
198
|
+
row('version', [t('ta.settings.version'), 'version'], React.createElement(Row, { label: t('ta.settings.version'), description: restartTa.update
|
|
199
|
+
? t('ta.update.ready', { version: ServeRestartUtil.label(restartTa.update) })
|
|
200
|
+
: workbench.server.release && t('ta.release.available', { version: `v${workbench.server.release.version}` }) },
|
|
198
201
|
React.createElement("span", { className: "ta-path" }, ServeRestartUtil.label(workbench.server)))),
|
|
199
202
|
...(restartTa.can
|
|
200
203
|
? [
|
|
201
204
|
row('restart', [t('ta.restart'), t('ta.restart.description'), 'restart', 'update'], React.createElement(Row, { label: t('ta.restart'), description: t('ta.restart.description') },
|
|
202
|
-
React.createElement("button", { type: "button", className: `ta-button${restartTa.update ? ' ta-primary' : ''}`, disabled: restartTa.restarting, onClick: () => void restartTa.restart() },
|
|
203
|
-
restartTa.restarting ? React.createElement("span", { className: "ta-spinner" }) : React.createElement(Icon, { icon: RotateCw, size: 15 }),
|
|
205
|
+
React.createElement("button", { type: "button", className: `ta-button${restartTa.update || restartTa.release ? ' ta-primary' : ''}`, disabled: restartTa.restarting || ((_a = restartTa.release) === null || _a === void 0 ? void 0 : _a.installing), onClick: () => void (restartTa.release && !restartTa.update ? restartTa.install() : restartTa.restart()) },
|
|
206
|
+
restartTa.restarting || ((_b = restartTa.release) === null || _b === void 0 ? void 0 : _b.installing) ? (React.createElement("span", { className: "ta-spinner" })) : (React.createElement(Icon, { icon: RotateCw, size: 15 })),
|
|
204
207
|
' ',
|
|
205
|
-
t('ta.restart.button')))),
|
|
208
|
+
t(restartTa.release && !restartTa.update ? 'ta.release.install' : 'ta.restart.button')))),
|
|
206
209
|
]
|
|
207
210
|
: []),
|
|
208
211
|
row('settings-files', [t('ta.settings.files'), 'settings.json', 'models.json', 'JSON'], React.createElement(SettingsFilesRow, null)),
|
|
@@ -19,6 +19,8 @@ export interface WorkbenchTabsProps {
|
|
|
19
19
|
maximized?: boolean;
|
|
20
20
|
/** Maximizes or restores the workbench: its button, or a double click on a tab. */
|
|
21
21
|
onMaximize?(): void;
|
|
22
|
+
/** Where the tab shown puts its tools (ui.EditorActions), before those of the workbench. */
|
|
23
|
+
actionsRef?(element: HTMLElement | null): void;
|
|
22
24
|
}
|
|
23
25
|
export declare function ViewGlyph({ view, size }: {
|
|
24
26
|
view: WebViewEntry;
|
|
@@ -28,13 +30,13 @@ export declare function ViewGlyph({ view, size }: {
|
|
|
28
30
|
* The tabs of a wide workbench, as those of a browser or an editor: the one shown is a card joined to what it
|
|
29
31
|
* shows, the others lie on the strip with a line between them, `+` follows the last one.
|
|
30
32
|
*/
|
|
31
|
-
export declare function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd, maximized, onMaximize }: WorkbenchTabsProps): React.JSX.Element;
|
|
33
|
+
export declare function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd, maximized, onMaximize, actionsRef }: WorkbenchTabsProps): React.JSX.Element;
|
|
32
34
|
/**
|
|
33
35
|
* The head of the workbench on a phone, as a browser's there: back to the conversation, the tab shown with how
|
|
34
36
|
* many are open, which opens the list of them (TabSwitcher), and `+`. A row of tabs a finger scrolls and
|
|
35
37
|
* closes by their small crosses is neither seen nor hit well on a phone.
|
|
36
38
|
*/
|
|
37
|
-
export declare function CompactHead({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd }: WorkbenchTabsProps): React.JSX.Element;
|
|
39
|
+
export declare function CompactHead({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd, actionsRef }: WorkbenchTabsProps): React.JSX.Element;
|
|
38
40
|
/** The tabs open on a phone, as rows of a finger's height under its head: a tap shows one, its cross closes it, a long press opens its menu. */
|
|
39
41
|
export declare function TabSwitcher({ editors, active, onShow, onClose, onMenu, onDismiss, }: Pick<WorkbenchTabsProps, 'editors' | 'active' | 'onShow' | 'onClose'> & {
|
|
40
42
|
onMenu(event: React.MouseEvent, editor: WebEditorEntry): void;
|
|
@@ -98,7 +98,7 @@ function CloseTab({ editor, title, onClose, onContextMenu, }) {
|
|
|
98
98
|
* The tabs of a wide workbench, as those of a browser or an editor: the one shown is a card joined to what it
|
|
99
99
|
* shows, the others lie on the strip with a line between them, `+` follows the last one.
|
|
100
100
|
*/
|
|
101
|
-
export function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd, maximized, onMaximize }) {
|
|
101
|
+
export function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd, maximized, onMaximize, actionsRef }) {
|
|
102
102
|
const t = useT();
|
|
103
103
|
const [menu, openMenu] = useContextMenu();
|
|
104
104
|
const menuFor = useTabMenu(editors, onClose, onPin);
|
|
@@ -116,7 +116,7 @@ export function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpe
|
|
|
116
116
|
const title = WebLabelUtil.text(editor.title);
|
|
117
117
|
const Glyph = editor.icon;
|
|
118
118
|
const selected = editor.id === active;
|
|
119
|
-
return (React.createElement("div", { key: editor.id, className: `ta-editor-tab ${selected ? 'ta-active' : ''} ${editor.preview ? 'ta-preview' : ''} ${editor.dirty ? 'ta-dirty' : ''}`, title: title },
|
|
119
|
+
return (React.createElement("div", { key: editor.id, className: `ta-editor-tab ${selected ? 'ta-active' : ''} ${editor.preview ? 'ta-preview' : ''} ${editor.dirty ? 'ta-dirty' : ''}`, title: editor.tooltip ? WebLabelUtil.text(editor.tooltip) : title },
|
|
120
120
|
React.createElement("button", { type: "button", role: "tab", "aria-selected": selected, className: "ta-editor-tab-button", onClick: () => onShow(editor.id), onDoubleClick: () => {
|
|
121
121
|
if (editor.preview) {
|
|
122
122
|
onPin(editor.id);
|
|
@@ -129,6 +129,7 @@ export function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpe
|
|
|
129
129
|
})),
|
|
130
130
|
views.length > 0 && React.createElement(OpenMenu, { views: views, onOpenView: onOpenView, cwd: cwd }),
|
|
131
131
|
menu,
|
|
132
|
+
React.createElement("div", { className: "ta-editor-actions", ref: actionsRef }),
|
|
132
133
|
React.createElement("div", { className: "ta-workbench-actions" },
|
|
133
134
|
maximized && onMaximize && React.createElement(IconButton, { icon: Minimize2, label: t('ta.workbench.restore'), className: "ta-wide-only", onClick: onMaximize }),
|
|
134
135
|
React.createElement(IconButton, { icon: SidebarRight, label: t('ta.panel.hide'), onClick: onHide }))));
|
|
@@ -138,7 +139,7 @@ export function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpe
|
|
|
138
139
|
* many are open, which opens the list of them (TabSwitcher), and `+`. A row of tabs a finger scrolls and
|
|
139
140
|
* closes by their small crosses is neither seen nor hit well on a phone.
|
|
140
141
|
*/
|
|
141
|
-
export function CompactHead({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd }) {
|
|
142
|
+
export function CompactHead({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd, actionsRef }) {
|
|
142
143
|
const t = useT();
|
|
143
144
|
const [open, setOpen] = React.useState(false);
|
|
144
145
|
const [menu, openMenu] = useContextMenu();
|
|
@@ -164,6 +165,7 @@ export function CompactHead({ editors, active, views, onShow, onClose, onPin, on
|
|
|
164
165
|
React.createElement("span", { className: "ta-workbench-switch-title" }, title),
|
|
165
166
|
editors.length > 1 && React.createElement("span", { className: "ta-workbench-count" }, editors.length),
|
|
166
167
|
React.createElement(ChevronDown, { className: "ta-workbench-switch-caret", size: 15, strokeWidth: 1.8, "aria-hidden": "true" }))) : (React.createElement("span", { className: "ta-workbench-title" }, title)),
|
|
168
|
+
React.createElement("div", { className: "ta-editor-actions", ref: actionsRef }),
|
|
167
169
|
views.length > 0 && React.createElement(OpenMenu, { views: views, onOpenView: onOpenView, cwd: cwd, align: "end" })),
|
|
168
170
|
menu,
|
|
169
171
|
open && (React.createElement(TabSwitcher, { editors: editors, active: active, onShow: id => {
|
|
@@ -15,7 +15,7 @@ export declare const ChatIcons: React.Context<{
|
|
|
15
15
|
/** The avatars that web extensions registered for the sessions of their groups. */
|
|
16
16
|
export declare const SessionAvatars: React.Context<Record<string, React.ComponentType<import("./web-extension-api.js").WebAvatarProps>>>;
|
|
17
17
|
/** What web extensions add to the menu of a conversation of a list (WebExtensionAPI.registerSessionMenu). */
|
|
18
|
-
export declare const SessionMenus: React.Context<import("./web-api-
|
|
18
|
+
export declare const SessionMenus: React.Context<import("./web-api-menus.js").WebSessionMenu[]>;
|
|
19
19
|
/** The web extensions loaded: what a message one of their packages sent as the user calls it (TaMessageSource). */
|
|
20
20
|
export declare const LoadedExtensions: React.Context<import("./web-extension-protocol.js").LoadedWebExtension[]>;
|
|
21
21
|
interface BoundaryProps {
|
|
@@ -40,6 +40,14 @@ export declare class ExtensionBoundary extends React.Component<BoundaryProps, {
|
|
|
40
40
|
componentDidUpdate(previous: BoundaryProps): void;
|
|
41
41
|
render(): string | number | bigint | boolean | React.JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | Iterable<React.ReactNode> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.ReactPortal | null | undefined> | null | undefined;
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* A component of a web extension that takes no props (a page, a view and its head, a tab of the workbench): drawn
|
|
45
|
+
* again as what it reads changes (its own state, the contexts and stores it uses) and as the language does, which it
|
|
46
|
+
* may read from `pi.ui`; not each time the page around it draws (a conversation shown, a minute gone).
|
|
47
|
+
*/
|
|
48
|
+
export declare function ExtensionPart({ component }: {
|
|
49
|
+
component: React.ComponentType;
|
|
50
|
+
}): React.JSX.Element;
|
|
43
51
|
/** A custom message of pi: with the renderer of its type, or as text when it is to be shown. */
|
|
44
52
|
export declare function CustomMessage({ message }: {
|
|
45
53
|
message: WebCustomMessage;
|
|
@@ -2,7 +2,7 @@ import { TA_RESUME_MESSAGE } from '@celljs/ta-protocol';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Callout } from '../components/callout.js';
|
|
4
4
|
import { Markdown } from '../components/markdown.js';
|
|
5
|
-
import { useT } from '../i18n/use-t.js';
|
|
5
|
+
import { useLanguage, useT } from '../i18n/use-t.js';
|
|
6
6
|
import { MessageUtil } from '../util/message.js';
|
|
7
7
|
/** The renderers of custom messages that web extensions registered. */
|
|
8
8
|
export const MessageRenderers = React.createContext({});
|
|
@@ -41,6 +41,17 @@ export class ExtensionBoundary extends React.Component {
|
|
|
41
41
|
return (_a = this.props.fallback) !== null && _a !== void 0 ? _a : React.createElement(ExtensionError, { name: this.props.name, error: this.state.error });
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* A component of a web extension that takes no props (a page, a view and its head, a tab of the workbench): drawn
|
|
46
|
+
* again as what it reads changes (its own state, the contexts and stores it uses) and as the language does, which it
|
|
47
|
+
* may read from `pi.ui`; not each time the page around it draws (a conversation shown, a minute gone).
|
|
48
|
+
*/
|
|
49
|
+
export function ExtensionPart({ component }) {
|
|
50
|
+
return React.createElement(StillPart, { component: component, language: useLanguage() });
|
|
51
|
+
}
|
|
52
|
+
const StillPart = React.memo(function StillPart({ component: Component }) {
|
|
53
|
+
return React.createElement(Component, null);
|
|
54
|
+
});
|
|
44
55
|
function ExtensionError({ name, error }) {
|
|
45
56
|
const t = useT();
|
|
46
57
|
return (React.createElement(Callout, { level: "error", detail: error.message }, t('ta.widget.failed', { name })));
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { AlarmClock, Aperture, ArrowDown, ArrowLeft, ArrowRight, ArrowUp, ArrowUpDown, Bell, BellOff, BookOpen, Bot, Box, Bug, Building2, Calendar, CaseSensitive, ChartSpline, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsDownUp, ChevronsUpDown, ChevronUp, Circle, CircleAlert, CircleArrowRight, CircleHelp, Clipboard, ClipboardPaste, Clock, Cloud, Code, Coins, Columns2, Contact, Copy, CopyMinus, CornerDownRight, CornerUpLeft, Cpu, Crown, Database, Download, Ellipsis, ExternalLink, Eye, File, FileArchive, FileDiff, FilePlus, Files, FileText, Film, FlaskConical, Folder, FolderInput, FolderOpen, FolderPlus, FolderSearch, FolderTree, Forward, Gamepad2, Gauge, GitBranch, GitCommitHorizontal, Globe, Grip, HardDrive, Hash, Heart, House, Image, ImagePlus, Info, Keyboard, KeyRound, Laptop, LayoutDashboard, Lightbulb, Link, List, ListChecks, ListTodo, ListTree, ListX, LoaderCircle, LocateFixed, Lock, MapIcon, Maximize, Maximize2, Megaphone, MemoryStick, MessageCircle, MessageSquareDot, MessageSquareText, MessagesSquare, Mic, Minimize2, Minus, Monitor, MonitorSmartphone, MousePointer2, MousePointerClick, Package, PackageOpen, Paperclip, Pencil, Phone, Pin, PinOff, Play, Plus, Pointer, Power, Puzzle, QrCode, Radar, RefreshCw, Regex, Replace, ReplaceAll, Rocket, RotateCcw, Rows2, Save, Scan, ScanLine, ScrollText, Search, Send, Server, Share2, Shield, ShieldCheck, SlidersHorizontal, Smartphone, Sparkles, Square, SquareMinus, SquarePlus, SquareTerminal, Star, StarOff, Store, Target, Text, Timer, Trash2, TrendingDown, TrendingUp, Trophy, Undo2, Unplug, Upload, User, UserPlus, Users, Volume2, WholeWord, Wrench, X, Zap, } from 'lucide-react';
|
|
1
|
+
import { AlarmClock, Aperture, Archive, ArrowDown, ArrowLeft, ArrowRight, ArrowUp, ArrowUpDown, Bell, BellOff, BookOpen, Bot, Box, Bug, Building2, Calendar, Camera, CaseSensitive, ChartColumn, ChartSpline, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsDownUp, ChevronsUpDown, ChevronUp, Circle, CircleAlert, CircleArrowRight, CircleHelp, Clipboard, ClipboardPaste, Clock, Cloud, Code, Coins, Columns2, Contact, Copy, CopyMinus, CornerDownRight, CornerUpLeft, Cpu, Crown, Database, Download, Ellipsis, ExternalLink, Eye, File, FileArchive, FileDiff, FilePlus, Files, FileText, Film, FlaskConical, Folder, FolderInput, FolderOpen, FolderPlus, FolderSearch, FolderTree, Forward, Gamepad2, Gauge, GitBranch, GitCommitHorizontal, Globe, Grip, HardDrive, Hash, Headphones, Heart, House, Image, ImagePlus, Info, Keyboard, KeyRound, Laptop, LayoutDashboard, Lightbulb, Link, List, ListChecks, ListTodo, ListTree, ListX, LoaderCircle, LocateFixed, Lock, MapIcon, Maximize, Maximize2, Megaphone, MemoryStick, MessageCircle, MessageSquareDot, MessageSquareText, MessagesSquare, Mic, Minimize2, Minus, Monitor, MonitorSmartphone, MousePointer2, MousePointerClick, Package, PackageOpen, Paperclip, Pencil, Phone, Pin, PinOff, Play, Plus, Pointer, Power, Puzzle, QrCode, Quote, Radar, RefreshCw, Regex, Replace, ReplaceAll, Rocket, RotateCcw, Rows2, Save, Scan, ScanLine, ScrollText, Search, Send, Server, Share2, Shield, ShieldAlert, ShieldCheck, Shuffle, SlidersHorizontal, Smartphone, Sparkles, Square, SquareMinus, SquarePlus, SquareTerminal, Star, StarOff, Store, Target, Text, ThumbsDown, ThumbsUp, Timer, Trash2, TrendingDown, TrendingUp, Trophy, Undo2, Unplug, Upload, User, UserPlus, Users, Volume2, WholeWord, Wrench, X, Zap, } from 'lucide-react';
|
|
2
2
|
/** The icons a web extension gets as `pi.ui.icons`; names are lucide's. Only add: removing one breaks extensions. */
|
|
3
3
|
export const WEB_ICONS = Object.freeze({
|
|
4
4
|
AlarmClock,
|
|
5
5
|
Aperture,
|
|
6
|
+
Archive,
|
|
6
7
|
ArrowDown,
|
|
7
8
|
ArrowLeft,
|
|
8
9
|
ArrowRight,
|
|
@@ -16,7 +17,9 @@ export const WEB_ICONS = Object.freeze({
|
|
|
16
17
|
Bug,
|
|
17
18
|
Building2,
|
|
18
19
|
Calendar,
|
|
20
|
+
Camera,
|
|
19
21
|
CaseSensitive,
|
|
22
|
+
ChartColumn,
|
|
20
23
|
ChartSpline,
|
|
21
24
|
Check,
|
|
22
25
|
ChevronDown,
|
|
@@ -71,6 +74,7 @@ export const WEB_ICONS = Object.freeze({
|
|
|
71
74
|
Grip,
|
|
72
75
|
HardDrive,
|
|
73
76
|
Hash,
|
|
77
|
+
Headphones,
|
|
74
78
|
Heart,
|
|
75
79
|
House,
|
|
76
80
|
Image,
|
|
@@ -118,6 +122,7 @@ export const WEB_ICONS = Object.freeze({
|
|
|
118
122
|
Pointer,
|
|
119
123
|
Power,
|
|
120
124
|
Puzzle,
|
|
125
|
+
Quote,
|
|
121
126
|
QrCode,
|
|
122
127
|
Radar,
|
|
123
128
|
RefreshCw,
|
|
@@ -136,7 +141,9 @@ export const WEB_ICONS = Object.freeze({
|
|
|
136
141
|
Server,
|
|
137
142
|
Share2,
|
|
138
143
|
Shield,
|
|
144
|
+
ShieldAlert,
|
|
139
145
|
ShieldCheck,
|
|
146
|
+
Shuffle,
|
|
140
147
|
SlidersHorizontal,
|
|
141
148
|
Smartphone,
|
|
142
149
|
Sparkles,
|
|
@@ -149,6 +156,8 @@ export const WEB_ICONS = Object.freeze({
|
|
|
149
156
|
Store,
|
|
150
157
|
Target,
|
|
151
158
|
Text,
|
|
159
|
+
ThumbsDown,
|
|
160
|
+
ThumbsUp,
|
|
152
161
|
Timer,
|
|
153
162
|
Trash2,
|
|
154
163
|
TrendingDown,
|