diff --git a/docs/SKIN_DEVELOPMENT.md b/docs/SKIN_DEVELOPMENT.md index 2194dc0..3d361f5 100644 --- a/docs/SKIN_DEVELOPMENT.md +++ b/docs/SKIN_DEVELOPMENT.md @@ -162,7 +162,9 @@ components.json 顶层接受 schemaVersion 1、2 或 3 和 components 数组。s } ``` -当前可选宿主控件 ID:`home.connection-form`、`home.connection-status`、`home.server-announcement`、`home.social-links`、`home.identity-provider`、`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-banner`、`voice.server-switcher`、`voice.channel-tree`。未知控件和同页重复控件会被拒绝;每个控件的状态和业务动作仍由 WebSpeak 内部处理。`home.identity-provider` 是通用身份提供方入口,需用 `options.identityProviderId` 和 `options.identityProviderLabel` 指定稳定提供方标识与显示名;宿主会把点击转交给应用代码的 `registerIdentityProviderAdapter` 分发接口,皮肤只能发起请求、不能注册适配器。当前没有 MyTS 适配器,所以 MyTS 入口仍提示开发中;这不代表已经实现登录认证。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`,在非本人卡片上显示可信宿主成员操作入口(包含现有个人音量控件);也可为 `voice.channel-tree` 设置该选项,在非本人频道树成员行上启用右键菜单;菜单仍由 WebSpeak 宿主处理,皮肤不获得额外动作或数据接口。频道树还可单独设置 `options.memberDragDrop: true`,将非本人成员拖到另一频道行时复用 WebSpeak 现有移动成员操作;悬停和拖入高亮由皮肤样式控制,此选项默认关闭且只适用于频道树。成员卡片或性能卡片可设置 `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 还提供经独立权限保护的麦克风/扬声器、输出音量、噪声抑制、伴奏、离开状态、悄悄话、断开连接和屏幕共享动作;噪声抑制使用 `audio.toggleNoiseSuppression` 与 `audio.microphone.control`,伴奏使用 `audio.toggleAccompaniment` 与 `audio.output.control`。它们只调用 WebSpeak 已有操作,屏幕采集仍由浏览器或操作系统询问用户。 +当前可选宿主控件 ID:`home.connection-form`、`home.connection-status`、`home.visitor-count`、`home.server-announcement`、`home.social-links`、`home.identity-provider`、`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-banner`、`voice.server-switcher`、`voice.channel-tree`。未知控件和同页重复控件会被拒绝;每个控件的状态和业务动作仍由 WebSpeak 内部处理。`home.identity-provider` 是通用身份提供方入口,需用 `options.identityProviderId` 和 `options.identityProviderLabel` 指定稳定提供方标识与显示名;宿主会把点击转交给应用代码的 `registerIdentityProviderAdapter` 分发接口,皮肤只能发起请求、不能注册适配器。当前没有 MyTS 适配器,所以 MyTS 入口仍提示开发中;这不代表已经实现登录认证。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`,在非本人卡片上显示可信宿主成员操作入口(包含现有个人音量控件);也可为 `voice.channel-tree` 设置该选项,在非本人频道树成员行上启用右键菜单;菜单仍由 WebSpeak 宿主处理,皮肤不获得额外动作或数据接口。频道树还可单独设置 `options.memberDragDrop: true`,将非本人成员拖到另一频道行时复用 WebSpeak 现有移动成员操作;悬停和拖入高亮由皮肤样式控制,此选项默认关闭且只适用于频道树。成员卡片或性能卡片可设置 `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 还提供经独立权限保护的麦克风/扬声器、输出音量、噪声抑制、伴奏、离开状态、悄悄话、断开连接和屏幕共享动作;噪声抑制使用 `audio.toggleNoiseSuppression` 与 `audio.microphone.control`,伴奏使用 `audio.toggleAccompaniment` 与 `audio.output.control`。它们只调用 WebSpeak 已有操作,屏幕采集仍由浏览器或操作系统询问用户。 + +首页访客统计使用公开宿主控件 `home.visitor-count`:它展示当前访客序号与累计访客数,文本跟随当前界面语言,并在统计数据尚不可用时隐藏;不需声明权限。该控件复用 WebSpeak 日间首页的同一结构与基础样式,皮肤通过包内 CSS 定位,不需要自建统计逻辑。组件节点可用稳定的 `part` 名称(例如 `visitor-stats`)控制位置;内部 `home.visitors`、`home.visitors.orbit`、`home.visitors.icon`、`home.visitors.label`、`home.visitors.divider`、`home.visitors.total` 和 `home.visitors.spark` 是稳定样式部件。控件只能放在 `home` 页面。 可信语音导航控件包括 `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 当前连接流程。v3 还可用 `session.invite.copy` 授权 `session.copyInviteLink`,让宿主复制当前公开服务器与频道的邀请链接并排除连接凭据。语音状态投影中的 `serverLabel` 会在看起来像 IP、域名或连接目标时省略,避免把地址显示为服务器名称。 @@ -326,7 +328,7 @@ Wasm 每轮最多读取一次输入并提交一个 UI 输出;首版宿主动 | 页面区域 | `data-ws-part` | | --- | --- | | 通用 | `app`、`app.toast`、`control`、`skin.trigger`、`skin.menu`、`skin.option`、`language.trigger`、`language.menu`、`language.option` | -| 首页 | `home`、`home.header`、`home.brand`、`home.header-tools`、`home.gateway-status`、`home.content`、`home.hero`、`home.hero.eyebrow`、`home.hero.title`、`home.hero.description`、`home.features`、`home.feature`、`home.visitors`、`home.join-card`、`home.join-card.waveform`、`home.join-card.sonar`、`home.join-title`、`home.join-description`、`home.notice`、`home.form`、`home.server-target`、`home.field-label`、`home.field`、`home.relay-choice`、`home.relay-choice.copy`、`home.server-history`、`home.server-history.group`、`home.server-history.item`、`home.server-history.select`、`home.server-history.favorite-toggle`、`home.favorite-toggle`、`home.identity`、`home.identity-actions`、`home.identity-provider.button`、`home.identity-provider.label`、`home.identity-import.open`、`home.identity-export.button`、`home.identity-import-dialog`、`home.identity-import.header`、`home.identity-import.close`、`home.identity-import.textarea`、`home.identity-import.drop-zone`、`home.identity-import.file-button`、`home.identity-import.error`、`home.identity-import.security`、`home.identity-import.footer`、`home.identity-import.cancel`、`home.identity-import.submit`、`home.server-announcement`、`home.server-announcement.title`、`home.server-announcement.body`、`home.social-links`、`home.connection-status`、`home.connect`、`home.security-note`、`home.footer`、`home.community-dialog` | +| 首页 | `home`、`home.header`、`home.brand`、`home.header-tools`、`home.gateway-status`、`home.content`、`home.hero`、`home.hero.eyebrow`、`home.hero.title`、`home.hero.description`、`home.features`、`home.feature`、`home.visitors`、`home.visitors.orbit`、`home.visitors.icon`、`home.visitors.label`、`home.visitors.divider`、`home.visitors.total`、`home.visitors.spark`、`home.join-card`、`home.join-card.waveform`、`home.join-card.sonar`、`home.join-title`、`home.join-description`、`home.notice`、`home.form`、`home.server-target`、`home.field-label`、`home.field`、`home.relay-choice`、`home.relay-choice.copy`、`home.server-history`、`home.server-history.group`、`home.server-history.item`、`home.server-history.select`、`home.server-history.favorite-toggle`、`home.favorite-toggle`、`home.identity`、`home.identity-actions`、`home.identity-provider.button`、`home.identity-provider.label`、`home.identity-import.open`、`home.identity-export.button`、`home.identity-import-dialog`、`home.identity-import.header`、`home.identity-import.close`、`home.identity-import.textarea`、`home.identity-import.drop-zone`、`home.identity-import.file-button`、`home.identity-import.error`、`home.identity-import.security`、`home.identity-import.footer`、`home.identity-import.cancel`、`home.identity-import.submit`、`home.server-announcement`、`home.server-announcement.title`、`home.server-announcement.body`、`home.social-links`、`home.connection-status`、`home.connect`、`home.security-note`、`home.footer`、`home.community-dialog` | | 语音工作区 | `voice.shell`、`voice.workspace`、`voice.header`、`voice.header-actions`、`voice.breadcrumbs`、`voice.performance`、`voice.performance.panel`、`voice.performance.route`、`voice.performance.metrics`、`voice.performance.status`、`voice.performance.webrtc-stats`、`voice.connection-status`、`voice.audio-status`、`voice.poke`、`voice.scroll`、`voice.content`、`voice.activity`、`voice.activity.artwork`、`voice.activity-heading`、`voice.screen-share-error`、`voice.members`、`voice.members.empty`、`voice.member`、`voice.member.action-trigger`、`voice.member.avatar-wrap`、`voice.member.avatar`、`voice.member.mic-status`、`voice.member.name`、`voice.member.status`、`voice.member.live-indicator`、`voice.member.stop-share`、`voice.member.share-actions`、`voice.member-panel`、`voice.member-panel.heading`、`voice.member-panel.search`、`voice.member-panel.channels`、`voice.channel-group`、`voice.channel-group.heading`、`voice.channel-group.members`、`voice.member-row`、`voice.member-row.avatar`、`voice.member-row.copy`、`voice.member-row.flags`、`voice.member-row.volume`、`voice.whisper-strip`、`voice.audio-dock`、`voice.audio-dock.microphone`、`voice.audio-dock.microphone-panel`、`voice.audio-dock.output`、`voice.audio-dock.output-panel`、`voice.audio-settings`、`voice.audio-settings.device-select`、`voice.audio-settings.device-select-trigger`、`voice.audio-settings.device-select-chevron`、`voice.audio-settings.device-select-menu`、`voice.audio-settings.device-select-option`、`voice.mobile-more`、`voice.mobile-nav` | | KOOK 频道树与服务器切换 | `voice.server-switcher`、`voice.server-switcher.trigger`、`voice.server-switcher.menu`、`voice.server-switcher.item`、`voice.server-switcher.icon`、`voice.server-switcher.label`、`voice.server-switcher.current`、`voice.server-switcher.empty`、`voice.channel-tree.list`、`voice.channel-tree.empty`、`voice.channel-tree.node`、`voice.channel-tree.line`、`voice.channel-tree.expander`、`voice.channel-tree.row`、`voice.channel-tree.icon`、`voice.channel-tree.join-hint`、`voice.channel-tree.name`、`voice.channel-tree.count`、`voice.channel-tree.branch`、`voice.channel-tree.member`、`voice.channel-tree.avatar`、`voice.channel-tree.member-name`、`voice.channel-tree.member-muted`、`voice.channel-tree.member-screen-share`、`voice.channel-tree.member-speaking`、`voice.channel-tree.member-away` | | 快速服务器 | `voice.favorite-servers.rail`、`voice.favorite-servers.rail.list`、`voice.favorite-servers.rail.item`、`voice.favorite-servers.server`、`voice.favorite-servers.avatar`、`voice.favorite-servers.tooltip`、`voice.favorite-servers.favorite-toggle`、`voice.favorite-servers.add`、`voice.favorite-servers.strip`、`voice.favorite-servers.strip.item`、`voice.favorite-servers.strip.server`、`voice.favorite-servers.strip.favorite-toggle`、`voice.favorite-servers.strip.add`、`voice.favorite-servers.switch-status`、`voice.favorite-servers.current-toggle`、`voice.favorite-servers.dialog-backdrop`、`voice.favorite-servers.dialog`、`voice.favorite-servers.dialog.header`、`voice.favorite-servers.dialog.close`、`voice.favorite-servers.dialog.form`、`voice.favorite-servers.dialog.field`、`voice.favorite-servers.dialog.input`、`voice.favorite-servers.dialog.target`、`voice.favorite-servers.dialog.hint`、`voice.favorite-servers.dialog.actions`、`voice.favorite-servers.dialog.cancel`、`voice.favorite-servers.dialog.submit` | diff --git a/docs/examples/kaak-voice.wskin b/docs/examples/kaak-voice.wskin index 345e6cf..6eb54a5 100644 Binary files a/docs/examples/kaak-voice.wskin and b/docs/examples/kaak-voice.wskin differ diff --git a/docs/examples/kaak-voice/components.json b/docs/examples/kaak-voice/components.json index 3c2d2c0..2c7a5f0 100644 --- a/docs/examples/kaak-voice/components.json +++ b/docs/examples/kaak-voice/components.json @@ -65,60 +65,93 @@ "tag": "svg", "part": "illustration", "attributes": { - "viewbox": "0 0 550 510", + "viewbox": "0 0 640 480", "role": "img", - "aria-label": "WebSpeak 展示插画" + "aria-label": "WebSpeak voice connection illustration" }, "children": [ { "tag": "rect", "attributes": { - "x": 45, - "y": 65, - "width": 460, - "height": 400, - "rx": 80, + "x": 40, + "y": 22, + "width": 560, + "height": 436, + "rx": 88, "fill": "#b0f49b" } }, + { + "tag": "path", + "attributes": { + "d": "M526 51v-18M549 61l13-13", + "stroke": "#ff9b70", + "stroke-width": 12, + "fill": "none", + "stroke-linecap": "round" + } + }, + { + "tag": "circle", + "attributes": { + "cx": 526, + "cy": 83, + "r": 23, + "fill": "#ff9b70" + } + }, { "tag": "rect", "attributes": { - "x": 90, - "y": 145, - "width": 370, - "height": 275, - "rx": 28, + "x": 295, + "y": 394, + "width": 50, + "height": 29, + "rx": 7, "fill": "#223641" } }, { "tag": "rect", "attributes": { - "x": 103, - "y": 157, - "width": 344, - "height": 250, - "rx": 18, - "fill": "#f7fff7" + "x": 250, + "y": 418, + "width": 140, + "height": 16, + "rx": 8, + "fill": "#223641" } }, { "tag": "rect", "attributes": { - "x": 103, - "y": 157, - "width": 344, - "height": 45, - "rx": 18, + "x": 120, + "y": 110, + "width": 400, + "height": 288, + "rx": 25, + "fill": "#223641" + } + }, + { + "tag": "path", + "attributes": { + "d": "M147 122h346a15 15 0 0 1 15 15v234a15 15 0 0 1-15 15H147a15 15 0 0 1-15-15V137a15 15 0 0 1 15-15Z", + "fill": "#f5fff4" + } + }, + { + "tag": "path", + "attributes": { + "d": "M147 122h346a15 15 0 0 1 15 15v31H132v-31a15 15 0 0 1 15-15Z", "fill": "#e4f5e6" } }, { "tag": "circle", "attributes": { - "cx": 128, - "cy": 178, + "cx": 156, + "cy": 145, "r": 6, "fill": "#82cd62" } @@ -126,8 +159,8 @@ { "tag": "circle", "attributes": { - "cx": 149, - "cy": 178, + "cx": 177, + "cy": 145, "r": 6, "fill": "#c2e3b2" } @@ -135,10 +168,10 @@ { "tag": "rect", "attributes": { - "x": 135, - "y": 236, - "width": 135, - "height": 14, + "x": 160, + "y": 205, + "width": 128, + "height": 13, "rx": 7, "fill": "#acdca6" } @@ -146,10 +179,10 @@ { "tag": "rect", "attributes": { - "x": 135, - "y": 265, - "width": 100, - "height": 12, + "x": 160, + "y": 233, + "width": 94, + "height": 11, "rx": 6, "fill": "#d6e8d8" } @@ -157,10 +190,21 @@ { "tag": "rect", "attributes": { - "x": 135, - "y": 292, - "width": 110, - "height": 12, + "x": 160, + "y": 258, + "width": 112, + "height": 11, + "rx": 6, + "fill": "#d6e8d8" + } + }, + { + "tag": "rect", + "attributes": { + "x": 160, + "y": 283, + "width": 84, + "height": 11, "rx": 6, "fill": "#d6e8d8" } @@ -168,16 +212,16 @@ { "tag": "circle", "attributes": { - "cx": 348, - "cy": 287, - "r": 54, - "fill": "#7dcf4b" + "cx": 418, + "cy": 250, + "r": 46, + "fill": "#77d33d" } }, { "tag": "path", "attributes": { - "d": "M319 287v-10a29 29 0 0 1 58 0v10", + "d": "M394 251v-10a24 24 0 0 1 48 0v10", "stroke": "white", "stroke-width": 10, "fill": "none", @@ -187,81 +231,55 @@ { "tag": "rect", "attributes": { - "x": 311, - "y": 279, - "width": 17, - "height": 32, - "rx": 8, - "fill": "white" - } - }, - { - "tag": "rect", - "attributes": { - "x": 369, - "y": 279, - "width": 17, - "height": 32, - "rx": 8, - "fill": "white" - } - }, - { - "tag": "rect", - "attributes": { - "x": 255, - "y": 417, - "width": 143, - "height": 13, + "x": 387, + "y": 246, + "width": 13, + "height": 27, "rx": 6, - "fill": "#233641" + "fill": "white" + } + }, + { + "tag": "rect", + "attributes": { + "x": 436, + "y": 246, + "width": 13, + "height": 27, + "rx": 6, + "fill": "white" } }, { "tag": "circle", "attributes": { - "cx": 77, - "cy": 348, - "r": 39, + "cx": 99, + "cy": 338, + "r": 38, "fill": "#55c3cf" } }, { "tag": "path", "attributes": { - "d": "M58 342h12l14-12v37l-14-12H58z", + "d": "M76 330h9l14-12v38l-14-12h-9z", "fill": "white" } }, { "tag": "path", "attributes": { - "d": "M92 340q12 12 0 25", + "d": "M107 327q13 13 0 27", "stroke": "white", "stroke-width": 5, "fill": "none" } - }, - { - "tag": "circle", - "attributes": { - "cx": 457, - "cy": 100, - "r": 18, - "fill": "#ff9b70" - } - }, - { - "tag": "path", - "attributes": { - "d": "M454 75v-23M478 76l15-14", - "stroke": "#ff9b70", - "stroke-width": 9, - "fill": "none", - "stroke-linecap": "round" - } } ] + }, + { + "widget": "home.visitor-count", + "part": "visitor-stats" } ] } diff --git a/docs/examples/kaak-voice/manifest.json b/docs/examples/kaak-voice/manifest.json index 1ab33c3..bd35a36 100644 --- a/docs/examples/kaak-voice/manifest.json +++ b/docs/examples/kaak-voice/manifest.json @@ -3,7 +3,7 @@ "packageType": "open-skin", "id": "community.kaak-voice", "name": "KAAK", - "version": "3.1.108", + "version": "3.1.115", "author": "WebSpeak Project", "license": "AGPL-3.0-only", "description": "A KOOK-inspired WebSpeak skin with a split-screen connection home, searchable server header, TeamSpeak banner, nested channel members, unified chat with local history, and a compact audio dock.", diff --git a/docs/examples/kaak-voice/skin.css b/docs/examples/kaak-voice/skin.css index 9f92ae3..6e8b8ba 100644 --- a/docs/examples/kaak-voice/skin.css +++ b/docs/examples/kaak-voice/skin.css @@ -16,14 +16,19 @@ --skin-kaak-font: "PingFang SC", "Microsoft YaHei New", 微软雅黑, "Microsoft Yahei", "Microsoft JhengHei", 宋体, SimSun, "Helvetica Neue", Helvetica, Arial, sans-serif; } -[data-ws-plugin-part="kaak-home"] { +[data-ws-plugin-part="kaak-home.home"] { --skin-kaak-home-green: #77cb25; --skin-kaak-home-text: #273248; --skin-kaak-home-muted: #8995a5; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); - min-height: 100vh; - min-height: 100dvh; + grid-template-rows: minmax(0, 1fr); + width: 100%; + height: calc(var(--ws-viewport-height, 100dvh) / var(--ui-scale, 1)); + min-height: calc(var(--ws-viewport-height, 100dvh) / var(--ui-scale, 1)); + max-height: calc(var(--ws-viewport-height, 100dvh) / var(--ui-scale, 1)); + overflow-x: hidden; + overflow-y: auto; color: var(--skin-kaak-home-text); color-scheme: light; font-family: Arial, "Microsoft YaHei", sans-serif; @@ -120,7 +125,10 @@ [data-ws-plugin-part="kaak-home.hero"] { position: relative; - min-height: 600px; + display: grid; + grid-template-rows: auto auto auto minmax(0, 1fr); + min-width: 0; + min-height: 0; overflow: visible; background: linear-gradient(145deg, #f7ffbd, #d9ffb3 55%, #b7f89e); } @@ -225,21 +233,42 @@ } [data-ws-plugin-part="kaak-home.hero-media"] { - position: absolute; + box-sizing: border-box; + position: relative; z-index: 1; - inset: 43% 6% 5%; display: grid; + width: auto; + min-width: 0; + min-height: 0; + margin: clamp(16px, 2.8dvh, 32px) 6% 5%; place-items: center; overflow: hidden; border-radius: 20px; } [data-ws-plugin-part="kaak-home.illustration"] { + display: block; width: 100%; height: 100%; + min-width: 0; max-height: 100%; } +[data-ws-plugin-part="kaak-home.visitor-stats"] { + position: absolute; + top: 64%; + left: 50%; + z-index: 2; + width: max-content; + max-width: 58%; + transform: translate(-50%, -50%); +} + +[data-ws-plugin-part="kaak-home.visitor-stats"] [data-ws-part="home.visitors"] { + max-width: 100%; + margin: 0; +} + [data-ws-plugin-part="kaak-home.right"] { display: flex; align-items: center; @@ -507,7 +536,7 @@ } @media (max-width: 850px) { - [data-ws-plugin-part="kaak-home"] { + [data-ws-plugin-part="kaak-home.home"] { grid-template-columns: minmax(0, 1fr); } @@ -2061,8 +2090,8 @@ [data-ws-plugin-part="kaak-workspace"][data-ws-plugin-surface="voice"] .ws-plugin-disconnect-control:hover { background: #3a292b; } [data-ws-plugin-part="kaak-workspace"][data-ws-plugin-surface="voice"] button:focus-visible, -[data-ws-plugin-part="kaak-home"] button:focus-visible, -[data-ws-plugin-part="kaak-home"] input:focus-visible { +[data-ws-plugin-part="kaak-home.home"] button:focus-visible, +[data-ws-plugin-part="kaak-home.home"] input:focus-visible { outline: 2px solid var(--skin-kaak-accent); outline-offset: 2px; } @@ -2228,7 +2257,7 @@ [data-ws-plugin-part="kaak-workspace"][data-ws-plugin-surface="voice"] { transition: none; } [data-ws-plugin-part="kaak-workspace.conversation"], [data-ws-plugin-part="kaak-workspace.chat-panel-expand"] { transition: none; } - [data-ws-plugin-part="kaak-home"] *, + [data-ws-plugin-part="kaak-home.home"] *, [data-ws-plugin-part="kaak-workspace"][data-ws-plugin-surface="voice"] * { scroll-behavior: auto; animation-duration: .01ms; diff --git a/src/shared/skin-layout.ts b/src/shared/skin-layout.ts index 4f649a0..ab3c0d9 100644 --- a/src/shared/skin-layout.ts +++ b/src/shared/skin-layout.ts @@ -162,6 +162,12 @@ const PUBLIC_PART_IDS = new Set([ "home.server-history.select", "home.server-target", "home.visitors", + "home.visitors.divider", + "home.visitors.icon", + "home.visitors.label", + "home.visitors.orbit", + "home.visitors.spark", + "home.visitors.total", "language.menu", "language.option", "language.trigger", diff --git a/src/shared/skin-plugin.test.ts b/src/shared/skin-plugin.test.ts index 265fea9..73980eb 100644 --- a/src/shared/skin-plugin.test.ts +++ b/src/shared/skin-plugin.test.ts @@ -237,6 +237,22 @@ test("home connection status widget requires the public session status permissio assert.deepEqual(skinPluginWidgetPermissions("home.connection-status"), ["session.status.read"]); }); +test("visitor count is a permission-free public home widget and cannot mount on other pages", () => { + const document = validDocument(); + document.schemaVersion = 3; + document.components[0].page = "home"; + document.components[0].permissions = []; + document.components[0].actions = {}; + document.components[0].root = { tag: "main", children: [{ widget: "home.visitor-count", part: "visitors" }] }; + + const parsed = parseSkinPluginDocument(document); + assert.equal(parsed.components[0].root.children?.[0].widget, "home.visitor-count"); + assert.deepEqual(skinPluginWidgetPermissions("home.visitor-count"), []); + + document.components[0].page = "voice"; + errorCode(() => parseSkinPluginDocument(document), "SKIN_PLUGIN_WIDGET_INVALID"); +}); + test("generic identity-provider entry is a host button with no connection permission or skin action", () => { const document = validDocument(); document.schemaVersion = 3; @@ -519,6 +535,7 @@ test("KAAK v3 example declares the connection home and complete voice workspace" const heroMedia = home.root.children?.[0].children?.[3]; assert.equal(heroMedia?.part, "hero-media"); assert.equal(heroMedia?.children?.[0].tag, "svg"); + assert.equal(heroMedia?.children?.[1].widget, "home.visitor-count"); assert.equal(workspace.page, "voice"); assert.equal(workspace.mode, "surface"); diff --git a/src/shared/skin-plugin.ts b/src/shared/skin-plugin.ts index f6c8d34..83662b8 100644 --- a/src/shared/skin-plugin.ts +++ b/src/shared/skin-plugin.ts @@ -45,6 +45,7 @@ export type SkinPluginComponentMode = "widget" | "surface"; export const SKIN_PLUGIN_HOST_WIDGETS = Object.freeze([ "home.connection-form", "home.connection-status", + "home.visitor-count", "home.server-announcement", "home.social-links", "home.identity-provider", @@ -470,6 +471,7 @@ export function parseSkinPluginDocument(input: unknown): SkinPluginDocument { if (rawNode.widget !== undefined) { if (typeof rawNode.widget !== "string" || !HOST_WIDGETS.has(rawNode.widget)) fail("SKIN_PLUGIN_WIDGET_INVALID", "The component requests an unsupported host widget."); if (page === "demo") fail("SKIN_PLUGIN_WIDGET_INVALID", "Host widgets are available only on the home and voice client pages."); + if (rawNode.widget === "home.visitor-count" && page !== "home") fail("SKIN_PLUGIN_WIDGET_INVALID", "The visitor count widget is available only on the home page."); if (rawNode.options !== undefined && inputSchemaVersion < 3) fail("SKIN_PLUGIN_SCHEMA_UNSUPPORTED", "Host widget options require components schema version 3."); // Preserve existing schema v2 packages; newly authored v3 widgets must declare every // permission needed by the trusted host UI they embed. Screen-share start was already gated. diff --git a/web/public/skins/kaak-voice.wskin b/web/public/skins/kaak-voice.wskin index 345e6cf..6eb54a5 100644 Binary files a/web/public/skins/kaak-voice.wskin and b/web/public/skins/kaak-voice.wskin differ diff --git a/web/src/components/web-client/VisitorCount.vue b/web/src/components/web-client/VisitorCount.vue new file mode 100644 index 0000000..2f2a436 --- /dev/null +++ b/web/src/components/web-client/VisitorCount.vue @@ -0,0 +1,35 @@ + + + diff --git a/web/src/services/skin-catalog.ts b/web/src/services/skin-catalog.ts index 6fe589a..c1ce1ae 100644 --- a/web/src/services/skin-catalog.ts +++ b/web/src/services/skin-catalog.ts @@ -46,7 +46,7 @@ export const BUILTIN_SKIN_CATALOG: SkinCatalogEntry[] = [ { id: BUILTIN_KAAK_SKIN_ID, name: "KAAK", - version: "3.1.108", + version: "3.1.115", author: "WebSpeak Project", license: "AGPL-3.0-only", description: "A KOOK-inspired WebSpeak skin with a split-screen connection home, searchable server header, TeamSpeak banner, nested channel members, unified chat with local history, and a compact audio dock.", diff --git a/web/src/services/skin-pack.test.ts b/web/src/services/skin-pack.test.ts index 9d23de5..8755d8a 100644 --- a/web/src/services/skin-pack.test.ts +++ b/web/src/services/skin-pack.test.ts @@ -486,7 +486,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.108"); + assert.equal(skin.version, "3.1.115"); 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"); @@ -496,6 +496,11 @@ test("the distributable KAAK package provides full home and voice surfaces", asy ["kaak-workspace", "surface"], ]); assert.ok(home?.permissions.includes("ui.surface.replace")); + assert.match(skin.css, /kaak-home\.home"\]\s*\{[\s\S]*?height: calc\(var\(--ws-viewport-height, 100dvh\) \/ var\(--ui-scale, 1\)\);[\s\S]*?overflow-y: auto;/, "only the explicitly named KAAK home root receives viewport layout styles"); + assert.doesNotMatch(skin.css, /\[data-ws-plugin-part="kaak-home"\]\s*\{/, "unlabelled SVG nodes cannot inherit home root sizing rules"); + assert.match(skin.css, /kaak-home\.right"\]\s*\{[\s\S]*?padding: 210px 28px 45px;/, "the login card keeps its existing vertical position"); + assert.match(skin.css, /kaak-home\.hero"\]\s*\{[\s\S]*?display: grid;[\s\S]*?grid-template-rows: auto auto auto minmax\(0, 1fr\);/, "the announcement and illustration have separate rows within the left panel"); + assert.match(skin.css, /kaak-home\.hero-media"\]\s*\{[\s\S]*?position: relative;[\s\S]*?margin: clamp\(16px, 2\.8dvh, 32px\) 6% 5%;/, "the left illustration follows the announcement with a bounded gap"); assert.match(skin.css, /@media \(max-width: 850px\)[\s\S]*?\[data-ws-plugin-part="kaak-home\.hero"\]\s*\{\s*display: none;/, "the narrow connection home hides the green hero and screen illustration"); assert.match(skin.css, /@media \(max-width: 850px\)[\s\S]*?\[data-ws-plugin-part="kaak-home\.welcome-title"\]\s*\{\s*display: none;/, "the narrow connection home shows only the login card"); assert.equal(voice?.stateScope, "session.status.channelId"); @@ -531,9 +536,21 @@ test("the distributable KAAK package provides full home and voice surfaces", asy } assert.equal(findPart(home?.root, "home-language")?.widget, "app.language-switcher", "the KAAK connection home has a language switcher in its top corner"); assert.equal(findPart(home?.root, "server-announcement")?.widget, "home.server-announcement", "the KAAK connection home displays the localized administrator announcement"); + assert.equal(findPart(home?.root, "visitor-stats")?.widget, "home.visitor-count", "the KAAK home composes the public visitor count widget over the monitor screen"); + assert.match(skin.css, /kaak-home\.visitor-stats"\]\s*\{[^}]*position: absolute;[^}]*top: 64%;[^}]*left: 50%;[^}]*max-width: 58%;/, "visitor statistics are contained within the monitor screen by the package"); assert.match(skin.css, /\[data-ws-plugin-part="kaak-home\.hero"\]\s*\{[^}]*overflow: visible;/, "the hero does not clip the announcement as it spans the full home width"); assert.match(skin.css, /\[data-ws-plugin-part="kaak-home\.server-announcement"\][^}]*width: calc\(100% - 40px\);[^}]*margin: 20px 20px 0;/, "the announcement card fills its half-width hero with 20px side margins"); assert.match(skin.css, /\[data-ws-plugin-part="kaak-home\.server-announcement"\] \[data-ws-part="home\.server-announcement\.body"\]\s*\{[^}]*color: #273248;/, "the announcement uses the published semantic text part with a readable color"); + const illustration = findPart(home?.root, "illustration"); + assert.equal(illustration?.attributes?.viewbox, "0 0 640 480", "the KAAK illustration uses a balanced 4:3 viewBox"); + const monitorFrame = illustration?.children?.[5]; + const screenBackground = illustration?.children?.[6]; + const screenHeader = illustration?.children?.[7]; + assert.deepEqual([monitorFrame?.attributes?.x, monitorFrame?.attributes?.y, monitorFrame?.attributes?.width, monitorFrame?.attributes?.height], [120, 110, 400, 288]); + assert.equal(screenBackground?.attributes?.d, "M147 122h346a15 15 0 0 1 15 15v234a15 15 0 0 1-15 15H147a15 15 0 0 1-15-15V137a15 15 0 0 1 15-15Z"); + assert.equal(screenHeader?.attributes?.d, "M147 122h346a15 15 0 0 1 15 15v31H132v-31a15 15 0 0 1 15-15Z"); + assert.match(skin.css, /kaak-home\.hero"\]\s*\{[^}]*min-width: 0;/, "the illustration column can shrink without overlapping the adjacent home panel"); + assert.match(skin.css, /kaak-home\.hero-media"\]\s*\{[^}]*width: auto;[^}]*min-width: 0;[^}]*margin: clamp\(16px, 2\.8dvh, 32px\) 6% 5%;/, "the monitor artwork fits between its left and right margins without clipping"); assert.equal(findPart(home?.root, "home-social-links")?.widget, "home.social-links", "the KAAK connection home exposes icon links beside the language switcher"); assert.equal(findPart(home?.root, "identity-provider")?.widget, "home.identity-provider"); assert.deepEqual(findPart(home?.root, "identity-provider")?.options, { identityProviderId: "myts", identityProviderLabel: "myts" }); @@ -729,7 +746,7 @@ test("the distributable KAAK package provides full home and voice surfaces", asy assert.match(skin.css, /\.settings-select:hover:not\(:disabled\) \{\s*border-color: #6cbf00;/); assert.match(skin.css, /\.microphone-toggle:not\(\.muted\):active,[\s\S]*?background: #60ab00;\s*border-color: #60ab00;/); assert.doesNotMatch(skin.css, /#58c877/); - assert.match(skin.css, /\[data-ws-plugin-part="kaak-home"\] \{[^}]*font-family: Arial, "Microsoft YaHei", sans-serif;/); + assert.match(skin.css, /\[data-ws-plugin-part="kaak-home\.home"\] \{[^}]*font-family: Arial, "Microsoft YaHei", sans-serif;/); assert.match(skin.css, /\[data-ws-part="home\.identity-provider\.button"\][\s\S]*?clip-path: polygon\(0 0, 100% 0, 100% 100%\);/); assert.match(skin.css, /\[data-ws-part="home\.identity-provider\.label"\][\s\S]*?color: #fff;[\s\S]*?transform: rotate\(45deg\);/); assert.match(skin.css, /settings-select-menu[\s\S]*?background: #25262a/); diff --git a/web/src/styles/web-client.css b/web/src/styles/web-client.css index 345a253..32b9150 100644 --- a/web/src/styles/web-client.css +++ b/web/src/styles/web-client.css @@ -351,7 +351,7 @@ font-size: 10px; } -.visitor-count { +:global(.visitor-count) { position: relative; display: inline-flex; align-items: center; @@ -367,12 +367,12 @@ border-radius: 999px; background: linear-gradient(110deg, rgba(225, 250, 245, .94), rgba(244, 255, 252, .78)); box-shadow: 0 10px 24px rgba(0, 106, 100, .1), inset 0 0 0 1px rgba(255, 255, 255, .55); - font-size: 12px; + font-size: 15px; font-weight: 700; letter-spacing: .035em; } -.visitor-count::before { +:global(.visitor-count::before) { position: absolute; top: 0; bottom: 0; @@ -385,7 +385,7 @@ animation: visitor-shimmer 3.6s 1.5s ease-in-out infinite; } -.visitor-count-orbit { +:global(.visitor-count-orbit) { position: absolute; top: -20px; right: 12px; @@ -397,7 +397,7 @@ animation: visitor-orbit 4s ease-in-out infinite; } -.visitor-count-icon { +:global(.visitor-count-icon) { position: relative; z-index: 1; display: grid; @@ -411,7 +411,7 @@ box-shadow: 0 0 0 4px rgba(55, 205, 182, .12), 0 0 18px rgba(55, 205, 182, .24); } -.visitor-count-label { +:global(.visitor-count-label) { position: relative; z-index: 1; min-width: 0; @@ -420,7 +420,7 @@ white-space: nowrap; } -.visitor-count-divider { +:global(.visitor-count-divider) { position: relative; z-index: 1; width: 1px; @@ -430,7 +430,7 @@ opacity: .24; } -.visitor-count-total { +:global(.visitor-count-total) { position: relative; z-index: 1; min-width: 0; @@ -443,7 +443,7 @@ opacity: .78; } -.visitor-count-spark { +:global(.visitor-count-spark) { position: relative; z-index: 1; color: #35bea7; @@ -3926,10 +3926,6 @@ font-size: 16.25px; } -.join-page .visitor-count { - font-size: 15px; -} - :deep(.join-page .notice) { font-size: 15px; } diff --git a/web/src/views/WebClient.vue b/web/src/views/WebClient.vue index 3f07244..7fe13db 100644 --- a/web/src/views/WebClient.vue +++ b/web/src/views/WebClient.vue @@ -118,41 +118,11 @@ > -
- - - {{ - t("visitorCount", { count: visitorNumber }) - }} - - {{ t("visitorTotal", { count: visitorTotal }) }} - -
+
{ }); const skinPluginWidgets = { + "home.visitor-count": () => visitorNumber.value === null ? null : h(VisitorCount, { + currentLabel: t("visitorCount", { count: visitorNumber.value }), + totalLabel: visitorTotal.value === null ? undefined : t("visitorTotal", { count: visitorTotal.value }), + }), "home.server-announcement": () => h("section", { "data-ws-part": "home.server-announcement", "aria-label": t("serverAnnouncement"),