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
@@ -0,0 +1,251 @@
|
||||
<template>
|
||||
<!-- Host chrome is intentionally outside .ws-skin-root so a v3 surface
|
||||
replacement cannot delete the recovery path or the authorization UI. -->
|
||||
<Teleport to="body">
|
||||
<div class="ws-host-chrome" data-ws-host-chrome>
|
||||
<div
|
||||
v-if="!isHostPartHidden('host.watermark')"
|
||||
class="ws-host-watermark"
|
||||
data-ws-part="host.watermark"
|
||||
aria-hidden="true"
|
||||
>WebSpeak</div>
|
||||
|
||||
<p
|
||||
v-if="!isHostPartHidden('host.hint')"
|
||||
class="ws-host-hint"
|
||||
data-ws-part="host.hint"
|
||||
>{{ copy.hint }}</p>
|
||||
|
||||
<div
|
||||
v-if="!isHostPartHidden('host.voice-status-decoration')"
|
||||
class="ws-host-voice-status-decoration"
|
||||
data-ws-part="host.voice-status-decoration"
|
||||
aria-hidden="true"
|
||||
><span></span><span></span></div>
|
||||
</div>
|
||||
</Teleport>
|
||||
|
||||
<!-- Trusted recovery entry. It lives in a closed shadow root and a manual
|
||||
popover, so no compiled skin selector can target it (shadow boundary)
|
||||
and no normal stacking context can cover it (top layer). It carries no
|
||||
`data-ws-part`: there is intentionally no skin hook for this control. -->
|
||||
<Teleport v-if="layer" :to="layer.container">
|
||||
<div
|
||||
ref="recoveryPopover"
|
||||
popover="manual"
|
||||
class="ws-host-recovery"
|
||||
data-ws-host-recovery
|
||||
role="region"
|
||||
:aria-label="copy.recovery"
|
||||
>
|
||||
<span class="ws-host-recovery-mark" aria-hidden="true">◈</span>
|
||||
<button
|
||||
type="button"
|
||||
data-ws-recovery-action="built-in"
|
||||
:title="copy.shortcut"
|
||||
@click="useBuiltInSkin"
|
||||
>{{ copy.useBuiltIn }}</button>
|
||||
<button
|
||||
type="button"
|
||||
data-ws-recovery-action="library"
|
||||
:title="copy.library"
|
||||
@click="openLibrary"
|
||||
>{{ copy.library }}</button>
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
||||
import type { SiteLanguage } from "../../../src/site-copy.js";
|
||||
import { hostChromeCopy } from "../i18n/host-chrome.js";
|
||||
import {
|
||||
isHostPartHidden,
|
||||
isHostPartVisuallyReachable,
|
||||
isRecoveryShortcut,
|
||||
isThirdPartySkinActive,
|
||||
openPluginLibrary,
|
||||
requestBuiltInSkin,
|
||||
} from "../services/host-chrome.js";
|
||||
import {
|
||||
createHostOwnedLayer,
|
||||
syncRecoveryPopover,
|
||||
type HostOwnedLayer,
|
||||
} from "../services/host-owned-layer.js";
|
||||
import { shouldShowRecovery } from "../services/host-chrome-visibility.js";
|
||||
import { thirdPartyAllowed } from "../services/instance-authorization.js";
|
||||
|
||||
const props = withDefaults(defineProps<{ language: SiteLanguage; connected?: boolean }>(), { connected: false });
|
||||
const copy = computed(() => hostChromeCopy[props.language] ?? hostChromeCopy.en);
|
||||
|
||||
// Styles live inside the closed shadow root: the component's scoped stylesheet
|
||||
// in <head> cannot cross the shadow boundary.
|
||||
const RECOVERY_LAYER_CSS = `
|
||||
:host { font: 11px/1.2 ui-sans-serif, system-ui, sans-serif; }
|
||||
.ws-host-recovery {
|
||||
position: fixed;
|
||||
inset: auto auto calc(38px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
|
||||
margin: 0;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
max-width: calc(100vw - 24px);
|
||||
padding: 4px 5px 4px 9px;
|
||||
border: 1px solid #9db6b2;
|
||||
border-radius: 999px;
|
||||
background: color-mix(in srgb, #ffffff 92%, transparent);
|
||||
color: #31524f;
|
||||
box-shadow: 0 6px 18px #0f2a2626;
|
||||
pointer-events: auto;
|
||||
}
|
||||
.ws-host-recovery:popover-open { display: flex; }
|
||||
.ws-host-recovery-mark { font-size: 12px; line-height: 1; }
|
||||
.ws-host-recovery button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 28px;
|
||||
padding: 4px 9px;
|
||||
border: 1px solid #9db6b2;
|
||||
border-radius: 999px;
|
||||
background: #fff;
|
||||
color: #31524f;
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.ws-host-recovery button[data-ws-recovery-action="built-in"] {
|
||||
border-color: #b45309;
|
||||
background: #fff7ed;
|
||||
color: #7c2d12;
|
||||
}
|
||||
.ws-host-recovery button:hover { filter: brightness(.96); }
|
||||
.ws-host-recovery button:focus-visible { outline: 2px solid #4c8f88; outline-offset: 2px; }
|
||||
@media (prefers-reduced-motion: reduce) { .ws-host-recovery button { transition: none; } }
|
||||
`;
|
||||
|
||||
const layer: HostOwnedLayer | null = createHostOwnedLayer("recovery", RECOVERY_LAYER_CSS);
|
||||
|
||||
// CSS-only hiding is invisible to `isHostPartHidden`, so sample the launcher's
|
||||
// live geometry. A one-second interval is enough for a recovery fallback and
|
||||
// stays cheaper than a MutationObserver on the whole document. While a
|
||||
// third-party skin is active the entry is persistent and this sample only
|
||||
// matters for the official-skin fallback.
|
||||
const launcherReachable = ref(true);
|
||||
const showRecovery = computed(() => shouldShowRecovery({
|
||||
connected: props.connected,
|
||||
thirdPartyAllowed: thirdPartyAllowed.value,
|
||||
thirdPartySkinActive: isThirdPartySkinActive(),
|
||||
launcherHiddenByConfig: isHostPartHidden("host.plugins.launcher"),
|
||||
launcherReachable: launcherReachable.value,
|
||||
}));
|
||||
|
||||
// The documented shortcut can summon the same host-owned entry even while a
|
||||
// bundled skin is active (for example after a broken third-party skin was
|
||||
// already reset). It never renders decoration on its own.
|
||||
const shortcutOpen = ref(false);
|
||||
const recoveryPopover = ref<HTMLElement | null>(null);
|
||||
const recoveryVisible = computed(() => showRecovery.value || (shortcutOpen.value && thirdPartyAllowed.value));
|
||||
|
||||
function syncPopover() {
|
||||
syncRecoveryPopover(recoveryPopover.value, recoveryVisible.value);
|
||||
}
|
||||
|
||||
function useBuiltInSkin() {
|
||||
shortcutOpen.value = false;
|
||||
requestBuiltInSkin();
|
||||
}
|
||||
|
||||
function openLibrary() {
|
||||
shortcutOpen.value = false;
|
||||
openPluginLibrary();
|
||||
}
|
||||
|
||||
function onKeydown(event: KeyboardEvent) {
|
||||
if (event.defaultPrevented || event.repeat || !thirdPartyAllowed.value) return;
|
||||
if (isRecoveryShortcut(event)) {
|
||||
event.preventDefault();
|
||||
shortcutOpen.value = true;
|
||||
void nextTick(() => recoveryPopover.value?.querySelector("button")?.focus());
|
||||
return;
|
||||
}
|
||||
if (event.key === "Escape" && shortcutOpen.value) shortcutOpen.value = false;
|
||||
}
|
||||
|
||||
let reachabilityTimer: ReturnType<typeof setInterval> | undefined;
|
||||
function refreshLauncherReachability() {
|
||||
launcherReachable.value = isHostPartVisuallyReachable("host.plugins.launcher");
|
||||
}
|
||||
|
||||
watch([recoveryVisible, recoveryPopover], () => { void nextTick(syncPopover); }, { flush: "post" });
|
||||
watch(thirdPartyAllowed, allowed => { if (!allowed) shortcutOpen.value = false; });
|
||||
|
||||
onMounted(() => {
|
||||
refreshLauncherReachability();
|
||||
reachabilityTimer = setInterval(refreshLauncherReachability, 1000);
|
||||
window.addEventListener("resize", refreshLauncherReachability);
|
||||
window.addEventListener("keydown", onKeydown);
|
||||
void nextTick(syncPopover);
|
||||
});
|
||||
onBeforeUnmount(() => {
|
||||
if (reachabilityTimer) clearInterval(reachabilityTimer);
|
||||
window.removeEventListener("resize", refreshLauncherReachability);
|
||||
window.removeEventListener("keydown", onKeydown);
|
||||
layer?.dispose();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ws-host-chrome {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 0;
|
||||
overflow: hidden;
|
||||
pointer-events: none;
|
||||
}
|
||||
.ws-host-watermark {
|
||||
position: absolute;
|
||||
top: clamp(8px, 6vh, 64px);
|
||||
right: clamp(12px, 3vw, 64px);
|
||||
color: #8ab9cf;
|
||||
font: 800 clamp(40px, 7vw, 104px)/1 ui-sans-serif, system-ui, sans-serif;
|
||||
letter-spacing: -.06em;
|
||||
opacity: .14;
|
||||
user-select: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.ws-host-hint {
|
||||
position: absolute;
|
||||
bottom: calc(10px + env(safe-area-inset-bottom));
|
||||
left: 14px;
|
||||
max-width: min(46vw, 420px);
|
||||
margin: 0;
|
||||
color: #6d8b88;
|
||||
font: 11px/1.4 ui-sans-serif, system-ui, sans-serif;
|
||||
opacity: .8;
|
||||
user-select: none;
|
||||
}
|
||||
.ws-host-voice-status-decoration {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
width: min(28vw, 320px);
|
||||
height: 28px;
|
||||
padding: 0 12px;
|
||||
opacity: .28;
|
||||
}
|
||||
.ws-host-voice-status-decoration span {
|
||||
display: block;
|
||||
height: 6px;
|
||||
border-radius: 3px;
|
||||
background: #95b6b1;
|
||||
}
|
||||
.ws-host-voice-status-decoration span:first-child { width: 64px; }
|
||||
.ws-host-voice-status-decoration span:last-child { flex: 1; opacity: .6; }
|
||||
@media (max-width: 640px) {
|
||||
.ws-host-hint { max-width: 62vw; }
|
||||
.ws-host-voice-status-decoration { display: none; }
|
||||
}
|
||||
</style>
|
||||
@@ -1,5 +1,9 @@
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<!-- The authorization dialog is host-owned trusted UI: it is rendered in a
|
||||
closed shadow root and promoted with showModal(), so compiled skin CSS
|
||||
cannot select, restyle, cover or disable it. It deliberately carries no
|
||||
`data-ws-part`; there is no skin hook for this dialog. -->
|
||||
<Teleport v-if="layer" :to="layer.container">
|
||||
<dialog ref="dialog" class="ws-instance-authorization" @cancel.prevent="cancel" @close="authorizationRequested = false">
|
||||
<form @submit.prevent="save">
|
||||
<div class="ws-authorization-mark" aria-hidden="true">◈</div>
|
||||
@@ -20,6 +24,18 @@ import { computed, onBeforeUnmount, ref, watch } from 'vue';
|
||||
import type { SiteLanguage } from '../../../src/site-copy.js';
|
||||
import { authorizationDecision, authorizationLanguage, authorizationRequested, setInstanceAuthorization } from '../services/instance-authorization.js';
|
||||
import { instanceAuthorizationCopy } from '../i18n/instance-authorization.js';
|
||||
import { createHostOwnedLayer, type HostOwnedLayer } from '../services/host-owned-layer.js';
|
||||
|
||||
const AUTHORIZATION_LAYER_CSS = `
|
||||
:host { font: 14px/1.75 system-ui, -apple-system, "Segoe UI", sans-serif; }
|
||||
.ws-instance-authorization{box-sizing:border-box;width:min(570px,calc(100vw - 32px));max-height:calc(100dvh - 32px);margin:auto;padding:30px;border:1px solid #dbe3f1;border-radius:20px;background:#fff;color:#25324b;font:inherit;box-shadow:0 24px 90px #101c4140;color-scheme:light;overflow:auto;pointer-events:auto}
|
||||
.ws-instance-authorization::backdrop{background:#10182d8c;backdrop-filter:blur(5px)}
|
||||
.ws-instance-authorization form{margin:0}.ws-instance-authorization h2{margin:12px 0 16px;font-size:23px;line-height:1.4;color:#202e49}.ws-instance-authorization p{margin:12px 0;color:#526079}.ws-authorization-mark{display:grid;place-items:center;width:43px;height:43px;border-radius:13px;background:#edf0ff;color:#5265df;font-size:28px}
|
||||
.ws-instance-authorization label{display:flex;align-items:flex-start;gap:12px;margin:22px 0;padding:15px;background:#f4f6fc;border:1px solid #dce3f3;border-radius:12px;cursor:pointer}.ws-instance-authorization input{appearance:auto;flex:none;width:18px;height:18px;margin:4px 0 0;accent-color:#5265df}.ws-instance-authorization footer{display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap;margin-top:24px}.ws-instance-authorization button{appearance:none;min-height:42px;padding:9px 16px;border:1px solid #d9e1ef;border-radius:10px;background:#f4f6fc;color:#43516d;font:600 14px/1.5 system-ui;cursor:pointer}.ws-instance-authorization .ws-authorization-primary{background:#5265df;color:#fff;border-color:#5265df}.ws-instance-authorization button:disabled{opacity:.45;cursor:not-allowed}.ws-instance-authorization button:focus-visible,.ws-instance-authorization input:focus-visible{outline:2px solid #5265df;outline-offset:3px}
|
||||
@media(max-width:600px){.ws-instance-authorization{padding:22px}.ws-instance-authorization footer button{flex:1}}
|
||||
`;
|
||||
|
||||
const layer: HostOwnedLayer | null = createHostOwnedLayer('authorization', AUTHORIZATION_LAYER_CSS);
|
||||
const props = defineProps<{ language: SiteLanguage }>();
|
||||
const dialog = ref<HTMLDialogElement | null>(null), checked = ref(false), firstVisit = ref(false);
|
||||
const copy = computed(() => instanceAuthorizationCopy[props.language]);
|
||||
@@ -34,12 +50,5 @@ function finish() { authorizationRequested.value = false; dialog.value?.close();
|
||||
function save() { if (firstVisit.value && !checked.value) return; setInstanceAuthorization(checked.value); finish(); }
|
||||
function decline() { setInstanceAuthorization(false); finish(); }
|
||||
function cancel() { if (firstVisit.value) decline(); else finish(); }
|
||||
onBeforeUnmount(() => dialog.value?.close());
|
||||
onBeforeUnmount(() => { dialog.value?.close(); layer?.dispose(); });
|
||||
</script>
|
||||
<style>
|
||||
.ws-instance-authorization{box-sizing:border-box;width:min(570px,calc(100vw - 32px));max-height:calc(100dvh - 32px);margin:auto;padding:30px;border:1px solid #dbe3f1;border-radius:20px;background:#fff;color:#25324b;font:14px/1.75 system-ui,-apple-system,"Segoe UI",sans-serif;box-shadow:0 24px 90px #101c4140;color-scheme:light;overflow:auto}
|
||||
.ws-instance-authorization::backdrop{background:#10182d8c;backdrop-filter:blur(5px)}
|
||||
.ws-instance-authorization form{margin:0}.ws-instance-authorization h2{margin:12px 0 16px;font-size:23px;line-height:1.4;color:#202e49}.ws-instance-authorization p{margin:12px 0;color:#526079}.ws-authorization-mark{display:grid;place-items:center;width:43px;height:43px;border-radius:13px;background:#edf0ff;color:#5265df;font-size:28px}
|
||||
.ws-instance-authorization label{display:flex;align-items:flex-start;gap:12px;margin:22px 0;padding:15px;background:#f4f6fc;border:1px solid #dce3f3;border-radius:12px;cursor:pointer}.ws-instance-authorization input{appearance:auto;flex:none;width:18px;height:18px;margin:4px 0 0;accent-color:#5265df}.ws-instance-authorization footer{display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap;margin-top:24px}.ws-instance-authorization button{appearance:none;min-height:42px;padding:9px 16px;border:1px solid #d9e1ef;border-radius:10px;background:#f4f6fc;color:#43516d;font:600 14px/1.5 system-ui;cursor:pointer}.ws-instance-authorization .ws-authorization-primary{background:#5265df;color:#fff;border-color:#5265df}.ws-instance-authorization button:disabled{opacity:.45;cursor:not-allowed}.ws-instance-authorization button:focus-visible,.ws-instance-authorization input:focus-visible{outline:2px solid #5265df;outline-offset:3px}
|
||||
@media(max-width:600px){.ws-instance-authorization{padding:22px}.ws-instance-authorization footer button{flex:1}}
|
||||
</style>
|
||||
@@ -11,7 +11,7 @@
|
||||
:aria-controls="menuId"
|
||||
@click.stop="toggle"
|
||||
>
|
||||
<Icon class="language-current-icon" name="translate" :size="24" />
|
||||
<Icon class="language-current-icon" name="translate" :size="24" data-ws-icon-slot="language.trigger" />
|
||||
<span class="language-current-flag" aria-hidden="true">{{ currentLanguage.flag }}</span>
|
||||
<span class="language-current-code">{{ currentLanguage.code }}</span>
|
||||
<Icon name="chevron-down" :size="13" />
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<div v-if="thirdPartyAllowed && connected && sessionToken" class="ws-plugin-overlay" :data-plugin-theme="theme">
|
||||
<button ref="launcher" class="ws-plugin-launcher" :style="launcherPosition" type="button" :title="tr('title')" :aria-label="tr('title')" :aria-expanded="visible" @pointerdown="startLauncherDrag" @lostpointercapture="endDrag" @click="toggle">
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h6v6h-6z" /></svg>
|
||||
<button v-if="!isHostPartHidden('host.plugins.launcher')" ref="launcher" class="ws-plugin-launcher" data-ws-part="host.plugins.launcher" :style="launcherPosition" type="button" :title="tr('title')" :aria-label="tr('title')" :aria-expanded="visible" @pointerdown="startLauncherDrag" @lostpointercapture="endDrag" @click="toggle">
|
||||
<svg viewBox="0 0 24 24" data-ws-icon-slot="host.plugins.launcher" aria-hidden="true"><path d="M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h6v6h-6z" /></svg>
|
||||
<span>{{ tr('title') }}</span><i v-if="current" />
|
||||
</button>
|
||||
<section v-show="visible" ref="windowElement" class="ws-plugin-window" :class="{ 'is-maximized': maximized, 'is-dragging': dragging }" :style="position" role="dialog" :aria-label="current && appView ? current.manifest.name : tr('title')" tabindex="-1" @keydown.esc.stop="minimize">
|
||||
<section v-show="visible" ref="windowElement" class="ws-plugin-window" data-ws-part="host.plugins.overlay" :class="{ 'is-maximized': maximized, 'is-dragging': dragging }" :style="position" role="dialog" :aria-label="current && appView ? current.manifest.name : tr('title')" tabindex="-1" @keydown.esc.stop="minimize">
|
||||
<header class="ws-plugin-titlebar" @pointerdown="startDrag" @lostpointercapture="endDrag" @dblclick="toggleMaximize">
|
||||
<span class="ws-plugin-mark" aria-hidden="true">◈</span>
|
||||
<div class="ws-plugin-window-title"><strong>{{ current && appView ? current.manifest.name : tr('title') }}</strong><small>WebSpeak</small></div>
|
||||
@@ -50,6 +50,7 @@ import { pluginTranslations, type PluginTextKey } from '../i18n/plugins.js';
|
||||
import { pluginWindowTranslations } from '../i18n/plugin-window.js';
|
||||
import type { SiteLanguage } from '../../../src/site-copy.js';
|
||||
import { thirdPartyAllowed } from '../services/instance-authorization.js';
|
||||
import { isHostPartHidden, pluginLibraryRequests } from '../services/host-chrome.js';
|
||||
const props = defineProps<{ sessionToken: string; gatewayUrl: string; connected: boolean; language: SiteLanguage }>();
|
||||
const tr = (key: PluginTextKey) => pluginTranslations[props.language][key];
|
||||
const ui = computed(() => pluginWindowTranslations[props.language]);
|
||||
@@ -154,9 +155,19 @@ watch(windowElement, element => { resizeObserver?.disconnect(); if (element) { r
|
||||
watch(() => [props.sessionToken, props.gatewayUrl, props.connected] as const, close);
|
||||
watch(thirdPartyAllowed, allowed => { if (!allowed) close(); }, { flush: 'sync' });
|
||||
watch(() => props.language, appearance); watch(theme, appearance);
|
||||
// Trusted recovery entry (host chrome / skin menu) keeps the application
|
||||
// library reachable when a skin hides the floating launcher.
|
||||
watch(pluginLibraryRequests, () => {
|
||||
if (!thirdPartyAllowed.value || !props.connected || !props.sessionToken) return;
|
||||
detectTheme();
|
||||
visible.value = true;
|
||||
appView.value = false;
|
||||
if (!current.value) void refresh();
|
||||
void nextTick(() => { fitWindow(); windowElement.value?.focus(); });
|
||||
});
|
||||
onMounted(() => {
|
||||
detectTheme(); window.addEventListener('message', message); window.addEventListener('resize', fitWindow); window.addEventListener('pointermove', moveDrag); window.addEventListener('pointerup', endDrag); window.addEventListener('pointercancel', endDrag); window.addEventListener('blur', endDrag);
|
||||
observer = new MutationObserver(detectTheme); observer.observe(document.documentElement, { attributes: true, subtree: true, attributeFilter: ['data-ws-skin', 'data-theme'] });
|
||||
observer = new MutationObserver(detectTheme); observer.observe(document.documentElement, { attributes: true, subtree: true, attributeFilter: ['data-ws-skin', 'data-ws-host-skin', 'data-theme'] });
|
||||
});
|
||||
onBeforeUnmount(() => { stop(); endDrag(); observer?.disconnect(); resizeObserver?.disconnect(); window.removeEventListener('message', message); window.removeEventListener('resize', fitWindow); window.removeEventListener('pointermove', moveDrag); window.removeEventListener('pointerup', endDrag); window.removeEventListener('pointercancel', endDrag); window.removeEventListener('blur', endDrag); });
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<section v-if="error" class="skin-load-recovery" role="alert">
|
||||
<section v-if="error" class="skin-load-recovery" data-ws-part="app.skin-load-recovery" role="alert">
|
||||
<p>{{ labels.skinLoadError(error.skinId) }}</p>
|
||||
<button type="button" @click="$emit('use-built-in')">{{ labels.skinUseBuiltIn }}</button>
|
||||
</section>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
:aria-controls="menuId"
|
||||
@click.stop="toggle"
|
||||
>
|
||||
<Icon :name="selectedOption.icon || 'compass'" :size="15" />
|
||||
<Icon :name="selectedOption.icon || 'compass'" :size="15" data-ws-icon-slot="skin.trigger" />
|
||||
<span>{{ menuLabel }}</span>
|
||||
<Icon name="chevron-down" :size="12" />
|
||||
</button>
|
||||
@@ -38,6 +38,9 @@
|
||||
<button type="button" class="skin-option skin-authorization" role="option" :aria-selected="false" @click="authorization">
|
||||
<Icon name="shield" :size="16" /><span>{{ authorizationCopy.menu }}</span><small>{{ thirdPartyAllowed ? authorizationCopy.enabled : authorizationCopy.disabled }}</small>
|
||||
</button>
|
||||
<button v-if="thirdPartyAllowed" type="button" class="skin-option skin-library" data-ws-part="skin.library" role="option" :aria-selected="false" @click="openLibrary">
|
||||
<Icon name="grid" :size="16" /><span>{{ libraryLabel }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -47,6 +50,8 @@ import { computed, onMounted, onUnmounted, ref } from "vue";
|
||||
import Icon from "./Icon.vue";
|
||||
import { authorizationLanguage, canUseSkin, openInstanceAuthorization, thirdPartyAllowed } from '../services/instance-authorization.js';
|
||||
import { instanceAuthorizationCopy } from '../i18n/instance-authorization.js';
|
||||
import { hostChromeCopy } from '../i18n/host-chrome.js';
|
||||
import { openPluginLibrary } from '../services/host-chrome.js';
|
||||
|
||||
export interface SkinOption {
|
||||
value: string;
|
||||
@@ -67,7 +72,9 @@ const emit = defineEmits<{
|
||||
|
||||
const options = computed(() => props.options.filter(option => canUseSkin(option.value)));
|
||||
const authorizationCopy = computed(() => instanceAuthorizationCopy[authorizationLanguage.value]);
|
||||
const libraryLabel = computed(() => hostChromeCopy[authorizationLanguage.value]?.library ?? hostChromeCopy.en.library);
|
||||
function authorization() { close(); openInstanceAuthorization(); }
|
||||
function openLibrary() { close(); openPluginLibrary(); }
|
||||
const selectedOption = computed(() => options.value.find((option) => option.value === props.modelValue) ?? options.value[0] ?? {
|
||||
value: props.modelValue,
|
||||
label: props.menuLabel,
|
||||
@@ -101,6 +108,7 @@ onUnmounted(() => document.removeEventListener("pointerdown", onDocumentPointerD
|
||||
}
|
||||
.skin-authorization{margin-top:6px;border-top:1px solid #8bdad8!important}
|
||||
.skin-authorization small{margin-left:auto;font-size:10px;opacity:.75}
|
||||
.skin-library{opacity:.9}
|
||||
|
||||
.skin-trigger {
|
||||
display: inline-flex;
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
@click.stop="togglePerformancePanel"
|
||||
><Icon
|
||||
name="activity"
|
||||
:size="16" /><span class="performance-trigger-label">{{ t("voiceStatus") }}</span
|
||||
:size="16"
|
||||
data-ws-icon-slot="voice.performance" /><span class="performance-trigger-label">{{ t("voiceStatus") }}</span
|
||||
><small v-if="performanceStats.ready">{{ voiceTransportLabel }}</small
|
||||
><Icon
|
||||
name="chevron-down"
|
||||
|
||||
@@ -92,6 +92,7 @@
|
||||
<Icon
|
||||
name="settings"
|
||||
:size="15"
|
||||
data-ws-icon-slot="home.toolbar.settings"
|
||||
/><span>{{ t("adminConsole") }}</span>
|
||||
</a>
|
||||
<SkinSwitcher
|
||||
|
||||
Reference in new issue
Block a user