Skip to content

Commit 4de321e

Browse files
committed
feat(theme): drive the last-resort error bar through skin tokens
The host-anchor fallback diagnostic strip inlined hardcoded colors (#f2a1a1 on #1b1b22). Route them through var() chains like the existing SideChatView.module.css fallback pattern: text/border read --dsw-alias-state-error-primary (the codebase's canonical error color, 23 existing usages) and the background reads --dsw-alias-bg-layer-3,var(--dsw-alias-bg-base,...) (elevated surface, then page base). The old hexes ride as the chain tails, so with no skin tokens on the page the bar renders byte-identical to before, while any --dsw-alias-* skin re-themes it (guide §12: no hardcoded colors). The guide does not cover this strip and tests/theme.spec.ts asserts effectiveTokenValue semantics only, so neither needs a follow-up.
1 parent e970ae8 commit 4de321e

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/client/index.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,21 @@ export function apply(ctx: Context): void {
166166
)
167167
// A failure anywhere in the client lifecycle must never take the app down
168168
// silently: log with the plugin prefix and pin a visible diagnostic strip
169-
// to the page so a blank panel is never the only symptom.
169+
// to the page so a blank panel is never the only symptom. This strip is
170+
// the last-resort reporter (no CSS module is reachable from here), so its
171+
// colors go through skin token chains with the previous hexes as the
172+
// chain tails — worst case (no skin tokens on the page) it renders
173+
// byte-identical to the old hardcoded bar, and any `--dsw-alias-*` skin
174+
// re-themes it (guide §12: no hardcoded colors).
170175
const fail = (phase: string, error: unknown): void => {
171176
console.error(`[dsh-better-sidebar] ${phase} error:`, error)
172177
try {
173178
const bar = document.createElement('div')
174179
bar.style.cssText = 'position:fixed;left:8px;bottom:8px;z-index:2147483000;max-width:70vw;padding:8px 12px;'
175-
+ 'font:12px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;color:#f2a1a1;background:#1b1b22;'
176-
+ 'border:1px solid #f2a1a1;border-radius:8px;white-space:pre-wrap'
180+
+ 'font:12px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;'
181+
+ 'color:var(--dsw-alias-state-error-primary,#f2a1a1);'
182+
+ 'background:var(--dsw-alias-bg-layer-3,var(--dsw-alias-bg-base,#1b1b22));'
183+
+ 'border:1px solid var(--dsw-alias-state-error-primary,#f2a1a1);border-radius:8px;white-space:pre-wrap'
177184
bar.textContent = `[dsh-better-sidebar] ${phase} error: ${error instanceof Error ? error.message : String(error)}`
178185
document.body.appendChild(bar)
179186
} catch {

0 commit comments

Comments
 (0)