feat: CSS Custom Highlight API — yellow for fake, terminal for real
Two visual modes using the Highlight API (zero DOM modification): - Yellow highlight: fake/substituted values the AI received. Shows automatically in all AI responses, even without reveal mode. "The AI sees these yellow values, not your real data." - Terminal style (black bg, green text): your real data shown in reveal mode. "This is YOUR data — the AI never saw this." Uses CSS.highlights with ::highlight() pseudo-elements — no spans, no DOM changes, no copy/paste artifacts. Falls back to CSS class-based styling if Highlight API is unavailable. Highlights are debounced (500ms) to handle streaming responses without excessive reflows. https://claude.ai/code/session_01Dvgwe7XMoSxnWXkih8p1Cw
This commit is contained in:
+18
-5
@@ -13,13 +13,26 @@
|
||||
padding: 0 1px;
|
||||
}
|
||||
|
||||
/* Revealed text styling (when reveal mode shows real values in responses) */
|
||||
/* CSS Custom Highlight API styles — zero DOM changes */
|
||||
|
||||
/* Yellow highlight: fake values the AI received (non-reveal mode) */
|
||||
::highlight(ss-substituted) {
|
||||
background-color: rgba(250, 204, 21, 0.4);
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
/* Terminal style: real data shown in reveal mode (dark bg, green text) */
|
||||
::highlight(ss-revealed) {
|
||||
background-color: rgba(0, 0, 0, 0.85);
|
||||
color: #4ade80;
|
||||
}
|
||||
|
||||
/* Fallback for browsers without Highlight API */
|
||||
.ss-revealed {
|
||||
background: rgba(59, 130, 246, 0.1);
|
||||
border-bottom: 2px solid rgba(59, 130, 246, 0.6);
|
||||
border-radius: 2px;
|
||||
background: rgba(0, 0, 0, 0.85);
|
||||
color: #4ade80;
|
||||
padding: 0 2px;
|
||||
cursor: help;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
/* Floating reveal mode indicator */
|
||||
|
||||
Reference in New Issue
Block a user