Polish plugin management UI
This commit is contained in:
parent
2549791d76
commit
ab1cbe5480
3 changed files with 372 additions and 92 deletions
|
|
@ -117,8 +117,9 @@ function renderPluginsSnapshot(snapshot) {
|
|||
const list = requireElement("plugins-list");
|
||||
const detail = requireElement("plugins-detail");
|
||||
const status = requireElement("plugins-status");
|
||||
list.replaceChildren();
|
||||
|
||||
status.textContent = snapshot.plugins.length === 0 ? "No plugins installed yet." : `${snapshot.plugins.length} plugin${snapshot.plugins.length === 1 ? "" : "s"} installed.`;
|
||||
status.className = "";
|
||||
requireButton("plugins-refresh").onclick = () => {
|
||||
if (currentPluginsTab === "discover") {
|
||||
void renderDiscover(true).catch(renderCaughtError);
|
||||
|
|
@ -126,39 +127,78 @@ function renderPluginsSnapshot(snapshot) {
|
|||
void renderPlugins().catch(renderCaughtError);
|
||||
}
|
||||
};
|
||||
|
||||
requireButton("plugins-installed-tab").onclick = () => setPluginsTab("installed");
|
||||
requireButton("plugins-discover-tab").onclick = () => setPluginsTab("discover");
|
||||
requireButton("plugins-developer-tab").onclick = () => setPluginsTab("developer");
|
||||
|
||||
const loadLocalButton = document.getElementById("plugins-load-local");
|
||||
if (loadLocalButton) loadLocalButton.onclick = () => { void loadLocalPlugin().catch(renderCaughtError); };
|
||||
|
||||
if (!snapshot.plugins.some((plugin) => plugin.id === activePluginId)) activePluginId = snapshot.plugins[0]?.id || "";
|
||||
|
||||
if (snapshot.plugins.length === 0) {
|
||||
detail.className = "panel empty";
|
||||
detail.textContent = "Installed manifest plugins will appear here. Catalog and local loading are coming in later phases.";
|
||||
list.textContent = "";
|
||||
detail.className = "panel empty-state";
|
||||
detail.innerHTML = `
|
||||
<h3>No plugins installed</h3>
|
||||
<p>Use Discover to install catalog plugins, or Developer to load a local manifest.</p>
|
||||
`;
|
||||
return;
|
||||
}
|
||||
|
||||
list.textContent = "";
|
||||
for (const plugin of snapshot.plugins) {
|
||||
const button = document.createElement("button");
|
||||
button.type = "button";
|
||||
button.className = `plugin-card${plugin.id === activePluginId ? " active" : ""}`;
|
||||
|
||||
const titleRow = document.createElement("div");
|
||||
titleRow.style.display = "flex";
|
||||
titleRow.style.justifyContent = "space-between";
|
||||
titleRow.style.alignItems = "center";
|
||||
|
||||
const title = document.createElement("strong");
|
||||
title.textContent = plugin.name || plugin.id;
|
||||
const meta = document.createElement("div");
|
||||
meta.className = "muted";
|
||||
meta.textContent = `${plugin.version} · ${plugin.source} · ${plugin.enabled ? "enabled" : "disabled"}`;
|
||||
button.append(title, meta);
|
||||
|
||||
const statusDot = document.createElement("div");
|
||||
statusDot.className = `status-dot ${plugin.brokenReason ? "broken" : plugin.enabled ? "enabled" : ""}`;
|
||||
statusDot.title = plugin.brokenReason ? "Broken" : plugin.enabled ? "Enabled" : "Disabled";
|
||||
|
||||
titleRow.append(title, statusDot);
|
||||
|
||||
const metaRow = document.createElement("div");
|
||||
metaRow.style.display = "flex";
|
||||
metaRow.style.justifyContent = "space-between";
|
||||
metaRow.style.fontSize = "12px";
|
||||
metaRow.style.color = "#94a3b8";
|
||||
|
||||
const version = document.createElement("span");
|
||||
version.textContent = `v${plugin.version}`;
|
||||
|
||||
const source = document.createElement("span");
|
||||
source.textContent = plugin.source;
|
||||
|
||||
metaRow.append(version, source);
|
||||
|
||||
button.append(titleRow, metaRow);
|
||||
|
||||
if (plugin.brokenReason) {
|
||||
const broken = document.createElement("div");
|
||||
broken.className = "error";
|
||||
broken.textContent = "Needs attention";
|
||||
broken.className = "pill error";
|
||||
broken.textContent = "Broken";
|
||||
broken.style.alignSelf = "flex-start";
|
||||
broken.style.marginTop = "4px";
|
||||
button.append(broken);
|
||||
}
|
||||
|
||||
button.onclick = () => {
|
||||
activePluginId = plugin.id;
|
||||
renderPluginsSnapshot(snapshot);
|
||||
};
|
||||
list.append(button);
|
||||
}
|
||||
|
||||
const selected = snapshot.plugins.find((plugin) => plugin.id === activePluginId) || snapshot.plugins[0];
|
||||
renderPluginDetail(selected);
|
||||
}
|
||||
|
|
@ -176,101 +216,190 @@ async function loadLocalPlugin() {
|
|||
function renderPluginDetail(plugin) {
|
||||
const detail = requireElement("plugins-detail");
|
||||
detail.className = "panel";
|
||||
detail.replaceChildren();
|
||||
detail.textContent = "";
|
||||
|
||||
const header = document.createElement("div");
|
||||
header.className = "detail-header";
|
||||
|
||||
const titleCol = document.createElement("div");
|
||||
titleCol.className = "detail-title";
|
||||
|
||||
const title = document.createElement("h2");
|
||||
title.textContent = plugin.name || plugin.id;
|
||||
const meta = document.createElement("p");
|
||||
meta.className = "muted";
|
||||
meta.textContent = `${plugin.id} · ${plugin.version} · ${plugin.source}`;
|
||||
detail.append(title, meta);
|
||||
|
||||
const meta = document.createElement("div");
|
||||
meta.className = "detail-meta";
|
||||
|
||||
const idBadge = document.createElement("span");
|
||||
idBadge.className = "pill";
|
||||
idBadge.textContent = plugin.id;
|
||||
|
||||
const verBadge = document.createElement("span");
|
||||
verBadge.className = "pill";
|
||||
verBadge.textContent = `v${plugin.version}`;
|
||||
|
||||
const srcBadge = document.createElement("span");
|
||||
srcBadge.className = "pill";
|
||||
srcBadge.textContent = plugin.source;
|
||||
|
||||
meta.append(idBadge, verBadge, srcBadge);
|
||||
titleCol.append(title, meta);
|
||||
|
||||
if (plugin.brokenReason) {
|
||||
const broken = document.createElement("p");
|
||||
broken.className = "error";
|
||||
broken.textContent = plugin.brokenReason;
|
||||
detail.append(broken);
|
||||
const broken = document.createElement("div");
|
||||
broken.className = "pill error";
|
||||
broken.textContent = `Broken: ${plugin.brokenReason}`;
|
||||
broken.style.marginTop = "8px";
|
||||
titleCol.append(broken);
|
||||
}
|
||||
const permissions = document.createElement("div");
|
||||
for (const permission of plugin.approvedPermissions || []) {
|
||||
const pill = document.createElement("span");
|
||||
pill.className = "pill";
|
||||
pill.textContent = permission;
|
||||
permissions.append(pill);
|
||||
}
|
||||
detail.append(permissions);
|
||||
const actions = document.createElement("div");
|
||||
actions.className = "actions";
|
||||
|
||||
const toggleWrap = document.createElement("div");
|
||||
toggleWrap.style.display = "flex";
|
||||
toggleWrap.style.flexDirection = "column";
|
||||
toggleWrap.style.alignItems = "flex-end";
|
||||
toggleWrap.style.gap = "8px";
|
||||
|
||||
const toggle = document.createElement("button");
|
||||
toggle.type = "button";
|
||||
toggle.className = "primary";
|
||||
toggle.textContent = plugin.enabled ? "Disable" : "Enable";
|
||||
toggle.className = `toggle ${plugin.enabled ? "enabled" : ""}`;
|
||||
toggle.setAttribute("role", "switch");
|
||||
toggle.setAttribute("aria-checked", String(plugin.enabled));
|
||||
toggle.title = plugin.enabled ? "Disable plugin" : "Enable plugin";
|
||||
toggle.onclick = () => runPluginAction(() => pluginsApi.setEnabled(plugin.id, !plugin.enabled));
|
||||
|
||||
const toggleLabel = document.createElement("span");
|
||||
toggleLabel.textContent = plugin.enabled ? "Enabled" : "Disabled";
|
||||
toggleLabel.style.fontSize = "13px";
|
||||
toggleLabel.style.color = plugin.enabled ? "#10b981" : "#94a3b8";
|
||||
toggleLabel.style.fontWeight = "500";
|
||||
|
||||
toggleWrap.append(toggle, toggleLabel);
|
||||
header.append(titleCol, toggleWrap);
|
||||
detail.append(header);
|
||||
|
||||
if (plugin.description) {
|
||||
const desc = document.createElement("p");
|
||||
desc.textContent = plugin.description;
|
||||
desc.style.marginBottom = "24px";
|
||||
detail.append(desc);
|
||||
}
|
||||
|
||||
if (plugin.approvedPermissions?.length) {
|
||||
const perms = document.createElement("div");
|
||||
perms.style.marginBottom = "24px";
|
||||
perms.style.display = "flex";
|
||||
perms.style.gap = "8px";
|
||||
perms.style.flexWrap = "wrap";
|
||||
for (const permission of plugin.approvedPermissions) {
|
||||
const p = document.createElement("span");
|
||||
p.className = "pill";
|
||||
p.textContent = permission;
|
||||
perms.append(p);
|
||||
}
|
||||
detail.append(perms);
|
||||
}
|
||||
|
||||
renderPluginConfigForm(detail, plugin);
|
||||
|
||||
const dangerZone = document.createElement("div");
|
||||
dangerZone.className = "danger-zone";
|
||||
|
||||
const reload = document.createElement("button");
|
||||
reload.className = "secondary";
|
||||
reload.type = "button";
|
||||
reload.textContent = "Reload";
|
||||
reload.onclick = () => runPluginAction(() => pluginsApi.reload(plugin.id));
|
||||
actions.append(toggle, reload);
|
||||
|
||||
const uninstallBtn = document.createElement("button");
|
||||
uninstallBtn.type = "button";
|
||||
uninstallBtn.textContent = "Uninstall";
|
||||
uninstallBtn.onclick = () => {
|
||||
const uninstall = document.createElement("button");
|
||||
uninstall.className = "destructive";
|
||||
uninstall.type = "button";
|
||||
uninstall.textContent = "Uninstall";
|
||||
uninstall.onclick = () => {
|
||||
if (confirm(`Are you sure you want to uninstall ${plugin.name || plugin.id}?`)) {
|
||||
runPluginAction(() => pluginsApi.uninstall(plugin.id));
|
||||
}
|
||||
};
|
||||
actions.append(uninstallBtn);
|
||||
|
||||
detail.append(actions);
|
||||
renderPluginConfigForm(detail, plugin);
|
||||
dangerZone.append(reload, uninstall);
|
||||
detail.append(dangerZone);
|
||||
}
|
||||
|
||||
function renderPluginConfigForm(parent, plugin) {
|
||||
const schema = plugin.configSchema || {};
|
||||
const keys = Object.keys(schema).sort((a, b) => a.localeCompare(b));
|
||||
const keys = Object.keys(schema);
|
||||
|
||||
const container = document.createElement("div");
|
||||
container.className = "config-panel";
|
||||
|
||||
const title = document.createElement("h3");
|
||||
title.textContent = "Settings";
|
||||
container.append(title);
|
||||
|
||||
if (keys.length === 0) {
|
||||
const empty = document.createElement("p");
|
||||
empty.className = "muted";
|
||||
empty.textContent = "This plugin has no settings.";
|
||||
parent.append(empty);
|
||||
container.append(empty);
|
||||
parent.append(container);
|
||||
return;
|
||||
}
|
||||
|
||||
const form = document.createElement("form");
|
||||
form.dataset.pluginConfigForm = plugin.id;
|
||||
const values = plugin.effectiveConfig || {};
|
||||
|
||||
for (const key of keys) {
|
||||
const field = schema[key];
|
||||
const wrap = document.createElement("div");
|
||||
wrap.className = "field";
|
||||
if (!field) continue;
|
||||
const wrapper = document.createElement("div");
|
||||
wrapper.className = "field";
|
||||
const label = document.createElement("label");
|
||||
label.textContent = field.label || key;
|
||||
label.htmlFor = `plugin-config-${key}`;
|
||||
if (field.description) label.title = field.description;
|
||||
const input = createPluginConfigInput(key, field, values[key]);
|
||||
wrap.append(label, input);
|
||||
wrapper.append(label, input);
|
||||
if (field.description) {
|
||||
const help = document.createElement("small");
|
||||
help.className = "muted";
|
||||
help.textContent = field.description;
|
||||
wrap.append(help);
|
||||
const desc = document.createElement("div");
|
||||
desc.className = "muted";
|
||||
desc.style.fontSize = "11px";
|
||||
desc.style.marginTop = "4px";
|
||||
desc.textContent = field.description;
|
||||
wrapper.append(desc);
|
||||
}
|
||||
form.append(wrap);
|
||||
form.append(wrapper);
|
||||
}
|
||||
|
||||
if (plugin.configErrors?.length) {
|
||||
const errors = document.createElement("p");
|
||||
errors.className = "error";
|
||||
const errors = document.createElement("div");
|
||||
errors.className = "pill error";
|
||||
errors.style.marginTop = "16px";
|
||||
errors.style.display = "block";
|
||||
errors.style.padding = "12px";
|
||||
errors.style.borderRadius = "8px";
|
||||
errors.textContent = plugin.configErrors.map((error) => error.message).join(" ");
|
||||
form.append(errors);
|
||||
}
|
||||
|
||||
const actions = document.createElement("div");
|
||||
actions.className = "actions";
|
||||
actions.style.marginTop = "24px";
|
||||
|
||||
const save = document.createElement("button");
|
||||
save.type = "submit";
|
||||
save.className = "primary";
|
||||
save.type = "submit";
|
||||
save.textContent = "Save settings";
|
||||
form.append(save);
|
||||
actions.append(save);
|
||||
form.append(actions);
|
||||
|
||||
form.onsubmit = (event) => {
|
||||
event.preventDefault();
|
||||
const nextConfig = collectPluginConfigForm(form, schema);
|
||||
void runPluginAction(() => pluginsApi.saveConfig(plugin.id, nextConfig));
|
||||
};
|
||||
parent.append(form);
|
||||
|
||||
container.append(form);
|
||||
parent.append(container);
|
||||
}
|
||||
|
||||
function createPluginConfigInput(key, field, value) {
|
||||
|
|
@ -325,10 +454,11 @@ async function runPluginAction(action) {
|
|||
requireElement("plugins-status").textContent = result.error || "Plugin action failed.";
|
||||
requireElement("plugins-status").className = "error";
|
||||
if (isPluginsSnapshot(result.snapshot)) renderPluginsSnapshot(result.snapshot);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (isPluginsSnapshot(result?.snapshot)) renderPluginsSnapshot(result.snapshot);
|
||||
else await renderPlugins();
|
||||
return true;
|
||||
}
|
||||
|
||||
async function renderDiscover(refresh = false) {
|
||||
|
|
@ -347,8 +477,11 @@ async function renderDiscover(refresh = false) {
|
|||
|
||||
if (catalog.plugins.length === 0) {
|
||||
const empty = document.createElement("div");
|
||||
empty.className = "empty muted";
|
||||
empty.textContent = "No plugins available in the catalog.";
|
||||
empty.className = "empty-state";
|
||||
empty.innerHTML = `
|
||||
<h3>Catalog empty</h3>
|
||||
<p>No plugins available in the catalog at this time.</p>
|
||||
`;
|
||||
list.append(empty);
|
||||
status.textContent = "Catalog loaded.";
|
||||
return;
|
||||
|
|
@ -356,11 +489,27 @@ async function renderDiscover(refresh = false) {
|
|||
|
||||
for (const plugin of catalog.plugins) {
|
||||
const card = document.createElement("div");
|
||||
card.className = "plugin-card";
|
||||
card.className = "discover-card";
|
||||
|
||||
const titleRow = document.createElement("div");
|
||||
titleRow.style.display = "flex";
|
||||
titleRow.style.justifyContent = "space-between";
|
||||
titleRow.style.alignItems = "center";
|
||||
titleRow.style.marginBottom = "4px";
|
||||
|
||||
const title = document.createElement("h3");
|
||||
title.textContent = plugin.name || plugin.id;
|
||||
title.style.margin = "0 0 4px 0";
|
||||
title.style.margin = "0";
|
||||
|
||||
titleRow.append(title);
|
||||
|
||||
if (plugin.installed) {
|
||||
const badge = document.createElement("span");
|
||||
badge.className = "pill success";
|
||||
badge.textContent = "Installed";
|
||||
badge.style.fontSize = "11px";
|
||||
titleRow.append(badge);
|
||||
}
|
||||
|
||||
const meta = document.createElement("div");
|
||||
meta.className = "muted";
|
||||
|
|
@ -385,15 +534,21 @@ async function renderDiscover(refresh = false) {
|
|||
installBtn.type = "button";
|
||||
if (plugin.installed) {
|
||||
installBtn.textContent = "Update";
|
||||
installBtn.onclick = () => runPluginAction(() => pluginsApi.updateCatalog(plugin.id));
|
||||
installBtn.onclick = async () => {
|
||||
const ok = await runPluginAction(() => pluginsApi.updateCatalog(plugin.id));
|
||||
if (ok) void renderDiscover();
|
||||
};
|
||||
} else {
|
||||
installBtn.className = "primary";
|
||||
installBtn.textContent = "Install";
|
||||
installBtn.onclick = () => runPluginAction(() => pluginsApi.installCatalog(plugin.id));
|
||||
installBtn.onclick = async () => {
|
||||
const ok = await runPluginAction(() => pluginsApi.installCatalog(plugin.id));
|
||||
if (ok) void renderDiscover();
|
||||
};
|
||||
}
|
||||
actions.append(installBtn);
|
||||
|
||||
card.append(title, meta, desc, permissions, actions);
|
||||
card.append(titleRow, meta, desc, permissions, actions);
|
||||
list.append(card);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,35 +13,160 @@ export function createPluginsHtml(definition: PluginsWindowDefinition): string {
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>${escapeHtml(definition.title)}</title>
|
||||
<style>
|
||||
:root { color-scheme: dark; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
|
||||
body { margin: 0; min-height: 100vh; background: #020617; color: #e5e7eb; }
|
||||
main { width: min(1040px, calc(100vw - 48px)); margin: 0 auto; padding: 32px 0 48px; }
|
||||
header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 24px; }
|
||||
h1 { margin: 0 0 8px; font-size: 32px; }
|
||||
p { color: #cbd5e1; line-height: 1.6; }
|
||||
button, input, select, textarea { font: inherit; }
|
||||
button { border: 1px solid rgba(148, 163, 184, 0.35); border-radius: 12px; background: rgba(15, 23, 42, 0.95); color: #e5e7eb; padding: 9px 12px; cursor: pointer; }
|
||||
button.primary { background: linear-gradient(135deg, #2563eb, #7c3aed); border-color: transparent; }
|
||||
button:disabled { cursor: not-allowed; opacity: 0.55; }
|
||||
.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
|
||||
.tab { color: #bfdbfe; }
|
||||
.tab.active { background: rgba(37, 99, 235, 0.24); border-color: rgba(96, 165, 250, 0.65); }
|
||||
.layout { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 18px; align-items: start; }
|
||||
.panel, .plugin-card { border: 1px solid rgba(148, 163, 184, 0.2); border-radius: 20px; background: rgba(15, 23, 42, 0.78); box-shadow: 0 18px 60px rgba(0,0,0,0.24); }
|
||||
.panel { padding: 18px; }
|
||||
.plugin-list { display: grid; gap: 10px; }
|
||||
.plugin-card { width: 100%; text-align: left; padding: 14px; }
|
||||
.plugin-card.active { border-color: rgba(96, 165, 250, 0.75); }
|
||||
.muted { color: #94a3b8; }
|
||||
.pill { display: inline-flex; border: 1px solid rgba(148, 163, 184, 0.25); border-radius: 999px; padding: 3px 8px; color: #bfdbfe; font-size: 12px; margin: 4px 4px 0 0; }
|
||||
.error { color: #fecaca; }
|
||||
.success { color: #bbf7d0; }
|
||||
.field { display: grid; gap: 6px; margin: 14px 0; }
|
||||
label { color: #dbeafe; font-weight: 700; }
|
||||
input, select, textarea { border: 1px solid rgba(148, 163, 184, 0.28); border-radius: 12px; background: rgba(2, 6, 23, 0.7); color: #e5e7eb; padding: 10px 12px; }
|
||||
textarea { min-height: 96px; resize: vertical; }
|
||||
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
|
||||
.empty { padding: 28px; text-align: center; }
|
||||
:root { color-scheme: light; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
|
||||
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 12% 8%, rgba(219, 234, 254, 0.9), transparent 24%), linear-gradient(180deg, #f8fbff 0%, #eff7ff 54%, #e9f3ff 100%); color: #102149; overflow-y: scroll; }
|
||||
main { width: min(1040px, calc(100vw - 48px)); margin: 0 auto; padding: 48px 0 64px; }
|
||||
|
||||
/* Typography */
|
||||
h1, h2, h3 { margin: 0; font-weight: 600; tracking: -0.02em; text-wrap: balance; }
|
||||
h1 { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 32px; line-height: 1; letter-spacing: -0.05em; color: #102149; margin-bottom: 8px; }
|
||||
h2 { font-size: 20px; margin-bottom: 12px; color: #102149; }
|
||||
h3 { font-size: 16px; margin-bottom: 16px; color: #102149; }
|
||||
p { color: #63708f; line-height: 1.6; margin: 0; text-wrap: pretty; }
|
||||
.muted { color: #63708f; font-size: 14px; }
|
||||
|
||||
/* Header */
|
||||
header { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 32px; }
|
||||
|
||||
/* Buttons */
|
||||
button, input, select, textarea { font: inherit; box-sizing: border-box; }
|
||||
button {
|
||||
display: inline-flex; align-items: center; justify-content: center; gap: 8px;
|
||||
min-height: 38px; padding: 0 12px; border-radius: 11px;
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 12px; font-weight: 950;
|
||||
cursor: pointer; user-select: none;
|
||||
border: 1px solid rgba(37, 99, 235, 0.34); background: rgba(255,255,255,0.76); color: #176df2;
|
||||
box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 8px 18px rgba(61, 99, 160, 0.08);
|
||||
}
|
||||
button:hover:not(:disabled) { transform: translateY(-1px); }
|
||||
button:active:not(:disabled) { transform: scale(0.96); }
|
||||
button:disabled { cursor: default; opacity: 0.54; transform: none; }
|
||||
|
||||
button.primary { background: linear-gradient(180deg, #3b96ff, #176df2); color: #fff; box-shadow: 0 14px 28px rgba(37, 99, 235, 0.24), inset 0 1px 0 rgba(255,255,255,0.38); border-color: transparent; }
|
||||
button.primary:hover:not(:disabled) { background: linear-gradient(180deg, #55a6ff, #176df2); }
|
||||
|
||||
button.secondary { background: rgba(255,255,255,0.76); color: #176df2; border-color: rgba(37, 99, 235, 0.42); box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 8px 18px rgba(61, 99, 160, 0.08); }
|
||||
button.secondary:hover:not(:disabled) { background: rgba(255,255,255,0.95); border-color: rgba(37, 99, 235, 0.55); box-shadow: inset 0 1px 0 rgba(255,255,255,1), 0 8px 18px rgba(61, 99, 160, 0.12); }
|
||||
|
||||
button.destructive { color: #dc2626; border-color: rgba(239, 68, 68, 0.42); }
|
||||
button.destructive:hover:not(:disabled) { background: #fef2f2; border-color: rgba(239, 68, 68, 0.62); box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.08), inset 0 1px 0 rgba(255,255,255,0.94); }
|
||||
|
||||
button:focus-visible, .discover-card:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }
|
||||
|
||||
/* Segmented Control / Tabs */
|
||||
.tabs {
|
||||
display: inline-flex; background: rgba(239, 246, 255, 0.5); border: 1px solid rgba(126, 161, 210, 0.28);
|
||||
border-radius: 16px; padding: 4px; gap: 2px; margin-bottom: 32px;
|
||||
}
|
||||
.tab {
|
||||
background: transparent; border: none; border-radius: 12px; color: #526483;
|
||||
padding: 8px 20px; font-weight: 900; min-height: 36px; box-shadow: none; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px;
|
||||
}
|
||||
.tab:hover:not(:disabled) { background: rgba(255,255,255,0.4); color: #102149; transform: none; }
|
||||
.tab.active { background: rgba(255,255,255,0.82); color: #176df2; box-shadow: 0 4px 12px rgba(61, 99, 160, 0.08), inset 0 1px 0 rgba(255,255,255,0.9); border: 1px solid rgba(126, 161, 210, 0.34); }
|
||||
.tab.active:hover:not(:disabled) { background: rgba(255,255,255,0.9); }
|
||||
|
||||
[hidden] { display: none !important; }
|
||||
/* Layouts */
|
||||
.layout { display: grid; grid-template-columns: 320px 1fr; gap: 24px; align-items: start; }
|
||||
|
||||
/* Panels & Cards */
|
||||
.panel {
|
||||
background: rgba(255,255,255,0.76); border: 1px solid rgba(126, 161, 210, 0.44);
|
||||
border-radius: 20px; padding: 24px; box-shadow: 0 16px 38px rgba(61, 99, 160, 0.1), inset 0 1px 0 rgba(255,255,255,0.94);
|
||||
}
|
||||
|
||||
.plugin-list { display: flex; flex-direction: column; gap: 8px; }
|
||||
|
||||
/* Sidebar Cards */
|
||||
.plugin-card {
|
||||
display: flex; flex-direction: column; gap: 6px; width: 100%; text-align: left;
|
||||
padding: 16px; border-radius: 16px; background: rgba(255,255,255,0.5);
|
||||
border: 1px solid rgba(126, 161, 210, 0.28); cursor: pointer;
|
||||
box-shadow: none;
|
||||
}
|
||||
.plugin-card:hover { background: rgba(255,255,255,0.8); border-color: rgba(126, 161, 210, 0.44); transform: none; }
|
||||
.plugin-card:active { transform: scale(0.98); }
|
||||
.plugin-card.active {
|
||||
background: linear-gradient(180deg, rgba(239, 247, 255, 0.92), rgba(255,255,255,0.78)); border-color: rgba(37, 99, 235, 0.36);
|
||||
box-shadow: inset 0 1px 0 rgba(255,255,255,0.94);
|
||||
}
|
||||
|
||||
/* Discover Grid */
|
||||
#plugins-discover-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
|
||||
.discover-card {
|
||||
display: flex; flex-direction: column; padding: 20px; border-radius: 20px;
|
||||
background: rgba(255,255,255,0.76); border: 1px solid rgba(126, 161, 210, 0.44);
|
||||
box-shadow: 0 16px 38px rgba(61, 99, 160, 0.1), inset 0 1px 0 rgba(255,255,255,0.94);
|
||||
}
|
||||
.discover-card:hover {
|
||||
border-color: rgba(37, 99, 235, 0.36); transform: translateY(-2px);
|
||||
box-shadow: 0 20px 42px rgba(61, 99, 160, 0.15), inset 0 1px 0 rgba(255,255,255,0.94);
|
||||
}
|
||||
.discover-card .actions { margin-top: auto; padding-top: 20px; }
|
||||
|
||||
/* Detail View */
|
||||
.detail-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid rgba(126, 161, 210, 0.28); }
|
||||
.detail-title { display: flex; flex-direction: column; gap: 8px; }
|
||||
.detail-meta { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #63708f; }
|
||||
|
||||
/* Form Elements */
|
||||
.config-panel { background: rgba(239, 246, 255, 0.5); border-radius: 16px; padding: 24px; border: 1px solid rgba(126, 161, 210, 0.28); margin-bottom: 32px; }
|
||||
.field { display: grid; gap: 8px; margin-bottom: 20px; }
|
||||
.field:last-child { margin-bottom: 0; }
|
||||
label { color: #102149; font-weight: 900; font-size: 14px; }
|
||||
input, select, textarea {
|
||||
border: 1px solid rgba(126, 161, 210, 0.54); border-radius: 11px;
|
||||
background: rgba(255,255,255,0.82); color: #17284f; padding: 10px 14px;
|
||||
font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; outline: none;
|
||||
}
|
||||
input:focus, select:focus, textarea:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15); }
|
||||
textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
|
||||
|
||||
/* Status & Badges */
|
||||
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #64748b; }
|
||||
.status-dot.enabled { background: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, 0.4); }
|
||||
.status-dot.broken { background: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, 0.4); }
|
||||
|
||||
.pill {
|
||||
height: 30px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
|
||||
border: 1px solid rgba(126, 161, 210, 0.36); border-radius: 10px; padding: 0 10px;
|
||||
background: rgba(255,255,255,0.68); color: #526483; font-size: 10px; font-weight: 900; white-space: nowrap;
|
||||
}
|
||||
.pill.success { color: #047857; background: rgba(236, 253, 245, 0.86); border-color: rgba(16, 185, 129, 0.28); }
|
||||
.pill.error { color: #b91c1c; background: rgba(254, 242, 242, 0.9); border-color: rgba(248, 113, 113, 0.32); }
|
||||
|
||||
/* Layout Utils */
|
||||
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
|
||||
.actions-right { margin-left: auto; }
|
||||
.danger-zone {
|
||||
margin-top: 32px; padding-top: 24px; border-top: 1px solid rgba(239, 68, 68, 0.2);
|
||||
display: flex; justify-content: space-between; align-items: center;
|
||||
}
|
||||
.empty-state {
|
||||
display: flex; flex-direction: column; align-items: center; justify-content: center;
|
||||
padding: 64px 24px; text-align: center; gap: 16px;
|
||||
}
|
||||
.empty-state h3 { margin: 0; color: #102149; }
|
||||
.empty-state p { max-width: 400px; }
|
||||
|
||||
/* Toggle Switch */
|
||||
.toggle {
|
||||
position: relative; display: inline-block; width: 44px; height: 24px; min-height: 24px; padding: 0;
|
||||
background: rgba(126, 161, 210, 0.28); border: 1px solid rgba(126, 161, 210, 0.44); border-radius: 999px; cursor: pointer;
|
||||
box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
|
||||
}
|
||||
.toggle.enabled { background: #10b981; border-color: #059669; }
|
||||
.toggle::after {
|
||||
content: ''; position: absolute; top: 1px; left: 1px; width: 20px; height: 20px;
|
||||
background: #fff; border-radius: 50%;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
|
||||
}
|
||||
.toggle.enabled::after { transform: translateX(20px); }
|
||||
|
||||
#plugins-status { margin-bottom: 24px; font-size: 14px; color: #63708f; }
|
||||
#plugins-status.error { color: #b91c1c; }
|
||||
@media (prefers-reduced-motion: reduce) { button:hover:not(:disabled), button:active:not(:disabled) { transform: none; } }
|
||||
</style>
|
||||
</head>
|
||||
<body data-openpets-view="plugins">
|
||||
|
|
@ -69,7 +194,7 @@ export function createPluginsHtml(definition: PluginsWindowDefinition): string {
|
|||
<section id="plugins-developer-view" class="panel" hidden>
|
||||
<h2>Developer plugins</h2>
|
||||
<p class="muted">Load a local manifest-only plugin folder for development. OpenPets snapshots only openpets.plugin.json into app data.</p>
|
||||
<button id="plugins-load-local" class="primary" type="button">Load local plugin folder</button>
|
||||
<button id="plugins-load-local" class="primary" type="button" style="margin-top: 24px;">Load local plugin folder</button>
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -1256,7 +1256,7 @@ function createTaskWindowStyles(): string {
|
|||
body[data-openpets-view="pet-manager"] .pm-detail-actions button:hover:not(:disabled) { background: linear-gradient(180deg, #55a6ff, #176df2); transform: translateY(-1px); }
|
||||
body[data-openpets-view="pet-manager"] .pm-detail-actions button:active:not(:disabled) { transform: scale(0.96); }
|
||||
body[data-openpets-view="pet-manager"] .pm-detail-actions button.secondary { background: rgba(255,255,255,0.76); color: #176df2; border-color: rgba(37, 99, 235, 0.42); box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 8px 18px rgba(61, 99, 160, 0.08); }
|
||||
body[data-openpets-view="pet-manager"] .pm-detail-actions button.secondary:hover:not(:disabled) { background: #fef2f2; color: #dc2626; border-color: rgba(239, 68, 68, 0.58); box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1), inset 0 1px 0 rgba(255,255,255,0.94); }
|
||||
body[data-openpets-view="pet-manager"] .pm-detail-actions button.secondary:hover:not(:disabled) { background: rgba(255,255,255,0.95); border-color: rgba(37, 99, 235, 0.55); box-shadow: inset 0 1px 0 rgba(255,255,255,1), 0 8px 18px rgba(61, 99, 160, 0.12); }
|
||||
body[data-openpets-view="pet-manager"] .pm-detail-actions button:disabled { opacity: 1; cursor: default; background: linear-gradient(180deg, #ecf5ff, #dbeafe); color: #176df2; box-shadow: inset 0 1px 0 rgba(255,255,255,0.9); }
|
||||
body[data-openpets-view="pet-manager"] .pm-detail-actions button:only-child { grid-column: 1 / -1; }
|
||||
body[data-openpets-view="pet-manager"] .pm-empty-state { grid-column: 1 / -1; padding: 28px; text-align: center; color: #667694; border: 1px dashed rgba(126, 161, 210, 0.48); border-radius: 18px; background: rgba(255,255,255,0.5); }
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue