feat(plugins): add GitHub store and scoped collaborative panels

This commit is contained in:
illusia committed 2026-10-25 01:42:41 +08:00
1 parent b9fccb8757
commit ce681f749d
40 files changed
+1370 -5

No files matched your search

+4
View File
@@ -18,6 +18,9 @@
<rect x="4" y="14" width="16" height="7" rx="1.5" />
<path d="M8 6.5h.01M8 17.5h.01M11 6.5h5M11 17.5h5" />
</template>
<template v-else-if="name === 'grid'">
<rect x="3" y="3" width="7" height="7" rx="1.5" /><rect x="14" y="3" width="7" height="7" rx="1.5" /><rect x="3" y="14" width="7" height="7" rx="1.5" /><rect x="14" y="14" width="7" height="7" rx="1.5" />
</template>
<template v-else-if="name === 'compass'">
<circle cx="12" cy="12" r="9" />
<path d="m15.5 8.5-2.2 4.8-4.8 2.2 2.2-4.8z" />
@@ -69,6 +72,7 @@
<path v-else-if="name === 'paperclip'" d="m20 11-7.5 7.5a5 5 0 0 1-7-7L13 4a3.5 3.5 0 0 1 5 5l-7.5 7.5a2 2 0 0 1-3-3L14 7" />
<path v-else-if="name === 'share'" d="M4 12v7a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7M16 6l-4-4-4 4m4-4v13" />
<path v-else-if="name === 'copy'" d="M8 8V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-3M6 8h7a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2Z" />
<path v-else-if="name === 'trash'" d="M3 6h18M9 6V3h6v3M5 6l1 15h12l1-15M10 10v7M14 10v7" />
<path v-else-if="name === 'close'" d="m6 6 12 12M18 6 6 18" />
<path v-else-if="name === 'more'" d="M5 12h.01M12 12h.01M19 12h.01" stroke-width="3" />
<path v-else-if="name === 'menu'" d="M4 6h16M4 12h16M4 18h16" />
+111
View File
@@ -0,0 +1,111 @@
<template>
<Teleport to="body">
<button v-if="connected" class="ws-plugin-launcher" type="button" @click="show">◈ {{ tr('title') }}</button>
<dialog ref="dialog" class="ws-plugin-dialog" :data-plugin-theme="theme" @close="closed" @cancel="closed">
<header><strong>{{ current?.manifest.name ?? tr('title') }}</strong><button type="button" @click="dialog?.close()">{{ tr('close') }}</button></header>
<p v-if="error" role="alert" class="ws-plugin-error">{{ error }}</p>
<template v-if="!current">
<div class="ws-plugin-toolbar"><button type="button" :disabled="busy" @click="refresh">{{ busy ? tr('loading') : tr('refresh') }}</button></div>
<p>{{ tr('enableNote') }}</p><p v-if="!busy && !available.length">{{ tr('empty') }}</p>
<section v-for="entry in available" :key="entry.manifest.id" class="ws-plugin-entry">
<div><strong>{{ entry.manifest.name }}</strong><small>{{ entry.scope === 'server' ? tr('server') : tr('instance') }} · {{ entry.manifest.version }}</small><p>{{ entry.manifest.description }}</p></div>
<button type="button" :disabled="busy" @click="launch(entry.manifest.id)">{{ tr('open') }}</button>
</section>
</template>
<template v-else>
<div class="ws-plugin-toolbar"><button type="button" @click="stop">← {{ tr('back') }}</button><small>{{ tr('permission') }}: {{ current.manifest.permissions.join(', ') }}</small></div>
<iframe ref="frame" :key="channel" :title="current.manifest.name" :srcdoc="documentSource" sandbox="allow-scripts" allow="fullscreen" referrerpolicy="no-referrer" @load="sendContext"></iframe>
</template>
</dialog>
</Teleport>
</template>
<script setup lang="ts">
import { computed, onBeforeUnmount, onMounted, ref, shallowRef, watch } from 'vue';
import { parsePluginPackage, pluginRecord, parsePluginJson, type PluginManifest, type PluginScope, type PluginRoomSnapshot } from '../../../src/shared/plugins.js';
import { pluginFrameDocument } from '../services/plugin-frame.js';
import type { PluginTransport } from '../services/plugin-transport.js';
import { pluginTranslations, type PluginTextKey } from '../i18n/plugins.js';
import type { SiteLanguage } from '../../../src/site-copy.js';
const props = defineProps<{ transport: PluginTransport; connected: boolean; language: SiteLanguage }>();
const tr = (key: PluginTextKey) => pluginTranslations[props.language][key];
const dialog = ref<HTMLDialogElement | null>(null), frame = ref<HTMLIFrameElement | null>(null);
const available = shallowRef<{ manifest: PluginManifest; scope: PluginScope }[]>([]);
const current = shallowRef<ReturnType<typeof parsePluginPackage> | null>(null);
const documentSource = ref(''), channel = ref(''), theme = ref<'light'|'dark'>('light');
const busy = ref(false), error = ref(''); let epoch = 0, openingId: string | undefined, context: Record<string,unknown> = {}, observer: MutationObserver | undefined;
const inFlight = new Set<number>();
const pluginId = computed(() => current.value?.manifest.id);
function detectTheme() {
const root = document.querySelector('.ws-skin-root');
const color = root ? getComputedStyle(root).color.match(/[\d.]+/g)?.map(Number) : null;
theme.value = color && color.length >= 3 ? (color[0]*.2126+color[1]*.7152+color[2]*.0722 > 140 ? 'dark':'light') : matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light';
}
function send(value: object) { frame.value?.contentWindow?.postMessage({ channel: channel.value, ...value }, '*'); }
function sendContext() { send({ type: 'context', context: { ...context, language: props.language, theme: theme.value } }); }
async function refresh() {
const owner = ++epoch; busy.value = true; error.value = '';
try {
const result = await props.transport.request('list');
if (owner !== epoch) return;
if (!Array.isArray(result) || result.length > 50) throw new Error('PLUGIN_INVALID_RESPONSE');
available.value = result.map(v => { if (!pluginRecord(v)) throw new Error('PLUGIN_INVALID_RESPONSE');
const manifest = v.manifest; if (!pluginRecord(manifest) || typeof manifest.id !== 'string' || typeof manifest.name !== 'string' || (v.scope !== 'server' && v.scope !== 'instance')) throw new Error('PLUGIN_INVALID_RESPONSE');
return { manifest: manifest as unknown as PluginManifest, scope: v.scope }; });
} catch (e) { if (owner === epoch) error.value = `${tr('error')}: ${e instanceof Error ? e.message : ''}`; }
finally { if (owner === epoch) busy.value = false; }
}
function show() { detectTheme(); dialog.value?.showModal(); void refresh(); }
function stop() {
const id = pluginId.value ?? openingId; ++epoch; openingId = undefined; inFlight.clear(); current.value = null; documentSource.value = ''; context = {}; channel.value = ''; busy.value = false;
if (id) void props.transport.request('close', { pluginId: id }).catch(() => undefined);
}
function closed() { stop(); error.value = ''; available.value = []; }
async function launch(id: string) {
const owner = ++epoch; openingId = id; busy.value = true; error.value = '';
try {
const result = await props.transport.request('open', { pluginId: id });
// stop() queues the close after this open on the same ordered socket.
// A late response must never close a newer opening of the same plugin.
if (owner !== epoch) return;
if (!pluginRecord(result) || !pluginRecord(result.snapshot)) throw new Error('PLUGIN_INVALID_RESPONSE');
const pack = parsePluginPackage(result.package);
if (pack.manifest.id !== id) throw new Error('PLUGIN_INVALID_RESPONSE');
current.value = pack; context = { config: result.config, self: result.self, scope: result.scope, snapshot: result.snapshot };
channel.value = crypto.randomUUID(); documentSource.value = pluginFrameDocument(pack, channel.value);
} catch (e) { if (owner === epoch) error.value = `${tr('error')}: ${e instanceof Error ? e.message : ''}`; }
finally { if (owner === epoch) { openingId = undefined; busy.value = false; } }
}
async function receive(event: MessageEvent) {
if (!frame.value || event.source !== frame.value.contentWindow || !pluginRecord(event.data) || event.data.channel !== channel.value || !current.value) return;
const value = event.data;
if (value.type === 'ready') { sendContext(); return; }
if (value.type !== 'request' || !Number.isSafeInteger(value.id) || inFlight.has(value.id as number) || inFlight.size >= 8) return;
const id = value.id as number, owner = epoch, plugin = pluginId.value!; inFlight.add(id);
try {
let result: unknown;
if (value.method === 'room.snapshot') result = await props.transport.request('snapshot', { pluginId: plugin });
else if (value.method === 'room.update' && pluginRecord(value.args) && Number.isSafeInteger(value.args.revision)) {
result = await props.transport.request('update', { pluginId: plugin, revision: value.args.revision as number, state: parsePluginJson(value.args.state) });
} else throw new Error('PLUGIN_PERMISSION_DENIED');
if (owner === epoch) send({ type: 'reply', id, result });
} catch (e) { if (owner === epoch) send({ type: 'reply', id, error: e instanceof Error ? e.message : 'PLUGIN_FAILED' }); }
finally { if (owner === epoch) inFlight.delete(id); }
}
const unsubscribe = props.transport.subscribe(message => {
if (message.type === 'pluginReset') { stop(); available.value = []; dialog.value?.close(); return; }
if (message.type !== 'pluginEvent' || message.pluginId !== pluginId.value) return;
if (!message.snapshot) { stop(); error.value = tr('context'); return; }
context.snapshot = message.snapshot as PluginRoomSnapshot; send({ type: 'snapshot', snapshot: message.snapshot });
});
watch(() => props.language, sendContext);
watch(theme, sendContext);
watch(() => props.connected, connected => { if (!connected) { closed(); dialog.value?.close(); } });
onMounted(() => { window.addEventListener('message', receive); observer = new MutationObserver(detectTheme); observer.observe(document.documentElement, { attributes: true, subtree: true, attributeFilter:['data-ws-skin','data-theme'] }); });
onBeforeUnmount(() => { unsubscribe(); stop(); observer?.disconnect(); window.removeEventListener('message', receive); dialog.value?.close(); });
</script>
<style>
.ws-plugin-launcher{all:initial;position:fixed;right:16px;top:88px;z-index:10000;font:600 14px system-ui;cursor:pointer;background:#184b48;color:white;border:1px solid #4d827e;border-radius:24px;padding:10px 16px;box-shadow:0 4px 20px #0003}
.ws-plugin-dialog{box-sizing:border-box;width:min(960px,calc(100vw - 24px));max-height:calc(100dvh - 32px);padding:20px;border:1px solid #b6c9c7;border-radius:16px;background:#fff;color:#182e2d;font:15px/1.5 system-ui;overflow:auto}
.ws-plugin-dialog[data-plugin-theme="dark"]{background:#20242b;color:#ecf2f1;border-color:#4a525d}.ws-plugin-dialog::backdrop{background:#0009}.ws-plugin-dialog header,.ws-plugin-toolbar,.ws-plugin-entry{display:flex;align-items:center;gap:12px;justify-content:space-between}.ws-plugin-dialog header strong{font-size:20px}.ws-plugin-dialog button{font:inherit;cursor:pointer;border:1px solid #779c98;border-radius:8px;padding:8px 12px;background:#e5f3f0;color:#153f3b}.ws-plugin-dialog button:disabled{opacity:.5;cursor:wait}.ws-plugin-dialog iframe{display:block;width:100%;height:min(620px,68dvh);border:1px solid #779c98;border-radius:8px;background:transparent}.ws-plugin-toolbar{margin:14px 0;flex-wrap:wrap}.ws-plugin-entry{border-top:1px solid #779c9866;padding:16px 0}.ws-plugin-entry small{display:block;opacity:.7}.ws-plugin-entry p{margin:6px 0}.ws-plugin-error{color:#c73131;overflow-wrap:anywhere}
@media(max-width:600px){.ws-plugin-launcher{top:72px;right:8px;padding:8px 12px}.ws-plugin-dialog{padding:14px}.ws-plugin-entry{align-items:start}.ws-plugin-dialog iframe{height:65dvh}}
</style>
+83
View File
@@ -0,0 +1,83 @@
<template>
<section class="page-content plugin-admin">
<header class="plugin-hero">
<div><span class="plugin-eyebrow"><Icon name="grid" :size="14" /> EXTENSIONS</span><h2>{{ tr('store') }}</h2><p>{{ tr('lead') }}</p><div class="plugin-metrics"><span><b>{{ model.catalog.value?.entries.length ?? '—' }}</b>{{ text('available') }}</span><i></i><span><b>{{ model.installed.value.length }}</b>{{ tr('installed') }}</span><i></i><span><b>{{ enabledCount }}</b>{{ text('active') }}</span></div></div>
<div class="plugin-hero-art" aria-hidden="true"><i></i><i></i><i></i><i></i><b>+</b></div>
</header>
<div class="plugin-toolbar">
<nav class="plugin-tabs" :aria-label="tr('store')"><button type="button" :aria-current="tab==='store'?'page':undefined" @click="tab='store'"><Icon name="compass" :size="16" />{{ text('discover') }}</button><button type="button" :aria-current="tab==='installed'?'page':undefined" @click="tab='installed'"><Icon name="grid" :size="16" />{{ tr('installed') }}<span>{{ model.installed.value.length }}</span></button></nav>
<div class="plugin-tools"><label class="plugin-search"><Icon name="search" :size="16" /><input v-model="search" type="search" :aria-label="text('search')" :placeholder="text('search')" /></label><button class="plugin-refresh" type="button" :disabled="model.busy.value" :title="tr('refresh')" :aria-label="tr('refresh')" @click="model.load"><Icon name="refresh" :size="17" /></button></div>
</div>
<p v-if="model.error.value" class="plugin-feedback is-error" role="alert"><Icon name="info" :size="17" />{{ tr('error') }}: {{ model.error.value }}</p>
<p v-if="notice" class="plugin-feedback" role="status"><Icon name="check" :size="17" />{{ notice }}</p>
<div class="plugin-section-heading"><div><h3>{{ tab==='store'?text('discover'):tr('installed') }}</h3><span v-if="tab==='store'" class="plugin-source"><i></i>{{ text('source') }}</span></div><a v-if="tab==='store'" :href="PLUGIN_STORE_REPOSITORY" target="_blank" rel="noopener noreferrer"><Icon name="github" :size="16" />GitHub ↗</a><button v-else class="plugin-button" type="button" :disabled="model.busy.value" @click="fileInput?.click()"><Icon name="share" :size="15" />{{ tr('upload') }}</button></div>
<input ref="fileInput" class="plugin-file-input" type="file" accept=".wplugin,application/json" @change="upload" />
<p v-if="model.busy.value" class="plugin-loading" role="status"><span class="spinner small"></span>{{ tr('loading') }}</p>
<div v-if="tab==='store'" class="plugin-store-grid">
<article v-for="entry in catalogEntries" :key="entry.id" class="plugin-market-card">
<div class="plugin-card-visual"><div class="plugin-card-symbol"><Icon name="grid" :size="38" /></div><span>API {{ entry.manifest?.apiVersion ?? '—' }}</span><i aria-hidden="true"></i></div>
<div class="plugin-card-body"><div class="plugin-card-title"><h4>{{ entry.manifest?.name ?? entry.id }}</h4><small>v{{ entry.manifest?.version ?? '—' }}</small></div><p class="plugin-author">{{ entry.manifest?.author }} · {{ entry.manifest?.license }}</p><p class="plugin-description">{{ entry.manifest?.description }}</p><div class="plugin-tags"><span v-for="scope in entry.manifest?.scopes" :key="scope"><Icon name="server" :size="12" />{{ tr(scope) }}</span></div><div class="plugin-permissions"><span v-for="permission in entry.manifest?.permissions" :key="permission"><Icon name="check" :size="12" />{{ text(permission==='room.read'?'read':'write') }}</span></div><p v-if="entry.error" class="is-error">{{ entry.error }}</p></div>
<footer><a :href="entry.repository" target="_blank" rel="noopener noreferrer" :aria-label="`${entry.manifest?.name ?? entry.id} · GitHub`"><Icon name="github" :size="16" />GitHub ↗</a><button class="plugin-button primary" type="button" :disabled="model.busy.value || !entry.manifest || !!entry.error" @click="install(entry)"><Icon name="download" :size="15" />{{ installLabel(entry) }}</button></footer>
</article>
</div>
<div v-else class="plugin-installed-list">
<article v-for="plugin in installedEntries" :key="plugin.manifest.id" class="plugin-installed-card">
<header><div class="plugin-installed-icon"><Icon name="grid" :size="23" /></div><div class="plugin-installed-name"><h4>{{ plugin.manifest.name }}</h4><p>v{{ plugin.manifest.version }} · {{ plugin.manifest.author }}</p></div><span class="plugin-status" :class="{active:plugin.settings.enabled}"><i></i>{{ text(plugin.settings.enabled?'active':'inactive') }}</span></header>
<p class="plugin-description">{{ plugin.manifest.description }}</p><div class="plugin-installed-meta"><span><Icon name="server" :size="13" />{{ tr(plugin.settings.scope) }}</span><span>{{ plugin.manifest.license }}</span><span>API {{ plugin.manifest.apiVersion }}</span></div>
<details :open="expanded===plugin.manifest.id" @toggle="onToggle($event,plugin.manifest.id)"><summary><Icon name="settings" :size="16" />{{ text('configure') }}<Icon class="plugin-chevron" name="chevron-down" :size="15" /></summary><fieldset :disabled="model.busy.value">
<div class="plugin-enable-row"><div><strong>{{ tr('enabled') }}</strong><p>{{ text('review') }}</p></div><label class="plugin-switch"><input v-model="model.drafts[plugin.manifest.id].enabled" type="checkbox" :aria-label="tr('enabled')" /><span></span></label></div>
<div class="plugin-permissions"><span v-for="permission in plugin.manifest.permissions" :key="permission"><Icon name="shield" :size="13" />{{ text(permission==='room.read'?'read':'write') }}</span></div>
<label>{{ tr('scope') }}<select v-model="model.drafts[plugin.manifest.id].scope"><option v-for="scope in plugin.manifest.scopes" :key="scope" :value="scope">{{ tr(scope) }}</option></select></label>
<label v-if="model.drafts[plugin.manifest.id].scope==='server'">{{ tr('targets') }}<textarea v-model="model.drafts[plugin.manifest.id].targets" rows="3" maxlength="15000" placeholder="voice.example.com:9987"></textarea></label>
<details class="plugin-advanced"><summary>{{ text('advanced') }}<Icon name="chevron-down" :size="14" /></summary><label>{{ tr('config') }}<textarea v-model="model.drafts[plugin.manifest.id].config" rows="5" maxlength="8192" spellcheck="false"></textarea></label></details>
<div class="plugin-settings-actions"><button class="plugin-button danger" type="button" @click="remove(plugin)"><Icon name="trash" :size="14" />{{ tr('remove') }}</button><button class="plugin-button primary" type="button" @click="save(plugin)"><Icon name="check" :size="15" />{{ tr('save') }}</button></div>
</fieldset></details>
</article>
</div>
<div v-if="!model.busy.value && !(tab==='store'?catalogEntries.length:installedEntries.length)" class="plugin-empty"><Icon name="grid" :size="32" /><h4>{{ search?text('empty'):tr('empty') }}</h4></div>
<details class="plugin-scope-help"><summary><Icon name="info" :size="16" />{{ text('scopeHelp') }}<Icon name="chevron-down" :size="14" /></summary><p>{{ tr('note') }}</p><p>{{ tr('enableNote') }}</p></details>
</section>
</template>
<script setup lang="ts">
import { computed, ref } from 'vue';
import Icon from '../Icon.vue';
import type { SiteLanguage } from '../../../../src/site-copy.js';
import { PLUGIN_STORE_REPOSITORY, type InstalledPlugin, type PluginStoreEntry, type PluginManifest } from '../../../../src/shared/plugins.js';
import type { useAdminPlugins } from '../../composables/useAdminPlugins.js';
import { pluginTranslations, type PluginTextKey } from '../../i18n/plugins.js';
import { pluginStoreTranslations, type PluginStoreTextKey } from '../../i18n/plugin-store.js';
const props=defineProps<{model:ReturnType<typeof useAdminPlugins>;language:SiteLanguage}>();
const tr=(key:PluginTextKey)=>pluginTranslations[props.language][key],text=(key:PluginStoreTextKey)=>pluginStoreTranslations[props.language][key];
const tab=ref<'store'|'installed'>('store'),search=ref(''),expanded=ref(''),notice=ref(''),fileInput=ref<HTMLInputElement|null>(null);
const enabledCount=computed(()=>props.model.installed.value.filter(p=>p.settings.enabled).length);
const matches=(manifest:PluginManifest|null,id:string)=>[manifest?.name,manifest?.author,manifest?.description,id].join(' ').toLocaleLowerCase().includes(search.value.trim().toLocaleLowerCase());
const catalogEntries=computed(()=>(props.model.catalog.value?.entries??[]).filter(e=>matches(e.manifest,e.id)));
const installedEntries=computed(()=>props.model.installed.value.filter(p=>matches(p.manifest,p.manifest.id)));
function installLabel(entry:PluginStoreEntry){const local=props.model.installed.value.find(p=>p.manifest.id===entry.id);return !local?text('add'):local.manifest.version===entry.manifest?.version?text('reinstall'):text('update');}
async function install(entry:PluginStoreEntry){notice.value='';await props.model.install(entry);if(!props.model.error.value){tab.value='installed';expanded.value=entry.id;notice.value=text('installedNotice');}}
async function upload(event:Event){const input=event.target as HTMLInputElement,file=input.files?.[0];if(file){notice.value='';await props.model.upload(file);if(!props.model.error.value){tab.value='installed';notice.value=text('installedNotice');}}input.value='';}
async function save(plugin:InstalledPlugin){notice.value='';await props.model.save(plugin);}
function remove(plugin:InstalledPlugin){if(window.confirm(tr('removed'))){notice.value='';void props.model.remove(plugin);}}
function onToggle(event:Event,id:string){if((event.target as HTMLDetailsElement).open)expanded.value=id;else if(expanded.value===id)expanded.value='';}
</script>
<style scoped>
section.page-content.plugin-admin{display:grid;grid-template-columns:minmax(0,1fr);grid-auto-rows:max-content;align-content:start;gap:24px;color:var(--admin-text);min-width:0}
.plugin-admin :is(h2,h3,h4,p){margin:0}.plugin-admin :is(button,input,select,textarea){font:inherit}.plugin-admin button{cursor:pointer}.plugin-admin button:disabled{opacity:.5;cursor:wait}
.plugin-hero{position:relative;display:flex;align-items:center;justify-content:space-between;gap:28px;overflow:hidden;padding:32px;border:1px solid var(--admin-border);border-radius:20px;background:radial-gradient(ellipse at 100% 0,color-mix(in srgb,var(--admin-accent) 12%,transparent),transparent 65%),var(--admin-surface)}
.plugin-hero>div:first-child{z-index:1;max-width:640px}.plugin-eyebrow{display:flex;align-items:center;gap:8px;font-size:10px;font-weight:800;letter-spacing:.16em;color:var(--admin-accent);margin-bottom:14px}.plugin-hero h2{font-size:30px;letter-spacing:-.04em}.plugin-hero p{font-size:13px;line-height:1.8;color:var(--admin-muted);max-width:560px;margin-top:12px}
.plugin-metrics{display:flex;align-items:center;gap:20px;margin-top:24px;flex-wrap:wrap}.plugin-metrics>span{display:flex;align-items:center;gap:9px;font-size:11px;color:var(--admin-muted)}.plugin-metrics b{font-size:20px;color:var(--admin-text);font-variant-numeric:tabular-nums}.plugin-metrics>i{height:17px;width:1px;background:var(--admin-border)}
.plugin-hero-art{position:relative;display:grid;grid-template-columns:1fr 1fr;gap:10px;width:130px;flex:0 0 130px;transform:rotate(-8deg);margin:8px 12px}.plugin-hero-art i{aspect-ratio:1;border-radius:15px;border:1px solid color-mix(in srgb,var(--admin-accent) 22%,var(--admin-border));background:var(--admin-accent-soft);box-shadow:0 8px 18px #0001}.plugin-hero-art i:nth-child(2){transform:translate(10px,-10px);background:var(--admin-accent);opacity:.8}.plugin-hero-art i:nth-child(3){opacity:.5}.plugin-hero-art b{position:absolute;right:-15px;bottom:-12px;display:grid;place-items:center;width:44px;height:44px;border-radius:50%;font-size:25px;background:var(--admin-surface);color:var(--admin-accent)}
.plugin-toolbar,.plugin-tools,.plugin-tabs{display:flex;align-items:center;gap:12px;min-width:0}.plugin-toolbar{justify-content:space-between;flex-wrap:wrap}.plugin-tabs{gap:4px;padding:4px;background:var(--admin-raised);border:1px solid var(--admin-border);border-radius:12px}.plugin-tabs button{display:flex;align-items:center;gap:8px;min-height:40px;border:0;border-radius:8px;padding:9px 15px;background:transparent;color:var(--admin-muted);font-size:12px;font-weight:650}.plugin-tabs button[aria-current]{color:var(--admin-accent);background:var(--admin-surface);box-shadow:0 1px 5px #0001}.plugin-tabs button>span{min-width:18px;border-radius:5px;padding:0 5px;background:var(--admin-accent-soft);font-size:10px}
.plugin-search{display:flex;gap:8px;align-items:center;padding:0 12px;border:1px solid var(--admin-border);border-radius:10px;background:var(--admin-surface);color:var(--admin-muted)}.plugin-search input{width:200px;min-width:0;border:0!important;outline:none;background:transparent!important;color:var(--admin-text);height:42px;font-size:12px;padding:0!important;box-shadow:none!important}.plugin-search:focus-within{outline:2px solid color-mix(in srgb,var(--admin-accent) 35%,transparent)}.plugin-refresh{display:grid;place-items:center;width:44px;height:44px;padding:0;border:1px solid var(--admin-border);border-radius:10px;background:var(--admin-surface);color:var(--admin-muted)}
.plugin-section-heading,.plugin-section-heading>div{display:flex;align-items:center;gap:14px;justify-content:space-between;flex-wrap:wrap}.plugin-section-heading h3{font-size:15px}.plugin-section-heading a,.plugin-market-card footer a{display:flex;gap:7px;align-items:center;font-size:11px;color:var(--admin-muted);text-decoration:none}.plugin-source{display:flex;align-items:center;gap:6px;font-size:10px;color:var(--admin-muted)}.plugin-source i,.plugin-status i{height:6px;width:6px;flex:none;border-radius:50%;background:#7c9790}.plugin-source i{background:var(--admin-accent)}
.plugin-store-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(300px,100%),1fr));gap:20px;align-items:start}.plugin-market-card{display:flex;flex-direction:column;max-width:460px;min-width:0;border:1px solid var(--admin-border);border-radius:16px;background:var(--admin-surface);overflow:hidden;transition:border-color .2s,transform .2s}.plugin-market-card:hover{transform:translateY(-3px);border-color:color-mix(in srgb,var(--admin-accent) 50%,var(--admin-border))}
.plugin-card-visual{position:relative;display:grid;place-items:center;height:142px;overflow:hidden;background:linear-gradient(130deg,var(--admin-accent-soft),var(--admin-raised))}.plugin-card-symbol{display:grid;place-items:center;width:76px;height:76px;border:1px solid color-mix(in srgb,var(--admin-accent) 20%,var(--admin-border));background:var(--admin-surface);border-radius:21px;color:var(--admin-accent);transform:rotate(-8deg);box-shadow:0 8px 20px #0001;z-index:1}.plugin-card-visual>span{position:absolute;top:14px;right:14px;padding:4px 7px;border:1px solid var(--admin-border);border-radius:6px;font-size:9px;font-weight:700;background:var(--admin-surface);color:var(--admin-muted)}.plugin-card-visual>i{position:absolute;border:1px solid color-mix(in srgb,var(--admin-accent) 15%,transparent);border-radius:50%;width:260px;height:260px;left:-65px;top:-95px}.plugin-card-visual>i:after{content:'';position:absolute;inset:24px;border:inherit;border-radius:inherit}
.plugin-card-body{padding:22px;display:grid;gap:12px}.plugin-card-title{display:flex;align-items:start;justify-content:space-between;gap:10px}.plugin-card-title h4{font-size:16px;line-height:1.4;letter-spacing:-.025em;overflow-wrap:anywhere}.plugin-card-title small{flex:none;font-size:10px;color:var(--admin-muted);padding-top:3px}.plugin-author{color:var(--admin-muted);font-size:10px}.plugin-description{font-size:12px;line-height:1.75;color:var(--admin-muted);overflow-wrap:anywhere}.plugin-tags,.plugin-permissions{display:flex;gap:7px;flex-wrap:wrap}.plugin-tags>span{display:inline-flex;align-items:center;gap:5px;padding:5px 7px;font-size:9px;border:1px solid var(--admin-border);border-radius:6px;color:var(--admin-muted)}.plugin-permissions>span{display:inline-flex;align-items:center;gap:5px;font-size:10px;color:var(--admin-accent)}.plugin-market-card footer{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:15px 22px;border-top:1px solid var(--admin-border);background:var(--admin-raised)}
.plugin-button{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:38px;border:1px solid var(--admin-border);border-radius:8px;padding:9px 13px;font-size:11px;font-weight:650;color:var(--admin-text);background:var(--admin-surface)}.plugin-button.primary{border-color:transparent;color:var(--admin-surface);background:var(--admin-accent)}.plugin-button.danger{color:#c95c5c;background:transparent;border-color:transparent}.plugin-file-input{display:none}.plugin-feedback{display:flex;gap:10px;align-items:center;border:1px solid var(--admin-border);border-radius:10px;padding:12px 16px;color:var(--admin-accent);background:var(--admin-accent-soft);font-size:12px;overflow-wrap:anywhere}.plugin-admin .is-error{color:#cf6565}.plugin-loading{display:flex;gap:10px;align-items:center;color:var(--admin-muted);font-size:12px}
.plugin-installed-list{display:grid;gap:16px}.plugin-installed-card{background:var(--admin-surface);border:1px solid var(--admin-border);border-radius:16px;overflow:hidden;min-width:0}.plugin-installed-card>header{display:flex;align-items:center;gap:13px;padding:22px 24px 12px}.plugin-installed-icon{display:grid;place-items:center;flex:none;width:48px;height:48px;background:var(--admin-accent-soft);color:var(--admin-accent);border:1px solid var(--admin-border);border-radius:13px}.plugin-installed-name{flex:1;min-width:0}.plugin-installed-name h4{font-size:15px;overflow-wrap:anywhere}.plugin-installed-name p{color:var(--admin-muted);font-size:10px;margin-top:5px}.plugin-status{display:flex;align-items:center;gap:6px;padding:5px 8px;font-size:10px;border:1px solid var(--admin-border);border-radius:20px;color:var(--admin-muted);flex:none}.plugin-status.active{background:var(--admin-accent-soft);color:var(--admin-accent)}.plugin-status.active i{background:var(--admin-accent)}.plugin-installed-card>.plugin-description{padding:0 24px}.plugin-installed-meta{display:flex;gap:14px;flex-wrap:wrap;padding:14px 24px 20px;font-size:10px;color:var(--admin-muted)}.plugin-installed-meta>span{display:flex;align-items:center;gap:6px}
.plugin-installed-card>details{border-top:1px solid var(--admin-border)}.plugin-installed-card>details>summary{display:flex;gap:8px;align-items:center;padding:15px 24px;list-style:none;cursor:pointer;color:var(--admin-muted);font-size:12px}.plugin-chevron{margin-left:auto;transition:transform .2s}details[open]>summary .plugin-chevron{transform:rotate(180deg)}summary::-webkit-details-marker{display:none}.plugin-installed-card fieldset{display:grid;gap:18px;min-width:0;margin:0;padding:6px 24px 24px;border:0}.plugin-enable-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px;background:var(--admin-raised);border:1px solid var(--admin-border);border-radius:10px}.plugin-enable-row strong{font-size:12px}.plugin-enable-row p{font-size:10px;color:var(--admin-muted);margin-top:4px}
.plugin-switch{position:relative;flex:none;display:block;width:36px;height:21px}.plugin-switch input{position:absolute;inset:0;opacity:0;margin:0;z-index:1;cursor:pointer;width:100%;height:100%}.plugin-switch>span{display:block;height:21px;border-radius:20px;background:var(--admin-border);transition:background .2s}.plugin-switch>span:after{content:'';display:block;position:absolute;left:3px;top:3px;width:15px;height:15px;border-radius:50%;background:white;transition:transform .2s}.plugin-switch input:checked+span{background:var(--admin-accent)}.plugin-switch input:checked+span:after{transform:translateX(15px)}.plugin-switch input:focus-visible+span{outline:3px solid color-mix(in srgb,var(--admin-accent) 35%,transparent);outline-offset:3px}
.plugin-installed-card fieldset>label,.plugin-advanced label{display:grid;gap:8px;color:var(--admin-muted);font-size:11px}.plugin-installed-card textarea,.plugin-installed-card select{width:100%;min-width:0;max-width:100%;border:1px solid var(--admin-border);padding:10px 12px;border-radius:8px;background:var(--admin-field);color:var(--admin-text);font-size:12px}.plugin-installed-card textarea{resize:vertical;line-height:1.7}.plugin-advanced{border:1px solid var(--admin-border);border-radius:9px;padding:0 12px}.plugin-advanced summary{display:flex;align-items:center;justify-content:space-between;font-size:11px;color:var(--admin-muted);padding:12px 0;cursor:pointer}.plugin-advanced label{padding-bottom:12px}.plugin-advanced textarea{font-family:ui-monospace,monospace}.plugin-settings-actions{display:flex;justify-content:space-between;gap:12px;padding-top:4px}.plugin-scope-help{margin-top:8px;border-top:1px solid var(--admin-border);padding-top:20px;color:var(--admin-muted);font-size:11px}.plugin-scope-help summary{display:flex;gap:8px;align-items:center;cursor:pointer;width:fit-content}.plugin-scope-help p{line-height:1.8;margin-top:12px;max-width:850px}.plugin-empty{display:grid;justify-items:center;gap:16px;padding:60px 20px;color:var(--admin-muted);text-align:center;border:1px dashed var(--admin-border);border-radius:16px}.plugin-empty h4{font-size:14px}.plugin-admin :is(button,a,input,textarea,select,summary):focus-visible{outline:3px solid color-mix(in srgb,var(--admin-accent) 35%,transparent);outline-offset:3px}
@media(max-width:1100px){.plugin-hero-art{width:100px;flex-basis:100px;margin-right:0}.plugin-hero{padding:26px}.plugin-tools{flex:1;justify-content:end}.plugin-search{flex:1;max-width:320px}.plugin-search input{width:100%}}
@media(max-width:600px){.plugin-admin{gap:18px}.plugin-hero{padding:24px 20px;border-radius:16px}.plugin-hero h2{font-size:25px}.plugin-hero p{font-size:12px}.plugin-hero-art{position:absolute;width:110px;right:-28px;top:-35px;opacity:.12}.plugin-metrics{gap:12px}.plugin-metrics>span{gap:6px;font-size:10px}.plugin-metrics b{font-size:18px}.plugin-tabs,.plugin-tools{width:100%}.plugin-tabs button{flex:1;justify-content:center;padding:8px 10px}.plugin-search{max-width:none}.plugin-section-heading>div{gap:8px}.plugin-section-heading h3{font-size:14px}.plugin-source{font-size:9px}.plugin-card-body{padding:18px}.plugin-market-card{max-width:none}.plugin-installed-card>header{padding:18px 16px 12px;flex-wrap:wrap;gap:10px}.plugin-installed-icon{width:40px;height:40px}.plugin-installed-name h4{font-size:13px}.plugin-status{font-size:9px}.plugin-installed-card>.plugin-description,.plugin-installed-meta{padding-left:16px;padding-right:16px}.plugin-installed-card>details>summary{padding:14px 16px}.plugin-installed-card fieldset{padding:4px 16px 16px}.plugin-enable-row{padding:12px}}
</style>