Files
plugins/packages/powercontext/page/style.css
T
Tsukikage 1e4c8a2b91 powercontext 0.2.0: PowerContext recall and opt-in capture as a gateway hook (#117)
PowerContext as a gateway hook package (@magpie-community/gateway-powercontext 0.2.0): recall from a user-deployed PowerContext service before a request, and opt-in capture of completed conversations, with a connection page that uses only the options/theme bridge. By @Tsukikage7.

Reviewed at c61036e9 (author) plus bff430f9 (maintainer merge of main: README, registry.json and scripts/check.mjs conflicts, both sides kept; check.mjs takes main's identical hooks skip).
All four points of the 10-25 review are fixed: the timing tests give the healthy side 1000 ms and move the backoff with a stubbed Date.now(); the empty page panels are gone; Scope ID is optional on the page as in the hook; both READMEs describe the npm install and the registry lists it.

Run on mote (macOS, Bun 1.4.2, temp HOME) at bff430f9:
- bun scripts/check.mjs: exit 0. Full bun test: 3423 pass, 8 skip, 0 fail.
- packages/powercontext: 107 pass, 5 runs in a row, then 8 runs in parallel, 0 fail each.
- Broken by hand: putting the Scope-required check back in page/settings.js turns the optional-Scope page test red; making the recall backoff expire at once (powercontext.hooks.mjs:336) turns 4 tests red (hung scope/prepare/body and connection-failure backoff).
- Earlier round (10-25): the real package in magpie's Bun host behind the gateway handler, against fake PowerContext and upstream.
Not tried: the page in a browser at this head (the author reports 40 Chromium/WebKit cases), a real PowerContext server.
2026-10-29 21:13:37 +08:00

151 lines
11 KiB
CSS

:root {
--bg: var(--magpie-bg, #f5f5f7);
--card: var(--magpie-card, #fff);
--fg: var(--magpie-fg, #1d1d1f);
--muted: var(--magpie-muted, #6e6e73);
--line: var(--magpie-line, #e5e5ea);
--accent: var(--magpie-accent, #4f46e5);
--accent-soft: var(--magpie-accent-soft, color-mix(in srgb, var(--accent) 10%, var(--card)));
--accent-fg: var(--magpie-accent-fg, #fff);
--red: var(--magpie-red, #d70015);
}
/* The official bridge sets data-theme for explicit and system themes alike. */
.pc-brand-dark { display: none; }
:root[data-theme=dark] .pc-brand-light { display: none; }
:root[data-theme=dark] .pc-brand-dark { display: block; }
* { box-sizing: border-box; }
body {
margin: 0;
padding: 16px 18px 28px;
background: var(--bg);
color: var(--fg);
font: 13px/1.4 var(--magpie-font, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif);
}
main { max-width: 1120px; margin: auto; }
header { display: flex; align-items: center; gap: 8px; margin: 2px 0 14px; }
.page-head > div { flex: 1; }
.page-head img { width: 20px; height: 20px; }
.page-head h1 { font-size: 13px; }
.page-head p { display: inline; font-size: 12px; }
#configure { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
header img { flex: none; }
h1, h2 { margin: 0; font-size: 13px; font-weight: 600; }
p { margin: 4px 0; color: var(--muted); }
header p { font-size: 11.5px; }
.panel { padding: 0 0 14px; }
.section-heading { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.section-heading span { color: var(--muted); font-size: 11.5px; }
.connection-summary { padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); }
dl { min-width: 0; margin: 0; display: grid; grid-template-columns: 1fr 1.3fr auto; gap: 18px; }
dl > div { display: grid; gap: 4px; min-width: 0; }
dt { color: var(--muted); font-size: 12px; }
dd { margin: 0; overflow-wrap: anywhere; font-size: 12px; font-variant-numeric: tabular-nums; }
dl > div:nth-child(-n+2) dd { font-family: var(--magpie-code, ui-monospace, monospace); font-size: 11px; }
button { font: inherit; border: 1px solid var(--line); border-radius: 7px; padding: 4px 10px; min-height: 28px; background: var(--accent); color: var(--accent-fg); cursor: pointer; white-space: nowrap; }
button:disabled { opacity: .5; cursor: default; }
button:hover:not(:disabled) { filter: brightness(.96); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Use Magpie's framed-editor proportions without scaling the iframe. */
dialog { padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--fg); width: min(540px, calc(100% - 32px)); max-height: calc(100% - 40px); box-shadow: 0 24px 60px #0005, 0 2px 8px #0002; }
dialog::backdrop { background: rgba(0, 0, 0, .28); backdrop-filter: blur(8px) saturate(1.1); }
dialog[open] { display: flex; flex-direction: column; }
.dialog-head { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 18px; border-bottom: 1px solid var(--line); flex: none; }
.dialog-head img { width: 20px; height: 20px; }
.icon-button { margin-left: auto; border: 0; background: transparent; color: var(--muted); padding: 2px 6px; font-size: 20px; line-height: 1; }
dialog form { padding: 0; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.dialog-body { padding: 14px 18px; overflow-y: auto; overscroll-behavior: contain; }
#dialog-description { margin: 0 0 14px; font-size: 12px; }
.fields { display: grid; gap: 14px; }
label { display: block; min-width: 0; }
label > span { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 500; }
/* Match Magpie's editor fields, including its single focus treatment. */
input:not([type=checkbox]) { appearance: none; -webkit-appearance: none; display: block; width: 100%; min-width: 0; height: 27px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--card); color: var(--fg); font: inherit; font-size: 12.5px; outline: none; box-shadow: none; }
input:not([type=checkbox]):focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); outline: none; }
small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 5px; }
/* Connection settings follow the host editor: one readable column, quiet section dividers. */
#settings { width: min(520px, calc(100% - 32px)); }
#settings .settings-head { gap: 10px; padding: 16px 20px; align-items: flex-start; }
.settings-head > img { width: 24px; height: 24px; margin-top: 2px; }
.settings-head > div { flex: 1; min-width: 0; }
#settings h2 { font-size: 14px; line-height: 20px; }
#settings #dialog-description { font-size: 12px; margin: 3px 0 0; line-height: 1.5; }
#settings .icon-button { width: 24px; height: 24px; min-height: 24px; padding: 0; border-radius: 5px; }
#settings .icon-button:hover { background: var(--bg); }
#settings .dialog-body { padding: 0 20px; }
.settings-section { margin: 0; padding: 18px 0; border: 0; min-width: 0; }
.settings-section + .settings-section { border-top: 1px solid var(--line); }
.settings-section legend { float: left; display: flex; align-items: center; gap: 7px; width: 100%; padding: 0; margin-bottom: 13px; font-size: 12px; font-weight: 600; }
.settings-section legend + * { clear: both; }
.settings-section legend svg { width: 15px; height: 15px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#settings input::placeholder { color: var(--muted); opacity: .7; }
.secret-input { position: relative; }
#settings .secret-input input { padding-right: 34px; }
.secret-toggle { position: absolute; right: 3px; top: 3px; display: grid; place-items: center; width: 26px; height: 21px; min-height: 0; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--muted); }
.secret-toggle:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); filter: none; }
.secret-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.secret-toggle .eye-hide, .secret-toggle[aria-pressed=true] .eye-show { display: none; }
.secret-toggle[aria-pressed=true] .eye-hide { display: block; }
#settings small { font-size: 11px; line-height: 1.6; }
.slide-switch { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 30px; height: 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--muted); margin: 0; cursor: pointer; }
.slide-switch::before { content: ""; position: absolute; width: 12px; height: 12px; top: 2px; left: 2px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px #0002; }
.slide-switch:checked { background: var(--accent); border-color: var(--accent); }
.slide-switch:checked::before { transform: translateX(12px); }
.slide-switch:disabled { opacity: .5; cursor: default; }
#settings footer { padding: 12px 20px; }
#settings footer .secondary { background: var(--accent-soft); }
#settings #result { border: 1px solid var(--line); border-radius: 6px; margin: 0 0 16px; padding: 9px 10px; line-height: 1.5; }
#settings #result[hidden] { display: none; }
@media(prefers-reduced-motion: no-preference) { .slide-switch, .slide-switch::before { transition: background .15s, transform .15s; } }
@media(prefers-reduced-motion: no-preference) { input:not([type=checkbox]) { transition: border-color .12s, box-shadow .12s; } }
dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: none; padding: 8px 18px; border-top: 1px solid var(--line); min-height: 48px; }
footer > span { font-size: 11.5px; color: var(--muted); }
.actions { display: flex; gap: 8px; }
.secondary { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 24%, var(--line)); }
.secondary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 16%, var(--card)); filter: none; }
#result { margin: 0; border-top: 1px solid var(--line); padding: 10px 18px; font-size: 12px; color: var(--muted); }
#result[data-error=true] { color: var(--red); }
@media(max-width: 560px) {
.connection-summary { align-items: flex-start; flex-direction: column; gap: 12px; }
dl { width: 100%; }
dl > div { grid-template-columns: 1fr; gap: 3px; }
.fields { grid-template-columns: 1fr; }
dialog footer > span { max-width: 100px; }
}
@media(prefers-reduced-motion: no-preference) {
dialog[open] { animation: dialog-in .16s ease-out; }
@keyframes dialog-in { from { opacity: .5; transform: translateY(3px); } }
}
.data-notice { padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 9px; }
.data-notice p { margin: 8px 0 0; font-size: 12px; line-height: 1.6; }
@media(max-width: 560px) { body { padding: 12px; } dl { grid-template-columns: 1fr; gap: 10px; } }
.page-head > .header-actions { flex: none; display: flex; align-items: center; gap: 8px; }
.capture-status { display: flex; align-items: center; gap: 7px; min-height: 18px; }
#capture-state { font-size: 11px; color: var(--muted); }
#capture-feedback { margin: 9px 0 0; padding-top: 9px; border-top: 1px solid var(--line); font-size: 11px; }
#capture-feedback[data-error=true] { color: var(--red); }
#deployment-dialog { width: min(580px, calc(100% - 32px)); }
.deployment-body { min-height: 0; }
.deploy-intro { margin: 0 0 18px; font-size: 12px; }
.deploy-steps { list-style: none; margin: 0; padding: 0; }
.deploy-steps li { display: flex; gap: 12px; padding: 0 0 18px; }
.step-number { flex: none; display: grid; place-items: center; width: 23px; height: 23px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.deploy-steps h3 { margin: 2px 0 5px; font-size: 12px; font-weight: 600; }
.deploy-steps p { margin: 0; font-size: 12px; line-height: 1.6; }
.docs-card { padding: 12px; border: 1px solid var(--line); border-radius: 9px; }
.docs-heading { display: flex; align-items: center; gap: 9px; }
.docs-heading > svg { flex: none; width: 20px; height: 20px; color: var(--muted); }
.docs-heading svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.docs-heading > div { flex: 1; min-width: 0; }
.docs-heading h3 { margin: 0; font-size: 12px; font-weight: 600; }
.docs-heading p { margin: 3px 0 0; font-size: 11px; }
#copy-docs { display: flex; align-items: center; gap: 5px; font-size: 11px; }
#copy-docs svg { width: 13px; height: 13px; }
.docs-address { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font: 10.5px/1.6 var(--magpie-code, ui-monospace, monospace); overflow-wrap: anywhere; user-select: text; }
#docs-feedback { margin: 8px 0 0; font-size: 11px; line-height: 1.5; }
.deployment-boundary { font-size: 11px; line-height: 1.6; }
.deployment-boundary { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
#deployment-dialog footer { justify-content: flex-end; }
@media(max-width: 560px) { .page-head { flex-wrap: wrap; } .header-actions { margin-left: 28px; } }