@alexsun-top/opencode-chat-room 0.7.0 → 0.7.2
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 +24 -0
- package/README.md +4 -4
- package/README.zh-CN.md +4 -4
- package/package.json +1 -1
- package/server/assets/base.css +4 -1
- package/server/assets/chat/create-room-dialog.js +49 -0
- package/server/assets/chat/editor.js +28 -9
- package/server/assets/chat/events.js +41 -23
- package/server/assets/chat/history-loader.js +1 -0
- package/server/assets/chat/image-zoom.js +49 -16
- package/server/assets/chat/index.js +2 -0
- package/server/assets/chat/locales/de.js +6 -2
- package/server/assets/chat/locales/es.js +6 -2
- package/server/assets/chat/locales/fr.js +6 -2
- package/server/assets/chat/locales/it.js +6 -2
- package/server/assets/chat/locales/ja.js +6 -2
- package/server/assets/chat/locales/ko.js +6 -2
- package/server/assets/chat/markdown.js +7 -1
- package/server/assets/chat/members.js +2 -0
- package/server/assets/chat/messages.js +1 -0
- package/server/assets/chat/questions.js +1 -0
- package/server/assets/chat/room-list.js +9 -1
- package/server/assets/chat/rooms.js +23 -9
- package/server/assets/chat/settings.js +40 -1
- package/server/assets/chat/shortcuts.js +137 -14
- package/server/assets/chat/state.js +14 -6
- package/server/assets/chat/viewport.js +3 -0
- package/server/assets/conversation.css +22 -19
- package/server/assets/responsive.css +52 -0
- package/server/assets/room-create.css +86 -0
- package/server/assets/settings.css +93 -35
- package/server/chat-server.ts +3 -3
- package/server/chat.html +138 -72
- package/server/sw.js +1 -0
- package/skills/chatroom/SKILL.md +2 -1
|
@@ -11,7 +11,7 @@ export const es = {
|
|
|
11
11
|
requireApproval: "Requerir aprobación para entrar", requireApprovalHint: "Los nuevos miembros necesitan la aprobación de un administrador humano. Los Agent también pueden ser aprobados por el Agent administrador.",
|
|
12
12
|
joinPolicyEditHint: "Los nuevos miembros necesitan la aprobación de un administrador humano. Si lo desactivas, se borrarán todas las solicitudes pendientes.", joinPolicyOpenConfirm: "¿Desactivar la aprobación? Se borrarán todas las solicitudes de entrada pendientes.",
|
|
13
13
|
approvalRequired: "Aprobación necesaria", joinRequired: "Aprobación necesaria", joinPendingStatus: "Aprobación pendiente",
|
|
14
|
-
joinPendingTitle: "Esperando aprobación", joinPendingBody: ({ name }) => `Tu solicitud para entrar en «${name}» se ha enviado. Un administrador humano debe aprobarla antes de que puedas entrar.`,
|
|
14
|
+
joinPendingTitle: "Esperando aprobación", joinApprovalPrompt: ({ name }) => `¿Solicitar unirte a «${name}»? Un administrador humano debe aprobarlo.`, joinPendingBody: ({ name }) => `Tu solicitud para entrar en «${name}» se ha enviado. Un administrador humano debe aprobarla antes de que puedas entrar.`,
|
|
15
15
|
joinPendingHint: "Puedes salir de esta página; la solicitud seguirá pendiente. Revisa la lista de salas más tarde.", joinPendingNotice: ({ name }) => `Solicitud enviada para entrar en «${name}». Esperando a un administrador humano.`, joinPendingCancel: "Cancelar solicitud", joinPendingCancelError: "No se pudo cancelar la solicitud. Inténtalo de nuevo.",
|
|
16
16
|
joinPendingGoneTitle: "La solicitud ya no está pendiente", joinPendingGoneBody: "Es posible que se haya denegado o borrado. Puedes enviar una nueva solicitud.", joinPendingAgain: "Volver a solicitarlo",
|
|
17
17
|
joinPendingError: "No se pudo comprobar la solicitud. Inténtalo de nuevo.", joinPendingRoomGone: "Esta sala ya no existe o ya no tienes acceso.",
|
|
@@ -56,6 +56,10 @@ export const es = {
|
|
|
56
56
|
settings: "Ajustes", adminAccess: "Administración", adminToken: "Token de administración", openAdministration: "Abrir administración", administration: "Administración", designations: "Designaciones", adminRoom: "Sala de administración", targetRoom: "Sala de membresía del Agent", adminScopeNote: "Elige un Agent en la sala de administración. Los administradores pueden gestionar todas las salas.", targetAgent: "Agent registrado", designate: "Designar administrador", revokeDesignation: "Revocar designación", globalStatus: "Estado global", adminTasks: "Tareas", taskText: "Tarea", dispatchTask: "Enviar tarea", timers: "Temporizadores", planName: "Nombre del temporizador", createTimer: "Crear temporizador", tokenRequired: "El servidor requiere un token de acceso (401).",
|
|
57
57
|
themeLabel: "Tema", themeSystem: "Sistema", themeLight: "Claro", themeDark: "Oscuro", themeForest: "Bosque", themeSand: "Arena",
|
|
58
58
|
settingsLocalHint: "El idioma y el tema se guardan en este navegador.",
|
|
59
|
+
settingsSections: "Secciones de ajustes", settingsGeneral: "General", settingsAppearance: "Apariencia", settingsConnection: "Conexión",
|
|
60
|
+
settingsLanguageHint: "Se aplica al instante y se guarda en este navegador.", settingsThemeHint: "Se guarda en este navegador. Sistema sigue tu dispositivo.", settingsTokenHint: "Solo se guarda en este navegador. Solo se necesita cuando el servidor lo pide.",
|
|
61
|
+
contentTransition: "Transición del contenido", contentTransitionHint: "Desliza los mensajes según la dirección al cambiar de sala con Alt+flechas. Desactivado por defecto.",
|
|
62
|
+
pageStep: "Distancia de página", pageStepHint: "Cuánto avanzan PageUp y PageDown por pulsación, como porcentaje de la altura de la conversación. 90 % por defecto.",
|
|
59
63
|
adminLoading: "Cargando administración…", refreshAdmin: "Actualizar", adminRoomBadge: "admin", chooseAdminRoom: "Elige una sala normal", chooseTargetRoom: "Elige una sala de Agent", chooseAgent: "Elige un Agent registrado", taskTargetRoom: "Sala de destino", taskTargetAgent: "Agent de destino", createAdminRoomFirst: "Crea primero una sala normal y luego selecciónala como sala de administración.", noAgents: "No hay Agent registrados", selectAdminAgent: "Elige una sala de administración y un Agent registrado.", adminDesignated: "La designación de administrador está activa de inmediato y se mantiene hasta que la revoques.", revokeConfirm: "¿Revocar esta designación de administrador? La sala normal se mantendrá.", updateTask: "Actualizar tarea", task_pending: "Pendiente", task_working: "En curso", task_blocked: "Bloqueada", task_completed: "Completada", task_cancelled: "Cancelada", nextRun: ({ time, minutes }) => `Cada ${minutes} min · próxima ${time}`, paused: "En pausa", pauseTimer: "Pausar", resumeTimer: "Reanudar", deleteTimer: "Eliminar", deleteTimerConfirm: ({ name }) => `¿Eliminar el temporizador «${name}»?`,
|
|
60
64
|
leave: "Salir", reconnecting: "Conexión perdida. Reintentando…", messageList: "Lista de mensajes",
|
|
61
65
|
noMessages: "Aún no hay mensajes. Di algo.", latestMessages: "Volver a los mensajes más recientes",
|
|
@@ -75,7 +79,7 @@ export const es = {
|
|
|
75
79
|
shortcutsOpen: "Todos los atajos",
|
|
76
80
|
shortcutsWriting: "Escritura", shortcutsSend: "Enviar el mensaje", shortcutsNewline: "Empezar una línea nueva",
|
|
77
81
|
shortcutsMention: "Elegir un miembro para mencionar", shortcutsRooms: "Salas",
|
|
78
|
-
shortcutsSwitchRoom: "Cambiar a la sala anterior o siguiente", shortcutsReading: "Lectura",
|
|
82
|
+
shortcutsSwitchRoom: "Cambiar a la sala anterior o siguiente", shortcutsNumberRoom: "Cambiar a una sala unida por número", shortcutsReading: "Lectura",
|
|
79
83
|
shortcutsScroll: "Desplazar los mensajes mientras escribes", shortcutsJump: "Ir al principio o al final de la conversación", shortcutsMenus: "Menús y diálogos",
|
|
80
84
|
shortcutsClose: "Cerrar el menú, panel o diálogo abierto",
|
|
81
85
|
earlierMessages: "Se han omitido mensajes anteriores", messagesBetweenOmitted: "Se han omitido los mensajes entre este punto de lectura y los más recientes.", you: "Tú", saved: "Guardado",
|
|
@@ -11,7 +11,7 @@ export const fr = {
|
|
|
11
11
|
requireApproval: "Exiger une approbation pour rejoindre", requireApprovalHint: "Les nouveaux membres doivent être approuvés par un administrateur humain. Les agents peuvent aussi être approuvés par l’agent administrateur.",
|
|
12
12
|
joinPolicyEditHint: "Les nouveaux membres doivent être approuvés par un administrateur humain. Désactiver cette option efface toutes les demandes en attente.", joinPolicyOpenConfirm: "Désactiver l’approbation ? Toutes les demandes d’adhésion en attente seront effacées.",
|
|
13
13
|
approvalRequired: "Approbation requise", joinRequired: "Approbation requise", joinPendingStatus: "En attente d’approbation",
|
|
14
|
-
joinPendingTitle: "En attente d’approbation", joinPendingBody: ({ name }) => `Votre demande pour rejoindre «\u00A0${name}\u00A0» a été envoyée. Un administrateur humain doit l’approuver avant que vous puissiez entrer.`,
|
|
14
|
+
joinPendingTitle: "En attente d’approbation", joinApprovalPrompt: ({ name }) => `Demander à rejoindre «\u00A0${name}\u00A0» ? Un administrateur humain doit approuver.`, joinPendingBody: ({ name }) => `Votre demande pour rejoindre «\u00A0${name}\u00A0» a été envoyée. Un administrateur humain doit l’approuver avant que vous puissiez entrer.`,
|
|
15
15
|
joinPendingHint: "Vous pouvez quitter cette page ; la demande reste en attente. Consultez la liste des salons plus tard.", joinPendingNotice: ({ name }) => `Demande envoyée pour rejoindre «\u00A0${name}\u00A0». En attente d’un administrateur humain.`, joinPendingCancel: "Annuler la demande", joinPendingCancelError: "Impossible d’annuler la demande. Réessayez.",
|
|
16
16
|
joinPendingGoneTitle: "Demande plus en attente", joinPendingGoneBody: "Elle a peut-être été refusée ou effacée. Vous pouvez envoyer une nouvelle demande.", joinPendingAgain: "Redemander",
|
|
17
17
|
joinPendingError: "Impossible de vérifier la demande. Réessayez.", joinPendingRoomGone: "Ce salon n’existe plus, ou vous n’y avez plus accès.",
|
|
@@ -57,6 +57,10 @@ export const fr = {
|
|
|
57
57
|
adminLoading: "Chargement de l’administration…", refreshAdmin: "Actualiser", adminRoomBadge: "admin", chooseAdminRoom: "Choisir un salon normal", chooseTargetRoom: "Choisir un salon d’agent", chooseAgent: "Choisir un agent enregistré", taskTargetRoom: "Salon cible", taskTargetAgent: "Agent cible", createAdminRoomFirst: "Créez d’abord un salon normal, puis sélectionnez-le comme salon d’administration.", noAgents: "Aucun agent enregistré", selectAdminAgent: "Choisissez un salon d’administration et un agent enregistré.", adminDesignated: "La désignation d’administrateur prend effet immédiatement et reste active jusqu’à sa révocation.", revokeConfirm: "Révoquer cette désignation d’administrateur ? Le salon normal sera conservé.", updateTask: "Mettre à jour la tâche", task_pending: "En attente", task_working: "En cours", task_blocked: "Bloquée", task_completed: "Terminée", task_cancelled: "Annulée", nextRun: ({ time, minutes }) => `Toutes les ${minutes} min · prochain : ${time}`, paused: "En pause", pauseTimer: "Mettre en pause", resumeTimer: "Reprendre", deleteTimer: "Supprimer", deleteTimerConfirm: ({ name }) => `Supprimer le minuteur «\u00A0${name}\u00A0» ?`,
|
|
58
58
|
themeLabel: "Thème", themeSystem: "Système", themeLight: "Clair", themeDark: "Sombre", themeForest: "Forêt", themeSand: "Sable",
|
|
59
59
|
settingsLocalHint: "La langue et le thème sont enregistrés dans ce navigateur.",
|
|
60
|
+
settingsSections: "Sections des réglages", settingsGeneral: "Général", settingsAppearance: "Apparence", settingsConnection: "Connexion",
|
|
61
|
+
settingsLanguageHint: "S'applique immédiatement et est enregistré dans ce navigateur.", settingsThemeHint: "Enregistré dans ce navigateur. Système suit votre appareil.", settingsTokenHint: "Stocké uniquement dans ce navigateur. Nécessaire seulement si le serveur le demande.",
|
|
62
|
+
contentTransition: "Transition du contenu", contentTransitionHint: "Faites glisser les messages dans le sens du changement de salon avec Alt+flèches. Désactivé par défaut.",
|
|
63
|
+
pageStep: "Distance de défilement", pageStepHint: "Distance parcourue par PageUp et PageDown à chaque appui, en pourcentage de la hauteur de la conversation. 90 % par défaut.",
|
|
60
64
|
leave: "Quitter", reconnecting: "Connexion perdue. Nouvelle tentative…", messageList: "Liste des messages",
|
|
61
65
|
noMessages: "Aucun message pour l’instant. Dites quelque chose.", latestMessages: "Revenir aux derniers messages",
|
|
62
66
|
mentionMembers: "Choisissez un membre à mentionner", messagePlaceholder: "Message · Entrée pour envoyer",
|
|
@@ -75,7 +79,7 @@ export const fr = {
|
|
|
75
79
|
shortcutsOpen: "Tous les raccourcis",
|
|
76
80
|
shortcutsWriting: "Rédaction", shortcutsSend: "Envoyer le message", shortcutsNewline: "Passer à la ligne",
|
|
77
81
|
shortcutsMention: "Choisir un membre à mentionner", shortcutsRooms: "Salons",
|
|
78
|
-
shortcutsSwitchRoom: "Passer au salon précédent ou suivant", shortcutsReading: "Lecture",
|
|
82
|
+
shortcutsSwitchRoom: "Passer au salon précédent ou suivant", shortcutsNumberRoom: "Passer à un salon rejoint par son numéro", shortcutsReading: "Lecture",
|
|
79
83
|
shortcutsScroll: "Faire défiler les messages pendant la saisie", shortcutsJump: "Aller au début ou à la fin de la conversation", shortcutsMenus: "Menus et boîtes de dialogue",
|
|
80
84
|
shortcutsClose: "Fermer le menu, le panneau ou la boîte de dialogue ouverts",
|
|
81
85
|
earlierMessages: "Messages précédents omis", messagesBetweenOmitted: "Les messages entre ce point de lecture et les derniers sont omis.", you: "Vous", saved: "Enregistré",
|
|
@@ -11,7 +11,7 @@ export const it = {
|
|
|
11
11
|
requireApproval: "Richiedi approvazione per entrare", requireApprovalHint: "I nuovi membri devono essere approvati da un amministratore umano. Gli Agent possono essere approvati anche dall’Agent amministratore.",
|
|
12
12
|
joinPolicyEditHint: "I nuovi membri devono essere approvati da un amministratore umano. Disattivando questa opzione, tutte le richieste in sospeso verranno cancellate.", joinPolicyOpenConfirm: "Disattivare l’approvazione? Tutte le richieste di accesso in sospeso verranno cancellate.",
|
|
13
13
|
approvalRequired: "Approvazione richiesta", joinRequired: "Approvazione richiesta", joinPendingStatus: "In attesa di approvazione",
|
|
14
|
-
joinPendingTitle: "In attesa di approvazione", joinPendingBody: ({ name }) => `La tua richiesta di entrare in «${name}» è stata inviata. Un amministratore umano deve approvarla prima che tu possa entrare.`,
|
|
14
|
+
joinPendingTitle: "In attesa di approvazione", joinApprovalPrompt: ({ name }) => `Vuoi chiedere di entrare in «${name}»? Un amministratore umano deve approvarlo.`, joinPendingBody: ({ name }) => `La tua richiesta di entrare in «${name}» è stata inviata. Un amministratore umano deve approvarla prima che tu possa entrare.`,
|
|
15
15
|
joinPendingHint: "Puoi lasciare questa pagina; la richiesta rimane in sospeso. Controlla più tardi l’elenco delle stanze.", joinPendingNotice: ({ name }) => `Richiesta inviata per entrare in «${name}». In attesa di un amministratore umano.`, joinPendingCancel: "Annulla richiesta", joinPendingCancelError: "Impossibile annullare la richiesta. Riprova.",
|
|
16
16
|
joinPendingGoneTitle: "Richiesta non più in sospeso", joinPendingGoneBody: "Potrebbe essere stata rifiutata o cancellata. Puoi inviare una nuova richiesta.", joinPendingAgain: "Invia di nuovo la richiesta",
|
|
17
17
|
joinPendingError: "Impossibile verificare la richiesta. Riprova.", joinPendingRoomGone: "Questa stanza non esiste più o non hai più accesso.",
|
|
@@ -56,6 +56,10 @@ export const it = {
|
|
|
56
56
|
settings: "Impostazioni", adminAccess: "Amministrazione", adminToken: "Token di amministrazione", openAdministration: "Apri amministrazione", administration: "Amministrazione", designations: "Designazioni", adminRoom: "Stanza di amministrazione", targetRoom: "Stanza di appartenenza dell’Agent", adminScopeNote: "Scegli un Agent nella stanza di amministrazione. Gli amministratori possono gestire tutte le stanze.", targetAgent: "Agent registrato", designate: "Designa amministratore", revokeDesignation: "Revoca designazione", globalStatus: "Stato globale", adminTasks: "Attività", taskText: "Attività", dispatchTask: "Invia attività", timers: "Timer", planName: "Nome del timer", createTimer: "Crea timer", tokenRequired: "Il server richiede un token di accesso (401).",
|
|
57
57
|
themeLabel: "Tema", themeSystem: "Sistema", themeLight: "Chiaro", themeDark: "Scuro", themeForest: "Foresta", themeSand: "Sabbia",
|
|
58
58
|
settingsLocalHint: "La lingua e il tema vengono salvati in questo browser.",
|
|
59
|
+
settingsSections: "Sezioni delle impostazioni", settingsGeneral: "Generali", settingsAppearance: "Aspetto", settingsConnection: "Connessione",
|
|
60
|
+
settingsLanguageHint: "Si applica subito e viene salvato in questo browser.", settingsThemeHint: "Salvato in questo browser. Sistema segue il dispositivo.", settingsTokenHint: "Salvato solo in questo browser. Serve solo quando il server lo richiede.",
|
|
61
|
+
contentTransition: "Transizione dei contenuti", contentTransitionHint: "Fai scorrere i messaggi nella direzione del cambio stanza con Alt+frecce. Disattivato per impostazione predefinita.",
|
|
62
|
+
pageStep: "Distanza di scorrimento", pageStepHint: "Quanto scorrono PageUp e PageDown a ogni pressione, in percentuale dell'altezza della conversazione. 90% per impostazione predefinita.",
|
|
59
63
|
adminLoading: "Caricamento dell’amministrazione…", refreshAdmin: "Aggiorna", adminRoomBadge: "admin", chooseAdminRoom: "Scegli una stanza normale", chooseTargetRoom: "Scegli una stanza dell’Agent", chooseAgent: "Scegli un Agent registrato", taskTargetRoom: "Stanza di destinazione", taskTargetAgent: "Agent di destinazione", createAdminRoomFirst: "Crea prima una stanza normale, poi selezionala come stanza di amministrazione.", noAgents: "Nessun Agent registrato", selectAdminAgent: "Scegli una stanza di amministrazione e un Agent registrato.", adminDesignated: "La designazione di amministratore è attiva subito e resta finché non la revochi.", revokeConfirm: "Revocare questa designazione di amministratore? La stanza normale rimarrà.", updateTask: "Aggiorna attività", task_pending: "In sospeso", task_working: "In corso", task_blocked: "Bloccata", task_completed: "Completata", task_cancelled: "Annullata", nextRun: ({ time, minutes }) => `Ogni ${minutes} min · prossima ${time}`, paused: "In pausa", pauseTimer: "Sospendi", resumeTimer: "Riprendi", deleteTimer: "Elimina", deleteTimerConfirm: ({ name }) => `Eliminare il timer «${name}»?`,
|
|
60
64
|
leave: "Esci", reconnecting: "Connessione persa. Nuovo tentativo…", messageList: "Elenco dei messaggi",
|
|
61
65
|
noMessages: "Nessun messaggio. Scrivi qualcosa.", latestMessages: "Torna ai messaggi più recenti",
|
|
@@ -75,7 +79,7 @@ export const it = {
|
|
|
75
79
|
shortcutsOpen: "Tutte le scorciatoie",
|
|
76
80
|
shortcutsWriting: "Scrittura", shortcutsSend: "Invia il messaggio", shortcutsNewline: "Vai a capo",
|
|
77
81
|
shortcutsMention: "Scegli un membro da menzionare", shortcutsRooms: "Stanze",
|
|
78
|
-
shortcutsSwitchRoom: "Passa alla stanza precedente o successiva", shortcutsReading: "Lettura",
|
|
82
|
+
shortcutsSwitchRoom: "Passa alla stanza precedente o successiva", shortcutsNumberRoom: "Passa a una stanza partecipata per numero", shortcutsReading: "Lettura",
|
|
79
83
|
shortcutsScroll: "Scorri i messaggi mentre scrivi", shortcutsJump: "Vai all’inizio o alla fine della conversazione", shortcutsMenus: "Menu e finestre di dialogo",
|
|
80
84
|
shortcutsClose: "Chiudi il menu, il pannello o la finestra di dialogo aperti",
|
|
81
85
|
earlierMessages: "Messaggi precedenti omessi", messagesBetweenOmitted: "I messaggi tra questo punto di lettura e i più recenti sono omessi.", you: "Tu", saved: "Salvato",
|
|
@@ -12,7 +12,7 @@ export const ja = {
|
|
|
12
12
|
requireApproval: "参加に承認を必須にする", requireApprovalHint: "新しいメンバーは人間の管理者の承認が必要です。Agent は管理者 Agent が承認することもできます。",
|
|
13
13
|
joinPolicyEditHint: "新しいメンバーは人間の管理者の承認が必要です。オフにすると保留中の申請はすべて削除されます。", joinPolicyOpenConfirm: "承認をオフにしますか?保留中の参加申請はすべて削除されます。",
|
|
14
14
|
approvalRequired: "承認が必要", joinRequired: "承認が必要", joinPendingStatus: "承認待ち",
|
|
15
|
-
joinPendingTitle: "承認を待っています", joinPendingBody: ({ name }) => `「${name}」への参加申請を送信しました。参加するには人間の管理者の承認が必要です。`,
|
|
15
|
+
joinPendingTitle: "承認を待っています", joinApprovalPrompt: ({ name }) => `「${name}」への参加を申請しますか?人間の管理者の承認が必要です。`, joinPendingBody: ({ name }) => `「${name}」への参加申請を送信しました。参加するには人間の管理者の承認が必要です。`,
|
|
16
16
|
joinPendingHint: "このページを離れても申請は保留されます。後でルーム一覧を確認してください。", joinPendingNotice: ({ name }) => `「${name}」への参加申請を送信しました。人間の管理者の承認を待っています。`, joinPendingCancel: "申請をキャンセル", joinPendingCancelError: "申請をキャンセルできませんでした。もう一度お試しください。",
|
|
17
17
|
joinPendingGoneTitle: "保留中の申請はありません", joinPendingGoneBody: "拒否または削除された可能性があります。新しい申請を送信できます。", joinPendingAgain: "再申請",
|
|
18
18
|
joinPendingError: "申請を確認できませんでした。もう一度お試しください。", joinPendingRoomGone: "このルームは存在しないか、アクセス権がありません。",
|
|
@@ -57,6 +57,10 @@ export const ja = {
|
|
|
57
57
|
settings: "設定", adminAccess: "管理", adminToken: "管理トークン", openAdministration: "管理画面を開く", administration: "管理", designations: "指定", adminRoom: "管理ルーム", targetRoom: "Agent の所属ルーム", adminScopeNote: "管理ルーム内の Agent を選択してください。管理者はすべてのルームを管理できます。", targetAgent: "登録済み Agent", designate: "管理者に指定", revokeDesignation: "指定を解除", globalStatus: "全体ステータス", adminTasks: "タスク", taskText: "タスク", dispatchTask: "タスクを送信", timers: "タイマー", planName: "タイマー名", createTimer: "タイマーを作成", tokenRequired: "サーバーはアクセストークンを要求しています(401)。",
|
|
58
58
|
themeLabel: "テーマ", themeSystem: "システム", themeLight: "ライト", themeDark: "ダーク", themeForest: "フォレスト", themeSand: "サンド",
|
|
59
59
|
settingsLocalHint: "言語とテーマはこのブラウザに保存されます。",
|
|
60
|
+
settingsSections: "設定セクション", settingsGeneral: "一般", settingsAppearance: "外観", settingsConnection: "接続",
|
|
61
|
+
settingsLanguageHint: "すぐに反映され、このブラウザに保存されます。", settingsThemeHint: "このブラウザに保存されます。システムは端末の設定に従います。", settingsTokenHint: "このブラウザにのみ保存されます。サーバーから求められた場合にのみ必要です。",
|
|
62
|
+
contentTransition: "ルーム内容のトランジション", contentTransitionHint: "Alt+矢印キーでルームを切り替えるとき、メッセージ内容を方向に沿ってスライドします。既定ではオフです。",
|
|
63
|
+
pageStep: "ページ送り距離", pageStepHint: "PageUp・PageDown を押すたびにスクロールする距離(会話領域の高さに対する割合)。既定は 90%。",
|
|
60
64
|
adminLoading: "管理画面を読み込み中…", refreshAdmin: "更新", adminRoomBadge: "管理者", chooseAdminRoom: "通常のルームを選択", chooseTargetRoom: "Agent ルームを選択", chooseAgent: "登録済み Agent を選択", taskTargetRoom: "対象ルーム", taskTargetAgent: "対象 Agent", createAdminRoomFirst: "先に通常のルームを作成し、管理ルームとして選択してください。", noAgents: "登録済み Agent はありません", selectAdminAgent: "管理ルームと登録済み Agent を選択してください。", adminDesignated: "管理者の指定はすぐに有効になり、解除するまで続きます。", revokeConfirm: "この管理者指定を解除しますか?通常のルームは残ります。", updateTask: "タスクを更新", task_pending: "待機中", task_working: "作業中", task_blocked: "ブロック中", task_completed: "完了", task_cancelled: "キャンセル済み", nextRun: ({ time, minutes }) => `${minutes} 分ごと · 次回 ${time}`, paused: "一時停止中", pauseTimer: "一時停止", resumeTimer: "再開", deleteTimer: "削除", deleteTimerConfirm: ({ name }) => `タイマー「${name}」を削除しますか?`,
|
|
61
65
|
leave: "退出", reconnecting: "接続が切れました。再接続中…", messageList: "メッセージ一覧",
|
|
62
66
|
noMessages: "メッセージはまだありません。何か書き込みましょう。", latestMessages: "最新のメッセージに戻る",
|
|
@@ -75,7 +79,7 @@ export const ja = {
|
|
|
75
79
|
shortcutsOpen: "すべてのショートカット",
|
|
76
80
|
shortcutsWriting: "入力", shortcutsSend: "メッセージを送信", shortcutsNewline: "改行",
|
|
77
81
|
shortcutsMention: "メンションするメンバーを選択", shortcutsRooms: "ルーム",
|
|
78
|
-
shortcutsSwitchRoom: "前後のルームに切り替え", shortcutsReading: "閲覧",
|
|
82
|
+
shortcutsSwitchRoom: "前後のルームに切り替え", shortcutsNumberRoom: "番号で参加中のルームに切り替え", shortcutsReading: "閲覧",
|
|
79
83
|
shortcutsScroll: "入力中にメッセージをスクロール", shortcutsJump: "会話の先頭または末尾に移動", shortcutsMenus: "メニューとダイアログ",
|
|
80
84
|
shortcutsClose: "開いているメニュー、パネル、ダイアログを閉じる",
|
|
81
85
|
earlierMessages: "以前のメッセージは省略されています", messagesBetweenOmitted: "この閲覧位置と最新の間のメッセージは省略されています。", you: "あなた", saved: "保存済み",
|
|
@@ -12,7 +12,7 @@ export const ko = {
|
|
|
12
12
|
requireApproval: "참여 승인 필요", requireApprovalHint: "새 멤버는 사람 관리자의 승인이 필요합니다. Agent는 관리자 Agent가 승인할 수도 있습니다.",
|
|
13
13
|
joinPolicyEditHint: "새 멤버는 사람 관리자의 승인이 필요합니다. 끄면 대기 중인 모든 신청이 삭제됩니다.", joinPolicyOpenConfirm: "승인을 끌까요? 대기 중인 참여 신청이 모두 삭제됩니다.",
|
|
14
14
|
approvalRequired: "승인 필요", joinRequired: "승인 필요", joinPendingStatus: "승인 대기 중",
|
|
15
|
-
joinPendingTitle: "승인을 기다리는 중", joinPendingBody: ({ name }) => `“${name}” 방 참여 신청을 보냈습니다. 참여하려면 사람 관리자의 승인이 필요합니다.`,
|
|
15
|
+
joinPendingTitle: "승인을 기다리는 중", joinApprovalPrompt: ({ name }) => `“${name}” 방에 참여를 요청할까요? 사람 관리자의 승인이 필요합니다.`, joinPendingBody: ({ name }) => `“${name}” 방 참여 신청을 보냈습니다. 참여하려면 사람 관리자의 승인이 필요합니다.`,
|
|
16
16
|
joinPendingHint: "이 페이지를 나가도 신청은 유지됩니다. 나중에 방 목록에서 확인하세요.", joinPendingNotice: ({ name }) => `“${name}” 방 참여 신청을 보냈습니다. 사람 관리자의 승인을 기다리는 중입니다.`, joinPendingCancel: "신청 취소", joinPendingCancelError: "신청을 취소하지 못했습니다. 다시 시도하세요.",
|
|
17
17
|
joinPendingGoneTitle: "대기 중인 신청이 없습니다", joinPendingGoneBody: "거절되었거나 삭제되었을 수 있습니다. 새로 신청할 수 있습니다.", joinPendingAgain: "다시 신청",
|
|
18
18
|
joinPendingError: "신청을 확인하지 못했습니다. 다시 시도하세요.", joinPendingRoomGone: "이 방은 없어졌거나 더 이상 접근할 수 없습니다.",
|
|
@@ -57,6 +57,10 @@ export const ko = {
|
|
|
57
57
|
settings: "설정", adminAccess: "관리", adminToken: "관리 토큰", openAdministration: "관리 열기", administration: "관리", designations: "지정", adminRoom: "관리 방", targetRoom: "Agent 소속 방", adminScopeNote: "관리 방에서 Agent를 선택하세요. 관리자는 모든 방을 관리할 수 있습니다.", targetAgent: "등록된 Agent", designate: "관리자로 지정", revokeDesignation: "지정 해제", globalStatus: "전체 상태", adminTasks: "작업", taskText: "작업", dispatchTask: "작업 보내기", timers: "타이머", planName: "타이머 이름", createTimer: "타이머 만들기", tokenRequired: "서버가 액세스 토큰을 요구합니다(401).",
|
|
58
58
|
themeLabel: "테마", themeSystem: "시스템", themeLight: "라이트", themeDark: "다크", themeForest: "포레스트", themeSand: "샌드",
|
|
59
59
|
settingsLocalHint: "언어와 테마는 이 브라우저에 저장됩니다.",
|
|
60
|
+
settingsSections: "설정 섹션", settingsGeneral: "일반", settingsAppearance: "모양", settingsConnection: "연결",
|
|
61
|
+
settingsLanguageHint: "즉시 적용되며 이 브라우저에 저장됩니다.", settingsThemeHint: "이 브라우저에 저장됩니다. 시스템은 기기 설정을 따릅니다.", settingsTokenHint: "이 브라우저에만 저장됩니다. 서버에서 요구할 때만 필요합니다.",
|
|
62
|
+
contentTransition: "방 콘텐츠 전환", contentTransitionHint: "Alt+방향키로 방을 전환할 때 메시지 내용을 방향에 맞춰 슬라이드합니다. 기본값은 꺼짐입니다.",
|
|
63
|
+
pageStep: "페이지 이동 거리", pageStepHint: "PageUp 또는 PageDown을 누를 때마다 스크롤할 거리(대화 영역 높이의 백분율). 기본값 90%.",
|
|
60
64
|
adminLoading: "관리 화면 불러오는 중…", refreshAdmin: "새로 고침", adminRoomBadge: "관리", chooseAdminRoom: "일반 방 선택", chooseTargetRoom: "Agent 방 선택", chooseAgent: "등록된 Agent 선택", taskTargetRoom: "대상 방", taskTargetAgent: "대상 Agent", createAdminRoomFirst: "먼저 일반 방을 만든 다음 관리 방으로 선택하세요.", noAgents: "등록된 Agent 없음", selectAdminAgent: "관리 방과 등록된 Agent를 선택하세요.", adminDesignated: "관리자 지정은 즉시 적용되며 해제할 때까지 유지됩니다.", revokeConfirm: "이 관리자 지정을 해제할까요? 일반 방은 그대로 남습니다.", updateTask: "작업 업데이트", task_pending: "대기 중", task_working: "작업 중", task_blocked: "차단됨", task_completed: "완료", task_cancelled: "취소됨", nextRun: ({ time, minutes }) => `${minutes}분마다 · 다음 ${time}`, paused: "일시 중지됨", pauseTimer: "일시 중지", resumeTimer: "재개", deleteTimer: "삭제", deleteTimerConfirm: ({ name }) => `타이머 “${name}”을(를) 삭제할까요?`,
|
|
61
65
|
leave: "나가기", reconnecting: "연결이 끊겼습니다. 다시 연결하는 중…", messageList: "메시지 목록",
|
|
62
66
|
noMessages: "아직 메시지가 없습니다. 무언가 남겨 보세요.", latestMessages: "최신 메시지로 돌아가기",
|
|
@@ -75,7 +79,7 @@ export const ko = {
|
|
|
75
79
|
shortcutsOpen: "모든 단축키",
|
|
76
80
|
shortcutsWriting: "작성", shortcutsSend: "메시지 보내기", shortcutsNewline: "줄 바꾸기",
|
|
77
81
|
shortcutsMention: "멘션할 멤버 선택", shortcutsRooms: "방",
|
|
78
|
-
shortcutsSwitchRoom: "이전 또는 다음 방으로 전환", shortcutsReading: "읽기",
|
|
82
|
+
shortcutsSwitchRoom: "이전 또는 다음 방으로 전환", shortcutsNumberRoom: "번호로 참여 중인 방으로 전환", shortcutsReading: "읽기",
|
|
79
83
|
shortcutsScroll: "입력 중에 메시지 스크롤", shortcutsJump: "대화의 시작이나 끝으로 이동", shortcutsMenus: "메뉴 및 대화 상자",
|
|
80
84
|
shortcutsClose: "열린 메뉴, 패널 또는 대화 상자 닫기",
|
|
81
85
|
earlierMessages: "이전 메시지는 생략됨", messagesBetweenOmitted: "이 읽기 지점과 최신 메시지 사이는 생략되었습니다.", you: "나", saved: "저장됨",
|
|
@@ -76,6 +76,8 @@ function codeToolbar(code, pre, block, app) {
|
|
|
76
76
|
wrap.setAttribute("aria-pressed", "false");
|
|
77
77
|
wrap.addEventListener("click", (event) => {
|
|
78
78
|
event.stopPropagation();
|
|
79
|
+
// A pointer click should not pin the toolbar open; hovering is enough.
|
|
80
|
+
if (event.detail > 0) wrap.blur();
|
|
79
81
|
const wrapped = !block.classList.contains("is-wrapped");
|
|
80
82
|
if (wrapped) block._codeScrollLeft = pre.scrollLeft;
|
|
81
83
|
block.classList.toggle("is-wrapped", wrapped);
|
|
@@ -83,7 +85,11 @@ function codeToolbar(code, pre, block, app) {
|
|
|
83
85
|
pre.scrollLeft = wrapped ? 0 : block._codeScrollLeft || 0;
|
|
84
86
|
});
|
|
85
87
|
const copy = codeToolButton("code-copy-button", "copyMessage", app, copyIcon(), checkIcon());
|
|
86
|
-
copy.addEventListener("click", (event) => {
|
|
88
|
+
copy.addEventListener("click", (event) => {
|
|
89
|
+
event.stopPropagation();
|
|
90
|
+
if (event.detail > 0) copy.blur();
|
|
91
|
+
void copyCode(copy, code, app);
|
|
92
|
+
});
|
|
87
93
|
toolbar.append(wrap, copy);
|
|
88
94
|
return toolbar;
|
|
89
95
|
}
|
|
@@ -11,6 +11,8 @@ export function initMembers(app) {
|
|
|
11
11
|
.map((person) => person.name));
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
app.mentionExists = (name) => name === "all" || name === app.state.myName || app.mentionNames().has(name);
|
|
15
|
+
|
|
14
16
|
app.renderMembers = () => {
|
|
15
17
|
const people = app.state.room?.participants || [];
|
|
16
18
|
app.setText($("#btnMembers .action-label"), "membersCount", { count: people.length });
|
|
@@ -9,6 +9,7 @@ import { initMessagePolling } from "./message-polling.js";
|
|
|
9
9
|
export function initMessages(app) {
|
|
10
10
|
const $ = app.$;
|
|
11
11
|
installEditor($("#msgInput"));
|
|
12
|
+
$("#msgInput").isKnownMention = (name) => app.mentionExists(name);
|
|
12
13
|
|
|
13
14
|
app.autoGrow = (textarea) => {
|
|
14
15
|
const thread = $("#thread"), atBottom = Boolean(app.state.room && Math.abs(thread.scrollHeight - thread.clientHeight - thread.scrollTop) < 1);
|
|
@@ -108,6 +108,7 @@ export function initQuestions(app) {
|
|
|
108
108
|
input.setAttribute("aria-placeholder", app.t("answerPlaceholder"));
|
|
109
109
|
input.setAttribute("aria-label", app.t("answerPlaceholder"));
|
|
110
110
|
installEditor(input);
|
|
111
|
+
input.isKnownMention = (name) => app.mentionExists(name);
|
|
111
112
|
const key = `${roomId}\0${question.id}`;
|
|
112
113
|
input.draftValue = drafts.has(key) ? drafts.get(key) : questionAuthorMention(question, roomId, app);
|
|
113
114
|
input.dataset.empty = input.value ? "false" : "true";
|
|
@@ -45,7 +45,15 @@ export function renderRoomOptions(app, list, rooms) {
|
|
|
45
45
|
badge.setAttribute("aria-label", label);
|
|
46
46
|
button.append(badge);
|
|
47
47
|
}
|
|
48
|
-
button.addEventListener("click", () =>
|
|
48
|
+
button.addEventListener("click", () => {
|
|
49
|
+
const name = app.state.myName || app.$("#inName").value.trim() || app.t("guest");
|
|
50
|
+
// A protected room must ask before turning a click into a join request.
|
|
51
|
+
if (!joined && approval && !pending && app.confirmAction) {
|
|
52
|
+
void app.confirmAction(app.t("joinApprovalPrompt", { name: room.name })).then((ok) => { if (ok) void app.joinRoom(room.id, name); });
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
void app.joinRoom(room.id, name);
|
|
56
|
+
});
|
|
49
57
|
row.append(button);
|
|
50
58
|
list.append(row);
|
|
51
59
|
}
|
|
@@ -122,6 +122,7 @@ export function initRooms(app) {
|
|
|
122
122
|
const entry = app.state.rooms.get(roomId);
|
|
123
123
|
if (!entry) return;
|
|
124
124
|
if (app.state.room?.id === roomId) return;
|
|
125
|
+
app.cancelThreadScrollAnimation?.();
|
|
125
126
|
if (!preserveRoomListGeneration) invalidateRoomList();
|
|
126
127
|
if (app.state.room) {
|
|
127
128
|
app.saveDraft(app.state.room.id, $("#msgInput").draftValue);
|
|
@@ -153,6 +154,16 @@ export function initRooms(app) {
|
|
|
153
154
|
$("#msgInput").draftValue = app.state.drafts.get(roomId) || ""; app.renderReplyPreview?.();
|
|
154
155
|
app.renderFailedMessages();
|
|
155
156
|
app.autoGrow($("#msgInput"));
|
|
157
|
+
// A restored draft and late layout can resize the composer after the initial bottom
|
|
158
|
+
// pin. Keep following for a few frames instead of sampling one fragile moment.
|
|
159
|
+
let settleFrames = 0;
|
|
160
|
+
const settleBottom = () => {
|
|
161
|
+
if (app.state.room?.id !== roomId || !app.state.followBottom) return;
|
|
162
|
+
const thread = $("#thread");
|
|
163
|
+
if (thread.scrollHeight - thread.scrollTop - thread.clientHeight > 1) thread.scrollTop = thread.scrollHeight;
|
|
164
|
+
if (++settleFrames < 30) requestAnimationFrame(settleBottom);
|
|
165
|
+
};
|
|
166
|
+
requestAnimationFrame(settleBottom);
|
|
156
167
|
app.updateDraftCount();
|
|
157
168
|
app.updateSendState();
|
|
158
169
|
app.hideSendError();
|
|
@@ -197,12 +208,15 @@ export function initRooms(app) {
|
|
|
197
208
|
const name = pending?.name || (fromChat ? app.state.myName : $("#inName").value.trim()) || LS.name || app.t("guest");
|
|
198
209
|
const roomName = pending?.roomName || $(fromChat ? "#inRoomNameChat" : "#inRoomName").value.trim();
|
|
199
210
|
const joinPolicy = pending?.joinPolicy ?? ((fromChat ? $("#inApprovalRequiredChat").checked : $("#inApprovalRequired").checked) ? "approval" : "open");
|
|
200
|
-
if (!roomName)
|
|
211
|
+
if (!roomName) {
|
|
212
|
+
if (!fromChat) return app.showJoinError("roomNameRequired");
|
|
213
|
+
app.showCreateRoomError("roomNameRequired"); $("#inRoomNameChat").focus(); return;
|
|
214
|
+
}
|
|
201
215
|
const intent = ++app.state.navigationGeneration; invalidateRoomList();
|
|
202
216
|
app.setJoinBusy(true);
|
|
203
217
|
app.hideJoinError();
|
|
204
218
|
app.state.pendingAction = null;
|
|
205
|
-
if (fromChat) $("#btnCreateChatRoom").disabled = true;
|
|
219
|
+
if (fromChat) { app.hideCreateRoomError(); $("#btnCreateChatRoom").disabled = true; }
|
|
206
220
|
try {
|
|
207
221
|
const room = await app.api("/rooms", {
|
|
208
222
|
method: "POST",
|
|
@@ -212,18 +226,18 @@ export function initRooms(app) {
|
|
|
212
226
|
LS.name = name;
|
|
213
227
|
$("#inApprovalRequired").checked = false;
|
|
214
228
|
$("#inApprovalRequiredChat").checked = false;
|
|
215
|
-
if (fromChat) {
|
|
216
|
-
$("#inRoomNameChat").value = "";
|
|
217
|
-
$("#railRoomForm").hidden = true;
|
|
218
|
-
}
|
|
229
|
+
if (fromChat) { $("#inRoomNameChat").value = ""; app.closeCreateRoomDialog(false); }
|
|
219
230
|
app.enterRoom(room, name, intent);
|
|
220
231
|
} catch (error) {
|
|
221
232
|
if (error.status === 401) {
|
|
222
233
|
app.state.pendingAction = { type: "create", name, roomName, fromChat, joinPolicy };
|
|
223
|
-
if (fromChat) { app.openChatSettings(); app.showSendError("sendAuth"); }
|
|
234
|
+
if (fromChat) { app.closeCreateRoomDialog(false); app.openChatSettings(); app.showSendError("sendAuth"); }
|
|
224
235
|
else { app.openTokenBox(); app.showJoinError("authRetry"); }
|
|
225
|
-
} else if (fromChat) {
|
|
226
|
-
|
|
236
|
+
} else if (fromChat) {
|
|
237
|
+
if ($("#createRoomDialog")?.open) app.showCreateRoomError("createFailed", { message: error.message });
|
|
238
|
+
else app.showSendError("createFailed", { message: error.message });
|
|
239
|
+
void app.refreshRoomList();
|
|
240
|
+
} else { app.showJoinError("createFailed", { message: error.message }); void app.refreshRoomList(); }
|
|
227
241
|
} finally {
|
|
228
242
|
app.setJoinBusy(false);
|
|
229
243
|
$("#btnCreateChatRoom").disabled = false;
|
|
@@ -6,6 +6,9 @@ export function initSettings(app) {
|
|
|
6
6
|
const dialog = $("#chatSettings");
|
|
7
7
|
if (!dialog) return;
|
|
8
8
|
const tokenInput = $("#inTokenChat"), tokenHint = $("#tokenHint");
|
|
9
|
+
const contentInput = $("#inContentTransition");
|
|
10
|
+
const pageInput = $("#inPageStep");
|
|
11
|
+
const tabs = [...dialog.querySelectorAll('[role="tab"]')];
|
|
9
12
|
const scheme = matchMedia("(prefers-color-scheme: dark)");
|
|
10
13
|
let opener = null;
|
|
11
14
|
|
|
@@ -28,17 +31,48 @@ export function initSettings(app) {
|
|
|
28
31
|
app.setTheme = (value) => applyTheme(value, true);
|
|
29
32
|
app.settingsOpen = () => dialog.open;
|
|
30
33
|
|
|
34
|
+
// One tab stop for the whole tablist; arrow keys move selection like a native tab widget.
|
|
35
|
+
const activateTab = (name, { focus = false } = {}) => {
|
|
36
|
+
for (const tab of tabs) {
|
|
37
|
+
const selected = tab.dataset.settingsTab === name;
|
|
38
|
+
tab.setAttribute("aria-selected", String(selected));
|
|
39
|
+
tab.tabIndex = selected ? 0 : -1;
|
|
40
|
+
const panel = document.getElementById(tab.getAttribute("aria-controls"));
|
|
41
|
+
if (panel) panel.hidden = !selected;
|
|
42
|
+
if (selected && focus) tab.focus();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const onTabKey = (event) => {
|
|
46
|
+
const index = tabs.indexOf(event.target);
|
|
47
|
+
if (index < 0) return;
|
|
48
|
+
const step = event.key === "ArrowUp" || event.key === "ArrowLeft" ? -1 : event.key === "ArrowDown" || event.key === "ArrowRight" ? 1 : 0;
|
|
49
|
+
const target = event.key === "Home" ? 0 : event.key === "End" ? tabs.length - 1 : step ? (index + step + tabs.length) % tabs.length : -1;
|
|
50
|
+
if (target < 0) return;
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
activateTab(tabs[target].dataset.settingsTab, { focus: true });
|
|
53
|
+
};
|
|
54
|
+
for (const tab of tabs) {
|
|
55
|
+
tab.addEventListener("click", () => activateTab(tab.dataset.settingsTab));
|
|
56
|
+
tab.addEventListener("keydown", onTabKey);
|
|
57
|
+
}
|
|
58
|
+
|
|
31
59
|
const open = ({ token = false } = {}) => {
|
|
32
60
|
app.closePanels?.();
|
|
33
61
|
syncThemeInputs();
|
|
62
|
+
if (contentInput) contentInput.checked = app.LS.contentTransition;
|
|
63
|
+
if (pageInput) pageInput.value = String(app.LS.pageStep);
|
|
34
64
|
tokenInput.value = app.LS.token;
|
|
35
65
|
if (tokenHint) tokenHint.hidden = !token;
|
|
36
66
|
if (dialog.open) {
|
|
37
|
-
if (token)
|
|
67
|
+
if (token) {
|
|
68
|
+
activateTab("connection");
|
|
69
|
+
tokenInput.focus();
|
|
70
|
+
}
|
|
38
71
|
return;
|
|
39
72
|
}
|
|
40
73
|
opener = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
41
74
|
opener?.setAttribute("aria-expanded", "true");
|
|
75
|
+
activateTab(token ? "connection" : "general");
|
|
42
76
|
dialog.showModal();
|
|
43
77
|
(token ? tokenInput : $("#localeSelectSettings"))?.focus();
|
|
44
78
|
};
|
|
@@ -56,6 +90,11 @@ export function initSettings(app) {
|
|
|
56
90
|
dialog.addEventListener("cancel", () => opener?.setAttribute("aria-expanded", "false"));
|
|
57
91
|
dialog.addEventListener("change", (event) => {
|
|
58
92
|
if (event.target instanceof HTMLInputElement && event.target.name === "theme") app.setTheme(event.target.value);
|
|
93
|
+
if (event.target === contentInput) app.LS.contentTransition = contentInput.checked;
|
|
94
|
+
if (event.target === pageInput) {
|
|
95
|
+
app.LS.pageStep = pageInput.value;
|
|
96
|
+
pageInput.value = String(app.LS.pageStep);
|
|
97
|
+
}
|
|
59
98
|
});
|
|
60
99
|
dialog.addEventListener("close", () => {
|
|
61
100
|
const target = opener;
|
|
@@ -25,7 +25,93 @@ export function initShortcuts(app) {
|
|
|
25
25
|
app.$("#btnShortcuts")?.addEventListener("mousedown", (event) => event.preventDefault());
|
|
26
26
|
app.$("#btnShortcuts")?.addEventListener("click", openSheet);
|
|
27
27
|
app.$("#btnCloseShortcuts")?.addEventListener("click", () => dialog.close());
|
|
28
|
+
dialog.addEventListener("click", (event) => {
|
|
29
|
+
if (event.target === dialog) dialog.close();
|
|
30
|
+
});
|
|
28
31
|
dialog.addEventListener("close", () => requestAnimationFrame(() => app.focusComposer?.()));
|
|
32
|
+
let scrollFrame = 0;
|
|
33
|
+
let scrollGeneration = 0;
|
|
34
|
+
let pageTarget = null;
|
|
35
|
+
let pageFrame = 0;
|
|
36
|
+
const cancelScroll = () => {
|
|
37
|
+
cancelAnimationFrame(scrollFrame);
|
|
38
|
+
scrollFrame = 0;
|
|
39
|
+
scrollGeneration++;
|
|
40
|
+
};
|
|
41
|
+
const cancelPageScroll = () => {
|
|
42
|
+
cancelAnimationFrame(pageFrame);
|
|
43
|
+
pageFrame = 0;
|
|
44
|
+
pageTarget = null;
|
|
45
|
+
};
|
|
46
|
+
const animateScroll = (target) => {
|
|
47
|
+
if (!thread) return;
|
|
48
|
+
cancelPageScroll();
|
|
49
|
+
const max = Math.max(0, thread.scrollHeight - thread.clientHeight);
|
|
50
|
+
const end = Math.max(0, Math.min(max, target));
|
|
51
|
+
if (matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
52
|
+
cancelScroll();
|
|
53
|
+
thread.scrollTop = end;
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
cancelScroll();
|
|
57
|
+
const generation = scrollGeneration;
|
|
58
|
+
const from = thread.scrollTop;
|
|
59
|
+
const distance = end - from;
|
|
60
|
+
const duration = Math.min(300, Math.max(140, Math.abs(distance) * 0.3));
|
|
61
|
+
const start = performance.now();
|
|
62
|
+
const step = (now) => {
|
|
63
|
+
if (generation !== scrollGeneration) {
|
|
64
|
+
scrollFrame = 0;
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const progress = Math.min(1, (now - start) / duration);
|
|
68
|
+
const eased = 1 - Math.pow(1 - progress, 3);
|
|
69
|
+
thread.scrollTop = from + distance * eased;
|
|
70
|
+
if (progress < 1) scrollFrame = requestAnimationFrame(step);
|
|
71
|
+
else scrollFrame = 0;
|
|
72
|
+
};
|
|
73
|
+
scrollFrame = requestAnimationFrame(step);
|
|
74
|
+
};
|
|
75
|
+
const pageScrollBy = (delta) => {
|
|
76
|
+
if (!thread) return;
|
|
77
|
+
cancelScroll();
|
|
78
|
+
const max = Math.max(0, thread.scrollHeight - thread.clientHeight);
|
|
79
|
+
const clamp = (value) => Math.max(0, Math.min(max, value));
|
|
80
|
+
if (matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
81
|
+
cancelPageScroll();
|
|
82
|
+
thread.scrollTop = clamp(thread.scrollTop + delta);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const base = pageTarget ?? thread.scrollTop;
|
|
86
|
+
pageTarget = clamp(base + delta);
|
|
87
|
+
if (pageFrame) return;
|
|
88
|
+
const step = () => {
|
|
89
|
+
if (pageTarget === null) {
|
|
90
|
+
pageFrame = 0;
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const remaining = pageTarget - thread.scrollTop;
|
|
94
|
+
if (Math.abs(remaining) <= 0.6) {
|
|
95
|
+
thread.scrollTop = pageTarget;
|
|
96
|
+
pageTarget = null;
|
|
97
|
+
pageFrame = 0;
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
thread.scrollTop += remaining * 0.28;
|
|
101
|
+
pageFrame = requestAnimationFrame(step);
|
|
102
|
+
};
|
|
103
|
+
pageFrame = requestAnimationFrame(step);
|
|
104
|
+
};
|
|
105
|
+
const cancelThreadScroll = () => {
|
|
106
|
+
cancelScroll();
|
|
107
|
+
cancelPageScroll();
|
|
108
|
+
};
|
|
109
|
+
app.cancelThreadScrollAnimation = cancelThreadScroll;
|
|
110
|
+
thread?.addEventListener("wheel", cancelThreadScroll, { passive: true });
|
|
111
|
+
thread?.addEventListener("touchmove", cancelThreadScroll, { passive: true });
|
|
112
|
+
thread?.addEventListener("pointerdown", cancelThreadScroll, { passive: true });
|
|
113
|
+
app.animateThreadScrollTo = animateScroll;
|
|
114
|
+
app.animateThreadScrollBy = pageScrollBy;
|
|
29
115
|
const scrollToEdge = (bottom) => {
|
|
30
116
|
if (!thread) return;
|
|
31
117
|
const reduced = matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -33,24 +119,44 @@ export function initShortcuts(app) {
|
|
|
33
119
|
if (!bottom) {
|
|
34
120
|
app.state.jumpToLoadedTop = true;
|
|
35
121
|
clearTimeout(app.state.jumpToLoadedTopTimer);
|
|
36
|
-
app.state.jumpToLoadedTopTimer = setTimeout(() => { app.state.jumpToLoadedTop = false; }, reduced ?
|
|
122
|
+
app.state.jumpToLoadedTopTimer = setTimeout(() => { app.state.jumpToLoadedTop = false; }, reduced ? 150 : 800);
|
|
37
123
|
}
|
|
38
|
-
|
|
39
|
-
app.animateThreadJump?.(bottom);
|
|
40
|
-
};
|
|
41
|
-
app.animateThreadJump = (bottom) => {
|
|
42
|
-
const list = app.$("#msgList");
|
|
43
|
-
if (!list) return;
|
|
44
|
-
list.classList.remove("thread-jump-up", "thread-jump-down");
|
|
45
|
-
void list.offsetWidth;
|
|
46
|
-
list.classList.add(bottom ? "thread-jump-down" : "thread-jump-up");
|
|
124
|
+
animateScroll(bottom ? thread.scrollHeight : 0);
|
|
47
125
|
};
|
|
48
126
|
app.animateRoomSwitch = (direction) => {
|
|
127
|
+
// Keep the motion in the room list: a vertical glide shows where the selection moved.
|
|
128
|
+
for (const row of document.querySelectorAll("#roomList .room-row.selected, #roomListChat .room-row.selected")) {
|
|
129
|
+
row.classList.remove("room-switch-enter");
|
|
130
|
+
row.style.setProperty("--room-switch-shift", `${direction > 0 ? 6 : -6}px`);
|
|
131
|
+
void row.offsetWidth;
|
|
132
|
+
row.classList.add("room-switch-enter");
|
|
133
|
+
row.scrollIntoView({ block: "nearest" });
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
app.switchRoom = (roomId, direction) => {
|
|
49
137
|
const list = app.$("#msgList");
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
138
|
+
const transition = app.LS.contentTransition && list && !matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
139
|
+
if (!transition || app.state.contentSwitching) {
|
|
140
|
+
if (app.state.contentSwitching) return;
|
|
141
|
+
app.activateRoom(roomId);
|
|
142
|
+
app.animateRoomSwitch?.(direction);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const out = direction > 0 ? "room-content-out-next" : "room-content-out-prev";
|
|
146
|
+
const into = direction > 0 ? "room-content-in-next" : "room-content-in-prev";
|
|
147
|
+
app.state.contentSwitching = true;
|
|
148
|
+
list.classList.add(out);
|
|
149
|
+
setTimeout(() => {
|
|
150
|
+
app.activateRoom(roomId);
|
|
151
|
+
app.animateRoomSwitch?.(direction);
|
|
152
|
+
list.classList.remove(out, "room-content-in-next", "room-content-in-prev");
|
|
153
|
+
void list.offsetWidth;
|
|
154
|
+
list.classList.add(into);
|
|
155
|
+
setTimeout(() => {
|
|
156
|
+
list.classList.remove(into);
|
|
157
|
+
app.state.contentSwitching = false;
|
|
158
|
+
}, 220);
|
|
159
|
+
}, 140);
|
|
54
160
|
};
|
|
55
161
|
document.addEventListener("keydown", (event) => {
|
|
56
162
|
if (event.defaultPrevented || event.isComposing) return;
|
|
@@ -58,6 +164,23 @@ export function initShortcuts(app) {
|
|
|
58
164
|
if (document.querySelector("dialog[open]")) return;
|
|
59
165
|
if (event.key === "Home" || event.code === "Home") { event.preventDefault(); scrollToEdge(false); return; }
|
|
60
166
|
if (event.key === "End" || event.code === "End") { event.preventDefault(); scrollToEdge(true); return; }
|
|
167
|
+
const digit = /^(?:Digit|Numpad)([1-9])$/.exec(event.code)?.[1] ?? (/^[1-9]$/.test(event.key) ? event.key : null);
|
|
168
|
+
if (digit) {
|
|
169
|
+
const rows = Array.from(document.querySelectorAll("#roomListChat .room-row.joined"));
|
|
170
|
+
const target = rows[Number(digit) - 1];
|
|
171
|
+
if (!target) return;
|
|
172
|
+
event.preventDefault();
|
|
173
|
+
const current = rows.findIndex((row) => row.dataset.roomId === app.state.room?.id);
|
|
174
|
+
const targetIndex = Number(digit) - 1;
|
|
175
|
+
if (targetIndex === current) return;
|
|
176
|
+
const direction = current < 0 || targetIndex > current ? 1 : -1;
|
|
177
|
+
const roomId = target.dataset.roomId;
|
|
178
|
+
if (roomId) {
|
|
179
|
+
if (app.switchRoom) app.switchRoom(roomId, direction);
|
|
180
|
+
else { app.activateRoom(roomId); app.animateRoomSwitch?.(direction); }
|
|
181
|
+
}
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
61
184
|
if (event.key !== "/" && event.code !== "Slash") return;
|
|
62
185
|
event.preventDefault();
|
|
63
186
|
openSheet();
|