@celljs/ta-web 4.25.0 → 4.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/browser/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 +7 -2
- 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 +13 -6
- package/esm/browser/components/chat-home.js +9 -9
- package/esm/browser/components/chat-icon.d.ts +6 -1
- package/esm/browser/components/chat-icon.js +49 -4
- package/esm/browser/components/chat-list-hooks.d.ts +20 -0
- package/esm/browser/components/chat-list-hooks.js +21 -0
- package/esm/browser/components/chat-list-row.d.ts +7 -4
- package/esm/browser/components/chat-list-row.js +22 -10
- package/esm/browser/components/chat-list.js +11 -18
- 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-area.js +2 -2
- package/esm/browser/components/host-view.d.ts +1 -1
- 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/nav-places.d.ts +2 -1
- package/esm/browser/components/nav-places.js +3 -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/ta-avatar.js +34 -6
- package/esm/browser/extension/extension-view.d.ts +8 -0
- 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 +15 -2
- package/esm/browser/extension/web-api-partners.d.ts +6 -0
- package/esm/browser/extension/web-home.js +8 -0
- package/esm/browser/hosts.d.ts +2 -0
- package/esm/browser/hosts.js +22 -3
- package/esm/browser/i18n/locales.d.ts +8 -1
- package/esm/browser/i18n/messages-ja.js +7 -0
- package/esm/browser/i18n/messages-zh-tw.js +7 -0
- package/esm/browser/i18n/messages.d.ts +7 -0
- package/esm/browser/i18n/messages.js +14 -0
- package/esm/browser/style/conversation-column.d.ts +1 -1
- package/esm/browser/style/conversation-column.js +2 -2
- 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/workbench-hosts.js +8 -4
- package/esm/browser/workbench-lists.d.ts +16 -1
- package/esm/browser/workbench-lists.js +38 -3
- 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 +6 -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 +13 -6
- package/lib/browser/components/chat-home.js +10 -11
- package/lib/browser/components/chat-icon.d.ts +6 -1
- package/lib/browser/components/chat-icon.js +49 -4
- package/lib/browser/components/chat-list-hooks.d.ts +20 -0
- package/lib/browser/components/chat-list-hooks.js +22 -0
- package/lib/browser/components/chat-list-row.d.ts +7 -4
- package/lib/browser/components/chat-list-row.js +23 -12
- package/lib/browser/components/chat-list.js +10 -17
- 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-area.js +1 -1
- package/lib/browser/components/host-view.d.ts +1 -1
- 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/nav-places.d.ts +2 -1
- package/lib/browser/components/nav-places.js +3 -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/ta-avatar.js +34 -6
- package/lib/browser/extension/extension-view.d.ts +8 -0
- 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 +15 -2
- package/lib/browser/extension/web-api-partners.d.ts +6 -0
- package/lib/browser/extension/web-home.js +8 -0
- package/lib/browser/hosts.d.ts +2 -0
- package/lib/browser/hosts.js +22 -3
- package/lib/browser/i18n/locales.d.ts +8 -1
- package/lib/browser/i18n/messages-ja.js +7 -0
- package/lib/browser/i18n/messages-zh-tw.js +7 -0
- package/lib/browser/i18n/messages.d.ts +7 -0
- package/lib/browser/i18n/messages.js +14 -0
- package/lib/browser/style/conversation-column.d.ts +1 -1
- package/lib/browser/style/conversation-column.js +2 -2
- 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/workbench-hosts.js +8 -4
- package/lib/browser/workbench-lists.d.ts +16 -1
- package/lib/browser/workbench-lists.js +38 -3
- 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
|
@@ -56,7 +56,9 @@ export function useAccountInfo(side, every = 3000) {
|
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
let live = true;
|
|
59
|
-
const read = () => side.read().then(
|
|
59
|
+
const read = () => side.read().then(
|
|
60
|
+
// Mostly the same as before: what shows it is not drawn again every few seconds for nothing.
|
|
61
|
+
next => live && setInfo(previous => WorkbenchUtil.same(previous, next)), (error) => live && setFailed(error));
|
|
60
62
|
void read();
|
|
61
63
|
const timer = setInterval(() => document.visibilityState !== 'hidden' && void read(), every);
|
|
62
64
|
return () => {
|
|
@@ -102,8 +102,10 @@ export class AssistantTaskSource {
|
|
|
102
102
|
const index = at + waiting.length;
|
|
103
103
|
const state = (_a = this.stores.get(task.id)) === null || _a === void 0 ? void 0 : _a.store.state;
|
|
104
104
|
const status = this.status(task, state);
|
|
105
|
-
const detail = this.detail(task, status, state);
|
|
106
105
|
const before = this.shown.get(task.id);
|
|
106
|
+
// What a task that ended said stays what it said: not read out of its result again each time the lists change.
|
|
107
|
+
const ended = !!before && before.task === task && before.status === status && status !== 'waiting' && task.status !== 'running';
|
|
108
|
+
const detail = ended ? before.detail : this.detail(task, status, state);
|
|
107
109
|
const shown = before && before.task === task && before.status === status && before.detail === detail
|
|
108
110
|
? before
|
|
109
111
|
: { task, status, detail, entry: this.entry(task, status, detail) };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SessionState } from '@celljs/ta-client';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import type { RowWindow } from '../components/earlier-messages.js';
|
|
3
4
|
import type { WebCodeRendererProps } from '../extension/web-api-contributions.js';
|
|
4
5
|
import type { WebTaskEntry } from '../extension/web-extension-api.js';
|
|
5
6
|
import type { Translate } from '../i18n/use-t.js';
|
|
@@ -14,9 +15,11 @@ interface AssistantThreadProps {
|
|
|
14
15
|
tasks: readonly WebTaskEntry[];
|
|
15
16
|
/** The file of this conversation. */
|
|
16
17
|
origin?: string;
|
|
18
|
+
/** Only its latest rows are drawn, more as the view nears them (useEarlierMessages). */
|
|
19
|
+
rows?: RowWindow;
|
|
17
20
|
onTask(id: string): void;
|
|
18
21
|
t: Translate;
|
|
19
22
|
}
|
|
20
|
-
/** The double's conversation, as the home of the double shows it. */
|
|
21
|
-
export declare
|
|
23
|
+
/** The double's conversation, as the home of the double shows it: drawn as any conversation is (MessageList), a row at a time. */
|
|
24
|
+
export declare const AssistantThread: React.MemoExoticComponent<({ state, reply, tasks, origin, rows, onTask, t }: AssistantThreadProps) => React.JSX.Element>;
|
|
22
25
|
export {};
|
|
@@ -6,7 +6,7 @@ import { ASK_CLASS } from '../components/conversation-scroll-util.js';
|
|
|
6
6
|
import { Icon } from '../components/icon.js';
|
|
7
7
|
import { Markdown } from '../components/markdown.js';
|
|
8
8
|
import { TimeBreak, TurnFooter, UserFooter } from '../components/message-footer.js';
|
|
9
|
-
import { endsInSteps, quiet, TurnAvatar } from '../components/message-list.js';
|
|
9
|
+
import { endsInSteps, quiet, TurnAvatar, useThreadRows } from '../components/message-list.js';
|
|
10
10
|
import { useMessageMenu } from '../components/message-menu.js';
|
|
11
11
|
import { Process } from '../components/message-steps.js';
|
|
12
12
|
import { NoticeMessage, SkillUse, UserMarks, UserSaid, userWords } from '../components/message-user.js';
|
|
@@ -45,8 +45,61 @@ function DoubleUserMessage({ message, blocks }) {
|
|
|
45
45
|
React.createElement(UserFooter, { message: message, text: copied }),
|
|
46
46
|
menu));
|
|
47
47
|
}
|
|
48
|
-
/**
|
|
49
|
-
|
|
48
|
+
/** A row of the double's conversation: a turn of it, or what the user (or a task reporting back) said. */
|
|
49
|
+
function DoubleRowView({ item, tools, mood, status, latest, started, onTask, t }) {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
if (item.kind === 'turn') {
|
|
52
|
+
const results = MessageUtil.results(item.messages);
|
|
53
|
+
const { errorMessage } = ((_a = item.last) !== null && _a !== void 0 ? _a : {});
|
|
54
|
+
const stopReason = MessageUtil.stopReason(item.last);
|
|
55
|
+
return (React.createElement(DoubleTurn, { item: item, latest: latest },
|
|
56
|
+
React.createElement(Process, { steps: item.steps, active: item.active, results: results, tools: tools, leading: React.createElement(TurnAvatar, { mood: mood }), status: status }),
|
|
57
|
+
React.createElement(TaskCards, { tasks: started }),
|
|
58
|
+
item.reply.map((text, index) => (React.createElement(Markdown, { key: index, text: text, streaming: item.active && index === item.reply.length - 1 }))),
|
|
59
|
+
!item.active && stopReason === 'error' && errorMessage && React.createElement(Callout, { level: "error" }, errorMessage)));
|
|
60
|
+
}
|
|
61
|
+
const { role } = item.message;
|
|
62
|
+
if (role === 'custom') {
|
|
63
|
+
return React.createElement(CustomMessage, { message: item.message });
|
|
64
|
+
}
|
|
65
|
+
if (role !== 'user') {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
const blocks = MessageUtil.blocks(item.message);
|
|
69
|
+
const text = MessageUtil.text(blocks).trim();
|
|
70
|
+
const note = AssistantTaskUtil.noteOf(text);
|
|
71
|
+
if (note) {
|
|
72
|
+
// A note of a new id is for the double only: the user sees the task under its id in the lists.
|
|
73
|
+
const line = AssistantTaskUtil.noteLine(note, t);
|
|
74
|
+
const status = note.status;
|
|
75
|
+
return line ? (React.createElement("button", { type: "button", className: "ta-task-update", onClick: () => onTask(note.id) },
|
|
76
|
+
React.createElement("span", { className: `ta-status ta-status-${(_b = TASK_DOTS[status]) !== null && _b !== void 0 ? _b : 'done'}` }),
|
|
77
|
+
React.createElement("span", { className: "ta-task-update-text" }, line),
|
|
78
|
+
React.createElement(Icon, { icon: ChevronRight, size: 13, className: "ta-task-update-chevron" }))) : null;
|
|
79
|
+
}
|
|
80
|
+
if (TaMessageSource.isNotice(text)) {
|
|
81
|
+
return React.createElement(NoticeMessage, { message: item.message });
|
|
82
|
+
}
|
|
83
|
+
return React.createElement(DoubleUserMessage, { message: item.message, blocks: blocks });
|
|
84
|
+
}
|
|
85
|
+
function sameTasks(a, b) {
|
|
86
|
+
return a.length === b.length && a.every((task, index) => task === b[index]);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A row draws again only when one of its messages changed (the store replaces only those), the tasks it handed out
|
|
90
|
+
* did, or, while the double is at it, a tool run did; not as the page around it draws, nor as the user types.
|
|
91
|
+
*/
|
|
92
|
+
const DoubleRow = React.memo(DoubleRowView, (previous, next) => previous.mood === next.mood &&
|
|
93
|
+
previous.status === next.status &&
|
|
94
|
+
previous.latest === next.latest &&
|
|
95
|
+
previous.t === next.t &&
|
|
96
|
+
previous.onTask === next.onTask &&
|
|
97
|
+
sameTasks(previous.started, next.started) &&
|
|
98
|
+
ProcessUtil.same(previous.item, next.item) &&
|
|
99
|
+
(next.item.kind === 'message' || !next.item.active || previous.tools === next.tools));
|
|
100
|
+
const NO_TASKS = [];
|
|
101
|
+
/** The double's conversation, as the home of the double shows it: drawn as any conversation is (MessageList), a row at a time. */
|
|
102
|
+
export const AssistantThread = React.memo(function AssistantThread({ state, reply, tasks, origin, rows, onTask, t }) {
|
|
50
103
|
const renderers = React.useContext(MessageRenderers);
|
|
51
104
|
const items = React.useMemo(() => ProcessUtil.items(state.messages, state.working, state.start, renderers, state.head), [state.messages, state.working, state.start, renderers, state.head]);
|
|
52
105
|
const starts = React.useMemo(() => ProcessUtil.starts(items), [items]);
|
|
@@ -54,6 +107,7 @@ export function AssistantThread({ state, reply, tasks, origin, onTask, t }) {
|
|
|
54
107
|
// A turn's cards know what the user said after it: a choice they asked for is made (message-list.tsx).
|
|
55
108
|
const answers = React.useMemo(() => ProcessUtil.answers(items, message => userWords(MessageUtil.blocks(message)).copied), [items]);
|
|
56
109
|
const own = React.useMemo(() => tasks.filter(task => task.origin && task.origin === origin), [tasks, origin]);
|
|
110
|
+
const shown = useThreadRows(items, rows);
|
|
57
111
|
let lastTurn = items.length - 1;
|
|
58
112
|
while (lastTurn >= 0 && items[lastTurn].kind !== 'turn') {
|
|
59
113
|
lastTurn--;
|
|
@@ -64,49 +118,19 @@ export function AssistantThread({ state, reply, tasks, origin, onTask, t }) {
|
|
|
64
118
|
const onHead = status && quiet(last);
|
|
65
119
|
// The cards of the tasks the last turn handed out come after its steps.
|
|
66
120
|
const inSteps = endsInSteps(last) && !WebTaskUtil.startedIn(own, origin, starts[items.length - 1], Number.POSITIVE_INFINITY).length;
|
|
67
|
-
const row = (item, index) => {
|
|
68
|
-
var _a, _b, _c;
|
|
69
|
-
if (item.kind === 'turn') {
|
|
70
|
-
const results = MessageUtil.results(item.messages);
|
|
71
|
-
const { errorMessage } = ((_a = item.last) !== null && _a !== void 0 ? _a : {});
|
|
72
|
-
const stopReason = MessageUtil.stopReason(item.last);
|
|
73
|
-
const mood = ProcessUtil.mood(item, index === lastTurn, waiting);
|
|
74
|
-
const started = WebTaskUtil.startedIn(own, origin, starts[index], (_b = starts[index + 1]) !== null && _b !== void 0 ? _b : Number.POSITIVE_INFINITY);
|
|
75
|
-
return (React.createElement(CodeAnswer.Provider, { key: item.key, value: answers[index] },
|
|
76
|
-
React.createElement(DoubleTurn, { item: item, latest: index === lastTurn },
|
|
77
|
-
React.createElement(Process, { steps: item.steps, active: item.active, results: results, tools: state.tools, leading: React.createElement(TurnAvatar, { mood: mood }), status: onHead && item === last ? status : undefined }),
|
|
78
|
-
React.createElement(TaskCards, { tasks: started }),
|
|
79
|
-
item.reply.map((text, index) => (React.createElement(Markdown, { key: index, text: text, streaming: item.active && index === item.reply.length - 1 }))),
|
|
80
|
-
!item.active && stopReason === 'error' && errorMessage && React.createElement(Callout, { level: "error" }, errorMessage))));
|
|
81
|
-
}
|
|
82
|
-
const { role } = item.message;
|
|
83
|
-
if (role === 'custom') {
|
|
84
|
-
return React.createElement(CustomMessage, { key: item.key, message: item.message });
|
|
85
|
-
}
|
|
86
|
-
if (role !== 'user') {
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
const blocks = MessageUtil.blocks(item.message);
|
|
90
|
-
const text = MessageUtil.text(blocks).trim();
|
|
91
|
-
const note = AssistantTaskUtil.noteOf(text);
|
|
92
|
-
if (note) {
|
|
93
|
-
// A note of a new id is for the double only: the user sees the task under its id in the lists.
|
|
94
|
-
const line = AssistantTaskUtil.noteLine(note, t);
|
|
95
|
-
const status = note.status;
|
|
96
|
-
return line ? (React.createElement("button", { key: item.key, type: "button", className: "ta-task-update", onClick: () => onTask(note.id) },
|
|
97
|
-
React.createElement("span", { className: `ta-status ta-status-${(_c = TASK_DOTS[status]) !== null && _c !== void 0 ? _c : 'done'}` }),
|
|
98
|
-
React.createElement("span", { className: "ta-task-update-text" }, line),
|
|
99
|
-
React.createElement(Icon, { icon: ChevronRight, size: 13, className: "ta-task-update-chevron" }))) : null;
|
|
100
|
-
}
|
|
101
|
-
if (TaMessageSource.isNotice(text)) {
|
|
102
|
-
return React.createElement(NoticeMessage, { key: item.key, message: item.message });
|
|
103
|
-
}
|
|
104
|
-
return React.createElement(DoubleUserMessage, { key: item.key, message: item.message, blocks: blocks });
|
|
105
|
-
};
|
|
106
121
|
return (React.createElement(CodeReply.Provider, { value: reply },
|
|
107
|
-
items.map((item, index) =>
|
|
108
|
-
|
|
109
|
-
|
|
122
|
+
items.map((item, index) => {
|
|
123
|
+
var _a;
|
|
124
|
+
if (index < shown.from) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
const turn = item.kind === 'turn';
|
|
128
|
+
const started = turn ? WebTaskUtil.startedIn(own, origin, starts[index], (_a = starts[index + 1]) !== null && _a !== void 0 ? _a : Number.POSITIVE_INFINITY) : NO_TASKS;
|
|
129
|
+
return (React.createElement("div", { key: item.key, "data-row": item.key, className: shown.className(index) },
|
|
130
|
+
breaks[index] !== undefined && React.createElement(TimeBreak, { timestamp: breaks[index] }),
|
|
131
|
+
React.createElement(CodeAnswer.Provider, { value: answers[index] },
|
|
132
|
+
React.createElement(DoubleRow, { item: item, tools: state.tools, mood: turn ? ProcessUtil.mood(item, index === lastTurn, waiting) : 'idle', status: onHead && item === last ? status : undefined, latest: index === lastTurn, started: started, onTask: onTask, t: t }))));
|
|
133
|
+
}),
|
|
110
134
|
status && !onHead && React.createElement("div", { className: `ta-run-line ${inSteps ? 'ta-run-steps' : ''}` }, status)));
|
|
111
|
-
}
|
|
135
|
+
});
|
|
112
136
|
//# sourceMappingURL=assistant-thread.js.map
|
|
@@ -7,7 +7,7 @@ import { useComposerAddons } from '../components/composer-addons.js';
|
|
|
7
7
|
import { ConnectionBanner } from '../components/connection-bar.js';
|
|
8
8
|
import { useConversationScroll } from '../components/conversation-scroll-hooks.js';
|
|
9
9
|
import { DialogView } from '../components/dialog-view.js';
|
|
10
|
-
import { isAsk, useAsked, useEarlierMessages } from '../components/earlier-messages.js';
|
|
10
|
+
import { isAsk, useAsked, useEarlierMessages, useRowWindow } from '../components/earlier-messages.js';
|
|
11
11
|
import { HeroCards, HeroSteps } from '../components/hero-cards.js';
|
|
12
12
|
import { Icon } from '../components/icon.js';
|
|
13
13
|
import { Loading } from '../components/loading.js';
|
|
@@ -171,7 +171,13 @@ function Chat({ store, tasks, taskStates, onTask, onMood, onTasks }) {
|
|
|
171
171
|
// What the user said; a task that reports back stays where it comes in.
|
|
172
172
|
const asked = useAsked(state, saidByUser);
|
|
173
173
|
const scroller = useConversationScroll(asked);
|
|
174
|
-
|
|
174
|
+
// A long conversation draws its latest rows, more as the view nears them, as any conversation does (session-view.tsx).
|
|
175
|
+
const rows = useRowWindow();
|
|
176
|
+
useEarlierMessages(store, state, scroller, rows);
|
|
177
|
+
// The same function as the page draws again each second (its mood): the rows of the thread do not draw for it.
|
|
178
|
+
const taskOpened = React.useRef(onTask);
|
|
179
|
+
taskOpened.current = onTask;
|
|
180
|
+
const openTask = React.useCallback((id) => taskOpened.current(id), []);
|
|
175
181
|
const say = (message) => {
|
|
176
182
|
hush();
|
|
177
183
|
return assistant.say(message);
|
|
@@ -296,7 +302,7 @@ function Chat({ store, tasks, taskStates, onTask, onMood, onTasks }) {
|
|
|
296
302
|
React.createElement(HeroSteps, { steps: STEPS }),
|
|
297
303
|
React.createElement(HeroCards, { suggestions: SUGGESTIONS, onPick: send }))) : (React.createElement(MessageActions.Provider, { value: messageActions },
|
|
298
304
|
React.createElement(MessageImages.Provider, { value: images },
|
|
299
|
-
React.createElement(AssistantThread, { state: state, reply: answerCard, tasks: allTasks, origin: assistant.sessionFile, onTask:
|
|
305
|
+
React.createElement(AssistantThread, { state: state, reply: answerCard, tasks: allTasks, origin: assistant.sessionFile, rows: rows, onTask: openTask, t: t })))))),
|
|
300
306
|
React.createElement("div", { className: "ta-composer-area" },
|
|
301
307
|
React.createElement("div", { className: "ta-chat-col" },
|
|
302
308
|
asks.map(ask => (React.createElement("div", { key: ask.id, className: "ta-attention" },
|
|
@@ -25,7 +25,8 @@ export interface AccountEntry {
|
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* The entries of the account and of the settings, in groups: the settings, the packages and the keys; the model
|
|
28
|
-
* accounts, the default directory and the phone; the theme and the language;
|
|
28
|
+
* accounts, the default directory and the phone; the theme and the language; the pages of extensions that are the
|
|
29
|
+
* user's own (WebView.group `me`: their feedback), about, and signing out.
|
|
29
30
|
*/
|
|
30
31
|
export declare function useAccountEntries(onSettings: (section?: SettingsSection) => void, onDialog: (dialog: AccountDialog) => void): AccountEntry[][];
|
|
31
32
|
/** What the entries of the account open over the page. */
|
|
@@ -4,7 +4,8 @@ import * as React from 'react';
|
|
|
4
4
|
import { useAccountInfo, useAccountSide } from '../account/account-side.js';
|
|
5
5
|
import { DeviceAccount } from '../account/device-account.js';
|
|
6
6
|
import { useDevice } from '../device/device.js';
|
|
7
|
-
import {
|
|
7
|
+
import { WebLabelUtil } from '../extension/web-extension-protocol.js';
|
|
8
|
+
import { useNotices, usePersisted, usePwa, useSettings, useWebExtensions, useWorkbench } from '../hooks.js';
|
|
8
9
|
import { HostUtil } from '../hosts.js';
|
|
9
10
|
import { useT } from '../i18n/use-t.js';
|
|
10
11
|
import { WorkbenchUtil } from '../workbench-util.js';
|
|
@@ -31,7 +32,8 @@ const LANGUAGES = [
|
|
|
31
32
|
];
|
|
32
33
|
/**
|
|
33
34
|
* The entries of the account and of the settings, in groups: the settings, the packages and the keys; the model
|
|
34
|
-
* accounts, the default directory and the phone; the theme and the language;
|
|
35
|
+
* accounts, the default directory and the phone; the theme and the language; the pages of extensions that are the
|
|
36
|
+
* user's own (WebView.group `me`: their feedback), about, and signing out.
|
|
35
37
|
*/
|
|
36
38
|
export function useAccountEntries(onSettings, onDialog) {
|
|
37
39
|
const t = useT();
|
|
@@ -49,6 +51,8 @@ export function useAccountEntries(onSettings, onDialog) {
|
|
|
49
51
|
const { info } = useAccountInfo(side, 15000);
|
|
50
52
|
const signedIn = Boolean(info === null || info === void 0 ? void 0 : info.account);
|
|
51
53
|
const app = WorkbenchUtil.isApp();
|
|
54
|
+
const [{ views }, extensions] = useWebExtensions();
|
|
55
|
+
const own = views.filter(view => view.group === 'me' && view.location === 'page');
|
|
52
56
|
// Signed in, out of the account (its computers go, those connected by a code stay); else out of the computer in use.
|
|
53
57
|
const signOut = async () => {
|
|
54
58
|
if (!signedIn || !side) {
|
|
@@ -117,6 +121,7 @@ export function useAccountEntries(onSettings, onDialog) {
|
|
|
117
121
|
entry('restart', restartTa.update ? t('ta.update.restartTo', { version: ServeRestartUtil.label(restartTa.update) }) : t('ta.restart'), RotateCw, () => void restartTa.restart()),
|
|
118
122
|
]
|
|
119
123
|
: []),
|
|
124
|
+
...own.map(view => { var _a; return entry(`page:${view.id}`, WebLabelUtil.text(view.title), ((_a = view.icon) !== null && _a !== void 0 ? _a : Info), () => void extensions.showView(view.id)); }),
|
|
120
125
|
entry('about', t('ta.manage.about'), Info, () => onSettings('about')),
|
|
121
126
|
// As WeChat's: the account in use kept, with its computers, to come back to in one tap (docs/design/ta-me.md 4).
|
|
122
127
|
...(app && signedIn ? [entry('switchAccount', t('ta.account.switchSignIn'), ArrowLeftRight, () => { var _a; return (_a = DeviceAccount.current()) === null || _a === void 0 ? void 0 : _a.switchAccount(); })] : []),
|
|
@@ -2,7 +2,7 @@ import { ChevronLeft, Compass, Grip, LayoutDashboard, PanelTop } from 'lucide-re
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useDevice } from '../device/device.js';
|
|
4
4
|
import { useHeld } from '../device/hold.js';
|
|
5
|
-
import { ExtensionBoundary } from '../extension/extension-view.js';
|
|
5
|
+
import { ExtensionBoundary, ExtensionPart } from '../extension/extension-view.js';
|
|
6
6
|
import { WebLabelUtil } from '../extension/web-extension-protocol.js';
|
|
7
7
|
import { useSettings, useWebExtensions, useWorkbench } from '../hooks.js';
|
|
8
8
|
import { useT } from '../i18n/use-t.js';
|
|
@@ -108,11 +108,11 @@ export function SidebarView({ view }) {
|
|
|
108
108
|
return (React.createElement("section", { className: "ta-side-view", "aria-label": title, "data-arrived": arrived ? '' : undefined },
|
|
109
109
|
React.createElement("header", { className: "ta-chats-head" }, Head ? (React.createElement("div", { className: "ta-side-view-head" },
|
|
110
110
|
React.createElement(ExtensionBoundary, { key: view.id, name: title, resetKey: Head },
|
|
111
|
-
React.createElement(
|
|
111
|
+
React.createElement(ExtensionPart, { component: Head })))) : (React.createElement("span", { className: "ta-chats-title" }, title))),
|
|
112
112
|
React.createElement(ConnectionBanner, null),
|
|
113
113
|
React.createElement("div", { className: "ta-side-view-body" },
|
|
114
114
|
React.createElement(ExtensionBoundary, { key: view.id, name: title, resetKey: View },
|
|
115
|
-
React.createElement(
|
|
115
|
+
React.createElement(ExtensionPart, { component: View })))));
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
118
|
* A page of a web extension in the main area: its head (`leading` first: the menu, or back), then the page. While
|
|
@@ -128,11 +128,11 @@ export function PageView({ view, leading }) {
|
|
|
128
128
|
pushed ? React.createElement(IconButton, { icon: ChevronLeft, label: t('ta.back'), onClick: () => pushed.close() }) : leading,
|
|
129
129
|
view.head ? (React.createElement("div", { className: "ta-main-head-view" },
|
|
130
130
|
React.createElement(ExtensionBoundary, { key: view.id, name: title, resetKey: view.head },
|
|
131
|
-
React.createElement(view.head
|
|
131
|
+
React.createElement(ExtensionPart, { component: view.head })))) : (React.createElement("div", { className: "ta-main-title" },
|
|
132
132
|
React.createElement("span", null, title))),
|
|
133
133
|
React.createElement(WorkbenchToggle, null)),
|
|
134
134
|
React.createElement("div", { className: "ta-page-body" },
|
|
135
135
|
React.createElement(ExtensionBoundary, { key: view.id, name: title, resetKey: View },
|
|
136
|
-
React.createElement(
|
|
136
|
+
React.createElement(ExtensionPart, { component: View })))));
|
|
137
137
|
}
|
|
138
138
|
//# sourceMappingURL=app-nav.js.map
|
|
@@ -68,9 +68,24 @@ export var ChatAskUtil;
|
|
|
68
68
|
function entryOf(sessions, saved, session) {
|
|
69
69
|
const { sessionId, sessionFile } = session;
|
|
70
70
|
const open = sessions.find(each => each.sessionId === sessionId || (!!sessionFile && each.sessionFile === sessionFile));
|
|
71
|
-
return open !== null && open !== void 0 ? open : (sessionFile ? saved.
|
|
71
|
+
return open !== null && open !== void 0 ? open : (sessionFile ? byFile(saved).get(sessionFile) : undefined);
|
|
72
72
|
}
|
|
73
73
|
ChatAskUtil.entryOf = entryOf;
|
|
74
|
+
/** The saved ones by their file, made once for a list: asked of every task as the lists draw, of hundreds. */
|
|
75
|
+
const indexed = new WeakMap();
|
|
76
|
+
function byFile(saved) {
|
|
77
|
+
let index = indexed.get(saved);
|
|
78
|
+
if (!index) {
|
|
79
|
+
index = new Map();
|
|
80
|
+
for (const each of saved) {
|
|
81
|
+
if (!index.has(each.sessionFile)) {
|
|
82
|
+
index.set(each.sessionFile, each);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
indexed.set(saved, index);
|
|
86
|
+
}
|
|
87
|
+
return index;
|
|
88
|
+
}
|
|
74
89
|
/** Whether it waits for the user: it asks, or a dialog of it waits. */
|
|
75
90
|
function waits(entry, letGo) {
|
|
76
91
|
return !!entry.waiting || !!asking(entry, letGo);
|
|
@@ -30,15 +30,19 @@ export declare function ChatDoubleItem({ home, counts, unseen, now }: {
|
|
|
30
30
|
* or unpinned as a folder is. What it opens shows as a conversation of the list does, the row selected while its page
|
|
31
31
|
* or the conversation it stands for is in front.
|
|
32
32
|
*/
|
|
33
|
-
export declare
|
|
33
|
+
export declare const ChatHomeItem: React.MemoExoticComponent<({ row, time, shown, openItem, selected, pinned, onPin, }: {
|
|
34
34
|
row: ChatHomeRow;
|
|
35
35
|
time: string;
|
|
36
|
-
|
|
36
|
+
/** Its page is in front (ChatHome.shownItem). */
|
|
37
|
+
shown: boolean;
|
|
38
|
+
openItem: ChatHome['openItem'];
|
|
37
39
|
/** The conversation it stands for is shown (WebHomeItem.sessionFile). */
|
|
38
40
|
selected: boolean;
|
|
39
41
|
pinned: boolean;
|
|
40
|
-
onPin(pinned: boolean): void;
|
|
41
|
-
})
|
|
42
|
+
onPin(key: string, pinned: boolean): void;
|
|
43
|
+
}) => React.JSX.Element>;
|
|
44
|
+
/** What a row of a task does to the double's home: marks it seen, deletes it. */
|
|
45
|
+
export type ChatTaskHome = Pick<ChatHome, 'look' | 'remove'>;
|
|
42
46
|
/**
|
|
43
47
|
* A task of the double that is no conversation (a team), or one that waits for the user: who does it, what it is at,
|
|
44
48
|
* when; a blue ? while it waits, an amber dot once it ended unseen. It opens in the main area, its conversation or its
|
|
@@ -46,7 +50,8 @@ export declare function ChatHomeItem({ row, time, home, selected, pinned, onPin,
|
|
|
46
50
|
*/
|
|
47
51
|
export declare const ChatTaskItem: React.MemoExoticComponent<({ task, home, unseen, time, onPicked, }: {
|
|
48
52
|
task: WebTaskEntry;
|
|
49
|
-
home:
|
|
53
|
+
/** What it does to the double's home: one that stays the same (ChatList), for the row not to draw again for nothing. */
|
|
54
|
+
home: ChatTaskHome;
|
|
50
55
|
unseen: boolean;
|
|
51
56
|
time: string;
|
|
52
57
|
/** As it opens in the main area: a drawer closes, a phone slides it in (ChatListProps.onPicked). */
|
|
@@ -56,8 +61,10 @@ export declare const ChatTaskItem: React.MemoExoticComponent<({ task, home, unse
|
|
|
56
61
|
* The top of the double's list: its card (`double`, unless a search leaves it out), then what waits for the user to
|
|
57
62
|
* decide, above the conversations. The rows extensions add are rows of the list, pinned at first (ChatListUtil.offerPins).
|
|
58
63
|
*/
|
|
59
|
-
export declare function ChatHomeTop({ home, double, waiting, counts, unseen, now, onPicked, }: {
|
|
64
|
+
export declare function ChatHomeTop({ home, taskHome, double, waiting, counts, unseen, now, onPicked, }: {
|
|
60
65
|
home: ChatHome;
|
|
66
|
+
/** The same, for the rows of what waits for the user (ChatTaskItem). */
|
|
67
|
+
taskHome: ChatTaskHome;
|
|
61
68
|
double: boolean;
|
|
62
69
|
waiting: readonly WebTaskEntry[];
|
|
63
70
|
counts: ChatHomeCounts;
|
|
@@ -47,7 +47,7 @@ export function ChatDoubleItem({ home, counts, unseen, now }) {
|
|
|
47
47
|
* or unpinned as a folder is. What it opens shows as a conversation of the list does, the row selected while its page
|
|
48
48
|
* or the conversation it stands for is in front.
|
|
49
49
|
*/
|
|
50
|
-
export function ChatHomeItem({ row, time,
|
|
50
|
+
export const ChatHomeItem = React.memo(function ChatHomeItem({ row, time, shown, openItem, selected, pinned, onPin, }) {
|
|
51
51
|
var _a;
|
|
52
52
|
const t = useT();
|
|
53
53
|
const [menu, openMenu] = useContextMenu();
|
|
@@ -55,20 +55,20 @@ export function ChatHomeItem({ row, time, home, selected, pinned, onPin, }) {
|
|
|
55
55
|
const { item, partner } = row;
|
|
56
56
|
if (partner) {
|
|
57
57
|
// A partner's conversation: the row the partners draw it with.
|
|
58
|
-
const opens = () =>
|
|
59
|
-
return React.createElement(PartnerRow, { partner: partner, time: time, selected:
|
|
58
|
+
const opens = () => openItem(item);
|
|
59
|
+
return React.createElement(PartnerRow, { partner: partner, time: time, selected: shown, open: opens, pinned: pinned, onPin: pin => onPin(row.key, pin) });
|
|
60
60
|
}
|
|
61
61
|
const Glyph = item.icon;
|
|
62
62
|
const Own = item.face;
|
|
63
63
|
const open = () => {
|
|
64
64
|
setOpening(true);
|
|
65
65
|
void Promise.resolve()
|
|
66
|
-
.then(() =>
|
|
66
|
+
.then(() => openItem(item))
|
|
67
67
|
.catch(error => console.error(`A row of the home of ${item.extension} failed:`, error))
|
|
68
68
|
.finally(() => setOpening(false));
|
|
69
69
|
};
|
|
70
|
-
const pin = { label: t(pinned ? 'ta.chat.unpin' : 'ta.chat.pin'), run: () => onPin(!pinned) };
|
|
71
|
-
const current = selected ||
|
|
70
|
+
const pin = { label: t(pinned ? 'ta.chat.unpin' : 'ta.chat.pin'), run: () => onPin(row.key, !pinned) };
|
|
71
|
+
const current = selected || shown;
|
|
72
72
|
return (React.createElement(SwipeRow, { as: "li", className: `ta-chat-row ta-chat-home-item${current ? ' ta-selected' : ''}`, "data-row": row.key, "data-unseen": item.unseen ? '' : undefined, actions: [{ key: 'pin', ...pin }], overlay: menu, onContextMenu: event => openMenu(event, ContextMenuUtil.sections([{ label: t('ta.chat.open'), run: open }], [pin])) },
|
|
73
73
|
React.createElement("button", { type: "button", className: "ta-chat-item", title: item.title, "aria-current": current ? 'true' : undefined, onClick: open },
|
|
74
74
|
React.createElement("span", { className: "ta-chat-avatar-box" },
|
|
@@ -76,7 +76,7 @@ export function ChatHomeItem({ row, time, home, selected, pinned, onPin, }) {
|
|
|
76
76
|
React.createElement(Own, { size: 38 }))) : (React.createElement("span", { className: "ta-chat-avatar ta-chat-icon", style: { background: `var(--ta-tint-${item.tone})`, color: `var(--ta-tint-ink-${item.tone})`, width: 38, height: 38 }, "aria-hidden": "true" }, opening ? React.createElement("span", { className: "ta-spinner" }) : React.createElement(Glyph, { size: 18, strokeWidth: 1.8 }))),
|
|
77
77
|
React.createElement(ChatDot, { unseen: !!item.unseen, asks: false })),
|
|
78
78
|
React.createElement(RowText, { title: item.title, time: time, line: (_a = item.detail) !== null && _a !== void 0 ? _a : '', unseen: item.unseen }))));
|
|
79
|
-
}
|
|
79
|
+
});
|
|
80
80
|
/**
|
|
81
81
|
* A task of the double that is no conversation (a team), or one that waits for the user: who does it, what it is at,
|
|
82
82
|
* when; a blue ? while it waits, an amber dot once it ended unseen. It opens in the main area, its conversation or its
|
|
@@ -120,7 +120,7 @@ export const ChatTaskItem = React.memo(function ChatTaskItem({ task, home, unsee
|
|
|
120
120
|
* The top of the double's list: its card (`double`, unless a search leaves it out), then what waits for the user to
|
|
121
121
|
* decide, above the conversations. The rows extensions add are rows of the list, pinned at first (ChatListUtil.offerPins).
|
|
122
122
|
*/
|
|
123
|
-
export function ChatHomeTop({ home, double, waiting, counts, unseen, now, onPicked, }) {
|
|
123
|
+
export function ChatHomeTop({ home, taskHome, double, waiting, counts, unseen, now, onPicked, }) {
|
|
124
124
|
const t = useT();
|
|
125
125
|
return (React.createElement(React.Fragment, null,
|
|
126
126
|
double && (React.createElement("section", { className: "ta-chat-section ta-chat-home" },
|
|
@@ -128,6 +128,6 @@ export function ChatHomeTop({ home, double, waiting, counts, unseen, now, onPick
|
|
|
128
128
|
React.createElement(ChatDoubleItem, { home: home, counts: counts, unseen: unseen, now: now })))),
|
|
129
129
|
waiting.length > 0 && (React.createElement("section", { className: "ta-chat-section ta-chat-decide" },
|
|
130
130
|
React.createElement("div", { className: "ta-chat-section-title" }, t('ta.home.decide')),
|
|
131
|
-
React.createElement("ul", { className: "ta-side-list" }, waiting.map(task => (React.createElement(ChatTaskItem, { key: task.key, task: task, home:
|
|
131
|
+
React.createElement("ul", { className: "ta-side-list" }, waiting.map(task => (React.createElement(ChatTaskItem, { key: task.key, task: task, home: taskHome, unseen: false, time: ChatListUtil.clock(task.startedAt, now), onPicked: onPicked }))))))));
|
|
132
132
|
}
|
|
133
133
|
//# sourceMappingURL=chat-home.js.map
|
|
@@ -11,7 +11,12 @@ export type ChatFolderIcon = FoundChatIcon & {
|
|
|
11
11
|
};
|
|
12
12
|
/** The icons web extensions give conversations of theirs (WebExtensionAPI.registerChatIcon). */
|
|
13
13
|
export declare namespace ChatIconUtil {
|
|
14
|
-
/**
|
|
14
|
+
/** An extension said its icons changed, or the language did: they are asked again. */
|
|
15
|
+
function changed(): void;
|
|
16
|
+
/**
|
|
17
|
+
* The icon of the first extension that gives one, with its tint; an extension that throws gives none. Asked once
|
|
18
|
+
* for a conversation (what WebChat has of it) until the icons change: the lists ask it of hundreds as they draw.
|
|
19
|
+
*/
|
|
15
20
|
function find(entries: readonly WebChatIconEntry[], chat: WebChat): FoundChatIcon | undefined;
|
|
16
21
|
/**
|
|
17
22
|
* Since when a conversation an extension archives sooner (WebChatIcon.archiveMinutes, archiveDays) stays listed,
|
|
@@ -1,12 +1,47 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ChatIcons } from '../extension/extension-view.js';
|
|
3
|
+
import { useLanguage } from '../i18n/use-t.js';
|
|
3
4
|
import { WorkbenchUtil } from '../workbench-util.js';
|
|
4
5
|
import { LauncherSearchUtil } from './launcher-search-util.js';
|
|
5
6
|
/** The icons web extensions give conversations of theirs (WebExtensionAPI.registerChatIcon). */
|
|
6
7
|
export var ChatIconUtil;
|
|
7
8
|
(function (ChatIconUtil) {
|
|
8
|
-
/**
|
|
9
|
+
/** Counts what extensions said changed of their icons (ChatIconsProvider): what `find` remembered from before is asked again. */
|
|
10
|
+
let generation = 0;
|
|
11
|
+
const remembered = new WeakMap();
|
|
12
|
+
/** An extension said its icons changed, or the language did: they are asked again. */
|
|
13
|
+
function changed() {
|
|
14
|
+
generation++;
|
|
15
|
+
}
|
|
16
|
+
ChatIconUtil.changed = changed;
|
|
17
|
+
/**
|
|
18
|
+
* The icon of the first extension that gives one, with its tint; an extension that throws gives none. Asked once
|
|
19
|
+
* for a conversation (what WebChat has of it) until the icons change: the lists ask it of hundreds as they draw.
|
|
20
|
+
*/
|
|
9
21
|
function find(entries, chat) {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
if (entries.length === 0) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
let memo = remembered.get(entries);
|
|
27
|
+
if ((memo === null || memo === void 0 ? void 0 : memo.generation) !== generation) {
|
|
28
|
+
memo = { generation, found: new Map(), byChat: new WeakMap() };
|
|
29
|
+
remembered.set(entries, memo);
|
|
30
|
+
}
|
|
31
|
+
// The same info of a conversation, asked again by each list and dot as they draw: found without a key made.
|
|
32
|
+
if (memo.byChat.has(chat)) {
|
|
33
|
+
return memo.byChat.get(chat);
|
|
34
|
+
}
|
|
35
|
+
const key = `${(_a = chat.group) !== null && _a !== void 0 ? _a : ''}\n${chat.cwd}\n${(_b = chat.sessionFile) !== null && _b !== void 0 ? _b : ''}`;
|
|
36
|
+
const found = memo.found.has(key)
|
|
37
|
+
? memo.found.get(key)
|
|
38
|
+
: ask(entries, { sessionFile: chat.sessionFile, cwd: chat.cwd, ...(chat.group ? { group: chat.group } : {}) });
|
|
39
|
+
memo.found.set(key, found);
|
|
40
|
+
memo.byChat.set(chat, found);
|
|
41
|
+
return found;
|
|
42
|
+
}
|
|
43
|
+
ChatIconUtil.find = find;
|
|
44
|
+
function ask(entries, chat) {
|
|
10
45
|
var _a;
|
|
11
46
|
for (const { extension, source } of entries) {
|
|
12
47
|
try {
|
|
@@ -30,7 +65,6 @@ export var ChatIconUtil;
|
|
|
30
65
|
}
|
|
31
66
|
return undefined;
|
|
32
67
|
}
|
|
33
|
-
ChatIconUtil.find = find;
|
|
34
68
|
/**
|
|
35
69
|
* Since when a conversation an extension archives sooner (WebChatIcon.archiveMinutes, archiveDays) stays listed,
|
|
36
70
|
* for ChatListUtil.entries; none without extensions that give icons.
|
|
@@ -68,8 +102,18 @@ export var ChatIconUtil;
|
|
|
68
102
|
/** Gives the lists the icons of the extensions, and draws their rows again when an extension says they changed. */
|
|
69
103
|
export function ChatIconsProvider({ entries, children }) {
|
|
70
104
|
const [version, setVersion] = React.useState(0);
|
|
105
|
+
// What an icon says (the name of its folder) may be in the language of the page.
|
|
106
|
+
const language = useLanguage();
|
|
107
|
+
const languageShown = React.useRef(language);
|
|
108
|
+
if (languageShown.current !== language) {
|
|
109
|
+
languageShown.current = language;
|
|
110
|
+
ChatIconUtil.changed();
|
|
111
|
+
}
|
|
71
112
|
React.useEffect(() => {
|
|
72
|
-
const changed = () =>
|
|
113
|
+
const changed = () => {
|
|
114
|
+
ChatIconUtil.changed();
|
|
115
|
+
setVersion(count => count + 1);
|
|
116
|
+
};
|
|
73
117
|
const stops = entries.map(({ source }) => {
|
|
74
118
|
var _a;
|
|
75
119
|
try {
|
|
@@ -85,7 +129,8 @@ export function ChatIconsProvider({ entries, children }) {
|
|
|
85
129
|
}
|
|
86
130
|
};
|
|
87
131
|
}, [entries]);
|
|
88
|
-
|
|
132
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: a new language is a new value, what the icons say read again
|
|
133
|
+
const value = React.useMemo(() => ({ entries: [...entries], version }), [entries, version, language]);
|
|
89
134
|
return React.createElement(ChatIcons.Provider, { value: value }, children);
|
|
90
135
|
}
|
|
91
136
|
/** The icon of a conversation, when an extension gives it one. */
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { WebChat, WebHomeEntry } from '../extension/web-extension-api.js';
|
|
3
|
+
import type { ChatTaskHome } from './chat-home.js';
|
|
4
|
+
import { type ChatHome } from './chat-home-util.js';
|
|
3
5
|
import type { ChatFolderIcon } from './chat-icon.js';
|
|
4
6
|
import { type ChatEntry } from './chat-list-util.js';
|
|
5
7
|
/**
|
|
@@ -30,3 +32,21 @@ export declare function usePageEnd(more: boolean, root: React.RefObject<HTMLElem
|
|
|
30
32
|
page: string): void;
|
|
31
33
|
/** A conversation that comes to the top, is pinned or let go slides to its place in the list and in a folder opened, as the others make room. */
|
|
32
34
|
export declare function useChatListMotion(list: React.RefObject<HTMLElement | null>, folder: React.RefObject<HTMLElement | null>): void;
|
|
35
|
+
/**
|
|
36
|
+
* What the rows do (ChatTaskItem, ChatHomeItem, ChatFolderItem), the same functions and object however often the list
|
|
37
|
+
* draws: a row draws again as what it shows does, not as the list or the page around it does.
|
|
38
|
+
*/
|
|
39
|
+
export declare function useRowCalls(given: {
|
|
40
|
+
onPicked(): void;
|
|
41
|
+
home: ChatHome | undefined;
|
|
42
|
+
openFolder(key: string, archived?: boolean): void;
|
|
43
|
+
pinned: readonly string[];
|
|
44
|
+
onPinned(pinned: string[]): void;
|
|
45
|
+
}): {
|
|
46
|
+
picked(): void;
|
|
47
|
+
taskHome: ChatTaskHome;
|
|
48
|
+
openItem: ChatHome['openItem'];
|
|
49
|
+
openFolder(key: string, archived?: boolean): void;
|
|
50
|
+
/** Pins or unpins a conversation's file or a folder's key: the last pinned first, as several may be. */
|
|
51
|
+
pinKey(key: string, pin: boolean): void;
|
|
52
|
+
};
|
|
@@ -84,4 +84,25 @@ export function useChatListMotion(list, folder) {
|
|
|
84
84
|
useListMotion(list);
|
|
85
85
|
useListMotion(folder);
|
|
86
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* What the rows do (ChatTaskItem, ChatHomeItem, ChatFolderItem), the same functions and object however often the list
|
|
89
|
+
* draws: a row draws again as what it shows does, not as the list or the page around it does.
|
|
90
|
+
*/
|
|
91
|
+
export function useRowCalls(given) {
|
|
92
|
+
const latest = React.useRef(given);
|
|
93
|
+
latest.current = given;
|
|
94
|
+
return React.useMemo(() => ({
|
|
95
|
+
pinKey: (key, pin) => {
|
|
96
|
+
const others = latest.current.pinned.filter(other => other !== key);
|
|
97
|
+
latest.current.onPinned(pin ? [key, ...others] : others);
|
|
98
|
+
},
|
|
99
|
+
picked: () => latest.current.onPicked(),
|
|
100
|
+
taskHome: {
|
|
101
|
+
look: (key, at) => { var _a; return (_a = latest.current.home) === null || _a === void 0 ? void 0 : _a.look(key, at); },
|
|
102
|
+
remove: tasks => { var _a; return (_a = latest.current.home) === null || _a === void 0 ? void 0 : _a.remove(tasks); },
|
|
103
|
+
},
|
|
104
|
+
openItem: entry => { var _a; var _b; return (_b = (_a = latest.current.home) === null || _a === void 0 ? void 0 : _a.openItem(entry)) !== null && _b !== void 0 ? _b : Promise.resolve(); },
|
|
105
|
+
openFolder: (key, archived) => latest.current.openFolder(key, archived),
|
|
106
|
+
}), []);
|
|
107
|
+
}
|
|
87
108
|
//# sourceMappingURL=chat-list-hooks.js.map
|
|
@@ -80,7 +80,7 @@ export declare function ChatDot({ unseen, asks, onSee }: {
|
|
|
80
80
|
* of it with what it said; a dot while one of them said something unseen, a spinner while one works. It opens the folder,
|
|
81
81
|
* and is pinned as a conversation is: from its menu, or a swipe to the left on a phone.
|
|
82
82
|
*/
|
|
83
|
-
|
|
83
|
+
interface ChatFolderProps {
|
|
84
84
|
folder: ChatFolder;
|
|
85
85
|
time: string;
|
|
86
86
|
/** The conversation shown is in it. */
|
|
@@ -88,9 +88,12 @@ export declare function ChatFolderItem({ folder, time, selected, unseen, pinned,
|
|
|
88
88
|
/** Those of it that said something unseen: its dot, which dragged away sees them all. */
|
|
89
89
|
unseen: ChatEntry[];
|
|
90
90
|
pinned: boolean;
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
/** It is of the archive. */
|
|
92
|
+
archived?: boolean;
|
|
93
|
+
onOpen(key: string, archived?: boolean): void;
|
|
94
|
+
onPin(key: string, pinned: boolean): void;
|
|
93
95
|
actions: ChatRowActions;
|
|
94
|
-
}
|
|
96
|
+
}
|
|
97
|
+
export declare const ChatFolderItem: React.MemoExoticComponent<({ folder, time, selected, unseen, pinned, archived, onOpen, onPin, actions, }: ChatFolderProps) => React.JSX.Element>;
|
|
95
98
|
export declare const ChatItem: React.MemoExoticComponent<({ session, source, selected, time, compact, actions, restorable, task, doubleName, handable, pinned, unseen, asking, draft, }: ItemProps) => React.JSX.Element>;
|
|
96
99
|
export {};
|