diff --git a/extension/src/popup/components/fields.ts b/extension/src/popup/components/fields.ts index f89c325..e269f6b 100644 --- a/extension/src/popup/components/fields.ts +++ b/extension/src/popup/components/fields.ts @@ -6,6 +6,7 @@ /// copy click handlers on any rendered rows. import { escapeHtml } from '../../shared/state'; +import { colorizePassword } from '../../shared/password-coloring'; import type { Item, Section, Field, FieldValue } from '../../shared/types'; export interface RowOpts { @@ -46,6 +47,7 @@ export interface ConcealedRowOpts { id: string; label: string; value: string; + kind?: 'password' | 'concealed'; monospace?: boolean; multiline?: boolean; } @@ -53,12 +55,15 @@ export interface ConcealedRowOpts { /// Concealed row — value rendered hidden until the user clicks "show". /// Plaintext is stored in `data-field-value` on the row element and copied /// to the visible value span on reveal. Copy button always copies plaintext. +/// When `kind` is "password", wireFieldHandlers applies colorizePassword on +/// reveal so digits/symbols/letters are rendered in distinct colours. export function renderConcealedRow(opts: ConcealedRowOpts): string { - const { id, label, value, monospace, multiline } = opts; + const { id, label, value, kind, monospace, multiline } = opts; const placeholder = multiline ? `•••• (${value.length} chars)` : '••••'; const valueClass = `field-row__value${monospace ? ' monospace' : ''}`; + const kindAttr = kind ? ` data-field-kind="${escapeHtml(kind)}"` : ''; return ` -