feat(kaak): match channel sidebar and audio dock reference

This commit is contained in:
illusia committed 2026-10-11 19:20:57 +08:00
1 parent b13bdf1eb2
commit 96d2ebae01
17 files changed
+847 -135

No files matched your search

+12 -2
View File
@@ -12,10 +12,10 @@
## 当前检查点(2026-10-11)
- KAAK 当前源码版本为 3.1.65;最近新增真实服务器名与收藏/历史快速切换入口,并以宿主频道树呈现嵌套语音频道、频道成员头像和状态。服务器显示名过滤像地址的内容;快速切换不向皮肤暴露连接目标。控制坞按用户 HTML 原型细化:顶排分享和伴奏,底排语音感应/设置、降噪、麦克风、扬声器。原型中的 REC 没有对应录音能力,因此不添加录制入口。3.1.55 的横向单行方案已被用户明确否决,不再沿用;3.1.53 已移除皮肤布局运行时对宿主控件强加的 44px 尺寸。
- KAAK 当前源码版本为 3.1.66;最近新增真实服务器名与收藏/历史快速切换入口,并以宿主频道树呈现嵌套语音频道、频道成员头像和状态。服务器显示名过滤像地址的内容;快速切换不向皮肤暴露连接目标。控制坞保留 WebSpeak 现有分享、降噪、伴奏、麦克风、扬声器和设置操作;按最新 HTML 在录音位显示不可操作的纯视觉占位,不提供录音能力。3.1.55 的横向单行方案已被用户明确否决,不再沿用;3.1.53 已移除皮肤布局运行时对宿主控件强加的 44px 尺寸。
- 语音布局、成员卡、频道/聊天收起、音量反馈、性能卡片、设备下拉交互和字体层级均已有对应实现;音频设置标签为 KOOK 已记录的 14px/400,表单卡与字段行按实测宽度/行高调整。
- 直接观察记录覆盖语音侧栏/频道树、成员卡与悬停姓名、当前语音频道聊天开合、语音坞、音频设置字体及设备列表尺寸和状态。独立文字频道不复刻;KOOK 的付费分享呈现不复刻,WebSpeak 自带屏幕分享入口和播放器保留。
- 设备选择菜单已按皮肤实际高度限位;KAAK 音频滑杆、性能反馈、字体和成员卡交互均有对应实现。此前完整验证为 666/666;本轮完整验证为 670/670,服务端 TypeScript 构建和前端类型检查/生产构建通过。用户已明确 KOOK 音乐语音频道附带聊天默认收起、普通语音频道默认展开。TeamSpeak `ChannelInfo` 与皮肤上下文没有音乐类别字段;当前实现按频道分别记住聊天开合,尚不能判断从未设置过的频道是否为音乐频道。
- 设备选择菜单已按皮肤实际高度限位;KAAK 音频滑杆、性能反馈、字体和成员卡交互均有对应实现。3.1.66 完整验证为 680/680,服务端 TypeScript 构建、前端类型检查和生产构建通过。用户已明确 KOOK 音乐语音频道附带聊天默认收起、普通语音频道默认展开。TeamSpeak `ChannelInfo` 与皮肤上下文没有音乐类别字段;当前实现按频道分别记住聊天开合,尚不能判断从未设置过的频道是否为音乐频道。
- 本轮从 KOOK 原页读取了可见频道树的 DOM 计算字体规格;成员舞台当前未加载,截图读取超时,未推断其具体像素尺寸或动画时长。
- KOOK 音频设置页可读到 732px 主内容区、660px 表单卡、72px 字段行及 268/320px 标签/控件列;当前设备名属于隐私数据,不记录。
- 本轮侧栏浏览器已加载 KAAK 本地连接页;展开身份选项后,导入身份按钮保持紧凑,导出身份因当前没有身份而禁用。连接按钮没有让页面进入语音工作区,因此本轮无法从浏览器目视确认左下控制坞。
@@ -459,3 +459,13 @@
- 验证:`npm run skin:kaak:build` 通过;`npm run verify` 通过(679/679 测试、服务端 TypeScript 构建、前端类型检查和 Vite 生产构建)。自动验证不替代连接真实频道后的视觉验收,本节点未做实际设备、语音或频道切换操作。
- 影响文件:通用皮肤插件白名单/安全投影、WebClient 组件挂载、新增频道树与服务器菜单、KAAK 组件树/样式/版本目录/包、部件和权限测试及文档。
- 当前状态:实现与自动验证完成;浏览器中的实时语音视觉复核尚待用户从使用者视角确认。
## 本轮修改节点(2026-10-11,KAAK 3.1.66 频道栏与音频坞按原型复刻)
- 目标:按用户提供的 HTML 复刻第二列及其底部音频面板,保留真实 TeamSpeak 数据与 WebSpeak 控件逻辑;不扩展到其他页面和皮肤。
- 频道栏:宽度恢复为原型的 304px;将服务器名、TeamSpeak/连接状态标签、服务器切换和可用频道搜索组合成一个可信宿主头部。搜索实时筛选频道名称并自动展开命中路径。KAAK 专属的频道树行高为 38px、成员行为 29px,头像 22px;父频道折叠只收起子频道,成员仍显示。当前频道使用绿色细指示条。
- 音频坞:宽度改为 282px,左右留白 11px,使用原型的深灰背景、17px 圆角、顶部 29px 操作与分隔线。屏幕分享、降噪、伴奏、设置、麦克风和扬声器继续调用现有 WebSpeak 功能;录音位只显示禁用的样式占位,不声称实现录音。
- 兼容性边界:频道树的新展示方式通过可选宿主布局声明启用,其他皮肤不变;所有视觉覆盖均限定在 KAAK 作用域。没有改动语音引擎或加入录音能力。
- 版本与分发包:KAAK 升至 3.1.66;更新示例和内置目录,重建示例 `.wskin` 与内置 `.wskin`。
- 验证:`npm run skin:kaak:build` 与 `git diff --check` 通过;定向测试 46/46、完整 `npm run verify` 680/680 通过,服务端 TypeScript、前端类型检查与生产构建通过。未在真实语音频道做浏览器目视验收。
- 当前状态:实现和自动验证完成;按既有指示提交并推送到 `dev`。
+3 -3
View File
@@ -150,9 +150,9 @@ components.json 顶层接受 schemaVersion 1、2 或 3 和 components 数组。s
}
```
当前可选宿主控件 ID:`home.connection-form`、`app.skin-switcher`、`app.language-switcher`、`voice.channel-panel`、`voice.member-cards`、`voice.chat-panel`、`voice.audio-controls`、`voice.screen-share-player`、`voice.screen-share-start`、`voice.whisper-controls`、`voice.performance-panel`、`voice.connection-controls`、`voice.disconnect-control`。未知控件和同页重复控件会被拒绝;每个控件的状态和业务动作仍由 WebSpeak 内部处理。schema v3 会检查受保护控件所需权限:音频控件需 `audio.status.read`、`audio.microphone.control` 和 `audio.output.control`;聊天需 `chat.channel.read` 与 `chat.channel.send`;成员卡片始终需 `session.members.read` 和 `session.memberAvatars.read`;schema v3 可为成员卡片设置 `options.memberActions: true`,在非本人卡片上显示可信宿主成员操作入口(包含现有个人音量控件);该入口由用户点击触发,不向皮肤代码暴露音量值或新增音频接口;成员卡片或性能卡片可设置 `options.screenShare: false`,同时隐藏共享 UI/指标并免除成员卡片所需的屏幕共享权限;默认成员共享操作仍需屏幕共享读取/控制权限;头像只在可信宿主控件内显示,不暴露给皮肤代码;屏幕共享播放器需 `voice.screenShare.read` 与 `voice.screenShare.control`;悄悄话控件需对应状态读取和控制权限;断开/连接控件需 `voice.disconnect`。既有 v2 包维持旧校验行为,`voice.screen-share-start` 仍像此前一样要求 `voice.screenShare.control`。该控件仅能放在语音页;宿主按钮在可信点击处理器内直接启动屏幕采集,避免异步 Wasm 回调丢失浏览器瞬时用户激活。自定义 UI 可以完全用普通声明式节点搭建,不需要采用这些控件。只显示收藏时可用 `favorites.items` 和 `favorites.switch`;若要将收藏与最近连接放在同一自定义栏,可用 `servers.quickList` 数据与 `quickServers.switch` 动作。服务器目标始终使用本机生成的不透明令牌,不把地址、密码或身份材料交给组件。频道行也可把 `voice.joinChannel` 绑定到双击事件,切房继续走 TeamSpeak 原有权限和密码流程。v3 还提供经独立权限保护的麦克风/扬声器、输出音量、离开状态、悄悄话、断开连接和屏幕共享动作;它们只调用 WebSpeak 已有操作,屏幕采集仍由浏览器或操作系统询问用户。
当前可选宿主控件 ID:`home.connection-form`、`app.skin-switcher`、`app.language-switcher`、`voice.channel-panel`、`voice.member-cards`、`voice.chat-panel`、`voice.audio-controls`、`voice.screen-share-player`、`voice.screen-share-start`、`voice.whisper-controls`、`voice.performance-panel`、`voice.connection-controls`、`voice.disconnect-control`、`voice.server-header`、`voice.server-switcher`、`voice.channel-tree`。未知控件和同页重复控件会被拒绝;每个控件的状态和业务动作仍由 WebSpeak 内部处理。schema v3 会检查受保护控件所需权限:音频控件需 `audio.status.read`、`audio.microphone.control` 和 `audio.output.control`;聊天需 `chat.channel.read` 与 `chat.channel.send`;成员卡片始终需 `session.members.read` 和 `session.memberAvatars.read`;schema v3 可为成员卡片设置 `options.memberActions: true`,在非本人卡片上显示可信宿主成员操作入口(包含现有个人音量控件);该入口由用户点击触发,不向皮肤代码暴露音量值或新增音频接口;成员卡片或性能卡片可设置 `options.screenShare: false`,同时隐藏共享 UI/指标并免除成员卡片所需的屏幕共享权限;默认成员共享操作仍需屏幕共享读取/控制权限;头像只在可信宿主控件内显示,不暴露给皮肤代码;屏幕共享播放器需 `voice.screenShare.read` 与 `voice.screenShare.control`;悄悄话控件需对应状态读取和控制权限;断开/连接控件需 `voice.disconnect`。既有 v2 包维持旧校验行为,`voice.screen-share-start` 仍像此前一样要求 `voice.screenShare.control`。该控件仅能放在语音页;宿主按钮在可信点击处理器内直接启动屏幕采集,避免异步 Wasm 回调丢失浏览器瞬时用户激活。自定义 UI 可以完全用普通声明式节点搭建,不需要采用这些控件。只显示收藏时可用 `favorites.items` 和 `favorites.switch`;若要将收藏与最近连接放在同一自定义栏,可用 `servers.quickList` 数据与 `quickServers.switch` 动作。服务器目标始终使用本机生成的不透明令牌,不把地址、密码或身份材料交给组件。频道行也可把 `voice.joinChannel` 绑定到双击事件,切房继续走 TeamSpeak 原有权限和密码流程。v3 还提供经独立权限保护的麦克风/扬声器、输出音量、离开状态、悄悄话、断开连接和屏幕共享动作;它们只调用 WebSpeak 已有操作,屏幕采集仍由浏览器或操作系统询问用户。
新增的可信语音导航控件为 `voice.channel-tree` 和 `voice.server-switcher`。频道树要求 `session.channels.read`、`session.members.read`、`session.memberAvatars.read` 与 `session.channel.join`;头像只由宿主读取并在频道树中绘制。服务器切换器要求 `servers.quickList.read` 与 `servers.quickList.switch`,只接收不透明本地标识,点击后复用 WebSpeak 当前连接流程。语音状态投影中的 `serverLabel` 会在看起来像 IP、域名或连接目标时省略,避免把地址显示为服务器名称。
可信语音导航控件包括 `voice.channel-tree`、`voice.server-switcher` 和 `voice.server-header`。频道树要求 `session.channels.read`、`session.members.read`、`session.memberAvatars.read` 与 `session.channel.join`;头像只由宿主读取并在频道树中绘制。它可选 `layout: "server-sidebar"` 展示频道成员并让频道行与成员行分别控制折叠;未指定时保留默认呈现。独立服务器切换器要求 `servers.quickList.read` 与 `servers.quickList.switch`。服务器头部还要求 `session.status.read`,并在同一可信部件中组合服务器身份、状态、频道搜索和快速切换。两种入口都只接收不透明本地标识,点击后复用 WebSpeak 当前连接流程。语音状态投影中的 `serverLabel` 会在看起来像 IP、域名或连接目标时省略,避免把地址显示为服务器名称。
示例包见 [KAAK voice 示例](./examples/KAAK-VOICE.md),其 components.json 使用完整首页与语音工作区 surface,展示收藏服务器、频道树、在线成员、聊天和可信语音控制的组合;[Open Voice Surface](./examples/OPEN-VOICE-SURFACE.md) 保留为通用格式验证脚手架。KAAK 的语音视觉参考来自用户授权进入的前两个语音房间;只记录布局,不保留服务器/房间标识、成员名或聊天内容。当前数据权限和宿主动作以[开放皮肤规格](./OPEN_SKIN_SYSTEM_SPEC.zh-CN.md)中的清单为准。组件按本地用户授权后才渲染;权限对每个皮肤版本、页面和组件分别保存,可在宿主权限入口撤销。页面替换时,宿主会额外显示“返回标准界面”和“恢复内置皮肤”入口;拒绝授权或离开 surface 后,普通页面可立即恢复。
@@ -275,7 +275,7 @@ widget 的可选 `mount` 只接受这些公开锚点:`home.header.after`、`ho
`voice.member.avatar` 是语音活动区头像;`voice.member.mic-status` 在成员麦克风静音时显示,状态值为 `muted`;`voice.member.action-trigger` 是打开宿主成员操作菜单的按钮,由成员卡片小组件的 `options.memberActions` 控制;`voice.member-row.avatar` 是右侧成员树头像。语音成员列表的动态项提供 `.ws-voice-member-enter-active`、`.ws-voice-member-leave-active`、`.ws-voice-member-enter-from`、`.ws-voice-member-leave-to` 和 `.ws-voice-member-move` 动效钩子,可分别设置加入、离开和排序变化的过渡。状态属性还会使用 `current`、`drag-over`、`dragging`、`self`、`events-empty` 和 `messages-empty`。当前根节点以及屏幕共享播放器、弹窗、菜单都属于同一皮肤作用域。
`voice.channel-tree` 和 `voice.server-switcher` 是 WebSpeak 可信宿主控件。频道树按 TeamSpeak 返回的层级展示语音频道与成员;展开按钮只改变本地显示,双击频道或聚焦后按 Enter 才加入频道。成员头像和语音状态只在宿主渲染的频道树中出现,不会传给皮肤插件。服务器切换菜单只列出本机收藏和最近连接,可用不透明本地标识触发既有连接流程;地址、密码和身份材料不会传给皮肤组件。
`voice.channel-tree`、`voice.server-switcher` 和 `voice.server-header` 是 WebSpeak 可信宿主控件。频道树按 TeamSpeak 返回的层级展示语音频道与成员;展开按钮只改变本地显示,双击频道或聚焦后按 Enter 才加入频道。服务器栏布局让频道成员保持可见,折叠按钮只收起子频道。成员头像和语音状态只在宿主渲染的频道树中出现,不会传给皮肤插件。服务器头部在宿主中展示状态并按频道名筛选;切换入口只列出本机收藏和最近连接,可用不透明本地标识触发既有连接流程;地址、密码和身份材料不会传给皮肤组件。
首页快速连接和语音工作区的服务器栏共用同一列表:收藏项排在前面,最近连接补在后面;地址相同的收藏与历史只显示一项。每项的星标按钮可在两个位置收藏或取消收藏,取消收藏后若该服务器仍在最近连接中,它会留在列表的最近连接位置。皮肤可通过 `data-ws-state="favorite|recent"` 区分首页条目,通过 `data-ws-server-kind="favorite|recent"` 区分语音栏条目。
Binary file not shown.
+42 -89
View File
@@ -319,92 +319,10 @@
"aria-label": "服务器频道 / Server channels"
},
"children": [
{
"tag": "header",
"part": "server-summary",
"children": [
{
"tag": "div",
"part": "server-summary-heading",
"children": [
{
"tag": "strong",
"part": "server-name",
"children": [
{
"text": "{{session.status.serverLabel}}"
}
]
},
{
"widget": "voice.server-switcher",
"part": "server-switcher"
}
]
},
{
"tag": "div",
"part": "server-connection-state",
"children": [
{
"tag": "span",
"part": "server-connection-dot",
"when": {
"path": "session.status.connectionState",
"equals": "connected"
},
"attributes": {
"aria-hidden": true
},
"children": [
{
"text": "●"
}
]
},
{
"tag": "small",
"part": "server-subtitle",
"when": {
"path": "session.status.connectionState",
"equals": "connected"
},
"children": [
{
"text": "已连接 · {{session.status.userName}}"
}
]
},
{
"tag": "small",
"part": "server-subtitle",
"when": {
"path": "session.status.connectionState",
"equals": "connecting"
},
"children": [
{
"text": "正在连接 / Connecting"
}
]
},
{
"tag": "small",
"part": "server-subtitle",
"when": {
"path": "session.status.connectionState",
"equals": "disconnected"
},
"children": [
{
"text": "未连接 / Disconnected"
}
]
}
]
}
]
},
{
"widget": "voice.server-header",
"part": "server-summary"
},
{
"tag": "nav",
"part": "channel-list",
@@ -455,10 +373,13 @@
"tag": "div",
"part": "voice-channel-items",
"children": [
{
{
"widget": "voice.channel-tree",
"part": "voice-channel-tree"
}
"part": "voice-channel-tree",
"options": {
"layout": "server-sidebar"
}
}
]
}
]
@@ -926,6 +847,38 @@
}
]
},
{
"tag": "button",
"part": "record-placeholder",
"attributes": {
"type": "button",
"disabled": true,
"aria-label": "录制 / Recording unavailable"
},
"children": [
{
"tag": "span",
"part": "recording-dot",
"attributes": {
"aria-hidden": true
},
"children": [
{
"text": "●"
}
]
},
{
"tag": "span",
"part": "recording-label",
"children": [
{
"text": "REC"
}
]
}
]
},
{
"widget": "voice.audio-controls",
"part": "audio-controls",
+2 -2
View File
@@ -3,10 +3,10 @@
"packageType": "open-skin",
"id": "community.kaak-voice",
"name": "KAAK",
"version": "3.1.65",
"version": "3.1.66",
"author": "WebSpeak Project",
"license": "AGPL-3.0-only",
"description": "A KOOK-inspired voice workspace with a live server header, quick server switching, a nested channel tree with member avatars, attached channel chat, and WebSpeak voice controls.",
"description": "A KOOK-inspired voice workspace with a searchable server header, nested channel members, attached channel chat, and a compact WebSpeak audio dock.",
"entry": "skin.css",
"components": "components.json",
"content": "content.json",
+517 -4
View File
@@ -122,7 +122,7 @@
--skin-kaak-border: #3a3b40;
position: relative;
display: grid;
grid-template-columns: 86px 290px minmax(280px, 1fr) minmax(340px, min(38vw, 520px));
grid-template-columns: 86px 304px minmax(280px, 1fr) minmax(340px, min(38vw, 520px));
grid-template-rows: 40px minmax(0, 1fr);
width: 100%;
height: 100dvh;
@@ -135,7 +135,7 @@
}
[data-ws-plugin-part="kaak-workspace"]:has([data-ws-plugin-part="kaak-workspace.chat-panel-toggle"][aria-expanded="false"]) {
grid-template-columns: 86px 290px minmax(280px, 1fr) 0;
grid-template-columns: 86px 304px minmax(280px, 1fr) 0;
}
[data-ws-plugin-part="kaak-workspace"] .language-switcher .language-trigger,
@@ -1369,7 +1369,36 @@
background: #303236;
pointer-events: none;
}
[data-ws-plugin-part="kaak-workspace.voice-dock-share"] { grid-column: 1 / 4; grid-row: 1; min-width: 0; }
[data-ws-plugin-part="kaak-workspace.voice-dock-share"] { grid-column: 1 / 3; grid-row: 1; min-width: 0; }
[data-ws-plugin-part="kaak-workspace.record-placeholder"] {
display: flex;
grid-column: 3;
grid-row: 1;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 0;
box-sizing: border-box;
width: 36px;
min-width: 36px;
height: 29px;
min-height: 29px;
padding: 1px 0 0;
border: 0;
border-radius: 9px;
color: #fff;
background: #69c000;
font-family: var(--skin-kaak-font);
font-size: 8px;
font-weight: 700;
line-height: 9px;
letter-spacing: .03em;
opacity: 1;
cursor: default;
pointer-events: none;
}
[data-ws-plugin-part="kaak-workspace.recording-dot"] { font-size: 13px; line-height: 13px; }
[data-ws-plugin-part="kaak-workspace.recording-label"] { font-size: 8px; line-height: 9px; }
[data-ws-plugin-part="kaak-workspace.audio-controls"] { display: contents; }
[data-ws-plugin-part="kaak-workspace.audio-controls"] .desktop-audio-dock-room-panel {
@@ -1594,7 +1623,8 @@
row-gap: 12px;
}
[data-ws-plugin-part="kaak-workspace.voice-dock-actions"]::after { top: 39px; }
[data-ws-plugin-part="kaak-workspace.voice-dock-share"] { grid-column: 1 / 4; grid-row: 1; }
[data-ws-plugin-part="kaak-workspace.voice-dock-share"] { grid-column: 1 / 3; grid-row: 1; }
[data-ws-plugin-part="kaak-workspace.record-placeholder"] { grid-column: 3; grid-row: 1; }
[data-ws-plugin-part="kaak-workspace.voice-dock-share"] .skin-runtime-screen-share-start,
[data-ws-plugin-part="kaak-workspace.voice-dock-share"] [data-ws-plugin-part="kaak-workspace.screen-share-stop"] {
min-height: 34px;
@@ -2411,3 +2441,486 @@
padding: 12px 20px calc(16px + env(safe-area-inset-bottom, 0px));
}
}
/* KAAK server sidebar and audio dock, matched to the supplied two-column reference. */
[data-ws-plugin-part="kaak-workspace"] {
--skin-kaak-panel: #252628;
}
[data-ws-plugin-part="kaak-workspace"] {
grid-template-columns: 86px 304px minmax(280px, 1fr) minmax(340px, min(38vw, 520px));
}
[data-ws-plugin-part="kaak-workspace"]:has([data-ws-plugin-part="kaak-workspace.chat-panel-toggle"][aria-expanded="false"]) {
grid-template-columns: 86px 304px minmax(280px, 1fr) 0;
}
[data-ws-plugin-part="kaak-workspace.channel-panel"] {
z-index: 1;
display: flex;
flex-direction: column;
min-width: 0;
min-height: 0;
overflow: hidden;
padding: 0;
border-right: 1px solid #37393e;
background: #252628;
}
[data-ws-plugin-part="kaak-workspace.server-summary"] {
position: relative;
z-index: 12;
display: block;
flex: 0 0 auto;
min-height: 0;
padding: 0;
border: 0;
background: transparent;
}
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-header {
display: flex;
flex-direction: column;
padding: 19px 17px 0;
color: #eff0f3;
font-family: var(--skin-kaak-font);
}
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-title-line,
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-meta-line {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
min-width: 0;
}
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-title-line { min-height: 26px; }
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-name {
min-width: 0;
overflow: hidden;
color: #eff0f3;
font-size: 16px;
font-weight: 720;
letter-spacing: -.35px;
text-overflow: ellipsis;
white-space: nowrap;
}
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-meta-line { margin-top: 12px; }
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-tags {
display: flex;
align-items: center;
gap: 7px;
min-width: 0;
}
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-tag {
display: inline-flex;
align-items: center;
gap: 5px;
height: 20px;
max-width: 130px;
overflow: hidden;
padding: 0 9px;
border-radius: 11px;
color: #f3f4f6;
background: #42454b;
font-size: 11px;
font-weight: 700;
text-overflow: ellipsis;
white-space: nowrap;
}
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-tag.is-connected {
color: #b9ea73;
background: #3b4930;
}
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-tag.is-connecting { color: #f2d27d; background: #4b422d; }
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-tag.is-disconnected { color: #b4b7bd; background: #3b3d42; }
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-tag i {
width: 6px;
height: 6px;
flex: 0 0 6px;
border-radius: 50%;
background: #72c800;
}
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-search-toggle {
display: grid;
flex: 0 0 27px;
place-items: center;
width: 27px;
height: 27px;
padding: 3px;
border: 0;
border-radius: 6px;
color: #d0d4da;
background: transparent;
cursor: pointer;
}
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-search-toggle:hover,
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-search-toggle:focus-visible {
color: #fff;
background: #35373b;
}
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-search-toggle:focus-visible,
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-search-box:focus-within {
outline: 2px solid #72c800;
outline-offset: 2px;
}
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-search-box {
display: flex;
align-items: center;
gap: 8px;
height: 32px;
margin-top: 10px;
padding: 0 8px;
border: 1px solid #4b4d53;
border-radius: 7px;
color: #a5aab4;
background: #1e2024;
}
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-search-box input {
flex: 1;
min-width: 0;
height: 100%;
padding: 0;
border: 0;
outline: 0;
color: #eff0f3;
background: transparent;
font: inherit;
font-size: 12px;
}
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-search-box input::placeholder { color: #777e88; }
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-search-box > button {
display: grid;
place-items: center;
width: 22px;
height: 22px;
padding: 0;
border: 0;
border-radius: 5px;
color: #a5aab4;
background: transparent;
cursor: pointer;
}
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-divider {
height: 1px;
margin-top: 13px;
background: #35373c;
}
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-switcher-trigger {
width: 27px;
height: 27px;
border-radius: 6px;
}
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-switcher-trigger .ui-icon { width: 18px; height: 18px; }
[data-ws-plugin-part="kaak-workspace.channel-list"] {
display: flex;
flex: 1 1 auto;
flex-direction: column;
gap: 0;
min-height: 0;
overflow: hidden;
padding: 3px 10px 0;
}
[data-ws-plugin-part="kaak-workspace.voice-channel-group-toggle"] {
display: flex;
flex: 0 0 auto;
align-items: center;
gap: 8px;
min-height: 29px;
margin: 0 0 4px;
padding: 3px 9px;
color: #eff0f3;
font-size: 13px;
font-weight: 750;
letter-spacing: -.1px;
}
[data-ws-plugin-part="kaak-workspace.voice-group-chevron"] { width: 12px; font-size: 15px; }
[data-ws-plugin-part="kaak-workspace.voice-channel-list"] {
display: grid;
flex: 1 1 auto;
grid-template-rows: 1fr;
min-height: 0;
overflow: hidden;
padding-bottom: 122px;
opacity: 1;
transform: translateY(0);
visibility: visible;
}
[data-ws-plugin-part="kaak-workspace.voice-channel-items"] { min-height: 0; overflow: auto; padding: 0 0 12px; }
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] {
display: flex;
flex-direction: column;
gap: 4px;
min-width: 0;
margin: 0;
padding: 0;
list-style: none;
}
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-node {
min-width: 0;
margin: 0;
padding: 0;
list-style: none;
}
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-line {
display: flex;
align-items: center;
gap: 0;
min-width: 0;
min-height: 38px;
margin-left: calc(var(--channel-depth, 0) * 14px);
padding: 0;
}
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-expander {
display: grid;
flex: 0 0 14px;
place-items: center;
width: 14px;
height: 28px;
padding: 0;
border: 0;
border-radius: 4px;
color: #777e88;
background: transparent;
cursor: pointer;
}
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-row {
position: relative;
display: flex;
flex: 1 1 auto;
align-items: center;
gap: 10px;
min-width: 0;
min-height: 38px;
padding: 0 12px 0 24px;
border: 0;
border-radius: 7px;
color: #a5aab4;
background: transparent;
text-align: left;
cursor: pointer;
transition: color .14s ease, background-color .14s ease;
}
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-line:has(> .ws-voice-channel-expander) .ws-voice-channel-row { padding-left: 7px; }
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-row:hover { color: #eff0f3; background: #303238; }
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-row:focus-visible { outline: 2px solid #72c800; outline-offset: 1px; }
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-node[data-current="true"] > .ws-voice-channel-line .ws-voice-channel-row {
color: #eff0f3;
background: #33353b;
}
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-node[data-current="true"] > .ws-voice-channel-line .ws-voice-channel-row::before {
position: absolute;
top: 5px;
bottom: 5px;
left: 0;
width: 3px;
border-radius: 0 2px 2px 0;
background: #72c800;
content: "";
}
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-node[data-selected="true"]:not([data-current="true"]) > .ws-voice-channel-line .ws-voice-channel-row { color: #eff0f3; background: #33353b; }
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-type { width: 17px; height: 17px; color: #a5aab4; }
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-name { min-width: 0; flex: 1 1 auto; overflow: hidden; font-size: 13px; font-weight: 690; line-height: 20px; text-overflow: ellipsis; white-space: nowrap; }
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-count { flex: 0 0 auto; color: #777e88; font-size: 12px; font-variant-numeric: tabular-nums; }
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-branch { display: grid; grid-template-rows: 1fr; min-width: 0; opacity: 1; transform: translateY(0); visibility: visible; transition: grid-template-rows .15s ease, opacity .14s ease, transform .15s ease, visibility 0s; }
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-branch[data-expanded="false"] { grid-template-rows: 0fr; opacity: 0; transform: translateY(-2px); visibility: hidden; transition: grid-template-rows .15s ease, opacity .14s ease, transform .15s ease, visibility 0s linear .15s; }
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-branch-content { display: flex; flex-direction: column; gap: 4px; min-width: 0; min-height: 0; overflow: hidden; margin: 0; padding: 0; border: 0; list-style: none; }
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-member-list { display: flex; flex-direction: column; gap: 2px; margin: 3px 0 5px; padding: 0; list-style: none; }
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-member { display: flex; align-items: center; gap: 9px; min-width: 0; min-height: 29px; margin-left: calc(var(--channel-depth, 0) * 14px); padding: 2px 10px 2px 46px; border-radius: 5px; color: #a5aab4; font-size: 12px; font-weight: 400; line-height: 17px; }
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-member[data-self="true"] { color: #eff0f3; font-weight: 650; }
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-member-avatar { display: grid; flex: 0 0 22px; place-items: center; width: 22px; height: 22px; overflow: hidden; border-radius: 50%; color: #eff0f3; background: #393b41; background-position: center; background-size: cover; font-size: 9px; font-weight: 700; }
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-member-name { min-width: 0; flex: 1 1 auto; overflow: hidden; color: inherit; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-member-self { flex: 0 0 auto; color: #72c800; font-size: 10px; font-weight: 700; }
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-member-mic { color: #a5aab4; }
[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-tree[data-layout="server-sidebar"] .ws-voice-channel-member-muted { color: #ff4c49; }
[data-ws-plugin-part="kaak-workspace.voice-dock"] {
z-index: 4;
box-sizing: border-box;
justify-self: center;
width: min(282px, calc(100% - 22px));
max-width: 282px;
margin-bottom: 11px;
grid-template-columns: minmax(0, 1fr);
grid-template-rows: auto auto;
gap: 10px;
padding: 13px 12px 10px;
border: 1px solid #34363b;
border-radius: 17px;
background: #252628;
box-shadow: none;
}
[data-ws-plugin-part="kaak-workspace.voice-dock-heading"] {
grid-template-columns: 8px minmax(0, 1fr) 28px 28px;
gap: 2px 5px;
min-height: 22px;
margin: 0;
}
[data-ws-plugin-part="kaak-workspace.voice-channel-name"] { color: #eff0f3; font-size: 13px; font-weight: 650; }
[data-ws-plugin-part="kaak-workspace.voice-dock-actions"] {
position: relative;
display: grid;
grid-column: 1;
grid-row: 2;
grid-template-columns: minmax(0, 1fr) 36px 36px 36px;
grid-template-rows: 29px 26px;
column-gap: 7px;
row-gap: 21px;
align-items: center;
min-width: 0;
}
[data-ws-plugin-part="kaak-workspace.voice-dock-actions"]::after { top: 40px; background: #35373c; }
[data-ws-plugin-part="kaak-workspace.voice-dock-share"] { grid-column: 1 / 4; grid-row: 1; min-width: 0; }
[data-ws-plugin-part="kaak-workspace.audio-controls"] { display: contents; }
[data-ws-plugin-part="kaak-workspace.audio-controls"] .desktop-audio-dock-room-panel,
[data-ws-plugin-part="kaak-workspace.audio-controls"] .desktop-audio-dock-room-panel .desktop-audio-dock-actions { display: contents; }
[data-ws-plugin-part="kaak-workspace.audio-controls"] .desktop-audio-dock-copy { display: none; }
[data-ws-plugin-part="kaak-workspace.audio-controls"] .room-panel-audio-settings {
display: inline-flex;
grid-column: 1;
grid-row: 2;
align-items: center;
justify-content: space-between;
gap: 5px;
min-width: 0;
min-height: 26px;
padding: 0 7px;
border: 0;
border-radius: 6px;
color: #b5c6d8;
background: transparent;
font: inherit;
font-size: 12px;
font-weight: 500;
}
[data-ws-plugin-part="kaak-workspace.audio-controls"] .room-panel-audio-settings .ui-icon { display: block; flex: 0 0 auto; width: 15px; height: 15px; transform: none; }
[data-ws-plugin-part="kaak-workspace.audio-controls"] .room-panel-audio-settings:hover,
[data-ws-plugin-part="kaak-workspace.audio-controls"] .room-panel-audio-settings:focus-visible { color: #eff0f3; background: #303238; }
[data-ws-plugin-part="kaak-workspace.audio-controls"] .desktop-audio-dock-room-panel .dock-audio-button {
display: inline-flex;
align-items: center;
justify-content: center;
width: 25px;
min-width: 25px;
height: 26px;
min-height: 26px;
margin: 0;
padding: 3px;
border: 0;
border-radius: 6px;
color: #a5aab4;
background: transparent;
cursor: pointer;
}
[data-ws-plugin-part="kaak-workspace.audio-controls"] .desktop-audio-dock-room-panel .dock-audio-button .ui-icon { display: block; width: 18px; height: 18px; transform: none; }
[data-ws-plugin-part="kaak-workspace.audio-controls"] [data-ws-part="voice.audio-dock.microphone"] { display: grid; grid-column: 3; grid-row: 2; place-items: center; min-width: 0; }
[data-ws-plugin-part="kaak-workspace.audio-controls"] [data-ws-part="voice.audio-dock.output"] { display: grid; grid-column: 4; grid-row: 2; place-items: center; min-width: 0; }
[data-ws-plugin-part="kaak-workspace.audio-controls"] .noise-suppression-toggle {
display: grid;
grid-column: 2;
grid-row: 2;
place-items: center;
box-sizing: border-box;
width: 36px;
min-width: 36px;
height: 26px;
min-height: 26px;
margin: 0;
padding: 0;
border: 0;
border-radius: 7px;
color: #a5aab4;
background: transparent;
transform: none;
}
[data-ws-plugin-part="kaak-workspace.audio-controls"] .noise-suppression-toggle.active { color: #b9ea73; background: #303238; }
[data-ws-plugin-part="kaak-workspace.audio-controls"] .desktop-audio-dock-room-panel .accompaniment-toggle {
position: relative;
z-index: 1;
grid-column: 4;
grid-row: 1;
box-sizing: border-box;
width: 36px;
min-width: 36px;
height: 29px;
min-height: 29px;
border: 0;
border-radius: 9px;
color: #fff;
background: #69c000;
cursor: pointer;
}
[data-ws-plugin-part="kaak-workspace.audio-controls"] .desktop-audio-dock-room-panel .accompaniment-toggle[aria-pressed="true"] { background: #477f00; box-shadow: inset 0 0 0 1px #9be031; }
[data-ws-plugin-part="kaak-workspace.audio-controls"] .desktop-audio-dock-room-panel .accompaniment-toggle .ui-icon { width: 17px; height: 17px; }
[data-ws-plugin-part="kaak-workspace.audio-controls"] .desktop-audio-dock-room-panel .dock-audio-button:hover,
[data-ws-plugin-part="kaak-workspace.audio-controls"] .desktop-audio-dock-room-panel .dock-audio-button:focus-visible,
[data-ws-plugin-part="kaak-workspace.audio-controls"] .noise-suppression-toggle:hover,
[data-ws-plugin-part="kaak-workspace.audio-controls"] .noise-suppression-toggle:focus-visible { color: #eff0f3; background: #303238; outline: none; }
[data-ws-plugin-part="kaak-workspace.audio-controls"] .desktop-audio-dock-room-panel .accompaniment-toggle:hover { background: #7ad50a; }
[data-ws-plugin-part="kaak-workspace.audio-controls"] .desktop-audio-dock-room-panel .dock-audio-button.muted { color: #ff4c49; }
[data-ws-plugin-part="kaak-workspace.voice-dock-heading"] [data-ws-plugin-part="kaak-workspace.disconnect-control"] { width: 25px; min-width: 25px; height: 25px; min-height: 25px; color: #ff4c49; }
[data-ws-plugin-part="kaak-workspace.voice-dock-share"] .skin-runtime-screen-share-start,
[data-ws-plugin-part="kaak-workspace.voice-dock-share"] [data-ws-plugin-part="kaak-workspace.screen-share-stop"] {
box-sizing: border-box;
width: 100%;
min-width: 0;
min-height: 29px;
height: 29px;
padding: 0 8px;
border: 0;
border-radius: 9px;
color: #fff;
font-family: var(--skin-kaak-font);
font-size: 12px;
font-weight: 700;
line-height: 1;
}
[data-ws-plugin-part="kaak-workspace.voice-dock-share"] .skin-runtime-screen-share-start { background: #69c000; }
[data-ws-plugin-part="kaak-workspace.voice-dock-share"] [data-ws-plugin-part="kaak-workspace.screen-share-stop"] { background: #9f3845; }
[data-ws-plugin-part="kaak-workspace.voice-dock-share"] .skin-runtime-screen-share-start .ui-icon { width: 17px; height: 17px; }
[data-ws-plugin-part="kaak-workspace.voice-dock-share"] .skin-runtime-screen-share-start:hover:not(:disabled) { background: #7ad50a; }
[data-ws-plugin-part="kaak-workspace.voice-dock-share"] .skin-runtime-screen-share-start:disabled { opacity: .5; }
@media (max-width: 1200px) and (min-width: 961px) {
[data-ws-plugin-part="kaak-workspace"] { grid-template-columns: 86px 204px minmax(340px, 1fr) minmax(280px, 32vw); }
[data-ws-plugin-part="kaak-workspace"]:has([data-ws-plugin-part="kaak-workspace.chat-panel-toggle"][aria-expanded="false"]) { grid-template-columns: 86px 204px minmax(340px, 1fr) 0; }
}
@media (max-width: 960px) and (min-width: 821px) {
[data-ws-plugin-part="kaak-workspace"] { grid-template-columns: 86px 184px minmax(260px, 1fr) minmax(260px, 29vw); }
[data-ws-plugin-part="kaak-workspace"]:has([data-ws-plugin-part="kaak-workspace.chat-panel-toggle"][aria-expanded="false"]) { grid-template-columns: 86px 184px minmax(260px, 1fr) 0; }
}
@media (max-width: 820px) {
[data-ws-plugin-part="kaak-workspace.channel-panel"] { display: flex; flex-direction: column; gap: 0; padding: 0 8px; }
[data-ws-plugin-part="kaak-workspace.server-summary"] { display: block; min-height: 0; padding: 0; }
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-header { padding: 5px 4px 0; }
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-title-line { min-height: 19px; }
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-name { font-size: 12px; line-height: 18px; }
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-meta-line { margin-top: 3px; }
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-tag { height: 16px; padding: 0 7px; font-size: 9px; }
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-search-toggle { width: 22px; height: 22px; flex-basis: 22px; }
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-search-box { height: 28px; margin-top: 4px; }
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-divider { margin-top: 5px; }
[data-ws-plugin-part="kaak-workspace.channel-list"] { padding: 0 4px; }
[data-ws-plugin-part="kaak-workspace.voice-channel-list"] { overflow: auto; padding-bottom: 0; }
[data-ws-plugin-part="kaak-workspace.voice-dock"] {
align-self: center;
width: min(282px, calc(100% - 12px));
max-width: 282px;
margin-bottom: 0;
min-height: 122px;
grid-template-rows: auto auto;
gap: 7px;
padding: 9px 12px 8px;
border: 1px solid #34363b;
border-radius: 17px;
}
[data-ws-plugin-part="kaak-workspace.voice-dock-heading"] { min-height: 22px; }
[data-ws-plugin-part="kaak-workspace.voice-dock-actions"] { grid-template-rows: 29px 26px; row-gap: 16px; }
[data-ws-plugin-part="kaak-workspace.voice-dock-actions"]::after { top: 36px; }
[data-ws-plugin-part="kaak-workspace.voice-dock-share"] .skin-runtime-screen-share-start,
[data-ws-plugin-part="kaak-workspace.voice-dock-share"] [data-ws-plugin-part="kaak-workspace.screen-share-stop"] { min-height: 29px; height: 29px; padding-inline: 8px; font-size: 12px; }
[data-ws-plugin-part="kaak-workspace.audio-controls"] .mobile-voice-controls { display: contents; }
[data-ws-plugin-part="kaak-workspace.audio-controls"] .mobile-voice-activity { grid-column: 1; grid-row: 2; min-height: 26px; font-size: 12px; }
[data-ws-plugin-part="kaak-workspace.audio-controls"] .mobile-noise-suppression { grid-column: 2; grid-row: 2; width: 36px; min-width: 36px; height: 26px; min-height: 26px; margin: 0; padding: 0; border-radius: 7px; }
[data-ws-plugin-part="kaak-workspace.audio-controls"] .mobile-microphone-toggle { grid-column: 3; grid-row: 2; }
[data-ws-plugin-part="kaak-workspace.audio-controls"] .mobile-output-toggle { grid-column: 4; grid-row: 2; }
[data-ws-plugin-part="kaak-workspace.audio-controls"] .mobile-accompaniment-toggle { grid-column: 4; grid-row: 1; width: 36px; min-width: 36px; height: 29px; min-height: 29px; border-radius: 9px; }
}
@media (max-height: 700px) and (min-width: 821px) {
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-header { padding-top: 12px; }
[data-ws-plugin-part="kaak-workspace.server-summary"] .ws-voice-server-divider { margin-top: 8px; }
[data-ws-plugin-part="kaak-workspace.voice-dock"] { padding-top: 10px; padding-bottom: 8px; }
}
+8 -2
View File
@@ -276,6 +276,7 @@ test("trusted channel tree and server switcher widgets require scoped read and c
document.schemaVersion = 3;
document.components[0].actions = {};
document.components[0].permissions = [
"session.status.read",
"session.channels.read",
"session.members.read",
"session.memberAvatars.read",
@@ -287,15 +288,18 @@ test("trusted channel tree and server switcher widgets require scoped read and c
tag: "header",
children: [
{ widget: "voice.server-switcher", part: "server-switcher" },
{ widget: "voice.server-header", part: "server-header" },
{ widget: "voice.channel-tree", part: "channel-tree" },
],
};
assert.deepEqual(parseSkinPluginDocument(document).components[0].root.children?.map(({ widget }) => widget), [
"voice.server-switcher",
"voice.server-header",
"voice.channel-tree",
]);
for (const missingPermission of [
"session.status.read",
"session.channels.read",
"session.members.read",
"session.memberAvatars.read",
@@ -324,6 +328,7 @@ test("KAAK v3 example declares the connection home and complete voice workspace"
assert.equal(workspace.page, "voice");
assert.equal(workspace.mode, "surface");
assert.ok(workspace.permissions.includes("session.channels.read"));
assert.ok(workspace.permissions.includes("session.status.read"));
assert.ok(workspace.permissions.includes("session.members.read"));
assert.ok(workspace.permissions.includes("session.memberAvatars.read"));
assert.ok(workspace.permissions.includes("session.channel.join"));
@@ -347,8 +352,9 @@ test("KAAK v3 example declares the connection home and complete voice workspace"
assert.ok(nodes.some((node) => node.widget === "voice.audio-controls"));
assert.ok(nodes.some((node) => node.widget === "voice.member-cards"));
assert.ok(nodes.some((node) => node.widget === "voice.audio-controls" && node.options?.layout === "room-panel"));
assert.ok(nodes.some((node) => node.widget === "voice.server-switcher"), "the server header exposes trusted quick switching");
assert.ok(nodes.some((node) => node.widget === "voice.channel-tree"), "channels and avatars render in the trusted nested tree");
assert.ok(nodes.some((node) => node.widget === "voice.server-header"), "the server header exposes trusted search and quick switching");
assert.ok(nodes.some((node) => node.widget === "voice.channel-tree" && node.options?.layout === "server-sidebar"), "the KAAK channel tree opts into its isolated sidebar layout");
assert.equal(nodes.find((node) => node.part === "record-placeholder")?.attributes?.disabled, true, "recording remains a visual-only disabled placeholder");
assert.ok(nodes.some((node) => node.widget === "voice.screen-share-start"), "the voice dock exposes WebSpeak screen sharing");
assert.ok(nodes.some((node) => node.widget === "voice.screen-share-player"), "the voice stage keeps WebSpeak's screen-share player");
assert.equal(nodes.find((node) => node.part === "screen-share-stop")?.events?.click, "stop-screen-share");
+9 -4
View File
@@ -45,6 +45,7 @@ export const SKIN_PLUGIN_HOST_WIDGETS = Object.freeze([
"app.skin-switcher",
"app.language-switcher",
"voice.server-switcher",
"voice.server-header",
"voice.channel-tree",
"voice.channel-panel",
"voice.member-cards",
@@ -63,13 +64,14 @@ export interface SkinPluginWidgetOptions {
screenShare?: boolean;
/** Show the trusted member actions trigger on desktop member cards. */
memberActions?: boolean;
/** Select a supported host presentation for audio controls. */
layout?: "default" | "room-panel";
/** Select a supported host presentation for audio controls or a channel tree. */
layout?: "default" | "room-panel" | "server-sidebar";
}
const widgetPermissions = (...permissions: SkinPluginPermission[]): readonly SkinPluginPermission[] => Object.freeze(permissions);
export const SKIN_PLUGIN_HOST_WIDGET_PERMISSIONS: Partial<Record<SkinPluginHostWidget, readonly SkinPluginPermission[]>> = Object.freeze({
"voice.channel-tree": widgetPermissions("session.channels.read", "session.members.read", "session.memberAvatars.read", "session.channel.join"),
"voice.server-switcher": widgetPermissions("servers.quickList.read", "servers.quickList.switch"),
"voice.server-header": widgetPermissions("session.status.read", "servers.quickList.read", "servers.quickList.switch"),
"voice.audio-controls": widgetPermissions("audio.status.read", "audio.microphone.control", "audio.output.control"),
"voice.chat-panel": widgetPermissions("chat.channel.read", "chat.channel.send"),
"voice.connection-controls": widgetPermissions("voice.disconnect"),
@@ -437,14 +439,17 @@ export function parseSkinPluginDocument(input: unknown): SkinPluginDocument {
? new Set(["screenShare", "memberActions"])
: rawNode.widget === "voice.performance-panel"
? new Set(["screenShare"])
: rawNode.widget === "voice.audio-controls"
: rawNode.widget === "voice.audio-controls" || rawNode.widget === "voice.channel-tree"
? new Set(["layout"])
: new Set<string>();
if (!isRecord(rawNode.options)
|| Object.keys(rawNode.options).some((key) => !supportedOptions.has(key))
|| (rawNode.options.screenShare !== undefined && typeof rawNode.options.screenShare !== "boolean")
|| (rawNode.options.memberActions !== undefined && typeof rawNode.options.memberActions !== "boolean")
|| (rawNode.options.layout !== undefined && rawNode.options.layout !== "default" && rawNode.options.layout !== "room-panel")) {
|| (rawNode.options.layout !== undefined
&& rawNode.options.layout !== "default"
&& rawNode.options.layout !== "room-panel"
&& !(rawNode.widget === "voice.channel-tree" && rawNode.options.layout === "server-sidebar"))) {
fail("SKIN_PLUGIN_WIDGET_OPTIONS_INVALID", "This host widget uses unsupported options.");
}
options = {
Binary file not shown.
@@ -1,19 +1,21 @@
<template>
<ul
v-if="tree.length"
v-if="visibleTree.length"
class="ws-voice-channel-tree"
data-ws-part="voice.channel-tree.list"
:data-layout="layout"
role="tree"
aria-label="语音频道 / Voice channels"
>
<VoiceChannelTreeItem
v-for="node in tree"
v-for="node in visibleTree"
:key="node.channel.id"
:node="node"
:depth="0"
:layout="layout"
:current-channel-id="currentChannelId"
:selected-channel-id="selectedChannelId"
:expanded-ids="expandedIds"
:expanded-ids="effectiveExpandedIds"
:avatar-style="avatarStyle"
:avatar-initial="avatarInitial"
:is-speaking="isSpeaking"
@@ -28,19 +30,21 @@
class="ws-voice-channel-tree-empty"
data-ws-part="voice.channel-tree.empty"
role="status"
>无可用语音频道 / No voice channels</div>
>{{ query.trim() ? "没有匹配的频道 / No matching channels" : "无可用语音频道 / No voice channels" }}</div>
</template>
<script setup lang="ts">
import { computed, ref, watch, type CSSProperties } from "vue";
import type { ChannelMember } from "../../composables/useVoiceWebSocket.js";
import type { TreeChannel } from "../../composables/useWebClientChannels.js";
import { buildVoiceChannelTree } from "../../services/voice-channel-tree.js";
import { buildVoiceChannelTree, filterVoiceChannelTree } from "../../services/voice-channel-tree.js";
import VoiceChannelTreeItem from "./VoiceChannelTreeItem.vue";
const props = defineProps<{
channels: readonly TreeChannel[];
currentChannelId?: string;
query?: string;
layout?: "default" | "server-sidebar";
avatarStyle: (name: string, isSelf?: boolean, avatar?: string) => CSSProperties;
avatarInitial: (name: string) => string;
isSpeaking: (member: ChannelMember) => boolean;
@@ -48,8 +52,22 @@ const props = defineProps<{
}>();
const tree = computed(() => buildVoiceChannelTree(props.channels));
const layout = computed(() => props.layout ?? "default");
const query = computed(() => props.query ?? "");
const visibleTree = computed(() => filterVoiceChannelTree(tree.value, query.value));
const selectedChannelId = ref(props.currentChannelId ?? "");
const expandedIds = ref(new Set<string>());
const effectiveExpandedIds = computed(() => {
const result = new Set(expandedIds.value);
if (!query.value.trim()) return result;
const pending = [...visibleTree.value];
while (pending.length) {
const node = pending.pop()!;
if (node.children.length) result.add(node.channel.id);
pending.push(...node.children);
}
return result;
});
watch(() => props.currentChannelId, (channelId) => {
if (channelId) selectedChannelId.value = channelId;
@@ -62,7 +80,7 @@ watch(tree, (nodes) => {
while (pending.length) {
const node = pending.pop()!;
availableIds.add(node.channel.id);
if (node.children.length || node.channel.members.length) expanded.add(node.channel.id);
if (node.children.length || (layout.value === "default" && node.channel.members.length)) expanded.add(node.channel.id);
pending.push(...node.children);
}
for (const id of expanded) if (!availableIds.has(id)) expanded.delete(id);
@@ -85,4 +103,5 @@ function joinChannel(channel: TreeChannel): void {
const emit = defineEmits<{
join: [channel: TreeChannel];
}>();
</script>
@@ -4,15 +4,15 @@
data-ws-part="voice.channel-tree.node"
role="treeitem"
:aria-level="depth + 1"
:aria-expanded="hasContents ? expanded : undefined"
:aria-expanded="isExpandable ? expanded : undefined"
:aria-selected="selected"
:aria-current="current ? 'location' : undefined"
:data-current="current ? 'true' : 'false'"
:data-selected="selected ? 'true' : 'false'"
>
<div class="ws-voice-channel-line" data-ws-part="voice.channel-tree.line">
<div class="ws-voice-channel-line" data-ws-part="voice.channel-tree.line" :style="{ '--channel-depth': depth }">
<button
v-if="hasContents"
v-if="isExpandable"
type="button"
class="ws-voice-channel-expander"
data-ws-part="voice.channel-tree.expander"
@@ -20,7 +20,6 @@
:aria-expanded="expanded"
@click.stop="emit('toggle', node.channel.id)"
><Icon :name="expanded ? 'chevron-down' : 'chevron-right'" :size="13" /></button>
<span v-else class="ws-voice-channel-expander-placeholder" aria-hidden="true"></span>
<button
type="button"
class="ws-voice-channel-row"
@@ -39,8 +38,72 @@
</button>
</div>
<template v-if="layout === 'server-sidebar'">
<ul v-if="node.channel.members.length" class="ws-voice-channel-member-list" role="group" :style="{ '--channel-depth': depth }">
<li
v-for="member in node.channel.members"
:key="member.id"
class="ws-voice-channel-member"
data-ws-part="voice.channel-tree.member"
role="treeitem"
:aria-level="depth + 2"
:aria-label="`${member.nickname}${member.isSelf ? `, ${t('you')}` : ''}${member.inputMuted ? `, ${t('inputMuted')}` : ''}`"
:data-self="member.isSelf ? 'true' : 'false'"
>
<span
class="ws-voice-channel-member-avatar"
data-ws-part="voice.channel-tree.avatar"
:style="avatarStyle(member.nickname, member.isSelf, member.avatar)"
aria-hidden="true"
>{{ member.avatar ? '' : avatarInitial(member.nickname) }}</span>
<span class="ws-voice-channel-member-name" data-ws-part="voice.channel-tree.member-name">{{ member.nickname }}</span>
<span v-if="member.isSelf" class="ws-voice-channel-member-self">你</span>
<Icon
v-if="member.inputMuted"
class="ws-voice-channel-member-muted"
data-ws-part="voice.channel-tree.member-muted"
name="mic-off"
:size="13"
:title="t('inputMuted')"
/>
<Icon
v-else
class="ws-voice-channel-member-mic"
name="mic"
:size="13"
:title="t('microphoneActive')"
/>
</li>
</ul>
<div
v-if="hasChildren"
class="ws-voice-channel-branch"
data-ws-part="voice.channel-tree.branch"
:data-expanded="expanded ? 'true' : 'false'"
>
<ul class="ws-voice-channel-branch-content" role="group">
<VoiceChannelTreeItem
v-for="child in node.children"
:key="child.channel.id"
:node="child"
:depth="depth + 1"
:layout="layout"
:current-channel-id="currentChannelId"
:selected-channel-id="selectedChannelId"
:expanded-ids="expandedIds"
:avatar-style="avatarStyle"
:avatar-initial="avatarInitial"
:is-speaking="isSpeaking"
:t="t"
@toggle="emit('toggle', $event)"
@select="emit('select', $event)"
@join="emit('join', $event)"
/>
</ul>
</div>
</template>
<div
v-if="hasContents"
v-else-if="hasContents"
class="ws-voice-channel-branch"
data-ws-part="voice.channel-tree.branch"
:data-expanded="expanded ? 'true' : 'false'"
@@ -88,6 +151,7 @@
:key="child.channel.id"
:node="child"
:depth="depth + 1"
:layout="layout"
:current-channel-id="currentChannelId"
:selected-channel-id="selectedChannelId"
:expanded-ids="expandedIds"
@@ -116,6 +180,7 @@ defineOptions({ name: "VoiceChannelTreeItem" });
const props = defineProps<{
node: VoiceChannelTreeNode<TreeChannel>;
depth: number;
layout: "default" | "server-sidebar";
currentChannelId?: string;
selectedChannelId: string;
expandedIds: ReadonlySet<string>;
@@ -132,7 +197,9 @@ const emit = defineEmits<{
}>();
const expanded = computed(() => props.expandedIds.has(props.node.channel.id));
const hasContents = computed(() => props.node.children.length > 0 || props.node.channel.members.length > 0);
const hasChildren = computed(() => props.node.children.length > 0);
const hasContents = computed(() => hasChildren.value || props.node.channel.members.length > 0);
const isExpandable = computed(() => props.layout === "server-sidebar" ? hasChildren.value : hasContents.value);
const current = computed(() => props.node.channel.id === props.currentChannelId);
const selected = computed(() => props.node.channel.id === props.selectedChannelId);
const memberCount = computed(() => String(props.node.channel.members.length).padStart(2, "0"));
@@ -0,0 +1,86 @@
<template>
<header class="ws-voice-server-header">
<div class="ws-voice-server-title-line">
<strong class="ws-voice-server-name">{{ serverLabel || "TeamSpeak" }}</strong>
<VoiceServerSwitcher :servers="servers" :on-switch-server="onSwitchServer" />
</div>
<div class="ws-voice-server-meta-line">
<div class="ws-voice-server-tags">
<span class="ws-voice-server-tag">TeamSpeak</span>
<span class="ws-voice-server-tag" :class="`is-${connectionState}`">
<i v-if="connectionState === 'connected'" aria-hidden="true"></i>
{{ connectionLabel }}
</span>
</div>
<button
ref="searchButton"
class="ws-voice-server-search-toggle"
type="button"
:aria-expanded="searchOpen"
aria-label="搜索频道 / Search channels"
title="搜索频道 / Search channels"
@click="toggleSearch"
><Icon name="search" :size="18" /></button>
</div>
<label v-if="searchOpen" class="ws-voice-server-search-box">
<span class="sr-only">搜索频道名称 / Search channel names</span>
<Icon name="search" :size="16" />
<input
ref="searchInput"
v-model="query"
type="search"
autocomplete="off"
spellcheck="false"
placeholder="搜索频道 / Search channels"
@keydown.esc.prevent="closeSearch"
/>
<button v-if="query" type="button" aria-label="清除搜索 / Clear search" @click="query = ''; searchInput?.focus()">
<Icon name="close" :size="15" />
</button>
</label>
<div class="ws-voice-server-divider" aria-hidden="true"></div>
</header>
</template>
<script setup lang="ts">
import { computed, nextTick, ref, watch } from "vue";
import type { SkinPluginQuickServer } from "../../services/skin-plugin-context.js";
import Icon from "../Icon.vue";
import VoiceServerSwitcher from "./VoiceServerSwitcher.vue";
const props = defineProps<{
serverLabel: string;
connectionState: "connected" | "connecting" | "disconnected";
servers: readonly SkinPluginQuickServer[];
onSwitchServer: (quickServerId: string) => void;
}>();
const emit = defineEmits<{ "update:query": [value: string] }>();
const searchOpen = ref(false);
const query = ref("");
const searchButton = ref<HTMLButtonElement | null>(null);
const searchInput = ref<HTMLInputElement | null>(null);
const connectionLabel = computed(() => ({
connected: "已连接",
connecting: "连接中",
disconnected: "未连接",
})[props.connectionState]);
watch(query, (value) => emit("update:query", value));
async function toggleSearch(): Promise<void> {
if (searchOpen.value) {
closeSearch();
return;
}
searchOpen.value = true;
await nextTick();
searchInput.value?.focus();
}
function closeSearch(): void {
searchOpen.value = false;
query.value = "";
void nextTick(() => searchButton.value?.focus());
}
</script>
+2 -2
View File
@@ -46,10 +46,10 @@ export const BUILTIN_SKIN_CATALOG: SkinCatalogEntry[] = [
{
id: BUILTIN_KAAK_SKIN_ID,
name: "KAAK",
version: "3.1.65",
version: "3.1.66",
author: "WebSpeak Project",
license: "AGPL-3.0-only",
description: "A KOOK-inspired voice-room workspace with a live server header, quick server switching, a nested channel tree with member avatars, attached channel chat, and WebSpeak voice controls.",
description: "A KOOK-inspired voice-room workspace with a searchable server header, nested channel members, attached channel chat, and a compact WebSpeak audio dock.",
minAppVersion: "0.2.7-preview",
installedAt: 0,
builtIn: true,
+16 -11
View File
@@ -464,7 +464,7 @@ test("the distributable KAAK package provides full home and voice surfaces", asy
const file = new File([archive], "kaak-voice.wskin", { type: "application/octet-stream" });
const skin = await importSkinPack(file);
assert.equal(skin.id, "community.kaak-voice");
assert.equal(skin.version, "3.1.65");
assert.equal(skin.version, "3.1.66");
assert.equal(BUILTIN_SKIN_CATALOG.find((entry) => entry.id === skin.id)?.version, skin.version);
assert.equal(skin.schemaVersion, 3);
const home = skin.pluginData?.components.find((component) => component.page === "home");
@@ -478,6 +478,7 @@ test("the distributable KAAK package provides full home and voice surfaces", asy
assert.ok(voice?.permissions.includes("ui.surface.replace"));
assert.ok(voice?.permissions.includes("servers.quickList.read"));
assert.ok(voice?.permissions.includes("servers.quickList.switch"));
assert.ok(voice?.permissions.includes("session.status.read"));
assert.ok(voice?.permissions.includes("session.channels.read"));
assert.ok(voice?.permissions.includes("session.members.read"));
assert.ok(voice?.permissions.includes("session.memberAvatars.read"));
@@ -497,11 +498,11 @@ test("the distributable KAAK package provides full home and voice surfaces", asy
}
return undefined;
}
assert.equal(findPart(voice?.root, "server-name")?.children?.[0]?.text, "{{session.status.serverLabel}}");
assert.equal(findPart(voice?.root, "server-switcher")?.widget, "voice.server-switcher");
assert.deepEqual(findPart(voice?.root, "server-connection-dot")?.when, { path: "session.status.connectionState", equals: "connected" });
assert.equal(findPart(voice?.root, "server-subtitle")?.children?.[0]?.text, "已连接 · {{session.status.userName}}");
assert.equal(findPart(voice?.root, "server-summary")?.widget, "voice.server-header");
assert.equal(findPart(voice?.root, "record-placeholder")?.attributes?.disabled, true);
assert.equal(findPart(voice?.root, "recording-label")?.children?.[0]?.text, "REC");
assert.equal(findPart(voice?.root, "voice-channel-tree")?.widget, "voice.channel-tree");
assert.deepEqual(findPart(voice?.root, "voice-channel-tree")?.options, { layout: "server-sidebar" });
assert.equal(findPart(voice?.root, "channel-row"), undefined, "channels render in the trusted nested tree widget");
assert.equal(voice?.actions["select-channel"], undefined);
assert.equal(voice?.actions["join-channel"], undefined);
@@ -555,6 +556,7 @@ test("the distributable KAAK package provides full home and voice surfaces", asy
assert.equal(findPart(voice?.root, "audio-controls")?.widget, "voice.audio-controls");
assert.deepEqual(findPart(voice?.root, "audio-controls")?.options, { layout: "room-panel" });
assert.ok(skin.css.includes('[data-ws-plugin-part="kaak-workspace.server-summary"]'));
assert.ok(skin.css.includes(".ws-voice-server-search-toggle"));
assert.ok(skin.css.includes(".ws-voice-server-switcher-menu"));
assert.ok(skin.css.includes('[data-ws-plugin-part="kaak-workspace"] .ws-voice-channel-row'));
assert.match(skin.css, /ws-voice-channel-node\[data-current="true"\][\s\S]*?box-shadow: inset 2px 0 var\(--skin-kaak-accent\);/);
@@ -562,12 +564,15 @@ test("the distributable KAAK package provides full home and voice surfaces", asy
assert.match(skin.css, /ws-voice-channel-member-avatar[\s\S]*?border-radius: 50%;/);
assert.match(skin.css, /--skin-kaak-font:[\s\S]*?PingFang SC/);
assert.match(skin.css, /--skin-kaak-accent: #6cbf00;/);
assert.match(skin.css, /voice-dock"\] \{[\s\S]*?width: min\(264px, 100%\);[\s\S]*?border-radius: 17px;/);
assert.match(skin.css, /voice-dock-actions"\] \{[\s\S]*?grid-template-columns: minmax\(0, 1fr\) 37px 37px 37px;[\s\S]*?grid-template-rows: 28px 23px;/);
assert.match(skin.css, /\[data-ws-plugin-part="kaak-workspace\.voice-dock"\] \{[\s\S]*?width: min\(282px, calc\(100% - 22px\)\);[\s\S]*?margin-bottom: 11px;[\s\S]*?border-radius: 17px;/);
assert.match(skin.css, /\[data-ws-plugin-part="kaak-workspace\.voice-dock-actions"\] \{[\s\S]*?grid-template-columns: minmax\(0, 1fr\) 36px 36px 36px;[\s\S]*?grid-template-rows: 29px 26px;[\s\S]*?row-gap: 21px;/);
assert.match(skin.css, /ws-voice-channel-tree\[data-layout="server-sidebar"\] \.ws-voice-channel-line[\s\S]*?min-height: 38px;/);
assert.match(skin.css, /ws-voice-channel-tree\[data-layout="server-sidebar"\] \.ws-voice-channel-member[\s\S]*?min-height: 29px;/);
assert.match(skin.css, /kaak-workspace\.record-placeholder"\][\s\S]*?grid-column: 3;[\s\S]*?grid-row: 1;[\s\S]*?background: #69c000;/);
assert.match(skin.css, /desktop-audio-dock-room-panel \{\s*display: contents;\s*\}/);
assert.match(skin.css, /desktop-audio-dock-copy \{ display: none; \}/);
assert.match(skin.css, /kaak-workspace\.voice-dock-share"\] \{ grid-column: 1 \/ 4; grid-row: 1;/);
assert.match(skin.css, /kaak-workspace\.voice-dock-share[\s\S]*?skin-runtime-screen-share-start \{[\s\S]*?height: 28px;[\s\S]*?background: #6cbf00;/);
assert.match(skin.css, /\[data-ws-plugin-part="kaak-workspace\.voice-dock-share"\] \{ grid-column: 1 \/ 3; grid-row: 1;/);
assert.match(skin.css, /\[data-ws-plugin-part="kaak-workspace\.voice-dock-share"\] \.skin-runtime-screen-share-start \{[\s\S]*?background: #69c000;/);
assert.match(skin.css, /room-panel-audio-settings[\s\S]*?grid-column: 1;[\s\S]*?grid-row: 2;/);
assert.match(skin.css, /noise-suppression-toggle \{ grid-column: 2; grid-row: 2; align-self: center; \}/);
assert.match(skin.css, /voice\.audio-dock\.microphone[\s\S]*?grid-column: 3;[\s\S]*?grid-row: 2;/);
@@ -625,8 +630,8 @@ test("the distributable KAAK package provides full home and voice surfaces", asy
assert.match(skin.css, /data-voice-group-open="false"[\s\S]*?voice-channel-list[\s\S]*?grid-template-rows: 0fr;[\s\S]*?visibility: hidden;[\s\S]*?visibility 0s linear \.18s/);
assert.match(skin.css, /voice-stage-heading[\s\S]*?flex: 0 0 46px;/);
assert.doesNotMatch(skin.css, /aria-expanded="true"\]\s*[^\n]*voice-stage-heading[^\n]*display: none;/);
assert.match(skin.css, /kaak-workspace"\]:has\(\[data-ws-plugin-part="kaak-workspace\.chat-panel-toggle"\]\[aria-expanded="false"\]\)[\s\S]*?grid-template-columns: 86px 290px minmax\(280px, 1fr\) 0;/);
assert.match(skin.css, /grid-template-columns: 86px 290px/);
assert.match(skin.css, /grid-template-columns: 86px 304px minmax\(280px, 1fr\) 0;/);
assert.match(skin.css, /grid-template-columns: 86px 304px/);
assert.match(skin.css, /minmax\(340px, min\(38vw, 520px\)\)/);
assert.match(skin.css, /grid-template-rows: 40px/);
assert.match(skin.css, /kaak-workspace\.server-rail"\]\s*\{[\s\S]*?--skin-kaak-rail-bg: #191a1d;[\s\S]*?--skin-kaak-rail-item-bg: #2b2d32;[\s\S]*?--skin-kaak-rail-accent: #75c900;[\s\S]*?gap: 18px;[\s\S]*?padding: 14px 0 96px;[\s\S]*?background: var\(--skin-kaak-rail-bg\);/);
@@ -0,0 +1,22 @@
import assert from "node:assert/strict";
import test from "node:test";
import { buildVoiceChannelTree, filterVoiceChannelTree } from "./voice-channel-tree.js";
test("channel search keeps matching nested channels and only their ancestors", () => {
const tree = buildVoiceChannelTree([
{ id: "root", depth: 0, name: "大厅" },
{ id: "lobby", depth: 1, name: "聊天大厅" },
{ id: "games", depth: 1, name: "游戏区" },
{ id: "afk", depth: 2, name: "AFK" },
{ id: "music", depth: 2, name: "音乐" },
{ id: "other", depth: 0, name: "其他" },
]);
const results = filterVoiceChannelTree(tree, " afk ");
assert.deepEqual(results.map(({ channel }) => channel.id), ["root"]);
assert.deepEqual(results[0].children.map(({ channel }) => channel.id), ["games"]);
assert.deepEqual(results[0].children[0].children.map(({ channel }) => channel.id), ["afk"]);
assert.deepEqual(filterVoiceChannelTree(tree, "大厅").map(({ channel }) => channel.id), ["root"]);
assert.deepEqual(filterVoiceChannelTree(tree, "missing"), []);
assert.deepEqual(filterVoiceChannelTree(tree, " "), tree);
});
+15
View File
@@ -35,3 +35,18 @@ export function buildVoiceChannelTree<T extends VoiceChannelTreeSource>(
return roots;
}
/** Filters visible channel names while retaining ancestors of matching nested channels. */
export function filterVoiceChannelTree<T extends VoiceChannelTreeSource & { name: string }>(
nodes: readonly VoiceChannelTreeNode<T>[],
query: string,
): VoiceChannelTreeNode<T>[] {
const needle = query.trim().toLocaleLowerCase();
if (!needle) return [...nodes];
return nodes.flatMap((node) => {
const children = filterVoiceChannelTree(node.children, needle);
return node.channel.name.toLocaleLowerCase().includes(needle) || children.length
? [{ ...node, children }]
: [];
});
}
+15 -4
View File
@@ -981,6 +981,7 @@ import VoiceMemberCards from "../components/web-client/VoiceMemberCards.vue";
import VoicePerformancePanel from "../components/web-client/VoicePerformancePanel.vue";
import VoiceChannelTree from "../components/web-client/VoiceChannelTree.vue";
import VoiceServerSwitcher from "../components/web-client/VoiceServerSwitcher.vue";
import VoiceServerHeader from "../components/web-client/VoiceServerHeader.vue";
import ScreenShareSettingsDialog from "../components/web-client/ScreenShareSettingsDialog.vue";
import ScreenSharePlayer from "../components/web-client/ScreenSharePlayer.vue";
import AudioDock from "../components/web-client/AudioDock.vue";
@@ -1121,7 +1122,8 @@ const serverPassword = ref("");
const rememberIdentity = ref(localStorage.getItem("webspeak:remember-identity") !== "0");
const accelerationRelayId = ref("");
const browserError = ref("");
const memberQuery = ref("");
const memberQuery = ref("");
const channelTreeSearchQuery = ref("");
const selectedChannelId = ref("");
const settingsOpen = ref(false);
const favoriteServerDialogOpen = ref(false);
@@ -1779,9 +1781,18 @@ const skinPluginWidgets = {
servers: skinPluginQuickList.value,
onSwitchServer: switchQuickServerByOpaqueId,
}),
"voice.channel-tree": () => h(VoiceChannelTree, {
"voice.server-header": () => h(VoiceServerHeader, {
serverLabel: currentServerDisplayName.value,
connectionState: voiceState.connected ? "connected" : voiceState.connecting || voiceState.reconnecting ? "connecting" : "disconnected",
servers: skinPluginQuickList.value,
onSwitchServer: switchQuickServerByOpaqueId,
"onUpdate:query": (value: string) => { channelTreeSearchQuery.value = value; },
}),
"voice.channel-tree": (options?: SkinPluginWidgetOptions) => h(VoiceChannelTree, {
channels: channelTree.value,
currentChannelId: currentChannel.value?.id,
query: channelTreeSearchQuery.value,
layout: options?.layout === "server-sidebar" ? "server-sidebar" : "default",
avatarStyle,
avatarInitial,
isSpeaking,
@@ -1857,10 +1868,10 @@ const skinPluginWidgets = {
}, [h(Icon, { name: "music", size: 18 })]),
] : []),
])
: h(AudioDock, {
: h(AudioDock, {
model: audioDockState,
controls: audioControls,
layout: options?.layout,
layout: options?.layout === "room-panel" ? "room-panel" : "default",
t,
rangeStyle,
onSettings: () => { settingsOpen.value = true; },