From 1e4bd8082b7a4ab416ca8aed2f269c0b4dda4a32 Mon Sep 17 00:00:00 2001 From: Michael Chihlas Date: Fri, 8 May 2026 17:42:09 -0400 Subject: [PATCH] feat: add overlay state types and IPC constants Co-Authored-By: Claude Opus 4.7 (1M context) --- src/types/overlay.ts | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/types/overlay.ts diff --git a/src/types/overlay.ts b/src/types/overlay.ts new file mode 100644 index 0000000..07763ee --- /dev/null +++ b/src/types/overlay.ts @@ -0,0 +1,34 @@ +export type OverlayPersistedState = { + url: string; + opacity: number; + alwaysOnTop: boolean; + clickThrough: boolean; +}; + +export type OverlayState = OverlayPersistedState & { + isOpen: boolean; + urlError: string | null; + hotkeyError: string | null; +}; + +export type OverlayActions = { + setUrl: (raw: string) => void; + setOpacity: (v: number) => void; + setAlwaysOnTop: (v: boolean) => void; + setClickThrough: (v: boolean) => void; + /** Internal: applies a click-through change that originated in Rust. + * Skips the live-wiring effect to avoid ping-pong with the backend. */ + _setClickThroughFromBackend: (v: boolean) => void; + setHotkeyError: (msg: string | null) => void; + setIsOpen: (v: boolean) => void; + hydrate: (s: OverlayPersistedState) => void; +}; + +export type ClickThroughToggledPayload = { clickThrough: boolean }; +export type ClickThroughNoOverlayPayload = Record; + +export const STORE_FILE = "browserlay.json"; +export const STORE_KEY = "state"; +export const OVERLAY_LABEL = "overlay"; +export const EVT_CLICK_THROUGH_TOGGLED = "click-through-toggled"; +export const EVT_CLICK_THROUGH_NO_OVERLAY = "click-through-no-overlay";