react-grab 0.0.9 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,37 @@
1
- declare const init: () => () => void;
1
+ interface StoreApi<T> {
2
+ getInitialState(): T;
3
+ getState(): T;
4
+ setState(partialState: ((prevState: T) => T) | Partial<T>): T;
5
+ subscribe(listener: Listener<T>): () => void;
6
+ subscribe<U>(listener: Listener<U>, selector: (state: T) => unknown): () => void;
7
+ }
8
+ type Listener<T> = (state: T, prevState: T | undefined) => (() => unknown) | void;
2
9
 
3
- export { init };
10
+ type Hotkey = KeyboardEvent["key"];
11
+
12
+ interface Options {
13
+ enabled?: boolean;
14
+ /**
15
+ * hotkey to trigger the overlay
16
+ *
17
+ * default: "Meta"
18
+ */
19
+ hotkey?: Hotkey | Hotkey[];
20
+ /**
21
+ * time required (ms) to hold the key to trigger the overlay
22
+ *
23
+ * default: 1000
24
+ */
25
+ keyHoldDuration?: number;
26
+ }
27
+ interface LibStore {
28
+ keyPressTimestamps: Map<Hotkey, number>;
29
+ mouseX: number;
30
+ mouseY: number;
31
+ overlayMode: "copying" | "hidden" | "visible";
32
+ pressedKeys: Set<Hotkey>;
33
+ }
34
+ declare const libStore: StoreApi<LibStore>;
35
+ declare const init: (options?: Options) => (() => void) | undefined;
36
+
37
+ export { type Options, init, libStore };