feat(ext): shared state host — decouple components from popup.ts
Introduce shared/state.ts as a service-locator so popup components (item-detail, item-form, trash, devices, settings, etc.) work in both the popup and vault tab bundles. Both entry points register themselves as the host; components import from shared/state instead of popup.ts. Vault.ts now delegates to the real popup components, removing ~300 lines of placeholder renderers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,14 +12,17 @@ globalThis.chrome = {
|
||||
};
|
||||
|
||||
// Mock popup module
|
||||
vi.mock('../../popup', () => ({
|
||||
vi.mock('../../../shared/state', () => ({
|
||||
setState: vi.fn(),
|
||||
sendMessage: vi.fn(),
|
||||
navigate: vi.fn(),
|
||||
escapeHtml: (s: string) => s,
|
||||
popOutToTab: vi.fn(),
|
||||
isInTab: vi.fn(() => false),
|
||||
openVaultTab: vi.fn(),
|
||||
}));
|
||||
|
||||
import { sendMessage, navigate } from '../../popup';
|
||||
import { sendMessage, navigate } from '../../../shared/state';
|
||||
|
||||
describe('devices view', () => {
|
||||
let app: HTMLElement;
|
||||
|
||||
Reference in New Issue
Block a user