1import { createEffect, createMemo, createSignal, lazy, onCleanup, onMount, Show, Suspense } from "solid-js";2import { App as CapacitorApp } from "@capacitor/app";3import { Capacitor, registerPlugin } from "@capacitor/core";4import { Keyboard } from "@capacitor/keyboard";5import { StatusBar, Style } from "@capacitor/status-bar";6import { storageGet, storageSet } from "../shared/storage";7import { sendMessage } from "../shared/bridge";8import { clearInMemoryVault, publishInMemoryVault } from "../shared/in-memory-vault";9import { ACCENT_COLORS } from "../shared/types";10import type { AccentColorName, PendingPasskeyRequest, ProFeature, VaultEntry } from "../shared/types";11import type { IncomingPairingRequest } from "../shared/sync-types";12import { isPasskeyOnly } from "../shared/types";13import { LockView } from "./views/Lock";14import { Onboarding } from "./views/Onboarding";15import { ProCelebration } from "./views/ProCelebration";16import { VaultView, type SortOrder } from "./views/Vault";17import { EntryView } from "./views/Entry";18import { AddView } from "./views/Add";19import { PeachWordmark } from "./components/PeachMark";20import { PasskeyApprovalView } from "./views/PasskeyApproval";21import { extractDomain } from "../shared/domain";22import { popupCopy } from "./copy";23import {24 DEFAULT_BINDINGS,25 formatKeybinding,26 getActiveBindings,27 matchKeybinding,28 SHORTCUT_DESCRIPTORS,29 type Keybinding,30 type ShortcutAction,31} from "../shared/shortcuts";32import { generateTOTP } from "../crypto/totp";3334export { sendMessage } from "../shared/bridge";3536const ImportView = lazy(() => import("./views/Import").then(m => ({ default: m.ImportView })));37const ExportView = lazy(() => import("./views/Export").then(m => ({ default: m.ExportView })));38const SettingsView = lazy(() => import("./views/Settings").then(m => ({ default: m.SettingsView })));39const HealthView = lazy(() => import("./views/Health").then(m => ({ default: m.HealthView })));40const TrashView = lazy(() => import("./views/TrashView").then(m => ({ default: m.TrashView })));41const PanicView = lazy(() => import("./views/Panic").then(m => ({ default: m.PanicView })));42const SyncPairingView = lazy(() => import("./views/SyncPairing").then(m => ({ default: m.SyncPairingView })));4344const Autofill = registerPlugin<{45 checkPendingSave(): Promise<{ pending: string | null }>;46 openAutofillSettings(): Promise<void>;47 isEnabledAsAutofillService(): Promise<{ enabled: boolean }>;48}>("Autofill");4950type View =51 | "lock"52 | "pro-celebration"53 | "entry"54 | "list"55 | "add"56 | "settings"57 | "sync-pairing"58 | "import"59 | "export"60 | "health"61 | "trash"62 | "panic";63type BootState = "loading" | "ready";6465const canarySuppressMap = new Map<string, boolean>();66let shellRingAnimation: Animation | null = null;6768export function isCanarySuppressed(entryId: string): boolean {69 return canarySuppressMap.get(entryId) ?? false;70}7172export function setCanarySuppressed(entryId: string, suppressed: boolean): void {73 canarySuppressMap.set(entryId, suppressed);74}7576export function clearCanarySuppressions(): void {77 canarySuppressMap.clear();78}7980export function triggerRing() {81 const shell = document.getElementById("hd-shell");82 if (!shell) return;8384 shellRingAnimation?.cancel();85 shell.dataset.glowing = "true";86 const animation = shell.animate(87 [88 { offset: 0, boxShadow: "var(--copy-shadow)" },89 {90 offset: 0.3,91 boxShadow:92 "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)",93 },94 { offset: 1, boxShadow: "var(--copy-shadow)" },95 ],96 {97 duration: 720,98 easing: "cubic-bezier(0.4, 0, 0.2, 1)",99 fill: "none",100 }101 );102 shellRingAnimation = animation;103 const clearGlow = () => {104 if (shellRingAnimation !== animation) return;105 shellRingAnimation = null;106 delete shell.dataset.glowing;107 };108 animation.onfinish = clearGlow;109 animation.oncancel = clearGlow;110}111112113export function triggerPipPulse() {114 const pip = document.querySelector(".peach-status-pip, .pip");115 if (pip) {116 pip.classList.remove("pulse");117 void (pip as HTMLElement).offsetWidth;118 pip.classList.add("pulse");119 }120}121122const ENTRY_TRANSITION_EXIT_MS = 95;123const ENTRY_TRANSITION_SETTLE_MS = 135;124125export default function App() {126 const [bootState, setBootState] = createSignal<BootState>("loading");127 const [view, setView] = createSignal<View>("lock");128 const [contentPhase, setContentPhase] = createSignal<"enter" | "exit" | "idle">(129 "enter"130 );131 const [contentTransitioning, setContentTransitioning] = createSignal(false);132 const [hasVault, setHasVault] = createSignal(false);133 const [onboarded, setOnboarded] = createSignal(true);134 const [entries, setEntries] = createSignal<VaultEntry[]>([]);135 const [selectedEntry, setSelectedEntry] = createSignal<VaultEntry | null>(null);136 const [editEntry, setEditEntry] = createSignal<VaultEntry | undefined>(undefined);137 const [accentColor, setAccentColor] = createSignal<AccentColorName>("peach");138 const [theme, setTheme] = createSignal<"dark" | "light">("dark");139 const [displayFont, setDisplayFont] = createSignal<"cormorant-italic" | "cormorant" | "inter" | "system">("cormorant-italic");140 const [textSize, setTextSize] = createSignal<"small" | "medium" | "large">("medium");141 const [reduceMotion, setReduceMotion] = createSignal<boolean>(false);142 const [lockOnClose, setLockOnClose] = createSignal(true);143 const [autoLockMinutes, setAutoLockMinutes] = createSignal(5);144 const [breachMonitoring, setBreachMonitoring] = createSignal(true);145 const [shortcutBindings, setShortcutBindings] = createSignal<Record<ShortcutAction, Keybinding>>(DEFAULT_BINDINGS);146 const [showShortcutsHelp, setShowShortcutsHelp] = createSignal(false);147 const [trashRetentionDays, setTrashRetentionDays] = createSignal(30);148 const [restoreView, setRestoreView] = createSignal<"file" | null>(null);149 const [pendingPasskey, setPendingPasskey] = createSignal<PendingPasskeyRequest | null>(null);150 const [currentTabDomain, setCurrentTabDomain] = createSignal<string>("");151 152 153 154 155 const [proStatus, setProStatus] = createSignal(false);156 const [settingsInitialSection, setSettingsInitialSection] = createSignal<string | null>(null);157 const [upgradeHighlight, setUpgradeHighlight] = createSignal<ProFeature | null>(null);158 const [sortOrder, setSortOrder] = createSignal<SortOrder>("url-first");159 const [listSearchSeed, setListSearchSeed] = createSignal("");160 const [listSearchSeedNonce, setListSearchSeedNonce] = createSignal(0);161 const [pendingCelebration, setPendingCelebration] = createSignal(false);162 const [pendingProNotice, setPendingProNotice] = createSignal<{ feature: string } | null>(null);163 const [pendingAutofillSave, setPendingAutofillSave] = createSignal<{164 domain: string;165 username: string;166 password: string;167 } | null>(null);168 const [backExitNotice, setBackExitNotice] = createSignal(false);169 const [incomingPair, setIncomingPair] = createSignal<IncomingPairingRequest | null>(null);170 const [incomingPairResponding, setIncomingPairResponding] = createSignal(false);171 const [incomingPairTick, setIncomingPairTick] = createSignal(0);172 const incomingPairSecondsLeft = () => {173 void incomingPairTick();174 const req = incomingPair();175 if (!req) return 0;176 return Math.max(0, Math.ceil((req.expiresAt - Date.now()) / 1000));177 };178 179 180 181 const [returnToPanic, setReturnToPanic] = createSignal(false);182183 let contentPhaseTimer: number | undefined;184 let lastBackExitAt = 0;185186 function applyAccent(name: AccentColorName) {187 const color = ACCENT_COLORS.find(c => c.name === name) ?? ACCENT_COLORS[0]!;188 const hex = color.hex;189 document.documentElement.style.setProperty("--peach-accent", hex);190 191 192 document.documentElement.style.setProperty("--peach-glow", hex + "2A");193 document.documentElement.style.setProperty("--peach-surface-tint", hex + "09");194 document.documentElement.style.setProperty("--peach-border-accent", hex + "24");195 }196197 createEffect(() => {198 applyAccent(accentColor());199 });200201 createEffect(() => {202 document.documentElement.classList.toggle("light", theme() === "light");203 document.body.classList.toggle("light", theme() === "light");204 if (Capacitor.isNativePlatform()) {205 void applyMobileStatusBar(theme());206 }207 });208209 createEffect(() => {210 document.documentElement.setAttribute("data-display-font", displayFont());211 });212213 createEffect(() => {214 document.documentElement.setAttribute("data-text-size", textSize());215 });216217 createEffect(() => {218 if (reduceMotion()) {219 document.documentElement.setAttribute("data-motion", "reduce");220 } else {221 document.documentElement.removeAttribute("data-motion");222 }223 });224225 const selectedIndex = createMemo(() => {226 const currentId = selectedEntry()?.id;227 if (!currentId) return entries().length > 0 ? 0 : -1;228 return entries().findIndex((entry) => entry.id === currentId);229 });230231 async function applyAccentColor(name: AccentColorName) {232 applyAccent(name);233 setAccentColor(name);234 await sendMessage({ type: "UPDATE_SETTINGS", payload: { accentColor: name } });235 }236237 async function applyTheme(t: "dark" | "light") {238 setTheme(t);239 await sendMessage({ type: "UPDATE_SETTINGS", payload: { theme: t } });240 }241242 async function applyDisplayFont(f: "cormorant-italic" | "cormorant" | "inter" | "system") {243 setDisplayFont(f);244 await sendMessage({ type: "UPDATE_SETTINGS", payload: { displayFont: f } });245 }246247 async function applyTextSize(size: "small" | "medium" | "large") {248 setTextSize(size);249 await sendMessage({ type: "UPDATE_SETTINGS", payload: { textSize: size } });250 }251252 async function applyReduceMotion(enabled: boolean) {253 setReduceMotion(enabled);254 await sendMessage({ type: "UPDATE_SETTINGS", payload: { reduceMotion: enabled } });255 }256257 258 259 260 async function applyShortcuts(active: Record<ShortcutAction, Keybinding>) {261 setShortcutBindings(active);262 const overrides: Record<string, Keybinding> = {};263 for (const action of Object.keys(active) as ShortcutAction[]) {264 const a = active[action];265 const d = DEFAULT_BINDINGS[action];266 const same = a.key === d.key267 && Boolean(a.ctrl) === Boolean(d.ctrl)268 && Boolean(a.meta) === Boolean(d.meta)269 && Boolean(a.shift) === Boolean(d.shift)270 && Boolean(a.alt) === Boolean(d.alt);271 if (!same) overrides[action] = a;272 }273 await sendMessage({ type: "UPDATE_SETTINGS", payload: { shortcuts: overrides } });274 }275276 async function applyLockOnClose(enabled: boolean) {277 setLockOnClose(enabled);278 await sendMessage({279 type: "UPDATE_SETTINGS",280 payload: { lockOnClose: enabled },281 });282 }283284 async function applyAutoLockMinutes(minutes: number) {285 setAutoLockMinutes(minutes);286 await sendMessage({287 type: "UPDATE_SETTINGS",288 payload: { autoLockMinutes: minutes },289 });290 }291292 async function applyBreachMonitoring(enabled: boolean) {293 setBreachMonitoring(enabled);294 await sendMessage({295 type: "UPDATE_SETTINGS",296 payload: { breachMonitoring: enabled },297 });298 }299300 async function applyMobileStatusBar(nextTheme: "dark" | "light") {301 try {302 await StatusBar.setStyle({ style: nextTheme === "light" ? Style.Light : Style.Dark });303 await StatusBar.setBackgroundColor({304 color: nextTheme === "light" ? "#EEE3CC" : "#0C0A06",305 });306 } catch {307 308 }309 }310311 function handleBackNavigation() {312 if (showShortcutsHelp()) {313 setShowShortcutsHelp(false);314 return;315 }316 if (restoreView() !== null) {317 setRestoreView(null);318 return;319 }320321 switch (view()) {322 case "list":323 setView("entry");324 return;325 case "settings":326 case "add":327 case "import":328 handleBack();329 return;330 case "export":331 if (returnToPanic()) {332 setReturnToPanic(false);333 setView("panic");334 } else {335 handleBack();336 }337 return;338 case "health":339 case "panic":340 case "sync-pairing":341 setView("settings");342 return;343 case "trash":344 setView("list");345 return;346 case "entry": {347 const now = Date.now();348 if (now - lastBackExitAt < 1600) {349 void CapacitorApp.exitApp();350 return;351 }352 lastBackExitAt = now;353 setBackExitNotice(true);354 window.setTimeout(() => setBackExitNotice(false), 1400);355 return;356 }357 default:358 void CapacitorApp.exitApp();359 }360 }361362 onMount(async () => {363 if (Capacitor.isNativePlatform()) {364 document.body.classList.add("peach-mobile");365 document.documentElement.classList.add("peach-mobile-root");366 void applyMobileStatusBar(theme());367368 const keyboardShow = await Keyboard.addListener("keyboardWillShow", (info) => {369 document.body.style.paddingBottom = `${info.keyboardHeight}px`;370 });371 const keyboardHide = await Keyboard.addListener("keyboardWillHide", () => {372 document.body.style.paddingBottom = "0";373 });374 const backButton = await CapacitorApp.addListener("backButton", () => {375 handleBackNavigation();376 });377378 let touchStartX = 0;379 let touchStartY = 0;380 const handleTouchStart = (event: TouchEvent) => {381 const touch = event.touches[0];382 if (!touch) return;383 touchStartX = touch.clientX;384 touchStartY = touch.clientY;385 };386 const handleTouchEnd = (event: TouchEvent) => {387 const touch = event.changedTouches[0];388 if (!touch) return;389 const dx = touch.clientX - touchStartX;390 const dy = Math.abs(touch.clientY - touchStartY);391 if (touchStartX < 30 && dx > 60 && dy < 40) {392 handleBackNavigation();393 }394 };395 document.addEventListener("touchstart", handleTouchStart, { passive: true });396 document.addEventListener("touchend", handleTouchEnd, { passive: true });397398 onCleanup(() => {399 void keyboardShow.remove();400 void keyboardHide.remove();401 void backButton.remove();402 document.removeEventListener("touchstart", handleTouchStart);403 document.removeEventListener("touchend", handleTouchEnd);404 document.body.style.paddingBottom = "0";405 });406 }407408 409 410 411 412 413 const [unlockResponse, vaultResponse, , celebrationResponse] = await Promise.all([414 sendMessage({ type: "IS_UNLOCKED" }),415 sendMessage({ type: "HAS_VAULT" }),416 refreshCurrentTab(),417 sendMessage({ type: "SHOULD_PLAY_CELEBRATION" }),418 ]);419 const unlocked = Boolean(420 (unlockResponse as { ok: boolean; data?: boolean }).data421 );422 const vaultExists = Boolean(423 (vaultResponse as { ok: boolean; data?: boolean }).data424 );425 const shouldCelebrate = Boolean(426 (celebrationResponse as { ok: boolean; data?: boolean }).data427 );428 setHasVault(vaultExists);429 430 431 432 try {433 const onboarded = await storageGet("peach_onboarded");434 const seen = onboarded === "true";435 if (vaultExists && !seen) {436 await storageSet("peach_onboarded", "true");437 setOnboarded(true);438 } else {439 setOnboarded(seen);440 }441 } catch {442 443 setOnboarded(true);444 }445 await Promise.all([restoreSettings(), refreshProStatus()]);446447 448 if (shouldCelebrate) {449 await sendMessage({ type: "MARK_CELEBRATION_PLAYED" });450 }451452 if (unlocked && vaultExists) {453 await openVault(undefined, shouldCelebrate);454 if (shouldCelebrate) {455 setView("pro-celebration");456 window.setTimeout(() => setView("entry"), 2500);457 }458 } else if (shouldCelebrate) {459 setPendingCelebration(true);460 }461462 await refreshPendingPasskey();463 await refreshIncomingPairing();464465 466 if (!Capacitor.isNativePlatform()) {467 const handleTabActivated = () => { void refreshCurrentTab(); };468 const handleTabUpdated = (_tabId: number, changeInfo: { url?: string; status?: string }) => {469 if (changeInfo.url || changeInfo.status === "complete") void refreshCurrentTab();470 };471 try {472 chrome.tabs.onActivated.addListener(handleTabActivated);473 chrome.tabs.onUpdated.addListener(handleTabUpdated);474 onCleanup(() => {475 chrome.tabs.onActivated.removeListener(handleTabActivated);476 chrome.tabs.onUpdated.removeListener(handleTabUpdated);477 });478 } catch {479 480 }481 }482483 setBootState("ready");484 document.getElementById("pre-lock")?.setAttribute("hidden", "true");485486 487 if (!Capacitor.isNativePlatform() && chrome.storage.session) {488 const session = await chrome.storage.session.get(["pendingProGate", "pendingProNotice"]) as489 Record<string, { feature?: string } | undefined>;490 if (session.pendingProGate?.feature) {491 await chrome.storage.session.remove("pendingProGate");492 setUpgradeHighlight((session.pendingProGate.feature as ProFeature) ?? null);493 setSettingsInitialSection("license");494 setView("settings");495 } else if (session.pendingProNotice?.feature) {496 await chrome.storage.session.remove("pendingProNotice");497 setPendingProNotice({ feature: session.pendingProNotice.feature ?? "" });498 }499 }500501 if (Capacitor.getPlatform() === "android") {502 try {503 const { pending } = await Autofill.checkPendingSave();504 if (pending) {505 const parsed = JSON.parse(pending) as {506 domain?: string;507 username?: string;508 password?: string;509 };510 if (parsed.username && parsed.password) {511 setPendingAutofillSave({512 domain: parsed.domain ?? "",513 username: parsed.username,514 password: parsed.password,515 });516 }517 }518 } catch {519 520 }521 }522523 524 525 526 527 void Promise.all([528 import("./views/Settings").catch(() => {}),529 import("./views/Import").catch(() => {}),530 import("./views/Export").catch(() => {}),531 import("./views/Health").catch(() => {}),532 import("./views/TrashView").catch(() => {}),533 ]);534535 536 537 538 if (!Capacitor.isNativePlatform()) {539 let popupPort: chrome.runtime.Port | null = null;540 try {541 popupPort = chrome.runtime.connect({ name: "popup" });542 } catch { }543 onCleanup(() => { try { popupPort?.disconnect(); } catch {} });544545 546 547 const handleRuntimeMessage = (msg: { type?: string; payload?: { feature?: ProFeature } }) => {548 if (msg?.type === "VAULT_LOCKED" && view() !== "lock") handleLock();549 if (msg?.type === "PRO_GATE_TRIGGERED") {550 setUpgradeHighlight(msg.payload?.feature ?? null);551 setSettingsInitialSection("license");552 setView("settings");553 }554 if (msg?.type === "INCOMING_PAIRING_REQUEST") {555 void refreshIncomingPairing();556 }557 };558 chrome.runtime.onMessage.addListener(handleRuntimeMessage);559 onCleanup(() => chrome.runtime.onMessage.removeListener(handleRuntimeMessage));560 }561562 563 564 565 const SHORTCUT_HANDLERS: Partial<Record<ShortcutAction, () => void>> = {566 copy_password: () => {567 const entry = selectedEntry();568 if (entry?.password) void popupCopy(entry.password, "Password").then((ok) => { if (ok) triggerRing(); });569 },570 copy_username: () => {571 const entry = selectedEntry();572 if (entry?.username) void popupCopy(entry.username, "Username").then((ok) => { if (ok) triggerRing(); });573 },574 copy_totp: () => {575 const entry = selectedEntry();576 if (!entry?.totp) return;577 try {578 const { code } = generateTOTP(entry.totp);579 void popupCopy(code, "2FA").then((ok) => { if (ok) triggerRing(); });580 } catch { }581 },582 new_entry: () => handleAdd(),583 edit_entry: () => {584 const entry = selectedEntry();585 586 587 if (!entry || isPasskeyOnly(entry)) return;588 setEditEntry(entry);589 setView("add");590 },591 delete_entry: () => {592 if (selectedEntry()) void handleDelete();593 },594 lock_vault: () => { void handleHeaderLock(); },595 search: () => openList(),596 nav_prev: () => navigate(-1),597 nav_next: () => navigate(1),598 jump_vault: () => setView("entry"),599 jump_settings: () => setView("settings"),600 show_help: () => setShowShortcutsHelp(true),601 };602603 604 605 606 const ENTRY_SCOPED: ReadonlySet<ShortcutAction> = new Set([607 "copy_password", "copy_username", "copy_totp",608 "edit_entry", "delete_entry", "nav_prev", "nav_next",609 ]);610611 const handleGlobalKeydown = (e: KeyboardEvent) => {612 const v = view();613 const inInput = (e.target as HTMLElement)?.tagName === "INPUT"614 || (e.target as HTMLElement)?.tagName === "TEXTAREA"615 || (e.target as HTMLElement)?.isContentEditable;616 const isPrintableSearchKey =617 e.key.length === 1 &&618 !e.ctrlKey &&619 !e.metaKey &&620 !e.altKey;621622 623 if (v === "pro-celebration") return;624625 626 627 if (showShortcutsHelp()) {628 if (e.key === "Escape") { e.preventDefault(); setShowShortcutsHelp(false); }629 return;630 }631632 633 if (e.key === "Escape") {634 if (v === "list") { setView("entry"); return; }635 if (v === "settings" || v === "import" || v === "export" || v === "add" || v === "health") { handleBack(); return; }636 if (v === "sync-pairing") { setView("settings"); return; }637 }638639 640 641 642 const bindings = shortcutBindings();643 for (const action of Object.keys(bindings) as ShortcutAction[]) {644 const binding = bindings[action];645 if (!matchKeybinding(e, binding)) continue;646 647 648 const hasMod = binding.ctrl || binding.meta || binding.alt || binding.shift;649 if (!hasMod && binding.key.length === 1 && inInput) return;650 if (ENTRY_SCOPED.has(action) && v !== "entry") return;651 e.preventDefault();652 SHORTCUT_HANDLERS[action]?.();653 return;654 }655656 657 658 659 660 if (v === "entry" && !inInput && isPrintableSearchKey) {661 e.preventDefault();662 primeListSearch(e.key);663 return;664 }665 };666 window.addEventListener("keydown", handleGlobalKeydown);667 onCleanup(() => window.removeEventListener("keydown", handleGlobalKeydown));668669 if (!Capacitor.isNativePlatform()) {670 const handleStorageChanged = (671 changes: Record<string, chrome.storage.StorageChange>,672 areaName: string673 ) => {674 if (areaName !== "session") return;675 if (!Object.keys(changes).some((key) => key.startsWith("passkey_pending_"))) {676 return;677 }678 void refreshPendingPasskey();679 };680 chrome.storage.onChanged.addListener(handleStorageChanged);681 onCleanup(() => chrome.storage.onChanged.removeListener(handleStorageChanged));682 }683 });684685 async function refreshCurrentTab() {686 if (Capacitor.isNativePlatform()) return;687 try {688 const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });689 const url = tab?.url ?? tab?.pendingUrl ?? "";690 setCurrentTabDomain(url ? (extractDomain(url) ?? "") : "");691 } catch {692 setCurrentTabDomain("");693 }694 }695696 async function refreshPendingPasskey() {697 const res = await sendMessage({ type: "GET_PENDING_PASSKEY" });698 setPendingPasskey((res as { ok: boolean; data?: PendingPasskeyRequest | null }).data ?? null);699 }700701 async function refreshIncomingPairing() {702 const res = await sendMessage({ type: "GET_INCOMING_PAIRING_REQUEST" });703 const data = (res as { ok: boolean; data?: IncomingPairingRequest | null }).data ?? null;704 setIncomingPair(data);705 }706707 async function respondIncomingPairing(accept: boolean) {708 if (incomingPairResponding()) return;709 setIncomingPairResponding(true);710 await sendMessage({ type: "RESPOND_INCOMING_PAIRING", payload: { accept } });711 setIncomingPair(null);712 setIncomingPairResponding(false);713 }714715 716 717 718 createEffect(() => {719 const req = incomingPair();720 if (!req) return;721 const handle = window.setInterval(() => {722 setIncomingPairTick((tick) => tick + 1);723 if (Date.now() >= req.expiresAt) {724 setIncomingPair(null);725 window.clearInterval(handle);726 }727 }, 1000);728 onCleanup(() => window.clearInterval(handle));729 });730731 async function refreshProStatus() {732 const res = await sendMessage({ type: "GET_LICENSE" });733 const data = (res as { ok: boolean; data?: { valid?: boolean; plan?: string } }).data;734 setProStatus(Boolean(data?.valid && data?.plan === "pro"));735 }736737 async function restoreSettings() {738 const res = await sendMessage({ type: "GET_SETTINGS" });739 const s = (res as { ok: boolean; data?: any }).data ?? {};740 if (s.accentColor && ACCENT_COLORS.some(c => c.name === s.accentColor)) {741 setAccentColor(s.accentColor as AccentColorName);742 }743 setTheme(s.theme === "light" ? "light" : "dark");744 if (s.displayFont === "cormorant" || s.displayFont === "inter" || s.displayFont === "system") {745 setDisplayFont(s.displayFont);746 } else {747 setDisplayFont("cormorant-italic");748 }749 if (s.textSize === "small" || s.textSize === "large") {750 setTextSize(s.textSize);751 } else {752 setTextSize("medium");753 }754 setReduceMotion(s.reduceMotion === true);755 setLockOnClose(s.lockOnClose !== false);756 setAutoLockMinutes(typeof s.autoLockMinutes === "number" ? s.autoLockMinutes : 5);757 setBreachMonitoring(s.breachMonitoring !== false);758 setTrashRetentionDays(typeof s.trashRetentionDays === "number" ? s.trashRetentionDays : 30);759 setShortcutBindings(getActiveBindings(s.shortcuts));760 }761762 async function applyTrashRetention(days: number) {763 setTrashRetentionDays(days);764 await sendMessage({ type: "UPDATE_SETTINGS", payload: { trashRetentionDays: days } });765 }766767 function primeListSearch(seed: string) {768 setListSearchSeed(seed);769 setListSearchSeedNonce((value) => value + 1);770 openList();771 }772773 774 775 776 async function loadEntries(): Promise<VaultEntry[] | null> {777 const response = await sendMessage({ type: "GET_ENTRIES" });778 const res = response as { ok: boolean; data?: VaultEntry[]; error?: string };779780 781 782 783 784 if (!res.ok) {785 if (786 res.error === "vault locked" ||787 res.error === "SERVICE_WORKER_UNAVAILABLE" ||788 (typeof res.error === "string" && res.error.includes("locked"))789 ) {790 handleLock();791 return null; 792 }793 return [];794 }795796 const loadedEntries = res.data ?? [];797 setEntries(loadedEntries);798 void publishInMemoryVault(loadedEntries);799800 const currentId = selectedEntry()?.id;801 if (currentId) {802 setSelectedEntry(803 loadedEntries.find((entry) => entry.id === currentId) ?? loadedEntries[0] ?? null804 );805 }806807 return loadedEntries;808 }809810 async function openVault(preferredEntryId?: string, skipViewSet = false) {811 812 const retDays = trashRetentionDays();813 if (retDays > 0) {814 void sendMessage({815 type: "PURGE_EXPIRED_TRASH",816 payload: { retentionMs: retDays * 86_400_000 },817 });818 }819820 const loadedEntries = await loadEntries();821822 823 824 if (loadedEntries === null) return;825826 827 let nextSelectedEntry: VaultEntry | null = null;828 if (preferredEntryId) {829 nextSelectedEntry = loadedEntries.find((e) => e.id === preferredEntryId) ?? null;830 }831 if (!nextSelectedEntry) {832 const tabDomain = currentTabDomain();833 if (tabDomain) {834 nextSelectedEntry = loadedEntries.find((e) => {835 if (e.type === "login") {836 if (e.url && (extractDomain(e.url) ?? "") === tabDomain) return true;837 for (const extra of e.additionalUrls ?? []) {838 if ((extractDomain(extra) ?? "") === tabDomain) return true;839 }840 return false;841 }842 if (e.passkey?.rpId) return e.passkey.rpId === tabDomain;843 return false;844 }) ?? null;845 }846 }847 nextSelectedEntry ??= loadedEntries[0] ?? null;848849 setSelectedEntry(nextSelectedEntry);850 setEditEntry(undefined);851 setContentTransitioning(false);852 setContentPhase("enter");853 queueContentIdle();854 if (!skipViewSet) setView("entry");855 }856857 async function handleUnlock() {858 setHasVault(true);859 triggerPipPulse();860 await restoreSettings();861 const celebrating = pendingCelebration();862 if (celebrating) {863 await sendMessage({ type: "MARK_CELEBRATION_PLAYED" });864 setPendingCelebration(false);865 }866 await openVault(undefined, celebrating);867 if (celebrating) {868 setView("pro-celebration");869 window.setTimeout(() => setView("entry"), 2500);870 }871 }872873 function handleSelectEntry(entry: VaultEntry) {874 setSelectedEntry(entry);875 setContentTransitioning(false);876 setContentPhase("enter");877 queueContentIdle();878 setView("entry");879 }880881 function handleAdd() {882 setEditEntry(undefined);883 setView("add");884 }885886 async function handleDelete() {887 const entry = selectedEntry();888 if (!entry) return;889 await sendMessage({ type: "DELETE_ENTRY", payload: { id: entry.id } });890 const loadedEntries = await loadEntries() ?? [];891 setSelectedEntry(loadedEntries[0] ?? null);892 setView("entry");893 }894895 async function handleDeleteMany(ids: string[]) {896 for (const id of ids) {897 await sendMessage({ type: "DELETE_ENTRY", payload: { id } });898 }899 const loadedEntries = await loadEntries() ?? [];900 901 const stillExists = loadedEntries.find(e => e.id === selectedEntry()?.id);902 if (!stillExists) setSelectedEntry(loadedEntries[0] ?? null);903 }904905 async function handleSave(savedEntry?: VaultEntry) {906 await openVault(savedEntry?.id);907 }908909 async function savePendingAutofill() {910 const pending = pendingAutofillSave();911 if (!pending) return;912 const domain = pending.domain.trim();913 const response = await sendMessage({914 type: "ADD_ENTRY",915 payload: {916 type: "login",917 title: domain || "Saved login",918 url: domain ? `https://${domain}` : "",919 username: pending.username,920 password: pending.password,921 },922 });923 if ((response as { ok: boolean }).ok) {924 setPendingAutofillSave(null);925 await openVault((response as { data?: VaultEntry }).data?.id);926 }927 }928929 function handleBack() {930 setEditEntry(undefined);931 setView("entry");932 }933934 function handleLock() {935 clearCanarySuppressions();936 setEntries([]);937 setSelectedEntry(null);938 setEditEntry(undefined);939 setContentPhase("idle");940 setView("lock");941 void clearInMemoryVault();942 }943944 function handleHeaderLock() {945 946 947 948 handleLock();949 void sendMessage({ type: "LOCK" });950 }951952 function navigate(dir: number) {953 const allEntries = entries();954 if (allEntries.length === 0) return;955 const currentIndex = selectedIndex();956 const baseIndex = currentIndex >= 0 ? currentIndex : 0;957 const nextIndex = (baseIndex + dir + allEntries.length) % allEntries.length;958 setSelectedEntry(allEntries[nextIndex]);959 setContentPhase("enter");960 queueContentIdle();961 }962963 function openList() {964 setView("list");965 }966967 function openHealth() {968 setEditEntry(undefined);969 setView("health");970 }971972 function handleOpenFileImport() {973 setRestoreView("file");974 }975976 const isShellOverlayOpen = () => view() !== "entry" || restoreView() !== null;977978 function handleFixEntry(entry: VaultEntry) {979 980 981 if (isPasskeyOnly(entry)) {982 setSelectedEntry(entry);983 setView("entry");984 return;985 }986 setEditEntry(entry);987 setView("add");988 }989990 const isLockedView = () => view() === "lock";991992 async function handleApprovePendingPasskey() {993 const pending = pendingPasskey();994 if (!pending) return;995 if (pending.browser === "firefox" && pending.type === "create") {996 997 998 999 1000 const { createFirefoxPasskey } = await import("./firefox-passkey");1001 const result = await createFirefoxPasskey(pending);1002 if (!result.ok) {1003 console.warn("Peach Firefox passkey create failed:", result.error);1004 }1005 await sendMessage({ type: "DENY_PASSKEY", payload: { requestId: pending.requestId } });1006 setPendingPasskey(null);1007 void loadEntries();1008 return;1009 }1010 await sendMessage({ type: "APPROVE_PASSKEY", payload: { requestId: pending.requestId } });1011 setPendingPasskey(null);1012 }10131014 async function handleDenyPendingPasskey() {1015 const pending = pendingPasskey();1016 if (!pending) return;1017 await sendMessage({ type: "DENY_PASSKEY", payload: { requestId: pending.requestId } });1018 setPendingPasskey(null);1019 }10201021 function queueContentIdle(after?: () => void) {1022 if (contentPhaseTimer) window.clearTimeout(contentPhaseTimer);1023 contentPhaseTimer = window.setTimeout(() => {1024 setContentPhase("idle");1025 after?.();1026 }, ENTRY_TRANSITION_SETTLE_MS);1027 }10281029 return (1030 <div class="popup-root peach-theme">1031 <Show when={bootState() === "ready"}>1032 <Show1033 when={!pendingPasskey()}1034 fallback={1035 <PasskeyApprovalView1036 type={pendingPasskey()!.type}1037 rpName={pendingPasskey()!.rpName}1038 rpId={pendingPasskey()!.rpId}1039 userName={pendingPasskey()!.userName}1040 userDisplayName={pendingPasskey()!.userDisplayName}1041 onApprove={handleApprovePendingPasskey}1042 onDeny={handleDenyPendingPasskey}1043 />1044 }1045 >1046 <Show1047 when={!isLockedView()}1048 fallback={1049 <Show1050 when={onboarded() || hasVault()}1051 fallback={1052 <Onboarding1053 onComplete={() => { setOnboarded(true); }}1054 />1055 }1056 >1057 <LockView1058 hasVault={hasVault()}1059 ready={bootState() === "ready"}1060 isPro={proStatus()}1061 onUnlock={handleUnlock}1062 onBackToOnboarding={1063 !hasVault()1064 ? () => setOnboarded(false)1065 : undefined1066 }1067 />1068 </Show>1069 }1070 >1071 <Show1072 when={view() !== "pro-celebration"}1073 fallback={<ProCelebration />}1074 >1075 <section1076 id="hd-shell"1077 class="peach-shell peach-theme"1078 data-surface="extension"1079 >1080 <header class="peach-chrome" classList={{ "is-hidden-for-overlay": isShellOverlayOpen() }}>1081 <PeachWordmark unlocked />1082 <div class="peach-chrome-actions">1083 <button1084 class="peach-btn peach-btn--ghost peach-btn--sm peach-icon-btn"1085 onClick={() => setView("settings")}1086 aria-label="Settings"1087 >1088 <svg width="14" height="14" viewBox="0 0 14 14" fill="none">1089 <path1090 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"1091 stroke="currentColor"1092 stroke-width="0.9"1093 />1094 <circle cx="7" cy="7" r="2.1" stroke="currentColor" stroke-width="0.9" />1095 </svg>1096 </button>1097 <button1098 class="peach-btn peach-btn--ghost peach-btn--sm peach-icon-btn"1099 onClick={handleAdd}1100 aria-label="New entry"1101 >1102 <svg width="11" height="11" viewBox="0 0 11 11" fill="none" stroke="currentColor" stroke-width="1.1" stroke-linecap="round">1103 <path d="M5.5 1v9M1 5.5h9" />1104 </svg>1105 </button>1106 <button1107 class="peach-btn peach-btn--ghost peach-btn--sm peach-icon-btn peach-lock-btn"1108 onClick={() => void handleHeaderLock()}1109 aria-label="Lock vault"1110 >1111 <svg class="peach-lock-icon" width="14" height="16" viewBox="0 0 14 16" fill="none">1112 <path1113 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"1114 stroke="currentColor"1115 stroke-width="1"1116 stroke-linecap="round"1117 />1118 <rect x="1.5" y="6" width="11" height="8.5" rx="2.2" stroke="currentColor" stroke-width="1" />1119 <circle cx="7" cy="10.25" r="1" fill="currentColor" />1120 </svg>1121 </button>1122 </div>1123 </header>11241125 <Show when={incomingPair() !== null}>1126 <div class="peach-pair-request-banner" role="dialog" aria-label="Pairing request">1127 <div class="peach-pair-request-header">1128 <span class="peach-pair-request-mark">🍑</span>1129 <span class="peach-pair-request-title">Pairing request</span>1130 <span class="peach-pair-request-countdown">{incomingPairSecondsLeft()}s</span>1131 </div>1132 <p class="peach-pair-request-body">1133 <strong>{incomingPair()!.deviceName}</strong> wants to sync with this Peach.1134 </p>1135 <div class="peach-pair-request-actions">1136 <button1137 class="peach-btn peach-btn--ghost peach-btn--sm"1138 onClick={() => void respondIncomingPairing(false)}1139 disabled={incomingPairResponding()}1140 >1141 Reject1142 </button>1143 <button1144 class="peach-btn peach-btn--accent peach-btn--sm"1145 onClick={() => void respondIncomingPairing(true)}1146 disabled={incomingPairResponding()}1147 >1148 Accept1149 </button>1150 </div>1151 </div>1152 </Show>11531154 <Show when={pendingProNotice() !== null}>1155 <div class="peach-pro-notice-banner">1156 <span>✦ {pendingProNotice()?.feature === "sync" ? "Sync" : "A Pro feature"} requires Peach Pro</span>1157 <button1158 class="peach-pro-notice-link"1159 onClick={() => {1160 setUpgradeHighlight((pendingProNotice()?.feature as ProFeature) ?? null);1161 setSettingsInitialSection("license");1162 setView("settings");1163 setPendingProNotice(null);1164 }}1165 >1166 Learn more →1167 </button>1168 <button class="peach-pro-notice-close" onClick={() => setPendingProNotice(null)} aria-label="Dismiss">✕</button>1169 </div>1170 </Show>11711172 <Show when={pendingAutofillSave() !== null && !isLockedView()}>1173 <div class="peach-pro-notice-banner peach-autofill-save-banner">1174 <span>1175 Save login{pendingAutofillSave()?.domain ? ` for ${pendingAutofillSave()!.domain}` : ""}?1176 </span>1177 <button1178 class="peach-pro-notice-link"1179 onClick={() => void savePendingAutofill()}1180 >1181 Save1182 </button>1183 <button1184 class="peach-pro-notice-close"1185 onClick={() => setPendingAutofillSave(null)}1186 aria-label="Dismiss"1187 >1188 x1189 </button>1190 </div>1191 </Show>11921193 <Show when={backExitNotice()}>1194 <div class="peach-pro-notice-banner peach-back-exit-banner">1195 <span>Tap back again to exit Peach</span>1196 </div>1197 </Show>11981199 <div class="peach-shell-body">1200 <div class="peach-shell-veil"></div>1201 <div class="peach-content-frame" data-content-phase={contentPhase()} classList={{ navigating: contentTransitioning() }}>1202 <EntryView1203 entry={selectedEntry()}1204 onDelete={handleDelete}1205 onFieldSaved={() => void loadEntries()}1206 onEscape={() => { setView("list"); }}1207 />1208 </div>12091210 <section class="peach-search-wrap" classList={{ "is-hidden-for-overlay": isShellOverlayOpen() }}>1211 <div class="peach-search-bar">1212 <span class="peach-search-icon">1213 <svg width="13" height="13" viewBox="0 0 13 13" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round">1214 <circle cx="5.5" cy="5.5" r="3.75" />1215 <path d="M8.75 8.75L11.5 11.5" />1216 </svg>1217 </span>1218 <input1219 class="peach-search-input"1220 placeholder="search vault..."1221 autocomplete="off"1222 aria-label="Search vault entries"1223 onClick={openList}1224 onFocus={openList}1225 readOnly1226 />1227 <div class="peach-search-meta">1228 <span class="peach-search-counter">1229 {entries().length > 01230 ? `${selectedIndex() + 1} / ${entries().length}`1231 : "0 entries"}1232 </span>1233 <span class="peach-divider"></span>1234 <button1235 class="peach-btn peach-btn--ghost peach-btn--sm peach-icon-btn"1236 onClick={() => navigate(-1)}1237 aria-label="Previous entry"1238 disabled={entries().length === 0}1239 >1240 <svg width="6" height="11" viewBox="0 0 6 11" fill="none" stroke="currentColor" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round">1241 <path d="M5 1L1 5.5L5 10" />1242 </svg>1243 </button>1244 <button1245 class="peach-btn peach-btn--ghost peach-btn--sm peach-icon-btn"1246 onClick={() => navigate(1)}1247 aria-label="Next entry"1248 disabled={entries().length === 0}1249 >1250 <svg width="6" height="11" viewBox="0 0 6 11" fill="none" stroke="currentColor" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round">1251 <path d="M1 1L5 5.5L1 10" />1252 </svg>1253 </button>1254 </div>1255 </div>1256 </section>1257 </div>12581259 <Show when={view() === "list"}>1260 <VaultView1261 entries={entries()}1262 selectedEntryId={selectedEntry()?.id}1263 currentTabDomain={currentTabDomain()}1264 sortOrder={sortOrder()}1265 searchSeed={listSearchSeed()}1266 searchSeedNonce={listSearchSeedNonce()}1267 onSelectEntry={handleSelectEntry}1268 onSortOrderChange={setSortOrder}1269 onAdd={handleAdd}1270 onClose={() => setView("entry")}1271 onOpenTrash={() => setView("trash")}1272 onDeleteMany={handleDeleteMany}1273 />1274 </Show>1275 <Show when={view() === "settings"}>1276 <Suspense fallback={<div class="peach-loading"><PeachWordmark /></div>}>1277 <SettingsView1278 entriesCount={entries().length}1279 breachMonitoring={breachMonitoring()}1280 lockOnClose={lockOnClose()}1281 autoLockMinutes={autoLockMinutes()}1282 trashRetentionDays={trashRetentionDays()}1283 theme={theme()}1284 accentColor={accentColor()}1285 displayFont={displayFont()}1286 textSize={textSize()}1287 reduceMotion={reduceMotion()}1288 isPro={proStatus()}1289 initialSection={settingsInitialSection()}1290 upgradeHighlight={upgradeHighlight()}1291 onBreachMonitoringChange={applyBreachMonitoring}1292 onLockOnCloseChange={applyLockOnClose}1293 onAutoLockMinutesChange={applyAutoLockMinutes}1294 onTrashRetentionChange={applyTrashRetention}1295 onThemeChange={applyTheme}1296 onAccentChange={applyAccentColor}1297 onDisplayFontChange={applyDisplayFont}1298 onTextSizeChange={applyTextSize}1299 onReduceMotionChange={applyReduceMotion}1300 shortcuts={shortcutBindings()}1301 onShortcutsChange={applyShortcuts}1302 onLicenseChange={async () => {1303 1304 1305 1306 1307 1308 await refreshProStatus();1309 void loadEntries();1310 const should = await sendMessage({ type: "SHOULD_PLAY_CELEBRATION" });1311 if ((should as { ok: boolean; data?: boolean }).data === true) {1312 await sendMessage({ type: "MARK_CELEBRATION_PLAYED" });1313 setView("pro-celebration");1314 window.setTimeout(() => setView("settings"), 2500);1315 }1316 }}1317 onBack={() => { setSettingsInitialSection(null); setUpgradeHighlight(null); handleBack(); }}1318 onImport={() => setView("import")}1319 onExport={() => setView("export")}1320 onBreachCheckDone={loadEntries}1321 onOpenHealth={openHealth}1322 onOpenSyncPairing={() => setView("sync-pairing")}1323 onOpenFileImport={handleOpenFileImport}1324 onOpenPanic={() => setView("panic")}1325 />1326 </Suspense>1327 </Show>1328 <Show when={view() === "sync-pairing"}>1329 <Suspense fallback={<div class="peach-loading"><PeachWordmark /></div>}>1330 <SyncPairingView1331 onClose={() => setView("settings")}1332 onPaired={() => { }}1333 />1334 </Suspense>1335 </Show>1336 <Show when={view() === "add"}>1337 <AddView1338 entry={editEntry()}1339 entries={entries()}1340 onBack={handleBack}1341 onSave={handleSave}1342 />1343 </Show>1344 <Show when={view() === "import"}>1345 <Suspense fallback={<div class="peach-loading"><PeachWordmark /></div>}>1346 <ImportView onBack={handleBack} onImport={handleSave} />1347 </Suspense>1348 </Show>1349 <Show when={view() === "export"}>1350 <Suspense fallback={<div class="peach-loading"><PeachWordmark /></div>}>1351 <ExportView1352 onBack={() => {1353 if (returnToPanic()) {1354 setReturnToPanic(false);1355 setView("panic");1356 } else {1357 handleBack();1358 }1359 }}1360 />1361 </Suspense>1362 </Show>1363 <Show when={view() === "panic"}>1364 <Suspense fallback={<div class="peach-loading"><PeachWordmark /></div>}>1365 <PanicView1366 onCancel={() => setView("settings")}1367 onOpenExport={() => {1368 setReturnToPanic(true);1369 setView("export");1370 }}1371 onDestroyed={async () => {1372 clearCanarySuppressions();1373 setEntries([]);1374 setSelectedEntry(null);1375 setEditEntry(undefined);1376 setHasVault(false);1377 setOnboarded(false);1378 setProStatus(false);1379 setPendingPasskey(null);1380 setUpgradeHighlight(null);1381 setSettingsInitialSection(null);1382 setPendingProNotice(null);1383 setPendingCelebration(false);1384 setReturnToPanic(false);1385 setContentPhase("idle");1386 setView("lock");1387 void clearInMemoryVault();1388 }}1389 />1390 </Suspense>1391 </Show>1392 <Show when={view() === "health"}>1393 <Suspense fallback={<div class="peach-loading"><PeachWordmark /></div>}>1394 <HealthView1395 entries={entries()}1396 isPro={proStatus()}1397 onFixEntry={handleFixEntry}1398 onBack={() => setView("settings")}1399 onRefresh={loadEntries}1400 />1401 </Suspense>1402 </Show>1403 <Show when={view() === "trash"}>1404 <Suspense fallback={<div class="peach-loading"><PeachWordmark /></div>}>1405 <TrashView1406 onBack={() => setView("list")}1407 onRestored={() => void loadEntries()}1408 />1409 </Suspense>1410 </Show>1411 <Show when={restoreView() === "file"}>1412 <Suspense fallback={<div class="peach-loading"><PeachWordmark /></div>}>1413 <ImportView1414 mode="onboarding"1415 replacesExistingVault={true}1416 onBack={() => setRestoreView(null)}1417 onImport={async () => {1418 setRestoreView(null);1419 await handleUnlock();1420 }}1421 />1422 </Suspense>1423 </Show>1424 </section>1425 </Show>1426 </Show>1427 </Show>1428 </Show>1429 <Show when={showShortcutsHelp()}>1430 <ShortcutsHelpOverlay1431 bindings={shortcutBindings()}1432 onClose={() => setShowShortcutsHelp(false)}1433 />1434 </Show>1435 </div>1436 );1437}14381439function ShortcutsHelpOverlay(props: {1440 bindings: Record<ShortcutAction, Keybinding>;1441 onClose: () => void;1442}) {1443 return (1444 <div class="peach-shortcuts-help-backdrop" onClick={props.onClose}>1445 <div class="peach-shortcuts-help-card" onClick={(e) => e.stopPropagation()}>1446 <div class="peach-shortcuts-help-head">1447 <h3>Keyboard shortcuts</h3>1448 <button class="peach-shortcuts-help-close" onClick={props.onClose} aria-label="Close">✕</button>1449 </div>1450 <div class="peach-shortcuts-help-body">1451 <p class="peach-settings-sub-label">ENTRY VIEW</p>1452 <ul>1453 {SHORTCUT_DESCRIPTORS.filter((d) => d.scope === "entry").map((d) => (1454 <li>1455 <span>{d.label}</span>1456 <kbd>{formatKeybinding(props.bindings[d.action])}</kbd>1457 </li>1458 ))}1459 </ul>1460 <p class="peach-settings-sub-label">ANYWHERE</p>1461 <ul>1462 {SHORTCUT_DESCRIPTORS.filter((d) => d.scope === "global").map((d) => (1463 <li>1464 <span>{d.label}</span>1465 <kbd>{formatKeybinding(props.bindings[d.action])}</kbd>1466 </li>1467 ))}1468 </ul>1469 </div>1470 </div>1471 </div>1472 );1473}