1import { createEffect, createMemo, createSignal, lazy, onCleanup, onMount, Show, Suspense } from "solid-js";2import { ACCENT_COLORS } from "../shared/types";3import type { AccentColorName, PasskeyEntry, PendingPasskeyRequest, VaultEntry } from "../shared/types";4import { LockView } from "./views/Lock";5import { VaultView, type SortOrder } from "./views/Vault";6import { EntryView } from "./views/Entry";7import { AddView } from "./views/Add";8import { PeachWordmark } from "./components/PeachMark";9import { PasskeyApprovalView } from "./views/PasskeyApproval";10import { PasskeyEntryView } from "./views/PasskeyEntry";11import { extractDomain } from "../shared/domain";12import { popupCopy } from "./copy";13import {14 DEFAULT_BINDINGS,15 getActiveBindings,16 matchKeybinding,17 type Keybinding,18 type ShortcutAction,19} from "../shared/shortcuts";20import { generateTOTP } from "../crypto/totp";2122const ImportView = lazy(() => import("./views/Import").then(m => ({ default: m.ImportView })));23const ExportView = lazy(() => import("./views/Export").then(m => ({ default: m.ExportView })));24const CJKExport = lazy(() => import("./views/CJKExport").then(m => ({ default: m.CJKExportView })));25const CJKImport = lazy(() => import("./views/CJKImport").then(m => ({ default: m.CJKImportView })));26const SettingsView = lazy(() => import("./views/Settings").then(m => ({ default: m.SettingsView })));27const HealthView = lazy(() => import("./views/Health").then(m => ({ default: m.HealthView })));28const TrashView = lazy(() => import("./views/TrashView").then(m => ({ default: m.TrashView })));2930type View =31 | "lock"32 | "entry"33 | "list"34 | "add"35 | "settings"36 | "import"37 | "export"38 | "health"39 | "trash";40type BootState = "loading" | "ready";4142const canarySuppressMap = new Map<string, boolean>();43let shellRingAnimation: Animation | null = null;4445export function isCanarySuppressed(entryId: string): boolean {46 return canarySuppressMap.get(entryId) ?? false;47}4849export function setCanarySuppressed(entryId: string, suppressed: boolean): void {50 canarySuppressMap.set(entryId, suppressed);51}5253export function clearCanarySuppressions(): void {54 canarySuppressMap.clear();55}5657export function triggerRing() {58 const shell = document.getElementById("hd-shell");59 if (!shell) return;6061 shellRingAnimation?.cancel();62 shell.dataset.glowing = "true";63 const animation = shell.animate(64 [65 { offset: 0, boxShadow: "var(--copy-shadow)" },66 {67 offset: 0.3,68 boxShadow:69 "0 2px 8px rgba(0,0,0,0.5), 0 14px 48px rgba(0,0,0,0.6), 0 0 0 1.5px color-mix(in srgb, var(--peach-accent) 58%, transparent), 0 0 22px color-mix(in srgb, var(--peach-accent) 18%, transparent)",70 },71 { offset: 1, boxShadow: "var(--copy-shadow)" },72 ],73 {74 duration: 720,75 easing: "cubic-bezier(0.4, 0, 0.2, 1)",76 fill: "none",77 }78 );79 shellRingAnimation = animation;80 const clearGlow = () => {81 if (shellRingAnimation !== animation) return;82 shellRingAnimation = null;83 delete shell.dataset.glowing;84 };85 animation.onfinish = clearGlow;86 animation.oncancel = clearGlow;87}888990export function triggerPipPulse() {91 const pip = document.querySelector(".peach-status-pip, .pip");92 if (pip) {93 pip.classList.remove("pulse");94 void (pip as HTMLElement).offsetWidth;95 pip.classList.add("pulse");96 }97}9899function humanizeError(error: string | undefined): string | undefined {100 if (!error) return error;101 if (error === "STORAGE_QUOTA_EXCEEDED") {102 return "Peach has run out of browser storage. Delete some entries or clear browser storage to continue.";103 }104 return error;105}106107async function sendMessage(msg: any): Promise<any> {108 const MESSAGE_TIMEOUT_MS = 5000;109110 return new Promise((resolve) => {111 let settled = false;112 const timeoutId = window.setTimeout(() => {113 if (settled) return;114 settled = true;115 resolve({ ok: false, error: "SERVICE_WORKER_UNAVAILABLE" });116 }, MESSAGE_TIMEOUT_MS);117118 try {119 chrome.runtime.sendMessage(msg, (response) => {120 if (settled) return;121 settled = true;122 window.clearTimeout(timeoutId);123124 if (chrome.runtime.lastError) {125 resolve({126 ok: false,127 error:128 chrome.runtime.lastError.message ?? "SERVICE_WORKER_UNAVAILABLE",129 });130 return;131 }132133 if (response === undefined) {134 resolve({ ok: false, error: "SERVICE_WORKER_UNAVAILABLE" });135 return;136 }137138 if (response && response.ok === false) {139 response.error = humanizeError(response.error);140 }141 resolve(response);142 });143 } catch (error) {144 if (settled) return;145 settled = true;146 window.clearTimeout(timeoutId);147 resolve({148 ok: false,149 error:150 error instanceof Error ? error.message : "SERVICE_WORKER_UNAVAILABLE",151 });152 }153 });154}155156export { sendMessage };157158const ENTRY_TRANSITION_EXIT_MS = 95;159const ENTRY_TRANSITION_SETTLE_MS = 135;160161export default function App() {162 const [bootState, setBootState] = createSignal<BootState>("loading");163 const [view, setView] = createSignal<View>("lock");164 const [contentPhase, setContentPhase] = createSignal<"enter" | "exit" | "idle">(165 "enter"166 );167 const [contentTransitioning, setContentTransitioning] = createSignal(false);168 const [hasVault, setHasVault] = createSignal(false);169 const [entries, setEntries] = createSignal<VaultEntry[]>([]);170 const [selectedEntry, setSelectedEntry] = createSignal<VaultEntry | null>(null);171 const [editEntry, setEditEntry] = createSignal<VaultEntry | undefined>(undefined);172 const [accentColor, setAccentColor] = createSignal<AccentColorName>("peach");173 const [theme, setTheme] = createSignal<"dark" | "light">("dark");174 const [lockOnClose, setLockOnClose] = createSignal(true);175 const [autoLockMinutes, setAutoLockMinutes] = createSignal(5);176 const [breachMonitoring, setBreachMonitoring] = createSignal(true);177 const [shortcutBindings, setShortcutBindings] = createSignal<Record<ShortcutAction, Keybinding>>(DEFAULT_BINDINGS);178 const [showShortcutsHelp, setShowShortcutsHelp] = createSignal(false);179 const [trashRetentionDays, setTrashRetentionDays] = createSignal(30);180 const [restoreView, setRestoreView] = createSignal<"cjk" | "file" | null>(null);181 const [pendingPasskey, setPendingPasskey] = createSignal<PendingPasskeyRequest | null>(null);182 const [currentTabDomain, setCurrentTabDomain] = createSignal<string>("");183 const [sortOrder, setSortOrder] = createSignal<SortOrder>("url-first");184 const [listSearchSeed, setListSearchSeed] = createSignal("");185 const [listSearchSeedNonce, setListSearchSeedNonce] = createSignal(0);186187 let contentPhaseTimer: number | undefined;188189 function applyAccent(name: AccentColorName) {190 const color = ACCENT_COLORS.find(c => c.name === name) ?? ACCENT_COLORS[0]!;191 const hex = color.hex;192 document.documentElement.style.setProperty("--peach-accent", hex);193 194 195 document.documentElement.style.setProperty("--peach-glow", hex + "2A");196 document.documentElement.style.setProperty("--peach-surface-tint", hex + "09");197 document.documentElement.style.setProperty("--peach-border-accent", hex + "24");198 }199200 createEffect(() => {201 applyAccent(accentColor());202 });203204 createEffect(() => {205 document.documentElement.classList.toggle("light", theme() === "light");206 document.body.classList.toggle("light", theme() === "light");207 });208209 const selectedIndex = createMemo(() => {210 const currentId = selectedEntry()?.id;211 if (!currentId) return entries().length > 0 ? 0 : -1;212 return entries().findIndex((entry) => entry.id === currentId);213 });214215 async function applyAccentColor(name: AccentColorName) {216 applyAccent(name);217 setAccentColor(name);218 await sendMessage({ type: "UPDATE_SETTINGS", payload: { accentColor: name } });219 }220221 async function applyTheme(t: "dark" | "light") {222 setTheme(t);223 await sendMessage({ type: "UPDATE_SETTINGS", payload: { theme: t } });224 }225226 async function applyLockOnClose(enabled: boolean) {227 setLockOnClose(enabled);228 await sendMessage({229 type: "UPDATE_SETTINGS",230 payload: { lockOnClose: enabled },231 });232 }233234 async function applyAutoLockMinutes(minutes: number) {235 setAutoLockMinutes(minutes);236 await sendMessage({237 type: "UPDATE_SETTINGS",238 payload: { autoLockMinutes: minutes },239 });240 }241242 async function applyBreachMonitoring(enabled: boolean) {243 setBreachMonitoring(enabled);244 await sendMessage({245 type: "UPDATE_SETTINGS",246 payload: { breachMonitoring: enabled },247 });248 }249250 onMount(async () => {251 252 253 254 255 256 const [unlockResponse, vaultResponse] = await Promise.all([257 sendMessage({ type: "IS_UNLOCKED" }),258 sendMessage({ type: "HAS_VAULT" }),259 refreshCurrentTab(),260 ]);261 const unlocked = Boolean(262 (unlockResponse as { ok: boolean; data?: boolean }).data263 );264 const vaultExists = Boolean(265 (vaultResponse as { ok: boolean; data?: boolean }).data266 );267 setHasVault(vaultExists);268 await restoreSettings();269270 if (unlocked && vaultExists) {271 await openVault();272 }273274 await refreshPendingPasskey();275276 277 const handleTabActivated = () => { void refreshCurrentTab(); };278 const handleTabUpdated = (_tabId: number, changeInfo: { url?: string; status?: string }) => {279 if (changeInfo.url || changeInfo.status === "complete") void refreshCurrentTab();280 };281 try {282 chrome.tabs.onActivated.addListener(handleTabActivated);283 chrome.tabs.onUpdated.addListener(handleTabUpdated);284 onCleanup(() => {285 chrome.tabs.onActivated.removeListener(handleTabActivated);286 chrome.tabs.onUpdated.removeListener(handleTabUpdated);287 });288 } catch {289 290 }291292 setBootState("ready");293 document.getElementById("pre-lock")?.setAttribute("hidden", "true");294295 296 297 298 299 void Promise.all([300 import("./views/Settings").catch(() => {}),301 import("./views/Import").catch(() => {}),302 import("./views/Export").catch(() => {}),303 import("./views/Health").catch(() => {}),304 import("./views/TrashView").catch(() => {}),305 import("./views/CJKExport").catch(() => {}),306 import("./views/CJKImport").catch(() => {}),307 ]);308309 310 311 312 let popupPort: chrome.runtime.Port | null = null;313 try {314 popupPort = chrome.runtime.connect({ name: "popup" });315 } catch { }316 onCleanup(() => { try { popupPort?.disconnect(); } catch {} });317318 319 320 const handleRuntimeMessage = (msg: { type?: string }) => {321 if (msg?.type === "VAULT_LOCKED" && view() !== "lock") handleLock();322 };323 chrome.runtime.onMessage.addListener(handleRuntimeMessage);324 onCleanup(() => chrome.runtime.onMessage.removeListener(handleRuntimeMessage));325326 327 328 329 const SHORTCUT_HANDLERS: Partial<Record<ShortcutAction, () => void>> = {330 copy_password: () => {331 const entry = selectedEntry();332 if (entry?.password) void popupCopy(entry.password, "Password").then((ok) => { if (ok) triggerRing(); });333 },334 copy_username: () => {335 const entry = selectedEntry();336 if (entry?.username) void popupCopy(entry.username, "Username").then((ok) => { if (ok) triggerRing(); });337 },338 copy_totp: () => {339 const entry = selectedEntry();340 if (!entry?.totp) return;341 try {342 const { code } = generateTOTP(entry.totp);343 void popupCopy(code, "2FA").then((ok) => { if (ok) triggerRing(); });344 } catch { }345 },346 new_entry: () => handleAdd(),347 edit_entry: () => {348 const entry = selectedEntry();349 if (!entry || entry.type === "passkey") return;350 setEditEntry(entry);351 setView("add");352 },353 delete_entry: () => {354 if (selectedEntry()) void handleDelete();355 },356 lock_vault: () => { void handleHeaderLock(); },357 search: () => openList(),358 nav_prev: () => navigate(-1),359 nav_next: () => navigate(1),360 jump_vault: () => setView("entry"),361 jump_settings: () => setView("settings"),362 show_help: () => setShowShortcutsHelp(true),363 };364365 366 367 368 const ENTRY_SCOPED: ReadonlySet<ShortcutAction> = new Set([369 "copy_password", "copy_username", "copy_totp",370 "edit_entry", "delete_entry", "nav_prev", "nav_next",371 ]);372373 const handleGlobalKeydown = (e: KeyboardEvent) => {374 const v = view();375 const inInput = (e.target as HTMLElement)?.tagName === "INPUT"376 || (e.target as HTMLElement)?.tagName === "TEXTAREA"377 || (e.target as HTMLElement)?.isContentEditable;378 const isPrintableSearchKey =379 e.key.length === 1 &&380 !e.ctrlKey &&381 !e.metaKey &&382 !e.altKey;383384 385 386 if (showShortcutsHelp()) {387 if (e.key === "Escape") { e.preventDefault(); setShowShortcutsHelp(false); }388 return;389 }390391 392 if (e.key === "Escape") {393 if (v === "list") { setView("entry"); return; }394 if (v === "settings" || v === "import" || v === "export" || v === "add" || v === "health") { handleBack(); return; }395 }396397 398 399 400 const bindings = shortcutBindings();401 for (const action of Object.keys(bindings) as ShortcutAction[]) {402 const binding = bindings[action];403 if (!matchKeybinding(e, binding)) continue;404 405 406 const hasMod = binding.ctrl || binding.meta || binding.alt || binding.shift;407 if (!hasMod && binding.key.length === 1 && inInput) return;408 if (ENTRY_SCOPED.has(action) && v !== "entry") return;409 e.preventDefault();410 SHORTCUT_HANDLERS[action]?.();411 return;412 }413414 415 416 417 418 if (v === "entry" && !inInput && isPrintableSearchKey) {419 e.preventDefault();420 primeListSearch(e.key);421 return;422 }423 };424 window.addEventListener("keydown", handleGlobalKeydown);425 onCleanup(() => window.removeEventListener("keydown", handleGlobalKeydown));426427 const handleStorageChanged = (428 changes: Record<string, chrome.storage.StorageChange>,429 areaName: string430 ) => {431 if (areaName !== "session") return;432 if (!Object.keys(changes).some((key) => key.startsWith("passkey_pending_"))) {433 return;434 }435 void refreshPendingPasskey();436 };437438 chrome.storage.onChanged.addListener(handleStorageChanged);439 onCleanup(() => chrome.storage.onChanged.removeListener(handleStorageChanged));440 });441442 async function refreshCurrentTab() {443 try {444 const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });445 const url = tab?.url ?? tab?.pendingUrl ?? "";446 setCurrentTabDomain(url ? (extractDomain(url) ?? "") : "");447 } catch {448 setCurrentTabDomain("");449 }450 }451452 async function refreshPendingPasskey() {453 const res = await sendMessage({ type: "GET_PENDING_PASSKEY" });454 setPendingPasskey((res as { ok: boolean; data?: PendingPasskeyRequest | null }).data ?? null);455 }456457 async function restoreSettings() {458 const res = await sendMessage({ type: "GET_SETTINGS" });459 const s = (res as { ok: boolean; data?: any }).data ?? {};460 if (s.accentColor && ACCENT_COLORS.some(c => c.name === s.accentColor)) {461 setAccentColor(s.accentColor as AccentColorName);462 }463 setTheme(s.theme === "light" ? "light" : "dark");464 setLockOnClose(s.lockOnClose !== false);465 setAutoLockMinutes(typeof s.autoLockMinutes === "number" ? s.autoLockMinutes : 5);466 setBreachMonitoring(s.breachMonitoring !== false);467 setTrashRetentionDays(typeof s.trashRetentionDays === "number" ? s.trashRetentionDays : 30);468 setShortcutBindings(getActiveBindings(s.shortcuts));469 }470471 async function applyTrashRetention(days: number) {472 setTrashRetentionDays(days);473 await sendMessage({ type: "UPDATE_SETTINGS", payload: { trashRetentionDays: days } });474 }475476 function primeListSearch(seed: string) {477 setListSearchSeed(seed);478 setListSearchSeedNonce((value) => value + 1);479 openList();480 }481482 483 484 485 async function loadEntries(): Promise<VaultEntry[] | null> {486 const response = await sendMessage({ type: "GET_ENTRIES" });487 const res = response as { ok: boolean; data?: VaultEntry[]; error?: string };488489 490 491 492 493 if (!res.ok) {494 if (495 res.error === "vault locked" ||496 res.error === "SERVICE_WORKER_UNAVAILABLE" ||497 (typeof res.error === "string" && res.error.includes("locked"))498 ) {499 handleLock();500 return null; 501 }502 return [];503 }504505 const loadedEntries = res.data ?? [];506 setEntries(loadedEntries);507508 const currentId = selectedEntry()?.id;509 if (currentId) {510 setSelectedEntry(511 loadedEntries.find((entry) => entry.id === currentId) ?? loadedEntries[0] ?? null512 );513 }514515 return loadedEntries;516 }517518 async function openVault(preferredEntryId?: string) {519 520 const retDays = trashRetentionDays();521 if (retDays > 0) {522 void sendMessage({523 type: "PURGE_EXPIRED_TRASH",524 payload: { retentionMs: retDays * 86_400_000 },525 });526 }527528 const loadedEntries = await loadEntries();529530 531 532 if (loadedEntries === null) return;533534 535 let nextSelectedEntry: VaultEntry | null = null;536 if (preferredEntryId) {537 nextSelectedEntry = loadedEntries.find((e) => e.id === preferredEntryId) ?? null;538 }539 if (!nextSelectedEntry) {540 const tabDomain = currentTabDomain();541 if (tabDomain) {542 nextSelectedEntry = loadedEntries.find((e) => {543 if (e.type === "login") {544 if (e.url && (extractDomain(e.url) ?? "") === tabDomain) return true;545 for (const extra of e.additionalUrls ?? []) {546 if ((extractDomain(extra) ?? "") === tabDomain) return true;547 }548 return false;549 }550 if (e.type === "passkey" && e.rpId) return e.rpId === tabDomain;551 return false;552 }) ?? null;553 }554 }555 nextSelectedEntry ??= loadedEntries[0] ?? null;556557 setSelectedEntry(nextSelectedEntry);558 setEditEntry(undefined);559 setContentTransitioning(false);560 setContentPhase("enter");561 queueContentIdle();562 setView("entry");563 }564565 async function handleUnlock() {566 setHasVault(true);567 triggerPipPulse();568 await restoreSettings();569 await openVault();570 }571572 function handleSelectEntry(entry: VaultEntry) {573 setSelectedEntry(entry);574 setContentTransitioning(false);575 setContentPhase("enter");576 queueContentIdle();577 setView("entry");578 }579580 function handleAdd() {581 setEditEntry(undefined);582 setView("add");583 }584585 async function handleDelete() {586 const entry = selectedEntry();587 if (!entry) return;588 await sendMessage({ type: "DELETE_ENTRY", payload: { id: entry.id } });589 const loadedEntries = await loadEntries() ?? [];590 setSelectedEntry(loadedEntries[0] ?? null);591 setView("entry");592 }593594 async function handleDeleteMany(ids: string[]) {595 for (const id of ids) {596 await sendMessage({ type: "DELETE_ENTRY", payload: { id } });597 }598 const loadedEntries = await loadEntries() ?? [];599 600 const stillExists = loadedEntries.find(e => e.id === selectedEntry()?.id);601 if (!stillExists) setSelectedEntry(loadedEntries[0] ?? null);602 }603604 async function handleSave(savedEntry?: VaultEntry) {605 await openVault(savedEntry?.id);606 }607608 function handleBack() {609 setEditEntry(undefined);610 setView("entry");611 }612613 function handleLock() {614 clearCanarySuppressions();615 setEntries([]);616 setSelectedEntry(null);617 setEditEntry(undefined);618 setContentPhase("idle");619 setView("lock");620 }621622 function handleHeaderLock() {623 624 625 626 handleLock();627 void sendMessage({ type: "LOCK" });628 }629630 function navigate(dir: number) {631 const allEntries = entries();632 if (allEntries.length === 0) return;633 const currentIndex = selectedIndex();634 const baseIndex = currentIndex >= 0 ? currentIndex : 0;635 const nextIndex = (baseIndex + dir + allEntries.length) % allEntries.length;636 setSelectedEntry(allEntries[nextIndex]);637 setContentPhase("enter");638 queueContentIdle();639 }640641 function openList() {642 setView("list");643 }644645 function openHealth() {646 setEditEntry(undefined);647 setView("health");648 }649650 function handleOpenCJKImport() {651 setRestoreView("cjk");652 }653654 function handleOpenFileImport() {655 setRestoreView("file");656 }657658 const isShellOverlayOpen = () => view() !== "entry" || restoreView() !== null;659660 function handleFixEntry(entry: VaultEntry) {661 if (entry.type === "passkey") {662 setSelectedEntry(entry);663 setView("entry");664 return;665 }666 setEditEntry(entry);667 setView("add");668 }669670 const isLockedView = () => view() === "lock";671 const selectedPasskeyEntry = createMemo(() =>672 selectedEntry()?.type === "passkey" ? (selectedEntry() as PasskeyEntry) : null673 );674675 async function handleApprovePendingPasskey() {676 const pending = pendingPasskey();677 if (!pending) return;678 await sendMessage({ type: "APPROVE_PASSKEY", payload: { requestId: pending.requestId } });679 setPendingPasskey(null);680 }681682 async function handleDenyPendingPasskey() {683 const pending = pendingPasskey();684 if (!pending) return;685 await sendMessage({ type: "DENY_PASSKEY", payload: { requestId: pending.requestId } });686 setPendingPasskey(null);687 }688689 function queueContentIdle(after?: () => void) {690 if (contentPhaseTimer) window.clearTimeout(contentPhaseTimer);691 contentPhaseTimer = window.setTimeout(() => {692 setContentPhase("idle");693 after?.();694 }, ENTRY_TRANSITION_SETTLE_MS);695 }696697 return (698 <div class="popup-root peach-theme">699 <Show when={bootState() === "ready"}>700 <Show701 when={!pendingPasskey()}702 fallback={703 <PasskeyApprovalView704 type={pendingPasskey()!.type}705 rpName={pendingPasskey()!.rpName}706 rpId={pendingPasskey()!.rpId}707 userName={pendingPasskey()!.userName}708 userDisplayName={pendingPasskey()!.userDisplayName}709 onApprove={handleApprovePendingPasskey}710 onDeny={handleDenyPendingPasskey}711 />712 }713 >714 <Show715 when={!isLockedView()}716 fallback={717 <LockView718 hasVault={hasVault()}719 ready={bootState() === "ready"}720 onUnlock={handleUnlock}721 />722 }723 >724 <section725 id="hd-shell"726 class="peach-shell peach-theme"727 data-surface="extension"728 >729 <header class="peach-chrome" classList={{ "is-hidden-for-overlay": isShellOverlayOpen() }}>730 <PeachWordmark unlocked />731 <div class="peach-chrome-actions">732 <button733 class="peach-btn peach-btn--ghost peach-btn--sm peach-icon-btn"734 onClick={() => setView("settings")}735 aria-label="Settings"736 >737 <svg width="14" height="14" viewBox="0 0 14 14" fill="none">738 <path739 d="M5.91 1.11C6.38-.02 7.62-.02 8.09 1.11L8.31 1.64C8.48 2.05 8.91 2.27 9.34 2.17L9.9 2.04C11.1 1.76 11.98 2.64 11.7 3.84L11.57 4.4C11.47 4.83 11.69 5.26 12.1 5.43L12.63 5.65C13.76 6.12 13.76 7.36 12.63 7.83L12.1 8.05C11.69 8.22 11.47 8.65 11.57 9.08L11.7 9.64C11.98 10.84 11.1 11.72 9.9 11.44L9.34 11.31C8.91 11.21 8.48 11.43 8.31 11.84L8.09 12.37C7.62 13.5 6.38 13.5 5.91 12.37L5.69 11.84C5.52 11.43 5.09 11.21 4.66 11.31L4.1 11.44C2.9 11.72 2.02 10.84 2.3 9.64L2.43 9.08C2.53 8.65 2.31 8.22 1.9 8.05L1.37 7.83C.24 7.36.24 6.12 1.37 5.65L1.9 5.43C2.31 5.26 2.53 4.83 2.43 4.4L2.3 3.84C2.02 2.64 2.9 1.76 4.1 2.04L4.66 2.17C5.09 2.27 5.52 2.05 5.69 1.64L5.91 1.11Z"740 stroke="currentColor"741 stroke-width="0.9"742 />743 <circle cx="7" cy="7" r="2.1" stroke="currentColor" stroke-width="0.9" />744 </svg>745 </button>746 <button747 class="peach-btn peach-btn--ghost peach-btn--sm peach-icon-btn"748 onClick={handleAdd}749 aria-label="New entry"750 >751 <svg width="11" height="11" viewBox="0 0 11 11" fill="none" stroke="currentColor" stroke-width="1.1" stroke-linecap="round">752 <path d="M5.5 1v9M1 5.5h9" />753 </svg>754 </button>755 <button756 class="peach-btn peach-btn--ghost peach-btn--sm peach-icon-btn peach-lock-btn"757 onClick={() => void handleHeaderLock()}758 aria-label="Lock vault"759 >760 <svg class="peach-lock-icon" width="14" height="16" viewBox="0 0 14 16" fill="none">761 <path762 d="M3.75 6V4.75C3.75 2.96 5.21 1.5 7 1.5C8.79 1.5 10.25 2.96 10.25 4.75V6"763 stroke="currentColor"764 stroke-width="1"765 stroke-linecap="round"766 />767 <rect x="1.5" y="6" width="11" height="8.5" rx="2.2" stroke="currentColor" stroke-width="1" />768 <circle cx="7" cy="10.25" r="1" fill="currentColor" />769 </svg>770 </button>771 </div>772 </header>773774 <div class="peach-shell-body">775 <div class="peach-shell-veil"></div>776 <div class="peach-content-frame" data-content-phase={contentPhase()} classList={{ navigating: contentTransitioning() }}>777 <Show778 when={selectedPasskeyEntry()}779 fallback={780 <EntryView781 entry={selectedEntry()}782 onDelete={handleDelete}783 onFieldSaved={() => void loadEntries()}784 onEscape={() => { setView("list"); }}785 />786 }787 >788 <PasskeyEntryView entry={selectedPasskeyEntry()} onDelete={handleDelete} />789 </Show>790 </div>791792 <section class="peach-search-wrap" classList={{ "is-hidden-for-overlay": isShellOverlayOpen() }}>793 <div class="peach-search-bar">794 <span class="peach-search-icon">795 <svg width="13" height="13" viewBox="0 0 13 13" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round">796 <circle cx="5.5" cy="5.5" r="3.75" />797 <path d="M8.75 8.75L11.5 11.5" />798 </svg>799 </span>800 <input801 class="peach-search-input"802 placeholder="search vault..."803 autocomplete="off"804 aria-label="Search vault entries"805 onClick={openList}806 onFocus={openList}807 readOnly808 />809 <div class="peach-search-meta">810 <span class="peach-search-counter">811 {entries().length > 0812 ? `${selectedIndex() + 1} / ${entries().length}`813 : "0 entries"}814 </span>815 <span class="peach-divider"></span>816 <button817 class="peach-btn peach-btn--ghost peach-btn--sm peach-icon-btn"818 onClick={() => navigate(-1)}819 aria-label="Previous entry"820 disabled={entries().length === 0}821 >822 <svg width="6" height="11" viewBox="0 0 6 11" fill="none" stroke="currentColor" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round">823 <path d="M5 1L1 5.5L5 10" />824 </svg>825 </button>826 <button827 class="peach-btn peach-btn--ghost peach-btn--sm peach-icon-btn"828 onClick={() => navigate(1)}829 aria-label="Next entry"830 disabled={entries().length === 0}831 >832 <svg width="6" height="11" viewBox="0 0 6 11" fill="none" stroke="currentColor" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round">833 <path d="M1 1L5 5.5L1 10" />834 </svg>835 </button>836 </div>837 </div>838 </section>839 </div>840841 <Show when={view() === "list"}>842 <VaultView843 entries={entries()}844 selectedEntryId={selectedEntry()?.id}845 currentTabDomain={currentTabDomain()}846 sortOrder={sortOrder()}847 searchSeed={listSearchSeed()}848 searchSeedNonce={listSearchSeedNonce()}849 onSelectEntry={handleSelectEntry}850 onSortOrderChange={setSortOrder}851 onAdd={handleAdd}852 onClose={() => setView("entry")}853 onOpenTrash={() => setView("trash")}854 onDeleteMany={handleDeleteMany}855 />856 </Show>857 <Show when={view() === "settings"}>858 <Suspense fallback={<div class="peach-loading"><PeachWordmark /></div>}>859 <SettingsView860 entriesCount={entries().length}861 breachMonitoring={breachMonitoring()}862 lockOnClose={lockOnClose()}863 autoLockMinutes={autoLockMinutes()}864 trashRetentionDays={trashRetentionDays()}865 theme={theme()}866 accentColor={accentColor()}867 onBreachMonitoringChange={applyBreachMonitoring}868 onLockOnCloseChange={applyLockOnClose}869 onAutoLockMinutesChange={applyAutoLockMinutes}870 onTrashRetentionChange={applyTrashRetention}871 onThemeChange={applyTheme}872 onAccentChange={applyAccentColor}873 onBack={handleBack}874 onImport={() => setView("import")}875 onExport={() => setView("export")}876 onBreachCheckDone={loadEntries}877 onOpenHealth={openHealth}878 onOpenCJKImport={handleOpenCJKImport}879 onOpenFileImport={handleOpenFileImport}880 />881 </Suspense>882 </Show>883 <Show when={view() === "add"}>884 <AddView885 entry={editEntry()}886 entries={entries()}887 onBack={handleBack}888 onSave={handleSave}889 />890 </Show>891 <Show when={view() === "import"}>892 <Suspense fallback={<div class="peach-loading"><PeachWordmark /></div>}>893 <ImportView onBack={handleBack} onImport={handleSave} />894 </Suspense>895 </Show>896 <Show when={view() === "export"}>897 <Suspense fallback={<div class="peach-loading"><PeachWordmark /></div>}>898 <ExportView onBack={handleBack} onRequiresUnlock={handleLock} />899 </Suspense>900 </Show>901 <Show when={view() === "health"}>902 <Suspense fallback={<div class="peach-loading"><PeachWordmark /></div>}>903 <HealthView904 entries={entries()}905 onFixEntry={handleFixEntry}906 onBack={() => setView("settings")}907 onRefresh={loadEntries}908 />909 </Suspense>910 </Show>911 <Show when={view() === "trash"}>912 <Suspense fallback={<div class="peach-loading"><PeachWordmark /></div>}>913 <TrashView914 onBack={() => setView("list")}915 onRestored={() => void loadEntries()}916 />917 </Suspense>918 </Show>919 <Show when={restoreView() === "cjk"}>920 <CJKImport921 mode="onboarding"922 onBack={() => setRestoreView(null)}923 onDone={async () => {924 setRestoreView(null);925 await handleUnlock();926 }}927 />928 </Show>929 <Show when={restoreView() === "file"}>930 <Suspense fallback={<div class="peach-loading"><PeachWordmark /></div>}>931 <ImportView932 mode="onboarding"933 replacesExistingVault={true}934 onBack={() => setRestoreView(null)}935 onImport={async () => {936 setRestoreView(null);937 await handleUnlock();938 }}939 />940 </Suspense>941 </Show>942 </section>943 </Show>944 </Show>945 </Show>946 </div>947 );948}