feat(ext/popup): wire Document type into form + detail + list dispatchers

Document is no longer 'coming soon' — the type chooser unlocks it,
form dispatcher routes to documentType.renderForm, detail dispatcher
routes to documentType.renderDetail. teardown chains include documentType.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
adlee-was-taken
2026-04-25 20:46:26 -04:00
parent 9c481422ad
commit ab36dbd31a
3 changed files with 7 additions and 3 deletions

View File

@@ -10,6 +10,7 @@ import * as identity from './types/identity';
import * as card from './types/card'; import * as card from './types/card';
import * as key from './types/key'; import * as key from './types/key';
import * as totp from './types/totp'; import * as totp from './types/totp';
import * as documentType from './types/document';
export async function renderItemDetail(app: HTMLElement): Promise<void> { export async function renderItemDetail(app: HTMLElement): Promise<void> {
// Tear down any tickers/handlers from a previous detail render before // Tear down any tickers/handlers from a previous detail render before
@@ -21,6 +22,7 @@ export async function renderItemDetail(app: HTMLElement): Promise<void> {
card.teardown(); card.teardown();
key.teardown(); key.teardown();
totp.teardown(); totp.teardown();
documentType.teardown();
const item = getState().selectedItem; const item = getState().selectedItem;
if (!item) { navigate('list'); return; } if (!item) { navigate('list'); return; }
@@ -32,7 +34,7 @@ export async function renderItemDetail(app: HTMLElement): Promise<void> {
case 'card': return card.renderDetail(app, item); case 'card': return card.renderDetail(app, item);
case 'key': return key.renderDetail(app, item); case 'key': return key.renderDetail(app, item);
case 'totp': return totp.renderDetail(app, item); case 'totp': return totp.renderDetail(app, item);
case 'document': return renderComingSoon(app, item); case 'document': return documentType.renderDetail(app, item);
} }
} }

View File

@@ -9,6 +9,7 @@ import * as identity from './types/identity';
import * as card from './types/card'; import * as card from './types/card';
import * as key from './types/key'; import * as key from './types/key';
import * as totp from './types/totp'; import * as totp from './types/totp';
import * as documentType from './types/document';
export function renderItemForm(app: HTMLElement, mode: 'add' | 'edit'): void { export function renderItemForm(app: HTMLElement, mode: 'add' | 'edit'): void {
login.teardown(); // detail-view's ticker/listener don't leak into form login.teardown(); // detail-view's ticker/listener don't leak into form
@@ -17,6 +18,7 @@ export function renderItemForm(app: HTMLElement, mode: 'add' | 'edit'): void {
card.teardown(); card.teardown();
key.teardown(); key.teardown();
totp.teardown(); totp.teardown();
documentType.teardown();
const state = getState(); const state = getState();
const existing = mode === 'edit' ? state.selectedItem : null; const existing = mode === 'edit' ? state.selectedItem : null;
const type: ItemType = existing?.type ?? state.newType ?? 'login'; const type: ItemType = existing?.type ?? state.newType ?? 'login';
@@ -28,7 +30,7 @@ export function renderItemForm(app: HTMLElement, mode: 'add' | 'edit'): void {
case 'card': return card.renderForm(app, mode, existing); case 'card': return card.renderForm(app, mode, existing);
case 'key': return key.renderForm(app, mode, existing); case 'key': return key.renderForm(app, mode, existing);
case 'totp': return totp.renderForm(app, mode, existing); case 'totp': return totp.renderForm(app, mode, existing);
case 'document': return renderComingSoon(app, type); case 'document': return documentType.renderForm(app, mode, existing);
} }
} }

View File

@@ -233,7 +233,7 @@ const NEW_TYPE_OPTIONS: Array<{ type: ItemType; icon: string; label: string; dis
{ type: 'card', icon: '💳', label: 'card' }, { type: 'card', icon: '💳', label: 'card' },
{ type: 'key', icon: '🗝', label: 'key' }, { type: 'key', icon: '🗝', label: 'key' },
{ type: 'totp', icon: '⏱', label: 'totp' }, { type: 'totp', icon: '⏱', label: 'totp' },
{ type: 'document', icon: '📄', label: 'document', disabled: true, tooltip: 'coming in γ — needs attachment upload' }, { type: 'document', icon: '📄', label: 'document' },
]; ];
function showNewTypePicker(anchor: HTMLElement): void { function showNewTypePicker(anchor: HTMLElement): void {