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:
34
src/types/overlay.ts
Normal file
34
src/types/overlay.ts
Normal 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";
|
||||||
Reference in New Issue
Block a user