mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-03 03:52:50 +08:00
feat: add host chrome theming and a skin-proof recovery layer
Allow skins to theme host chrome through a second scope and explicit visibleParts. Official and built-in skins stay decoration-free by default. Harden the CSS compiler so skins cannot hide the document root, push protected controls off-screen, or target the host layer with sibling selectors. Move recovery and authorization UI into a closed Shadow DOM on the top layer, so a third-party skin cannot block the built-in skin reset.
This commit is contained in:
1 parent
33ba062686
commit
f8d61d22ef
45 files changed
+3535
-558
No files matched your search
+26
-33
@@ -1,3 +1,13 @@
|
||||
import {
|
||||
AUTH_PASSWORD_PART_IDS,
|
||||
DECORATIVE_PART_IDS,
|
||||
HOST_PART_IDS,
|
||||
PROTECTED_PART_IDS,
|
||||
TRUSTED_PART_IDS,
|
||||
} from "./skin-visual-parts.js";
|
||||
|
||||
export { AUTH_PASSWORD_PART_IDS, DECORATIVE_PART_IDS, TRUSTED_PART_IDS, PROTECTED_PART_IDS, HOST_PART_IDS };
|
||||
|
||||
export type SkinLayoutPage = "home" | "voice" | "demo";
|
||||
export type SkinLayoutProfile = "desktop" | "tablet" | "mobile";
|
||||
|
||||
@@ -46,24 +56,10 @@ export interface SkinLayoutComponent {
|
||||
editable: boolean;
|
||||
}
|
||||
|
||||
const AUTH_PASSWORD_PART_IDS = [
|
||||
"auth.password.backdrop",
|
||||
"auth.password.dialog",
|
||||
"auth.password.decoration",
|
||||
"auth.password.eyebrow",
|
||||
"auth.password.title",
|
||||
"auth.password.lead",
|
||||
"auth.password.form",
|
||||
"auth.password.label",
|
||||
"auth.password.field",
|
||||
"auth.password.field-icon",
|
||||
"auth.password.error",
|
||||
"auth.password.actions",
|
||||
] as const;
|
||||
|
||||
const PUBLIC_PART_IDS = new Set<string>([
|
||||
"app",
|
||||
"app.toast",
|
||||
"app.skin-load-recovery",
|
||||
...AUTH_PASSWORD_PART_IDS,
|
||||
"control",
|
||||
"demo.action.poke",
|
||||
@@ -330,25 +326,16 @@ const PUBLIC_PART_IDS = new Set<string>([
|
||||
"voice.shell",
|
||||
"voice.whisper-strip",
|
||||
"voice.workspace",
|
||||
// Host chrome is rendered outside the skin root. It stays in the public
|
||||
// part registry so contract tests and the layout catalogue describe it,
|
||||
// even though the layout editor only moves elements inside the root.
|
||||
...HOST_PART_IDS,
|
||||
"home.footer.decoration",
|
||||
"home.footer.clear",
|
||||
"skin.library",
|
||||
]);
|
||||
|
||||
const CONTROL_KINDS = ["button", "link", "input", "checkbox", "range", "select", "textarea", "menuitem", "draggable"] as const;
|
||||
const TRUSTED_PART_IDS = new Set([
|
||||
...AUTH_PASSWORD_PART_IDS,
|
||||
"app",
|
||||
"app.toast",
|
||||
"home.security-note",
|
||||
"home.identity-import.security",
|
||||
"voice.connection-status",
|
||||
"voice.screen-share-error",
|
||||
]);
|
||||
const DECORATIVE_PART_IDS = new Set([
|
||||
"demo.avatar", "demo.badge", "demo.note", "demo.poke-notification", "demo.wave",
|
||||
"home.feature", "home.features", "home.footer", "home.hero.eyebrow", "home.join-card.sonar",
|
||||
"home.join-card.waveform", "home.visitors", "voice.activity.artwork", "voice.member.avatar-wrap",
|
||||
"voice.member.live-indicator", "voice.performance.metrics", "voice.performance.webrtc-stats",
|
||||
"voice.screen-player.viewer-avatar",
|
||||
]);
|
||||
const SHELL_PART_IDS = new Set([
|
||||
"app", "home", "home.content", "home.form", "home.header", "voice.shell", "voice.workspace",
|
||||
"voice.content", "demo.layout", "demo.main",
|
||||
@@ -373,6 +360,7 @@ const ACTION_PART_IDS = new Set([
|
||||
"voice.favorite-servers.strip.server", "demo.voice-card", "home.identity-import.drop-zone",
|
||||
"voice.channel-group", "voice.member-row", "voice.server-switcher.trigger", "voice.server-switcher.item",
|
||||
"voice.channel-tree.expander", "voice.channel-tree.row", "demo.skin-switcher", "demo.language-switcher",
|
||||
"skin.library", "home.footer.clear", "host.plugins.launcher",
|
||||
]);
|
||||
const INTERACTIVE_PART_IDS = new Set([
|
||||
"voice.connection-status.nickname.input", "voice.connection-status.reconnect",
|
||||
@@ -392,6 +380,7 @@ const INTERACTIVE_PART_IDS = new Set([
|
||||
"voice.screen-player.exit", "voice.screen-player.fullscreen", "demo.voice-card",
|
||||
"home.identity-import.drop-zone", "voice.channel-group", "voice.member-row", "demo.skin-switcher",
|
||||
"demo.language-switcher",
|
||||
"skin.library", "home.footer.clear", "host.plugins.launcher",
|
||||
]);
|
||||
const IDENTITY_PART_IDS = new Set([
|
||||
"home.identity", "home.identity-actions", "home.identity-export.button", "home.identity-import-dialog",
|
||||
@@ -402,8 +391,9 @@ const IDENTITY_PART_IDS = new Set([
|
||||
]);
|
||||
const COMMON_PART_IDS = new Set([
|
||||
...AUTH_PASSWORD_PART_IDS,
|
||||
"app", "app.toast", "control", "skin.trigger", "skin.menu", "skin.option",
|
||||
"language.trigger", "language.menu", "language.option",
|
||||
...HOST_PART_IDS,
|
||||
"app", "app.toast", "app.skin-load-recovery", "control", "skin.trigger", "skin.menu", "skin.option",
|
||||
"skin.library", "language.trigger", "language.menu", "language.option",
|
||||
]);
|
||||
|
||||
function pageOfPart(id: string): SkinLayoutPage | "common" | null {
|
||||
@@ -444,6 +434,9 @@ const COMPONENT_NAME_PARTS: Record<string, string> = {
|
||||
user: "User", video: "Video", viewer: "Viewer", viewers: "Viewers", visitors: "Visitors", voice: "Voice",
|
||||
volume: "Volume", wave: "Wave", waveform: "Waveform", webrtc: "WebRTC", whisper: "Whisper", workspace: "Workspace",
|
||||
wrap: "Wrapper", zone: "Drop zone",
|
||||
host: "Host", plugins: "Plugins", launcher: "Launcher", overlay: "Overlay", watermark: "Watermark",
|
||||
decoration: "Decoration", recovery: "Recovery", permission: "Permission", library: "Library",
|
||||
clear: "Clear",
|
||||
};
|
||||
|
||||
function componentName(id: string): string {
|
||||
|
||||
Reference in new issue
Block a user