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";