@celljs/ta-web 4.24.1 → 4.25.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/components/account-menu.js +5 -1
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- 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 +7 -3
- 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-user.js +5 -3
- 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/workbench-tabs.d.ts +4 -2
- package/esm/browser/components/workbench-tabs.js +5 -3
- package/esm/browser/extension/extension-view.d.ts +1 -1
- package/esm/browser/extension/web-api-contributions.d.ts +4 -12
- 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-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-session-notices.js +8 -0
- package/esm/browser/i18n/locales.d.ts +5 -1
- package/esm/browser/i18n/messages-ja.js +6 -2
- package/esm/browser/i18n/messages-zh-tw.js +6 -2
- package/esm/browser/i18n/messages.d.ts +4 -0
- package/esm/browser/i18n/messages.js +13 -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/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/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/lib/browser/components/account-menu.js +4 -0
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- 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-user.js +5 -3
- 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/workbench-tabs.d.ts +4 -2
- package/lib/browser/components/workbench-tabs.js +5 -3
- package/lib/browser/extension/extension-view.d.ts +1 -1
- package/lib/browser/extension/web-api-contributions.d.ts +4 -12
- 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-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-session-notices.js +8 -0
- package/lib/browser/i18n/locales.d.ts +5 -1
- package/lib/browser/i18n/messages-ja.js +6 -2
- package/lib/browser/i18n/messages-zh-tw.js +6 -2
- package/lib/browser/i18n/messages.d.ts +4 -0
- package/lib/browser/i18n/messages.js +13 -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/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/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/package.json +7 -7
|
@@ -1,7 +1,11 @@
|
|
|
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;
|
|
7
11
|
//# sourceMappingURL=said-text.d.ts.map
|
|
@@ -37,8 +37,14 @@ exports.SaidText = SaidText;
|
|
|
37
37
|
const React = __importStar(require("react"));
|
|
38
38
|
const quote_1 = require("../util/quote");
|
|
39
39
|
const fold_text_1 = require("./fold-text");
|
|
40
|
-
/**
|
|
41
|
-
|
|
40
|
+
/**
|
|
41
|
+
* What the user wrote, in their bubble: the quote it starts with (QuoteUtil) set apart above the rest, as WeChat's.
|
|
42
|
+
* What a part of Ta wrote for them (`markdown`) is drawn as Markdown.
|
|
43
|
+
*/
|
|
44
|
+
function SaidText({ text, className, markdown }) {
|
|
45
|
+
if (markdown) {
|
|
46
|
+
return React.createElement(fold_text_1.FoldText, { text: text, className: className, markdown: true });
|
|
47
|
+
}
|
|
42
48
|
const { quote, rest } = quote_1.QuoteUtil.split(text);
|
|
43
49
|
if (!quote) {
|
|
44
50
|
return React.createElement(fold_text_1.FoldText, { text: text, className: className });
|
|
@@ -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;
|
|
@@ -137,7 +137,7 @@ function CloseTab({ editor, title, onClose, onContextMenu, }) {
|
|
|
137
137
|
* The tabs of a wide workbench, as those of a browser or an editor: the one shown is a card joined to what it
|
|
138
138
|
* shows, the others lie on the strip with a line between them, `+` follows the last one.
|
|
139
139
|
*/
|
|
140
|
-
function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd, maximized, onMaximize }) {
|
|
140
|
+
function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd, maximized, onMaximize, actionsRef }) {
|
|
141
141
|
const t = (0, use_t_1.useT)();
|
|
142
142
|
const [menu, openMenu] = (0, context_menu_1.useContextMenu)();
|
|
143
143
|
const menuFor = useTabMenu(editors, onClose, onPin);
|
|
@@ -155,7 +155,7 @@ function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpenView,
|
|
|
155
155
|
const title = web_extension_protocol_1.WebLabelUtil.text(editor.title);
|
|
156
156
|
const Glyph = editor.icon;
|
|
157
157
|
const selected = editor.id === active;
|
|
158
|
-
return (React.createElement("div", { key: editor.id, className: `ta-editor-tab ${selected ? 'ta-active' : ''} ${editor.preview ? 'ta-preview' : ''} ${editor.dirty ? 'ta-dirty' : ''}`, title: title },
|
|
158
|
+
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 ? web_extension_protocol_1.WebLabelUtil.text(editor.tooltip) : title },
|
|
159
159
|
React.createElement("button", { type: "button", role: "tab", "aria-selected": selected, className: "ta-editor-tab-button", onClick: () => onShow(editor.id), onDoubleClick: () => {
|
|
160
160
|
if (editor.preview) {
|
|
161
161
|
onPin(editor.id);
|
|
@@ -168,6 +168,7 @@ function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpenView,
|
|
|
168
168
|
})),
|
|
169
169
|
views.length > 0 && React.createElement(OpenMenu, { views: views, onOpenView: onOpenView, cwd: cwd }),
|
|
170
170
|
menu,
|
|
171
|
+
React.createElement("div", { className: "ta-editor-actions", ref: actionsRef }),
|
|
171
172
|
React.createElement("div", { className: "ta-workbench-actions" },
|
|
172
173
|
maximized && onMaximize && React.createElement(icon_1.IconButton, { icon: lucide_react_1.Minimize2, label: t('ta.workbench.restore'), className: "ta-wide-only", onClick: onMaximize }),
|
|
173
174
|
React.createElement(icon_1.IconButton, { icon: icon_1.SidebarRight, label: t('ta.panel.hide'), onClick: onHide }))));
|
|
@@ -177,7 +178,7 @@ function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpenView,
|
|
|
177
178
|
* many are open, which opens the list of them (TabSwitcher), and `+`. A row of tabs a finger scrolls and
|
|
178
179
|
* closes by their small crosses is neither seen nor hit well on a phone.
|
|
179
180
|
*/
|
|
180
|
-
function CompactHead({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd }) {
|
|
181
|
+
function CompactHead({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd, actionsRef }) {
|
|
181
182
|
const t = (0, use_t_1.useT)();
|
|
182
183
|
const [open, setOpen] = React.useState(false);
|
|
183
184
|
const [menu, openMenu] = (0, context_menu_1.useContextMenu)();
|
|
@@ -203,6 +204,7 @@ function CompactHead({ editors, active, views, onShow, onClose, onPin, onOpenVie
|
|
|
203
204
|
React.createElement("span", { className: "ta-workbench-switch-title" }, title),
|
|
204
205
|
editors.length > 1 && React.createElement("span", { className: "ta-workbench-count" }, editors.length),
|
|
205
206
|
React.createElement(lucide_react_1.ChevronDown, { className: "ta-workbench-switch-caret", size: 15, strokeWidth: 1.8, "aria-hidden": "true" }))) : (React.createElement("span", { className: "ta-workbench-title" }, title)),
|
|
207
|
+
React.createElement("div", { className: "ta-editor-actions", ref: actionsRef }),
|
|
206
208
|
views.length > 0 && React.createElement(OpenMenu, { views: views, onOpenView: onOpenView, cwd: cwd, align: "end" })),
|
|
207
209
|
menu,
|
|
208
210
|
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").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").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").LoadedWebExtension[]>;
|
|
21
21
|
interface BoundaryProps {
|
|
@@ -102,6 +102,8 @@ export interface WebRoomAddonEntry {
|
|
|
102
102
|
export interface WebEditor {
|
|
103
103
|
id: string;
|
|
104
104
|
title: WebLabel;
|
|
105
|
+
/** What its tab says under a pointer, such as the path of a file; its title when none. */
|
|
106
|
+
tooltip?: WebLabel;
|
|
105
107
|
icon?: WebIcon;
|
|
106
108
|
render: React.ComponentType;
|
|
107
109
|
/** The user closed the tab. */
|
|
@@ -540,6 +542,8 @@ export interface WebSessionNotice {
|
|
|
540
542
|
* extension shows it on the page itself, so the page tells of it only by a notice of the system while away.
|
|
541
543
|
*/
|
|
542
544
|
view?: string;
|
|
545
|
+
/** The user wants to hear it: the page plays a short tone, not of what they look at (SessionNoticeUtil.audible). */
|
|
546
|
+
sound?: boolean;
|
|
543
547
|
}
|
|
544
548
|
/** Lines and columns of a file, from 1: a line, a place in it, or a range. */
|
|
545
549
|
export interface TextSelection {
|
|
@@ -574,16 +578,4 @@ export interface WebOpenerOptions {
|
|
|
574
578
|
*/
|
|
575
579
|
specific?: boolean;
|
|
576
580
|
}
|
|
577
|
-
/** A conversation as a list shows it: an open one has its session, one kept on the disk its file only. */
|
|
578
|
-
export interface WebSessionRef {
|
|
579
|
-
sessionId?: string;
|
|
580
|
-
sessionFile?: string;
|
|
581
|
-
cwd: string;
|
|
582
|
-
/** As the list names it. */
|
|
583
|
-
title: string;
|
|
584
|
-
/** TaSessionInfo.group. */
|
|
585
|
-
group?: string;
|
|
586
|
-
}
|
|
587
|
-
/** The entries an extension adds to the menu of a conversation of a list (registerSessionMenu); none for some. */
|
|
588
|
-
export type WebSessionMenu = (session: WebSessionRef) => WebMenuItem[];
|
|
589
581
|
//# sourceMappingURL=web-api-contributions.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { WebEditor } from './web-api-contributions';
|
|
3
|
+
/** The tabs of the workbench beside the conversation, as an extension opens them and draws their tools. */
|
|
4
|
+
export interface WebEditorsUI {
|
|
5
|
+
/**
|
|
6
|
+
* A tab in the editor area beside the conversation (a file, a diff, a browser); an open id is shown
|
|
7
|
+
* again. With `preserveFocus`, it opens behind the tab shown, and the workbench is not revealed: for
|
|
8
|
+
* tabs opened again when the page loads. With `preview`, as a single click in an IDE: its title is in
|
|
9
|
+
* italics, and the next tab opened as a preview takes its place, until it is pinned (`pinEditor`, or a
|
|
10
|
+
* double click on it); opening it again without `preview` pins it too.
|
|
11
|
+
*/
|
|
12
|
+
openEditor(editor: WebEditor, options?: {
|
|
13
|
+
preserveFocus?: boolean;
|
|
14
|
+
preview?: boolean;
|
|
15
|
+
}): void;
|
|
16
|
+
closeEditor(id: string): void;
|
|
17
|
+
/** Keeps a tab opened as a preview: the next preview opens beside it. */
|
|
18
|
+
pinEditor(id: string): void;
|
|
19
|
+
/** Marks a tab as changed and not saved: a dot in place of its close button, and the user is asked before closing it. Dirty tabs are pinned. */
|
|
20
|
+
setEditorDirty(id: string, dirty: boolean): void;
|
|
21
|
+
/** A React hook: the id of the tab shown in the workbench, whoever opened it. */
|
|
22
|
+
useActiveEditor(): string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* The tools of the tab it is drawn in (by the `render` of `openEditor`): put in the head of the workbench beside
|
|
25
|
+
* the tabs while the tab is shown, as the actions of an editor's title in an IDE: a few icon buttons (a preview or
|
|
26
|
+
* its text, saving, going through the changes of a diff) and a short note. A tab needs no head of its own over
|
|
27
|
+
* what it shows: its tab already names it. Nothing elsewhere.
|
|
28
|
+
*/
|
|
29
|
+
readonly EditorActions: React.ComponentType<{
|
|
30
|
+
children?: React.ReactNode;
|
|
31
|
+
}>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=web-api-editors.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** Part of the web extension API (web-extension-api.ts, which exports it all): the entries extensions add to menus of the page. */
|
|
2
|
+
import type { WebMenuItem } from './web-api-contributions';
|
|
3
|
+
/** A conversation as a list shows it: an open one has its session, one kept on the disk its file only. */
|
|
4
|
+
export interface WebSessionRef {
|
|
5
|
+
sessionId?: string;
|
|
6
|
+
sessionFile?: string;
|
|
7
|
+
cwd: string;
|
|
8
|
+
/** As the list names it. */
|
|
9
|
+
title: string;
|
|
10
|
+
/** TaSessionInfo.group. */
|
|
11
|
+
group?: string;
|
|
12
|
+
}
|
|
13
|
+
/** The entries an extension adds to the menu of a conversation of a list (registerSessionMenu); none for some. */
|
|
14
|
+
export type WebSessionMenu = (session: WebSessionRef) => WebMenuItem[];
|
|
15
|
+
/** A file or a folder of a workspace, as a list of files (the explorer) shows it. */
|
|
16
|
+
export interface WebFileRef {
|
|
17
|
+
/** The directory of the workspace: a path, or `ssh://…` (TaLocation). */
|
|
18
|
+
cwd: string;
|
|
19
|
+
/** Relative to `cwd`, with `/`. */
|
|
20
|
+
path: string;
|
|
21
|
+
name: string;
|
|
22
|
+
kind: 'file' | 'directory';
|
|
23
|
+
size?: number;
|
|
24
|
+
}
|
|
25
|
+
/** The entries an extension adds to the menu of a file or a folder of a list of files (registerFileMenu); none for some. */
|
|
26
|
+
export type WebFileMenu = (file: WebFileRef) => WebMenuItem[];
|
|
27
|
+
/** What a web extension adds to the menus of the page (WebExtensionAPI extends it). */
|
|
28
|
+
export interface WebMenus {
|
|
29
|
+
/**
|
|
30
|
+
* Entries of the menu of a conversation where a list shows it (a right click or a held finger on its row), in a
|
|
31
|
+
* section of their own after Ta's: read each time the menu opens.
|
|
32
|
+
*/
|
|
33
|
+
registerSessionMenu(menu: WebSessionMenu): void;
|
|
34
|
+
/**
|
|
35
|
+
* Entries of the menu of a file or a folder where a list of files shows it (the explorer: a right click or a held
|
|
36
|
+
* finger on its row), in a section of their own: read each time the menu opens. Newer than some Ta apps:
|
|
37
|
+
* `pi.registerFileMenu?.(…)`.
|
|
38
|
+
*/
|
|
39
|
+
registerFileMenu(menu: WebFileMenu): void;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=web-api-menus.d.ts.map
|
|
@@ -7,9 +7,11 @@ import type { Game3DProps } from '../game/game3d-protocol';
|
|
|
7
7
|
import type { ScreenPartSpec, TaScreen } from '../screen/screen-protocol';
|
|
8
8
|
import type { Language, Theme } from '../settings/settings-protocol';
|
|
9
9
|
import type { CodeEditorProps, DiffEditorProps, 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';
|
|
10
|
-
import type { WebAsk, WebCallPartner, WebChatIconSource, WebCodeRendererOptions, WebCodeRendererProps, WebComposerAddon, WebCustomMessage,
|
|
10
|
+
import type { WebAsk, WebCallPartner, WebChatIconSource, WebCodeRendererOptions, WebCodeRendererProps, 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';
|
|
11
11
|
import type { WebDesktop, WebFileDrag } from './web-api-desktop';
|
|
12
|
+
import type { WebEditorsUI } from './web-api-editors';
|
|
12
13
|
import type { WebHomeUI, WebPartnersAPI, WebPartnersUI } from './web-api-home';
|
|
14
|
+
import type { WebFileRef, WebMenus } from './web-api-menus';
|
|
13
15
|
import type { WebServices } from './web-api-services';
|
|
14
16
|
import type { WebTerminal, WebTerminalOptions } from './web-api-terminal';
|
|
15
17
|
import type { WebPageInfo } from './web-pages';
|
|
@@ -22,7 +24,9 @@ export type { Language, Theme } from '../settings/settings-protocol';
|
|
|
22
24
|
export type * from './web-api-components';
|
|
23
25
|
export type * from './web-api-contributions';
|
|
24
26
|
export type * from './web-api-desktop';
|
|
27
|
+
export type * from './web-api-editors';
|
|
25
28
|
export type * from './web-api-home';
|
|
29
|
+
export type * from './web-api-menus';
|
|
26
30
|
export type * from './web-api-services';
|
|
27
31
|
export type * from './web-api-terminal';
|
|
28
32
|
export type { WebPageInfo, WebPageState } from './web-pages';
|
|
@@ -31,7 +35,7 @@ export type { WebPageInfo, WebPageState } from './web-pages';
|
|
|
31
35
|
* the two mean the same. A web extension is one ES module without imports, the `web` part of a pi
|
|
32
36
|
* package (see TaWebExtensionInfo); it exports a {@link WebExtensionFactory}.
|
|
33
37
|
*/
|
|
34
|
-
export interface WebExtensionAPI extends WebServices, WebPartnersAPI {
|
|
38
|
+
export interface WebExtensionAPI extends WebServices, WebPartnersAPI, WebMenus {
|
|
35
39
|
/** The React of the page: an extension brings no React of its own. */
|
|
36
40
|
readonly React: typeof React;
|
|
37
41
|
readonly ui: WebExtensionUI;
|
|
@@ -105,11 +109,6 @@ export interface WebExtensionAPI extends WebServices, WebPartnersAPI {
|
|
|
105
109
|
* Without one, a page opens in the browser of the system after the user said so.
|
|
106
110
|
*/
|
|
107
111
|
registerOpener(opener: WebOpener, options?: WebOpenerOptions): void;
|
|
108
|
-
/**
|
|
109
|
-
* Entries of the menu of a conversation where a list shows it (a right click or a held finger on its row), in a
|
|
110
|
-
* section of their own after Ta's: read each time the menu opens.
|
|
111
|
-
*/
|
|
112
|
-
registerSessionMenu(menu: WebSessionMenu): void;
|
|
113
112
|
/** The events of the conversation shown. */
|
|
114
113
|
on<T extends TaEvent['type']>(type: T, handler: (event: Extract<TaEvent, {
|
|
115
114
|
type: T;
|
|
@@ -230,7 +229,7 @@ export interface WebNotifyOptions {
|
|
|
230
229
|
export type { ScreenAction, ScreenItem, ScreenPartSpec, ScreenPartView, ScreenPlace, ScreenScrollable, ScreenScrollTo } from '../screen/screen-protocol';
|
|
231
230
|
/** What web extensions see of TaScreen. */
|
|
232
231
|
export type WebScreen = Pick<TaScreen, 'agent' | 'parts' | 'act' | 'element' | 'where' | 'places' | 'go' | 'pageScroll' | 'scroll'>;
|
|
233
|
-
export interface WebExtensionUI extends WebHomeUI, WebPartnersUI {
|
|
232
|
+
export interface WebExtensionUI extends WebHomeUI, WebPartnersUI, WebEditorsUI {
|
|
234
233
|
/** A widget around the message box, as pi's, or a card in the workbench on the right; `undefined` removes it. */
|
|
235
234
|
setWidget(key: string, widget: React.ComponentType | undefined, options?: WidgetOptions): void;
|
|
236
235
|
/**
|
|
@@ -253,6 +252,8 @@ export interface WebExtensionUI extends WebHomeUI, WebPartnersUI {
|
|
|
253
252
|
readonly doubleInChats?: boolean;
|
|
254
253
|
/** A React hook: what extensions add to the rooms (registerRoomAddon), in the order they loaded. Newer than some Ta apps. */
|
|
255
254
|
useRoomAddons(): readonly WebRoomAddonEntry[];
|
|
255
|
+
/** What extensions add to the menu of a file or a folder (registerFileMenu), read as a list of files opens it. Newer than some Ta apps. */
|
|
256
|
+
fileMenu?(file: WebFileRef): WebMenuItem[];
|
|
256
257
|
/**
|
|
257
258
|
* Pins a conversation to the top of the lists (or unpins it), by its session file, as the user does with Pin: for
|
|
258
259
|
* one the extension made that the user looks at each day. Pin it once; the user may unpin it. Newer than some Ta
|
|
@@ -308,24 +309,6 @@ export interface WebExtensionUI extends WebHomeUI, WebPartnersUI {
|
|
|
308
309
|
mimeType: string;
|
|
309
310
|
}[];
|
|
310
311
|
}): boolean;
|
|
311
|
-
/**
|
|
312
|
-
* A tab in the editor area beside the conversation (a file, a diff, a browser); an open id is shown
|
|
313
|
-
* again. With `preserveFocus`, it opens behind the tab shown, and the workbench is not revealed: for
|
|
314
|
-
* tabs opened again when the page loads. With `preview`, as a single click in an IDE: its title is in
|
|
315
|
-
* italics, and the next tab opened as a preview takes its place, until it is pinned (`pinEditor`, or a
|
|
316
|
-
* double click on it); opening it again without `preview` pins it too.
|
|
317
|
-
*/
|
|
318
|
-
openEditor(editor: WebEditor, options?: {
|
|
319
|
-
preserveFocus?: boolean;
|
|
320
|
-
preview?: boolean;
|
|
321
|
-
}): void;
|
|
322
|
-
closeEditor(id: string): void;
|
|
323
|
-
/** Keeps a tab opened as a preview: the next preview opens beside it. */
|
|
324
|
-
pinEditor(id: string): void;
|
|
325
|
-
/** Marks a tab as changed and not saved: a dot in place of its close button, and the user is asked before closing it. Dirty tabs are pinned. */
|
|
326
|
-
setEditorDirty(id: string, dirty: boolean): void;
|
|
327
|
-
/** A React hook: the id of the tab shown in the workbench, whoever opened it. */
|
|
328
|
-
useActiveEditor(): string | undefined;
|
|
329
312
|
/**
|
|
330
313
|
* A React hook: the directory of the conversation (or agent) in front, as it changes; the default directory
|
|
331
314
|
* of the server when none is: a page, the settings, the lists of a phone. What opens now (a terminal) opens there.
|
|
@@ -47,6 +47,7 @@ const context_menu_1 = require("../components/context-menu");
|
|
|
47
47
|
const conversation_scroll_hooks_1 = require("../components/conversation-scroll-hooks");
|
|
48
48
|
const conversation_view_1 = require("../components/conversation-view");
|
|
49
49
|
const diff_editor_1 = require("../components/diff-editor");
|
|
50
|
+
const editor_actions_1 = require("../components/editor-actions");
|
|
50
51
|
const empty_state_1 = require("../components/empty-state");
|
|
51
52
|
const face_1 = require("../components/face");
|
|
52
53
|
const folder_picker_1 = require("../components/folder-picker");
|
|
@@ -257,15 +258,8 @@ class WebExtensionContext {
|
|
|
257
258
|
registerComposerAddon: addon => register(() => run.composerAddons.push(addon)),
|
|
258
259
|
registerRoomAddon: addon => register(() => run.roomAddons.push(addon)),
|
|
259
260
|
registerSettings: section => register(() => run.settingsSections.push(section)),
|
|
260
|
-
registerSessionMenu: menu => register(() => run.sessionMenus.push(
|
|
261
|
-
|
|
262
|
-
return run.stopped ? [] : menu(session);
|
|
263
|
-
}
|
|
264
|
-
catch (error) {
|
|
265
|
-
console.error(`The web extension ${run.loaded.name} failed:`, error);
|
|
266
|
-
return [];
|
|
267
|
-
}
|
|
268
|
-
})),
|
|
261
|
+
registerSessionMenu: menu => register(() => run.sessionMenus.push(web_extension_run_1.WebExtensionRunUtil.menu(run, menu))),
|
|
262
|
+
registerFileMenu: menu => register(() => run.fileMenus.push(web_extension_run_1.WebExtensionRunUtil.menu(run, menu))),
|
|
269
263
|
registerOpener: (opener, options) => register(() => ((options === null || options === void 0 ? void 0 : options.specific) ? run.specificOpeners : run.openers).push(async (link) => {
|
|
270
264
|
// An opener that fails, or of an extension that stopped, leaves the link to the next one.
|
|
271
265
|
try {
|
|
@@ -431,6 +425,7 @@ class WebExtensionContext {
|
|
|
431
425
|
forgetPage: id => !run.stopped && host.extensions.forgetPage(id),
|
|
432
426
|
...web_home_1.WebHomeUtil.ui(host.extensions, () => run.stopped, run.loaded.name),
|
|
433
427
|
doubleInChats: true,
|
|
428
|
+
fileMenu: file => (run.stopped ? [] : host.extensions.state.fileMenus.flatMap(menu => menu(file))),
|
|
434
429
|
useRoomAddons: () => {
|
|
435
430
|
const read = () => host.extensions.state.roomAddons;
|
|
436
431
|
const subscribe = React.useCallback((listener) => host.extensions.subscribe(listener), []);
|
|
@@ -442,6 +437,7 @@ class WebExtensionContext {
|
|
|
442
437
|
icons: icons_1.WEB_ICONS,
|
|
443
438
|
CodeEditor: this.codeEditor,
|
|
444
439
|
DiffEditor: this.diffEditor,
|
|
440
|
+
EditorActions: editor_actions_1.EditorActions,
|
|
445
441
|
// Ends with the extension: one made after it stopped is ended at once.
|
|
446
442
|
createTerminal: (options) => {
|
|
447
443
|
const terminal = new web_terminal_1.DefaultWebTerminal(settings, (target, open) => void host.links.open(target, open), options);
|
|
@@ -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';
|
|
4
4
|
import type { BlockSpeech } from '../util/spoken';
|
|
5
|
-
import type { WebAvatarProps, WebCallPartner, WebChatIconSource, WebCodeRendererProps, WebComposerAddon, WebCustomMessage, WebEditor, WebExtensionFactory, WebHomeEntry, WebIcon, WebImage, WebInitiative, WebLabel, WebMenuItem, WebOpener, WebPageGroup, WebRoomAddonEntry, WebSearchSource, WebSessionMenu, WebSessionOpening, WebSettingsSection, WebShareTarget, WebTool, WebToolRendererResolver, WebViewLocation, WebViewPreview, WidgetOptions } from './web-extension-api';
|
|
5
|
+
import type { WebAvatarProps, WebCallPartner, WebChatIconSource, WebCodeRendererProps, WebComposerAddon, WebCustomMessage, WebEditor, WebExtensionFactory, WebFileMenu, WebHomeEntry, WebIcon, WebImage, WebInitiative, WebLabel, WebMenuItem, WebOpener, WebPageGroup, WebRoomAddonEntry, WebSearchSource, WebSessionMenu, WebSessionOpening, WebSettingsSection, WebShareTarget, WebTool, WebToolRendererResolver, WebViewLocation, WebViewPreview, WidgetOptions } from './web-extension-api';
|
|
6
6
|
import type { WebHomeBoard } from './web-home';
|
|
7
7
|
import type { PageUsage, WebPageInfo } from './web-pages';
|
|
8
8
|
import type { WebPartnerBoard } from './web-partners';
|
|
@@ -139,6 +139,8 @@ export interface WebExtensionsState {
|
|
|
139
139
|
specificOpeners: WebOpener[];
|
|
140
140
|
/** Entries of the menu of a conversation of a list (WebExtensionAPI.registerSessionMenu). */
|
|
141
141
|
sessionMenus: WebSessionMenu[];
|
|
142
|
+
/** Entries of the menu of a file or a folder of a list of files (WebExtensionAPI.registerFileMenu). */
|
|
143
|
+
fileMenus: WebFileMenu[];
|
|
142
144
|
/** The tabs of the editor area (the workbench), in the order they opened. */
|
|
143
145
|
editors: WebEditorEntry[];
|
|
144
146
|
activeEditor?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TaEvent } from '@celljs/ta-protocol';
|
|
2
2
|
import type * as React from 'react';
|
|
3
|
-
import type { WebCallPartner, WebChatIconSource, WebComposerAddon, WebHomeSource, WebInitiative, WebOpener, WebPartnerSource, WebRoomAddon, WebSearchSource, WebSessionMenu, WebSettingsSection, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WidgetOptions } from './web-extension-api';
|
|
3
|
+
import type { WebCallPartner, WebChatIconSource, WebComposerAddon, WebFileMenu, WebHomeSource, WebInitiative, WebMenuItem, WebOpener, WebPartnerSource, WebRoomAddon, WebSearchSource, WebSessionMenu, WebSettingsSection, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WidgetOptions } from './web-extension-api';
|
|
4
4
|
import type { LoadedWebExtension, WebExtensionsState } from './web-extension-protocol';
|
|
5
5
|
/** What an extension registered through its API: all of it goes when it stops. */
|
|
6
6
|
export interface WebRegistrations {
|
|
@@ -24,6 +24,7 @@ export interface WebRegistrations {
|
|
|
24
24
|
/** Openers of some links only (WebOpenerOptions.specific): asked first. */
|
|
25
25
|
specificOpeners: WebOpener[];
|
|
26
26
|
sessionMenus: WebSessionMenu[];
|
|
27
|
+
fileMenus: WebFileMenu[];
|
|
27
28
|
taskSources: WebTaskSource[];
|
|
28
29
|
searches: WebSearchSource[];
|
|
29
30
|
composerAddons: WebComposerAddon[];
|
|
@@ -47,6 +48,8 @@ export interface WebExtensionRun extends WebRegistrations {
|
|
|
47
48
|
dispose?: () => void;
|
|
48
49
|
}
|
|
49
50
|
export declare namespace WebExtensionRunUtil {
|
|
51
|
+
/** A menu of the extension (registerSessionMenu, registerFileMenu): none once it stopped, nor when it throws. */
|
|
52
|
+
function menu<T>(run: WebExtensionRun, menu: (target: T) => WebMenuItem[]): (target: T) => WebMenuItem[];
|
|
50
53
|
/** Nothing registered: the one list of what a run holds, so that a stop clears every kind of it. */
|
|
51
54
|
function registrations(): WebRegistrations;
|
|
52
55
|
function create(loaded: LoadedWebExtension, hash?: string): WebExtensionRun;
|
|
@@ -55,6 +58,6 @@ export declare namespace WebExtensionRunUtil {
|
|
|
55
58
|
/** Subscribes for the extension: undone when it stops, or by the function returned. */
|
|
56
59
|
function track(run: WebExtensionRun, subscribe: () => () => void): () => void;
|
|
57
60
|
/** What the extensions that run registered, as the page shows it: the first of a message type or a tool name wins. */
|
|
58
|
-
function collect(runs: readonly WebExtensionRun[], onOpen: (id: string) => boolean): Pick<WebExtensionsState, 'openers' | 'specificOpeners' | 'sessionMenus' | 'extensions' | 'views' | 'widgets' | 'composerAddons' | 'roomAddons' | 'settingsSections' | 'renderers' | 'codeRenderers' | 'codeSpeech' | 'callPartner' | 'avatars' | 'chatIcons' | 'initiatives' | 'tools' | 'toolRenderers' | 'searches'>;
|
|
61
|
+
function collect(runs: readonly WebExtensionRun[], onOpen: (id: string) => boolean): Pick<WebExtensionsState, 'openers' | 'specificOpeners' | 'sessionMenus' | 'fileMenus' | 'extensions' | 'views' | 'widgets' | 'composerAddons' | 'roomAddons' | 'settingsSections' | 'renderers' | 'codeRenderers' | 'codeSpeech' | 'callPartner' | 'avatars' | 'chatIcons' | 'initiatives' | 'tools' | 'toolRenderers' | 'searches'>;
|
|
59
62
|
}
|
|
60
63
|
//# sourceMappingURL=web-extension-run.d.ts.map
|
|
@@ -4,6 +4,19 @@ exports.WebExtensionRunUtil = void 0;
|
|
|
4
4
|
const DEFAULT_ORDER = 100;
|
|
5
5
|
var WebExtensionRunUtil;
|
|
6
6
|
(function (WebExtensionRunUtil) {
|
|
7
|
+
/** A menu of the extension (registerSessionMenu, registerFileMenu): none once it stopped, nor when it throws. */
|
|
8
|
+
function menu(run, menu) {
|
|
9
|
+
return target => {
|
|
10
|
+
try {
|
|
11
|
+
return run.stopped ? [] : menu(target);
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
console.error(`The web extension ${run.loaded.name} failed:`, error);
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
WebExtensionRunUtil.menu = menu;
|
|
7
20
|
/** Nothing registered: the one list of what a run holds, so that a stop clears every kind of it. */
|
|
8
21
|
function registrations() {
|
|
9
22
|
return {
|
|
@@ -23,6 +36,7 @@ var WebExtensionRunUtil;
|
|
|
23
36
|
openers: [],
|
|
24
37
|
specificOpeners: [],
|
|
25
38
|
sessionMenus: [],
|
|
39
|
+
fileMenus: [],
|
|
26
40
|
taskSources: [],
|
|
27
41
|
searches: [],
|
|
28
42
|
composerAddons: [],
|
|
@@ -109,6 +123,7 @@ var WebExtensionRunUtil;
|
|
|
109
123
|
openers: [...runs.flatMap(run => run.specificOpeners), ...runs.flatMap(run => run.openers)],
|
|
110
124
|
specificOpeners: runs.flatMap(run => run.specificOpeners),
|
|
111
125
|
sessionMenus: runs.flatMap(run => run.sessionMenus),
|
|
126
|
+
fileMenus: runs.flatMap(run => run.fileMenus),
|
|
112
127
|
extensions: runs.map(run => run.loaded),
|
|
113
128
|
views,
|
|
114
129
|
widgets: runs.flatMap(run => [...run.widgets].map(([key, { component, options }]) => { var _a; return ({
|
|
@@ -16,6 +16,7 @@ const chat_list_util_1 = require("../components/chat-list-util");
|
|
|
16
16
|
const side_lists_1 = require("../components/side-lists");
|
|
17
17
|
const device_1 = require("../device/device");
|
|
18
18
|
const use_t_1 = require("../i18n/use-t");
|
|
19
|
+
const chime_1 = require("../notices/chime");
|
|
19
20
|
const notices_protocol_1 = require("../notices/notices-protocol");
|
|
20
21
|
const session_notices_1 = require("../notices/session-notices");
|
|
21
22
|
const settings_protocol_1 = require("../settings/settings-protocol");
|
|
@@ -135,6 +136,7 @@ var WebSessionNoticeUtil;
|
|
|
135
136
|
}
|
|
136
137
|
return (await deps.workbench.server.openSession({ cwd: (_a = notice.cwd) !== null && _a !== void 0 ? _a : '.', sessionFile: notice.sessionFile })).sessionId;
|
|
137
138
|
};
|
|
139
|
+
const tone = new chime_1.Chime();
|
|
138
140
|
return {
|
|
139
141
|
notices: deps.notices,
|
|
140
142
|
scene: notice => scene(notice, deps),
|
|
@@ -193,6 +195,12 @@ var WebSessionNoticeUtil;
|
|
|
193
195
|
console.warn('A notice of the system failed:', error);
|
|
194
196
|
}
|
|
195
197
|
},
|
|
198
|
+
chime: (level, way) => {
|
|
199
|
+
// Ta Desktop's notice of the system, from its main process, sounds of its own but for an answer.
|
|
200
|
+
if (way !== 'system' || !desktop_1.DesktopUtil.notices() || level === 'done') {
|
|
201
|
+
tone.play(level);
|
|
202
|
+
}
|
|
203
|
+
},
|
|
196
204
|
};
|
|
197
205
|
}
|
|
198
206
|
WebSessionNoticeUtil.host = host;
|