@alexsun-top/opencode-chat-room 0.7.8 → 0.8.1
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/CHANGELOG.md +43 -1
- package/LICENSE +21 -0
- package/README.md +77 -36
- package/README.zh-CN.md +82 -41
- package/cli.ts +27 -1
- package/dist/cli.js +6905 -2764
- package/package.json +33 -3
- package/packages/chat-room-channeld/README.md +315 -0
- package/packages/chat-room-channeld/dist/feishu-adapter.js +1262 -0
- package/packages/chat-room-channeld/dist/mock-adapter.js +295 -0
- package/packages/chat-room-channeld/src/adapter.ts +509 -0
- package/packages/chat-room-channeld/src/cli.ts +124 -0
- package/packages/chat-room-channeld/src/config.ts +269 -0
- package/packages/chat-room-channeld/src/delivery.ts +163 -0
- package/packages/chat-room-channeld/src/feishu-adapter.ts +303 -0
- package/packages/chat-room-channeld/src/feishu-card.ts +27 -0
- package/packages/chat-room-channeld/src/feishu-inbound.ts +158 -0
- package/packages/chat-room-channeld/src/feishu-live.ts +355 -0
- package/packages/chat-room-channeld/src/feishu-send.ts +342 -0
- package/packages/chat-room-channeld/src/feishu-ws-frames.ts +173 -0
- package/packages/chat-room-channeld/src/framing.ts +128 -0
- package/packages/chat-room-channeld/src/host-helpers.ts +52 -0
- package/packages/chat-room-channeld/src/host.ts +627 -0
- package/packages/chat-room-channeld/src/inbound.ts +26 -0
- package/packages/chat-room-channeld/src/ingest-gate.ts +108 -0
- package/packages/chat-room-channeld/src/log.ts +26 -0
- package/packages/chat-room-channeld/src/mock-adapter.ts +206 -0
- package/packages/chat-room-channeld/src/protocol.ts +75 -0
- package/packages/chat-room-channeld/src/published.ts +37 -0
- package/packages/chat-room-channeld/src/rules.ts +127 -0
- package/packages/chat-room-channeld/src/state.ts +502 -0
- package/packages/chat-room-channeld/src/stats.ts +209 -0
- package/plugin.ts +22 -5
- package/server/addressing-routes.ts +130 -0
- package/server/admin-state.ts +13 -13
- package/server/app.ts +95 -0
- package/server/assets/NOTICE.txt +3 -2
- package/server/assets/SHIKI-LICENSE +22 -0
- package/server/assets/base.css +24 -10
- package/server/assets/chat/announcements.js +70 -7
- package/server/assets/chat/doc-preview.js +187 -39
- package/server/assets/chat/events.js +3 -0
- package/server/assets/chat/files.js +46 -4
- package/server/assets/chat/forward.js +69 -0
- package/server/assets/chat/index.js +4 -0
- package/server/assets/chat/integration-editor.js +163 -0
- package/server/assets/chat/integration-values.js +124 -0
- package/server/assets/chat/integrations.js +498 -0
- package/server/assets/chat/locales/de.js +45 -4
- package/server/assets/chat/locales/es.js +45 -4
- package/server/assets/chat/locales/fr.js +45 -4
- package/server/assets/chat/locales/it.js +45 -4
- package/server/assets/chat/locales/ja.js +45 -4
- package/server/assets/chat/locales/ko.js +45 -4
- package/server/assets/chat/markdown-footnotes.js +115 -0
- package/server/assets/chat/markdown.js +46 -43
- package/server/assets/chat/messages.js +5 -5
- package/server/assets/chat/office-preview.js +69 -0
- package/server/assets/chat/palette.js +1 -1
- package/server/assets/chat/panels.js +36 -0
- package/server/assets/chat/recall.js +58 -7
- package/server/assets/chat/receipts.js +15 -3
- package/server/assets/chat/reminders.js +69 -8
- package/server/assets/chat/replies.js +7 -1
- package/server/assets/chat/resource-format.js +11 -0
- package/server/assets/chat/settings.js +30 -2
- package/server/assets/chat/shiki.js +87 -0
- package/server/assets/chat/side-pane.js +9 -3
- package/server/assets/chat/state.js +107 -11
- package/server/assets/chat/system-events.js +32 -0
- package/server/assets/chat/system-messages.js +23 -12
- package/server/assets/chat/task-row.js +0 -6
- package/server/assets/chat/tasks.js +121 -33
- package/server/assets/code-highlight.css +74 -62
- package/server/assets/conversation.css +126 -25
- package/server/assets/doc-preview.css +36 -3
- package/server/assets/files.css +5 -0
- package/server/assets/fluent-icons.svg +2 -0
- package/server/assets/monaco/LICENSE +21 -0
- package/server/assets/monaco/ThirdPartyNotices.txt +448 -0
- package/server/assets/monaco/codicon-jdswhhtn.ttf +0 -0
- package/server/assets/monaco/editor.worker.js +45 -0
- package/server/assets/monaco/integration-rules.css +1 -0
- package/server/assets/monaco/integration-rules.js +1297 -0
- package/server/assets/monaco/json.worker.js +77 -0
- package/server/assets/office/THIRD-PARTY-NOTICES.txt +11 -0
- package/server/assets/office/docx.bundle.js +33 -0
- package/server/assets/office/licenses/docx-preview-LICENSE.txt +201 -0
- package/server/assets/office/licenses/echarts-LICENSE.txt +222 -0
- package/server/assets/office/licenses/jszip-LICENSE.txt +651 -0
- package/server/assets/office/licenses/lodash-LICENSE.txt +47 -0
- package/server/assets/office/licenses/pptx-preview-LICENSE.txt +8 -0
- package/server/assets/office/licenses/tslib-LICENSE.txt +12 -0
- package/server/assets/office/licenses/uuid-LICENSE.txt +9 -0
- package/server/assets/office/licenses/xlsx-LICENSE.txt +201 -0
- package/server/assets/{HIGHLIGHT-LICENSE → office/licenses/zrender-LICENSE.txt} +2 -2
- package/server/assets/office/pptx.bundle.js +104 -0
- package/server/assets/office/xlsx.bundle.js +141 -0
- package/server/assets/recall.css +5 -4
- package/server/assets/responsive.css +52 -8
- package/server/assets/settings.css +73 -1
- package/server/assets/shiki.bundle.js +152 -0
- package/server/assets/tasks.css +57 -7
- package/server/channel-integration.ts +519 -0
- package/server/channel-settings.ts +77 -0
- package/server/channels.ts +557 -0
- package/server/chat-server.ts +33 -558
- package/server/chat.html +195 -22
- package/server/http-server.ts +3 -182
- package/server/resource-routes.ts +16 -16
- package/server/routes/inbox.ts +100 -0
- package/server/routes/pages.ts +83 -0
- package/server/routes/questions.ts +39 -0
- package/server/routes/room-actions.ts +162 -0
- package/server/routes/rooms.ts +160 -0
- package/server/startup.ts +84 -0
- package/server/sw.js +5 -2
- package/server/task-routes.ts +1 -1
- package/skills/chatroom/SKILL.md +1 -1
- package/src/center/center-client.ts +71 -1
- package/src/config/file-config.ts +29 -42
- package/src/platform/http-server.ts +182 -0
- package/src/protocol/addressing.ts +21 -0
- package/src/protocol/config.ts +58 -0
- package/src/protocol/room.ts +51 -0
- package/src/rooms/resources.ts +26 -16
- package/src/rooms/room-service.ts +2 -48
- package/src/rooms/storage.ts +329 -0
- package/src/rooms/tasks.ts +21 -5
- package/src/runtime/v2-plugin.ts +8 -2
- package/src/runtime/watch.ts +4 -3
- package/src/state/pg-database.ts +183 -0
- package/src/state/pg-migrate.ts +175 -0
- package/src/state/pg-sql.mjs +175 -0
- package/src/state/pg-worker.mjs +148 -0
- package/src/state/sqlite-announcements.ts +25 -0
- package/src/state/sqlite-database.ts +121 -0
- package/src/state/sqlite-legacy.ts +90 -0
- package/src/state/sqlite-members.ts +155 -0
- package/src/state/sqlite-messages.ts +288 -0
- package/src/state/sqlite-resources.ts +39 -0
- package/src/state/sqlite-rooms.ts +87 -0
- package/src/state/sqlite-schema.ts +80 -0
- package/src/state/sqlite-state-store.ts +33 -0
- package/src/state/sqlite-state.ts +15 -866
- package/src/state/sqlite-tasks.ts +65 -0
- package/src/state/sqlite-transaction.ts +13 -0
- package/src/state/sqlite.ts +21 -1
- package/src/state/store.ts +13 -3
- package/src/tui/app.mjs +32 -19
- package/src/tui/config.mjs +12 -4
- package/src/tui/http.mjs +16 -2
- package/src/tui/i18n.mjs +38 -0
- package/src/tui/info-app.mjs +50 -51
- package/src/tui/info-content.mjs +79 -44
- package/src/tui/join-app.mjs +9 -9
- package/src/tui/locales/en.mjs +349 -0
- package/src/tui/locales/zh-CN.mjs +349 -0
- package/src/tui/main.mjs +85 -37
- package/src/tui/markdown.mjs +3 -2
- package/src/tui/mentions.mjs +3 -1
- package/src/tui/message-app.mjs +22 -21
- package/src/tui/message-view.mjs +2 -1
- package/src/tui/palette-app.mjs +9 -8
- package/src/tui/palette.mjs +30 -24
- package/src/tui/prefs.mjs +92 -0
- package/src/tui/reminder-app.mjs +18 -17
- package/src/tui/room-settings-app.mjs +30 -28
- package/src/tui/settings-app.mjs +153 -0
- package/src/tui/ui-content.mjs +65 -86
- package/src/tui/ui-help.mjs +73 -0
- package/src/tui/ui-overlay-view.mjs +23 -7
- package/src/tui/ui-suggest.mjs +6 -5
- package/src/tui/ui-theme.mjs +37 -33
- package/src/tui/ui-view.mjs +22 -7
- package/src/tui/ui.mjs +15 -3
- package/src/web/editor.worker.ts +1 -0
- package/src/web/integration-rules-editor.ts +439 -0
- package/src/web/integration-rules.ts +22 -0
- package/src/web/integration-schema.ts +228 -0
- package/src/web/json.worker.ts +1 -0
- package/src/web/office-viewer.ts +221 -0
- package/server/assets/highlight-10.7.3.min.js +0 -1358
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
// name, description and join-policy patches through api.updateRoom.
|
|
4
4
|
import { roomSettingsMarkdown } from "./info-content.mjs";
|
|
5
5
|
import { createInfoPalette } from "./info-app.mjs";
|
|
6
|
+
import { t } from "./i18n.mjs";
|
|
6
7
|
|
|
7
8
|
const errorText = (error) => (error instanceof Error ? error.message : String(error ?? "unknown error"));
|
|
8
|
-
const EDIT_HINT = "r rename · d desc · j policy · Esc close";
|
|
9
9
|
|
|
10
10
|
export function attachRoomSettings(Class) {
|
|
11
11
|
Object.assign(Class.prototype, {
|
|
@@ -13,15 +13,15 @@ export function attachRoomSettings(Class) {
|
|
|
13
13
|
const current = this.state.current;
|
|
14
14
|
if (!current || !this.state.joined) {
|
|
15
15
|
this.state.palette = null;
|
|
16
|
-
this.setStatus("
|
|
16
|
+
this.setStatus(t("info.joinFirst"), "error");
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
this.roomSettings = null;
|
|
20
20
|
const palette = {
|
|
21
|
-
...createInfoPalette("room-settings", "
|
|
21
|
+
...createInfoPalette("room-settings", t("room.title"), `#${current.name}`),
|
|
22
22
|
mode: "detail",
|
|
23
|
-
detail: { title: "
|
|
24
|
-
hint: "
|
|
23
|
+
detail: { title: t("room.title"), markdown: t("common.loading"), kind: "room-settings" },
|
|
24
|
+
hint: t("palette.detailHint"),
|
|
25
25
|
};
|
|
26
26
|
this.state.palette = palette;
|
|
27
27
|
this.touch();
|
|
@@ -39,7 +39,7 @@ export function attachRoomSettings(Class) {
|
|
|
39
39
|
this.roomSettings = { room, canEdit, canDelete };
|
|
40
40
|
palette.roomMeta = room;
|
|
41
41
|
palette.detail = {
|
|
42
|
-
title: "
|
|
42
|
+
title: t("room.title"),
|
|
43
43
|
markdown: roomSettingsMarkdown(room, {
|
|
44
44
|
participant: this.participant,
|
|
45
45
|
sessionID: this.sessionID,
|
|
@@ -48,20 +48,22 @@ export function attachRoomSettings(Class) {
|
|
|
48
48
|
}),
|
|
49
49
|
kind: "room-settings",
|
|
50
50
|
};
|
|
51
|
-
palette.hint = canEdit ?
|
|
51
|
+
palette.hint = canEdit ? t("room.editHint") : t("room.readOnlyHint");
|
|
52
52
|
if (canDelete) {
|
|
53
|
-
palette.hint = canEdit
|
|
54
|
-
? "r rename · d desc · j policy · x delete · Esc close"
|
|
55
|
-
: "x delete room · Esc close";
|
|
53
|
+
palette.hint = canEdit ? t("room.editDeleteHint") : t("room.deleteOnlyHint");
|
|
56
54
|
}
|
|
57
55
|
palette.error = "";
|
|
58
56
|
this.touch();
|
|
59
57
|
} catch (error) {
|
|
60
58
|
if (this.state.palette !== palette) return;
|
|
61
59
|
this.roomSettings = null;
|
|
62
|
-
palette.detail = {
|
|
60
|
+
palette.detail = {
|
|
61
|
+
title: t("room.title"),
|
|
62
|
+
markdown: `${t("room.loadFailed")}\n\n${errorText(error)}`,
|
|
63
|
+
kind: "room-settings",
|
|
64
|
+
};
|
|
63
65
|
palette.error = errorText(error);
|
|
64
|
-
palette.hint = "
|
|
66
|
+
palette.hint = t("room.readOnlyHint");
|
|
65
67
|
this.touch();
|
|
66
68
|
}
|
|
67
69
|
},
|
|
@@ -75,7 +77,7 @@ export function attachRoomSettings(Class) {
|
|
|
75
77
|
|| settings.room.id !== this.state.current?.id
|
|
76
78
|
) {
|
|
77
79
|
if (palette) {
|
|
78
|
-
palette.error = "
|
|
80
|
+
palette.error = t("room.guardEdit");
|
|
79
81
|
this.touch();
|
|
80
82
|
}
|
|
81
83
|
return null;
|
|
@@ -88,9 +90,9 @@ export function attachRoomSettings(Class) {
|
|
|
88
90
|
const palette = this.state.palette;
|
|
89
91
|
if (!settings || !palette) return;
|
|
90
92
|
palette.mode = "prompt";
|
|
91
|
-
palette.prompt = { label: "
|
|
93
|
+
palette.prompt = { label: t("room.namePrompt"), value: settings.room.name, action: "room-name", data: {} };
|
|
92
94
|
palette.error = "";
|
|
93
|
-
palette.hint = "
|
|
95
|
+
palette.hint = t("palette.enterSaveHint");
|
|
94
96
|
this.touch();
|
|
95
97
|
},
|
|
96
98
|
|
|
@@ -100,13 +102,13 @@ export function attachRoomSettings(Class) {
|
|
|
100
102
|
if (!settings || !palette) return;
|
|
101
103
|
palette.mode = "prompt";
|
|
102
104
|
palette.prompt = {
|
|
103
|
-
label: "
|
|
105
|
+
label: t("room.descriptionPrompt"),
|
|
104
106
|
value: settings.room.description ?? "",
|
|
105
107
|
action: "room-description",
|
|
106
108
|
data: {},
|
|
107
109
|
};
|
|
108
110
|
palette.error = "";
|
|
109
|
-
palette.hint = "
|
|
111
|
+
palette.hint = t("room.descriptionHint");
|
|
110
112
|
this.touch();
|
|
111
113
|
},
|
|
112
114
|
|
|
@@ -118,12 +120,12 @@ export function attachRoomSettings(Class) {
|
|
|
118
120
|
palette.mode = "confirm";
|
|
119
121
|
palette.previous = { mode: "detail", hint: palette.hint };
|
|
120
122
|
palette.confirm = {
|
|
121
|
-
text:
|
|
123
|
+
text: t("room.policyConfirm", { policy: next }),
|
|
122
124
|
action: "room-join-policy",
|
|
123
125
|
data: { joinPolicy: next },
|
|
124
126
|
};
|
|
125
127
|
palette.error = "";
|
|
126
|
-
palette.hint = "
|
|
128
|
+
palette.hint = t("room.policyHint");
|
|
127
129
|
this.touch();
|
|
128
130
|
},
|
|
129
131
|
|
|
@@ -138,7 +140,7 @@ export function attachRoomSettings(Class) {
|
|
|
138
140
|
|| palette.kind !== "room-settings"
|
|
139
141
|
) {
|
|
140
142
|
if (palette) {
|
|
141
|
-
palette.error = "
|
|
143
|
+
palette.error = t("room.guardDelete");
|
|
142
144
|
this.touch();
|
|
143
145
|
}
|
|
144
146
|
return;
|
|
@@ -146,12 +148,12 @@ export function attachRoomSettings(Class) {
|
|
|
146
148
|
palette.mode = "confirm";
|
|
147
149
|
palette.previous = { mode: "detail", hint: palette.hint };
|
|
148
150
|
palette.confirm = {
|
|
149
|
-
text:
|
|
151
|
+
text: t("room.deleteConfirm", { name: settings.room.name }),
|
|
150
152
|
action: "room-delete",
|
|
151
153
|
data: { id: settings.room.id, name: settings.room.name },
|
|
152
154
|
};
|
|
153
155
|
palette.error = "";
|
|
154
|
-
palette.hint = "
|
|
156
|
+
palette.hint = t("palette.deleteHint");
|
|
155
157
|
this.touch();
|
|
156
158
|
},
|
|
157
159
|
|
|
@@ -162,21 +164,21 @@ export function attachRoomSettings(Class) {
|
|
|
162
164
|
if (prompt.action === "room-name") {
|
|
163
165
|
const name = String(value ?? "").trim();
|
|
164
166
|
if (!name || Array.from(name).length > 64) {
|
|
165
|
-
palette.error = "room
|
|
167
|
+
palette.error = t("room.nameInvalid");
|
|
166
168
|
this.touch();
|
|
167
169
|
return;
|
|
168
170
|
}
|
|
169
|
-
await this.applyRoomPatch({ name },
|
|
171
|
+
await this.applyRoomPatch({ name }, t("room.renamed", { name }));
|
|
170
172
|
return;
|
|
171
173
|
}
|
|
172
174
|
if (prompt.action === "room-description") {
|
|
173
175
|
const description = String(value ?? "").trim();
|
|
174
176
|
if (Array.from(description).length > 2000) {
|
|
175
|
-
palette.error = "
|
|
177
|
+
palette.error = t("room.descriptionInvalid");
|
|
176
178
|
this.touch();
|
|
177
179
|
return;
|
|
178
180
|
}
|
|
179
|
-
await this.applyRoomPatch({ description }, "
|
|
181
|
+
await this.applyRoomPatch({ description }, t("room.descriptionUpdated"));
|
|
180
182
|
}
|
|
181
183
|
},
|
|
182
184
|
|
|
@@ -229,7 +231,7 @@ export function attachRoomSettings(Class) {
|
|
|
229
231
|
this.state.pending = null;
|
|
230
232
|
this.state.selected = Math.min(this.state.selected, Math.max(0, this.state.rooms.length - 1));
|
|
231
233
|
this.closePalette();
|
|
232
|
-
this.setStatus(
|
|
234
|
+
this.setStatus(t("room.deleted", { name: confirm.data.name }), "success");
|
|
233
235
|
} catch (error) {
|
|
234
236
|
if (this.state.palette === palette) {
|
|
235
237
|
palette.searching = false;
|
|
@@ -242,7 +244,7 @@ export function attachRoomSettings(Class) {
|
|
|
242
244
|
if (confirm.action !== "room-join-policy") return;
|
|
243
245
|
await this.applyRoomPatch(
|
|
244
246
|
{ joinPolicy: confirm.data.joinPolicy },
|
|
245
|
-
|
|
247
|
+
t("room.policySet", { policy: confirm.data.joinPolicy }),
|
|
246
248
|
);
|
|
247
249
|
},
|
|
248
250
|
});
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
// Editable TUI preferences over the shared palette. The old read-only facts
|
|
2
|
+
// stay available as "Connection details" and from the Settings detail page.
|
|
3
|
+
import { createInfoPalette } from "./info-app.mjs";
|
|
4
|
+
import { settingsMarkdown } from "./info-content.mjs";
|
|
5
|
+
import { normalizeLanguage, setLanguage, t } from "./i18n.mjs";
|
|
6
|
+
import { normalizeTheme } from "./prefs.mjs";
|
|
7
|
+
|
|
8
|
+
const errorText = (error) => (error instanceof Error ? error.message : String(error ?? "unknown error"));
|
|
9
|
+
const LANGUAGE_INPUTS = ["en", "zh", "zh-cn", "zh_cn"];
|
|
10
|
+
|
|
11
|
+
function languageLabel(language) {
|
|
12
|
+
return t(normalizeLanguage(language) === "zh-CN" ? "settings.langZh" : "settings.langEn");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function themeLabel(theme) {
|
|
16
|
+
return t(normalizeTheme(theme) === "light" ? "settings.themeLight" : "settings.themeDark");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function factsMarkdown(app) {
|
|
20
|
+
return settingsMarkdown({
|
|
21
|
+
...app.settings,
|
|
22
|
+
participant: app.participant,
|
|
23
|
+
language: app.state.language,
|
|
24
|
+
theme: app.state.theme,
|
|
25
|
+
token: app.token,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function attachSettings(Class) {
|
|
30
|
+
Object.assign(Class.prototype, {
|
|
31
|
+
// Read-only summary kept for the palette "Settings" docs and the e key.
|
|
32
|
+
openSettings() {
|
|
33
|
+
const text = factsMarkdown(this);
|
|
34
|
+
this.state.help = false;
|
|
35
|
+
this.state.palette = {
|
|
36
|
+
...createInfoPalette("settings", t("settings.title"), t("settings.readOnlyHint")),
|
|
37
|
+
mode: "detail",
|
|
38
|
+
detail: { title: t("settings.title"), markdown: text, kind: "settings" },
|
|
39
|
+
hint: t("settings.readOnlyHint"),
|
|
40
|
+
};
|
|
41
|
+
this.touch();
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
openSettingsEditor() {
|
|
45
|
+
this.state.help = false;
|
|
46
|
+
const palette = createInfoPalette("settings", t("settings.title"), t("settings.subtitle"));
|
|
47
|
+
palette.hint = t("settings.editHint");
|
|
48
|
+
palette.items = this.settingsItems();
|
|
49
|
+
palette.selected = 0;
|
|
50
|
+
this.state.palette = palette;
|
|
51
|
+
this.touch();
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
settingsItems() {
|
|
55
|
+
const server = this.prefs.url || this.settings.server || t("common.notSet");
|
|
56
|
+
return [
|
|
57
|
+
{ name: `${t("settings.language")}: ${languageLabel(this.prefs.language)}`, value: "language" },
|
|
58
|
+
{ name: `${t("settings.name")}: ${this.participant}`, value: "name" },
|
|
59
|
+
{ name: `${t("settings.server")}: ${server}`, value: "server" },
|
|
60
|
+
{ name: `${t("settings.theme")}: ${themeLabel(this.prefs.theme)}`, value: "theme" },
|
|
61
|
+
{ name: t("settings.details"), value: "details" },
|
|
62
|
+
];
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
editSetting(item) {
|
|
66
|
+
const palette = this.state.palette;
|
|
67
|
+
if (!palette || !item) return;
|
|
68
|
+
if (item.value === "details") {
|
|
69
|
+
palette.mode = "detail";
|
|
70
|
+
palette.previous = { mode: "info", hint: palette.hint };
|
|
71
|
+
palette.detail = { title: t("settings.title"), markdown: factsMarkdown(this), kind: "settings" };
|
|
72
|
+
palette.hint = t("palette.detailHint");
|
|
73
|
+
this.touch();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const prompts = {
|
|
77
|
+
language: { label: t("settings.languagePrompt"), value: this.prefs.language, action: "settings-language" },
|
|
78
|
+
name: { label: t("settings.namePrompt"), value: this.participant, action: "settings-name" },
|
|
79
|
+
server: { label: t("settings.serverPrompt"), value: this.prefs.url || this.settings.server || "", action: "settings-server" },
|
|
80
|
+
theme: { label: t("settings.themePrompt"), value: this.prefs.theme, action: "settings-theme" },
|
|
81
|
+
};
|
|
82
|
+
const prompt = prompts[item.value];
|
|
83
|
+
if (!prompt) return;
|
|
84
|
+
palette.mode = "prompt";
|
|
85
|
+
palette.prompt = { ...prompt, data: {} };
|
|
86
|
+
palette.error = "";
|
|
87
|
+
palette.hint = t("palette.enterSaveHint");
|
|
88
|
+
this.touch();
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
/** Validate and persist one preference, then apply what can change live. */
|
|
92
|
+
async submitPreferencePrompt(prompt, value) {
|
|
93
|
+
const palette = this.state.palette;
|
|
94
|
+
if (!palette) return;
|
|
95
|
+
const raw = String(value ?? "").trim();
|
|
96
|
+
let patch;
|
|
97
|
+
let status = t("settings.saved");
|
|
98
|
+
if (prompt.action === "settings-language") {
|
|
99
|
+
if (!LANGUAGE_INPUTS.includes(raw.toLowerCase())) {
|
|
100
|
+
palette.error = t("settings.invalidLanguage");
|
|
101
|
+
this.touch();
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
patch = { language: normalizeLanguage(raw) };
|
|
105
|
+
} else if (prompt.action === "settings-theme") {
|
|
106
|
+
const theme = raw.toLowerCase();
|
|
107
|
+
if (theme !== "dark" && theme !== "light") {
|
|
108
|
+
palette.error = t("settings.invalidTheme");
|
|
109
|
+
this.touch();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
patch = { theme };
|
|
113
|
+
} else if (prompt.action === "settings-name") {
|
|
114
|
+
if (!raw || Array.from(raw).length > 64) {
|
|
115
|
+
palette.error = t("settings.invalidName");
|
|
116
|
+
this.touch();
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
patch = { participant: raw };
|
|
120
|
+
} else if (prompt.action === "settings-server") {
|
|
121
|
+
if (!/^https?:\/\/[^/]+/i.test(raw)) {
|
|
122
|
+
palette.error = t("settings.invalidServer");
|
|
123
|
+
this.touch();
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
patch = { url: raw.replace(/\/+$/, "") };
|
|
127
|
+
status = t("settings.restartForServer");
|
|
128
|
+
} else {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const next = { ...this.prefs, ...patch };
|
|
132
|
+
try {
|
|
133
|
+
const saved = this.savePrefs?.(next);
|
|
134
|
+
this.prefs = saved ?? next;
|
|
135
|
+
} catch (error) {
|
|
136
|
+
palette.error = t("settings.saveFailed", { error: errorText(error) });
|
|
137
|
+
this.touch();
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (patch.language) {
|
|
141
|
+
this.state.language = patch.language;
|
|
142
|
+
setLanguage(patch.language);
|
|
143
|
+
}
|
|
144
|
+
if (patch.theme) this.state.theme = patch.theme;
|
|
145
|
+
if (patch.participant) {
|
|
146
|
+
this.participant = patch.participant;
|
|
147
|
+
this.state.participant = patch.participant;
|
|
148
|
+
}
|
|
149
|
+
this.setStatus(status, "success");
|
|
150
|
+
this.openSettingsEditor();
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
}
|
package/src/tui/ui-content.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import { formatMessage, messageStamp, sanitizeText } from "./messages.mjs";
|
|
|
5
5
|
import { addNotice, buildMessageBlock, hashText, markdownStyle } from "./message-view.mjs";
|
|
6
6
|
import { syncMentionHighlights } from "./ui-mentions.mjs";
|
|
7
7
|
import { connectionStyle } from "./ui-theme.mjs";
|
|
8
|
+
import { t } from "./i18n.mjs";
|
|
8
9
|
|
|
9
10
|
const clear = (container) => {
|
|
10
11
|
for (const child of container.getChildren()) {
|
|
@@ -13,14 +14,14 @@ const clear = (container) => {
|
|
|
13
14
|
}
|
|
14
15
|
};
|
|
15
16
|
|
|
16
|
-
const plural = (count, word) => `${count} ${word}${count === 1 ? "" : "s"}`;
|
|
17
|
-
|
|
18
17
|
export function syncLayout(ui) {
|
|
19
18
|
const { renderer, theme } = ui;
|
|
20
19
|
const narrow = renderer.width < 70;
|
|
21
20
|
const showRooms = !narrow;
|
|
21
|
+
const railWidth = renderer.width >= 120 ? 32 : renderer.width >= 100 ? 28 : 24;
|
|
22
22
|
ui.roomsPane.visible = showRooms;
|
|
23
|
-
ui.roomsPane.width = showRooms ?
|
|
23
|
+
ui.roomsPane.width = showRooms ? railWidth : 0;
|
|
24
|
+
ui.roomsFooter.visible = showRooms;
|
|
24
25
|
ui.roomsPane.borderColor = theme.border;
|
|
25
26
|
ui.headerBox.borderColor = theme.border;
|
|
26
27
|
ui.headerBox.paddingX = narrow ? 1 : 2;
|
|
@@ -32,18 +33,24 @@ export function syncLayout(ui) {
|
|
|
32
33
|
ui.textarea.height = ui.composer.height - 2;
|
|
33
34
|
ui.prompt.height = ui.textarea.height;
|
|
34
35
|
ui.statusHints.visible = !narrow;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
ui.paletteBox.
|
|
36
|
+
// Dialogs keep the OpenCode v2 habit: inset, readable measure and a top-third seat.
|
|
37
|
+
const paletteMargin = narrow ? 0 : Math.max(1, Math.floor((renderer.width - 76) / 2));
|
|
38
|
+
ui.paletteBox.left = paletteMargin;
|
|
39
|
+
ui.paletteBox.right = paletteMargin;
|
|
40
|
+
ui.paletteBox.bottom = narrow ? 1 : Math.max(1, Math.floor(renderer.height / 4));
|
|
38
41
|
ui.paletteBox.height = Math.min(16, Math.max(9, Math.floor(renderer.height / 2) + 1));
|
|
39
42
|
ui.helpBox.left = narrow ? 0 : 1;
|
|
40
43
|
ui.helpBox.right = narrow ? 0 : 1;
|
|
41
44
|
ui.helpBox.bottom = narrow ? 0 : 1;
|
|
42
|
-
ui.helpBox.height = Math.min(
|
|
45
|
+
ui.helpBox.height = Math.min(16, Math.max(8, renderer.height - 4));
|
|
43
46
|
ui.helpBody.gap = narrow ? 1 : 4;
|
|
44
47
|
ui.helpBody.paddingX = narrow ? 1 : 2;
|
|
48
|
+
ui.helpBody.paddingY = renderer.height < 22 ? 0 : 1;
|
|
45
49
|
ui.roomsTitle.fg = theme.muted;
|
|
50
|
+
ui.roomsTitle.content = t("rooms.title");
|
|
46
51
|
ui.roomsCount.fg = theme.muted;
|
|
52
|
+
ui.roomsFooter.fg = theme.faint;
|
|
53
|
+
ui.roomsFooter.content = ` ${t("rooms.refreshHint")}`;
|
|
47
54
|
ui.chatMeta.fg = theme.muted;
|
|
48
55
|
}
|
|
49
56
|
|
|
@@ -53,7 +60,7 @@ export function syncHeader(ui, state) {
|
|
|
53
60
|
const left = [bold(fg(theme.accent)("opencode-chat-room"))];
|
|
54
61
|
if (!narrow) {
|
|
55
62
|
left.push(fg(theme.muted)(" · "));
|
|
56
|
-
left.push(fg(theme.muted)(sanitizeText(state.host || "server")));
|
|
63
|
+
left.push(fg(theme.muted)(sanitizeText(state.host || t("common.server"))));
|
|
57
64
|
}
|
|
58
65
|
ui.headerLeft.content = new StyledText(left);
|
|
59
66
|
|
|
@@ -94,7 +101,7 @@ export function updateRoomStyles(ui, state) {
|
|
|
94
101
|
|
|
95
102
|
export function syncRooms(ui, state) {
|
|
96
103
|
const pendingID = state.pending?.roomId;
|
|
97
|
-
const signature = `${ui.theme.mode}|${pendingID ?? ""}|${state.rooms
|
|
104
|
+
const signature = `${ui.theme.mode}|${state.language}|${state.connection}|${pendingID ?? ""}|${state.rooms
|
|
98
105
|
.map((room) => `${room.id}:${room.name}:${room.joined}:${room.participants.length}`)
|
|
99
106
|
.join("|")}`;
|
|
100
107
|
ui.roomsCount.content = state.rooms.length ? String(state.rooms.length) : "";
|
|
@@ -103,13 +110,18 @@ export function syncRooms(ui, state) {
|
|
|
103
110
|
clear(ui.roomContent);
|
|
104
111
|
ui.roomRows.clear();
|
|
105
112
|
if (!state.rooms.length) {
|
|
113
|
+
const emptyLabel = state.connection === "connecting"
|
|
114
|
+
? t("connection.connecting")
|
|
115
|
+
: state.connection === "offline"
|
|
116
|
+
? t("connection.offline")
|
|
117
|
+
: t("rooms.empty");
|
|
106
118
|
ui.roomContent.add(new TextRenderable(ui.renderer, {
|
|
107
119
|
id: "room-empty",
|
|
108
120
|
height: 1,
|
|
109
121
|
wrapMode: "none",
|
|
110
122
|
fg: ui.theme.muted,
|
|
111
123
|
paddingX: 1,
|
|
112
|
-
content:
|
|
124
|
+
content: emptyLabel,
|
|
113
125
|
}));
|
|
114
126
|
}
|
|
115
127
|
for (const [index, room] of state.rooms.entries()) {
|
|
@@ -165,14 +177,15 @@ export function syncMessages(ui, state) {
|
|
|
165
177
|
const messageKey = messages
|
|
166
178
|
.map((message) => `${message.id}:${message.recalledAt ? 1 : 0}:${message.isQuestion ? 1 : 0}:${message.text?.length ?? 0}`)
|
|
167
179
|
.join("|");
|
|
168
|
-
const signature = `${ui.theme.mode}:${current?.id ?? ""}:${joined}:${pending?.roomId ?? ""}:${pending?.message ?? ""}:${highlight ?? ""}:${messageKey}`;
|
|
180
|
+
const signature = `${ui.theme.mode}:${state.language}:${current?.id ?? ""}:${joined}:${pending?.roomId ?? ""}:${pending?.message ?? ""}:${highlight ?? ""}:${messageKey}`;
|
|
169
181
|
|
|
170
182
|
if (current) {
|
|
171
183
|
ui.chatTitle.content = new StyledText([bold(fg(ui.theme.accent)(`# ${sanitizeText(current.name)}`))]);
|
|
172
|
-
|
|
184
|
+
const count = current.participants.length;
|
|
185
|
+
ui.chatMeta.content = t(count === 1 ? "common.member" : "common.members", { count });
|
|
173
186
|
ui.chatMeta.fg = ui.theme.muted;
|
|
174
187
|
} else {
|
|
175
|
-
ui.chatTitle.content = new StyledText([fg(ui.theme.muted)("
|
|
188
|
+
ui.chatTitle.content = new StyledText([fg(ui.theme.muted)(t("chat.noRoom"))]);
|
|
176
189
|
ui.chatMeta.content = "";
|
|
177
190
|
}
|
|
178
191
|
|
|
@@ -188,19 +201,19 @@ export function syncMessages(ui, state) {
|
|
|
188
201
|
clear(ui.messageContent);
|
|
189
202
|
ui.messageBlocks = [];
|
|
190
203
|
addNotice(ui, "pending", sanitizeText(pending.message), ui.theme.warning);
|
|
191
|
-
addNotice(ui, "pending-wait", "
|
|
204
|
+
addNotice(ui, "pending-wait", t("chat.waitingApproval"), ui.theme.muted);
|
|
192
205
|
} else if (!current) {
|
|
193
206
|
clear(ui.messageContent);
|
|
194
207
|
ui.messageBlocks = [];
|
|
195
|
-
addNotice(ui, "empty", "
|
|
208
|
+
addNotice(ui, "empty", t("chat.selectRoom"), ui.theme.muted);
|
|
196
209
|
} else if (!joined) {
|
|
197
210
|
clear(ui.messageContent);
|
|
198
211
|
ui.messageBlocks = [];
|
|
199
|
-
addNotice(ui, "empty", "
|
|
212
|
+
addNotice(ui, "empty", t("chat.notJoined"), ui.theme.muted);
|
|
200
213
|
} else if (!messages.length) {
|
|
201
214
|
clear(ui.messageContent);
|
|
202
215
|
ui.messageBlocks = [];
|
|
203
|
-
addNotice(ui, "empty", "
|
|
216
|
+
addNotice(ui, "empty", t("chat.noMessages"), ui.theme.muted);
|
|
204
217
|
} else {
|
|
205
218
|
if (!ui.messageBlocks.length && ui.messageContent.getChildren().length) clear(ui.messageContent);
|
|
206
219
|
const nextBlocks = [];
|
|
@@ -253,6 +266,7 @@ export function syncMessages(ui, state) {
|
|
|
253
266
|
|
|
254
267
|
export function syncComposer(ui, state) {
|
|
255
268
|
const draft = String(state.draft ?? "");
|
|
269
|
+
ui.textarea.placeholder = t("chat.composerPlaceholder");
|
|
256
270
|
ui.textarea.placeholderColor = ui.theme.faint;
|
|
257
271
|
ui.textarea.textColor = ui.theme.text;
|
|
258
272
|
ui.textarea.focusedTextColor = ui.theme.text;
|
|
@@ -276,18 +290,20 @@ export function syncComposer(ui, state) {
|
|
|
276
290
|
|
|
277
291
|
export function syncStatus(ui, state) {
|
|
278
292
|
const { theme } = ui;
|
|
279
|
-
const
|
|
293
|
+
const connection = connectionStyle(theme, state.connection);
|
|
294
|
+
const text = state.status
|
|
295
|
+
|| (state.connection === "online" ? t("status.ready") : `${connection.dot} ${connection.label}`);
|
|
280
296
|
ui.statusLine.content = sanitizeText(text);
|
|
281
297
|
ui.statusLine.fg = state.statusKind === "error"
|
|
282
298
|
? theme.error
|
|
283
299
|
: state.statusKind === "success"
|
|
284
300
|
? theme.success
|
|
285
301
|
: theme.muted;
|
|
286
|
-
const
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
ui.statusHints.fg = theme.
|
|
302
|
+
const hints = state.focus === "composer"
|
|
303
|
+
? t("status.composerHints")
|
|
304
|
+
: t("status.roomHints");
|
|
305
|
+
ui.statusHints.content = ui.renderer.width < 70 ? t("status.hintsShort") : hints;
|
|
306
|
+
ui.statusHints.fg = theme.faint;
|
|
291
307
|
}
|
|
292
308
|
|
|
293
309
|
export function syncFocus(ui, state) {
|
|
@@ -343,20 +359,20 @@ export function syncPalette(ui, state) {
|
|
|
343
359
|
ui.paletteList.selectedBackgroundColor = theme.selectedBg;
|
|
344
360
|
ui.paletteList.selectedTextColor = theme.selectedFg;
|
|
345
361
|
|
|
346
|
-
const scope = palette.scope === "all" ? "
|
|
362
|
+
const scope = palette.scope === "all" ? t("palette.scopeAll") : t("palette.scopeRoom");
|
|
347
363
|
const defaultTitle = mode === "prompt"
|
|
348
|
-
? "
|
|
364
|
+
? t("palette.newRoom")
|
|
349
365
|
: mode === "search"
|
|
350
|
-
? "
|
|
351
|
-
: "
|
|
352
|
-
ui.paletteTitle.content = palette.title || defaultTitle;
|
|
366
|
+
? t("palette.searchMessages")
|
|
367
|
+
: t("palette.title");
|
|
368
|
+
ui.paletteTitle.content = new StyledText([bold(fg(theme.text)(palette.title || defaultTitle))]);
|
|
353
369
|
ui.paletteScope.content = palette.subtitle
|
|
354
|
-
|| (mode === "prompt" ? "create" : mode === "search" ? scope : "commands");
|
|
370
|
+
|| (mode === "prompt" ? t("palette.create") : mode === "search" ? scope : t("palette.commands"));
|
|
355
371
|
ui.paletteInput.placeholder = mode === "prompt"
|
|
356
|
-
? palette.prompt?.label || "
|
|
372
|
+
? palette.prompt?.label || t("palette.valuePlaceholder")
|
|
357
373
|
: mode === "search"
|
|
358
|
-
? "
|
|
359
|
-
: "
|
|
374
|
+
? t("palette.searchPlaceholder")
|
|
375
|
+
: t("palette.commandPlaceholder");
|
|
360
376
|
|
|
361
377
|
const value = mode === "prompt" ? palette.prompt?.value ?? "" : palette.query ?? "";
|
|
362
378
|
if (ui.paletteInput.value !== value) {
|
|
@@ -373,9 +389,9 @@ export function syncPalette(ui, state) {
|
|
|
373
389
|
options = ui.app.paletteCommands().map((command) => ({ name: command.label, description: "", value: command.id }));
|
|
374
390
|
} else if (mode === "search") {
|
|
375
391
|
options = !String(palette.query ?? "").trim()
|
|
376
|
-
? [{ name: "
|
|
392
|
+
? [{ name: t("palette.searchPlaceholder"), description: "", value: "" }]
|
|
377
393
|
: !palette.results.length
|
|
378
|
-
? [{ name: palette.searching ? "
|
|
394
|
+
? [{ name: palette.searching ? t("palette.searching") : t("palette.noMatches"), description: "", value: "" }]
|
|
379
395
|
: palette.results.map((result) => {
|
|
380
396
|
const info = formatMessage(result.message, null);
|
|
381
397
|
return {
|
|
@@ -386,17 +402,17 @@ export function syncPalette(ui, state) {
|
|
|
386
402
|
});
|
|
387
403
|
} else if (mode === "info") {
|
|
388
404
|
options = palette.loading
|
|
389
|
-
? [{ name: "
|
|
405
|
+
? [{ name: t("common.loading"), description: "", value: "" }]
|
|
390
406
|
: palette.items.length
|
|
391
407
|
? palette.items.map((item) => ({ name: item.name, description: "", value: item.value }))
|
|
392
|
-
: [{ name: palette.error ? "
|
|
408
|
+
: [{ name: palette.error ? t("palette.unavailable") : t("palette.nothing"), description: "", value: "" }];
|
|
393
409
|
}
|
|
394
410
|
ui.paletteList.options = options;
|
|
395
411
|
if (isList) ui.paletteList.setSelectedIndex(Math.min(palette.selected ?? 0, Math.max(0, options.length - 1)));
|
|
396
412
|
|
|
397
413
|
let desiredHeight;
|
|
398
414
|
if (mode === "commands" || mode === "info") {
|
|
399
|
-
desiredHeight = Math.min(ui.renderer.height - 2, Math.max(9, options.length +
|
|
415
|
+
desiredHeight = Math.min(16, ui.renderer.height - 2, Math.max(9, options.length + 4));
|
|
400
416
|
} else if (isDetail) {
|
|
401
417
|
desiredHeight = Math.min(ui.renderer.height - 2, Math.max(12, Math.floor(ui.renderer.height * 0.8)));
|
|
402
418
|
} else if (isConfirm) {
|
|
@@ -404,12 +420,14 @@ export function syncPalette(ui, state) {
|
|
|
404
420
|
} else {
|
|
405
421
|
desiredHeight = Math.min(16, Math.max(9, Math.floor(ui.renderer.height / 2) + 1));
|
|
406
422
|
}
|
|
423
|
+
desiredHeight = Math.max(4, Math.min(desiredHeight, ui.renderer.height - Math.max(1, Math.floor(ui.renderer.height / 4)) - 1));
|
|
424
|
+
paletteBox.bottom = Math.max(1, ui.renderer.height - Math.max(1, Math.floor(ui.renderer.height / 4)) - desiredHeight);
|
|
407
425
|
if (paletteBox.height !== desiredHeight) paletteBox.height = desiredHeight;
|
|
408
426
|
|
|
409
427
|
ui.paletteDetailMarkdown.syntaxStyle = markdownStyle(ui);
|
|
410
428
|
ui.paletteDetailMarkdown.fg = theme.text;
|
|
411
429
|
if (isDetail) {
|
|
412
|
-
const signature = `${theme.mode}:${palette.detail?.title}:${palette.detail?.markdown}`;
|
|
430
|
+
const signature = `${theme.mode}:${state.language}:${palette.detail?.title}:${palette.detail?.markdown}`;
|
|
413
431
|
if (signature !== ui.detailSignature) {
|
|
414
432
|
ui.detailSignature = signature;
|
|
415
433
|
ui.paletteDetailMarkdown.content = palette.detail?.markdown ?? "";
|
|
@@ -423,56 +441,17 @@ export function syncPalette(ui, state) {
|
|
|
423
441
|
|
|
424
442
|
const footer = palette.error
|
|
425
443
|
|| (mode === "prompt"
|
|
426
|
-
? palette.hint || "
|
|
444
|
+
? palette.hint || t("palette.promptHint")
|
|
427
445
|
: mode === "search"
|
|
428
|
-
?
|
|
446
|
+
? t("palette.searchHint", {
|
|
447
|
+
scope: palette.scope === "all" ? t("palette.scopeRoom") : t("palette.scopeAll"),
|
|
448
|
+
searching: palette.searching ? t("palette.searchingSuffix") : "",
|
|
449
|
+
})
|
|
429
450
|
: mode === "detail"
|
|
430
|
-
? palette.hint || "
|
|
451
|
+
? palette.hint || t("palette.detailHint")
|
|
431
452
|
: mode === "confirm"
|
|
432
|
-
? palette.hint || "
|
|
433
|
-
: palette.hint || (mode === "info" ? "
|
|
434
|
-
ui.paletteHint.content = ` ${sanitizeText(footer)}${palette.searching && mode !== "search" ?
|
|
453
|
+
? palette.hint || t("palette.confirmHint")
|
|
454
|
+
: palette.hint || (mode === "info" ? t("palette.listHint") : t("palette.runHint")));
|
|
455
|
+
ui.paletteHint.content = ` ${sanitizeText(footer)}${palette.searching && mode !== "search" ? ` · ${t("palette.working")}` : ""}`;
|
|
435
456
|
ui.paletteHint.fg = palette.error ? theme.error : theme.muted;
|
|
436
457
|
}
|
|
437
|
-
|
|
438
|
-
function shortcutChunks(title, rows, theme) {
|
|
439
|
-
const chunks = [bold(fg(theme.accent)(`${title}\n`))];
|
|
440
|
-
for (const [key, label] of rows) {
|
|
441
|
-
chunks.push(fg(theme.accent)(key.padEnd(12)));
|
|
442
|
-
chunks.push(fg(theme.text)(`${label}\n`));
|
|
443
|
-
}
|
|
444
|
-
return chunks;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
export function syncHelp(ui, state) {
|
|
448
|
-
const show = Boolean(state.help) && !state.palette;
|
|
449
|
-
ui.helpBox.visible = show;
|
|
450
|
-
if (!show) return;
|
|
451
|
-
ui.helpBox.borderColor = ui.theme.border;
|
|
452
|
-
ui.helpBox.backgroundColor = ui.theme.surface;
|
|
453
|
-
ui.helpBar.backgroundColor = ui.theme.raised;
|
|
454
|
-
ui.helpTitle.fg = ui.theme.text;
|
|
455
|
-
ui.helpClose.fg = ui.theme.muted;
|
|
456
|
-
ui.helpFooter.fg = ui.theme.muted;
|
|
457
|
-
const signature = ui.theme.mode;
|
|
458
|
-
if (signature === ui.helpSignature) return;
|
|
459
|
-
ui.helpSignature = signature;
|
|
460
|
-
ui.helpLeft.content = new StyledText(shortcutChunks("Navigation", [
|
|
461
|
-
["↑ / ↓", "select room"],
|
|
462
|
-
["Enter", "open / join"],
|
|
463
|
-
["Tab", "focus composer"],
|
|
464
|
-
["PgUp / PgDn", "scroll messages"],
|
|
465
|
-
["Alt+Home", "first message"],
|
|
466
|
-
["Alt+End", "last message"],
|
|
467
|
-
], ui.theme));
|
|
468
|
-
ui.helpRight.content = new StyledText(shortcutChunks("Composer", [
|
|
469
|
-
["Enter", "send message"],
|
|
470
|
-
["Ctrl+J", "insert newline"],
|
|
471
|
-
["Esc", "clear / blur"],
|
|
472
|
-
["/", "inline commands"],
|
|
473
|
-
["@", "mention members"],
|
|
474
|
-
["Alt+Space", "palette / search"],
|
|
475
|
-
["Ctrl+R", "refresh rooms"],
|
|
476
|
-
["Ctrl+C", "quit"],
|
|
477
|
-
], ui.theme));
|
|
478
|
-
}
|