@alexsun-top/opencode-chat-room 0.6.8 → 0.6.9
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 +9 -0
- package/README.md +3 -3
- package/README.zh-CN.md +3 -3
- package/package.json +1 -1
- package/server/assets/base.css +2 -8
- package/server/assets/chat/admin.js +1 -1
- package/server/assets/chat/announcements.js +1 -1
- package/server/assets/chat/confirm-dialog.js +28 -0
- package/server/assets/chat/events.js +9 -1
- package/server/assets/chat/index.js +2 -0
- package/server/assets/chat/markdown.js +1 -1
- package/server/assets/chat/members.js +1 -1
- package/server/assets/chat/recall.js +5 -17
- package/server/assets/chat/reminders.js +1 -1
- package/server/assets/chat/rooms.js +1 -1
- package/server/assets/chat/shortcuts.js +22 -236
- package/server/assets/chat/state.js +13 -19
- package/server/assets/chat/system-messages.js +1 -0
- package/server/assets/responsive.css +3 -0
- package/server/chat.html +17 -24
- package/skills/chatroom/SKILL.md +1 -1
- package/src/state/sqlite-state.ts +3 -2
- package/src/tests/announcement-board.ts +3 -2
- package/server/assets/keyboard-hints.css +0 -51
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.9 — 2026-11-18
|
|
4
|
+
|
|
5
|
+
- Remove the automatic keyboard-hint tags on controls, the rail shortcut hint, and the `?` shortcut. Press Alt+/ to open the shortcut sheet, which lists only shortcuts that exist. Alt+Home and Alt+End jump to the oldest or latest loaded message without requesting older history.
|
|
6
|
+
- Replace native browser confirmation dialogs with an in-app dialog for room deletion, member removal, message recall, reminder and announcement deletion, file deletion, and disabling join approval.
|
|
7
|
+
- Block recall of system notices in both the web client and the server.
|
|
8
|
+
- Localize join-approval system messages with natural English and Chinese wording.
|
|
9
|
+
- Use a responsive two-column join page and clear a stale token warning after the token is saved.
|
|
10
|
+
- Align the Codex and dsh plugins at 0.1.1; they inherit the central-server fixes.
|
|
11
|
+
|
|
3
12
|
## 0.6.8 — 2026-11-18
|
|
4
13
|
|
|
5
14
|
- Create protected group rooms that require approval to join. Human owners and administrators approve people and Agents; the designated management Agent can approve Agent requests only. Pending applicants are not members and cannot send, poll, or receive room delivery until approved.
|
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ When upgrading an existing install, quit OpenCode first or use `opencode plugin
|
|
|
24
24
|
On a machine reachable by the other devices, start the server. Replace `your-password` with a shared password:
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
bunx @alexsun-top/opencode-chat-room@0.6.
|
|
27
|
+
bunx @alexsun-top/opencode-chat-room@0.6.9 --host 0.0.0.0 --port 4399 --token 'your-password'
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
On each machine running OpenCode, set the server address and the same password, then start OpenCode from that environment:
|
|
@@ -49,7 +49,7 @@ docker run --rm -p 4399:4399 -v chat-room-data:/data \
|
|
|
49
49
|
ghcr.io/agentsyaml/opencode-chat-room:latest
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
Pin a release with `ghcr.io/agentsyaml/opencode-chat-room:v0.6.
|
|
52
|
+
Pin a release with `ghcr.io/agentsyaml/opencode-chat-room:v0.6.9`. Rooms, messages and receipts live in the `/data` volume; keep it mounted across upgrades. If you bind-mount a host directory instead of a named volume, make it writable by uid `10001`.
|
|
53
53
|
|
|
54
54
|
## 3. Start chatting
|
|
55
55
|
|
|
@@ -58,7 +58,7 @@ Pin a release with `ghcr.io/agentsyaml/opencode-chat-room:v0.6.8`. Rooms, messag
|
|
|
58
58
|
- Use Reply to respond to a message. Mark a message as a question when you need an answer.
|
|
59
59
|
- Use the room's reminder button for one-time or recurring reminders. Times default to the server's time zone.
|
|
60
60
|
- Reminder text supports `{{time}}`, `{{initiator}}`, and `{{room}}`.
|
|
61
|
-
- Press
|
|
61
|
+
- Press Alt+/ for the keyboard shortcut sheet. Alt+Home/Alt+End jump to the oldest/latest message, and PageUp/PageDown scrolls the conversation while you type.
|
|
62
62
|
- Attach files, drag them in, or paste images. The default limit is 500 MiB per file.
|
|
63
63
|
- Agents can recall a message by ID; the original stays available to current members.
|
|
64
64
|
- Agents can use the `room` tool's `read_resource` action to save an attachment to a temporary file before opening it.
|
package/README.zh-CN.md
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
在一台可被其他设备访问的机器上启动服务器,把 `换成自己的密码` 换成共享密码:
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
bunx @alexsun-top/opencode-chat-room@0.6.
|
|
27
|
+
bunx @alexsun-top/opencode-chat-room@0.6.9 --host 0.0.0.0 --port 4399 --token '换成自己的密码'
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
在每台运行 OpenCode 的机器上设置服务器地址和相同密码,再从该环境启动 OpenCode:
|
|
@@ -49,7 +49,7 @@ docker run --rm -p 4399:4399 -v chat-room-data:/data \
|
|
|
49
49
|
ghcr.io/agentsyaml/opencode-chat-room:latest
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
用 `ghcr.io/agentsyaml/opencode-chat-room:v0.6.
|
|
52
|
+
用 `ghcr.io/agentsyaml/opencode-chat-room:v0.6.9` 可以固定到具体版本。房间、消息和回执都保存在 `/data` 卷里,升级时保留该卷即可。如果改用宿主目录做挂载,需要让该目录对 uid `10001` 可写。
|
|
53
53
|
|
|
54
54
|
## 3. 开始聊天
|
|
55
55
|
|
|
@@ -58,7 +58,7 @@ docker run --rm -p 4399:4399 -v chat-room-data:/data \
|
|
|
58
58
|
- 回复消息时点击回复;需要对方回答的问题可标记为「问题」。
|
|
59
59
|
- 点击房间里的提醒按钮,可创建一次性或周期提醒。默认使用服务器时区。
|
|
60
60
|
- 提醒正文支持 `{{time}}`、`{{initiator}}`、`{{room}}` 模板变量。
|
|
61
|
-
- 按
|
|
61
|
+
- 按 Alt+/ 打开快捷键面板,Alt+Home/Alt+End 跳到最早/最新消息,输入时用 PageUp/PageDown 滚动会话。
|
|
62
62
|
- 点击附件按钮、拖入文件或粘贴图片即可分享;默认单文件上限为 500 MiB。
|
|
63
63
|
- Agent 可按消息 ID 撤回;当前成员仍可查看原文。
|
|
64
64
|
- Agent 收到附件后可通过 `room` 的 `read_resource` 操作保存到临时文件,再打开查看。
|
package/package.json
CHANGED
package/server/assets/base.css
CHANGED
|
@@ -95,7 +95,8 @@
|
|
|
95
95
|
.join-head .wordmark-row { grid-column: 1; grid-row: 1; align-self: center; }
|
|
96
96
|
.join-head .locale-control { grid-column: 2; grid-row: 1; margin: 0; }
|
|
97
97
|
.join-head .tagline { grid-column: 1 / -1; grid-row: 2; max-width: 62ch; margin: 0; }
|
|
98
|
-
.join-entries { display: grid; grid-template-columns: repeat(
|
|
98
|
+
.join-entries { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
|
|
99
|
+
#createForm { grid-column: 1 / -1; }
|
|
99
100
|
#joinError { grid-column: 1 / -1; }
|
|
100
101
|
.room-list { margin-top: 0; }
|
|
101
102
|
.entry-card.identity-card { display: grid; align-content: start; margin-bottom: 0; background: var(--surface); border-color: var(--line); }
|
|
@@ -316,12 +317,9 @@
|
|
|
316
317
|
white-space: nowrap;
|
|
317
318
|
box-shadow: 0 1px 0 color-mix(in srgb, var(--line) 55%, transparent);
|
|
318
319
|
}
|
|
319
|
-
.keys-hint:hover .keys-key { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
|
|
320
320
|
.keys-combo { display: inline-flex; align-items: center; gap: 3px; flex: none; }
|
|
321
321
|
.keys-sep { color: var(--ink-3); font-size: 10px; }
|
|
322
322
|
.composer-keys { margin-right: auto; }
|
|
323
|
-
.rail-key-hint { display: flex; align-items: center; gap: 7px; margin: 7px 8px 0; color: var(--ink-3); font-size: 10.5px; line-height: 1.4; }
|
|
324
|
-
.rail-key-hint .keys-key { height: 18px; min-width: 18px; font-size: 10px; }
|
|
325
323
|
|
|
326
324
|
.keys-dialog {
|
|
327
325
|
width: min(520px, calc(100vw - 28px));
|
|
@@ -340,8 +338,6 @@
|
|
|
340
338
|
.keys-dialog-head h2 { margin: 0; font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
|
|
341
339
|
.keys-dialog-head h2:focus { outline: none; }
|
|
342
340
|
.keys-lead { margin: 6px 0 18px; color: var(--ink-2); font-size: 13px; line-height: 1.55; }
|
|
343
|
-
.keys-sheet-actions { margin: -6px 0 16px; }
|
|
344
|
-
.keys-sheet-actions .btn { margin: 0; }
|
|
345
341
|
.keys-section + .keys-section { margin-top: 16px; }
|
|
346
342
|
.keys-section h3 { margin: 0 0 7px; color: var(--ink-3); font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
|
|
347
343
|
.keys-list { display: grid; gap: 2px; list-style: none; margin: 0; padding: 0; }
|
|
@@ -354,8 +350,6 @@
|
|
|
354
350
|
.keys-dialog { padding: 18px; }
|
|
355
351
|
.keys-dialog-head h2 { font-size: 21px; }
|
|
356
352
|
}
|
|
357
|
-
@media (max-width: 760px) { .rail-key-hint { display: none; } }
|
|
358
|
-
|
|
359
353
|
.room-list { margin-top: 0; }
|
|
360
354
|
.room-list h2 { margin: 0 0 8px; font-size: 13px; font-weight: 600; letter-spacing: .06em; color: var(--ink-2); }
|
|
361
355
|
#roomList { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 12px; list-style: none; margin: 0; padding: 0; max-height: 220px; overflow-y: auto; }
|
|
@@ -100,7 +100,7 @@ export function initAdmin(app) {
|
|
|
100
100
|
const owner = isOwner(), nextOwner = $("#editRoomOwner").value;
|
|
101
101
|
const checkedAdmins = [...$("#editRoomAdminIds").querySelectorAll("input:checked")].map((input) => input.value);
|
|
102
102
|
const joinPolicy = $("#editRoomJoinPolicy").checked ? "approval" : "open";
|
|
103
|
-
if (joinPolicy !== (room.joinPolicy ?? "open") && joinPolicy === "open" && !
|
|
103
|
+
if (joinPolicy !== (room.joinPolicy ?? "open") && joinPolicy === "open" && !(await app.confirmAction(app.t("joinPolicyOpenConfirm")))) return;
|
|
104
104
|
const body = {
|
|
105
105
|
sessionID: LS.sessionID, name, description: $("#editRoomDescription").value.trim(),
|
|
106
106
|
...(joinPolicy !== (room.joinPolicy ?? "open") ? { joinPolicy } : {}),
|
|
@@ -119,7 +119,7 @@ export function initAnnouncements(app) {
|
|
|
119
119
|
$("#btnNewAnnouncement").addEventListener("click", () => openEditor(null));
|
|
120
120
|
$("#btnDeleteAnnouncement").addEventListener("click", async () => {
|
|
121
121
|
const id = roomId(), name = selected;
|
|
122
|
-
if (!id || !name || !
|
|
122
|
+
if (!id || !name || !(await app.confirmAction(app.t("announcementDeleteConfirm", { name })))) return;
|
|
123
123
|
const context = roomGeneration, captured = editorSnapshot();
|
|
124
124
|
try {
|
|
125
125
|
await app.api(`/rooms/${encodeURIComponent(id)}/announcements/${encodeURIComponent(name)}`, { method: "DELETE", body: JSON.stringify({ sessionID: LS.sessionID }) });
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// One shared confirmation dialog replaces the browser's native confirmation
|
|
2
|
+
// window, so a destructive action stays inside the page.
|
|
3
|
+
export function initConfirmDialog(app) {
|
|
4
|
+
const dialog = app.$("#confirmDialog"), message = app.$("#confirmMessage");
|
|
5
|
+
const accept = app.$("#btnAcceptConfirm"), cancel = app.$("#btnCancelConfirm");
|
|
6
|
+
let pending = null;
|
|
7
|
+
const settle = (value) => { const resolve = pending; pending = null; resolve?.(value); };
|
|
8
|
+
function close(value) { settle(value); dialog.close(); }
|
|
9
|
+
|
|
10
|
+
app.confirmAction = (text) => {
|
|
11
|
+
// One dialog at a time: a newer request dismisses the open one as cancelled.
|
|
12
|
+
if (dialog.open) close(false);
|
|
13
|
+
message.textContent = text;
|
|
14
|
+
dialog.showModal();
|
|
15
|
+
cancel.focus();
|
|
16
|
+
return new Promise((resolve) => { pending = resolve; });
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
accept.addEventListener("click", () => close(true));
|
|
20
|
+
cancel.addEventListener("click", () => close(false));
|
|
21
|
+
dialog.addEventListener("cancel", (event) => { event.preventDefault(); close(false); });
|
|
22
|
+
dialog.addEventListener("click", (event) => { if (event.target === dialog) close(false); });
|
|
23
|
+
dialog.addEventListener("close", () => {
|
|
24
|
+
// A close from outside the buttons still settles the promise; a re-open in the
|
|
25
|
+
// same task leaves the dialog open, so the stale event must not clear it.
|
|
26
|
+
if (!dialog.open) { settle(false); message.textContent = ""; }
|
|
27
|
+
});
|
|
28
|
+
}
|
|
@@ -308,7 +308,7 @@ export function initEvents(app) {
|
|
|
308
308
|
app.queueReceiptRefresh();
|
|
309
309
|
if (!adjusting) app.queueReceiptObservation();
|
|
310
310
|
app.updateJump();
|
|
311
|
-
if (!adjusting && thread.scrollTop < 160) void app.loadOlderHistory?.();
|
|
311
|
+
if (!adjusting && !app.state.jumpToLoadedTop && thread.scrollTop < 160) void app.loadOlderHistory?.();
|
|
312
312
|
});
|
|
313
313
|
document.addEventListener("visibilitychange", () => {
|
|
314
314
|
if (!document.hidden) {
|
|
@@ -334,6 +334,10 @@ export function initEvents(app) {
|
|
|
334
334
|
document.querySelector(`[data-token-save="${selector.slice(1)}"]`).click();
|
|
335
335
|
}
|
|
336
336
|
});
|
|
337
|
+
$(selector).addEventListener("input", () => {
|
|
338
|
+
app.hideJoinError();
|
|
339
|
+
app.hideSendError();
|
|
340
|
+
});
|
|
337
341
|
});
|
|
338
342
|
|
|
339
343
|
document.addEventListener("click", (event) => {
|
|
@@ -387,6 +391,10 @@ function saveAccessToken(button, app) {
|
|
|
387
391
|
let persistent = false;
|
|
388
392
|
try { persistent = localStorage.getItem("chat.token") === LS.token; } catch { /* Memory fallback is tab-scoped. */ }
|
|
389
393
|
app.flash(button, persistent ? "saved" : "savedMemory");
|
|
394
|
+
if (LS.token) {
|
|
395
|
+
app.hideJoinError();
|
|
396
|
+
app.hideSendError();
|
|
397
|
+
}
|
|
390
398
|
// The key prompt is a one-time visit: a stored key gets out of the way again.
|
|
391
399
|
if (LS.token) document.getElementById("tokenBox")?.close();
|
|
392
400
|
void app.refreshRoomList();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { app } from "./state.js";
|
|
2
|
+
import { initConfirmDialog } from "./confirm-dialog.js";
|
|
2
3
|
import { initMentions } from "./mentions.js";
|
|
3
4
|
import { initMessages } from "./messages.js";
|
|
4
5
|
import { initMembers } from "./members.js";
|
|
@@ -19,6 +20,7 @@ import { initPwa } from "./pwa.js";
|
|
|
19
20
|
import { initInstallPrompt } from "./install-prompt.js";
|
|
20
21
|
import { initShortcuts } from "./shortcuts.js";
|
|
21
22
|
|
|
23
|
+
initConfirmDialog(app);
|
|
22
24
|
initMentions(app);
|
|
23
25
|
initMessages(app);
|
|
24
26
|
initAttachments(app);
|
|
@@ -202,7 +202,7 @@ function resourceSplit(app, resource, download, item) {
|
|
|
202
202
|
return group;
|
|
203
203
|
}
|
|
204
204
|
async function deleteResource(card, roomId, id, resource, app, status, button) {
|
|
205
|
-
if (!
|
|
205
|
+
if (!(await app.confirmAction(app.t("resourceDeleteConfirm", { name: resource.name })))) return;
|
|
206
206
|
button.disabled = true;
|
|
207
207
|
status.textContent = app.t("resourceDeleting");
|
|
208
208
|
try {
|
|
@@ -149,7 +149,7 @@ export function initMembers(app) {
|
|
|
149
149
|
};
|
|
150
150
|
|
|
151
151
|
app.kickMember = async (member) => {
|
|
152
|
-
if (!
|
|
152
|
+
if (!(await app.confirmAction(app.t("kickConfirm", { name: member.name })))) return;
|
|
153
153
|
try {
|
|
154
154
|
await app.api(`/rooms/${encodeURIComponent(app.state.room.id)}/kick`, {
|
|
155
155
|
method: "POST",
|
|
@@ -16,8 +16,7 @@ export function initRecall(app) {
|
|
|
16
16
|
const self = app.state.memberSessions.get(app.state.room?.id)?.find((member) => member.sessionID === LS.sessionID);
|
|
17
17
|
// Member data may not have loaded yet; the server re-checks the real membership.
|
|
18
18
|
const humanAdmin = (!self || self.type === "human") && isRoomAdmin(app);
|
|
19
|
-
|
|
20
|
-
if (message.senderId === "system") return app.state.room?.kind !== "direct" && humanAdmin;
|
|
19
|
+
if (message.senderId === "system") return false;
|
|
21
20
|
if (isOwnMessage(message, app)) return true;
|
|
22
21
|
if (app.state.room?.kind === "direct") return false;
|
|
23
22
|
return humanAdmin;
|
|
@@ -27,10 +26,7 @@ export function initRecall(app) {
|
|
|
27
26
|
const row = base(message, live);
|
|
28
27
|
if (message.recalledAt) return renderTombstone(row, message, app, false);
|
|
29
28
|
if (!app.canRecallMessage(message)) return row;
|
|
30
|
-
|
|
31
|
-
row.classList.add("has-recall");
|
|
32
|
-
row.append(systemRecallButton(message, app));
|
|
33
|
-
} else row.querySelector(".message-actions")?.append(recallButton(message, app));
|
|
29
|
+
row.querySelector(".message-actions")?.append(recallButton(message, app));
|
|
34
30
|
return row;
|
|
35
31
|
};
|
|
36
32
|
|
|
@@ -141,22 +137,14 @@ function recallButton(message, app) {
|
|
|
141
137
|
return button;
|
|
142
138
|
}
|
|
143
139
|
|
|
144
|
-
|
|
145
|
-
const button = recallButton(message, app);
|
|
146
|
-
button.classList.add("sys-recall");
|
|
147
|
-
button.title = app.t("recallSystemMessage");
|
|
148
|
-
button.setAttribute("aria-label", app.t("recallSystemMessage"));
|
|
149
|
-
button.dataset.i18nAriaLabel = "recallSystemMessage";
|
|
150
|
-
return button;
|
|
151
|
-
}
|
|
140
|
+
|
|
152
141
|
|
|
153
142
|
async function recall(message, button, app) {
|
|
154
143
|
const roomId = app.state.room?.id;
|
|
155
144
|
if (!roomId || button.disabled) return;
|
|
156
145
|
const own = isOwnMessage(message, app);
|
|
157
|
-
const prompt =
|
|
158
|
-
|
|
159
|
-
if (!confirm(prompt)) return;
|
|
146
|
+
const prompt = own ? app.t("recallConfirm") : app.t("recallAdminConfirm", { name: message.senderId });
|
|
147
|
+
if (!(await app.confirmAction(prompt))) return;
|
|
160
148
|
button.disabled = true;
|
|
161
149
|
try {
|
|
162
150
|
const result = await app.api(`/rooms/${encodeURIComponent(roomId)}/messages/${encodeURIComponent(message.id)}/recall`, {
|
|
@@ -70,7 +70,7 @@ export function initReminders(app) {
|
|
|
70
70
|
toggle.addEventListener("click", () => void update(reminder, !reminder.paused));
|
|
71
71
|
const remove = document.createElement("button"); remove.type = "button"; remove.className = "btn ghost small danger-text"; remove.textContent = app.t("reminderDelete");
|
|
72
72
|
remove.setAttribute("aria-label", `${remove.textContent}: ${text.textContent.slice(0, 80)}`);
|
|
73
|
-
remove.addEventListener("click", () => { if (
|
|
73
|
+
remove.addEventListener("click", async () => { if (await app.confirmAction(app.t("reminderDeleteConfirm"))) void erase(reminder); });
|
|
74
74
|
row.append(text, detail, edit, toggle, remove); list.append(row);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -425,7 +425,7 @@ export function initRooms(app) {
|
|
|
425
425
|
|
|
426
426
|
app.deleteRoom = async () => {
|
|
427
427
|
const room = app.state.room;
|
|
428
|
-
if (!room || !
|
|
428
|
+
if (!room || !(await app.confirmAction(app.t("deleteConfirm", { name: room.name })))) return;
|
|
429
429
|
try {
|
|
430
430
|
await app.api(`/rooms/${encodeURIComponent(room.id)}`, {
|
|
431
431
|
method: "DELETE", body: JSON.stringify({ sessionID: LS.sessionID }),
|
|
@@ -1,254 +1,40 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
// dedicated badge. Tags start on and follow scrolling; the '?' trigger opens
|
|
4
|
-
// the full shortcut sheet, and the legend can turn the tags off.
|
|
5
|
-
const FOCUSABLE = [
|
|
6
|
-
"a[href]", "button", "input:not([type='hidden'])", "select", "textarea", "summary",
|
|
7
|
-
"[contenteditable='true']", "[role='button']", "[role='link']", "[role='switch']",
|
|
8
|
-
"[role='checkbox']", "[role='radio']", "[role='tab']", "[role='menuitem']",
|
|
9
|
-
"[tabindex]:not([tabindex='-1'])",
|
|
10
|
-
].join(",");
|
|
11
|
-
|
|
1
|
+
// The shortcut sheet lists genuine ChatRoom shortcuts. Alt+/ opens it; no
|
|
2
|
+
// per-control badges, no native Tab/Enter hints, and no background observers.
|
|
12
3
|
export function initShortcuts(app) {
|
|
13
|
-
const dialog = app.$("#shortcutsDialog")
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
const dialog = app.$("#shortcutsDialog");
|
|
5
|
+
if (!dialog) return;
|
|
6
|
+
const heading = app.$("#shortcutsHeading");
|
|
7
|
+
const thread = app.$("#thread");
|
|
16
8
|
const triggers = [...document.querySelectorAll("[data-shortcuts]")];
|
|
17
|
-
const sheetToggle = app.$("#btnToggleHints");
|
|
18
|
-
let active = false, badges = [], frame = 0, observer = null, controller = null;
|
|
19
|
-
|
|
20
|
-
const syncSheetToggle = () => {
|
|
21
|
-
if (sheetToggle) app.setText(sheetToggle, active ? "hintsHide" : "hintsShow");
|
|
22
|
-
};
|
|
23
|
-
const syncLegendVisibility = () => {
|
|
24
|
-
const next = Boolean(document.querySelector("#roomRail.drawer-open, .panel:not([hidden]), #readerPanel:not([hidden])"));
|
|
25
|
-
if (legend.hidden !== next) legend.hidden = next;
|
|
26
|
-
};
|
|
27
|
-
const syncVisibility = () => {
|
|
28
|
-
overlay.hidden = !active || Boolean(document.querySelector("dialog[open]"));
|
|
29
|
-
syncLegendVisibility();
|
|
30
|
-
};
|
|
31
9
|
|
|
32
10
|
const openSheet = () => {
|
|
33
11
|
if (dialog.open || document.querySelector("dialog[open]")) return;
|
|
34
12
|
app.closePanels?.();
|
|
35
13
|
app.closeMention?.();
|
|
36
14
|
dialog.showModal();
|
|
37
|
-
heading
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const realKeys = (node) => {
|
|
41
|
-
if (node.matches("#roomListChat .room-row.joined[data-room-id]")
|
|
42
|
-
&& innerWidth > 760 && document.querySelectorAll("#roomListChat .room-row.joined").length > 1) return ["↑", "↓"];
|
|
43
|
-
if (node.id === "msgInput" || node.matches("#msgList img[tabindex], #attachmentList img[tabindex], .chat-resource img[tabindex]")) return ["Enter"];
|
|
44
|
-
if (node.id === "btnCloseReaders") return ["Esc"];
|
|
45
|
-
return null;
|
|
46
|
-
};
|
|
47
|
-
const genericLabel = (node) => {
|
|
48
|
-
const switchKey = node.matches("input[type='checkbox'], input[type='radio'], [role='switch'], [role='checkbox'], [role='radio']") ? "Space" : "↵";
|
|
49
|
-
return node.getBoundingClientRect().width < 60 ? (switchKey === "Space" ? "Tab Space" : "Tab↵") : `Tab › ${switchKey}`;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const badgeFor = (node) => {
|
|
53
|
-
const real = realKeys(node);
|
|
54
|
-
const badge = document.createElement("span");
|
|
55
|
-
badge.className = real ? "keys-badge is-real" : "keys-badge is-generic";
|
|
56
|
-
if (node.id) badge.dataset.hintTarget = node.id;
|
|
57
|
-
if (!real) {
|
|
58
|
-
badge.textContent = genericLabel(node);
|
|
59
|
-
return badge;
|
|
60
|
-
}
|
|
61
|
-
real.forEach((key, index) => {
|
|
62
|
-
const separator = document.createElement("span");
|
|
63
|
-
if (index) { separator.className = "keys-badge-sep"; separator.textContent = "›"; badge.append(separator); }
|
|
64
|
-
const cap = document.createElement("kbd");
|
|
65
|
-
cap.className = "keys-key";
|
|
66
|
-
cap.textContent = key;
|
|
67
|
-
badge.append(cap);
|
|
68
|
-
});
|
|
69
|
-
return badge;
|
|
15
|
+
heading?.focus();
|
|
70
16
|
};
|
|
71
17
|
|
|
72
|
-
|
|
73
|
-
// The trigger already shows its own "?", and overlay chrome is not a target.
|
|
74
|
-
if (node.closest("#keyboardHints, #shortcutsDialog, [inert], [hidden], [data-shortcuts]")) return false;
|
|
75
|
-
if (node.id === "roomDrawerBackdrop" || node.tabIndex < 0) return false;
|
|
76
|
-
if (node.matches(":disabled, [aria-disabled='true']")) return false;
|
|
77
|
-
const rect = node.getBoundingClientRect();
|
|
78
|
-
if (rect.width < 2 || rect.height < 2) return false;
|
|
79
|
-
if (node.checkVisibility && !node.checkVisibility({ checkVisibilityCSS: true })) return false;
|
|
80
|
-
// Collect off-screen controls too: scrolling then only moves existing badges.
|
|
81
|
-
const onScreen = rect.bottom > 0 && rect.top < innerHeight && rect.right > 0 && rect.left < innerWidth;
|
|
82
|
-
if (!onScreen) return true;
|
|
83
|
-
const left = Math.max(rect.left, 0), top = Math.max(rect.top, 0);
|
|
84
|
-
const right = Math.min(rect.right, innerWidth), bottom = Math.min(rect.bottom, innerHeight);
|
|
85
|
-
if (right - left < 2 || bottom - top < 2) return false;
|
|
86
|
-
const hit = document.elementFromPoint((left + right) / 2, (top + bottom) / 2);
|
|
87
|
-
return Boolean(hit) && (hit === node || node.contains(hit));
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const overlaps = (a, b) => a.left < b.right && a.right > b.left && a.top < b.bottom && a.bottom > b.top;
|
|
91
|
-
|
|
92
|
-
const textRect = (element) => {
|
|
93
|
-
const range = document.createRange();
|
|
94
|
-
range.selectNodeContents(element);
|
|
95
|
-
const rect = range.getBoundingClientRect();
|
|
96
|
-
return rect.width > 0 && rect.height > 0 ? rect : null;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const textObstacles = () => {
|
|
100
|
-
const rects = [];
|
|
101
|
-
const skip = new Set(["SCRIPT", "STYLE", "SVG", "TEXTAREA", "SELECT"]);
|
|
102
|
-
const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT, {
|
|
103
|
-
acceptNode(node) {
|
|
104
|
-
if (!node.nodeValue?.trim()) return NodeFilter.FILTER_REJECT;
|
|
105
|
-
const parent = node.parentElement;
|
|
106
|
-
if (!parent || skip.has(parent.tagName) || parent.closest("#keyboardHints")) return NodeFilter.FILTER_REJECT;
|
|
107
|
-
if (parent.checkVisibility && !parent.checkVisibility({ checkVisibilityCSS: true })) return NodeFilter.FILTER_REJECT;
|
|
108
|
-
return NodeFilter.FILTER_ACCEPT;
|
|
109
|
-
},
|
|
110
|
-
});
|
|
111
|
-
for (let node = walker.nextNode(); node; node = walker.nextNode()) {
|
|
112
|
-
const range = document.createRange();
|
|
113
|
-
range.selectNodeContents(node);
|
|
114
|
-
for (const rect of range.getClientRects()) {
|
|
115
|
-
if (rect.width > 0 && rect.height > 0 && rect.right > 0 && rect.left < innerWidth && rect.bottom > 0 && rect.top < innerHeight) rects.push(rect);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
// The legend covers content too, so tags keep clear of it.
|
|
119
|
-
if (!legend.hidden) rects.push(legend.getBoundingClientRect());
|
|
120
|
-
return rects;
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const place = () => {
|
|
124
|
-
if (!active) return;
|
|
125
|
-
syncLegendVisibility();
|
|
126
|
-
const obstacles = textObstacles();
|
|
127
|
-
const occupied = [];
|
|
128
|
-
const boxes = [];
|
|
129
|
-
const modal = document.querySelector("#roomRail.drawer-open, .panel:not([hidden]), #readerPanel:not([hidden])");
|
|
130
|
-
for (const { node, badge } of badges) {
|
|
131
|
-
const box = node.getBoundingClientRect();
|
|
132
|
-
if (box.width > 0 && box.height > 0) boxes.push([node, box]);
|
|
133
|
-
}
|
|
134
|
-
for (const { node, badge } of badges) {
|
|
135
|
-
if (!node.isConnected) { badge.remove(); continue; }
|
|
136
|
-
if (modal && !modal.contains(node)) { badge.hidden = true; continue; }
|
|
137
|
-
const rect = node.getBoundingClientRect();
|
|
138
|
-
if (rect.bottom <= 0 || rect.top >= innerHeight || rect.right <= 0 || rect.left >= innerWidth) { badge.hidden = true; continue; }
|
|
139
|
-
const leftEdge = Math.max(rect.left, 0), topEdge = Math.max(rect.top, 0);
|
|
140
|
-
const rightEdge = Math.min(rect.right, innerWidth), bottomEdge = Math.min(rect.bottom, innerHeight);
|
|
141
|
-
const hit = rightEdge - leftEdge > 1 && bottomEdge - topEdge > 1
|
|
142
|
-
? document.elementFromPoint((leftEdge + rightEdge) / 2, (topEdge + bottomEdge) / 2) : null;
|
|
143
|
-
if (!hit || !(hit === node || node.contains(hit))) { badge.hidden = true; continue; }
|
|
144
|
-
const width = badge.offsetWidth, height = badge.offsetHeight;
|
|
145
|
-
const centerY = rect.top + (rect.height - height) / 2;
|
|
146
|
-
const switchLike = node.matches("input[type='checkbox'], input[type='radio'], [role='switch'], [role='checkbox'], [role='radio']");
|
|
147
|
-
const candidates = [];
|
|
148
|
-
// A tag never covers label text: outside the control first, then a free
|
|
149
|
-
// inside corner, and hidden when neither fits.
|
|
150
|
-
if (switchLike) {
|
|
151
|
-
const label = node.labels?.[0] || node.closest(".join-policy")?.querySelector(".join-policy-label");
|
|
152
|
-
const labelText = label ? textRect(label) : null;
|
|
153
|
-
if (labelText) candidates.push([labelText.right + 8, centerY], [labelText.left, labelText.bottom + 4]);
|
|
154
|
-
candidates.push([rect.left - width - 4, centerY], [rect.right + 4, centerY],
|
|
155
|
-
[rect.right - width, rect.top - height - 4], [rect.right - width, rect.bottom + 4]);
|
|
156
|
-
} else {
|
|
157
|
-
candidates.push([rect.right - width, rect.top - height - 3], [rect.right - width, rect.bottom + 3],
|
|
158
|
-
[rect.right + 4, centerY], [rect.left - width - 4, centerY],
|
|
159
|
-
[rect.left, rect.top - height - 3], [rect.left, rect.bottom + 3],
|
|
160
|
-
[rect.right - width - 2, rect.bottom - height - 2], [rect.left + 2, rect.bottom - height - 2]);
|
|
161
|
-
}
|
|
162
|
-
let chosen = null;
|
|
163
|
-
for (const [left, top] of candidates) {
|
|
164
|
-
const box = { left, top, right: left + width, bottom: top + height };
|
|
165
|
-
if (left < 4 || top < 4 || box.right > innerWidth - 4 || box.bottom > innerHeight - 4) continue;
|
|
166
|
-
if (obstacles.some((other) => overlaps(box, other))) continue;
|
|
167
|
-
if (boxes.some(([other, otherBox]) => other !== node && !other.contains(node) && !node.contains(other) && overlaps(box, otherBox))) continue;
|
|
168
|
-
if (occupied.some((other) => overlaps(box, other))) continue;
|
|
169
|
-
chosen = box; break;
|
|
170
|
-
}
|
|
171
|
-
if (!chosen) { badge.hidden = true; continue; }
|
|
172
|
-
badge.hidden = false;
|
|
173
|
-
badge.style.left = `${Math.round(chosen.left)}px`;
|
|
174
|
-
badge.style.top = `${Math.round(chosen.top)}px`;
|
|
175
|
-
occupied.push(chosen);
|
|
176
|
-
}
|
|
177
|
-
const composer = [...document.querySelectorAll("#chatView .composer")].find((node) => node.offsetParent !== null);
|
|
178
|
-
const bottom = composer ? innerHeight - composer.getBoundingClientRect().top + 10 : 18;
|
|
179
|
-
legend.style.bottom = `${Math.max(12, Math.min(bottom, innerHeight - 90))}px`;
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
const collect = () => {
|
|
183
|
-
if (!active) return;
|
|
184
|
-
marks.textContent = "";
|
|
185
|
-
badges = [];
|
|
186
|
-
for (const node of document.querySelectorAll(FOCUSABLE)) {
|
|
187
|
-
if (!usable(node)) continue;
|
|
188
|
-
const badge = badgeFor(node);
|
|
189
|
-
marks.append(badge);
|
|
190
|
-
badges.push({ node, badge });
|
|
191
|
-
}
|
|
192
|
-
place();
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
const schedule = (task) => {
|
|
196
|
-
if (!active || frame) return;
|
|
197
|
-
frame = requestAnimationFrame(() => { frame = 0; task(); });
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
const setActive = (next) => {
|
|
201
|
-
active = next;
|
|
202
|
-
syncSheetToggle();
|
|
203
|
-
syncVisibility();
|
|
204
|
-
if (!active) {
|
|
205
|
-
controller?.abort(); controller = null;
|
|
206
|
-
observer?.disconnect(); observer = null;
|
|
207
|
-
cancelAnimationFrame(frame); frame = 0;
|
|
208
|
-
marks.textContent = "";
|
|
209
|
-
badges = [];
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
controller = new AbortController();
|
|
213
|
-
const { signal } = controller;
|
|
214
|
-
addEventListener("resize", () => schedule(place), { signal });
|
|
215
|
-
addEventListener("scroll", () => schedule(place), { capture: true, signal });
|
|
216
|
-
addEventListener("click", () => schedule(place), { capture: true, signal });
|
|
217
|
-
// View entrance animations move every control; collect once they settle.
|
|
218
|
-
addEventListener("animationend", (event) => {
|
|
219
|
-
if (event.target === app.$("#joinView") || event.target === app.$("#chatView")) schedule(collect);
|
|
220
|
-
}, { capture: true, signal });
|
|
221
|
-
window.visualViewport?.addEventListener("resize", () => schedule(place), { signal });
|
|
222
|
-
window.visualViewport?.addEventListener("scroll", () => schedule(place), { signal });
|
|
223
|
-
observer = new MutationObserver((records) => {
|
|
224
|
-
if (records.some((record) => record.target instanceof Element && record.target.matches("dialog") && record.attributeName === "open")) syncVisibility();
|
|
225
|
-
syncLegendVisibility();
|
|
226
|
-
if (records.some((record) => !(record.target instanceof Element) || !record.target.closest("#keyboardHints"))) schedule(collect);
|
|
227
|
-
});
|
|
228
|
-
observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ["hidden", "disabled", "aria-disabled", "aria-hidden", "inert", "open"] });
|
|
229
|
-
collect();
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
const enable = () => { app.LS.keyHintsOff = false; setActive(true); };
|
|
233
|
-
const disable = () => { app.LS.keyHintsOff = true; setActive(false); };
|
|
234
|
-
|
|
235
|
-
triggers.forEach((button) => button.addEventListener("click", () => openSheet()));
|
|
236
|
-
app.$("#btnAllShortcuts")?.addEventListener("click", () => openSheet());
|
|
237
|
-
app.$("#btnToggleHints")?.addEventListener("click", () => (active ? disable() : enable()));
|
|
238
|
-
app.$("#btnCloseHints")?.addEventListener("click", () => {
|
|
239
|
-
disable();
|
|
240
|
-
triggers.find((button) => button.offsetParent !== null)?.focus({ preventScroll: true });
|
|
241
|
-
});
|
|
18
|
+
triggers.forEach((button) => button.addEventListener("click", openSheet));
|
|
242
19
|
app.$("#btnCloseShortcuts")?.addEventListener("click", () => dialog.close());
|
|
243
20
|
dialog.addEventListener("close", () => requestAnimationFrame(() => app.focusComposer?.()));
|
|
21
|
+
const scrollToEdge = (bottom) => {
|
|
22
|
+
if (!thread) return;
|
|
23
|
+
app.state.userScrollIntentUntil = performance.now() + 700;
|
|
24
|
+
if (!bottom) {
|
|
25
|
+
app.state.jumpToLoadedTop = true;
|
|
26
|
+
setTimeout(() => { app.state.jumpToLoadedTop = false; }, 100);
|
|
27
|
+
}
|
|
28
|
+
thread.scrollTop = bottom ? thread.scrollHeight : 0;
|
|
29
|
+
};
|
|
244
30
|
document.addEventListener("keydown", (event) => {
|
|
245
|
-
if (event.defaultPrevented || event.isComposing
|
|
246
|
-
if (event.
|
|
247
|
-
const target = event.target;
|
|
248
|
-
if (target instanceof Element && target.closest("input, textarea, select, [contenteditable='true']")) return;
|
|
31
|
+
if (event.defaultPrevented || event.isComposing) return;
|
|
32
|
+
if (!event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;
|
|
249
33
|
if (document.querySelector("dialog[open]")) return;
|
|
34
|
+
if (event.key === "Home" || event.code === "Home") { event.preventDefault(); scrollToEdge(false); return; }
|
|
35
|
+
if (event.key === "End" || event.code === "End") { event.preventDefault(); scrollToEdge(true); return; }
|
|
36
|
+
if (event.key !== "/" && event.code !== "Slash") return;
|
|
250
37
|
event.preventDefault();
|
|
251
38
|
openSheet();
|
|
252
39
|
});
|
|
253
|
-
if (app.LS.keyHintsOff) syncSheetToggle(); else setActive(true);
|
|
254
40
|
}
|
|
@@ -137,7 +137,7 @@ export function createAuth(storage, fetcher, translate = (key) => key, sessionSt
|
|
|
137
137
|
set name(value) { ensureIdentity(); browserIdentity.name = String(value ?? "").slice(0, 64); writeSession("chat.name", browserIdentity.name || null); saveIdentity(); },
|
|
138
138
|
get token() { return read("chat.token") || ""; }, set token(value) { write("chat.token", value || null); },
|
|
139
139
|
get locale() { return read("chat.locale") || "en"; }, set locale(value) { write("chat.locale", value || null); },
|
|
140
|
-
|
|
140
|
+
|
|
141
141
|
get joinedRoomIds() {
|
|
142
142
|
try {
|
|
143
143
|
const ids = JSON.parse(readSession("chat.joinedRoomIds") || "[]");
|
|
@@ -269,17 +269,13 @@ const messages = {
|
|
|
269
269
|
joinArrow: "Join →", joinDirectTitle: "Click to join directly", mentionEmpty: "No matching members",
|
|
270
270
|
joined: "Joined", joinAction: "Join room", unreadMessages: ({ count }) => `${count} unread`,
|
|
271
271
|
mentionHint: "↑↓ Select · Enter to confirm · Esc to close", today: "Today", yesterday: "Yesterday",
|
|
272
|
-
keyboardHints: "Keyboard
|
|
273
|
-
shortcutsTitle: "Keyboard shortcuts", shortcutsLead: "
|
|
274
|
-
hintsLegend: "Tab reaches · Enter / Space activates",
|
|
275
|
-
allShortcuts: "All shortcuts", hintsHide: "Hide tags on controls", hintsShow: "Show tags on controls",
|
|
272
|
+
keyboardHints: "Keyboard shortcuts", shortcutsLabel: "Shortcuts",
|
|
273
|
+
shortcutsTitle: "Keyboard shortcuts", shortcutsLead: "ChatRoom shortcuts. Press Alt + / to open this list.",
|
|
276
274
|
shortcutsWriting: "Writing", shortcutsSend: "Send the message", shortcutsNewline: "Start a new line",
|
|
277
275
|
shortcutsMention: "Choose a member to mention", shortcutsRooms: "Rooms",
|
|
278
276
|
shortcutsSwitchRoom: "Switch to the previous or next room", shortcutsReading: "Reading",
|
|
279
|
-
shortcutsScroll: "Scroll messages while typing", shortcutsMenus: "Menus and dialogs",
|
|
280
|
-
shortcutsClose: "Close the open menu, panel, or dialog",
|
|
281
|
-
shortcutsTab: "Move between controls", shortcutsActivate: "Use the focused control",
|
|
282
|
-
shortcutsOpen: "Open this shortcut list", switchRoomsHint: "Switch rooms",
|
|
277
|
+
shortcutsScroll: "Scroll messages while typing", shortcutsJump: "Jump to the start or end of the conversation", shortcutsMenus: "Menus and dialogs",
|
|
278
|
+
shortcutsClose: "Close the open menu, panel, or dialog",
|
|
283
279
|
earlierMessages: "Earlier messages omitted", messagesBetweenOmitted: "Messages between this reading point and latest are omitted.", you: "You", saved: "Saved",
|
|
284
280
|
savedMemory: "Saved for this tab only", copyFailed: ({ id }) => `Copy failed. Copy manually: ${id}`,
|
|
285
281
|
copyMessage: "Copy", copiedMessage: "Copied", copyMessageFailed: "Could not copy. Select and copy the message manually.",
|
|
@@ -308,10 +304,11 @@ const messages = {
|
|
|
308
304
|
privacyNote: "Anyone with the shared token can read direct messages and manage rooms; the server can read them too.",
|
|
309
305
|
resourceDelete: "Delete file", resourceDeleting: "Deleting…", resourceDeleteConfirm: ({ name }) => `Delete “${name}”? This cannot be undone.`, resourceDeleted: "File deleted.", resourceDeleteFailed: "Could not delete this file.",
|
|
310
306
|
systemJoined: ({ name }) => `${name} joined the room`, systemLeft: ({ name }) => `${name} left the room`, systemRemoved: ({ name }) => `${name} was removed from the room`,
|
|
311
|
-
systemDesignated: ({ actor, name }) => `${actor} designated ${name} as administrator`, systemRevoked: ({ actor }) => `${actor} revoked the administrator designation`, systemRenamed: ({ actor, from, to }) => `${actor} renamed the room from "${from}" to "${to}"`, systemDescribed: ({ actor }) => `${actor} updated the room description`, systemHanded: ({ actor, name }) => `${actor} handed the room to ${name}`, systemAdminsUpdated: ({ actor }) => `${actor} updated the room administrators`, systemSuccessorNamed: ({ actor, name }) => `${actor} named ${name} as the room successor`, systemSuccessorCleared: ({ actor }) => `${actor} cleared the room successor`,
|
|
307
|
+
systemDesignated: ({ actor, name }) => `${actor} designated ${name} as administrator`, systemRevoked: ({ actor }) => `${actor} revoked the administrator designation`, systemRenamed: ({ actor, from, to }) => `${actor} renamed the room from "${from}" to "${to}"`, systemDescribed: ({ actor }) => `${actor} updated the room description`, systemHanded: ({ actor, name }) => `${actor} handed the room to ${name}`, systemAdminsUpdated: ({ actor }) => `${actor} updated the room administrators`, systemSuccessorNamed: ({ actor, name }) => `${actor} named ${name} as the room successor`, systemSuccessorCleared: ({ actor }) => `${actor} cleared the room successor`, systemJoinPolicy: ({ actor, policy }) => policy === "approval" ? `${actor} now requires approval to join this room` : `${actor} opened this room to join without approval`,
|
|
312
308
|
activity_working: "Working", activity_idle: "Foreground idle", activity_waiting: "Waiting", activity_unknown: "Status unknown", activity_offline: "Status stale",
|
|
313
309
|
activityHint_working: "The agent reports active work.", activityHint_idle: "Foreground is idle; background work may continue.", activityHint_waiting: "The agent reports that it is waiting.", activityHint_unknown: "No activity report is available.", activityHint_offline: "The last status is stale; this does not prove the agent is offline.",
|
|
314
310
|
receiptCount: ({ count }) => `Read by ${count}`, receiptNone: "No readers yet", receiptNotLoaded: "Read status not loaded", readerPanelTitle: "Message readers", close: "Close", departedMember: "left",
|
|
311
|
+
confirmTitle: "Please confirm", cancel: "Cancel", confirmAction: "Confirm",
|
|
315
312
|
receiptEvidence_displayed: "Shown on screen", receiptEvidence_tool: "Fetched with room tool", receiptEvidence_context: "In agent context",
|
|
316
313
|
},
|
|
317
314
|
"zh-CN": {
|
|
@@ -381,17 +378,13 @@ const messages = {
|
|
|
381
378
|
fileTooLarge: "文件超过服务器当前大小限制。",
|
|
382
379
|
send: "发送", roomMeta: ({ members, count }) => `${members} 人 · ${count} 条消息`, joinArrow: "加入 →",
|
|
383
380
|
joinDirectTitle: "点击直接加入", mentionEmpty: "没有匹配的成员", mentionHint: "↑↓ 选择 · Enter 确认 · Esc 关闭",
|
|
384
|
-
keyboardHints: "
|
|
385
|
-
shortcutsTitle: "键盘快捷键", shortcutsLead: "
|
|
386
|
-
hintsLegend: "Tab 定位 · Enter 或空格使用",
|
|
387
|
-
allShortcuts: "全部快捷键", hintsHide: "隐藏控件提示", hintsShow: "显示控件提示",
|
|
381
|
+
keyboardHints: "键盘快捷键", shortcutsLabel: "快捷键",
|
|
382
|
+
shortcutsTitle: "键盘快捷键", shortcutsLead: "ChatRoom 快捷键。按 Alt + / 打开此列表。",
|
|
388
383
|
shortcutsWriting: "输入", shortcutsSend: "发送消息", shortcutsNewline: "换行",
|
|
389
384
|
shortcutsMention: "选择要提及的成员", shortcutsRooms: "房间",
|
|
390
385
|
shortcutsSwitchRoom: "切换到上一个或下一个房间", shortcutsReading: "阅读",
|
|
391
|
-
shortcutsScroll: "输入时滚动消息", shortcutsMenus: "菜单和对话框",
|
|
392
|
-
shortcutsClose: "关闭当前菜单、面板或对话框",
|
|
393
|
-
shortcutsTab: "在控件之间移动", shortcutsActivate: "使用当前聚焦的控件",
|
|
394
|
-
shortcutsOpen: "打开这个快捷键列表", switchRoomsHint: "切换房间",
|
|
386
|
+
shortcutsScroll: "输入时滚动消息", shortcutsJump: "跳到会话开头或结尾", shortcutsMenus: "菜单和对话框",
|
|
387
|
+
shortcutsClose: "关闭当前菜单、面板或对话框",
|
|
395
388
|
joined: "已加入", joinAction: "加入房间", unreadMessages: ({ count }) => `${count} 条未读`,
|
|
396
389
|
today: "今天", yesterday: "昨天", earlierMessages: "更早的消息已省略", messagesBetweenOmitted: "此阅读位置与最新消息之间的部分消息已省略。", you: "我", saved: "已保存",
|
|
397
390
|
savedMemory: "仅保存于当前标签页", copyFailed: ({ id }) => `复制失败,请手动复制:${id}`,
|
|
@@ -416,10 +409,11 @@ const messages = {
|
|
|
416
409
|
sendAsFile: ({ count }) => `${count} 个字符超出上限,将作为文本文件发送`,
|
|
417
410
|
privacyNote: "持有共享令牌的人都可以读取私聊内容和管理房间;服务器也可以读取私聊内容。", resourceDelete: "删除文件", resourceDeleting: "正在删除…", resourceDeleteConfirm: ({ name }) => `确定删除“${name}”?此操作无法撤销。`, resourceDeleted: "文件已删除。", resourceDeleteFailed: "无法删除此文件。",
|
|
418
411
|
systemJoined: ({ name }) => `${name} 加入了房间`, systemLeft: ({ name }) => `${name} 离开了房间`, systemRemoved: ({ name }) => `${name} 被移出了房间`,
|
|
419
|
-
systemDesignated: ({ actor, name }) => `${actor} 指定 ${name} 为管理员`, systemRevoked: ({ actor }) => `${actor} 撤销了管理员指定`, systemRenamed: ({ actor, from, to }) => `${actor} 将房间名称从“${from}”改为“${to}”`, systemDescribed: ({ actor }) => `${actor} 更新了房间描述`, systemHanded: ({ actor, name }) => `${actor} 将房间移交给了 ${name}`, systemAdminsUpdated: ({ actor }) => `${actor} 更新了房间管理员`, systemSuccessorNamed: ({ actor, name }) => `${actor} 指定 ${name} 为房间继任者`, systemSuccessorCleared: ({ actor }) => `${actor} 清除了房间继任者`,
|
|
412
|
+
systemDesignated: ({ actor, name }) => `${actor} 指定 ${name} 为管理员`, systemRevoked: ({ actor }) => `${actor} 撤销了管理员指定`, systemRenamed: ({ actor, from, to }) => `${actor} 将房间名称从“${from}”改为“${to}”`, systemDescribed: ({ actor }) => `${actor} 更新了房间描述`, systemHanded: ({ actor, name }) => `${actor} 将房间移交给了 ${name}`, systemAdminsUpdated: ({ actor }) => `${actor} 更新了房间管理员`, systemSuccessorNamed: ({ actor, name }) => `${actor} 指定 ${name} 为房间继任者`, systemSuccessorCleared: ({ actor }) => `${actor} 清除了房间继任者`, systemJoinPolicy: ({ actor, policy }) => policy === "approval" ? `${actor} 开启了加入审核,新成员需要管理员批准` : `${actor} 关闭了加入审核,新成员可以直接加入`,
|
|
420
413
|
activity_working: "工作中", activity_idle: "前台空闲", activity_waiting: "等待中", activity_unknown: "状态未知", activity_offline: "状态已过期",
|
|
421
414
|
activityHint_working: "Agent 正在报告工作状态。", activityHint_idle: "前台空闲;后台任务仍可能继续。", activityHint_waiting: "Agent 正在报告等待状态。", activityHint_unknown: "暂无活动状态报告。", activityHint_offline: "最近的状态已过期;这不能证明 Agent 已离线。",
|
|
422
415
|
receiptCount: ({ count }) => `已读 ${count} 人`, receiptNone: "尚无人已读", receiptNotLoaded: "尚未加载已读状态", readerPanelTitle: "消息已读情况", close: "关闭", departedMember: "已离开",
|
|
416
|
+
confirmTitle: "请确认", cancel: "取消", confirmAction: "确认",
|
|
423
417
|
receiptEvidence_displayed: "已显示在屏幕上", receiptEvidence_tool: "通过房间工具读取", receiptEvidence_context: "进入上下文",
|
|
424
418
|
},
|
|
425
419
|
};
|
|
@@ -9,6 +9,7 @@ const patterns = [
|
|
|
9
9
|
[/^(.*?) revoked the administrator designation$/, "systemRevoked", (m) => ({ actor: m[1] })],
|
|
10
10
|
[/^(.*?) renamed the room from "(.*)" to "(.*)"$/, "systemRenamed", (m) => ({ actor: m[1], from: m[2], to: m[3] })],
|
|
11
11
|
[/^(.*?) updated the room description$/, "systemDescribed", (m) => ({ actor: m[1] })],
|
|
12
|
+
[/^(.*?) set join approval to (open|approval)$/, "systemJoinPolicy", (m) => ({ actor: m[1], policy: m[2] })],
|
|
12
13
|
[/^(.*?) handed the room to (.*)$/, "systemHanded", (m) => ({ actor: m[1], name: m[2] })],
|
|
13
14
|
];
|
|
14
15
|
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
/* The three setup cards stack below the masthead; rooms use two columns until phones. */
|
|
16
16
|
@media (max-width: 860px) {
|
|
17
17
|
.join-entries { grid-template-columns: minmax(0, 1fr); }
|
|
18
|
+
#createForm { grid-column: auto; }
|
|
18
19
|
#roomList { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
19
20
|
}
|
|
20
21
|
@media (max-width: 560px) {
|
|
@@ -105,6 +106,8 @@
|
|
|
105
106
|
#reminderDialog { width: min(680px, calc(100vw - 32px)); }
|
|
106
107
|
.admin-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
|
|
107
108
|
.admin-dialog-actions { display: flex; align-items: center; gap: 10px; }
|
|
109
|
+
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }
|
|
110
|
+
#confirmMessage { margin: 12px 0 20px; color: var(--ink-2); }
|
|
108
111
|
.admin-dialog-head h2 { min-width: 0; margin: 0; font-family: var(--font-display); font-size: 25px; font-weight: 600; letter-spacing: -.02em; overflow-wrap: anywhere; }
|
|
109
112
|
.admin-dialog h3 { margin: 20px 0 9px; font-size: 14px; font-weight: 700; letter-spacing: .01em; }
|
|
110
113
|
.admin-guide { padding: 16px; border: 1px solid color-mix(in srgb, var(--line) 82%, transparent); border-radius: 14px; background: color-mix(in srgb, var(--surface) 84%, var(--accent-soft)); }
|
package/server/chat.html
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<meta name="mobile-web-app-capable" content="yes">
|
|
13
13
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
14
14
|
<link rel="stylesheet" href="/assets/base.css">
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
<link rel="stylesheet" href="/assets/conversation.css">
|
|
17
17
|
<link rel="stylesheet" href="/assets/recall.css">
|
|
18
18
|
<link rel="stylesheet" href="/assets/attachments.css">
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
<option value="en">English</option>
|
|
39
39
|
<option value="zh-CN">中文</option>
|
|
40
40
|
</select>
|
|
41
|
-
<button id="btnKeysJoin" class="keys-hint" type="button" data-shortcuts aria-haspopup="dialog" aria-controls="shortcutsDialog" aria-label="Keyboard hints" data-i18n-aria-label="keyboardHints" title="Keyboard hints" data-i18n-title="keyboardHints" aria-keyshortcuts="
|
|
41
|
+
<button id="btnKeysJoin" class="keys-hint" type="button" data-shortcuts aria-haspopup="dialog" aria-controls="shortcutsDialog" aria-label="Keyboard hints" data-i18n-aria-label="keyboardHints" title="Keyboard hints" data-i18n-title="keyboardHints" aria-keyshortcuts="Alt+/"><span class="keys-label" data-i18n="shortcutsLabel">Shortcuts</span></button>
|
|
42
42
|
</div>
|
|
43
43
|
<p class="tagline" data-i18n="tagline">A lightweight chat room. Enter a room ID to join, or create a new one.</p>
|
|
44
44
|
</header>
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
</form>
|
|
138
138
|
<ul id="roomListChat" class="rail-rooms"></ul>
|
|
139
139
|
<p id="roomListChatEmpty" class="hint" data-i18n="noRooms" hidden></p>
|
|
140
|
-
|
|
140
|
+
|
|
141
141
|
<div id="railInstall" class="rail-install" hidden>
|
|
142
142
|
<button id="btnRailInstall" class="btn ghost small rail-install-btn" type="button"><svg aria-hidden="true" viewBox="0 0 24 24"><path d="M12 4v10M8 10l4 4 4-4M5 19h14"/></svg><span data-i18n="installAction">Install</span></button>
|
|
143
143
|
<p id="railInstallGuide" class="hint" data-i18n="installIosGuide" hidden>Tap Share, then Add to Home Screen.</p>
|
|
@@ -322,7 +322,7 @@
|
|
|
322
322
|
<button class="btn primary" type="button" id="btnSend" data-i18n="send" disabled>Send</button>
|
|
323
323
|
</div>
|
|
324
324
|
<div class="composer-meta">
|
|
325
|
-
<button id="btnKeysChat" class="keys-hint composer-keys" type="button" data-shortcuts aria-haspopup="dialog" aria-controls="shortcutsDialog" aria-label="Keyboard hints" data-i18n-aria-label="keyboardHints" title="Keyboard hints" data-i18n-title="keyboardHints" aria-keyshortcuts="
|
|
325
|
+
<button id="btnKeysChat" class="keys-hint composer-keys" type="button" data-shortcuts aria-haspopup="dialog" aria-controls="shortcutsDialog" aria-label="Keyboard hints" data-i18n-aria-label="keyboardHints" title="Keyboard hints" data-i18n-title="keyboardHints" aria-keyshortcuts="Alt+/"><span class="keys-label" data-i18n="shortcutsLabel">Shortcuts</span></button>
|
|
326
326
|
<p id="draftCount" class="draft-count">0 / 5000</p>
|
|
327
327
|
</div>
|
|
328
328
|
</footer>
|
|
@@ -347,6 +347,15 @@
|
|
|
347
347
|
<button id="btnOwnerOnlyOk" class="btn ghost small" type="button" data-i18n="close">Close</button>
|
|
348
348
|
</dialog>
|
|
349
349
|
|
|
350
|
+
<dialog id="confirmDialog" class="admin-dialog confirm-dialog" aria-labelledby="confirmHeading">
|
|
351
|
+
<header class="admin-dialog-head"><h2 id="confirmHeading" data-i18n="confirmTitle">Please confirm</h2></header>
|
|
352
|
+
<p id="confirmMessage" class="hint"></p>
|
|
353
|
+
<div class="confirm-actions">
|
|
354
|
+
<button id="btnCancelConfirm" class="btn ghost small" type="button" data-i18n="cancel">Cancel</button>
|
|
355
|
+
<button id="btnAcceptConfirm" class="btn primary small" type="button" data-i18n="confirmAction">Confirm</button>
|
|
356
|
+
</div>
|
|
357
|
+
</dialog>
|
|
358
|
+
|
|
350
359
|
<!-- The visible contract that every control works from the keyboard. -->
|
|
351
360
|
<dialog id="shortcutsDialog" class="keys-dialog" aria-labelledby="shortcutsHeading">
|
|
352
361
|
<header class="keys-dialog-head">
|
|
@@ -354,7 +363,7 @@
|
|
|
354
363
|
<button id="btnCloseShortcuts" class="reader-close" type="button" aria-label="Close" data-i18n-aria-label="close"><svg class="close-icon" aria-hidden="true" viewBox="0 0 24 24"><path d="M6 6l12 12M18 6 6 18"/></svg></button>
|
|
355
364
|
</header>
|
|
356
365
|
<p class="keys-lead" data-i18n="shortcutsLead">Every control works from the keyboard. Tags show the keys that work.</p>
|
|
357
|
-
|
|
366
|
+
|
|
358
367
|
<section class="keys-section">
|
|
359
368
|
<h3 data-i18n="shortcutsWriting">Writing</h3>
|
|
360
369
|
<ul class="keys-list">
|
|
@@ -373,6 +382,7 @@
|
|
|
373
382
|
<h3 data-i18n="shortcutsReading">Reading</h3>
|
|
374
383
|
<ul class="keys-list">
|
|
375
384
|
<li><span class="keys-combo"><kbd class="keys-key">PageUp</kbd><span class="keys-sep">/</span><kbd class="keys-key">PageDown</kbd></span><span data-i18n="shortcutsScroll">Scroll messages while typing</span></li>
|
|
385
|
+
<li><span class="keys-combo"><kbd class="keys-key">Alt</kbd><span class="keys-sep">+</span><kbd class="keys-key">Home</kbd><span class="keys-sep">/</span><kbd class="keys-key">End</kbd></span><span data-i18n="shortcutsJump">Jump to the start or end of the conversation</span></li>
|
|
376
386
|
</ul>
|
|
377
387
|
</section>
|
|
378
388
|
<section class="keys-section">
|
|
@@ -381,27 +391,10 @@
|
|
|
381
391
|
<li><span class="keys-combo"><kbd class="keys-key">Esc</kbd></span><span data-i18n="shortcutsClose">Close the open menu, panel, or dialog</span></li>
|
|
382
392
|
</ul>
|
|
383
393
|
</section>
|
|
384
|
-
|
|
385
|
-
<h3 data-i18n="shortcutsEverywhere">Everywhere</h3>
|
|
386
|
-
<ul class="keys-list">
|
|
387
|
-
<li><span class="keys-combo"><kbd class="keys-key">Tab</kbd><span class="keys-sep">/</span><kbd class="keys-key">Shift</kbd><span class="keys-sep">+</span><kbd class="keys-key">Tab</kbd></span><span data-i18n="shortcutsTab">Move between controls</span></li>
|
|
388
|
-
<li><span class="keys-combo"><kbd class="keys-key">Enter</kbd><span class="keys-sep">/</span><kbd class="keys-key">Space</kbd></span><span data-i18n="shortcutsActivate">Use the focused control</span></li>
|
|
389
|
-
<li><span class="keys-combo"><kbd class="keys-key">?</kbd></span><span data-i18n="shortcutsOpen">Open this shortcut list</span></li>
|
|
390
|
-
</ul>
|
|
391
|
-
</section>
|
|
394
|
+
|
|
392
395
|
</dialog>
|
|
393
396
|
|
|
394
|
-
|
|
395
|
-
<div id="keyboardHints" class="keys-overlay" hidden>
|
|
396
|
-
<div id="keyboardHintMarks" class="keys-marks" aria-hidden="true"></div>
|
|
397
|
-
<div class="keys-legend">
|
|
398
|
-
<p class="keys-legend-text" data-i18n="hintsLegend">Tab reaches · Enter / Space activates</p>
|
|
399
|
-
<div class="keys-legend-actions">
|
|
400
|
-
<button id="btnAllShortcuts" class="keys-legend-btn" type="button" data-i18n="allShortcuts">All shortcuts</button>
|
|
401
|
-
<button id="btnCloseHints" class="keys-legend-close" type="button" aria-label="Hide tags on controls" data-i18n-aria-label="hintsHide"><svg class="close-icon" aria-hidden="true" viewBox="0 0 24 24"><path d="M6 6l12 12M18 6 6 18"/></svg></button>
|
|
402
|
-
</div>
|
|
403
|
-
</div>
|
|
404
|
-
</div>
|
|
397
|
+
|
|
405
398
|
|
|
406
399
|
</main>
|
|
407
400
|
|
package/skills/chatroom/SKILL.md
CHANGED
|
@@ -128,7 +128,7 @@ To delete an attachment you uploaded, call `room` with `action: "delete_resource
|
|
|
128
128
|
|
|
129
129
|
## Recall messages
|
|
130
130
|
|
|
131
|
-
Use `recall` with `roomId` and `messageId` when the user asks you to remove a message you sent, or when you sent a wrong or
|
|
131
|
+
Use `recall` with `roomId` and `messageId` when the user asks you to remove a message you sent, or when you sent a wrong, misleading, or noisy message. Recall your own mistake proactively instead of leaving it to pollute the room context. You may recall only messages sent by your own session; human room administrators can recall any message in a room they administer, except server notices, which are not recallable.
|
|
132
132
|
|
|
133
133
|
```json
|
|
134
134
|
{"action":"recall","roomId":"<room-id>","messageId":"<message-id>"}
|
|
@@ -532,9 +532,10 @@ export async function recallMessage(file: string, roomID: string, messageID: str
|
|
|
532
532
|
const member = db.query("SELECT name,protocol,host,receiver_owner_id,membership_id FROM registry WHERE room_id=? AND session_id=?")
|
|
533
533
|
.get(roomID, sessionID) as RecallMemberRow | null;
|
|
534
534
|
if (!member) return { status: "member" };
|
|
535
|
-
const message = db.query("SELECT sender_session_id,recalled_at,recalled_by FROM messages WHERE room_id=? AND id=?")
|
|
536
|
-
.get(roomID, messageID) as { sender_session_id: string | null; recalled_at: number | null; recalled_by: string | null } | null;
|
|
535
|
+
const message = db.query("SELECT sender_id,sender_session_id,recalled_at,recalled_by FROM messages WHERE room_id=? AND id=?")
|
|
536
|
+
.get(roomID, messageID) as { sender_id: string; sender_session_id: string | null; recalled_at: number | null; recalled_by: string | null } | null;
|
|
537
537
|
if (!message) return { status: "missing" };
|
|
538
|
+
if (message.sender_id === "system") return { status: "forbidden" };
|
|
538
539
|
const room = {
|
|
539
540
|
ownerId: roomRow.owner_id,
|
|
540
541
|
...(roomRow.owner_membership_id ? { ownerMembershipID: roomRow.owner_membership_id } : {}),
|
|
@@ -61,7 +61,6 @@ async function announcementRaces(page: any, first: string) {
|
|
|
61
61
|
await page.locator("#btnSaveAnnouncement").click();
|
|
62
62
|
await page.waitForFunction(() => document.querySelector("#announcementStatus")?.textContent === "Announcement saved.");
|
|
63
63
|
await page.locator("#announcementDialog").waitFor({ state: "hidden" });
|
|
64
|
-
page.on("dialog", (dialog: any) => dialog.accept());
|
|
65
64
|
await openAnnouncement(page, first);
|
|
66
65
|
const roomId = await page.evaluate((url: string) => import(url).then(({ app }) => app.state.room.id), "/assets/chat/state.js");
|
|
67
66
|
const update = async (value: string) => page.evaluate(async ({ url, id, name, content }: any) => {
|
|
@@ -98,7 +97,8 @@ async function announcementRaces(page: any, first: string) {
|
|
|
98
97
|
await page.unroute(putB.pattern);
|
|
99
98
|
const del = await holdMutation(page, first, "DELETE");
|
|
100
99
|
await closeAnnouncement(page);
|
|
101
|
-
await openAnnouncement(page, first); await page.locator("#btnDeleteAnnouncement").click();
|
|
100
|
+
await openAnnouncement(page, first); await page.locator("#btnDeleteAnnouncement").click();
|
|
101
|
+
await page.locator("#confirmDialog").waitFor({ state: "visible" }); await page.locator("#btnAcceptConfirm").click(); await del.started;
|
|
102
102
|
await closeAnnouncement(page);
|
|
103
103
|
await openAnnouncement(page, second); await page.locator(content).fill("B survives delete");
|
|
104
104
|
del.release(); await del.done;
|
|
@@ -122,6 +122,7 @@ async function announcementRaces(page: any, first: string) {
|
|
|
122
122
|
await page.unroute(`**/rooms/*/announcements/__Test_FailedDraft`);
|
|
123
123
|
await closeAnnouncement(page);
|
|
124
124
|
await openAnnouncement(page, second); await page.locator("#btnDeleteAnnouncement").click();
|
|
125
|
+
await page.locator("#confirmDialog").waitFor({ state: "visible" }); await page.locator("#btnAcceptConfirm").click();
|
|
125
126
|
await page.waitForFunction(() => document.querySelector("#announcementStatus")?.textContent === "Announcement deleted.");
|
|
126
127
|
await page.locator("#announcementDialog").waitFor({ state: "hidden" });
|
|
127
128
|
expect(await page.locator("#announcementList button").count()).toBe(0);
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/* Keyboard hints: a small badge over every visible control. */
|
|
2
|
-
.keys-overlay { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
|
|
3
|
-
.keys-marks { position: absolute; inset: 0; }
|
|
4
|
-
.keys-badge {
|
|
5
|
-
position: absolute;
|
|
6
|
-
display: inline-flex;
|
|
7
|
-
align-items: center;
|
|
8
|
-
gap: 2px;
|
|
9
|
-
padding: 2px 4px;
|
|
10
|
-
border: 1px solid rgb(255 255 255 / .22);
|
|
11
|
-
border-radius: 6px;
|
|
12
|
-
color: #f6f8f4;
|
|
13
|
-
background: rgb(12 22 19 / .92);
|
|
14
|
-
box-shadow: 0 2px 8px rgb(0 0 0 / .28);
|
|
15
|
-
font: 600 9.5px/1 var(--font-mono);
|
|
16
|
-
white-space: nowrap;
|
|
17
|
-
}
|
|
18
|
-
.keys-badge.is-real { color: var(--accent-ink); background: var(--accent); border-color: color-mix(in srgb, var(--accent-ink) 35%, transparent); }
|
|
19
|
-
.keys-badge .keys-key { height: 15px; min-width: 15px; padding: 0 3px; border-width: 1px; border-bottom-width: 2px; border-radius: 4px; border-color: rgb(255 255 255 / .3); background: rgb(255 255 255 / .14); box-shadow: none; color: inherit; font-size: 9px; }
|
|
20
|
-
.keys-badge.is-real .keys-key { border-color: color-mix(in srgb, var(--accent-ink) 32%, transparent); background: color-mix(in srgb, var(--accent-ink) 14%, transparent); }
|
|
21
|
-
.keys-legend {
|
|
22
|
-
position: fixed;
|
|
23
|
-
left: 50%;
|
|
24
|
-
bottom: 18px;
|
|
25
|
-
transform: translateX(-50%);
|
|
26
|
-
display: flex;
|
|
27
|
-
flex-wrap: wrap;
|
|
28
|
-
align-items: center;
|
|
29
|
-
gap: 6px 14px;
|
|
30
|
-
width: min(460px, calc(100vw - 20px));
|
|
31
|
-
padding: 9px 10px 9px 14px;
|
|
32
|
-
border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
|
|
33
|
-
border-radius: 14px;
|
|
34
|
-
background: color-mix(in srgb, var(--surface) 94%, transparent);
|
|
35
|
-
box-shadow: var(--shadow);
|
|
36
|
-
backdrop-filter: blur(10px);
|
|
37
|
-
pointer-events: none;
|
|
38
|
-
}
|
|
39
|
-
.keys-legend-text { flex: 1 1 auto; min-width: 0; margin: 0; color: var(--ink-2); font-size: 12px; line-height: 1.45; }
|
|
40
|
-
.keys-legend-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
|
|
41
|
-
.keys-legend-btn { min-height: 34px; padding: 6px 8px; border: 1px solid transparent; border-radius: 8px; color: var(--accent); background: transparent; font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; }
|
|
42
|
-
.keys-legend-btn, .keys-legend-close { pointer-events: auto; }
|
|
43
|
-
.keys-legend-btn:hover { border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); background: var(--accent-soft); }
|
|
44
|
-
.keys-legend-close { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid transparent; border-radius: 9px; color: var(--ink-2); background: transparent; cursor: pointer; }
|
|
45
|
-
.keys-legend-close:hover { border-color: var(--line); color: var(--ink); background: var(--surface-2); }
|
|
46
|
-
.keys-legend-btn:focus-visible, .keys-legend-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
47
|
-
@media (max-width: 560px) {
|
|
48
|
-
.keys-legend { gap: 2px 8px; padding: 7px 8px 7px 11px; }
|
|
49
|
-
.keys-legend-text { font-size: 11px; }
|
|
50
|
-
}
|
|
51
|
-
|