@hyperix/hooks 0.1.0

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/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # @bunstack/hooks
2
+
3
+ React hooks for the local workspace.
4
+
5
+ ## Workspace usage
6
+
7
+ This package is intended for source-first usage inside the monorepo. Consumers should reference it with `"workspace:*"` and let the app bundler resolve the TypeScript source.
8
+
9
+ ## Example
10
+
11
+ ```tsx
12
+ import { useState } from "react";
13
+ import { useDebouncedValue } from "@bunstack/hooks";
14
+
15
+ function Search() {
16
+ const [query, setQuery] = useState("");
17
+ const debouncedQuery = useDebouncedValue(query, 300);
18
+
19
+ return <input value={query} onChange={(e) => setQuery(e.target.value)} />;
20
+ }
21
+ ```
22
+
23
+ ## Tests
24
+
25
+ ```bash
26
+ bun run --cwd packages/hooks test
27
+ ```
@@ -0,0 +1,17 @@
1
+ import * as _outofgas_react_stream from '@outofgas/react-stream';
2
+
3
+ declare function useDebouncedValue<T>(value: T, delayMs?: number): T;
4
+
5
+ type L2BookLevel = [price: number, size: number, cumulativeSize: number];
6
+ type L2Book = {
7
+ bids: L2BookLevel[];
8
+ asks: L2BookLevel[];
9
+ maxCumulativeSize: number;
10
+ };
11
+ type UseL2BookOptions = {
12
+ depth?: number;
13
+ nSigFigs?: number;
14
+ };
15
+ declare const useL2Book: (coin: string, options?: UseL2BookOptions) => _outofgas_react_stream.UseSubscribeState<L2Book>;
16
+
17
+ export { type L2Book, type L2BookLevel, type UseL2BookOptions, useDebouncedValue, useL2Book };