feat: add overlay state types and IPC constants

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Michael Chihlas
2026-05-08 17:42:09 -04:00
parent 36dc73ac32
commit 1e4bd8082b

34
src/types/overlay.ts Normal file
View File

@@ -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<string, never>;
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";