preact-missing-hooks 4.2.0 → 4.3.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/llm.package.json CHANGED
@@ -1,322 +1,277 @@
1
1
  {
2
2
  "name": "preact-missing-hooks",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "description": "A lightweight, extendable collection of missing React-like hooks for Preact — plus fresh, powerful new ones designed specifically for modern Preact apps.",
5
5
  "exports": {
6
6
  "useTransition": {
7
7
  "type": "function",
8
- "description": "A custom hook that wraps React's useTransition API, providing a way to mark updates as transitions to allow the browser to prioritize updates. It returns a tuple containing a boolean indicating if the transition is pending and a startTransition function to wrap state updates.",
8
+ "description": "A hook that provides a transition state and a function to start a transition. It is used to defer non-urgent updates to avoid blocking the UI during high-priority updates.",
9
9
  "hook": true,
10
- "params": "config?: { timeoutMs?: number }",
11
- "returns": "[isPending: boolean, startTransition: (callback: () => void) => void]",
12
- "sideEffect": false
10
+ "params": "options?: { timeoutMs?: number }",
11
+ "returns": "Array containing a boolean indicating if a transition is in progress and a function to start a transition"
13
12
  },
14
13
  "useMutationObserver": {
15
14
  "type": "function",
16
- "description": "A hook that creates and manages a MutationObserver to watch for changes in the DOM. It accepts a target element and a callback to execute when mutations are observed, returning a ref to attach to the target element.",
15
+ "description": "A hook that observes DOM mutations on a given element and calls a callback when mutations occur. It is useful for reacting to changes in the DOM structure or attributes.",
17
16
  "hook": true,
18
- "params": "target: Element | null, callback: MutationCallback, options?: MutationObserverInit",
19
- "returns": "ref: { current: Element | null }",
20
- "sideEffect": false
17
+ "params": "element: Element, callback: (mutations: MutationRecord[]) => void, options?: MutationObserverInit",
18
+ "returns": "void"
21
19
  },
22
20
  "UseMutationObserverOptions": {
23
21
  "type": "type",
24
- "description": "A TypeScript type defining the options object for the useMutationObserver hook, extending MutationObserverInit to include optional configuration for observing DOM mutations.",
22
+ "description": "An interface defining the options for the useMutationObserver hook. It extends MutationObserverInit and includes additional properties specific to the hook.",
25
23
  "hook": false,
26
- "params": "extends MutationObserverInit",
24
+ "params": "N/A",
27
25
  "returns": "N/A"
28
26
  },
29
27
  "useEventBus": {
30
28
  "type": "function",
31
- "description": "A hook that provides access to a global event bus for publishing and subscribing to events across components. It returns an object with methods to subscribe, unsubscribe, and publish events.",
29
+ "description": "A hook that provides a simple event bus for component communication. It allows components to emit and listen to events without prop drilling.",
32
30
  "hook": true,
33
- "params": "none",
34
- "returns": "{ subscribe: (event: string, callback: Function) => void, unsubscribe: (event: string, callback: Function) => void, publish: (event: string, data: any) => void }",
35
- "sideEffect": false
31
+ "params": "N/A",
32
+ "returns": "Object with emit and on methods for event handling"
36
33
  },
37
34
  "useWrappedChildren": {
38
35
  "type": "function",
39
- "description": "A hook that wraps the children of a component with a specified wrapper component or element. It takes children and a wrapper as arguments and returns the wrapped children.",
36
+ "description": "A hook that wraps child components with additional functionality or styling. It is useful for applying consistent behavior or appearance to a group of child components.",
40
37
  "hook": true,
41
- "params": "children: ReactNode, wrapper: ComponentType | string",
42
- "returns": "ReactNode",
43
- "sideEffect": false
38
+ "params": "children: ReactNode, wrapper: (child: ReactNode) => ReactNode",
39
+ "returns": "ReactNode"
44
40
  },
45
41
  "InjectableProps": {
46
42
  "type": "type",
47
- "description": "A TypeScript type that defines the shape of props that can be injected into a component, typically used for dependency injection or prop forwarding.",
43
+ "description": "An interface defining the props that can be injected into a component. It is used to specify the properties that can be dynamically added to a component.",
48
44
  "hook": false,
49
- "params": "Generic type extending React.PropsWithChildren",
45
+ "params": "N/A",
50
46
  "returns": "N/A"
51
47
  },
52
48
  "usePreferredTheme": {
53
49
  "type": "function",
54
- "description": "A hook that detects and returns the user's preferred color scheme (light or dark) based on the operating system or browser settings. It returns the current preferred theme.",
50
+ "description": "A hook that provides the user's preferred theme (light or dark) based on system preferences or user settings. It is useful for implementing theme-aware components.",
55
51
  "hook": true,
56
- "params": "none",
57
- "returns": "'light' | 'dark' | 'no-preference'",
58
- "sideEffect": false
52
+ "params": "N/A",
53
+ "returns": "String representing the preferred theme ('light' or 'dark')"
59
54
  },
60
55
  "PreferredTheme": {
61
56
  "type": "type",
62
- "description": "A TypeScript type that defines the possible values for a preferred theme, typically 'light', 'dark', or 'no-preference'.",
57
+ "description": "A type alias for the possible theme values ('light' or 'dark'). It is used to ensure type safety when working with theme-related values.",
63
58
  "hook": false,
64
59
  "params": "N/A",
65
- "returns": "'light' | 'dark' | 'no-preference'"
60
+ "returns": "N/A"
66
61
  },
67
62
  "useNetworkState": {
68
63
  "type": "function",
69
- "description": "React hook that returns the current network state of the browser, including connection type, effective connection type, and whether the device is online or offline. Useful for adapting application behavior based on network conditions, such as reducing data usage or showing offline indicators.",
64
+ "description": "React hook that returns the current network state of the device, including connection type, effective connection type, and whether the device is online or offline. It uses the browser's Network Information API to provide real-time updates when the network conditions change.",
70
65
  "hook": true,
71
- "params": "none",
72
- "returns": "NetworkState object with online, since, downlink, downlinkMax, effectiveType, rtt, type properties",
73
- "example": "const network = useNetworkState(); if (!network.online) { /* show offline message */ }"
66
+ "params": "options?: { refreshRate?: number }",
67
+ "returns": "NetworkState: { online: boolean, since: number, downlink: number, downlinkMax: number, effectiveType: EffectiveConnectionType, rtt: number, saveData: boolean, type: ConnectionType }",
68
+ "example": "const { online, type, effectiveType } = useNetworkState()"
74
69
  },
75
70
  "EffectiveConnectionType": {
76
71
  "type": "type",
77
- "description": "TypeScript type representing the effective connection type as defined by the Network Information API. Represents the effective connection type ('slow-2g', '2g', '3g', '4g') that the browser uses to optimize content delivery based on the user's network conditions.",
78
- "hook": false
72
+ "description": "TypeScript type representing the effective connection type as defined by the Network Information API. It includes values like 'slow-2g', '2g', '3g', '4g' that indicate the effective network speed the browser detects.",
73
+ "hook": false,
74
+ "example": "'slow-2g' | '2g' | '3g' | '4g'"
79
75
  },
80
76
  "ConnectionType": {
81
77
  "type": "type",
82
- "description": "TypeScript type representing the physical connection type of the device (e.g., 'wifi', 'cellular', 'ethernet', 'none', 'unknown'). Used to determine how the device is connected to the network, which can inform decisions about data usage and performance optimizations.",
83
- "hook": false
78
+ "description": "TypeScript type representing the connection type as defined by the Network Information API. It includes values like 'bluetooth', 'cellular', 'ethernet', 'wifi', 'wimax', 'none', 'unknown', 'other' that indicate the physical connection type.",
79
+ "hook": false,
80
+ "example": "'bluetooth' | 'cellular' | 'ethernet' | 'wifi' | 'wimax' | 'none' | 'unknown' | 'other'"
84
81
  },
85
82
  "NetworkState": {
86
83
  "type": "type",
87
- "description": "TypeScript interface defining the structure of network state information returned by useNetworkState hook. Includes properties like online (boolean), since (Date), downlink (number), downlinkMax (number), effectiveType (EffectiveConnectionType), rtt (number), and type (ConnectionType).",
88
- "hook": false
84
+ "description": "TypeScript type representing the complete network state object returned by useNetworkState hook. It includes online status, timestamps, bandwidth information, effective connection type, round-trip time, data saver status, and connection type.",
85
+ "hook": false,
86
+ "example": "{ online: boolean, since: number, downlink: number, downlinkMax: number, effectiveType: EffectiveConnectionType, rtt: number, saveData: boolean, type: ConnectionType }"
89
87
  },
90
88
  "useClipboard": {
91
89
  "type": "function",
92
- "description": "React hook that provides access to the system clipboard, allowing reading and writing of text content. Useful for implementing copy-to-clipboard functionality in components without requiring direct DOM manipulation or event handling.",
90
+ "description": "React hook that provides access to the system clipboard, allowing reading and writing of clipboard content. It returns an object with methods to read and write text to the clipboard, handling browser compatibility and permissions.",
93
91
  "hook": true,
94
92
  "params": "options?: UseClipboardOptions",
95
- "returns": "UseClipboardReturn object with read and write methods",
96
- "example": "const { write } = useClipboard(); write('Hello World');"
93
+ "returns": "UseClipboardReturn: { readText: () => Promise<string>, writeText: (text: string) => Promise<void> }",
94
+ "example": "const { readText, writeText } = useClipboard()"
97
95
  },
98
96
  "UseClipboardOptions": {
99
97
  "type": "type",
100
- "description": "TypeScript type defining optional configuration for the useClipboard hook, such as specifying the target element for clipboard operations or setting permissions for clipboard access.",
101
- "hook": false
98
+ "description": "TypeScript type representing the options object for the useClipboard hook. Currently it may include configuration options for clipboard behavior, though the exact properties depend on the implementation.",
99
+ "hook": false,
100
+ "example": "{}"
102
101
  },
103
102
  "UseClipboardReturn": {
104
103
  "type": "type",
105
- "description": "TypeScript interface defining the return value of useClipboard hook, which includes read and write methods for interacting with the system clipboard. The read method returns the current clipboard content as a string, while the write method sets new content to the clipboard.",
106
- "hook": false
104
+ "description": "TypeScript type representing the return value of the useClipboard hook. It includes readText and writeText methods that return promises for asynchronous clipboard operations.",
105
+ "hook": false,
106
+ "example": "{ readText: () => Promise<string>, writeText: (text: string) => Promise<void> }"
107
107
  },
108
108
  "useRageClick": {
109
109
  "type": "function",
110
- "description": "React hook that detects rapid, repeated clicking (rage clicking) on an element, typically indicating user frustration or confusion. Useful for identifying problematic UI elements that may need redesign or additional feedback to improve user experience.",
110
+ "description": "React hook that detects rapid, repeated clicks on an element, commonly known as rage clicks. It helps identify user frustration by tracking multiple clicks in quick succession and provides a callback when such behavior is detected.",
111
111
  "hook": true,
112
- "params": "options?: { threshold?: number, timeout?: number }",
113
- "returns": "{ isRageClicking: boolean, reset: () => void }",
114
- "example": "const { isRageClicking } = useRageClick(); if (isRageClicking) { /* show help tooltip */ }"
112
+ "params": "options?: { threshold?: number, timeWindow?: number, callback?: (event: MouseEvent) => void }",
113
+ "returns": "void",
114
+ "example": "useRageClick({ threshold: 3, timeWindow: 1000, callback: (event) => console.log('Rage click detected!') })"
115
115
  },
116
116
  "RageClickPayload": {
117
117
  "type": "type",
118
- "description": "TypeScript type defining the shape of a rage click event payload. Contains properties like target element, coordinates, and timestamp to identify rapid repeated clicks on the same element.",
119
- "hook": false,
120
- "params": "Optional: { target: Element, x: number, y: number, timestamp: number }",
121
- "returns": "N/A",
122
- "sideEffect": false
118
+ "description": "Interface describing the payload structure for rage click events, typically containing timestamp, element info, and click count. Used when tracking rapid repeated clicks for UX analysis or error reporting.",
119
+ "hook": false
123
120
  },
124
121
  "UseRageClickOptions": {
125
122
  "type": "type",
126
- "description": "TypeScript type defining configuration options for the useRageClick hook. Allows customizing detection threshold, debounce delay, and callback behavior for rage click detection.",
127
- "hook": false,
128
- "params": "Optional: { threshold?: number, debounce?: number, callback?: (payload: RageClickPayload) => void }",
129
- "returns": "N/A",
130
- "sideEffect": false
123
+ "description": "Configuration options for the useRageClick hook, including threshold for clicks per second, timeout duration, and callback handler. Allows customization of rage click detection sensitivity and behavior.",
124
+ "hook": false
131
125
  },
132
126
  "useThreadedWorker": {
133
127
  "type": "function",
134
- "description": "React hook that manages communication with a web worker thread. Enables offloading heavy computations to a separate thread while maintaining React state synchronization.",
128
+ "description": "Hook that creates and manages a Web Worker thread for offloading heavy computations or operations. Returns worker instance and control methods for communication and lifecycle management.",
135
129
  "hook": true,
136
130
  "params": "options: UseThreadedWorkerOptions",
137
131
  "returns": "UseThreadedWorkerReturn",
138
- "sideEffect": false,
139
- "example": "const { data, error, isLoading } = useThreadedWorker({ worker: myWorker, input: someData })"
132
+ "example": "const { worker, postMessage, terminate } = useThreadedWorker({ worker: myWorker });"
140
133
  },
141
134
  "ThreadedWorkerMode": {
142
135
  "type": "type",
143
- "description": "TypeScript enum defining operational modes for threaded workers. Specifies whether worker runs in dedicated, shared, or service worker context for different threading strategies.",
144
- "hook": false,
145
- "params": "Optional: { DEDICATED, SHARED, SERVICE_WORKER }",
146
- "returns": "N/A",
147
- "sideEffect": false
136
+ "description": "Enumeration defining worker modes: 'shared' for SharedWorker instances or 'dedicated' for standard Web Workers. Determines how worker threads are instantiated and shared across components.",
137
+ "hook": false
148
138
  },
149
139
  "UseThreadedWorkerOptions": {
150
140
  "type": "type",
151
- "description": "TypeScript type defining configuration options for useThreadedWorker hook. Includes worker instance, input data, transfer options, and error handling callbacks.",
152
- "hook": false,
153
- "params": "Optional: { worker: Worker, input?: any, transfer?: Transferable[], onError?: (error: Error) => void }",
154
- "returns": "N/A",
155
- "sideEffect": false
141
+ "description": "Configuration object for useThreadedWorker hook containing worker script URL or blob, mode selection, and optional initialization parameters. Defines how the worker thread should be created and configured.",
142
+ "hook": false
156
143
  },
157
144
  "RunOptions": {
158
145
  "type": "type",
159
- "description": "TypeScript type defining options for running threaded operations. Controls execution behavior like cancellation, timeout, and result handling for worker tasks.",
160
- "hook": false,
161
- "params": "Optional: { cancelable?: boolean, timeout?: number, onResult?: (result: any) => void }",
162
- "returns": "N/A",
163
- "sideEffect": false
146
+ "description": "Options object for controlling execution behavior of threaded operations, including timeout settings, retry logic, and error handling strategies. Used to customize how tasks run in worker threads.",
147
+ "hook": false
164
148
  },
165
149
  "UseThreadedWorkerReturn": {
166
150
  "type": "type",
167
- "description": "TypeScript type defining the return value shape from useThreadedWorker hook. Contains data, error state, loading status, and control methods for worker communication.",
168
- "hook": false,
169
- "params": "Optional: { data: any, error: Error | null, isLoading: boolean, cancel: () => void, postMessage: (message: any) => void }",
170
- "returns": "N/A",
171
- "sideEffect": false
151
+ "description": "Return type from useThreadedWorker hook containing worker instance, message posting method, event listeners, and cleanup functions. Provides complete interface for interacting with the managed worker thread.",
152
+ "hook": false
172
153
  },
173
154
  "useIndexedDB": {
174
155
  "type": "function",
175
- "description": "React hook providing simplified IndexedDB access with React state management. Enables reading and writing to IndexedDB with automatic change detection and error handling.",
156
+ "description": "Hook for managing IndexedDB database operations including opening connections, reading, writing, and deleting data. Provides reactive state management for database changes and error handling.",
176
157
  "hook": true,
177
- "params": "databaseName: string, storeName: string, options?: { version?: number, keyPath?: string }",
178
- "returns": "UseIndexedDBReturn",
179
- "sideEffect": false,
180
- "example": "const { data, error, isLoading, add, get } = useIndexedDB('myDB', 'store')"
158
+ "params": "dbName: string, options?: { version?: number, objectStores?: string[] }",
159
+ "returns": "{ db: IDBDatabase | null, error: Error | null, isOpen: boolean, close: () => void }",
160
+ "example": "const { db, isOpen, error } = useIndexedDB('myDatabase');"
181
161
  },
182
162
  "IndexedDBConfig": {
183
163
  "type": "type",
184
- "description": "Configuration object for setting up an IndexedDB connection, including database name, version, and optional upgrade callback. Used to customize the IndexedDB environment for use with the IDBController.",
164
+ "description": "Configuration object for IndexedDB operations, specifying database name, version, and store schema. Use when setting up persistent client-side storage with custom store structures.",
185
165
  "hook": false,
186
- "params": "{ name: string, version?: number, upgradeCallback?: (db: IDBDatabase) => void }",
187
- "returns": "None (type definition)",
188
- "sideEffect": false
166
+ "params": "{ dbName: string, version?: number, stores: { name: string, keyPath?: string, autoIncrement?: boolean }[] }"
189
167
  },
190
168
  "IDBController": {
191
169
  "type": "class",
192
- "description": "A class that manages IndexedDB connections and operations, providing methods to open, close, and interact with IndexedDB databases. Used for encapsulating IndexedDB logic and handling database lifecycle.",
170
+ "description": "Controller class managing IndexedDB instance lifecycle, providing methods to open, close, and interact with the database. Use when you need programmatic control over IndexedDB operations beyond basic hooks.",
193
171
  "hook": false,
194
- "params": "config: IndexedDBConfig",
195
- "returns": "Instance of IDBController",
196
- "sideEffect": false,
197
- "example": "const db = new IDBController({ name: 'my-db' })"
172
+ "params": "constructor(config: IndexedDBConfig)",
173
+ "returns": "IDBController instance with open(), close(), getStore(), and transaction methods"
198
174
  },
199
175
  "UseIndexedDBReturn": {
200
176
  "type": "type",
201
- "description": "Return type for the useIndexedDB hook, containing the database instance and a loading/error state. Used to provide the current IndexedDB state and data to React components.",
177
+ "description": "Return type from useIndexedDB hook containing database instance, store references, and utility methods. Use to access structured data operations and transaction capabilities within React components.",
202
178
  "hook": false,
203
- "params": "{ db: IDBDatabase | null, loading: boolean, error: Error | null }",
204
- "returns": "None (type definition)",
205
- "sideEffect": false
179
+ "params": "{ db: IDBDatabase, stores: Record<string, IDBObjectStore>, transaction: (stores: string[], mode?: IDBTransactionMode) => IDBTransaction }"
206
180
  },
207
181
  "useWebRTCIP": {
208
182
  "type": "function",
209
- "description": "A React hook that retrieves the local IP address using WebRTC by creating a peer connection and extracting the IP from ICE candidates. Used for obtaining the client's IP address in a browser environment.",
183
+ "description": "Hook that retrieves local WebRTC IP addresses by creating a peer connection and parsing ICE candidates. Use when you need to detect client IP addresses for WebRTC signaling or network diagnostics.",
210
184
  "hook": true,
211
185
  "params": "options?: UseWebRTCIPOptions",
212
- "returns": "UseWebRTCIPReturn",
213
- "sideEffect": false,
214
- "example": "const { ip, loading, error } = useWebRTCIP()"
186
+ "returns": "UseWebRTCIPReturn containing ipAddresses: string[] and loading: boolean"
215
187
  },
216
188
  "UseWebRTCIPOptions": {
217
189
  "type": "type",
218
- "description": "Options object for configuring the useWebRTCIP hook, such as disabling IPv6 or setting a timeout. Used to customize the behavior of the WebRTC IP discovery process.",
190
+ "description": "Configuration options for useWebRTCIP hook, allowing customization of timeout duration and STUN/TURN server configuration. Use to control how long the hook waits for ICE gathering and which servers to use.",
219
191
  "hook": false,
220
- "params": "{ disableIPv6?: boolean, timeout?: number }",
221
- "returns": "None (type definition)",
222
- "sideEffect": false
192
+ "params": "{ timeout?: number, iceServers?: RTCIceServer[] }"
223
193
  },
224
194
  "UseWebRTCIPReturn": {
225
195
  "type": "type",
226
- "description": "Return type for the useWebRTCIP hook, containing the discovered IP address and loading/error state. Used to provide the WebRTC IP discovery result to React components.",
196
+ "description": "Return object from useWebRTCIP hook containing detected IP addresses and loading state. Use to access the gathered IP addresses and determine when the operation is complete.",
227
197
  "hook": false,
228
- "params": "{ ip: string | null, loading: boolean, error: Error | null }",
229
- "returns": "None (type definition)",
230
- "sideEffect": false
198
+ "params": "{ ipAddresses: string[], loading: boolean }"
231
199
  },
232
200
  "useWasmCompute": {
233
201
  "type": "function",
234
- "description": "A React hook that loads and executes WebAssembly modules for computationally intensive tasks, providing a way to run WASM code in the browser. Used for offloading heavy computations to WASM for performance gains.",
202
+ "description": "Hook that loads and executes WebAssembly modules for high-performance computation in the browser. Use when you need to run CPU-intensive tasks like image processing, cryptography, or numerical computations without blocking the main thread.",
235
203
  "hook": true,
236
204
  "params": "options: UseWasmComputeOptions",
237
- "returns": "function that executes the WASM module with input data",
238
- "sideEffect": false,
239
- "example": "const compute = useWasmCompute({ modulePath: '/compute.wasm' }); const result = compute(inputData)"
205
+ "returns": "Promise resolving to Wasm module instance with exported functions"
240
206
  },
241
207
  "UseWasmComputeOptions": {
242
208
  "type": "type",
243
- "description": "Options object for configuring the useWasmCompute hook, including the path to the WASM module and optional initialization parameters. Used to specify which WASM module to load and how to initialize it.",
209
+ "description": "Configuration object for useWasmCompute hook specifying WASM module source, imports, and execution parameters. Use to configure memory limits, import objects, and execution environment for WebAssembly modules.",
244
210
  "hook": false,
245
- "params": "{ modulePath: string, initParams?: any }",
246
- "returns": "None (type definition)",
247
- "sideEffect": false
211
+ "params": "{ moduleUrl: string, imports?: Record<string, any>, memorySize?: number }"
248
212
  },
249
213
  "UseWasmComputeReturn": {
250
214
  "type": "type",
251
- "description": "Type definition for the return value of Wasm compute functions, typically containing status and result fields.",
252
- "hook": false,
253
- "params": "N/A",
254
- "returns": "N/A"
215
+ "description": "Type definition for the return value of a WASM compute function. Represents the structured result of a WebAssembly-based computation, typically containing status, data, and error information.",
216
+ "hook": false
255
217
  },
256
218
  "useWorkerNotifications": {
257
219
  "type": "function",
258
- "description": "React hook that subscribes to worker notifications and manages their lifecycle within a component.",
220
+ "description": "React hook that subscribes to notifications from a Web Worker. Provides real-time updates from background processing tasks, allowing components to react to worker events without manual event listener management.",
259
221
  "hook": true,
260
222
  "params": "options: UseWorkerNotificationsOptions",
261
223
  "returns": "UseWorkerNotificationsReturn",
262
- "example": "const { notifications, error } = useWorkerNotifications({ worker: myWorker });"
224
+ "example": "const { notifications, error } = useWorkerNotifications({ worker: myWorker })"
263
225
  },
264
226
  "WorkerEventType": {
265
227
  "type": "type",
266
- "description": "Enumeration type defining the different types of events that can be emitted by a worker.",
267
- "hook": false,
268
- "params": "N/A",
269
- "returns": "N/A"
228
+ "description": "Enumeration of possible event types that can be emitted by a Web Worker. Defines the standard set of notification categories for worker-to-main-thread communication, enabling type-safe event handling.",
229
+ "hook": false
270
230
  },
271
231
  "WorkerNotificationEvent": {
272
232
  "type": "type",
273
- "description": "Type definition for worker notification events, containing event data and metadata.",
274
- "hook": false,
275
- "params": "N/A",
276
- "returns": "N/A"
233
+ "description": "Type definition for a worker notification event object. Contains metadata about a specific event from a Web Worker, including type, timestamp, and payload data for structured communication.",
234
+ "hook": false
277
235
  },
278
236
  "UseWorkerNotificationsOptions": {
279
237
  "type": "type",
280
- "description": "Configuration options for the useWorkerNotifications hook, including worker instance and event filters.",
281
- "hook": false,
282
- "params": "N/A",
283
- "returns": "N/A"
238
+ "description": "Configuration object type for the useWorkerNotifications hook. Specifies parameters like the worker instance, event filters, and optional callback handlers for customizing notification subscription behavior.",
239
+ "hook": false
284
240
  },
285
241
  "UseWorkerNotificationsReturn": {
286
242
  "type": "type",
287
- "description": "Return type for useWorkerNotifications hook, providing notifications array and error state.",
288
- "hook": false,
289
- "params": "N/A",
290
- "returns": "N/A"
243
+ "description": "Return type for the useWorkerNotifications hook. Provides an object containing the current notifications array, error state, and optional methods for managing the subscription to worker events.",
244
+ "hook": false
291
245
  },
292
246
  "useLLMMetadata": {
293
247
  "type": "function",
294
- "description": "React hook for fetching and managing LLM metadata within a component's lifecycle.",
248
+ "description": "React hook that retrieves metadata about the underlying LLVM/WebAssembly compilation environment. Provides information about the current runtime capabilities, version, and available features for debugging and optimization.",
295
249
  "hook": true,
296
- "params": "options?: { modelId?: string }",
297
- "returns": "{ metadata: LLMData | null, loading: boolean, error: Error | null }",
298
- "example": "const { metadata, loading } = useLLMMetadata({ modelId: 'gpt-4' });"
250
+ "returns": "object containing metadata properties",
251
+ "example": "const metadata = useLLMMetadata()"
299
252
  },
300
253
  "OGType": {
301
254
  "type": "type",
302
- "description": "Type definition for Open Graph metadata types used in social media sharing.",
303
- "hook": false,
304
- "params": "N/A",
305
- "returns": "N/A"
255
+ "description": "Type definition for Open Graph metadata types. Represents the standardized vocabulary for social media sharing metadata, used to control how content appears when shared on platforms like Facebook and Twitter.",
256
+ "hook": false
306
257
  },
307
258
  "LLMConfig": {
308
259
  "type": "type",
309
- "description": "Configuration object type for LLM integrations, defining required settings like model, API key, and optional parameters. Used to initialize and configure LLM client instances with consistent type safety.",
260
+ "description": "Configuration object for setting up an LLM client, including model details, API keys, and connection parameters. Use this to define how the LLM should behave and connect.",
310
261
  "hook": false,
311
- "params": "{ model: string, apiKey: string, temperature?: number, maxTokens?: number }",
312
- "returns": "LLMConfig object with typed properties for LLM initialization"
262
+ "params": "Optional: { model: string, apiKey: string, endpoint: string, temperature?: number, maxTokens?: number }",
263
+ "returns": "A typed configuration object for LLM initialization",
264
+ "sideEffect": false,
265
+ "example": "const config: LLMConfig = { model: 'gpt-4', apiKey: 'your-key', endpoint: 'https://api.openai.com/v1' }"
313
266
  },
314
267
  "LLMPayload": {
315
268
  "type": "type",
316
- "description": "Payload type for LLM requests, encapsulating the user message and optional context for AI model interactions. Used to structure input data sent to LLM endpoints for processing and response generation.",
269
+ "description": "Payload structure for sending requests to an LLM, containing the prompt, conversation context, and optional parameters. Use this to format data sent to the LLM service.",
317
270
  "hook": false,
318
- "params": "{ message: string, context?: string[] }",
319
- "returns": "LLMPayload object containing message and optional context array for LLM processing"
271
+ "params": "Optional: { prompt: string, messages?: Message[], temperature?: number, maxTokens?: number, stream?: boolean }",
272
+ "returns": "A typed payload object for LLM requests",
273
+ "sideEffect": false,
274
+ "example": "const payload: LLMPayload = { prompt: 'Translate to French:', messages: [{ role: 'user', content: 'Hello world' }] }"
320
275
  }
321
276
  },
322
277
  "hooks": [
package/llm.package.txt CHANGED
@@ -1,5 +1,5 @@
1
1
  Package: preact-missing-hooks
2
- Version: 4.1.0
2
+ Version: 4.2.0
3
3
 
4
4
  Description:
5
5
  A lightweight, extendable collection of missing React-like hooks for Preact — plus fresh, powerful new ones designed specifically for modern Preact apps.
@@ -40,48 +40,48 @@ Related packages:
40
40
  preact, react, react-hooks, preact/hooks
41
41
 
42
42
  Exports:
43
- - ConnectionType : TypeScript type representing the physical connection type of the device (e.g., 'wifi', 'cellular', 'ethernet', 'none', 'unknown'). Used to determine how the device is connected to the network, which can inform decisions about data usage and performance optimizations.
44
- - EffectiveConnectionType : TypeScript type representing the effective connection type as defined by the Network Information API. Represents the effective connection type ('slow-2g', '2g', '3g', '4g') that the browser uses to optimize content delivery based on the user's network conditions.
45
- - IDBController : A class that manages IndexedDB connections and operations, providing methods to open, close, and interact with IndexedDB databases. Used for encapsulating IndexedDB logic and handling database lifecycle. — params: config: IndexedDBConfig — returns: Instance of IDBController e.g. const db = new IDBController({ name: 'my-db' })
46
- - IndexedDBConfig : Configuration object for setting up an IndexedDB connection, including database name, version, and optional upgrade callback. Used to customize the IndexedDB environment for use with the IDBController. — params: { name: string, version?: number, upgradeCallback?: (db: IDBDatabase) => void } returns: None (type definition)
47
- - InjectableProps : A TypeScript type that defines the shape of props that can be injected into a component, typically used for dependency injection or prop forwarding. params: Generic type extending React.PropsWithChildren — returns: N/A
48
- - LLMConfig : Configuration object type for LLM integrations, defining required settings like model, API key, and optional parameters. Used to initialize and configure LLM client instances with consistent type safety. — params: { model: string, apiKey: string, temperature?: number, maxTokens?: number } — returns: LLMConfig object with typed properties for LLM initialization
49
- - LLMPayload : Payload type for LLM requests, encapsulating the user message and optional context for AI model interactions. Used to structure input data sent to LLM endpoints for processing and response generation. — params: { message: string, context?: string[] } — returns: LLMPayload object containing message and optional context array for LLM processing
50
- - NetworkState : TypeScript interface defining the structure of network state information returned by useNetworkState hook. Includes properties like online (boolean), since (Date), downlink (number), downlinkMax (number), effectiveType (EffectiveConnectionType), rtt (number), and type (ConnectionType).
51
- - OGType : Type definition for Open Graph metadata types used in social media sharing. params: N/A returns: N/A
52
- - PreferredTheme : A TypeScript type that defines the possible values for a preferred theme, typically 'light', 'dark', or 'no-preference'. — params: N/A — returns: 'light' | 'dark' | 'no-preference'
53
- - RageClickPayload : TypeScript type defining the shape of a rage click event payload. Contains properties like target element, coordinates, and timestamp to identify rapid repeated clicks on the same element. params: Optional: { target: Element, x: number, y: number, timestamp: number } — returns: N/A
54
- - RunOptions : TypeScript type defining options for running threaded operations. Controls execution behavior like cancellation, timeout, and result handling for worker tasks. params: Optional: { cancelable?: boolean, timeout?: number, onResult?: (result: any) => void } — returns: N/A
55
- - ThreadedWorkerMode : TypeScript enum defining operational modes for threaded workers. Specifies whether worker runs in dedicated, shared, or service worker context for different threading strategies. params: Optional: { DEDICATED, SHARED, SERVICE_WORKER } returns: N/A
56
- - useClipboard (Hook) : React hook that provides access to the system clipboard, allowing reading and writing of text content. Useful for implementing copy-to-clipboard functionality in components without requiring direct DOM manipulation or event handling. — params: options?: UseClipboardOptions — returns: UseClipboardReturn object with read and write methods — e.g. const { write } = useClipboard(); write('Hello World');
57
- - UseClipboardOptions : TypeScript type defining optional configuration for the useClipboard hook, such as specifying the target element for clipboard operations or setting permissions for clipboard access.
58
- - UseClipboardReturn : TypeScript interface defining the return value of useClipboard hook, which includes read and write methods for interacting with the system clipboard. The read method returns the current clipboard content as a string, while the write method sets new content to the clipboard.
59
- - useEventBus (Hook) : A hook that provides access to a global event bus for publishing and subscribing to events across components. It returns an object with methods to subscribe, unsubscribe, and publish events. — params: none — returns: { subscribe: (event: string, callback: Function) => void, unsubscribe: (event: string, callback: Function) => void, publish: (event: string, data: any) => void }
60
- - useIndexedDB (Hook) : React hook providing simplified IndexedDB access with React state management. Enables reading and writing to IndexedDB with automatic change detection and error handling. — params: databaseName: string, storeName: string, options?: { version?: number, keyPath?: string } — returns: UseIndexedDBReturn — e.g. const { data, error, isLoading, add, get } = useIndexedDB('myDB', 'store')
61
- - UseIndexedDBReturn : Return type for the useIndexedDB hook, containing the database instance and a loading/error state. Used to provide the current IndexedDB state and data to React components. — params: { db: IDBDatabase | null, loading: boolean, error: Error | null } returns: None (type definition)
62
- - useLLMMetadata (Hook) : React hook for fetching and managing LLM metadata within a component's lifecycle. params: options?: { modelId?: string } returns: { metadata: LLMData | null, loading: boolean, error: Error | null } — e.g. const { metadata, loading } = useLLMMetadata({ modelId: 'gpt-4' });
63
- - useMutationObserver (Hook) : A hook that creates and manages a MutationObserver to watch for changes in the DOM. It accepts a target element and a callback to execute when mutations are observed, returning a ref to attach to the target element. — params: target: Element | null, callback: MutationCallback, options?: MutationObserverInit — returns: ref: { current: Element | null }
64
- - UseMutationObserverOptions : A TypeScript type defining the options object for the useMutationObserver hook, extending MutationObserverInit to include optional configuration for observing DOM mutations. — params: extends MutationObserverInit — returns: N/A
65
- - useNetworkState (Hook) : React hook that returns the current network state of the browser, including connection type, effective connection type, and whether the device is online or offline. Useful for adapting application behavior based on network conditions, such as reducing data usage or showing offline indicators. — params: none — returns: NetworkState object with online, since, downlink, downlinkMax, effectiveType, rtt, type properties — e.g. const network = useNetworkState(); if (!network.online) { /* show offline message */ }
66
- - usePreferredTheme (Hook) : A hook that detects and returns the user's preferred color scheme (light or dark) based on the operating system or browser settings. It returns the current preferred theme. — params: none — returns: 'light' | 'dark' | 'no-preference'
67
- - useRageClick (Hook) : React hook that detects rapid, repeated clicking (rage clicking) on an element, typically indicating user frustration or confusion. Useful for identifying problematic UI elements that may need redesign or additional feedback to improve user experience. — params: options?: { threshold?: number, timeout?: number } — returns: { isRageClicking: boolean, reset: () => void } — e.g. const { isRageClicking } = useRageClick(); if (isRageClicking) { /* show help tooltip */ }
68
- - UseRageClickOptions : TypeScript type defining configuration options for the useRageClick hook. Allows customizing detection threshold, debounce delay, and callback behavior for rage click detection. params: Optional: { threshold?: number, debounce?: number, callback?: (payload: RageClickPayload) => void } — returns: N/A
69
- - useThreadedWorker (Hook) : React hook that manages communication with a web worker thread. Enables offloading heavy computations to a separate thread while maintaining React state synchronization. — params: options: UseThreadedWorkerOptions — returns: UseThreadedWorkerReturn — e.g. const { data, error, isLoading } = useThreadedWorker({ worker: myWorker, input: someData })
70
- - UseThreadedWorkerOptions : TypeScript type defining configuration options for useThreadedWorker hook. Includes worker instance, input data, transfer options, and error handling callbacks. params: Optional: { worker: Worker, input?: any, transfer?: Transferable[], onError?: (error: Error) => void } — returns: N/A
71
- - UseThreadedWorkerReturn : TypeScript type defining the return value shape from useThreadedWorker hook. Contains data, error state, loading status, and control methods for worker communication. — params: Optional: { data: any, error: Error | null, isLoading: boolean, cancel: () => void, postMessage: (message: any) => void } returns: N/A
72
- - useTransition (Hook) : A custom hook that wraps React's useTransition API, providing a way to mark updates as transitions to allow the browser to prioritize updates. It returns a tuple containing a boolean indicating if the transition is pending and a startTransition function to wrap state updates. — params: config?: { timeoutMs?: number } — returns: [isPending: boolean, startTransition: (callback: () => void) => void]
73
- - useWasmCompute (Hook) : A React hook that loads and executes WebAssembly modules for computationally intensive tasks, providing a way to run WASM code in the browser. Used for offloading heavy computations to WASM for performance gains. — params: options: UseWasmComputeOptions — returns: function that executes the WASM module with input data — e.g. const compute = useWasmCompute({ modulePath: '/compute.wasm' }); const result = compute(inputData)
74
- - UseWasmComputeOptions : Options object for configuring the useWasmCompute hook, including the path to the WASM module and optional initialization parameters. Used to specify which WASM module to load and how to initialize it. — params: { modulePath: string, initParams?: any } returns: None (type definition)
75
- - UseWasmComputeReturn : Type definition for the return value of Wasm compute functions, typically containing status and result fields. — params: N/A — returns: N/A
76
- - useWebRTCIP (Hook) : A React hook that retrieves the local IP address using WebRTC by creating a peer connection and extracting the IP from ICE candidates. Used for obtaining the client's IP address in a browser environment. — params: options?: UseWebRTCIPOptions — returns: UseWebRTCIPReturn e.g. const { ip, loading, error } = useWebRTCIP()
77
- - UseWebRTCIPOptions : Options object for configuring the useWebRTCIP hook, such as disabling IPv6 or setting a timeout. Used to customize the behavior of the WebRTC IP discovery process. — params: { disableIPv6?: boolean, timeout?: number } — returns: None (type definition)
78
- - UseWebRTCIPReturn : Return type for the useWebRTCIP hook, containing the discovered IP address and loading/error state. Used to provide the WebRTC IP discovery result to React components. — params: { ip: string | null, loading: boolean, error: Error | null } — returns: None (type definition)
79
- - useWorkerNotifications (Hook) : React hook that subscribes to worker notifications and manages their lifecycle within a component. — params: options: UseWorkerNotificationsOptions — returns: UseWorkerNotificationsReturn — e.g. const { notifications, error } = useWorkerNotifications({ worker: myWorker });
80
- - UseWorkerNotificationsOptions : Configuration options for the useWorkerNotifications hook, including worker instance and event filters. params: N/A returns: N/A
81
- - UseWorkerNotificationsReturn : Return type for useWorkerNotifications hook, providing notifications array and error state. params: N/A returns: N/A
82
- - useWrappedChildren (Hook) : A hook that wraps the children of a component with a specified wrapper component or element. It takes children and a wrapper as arguments and returns the wrapped children. — params: children: ReactNode, wrapper: ComponentType | string — returns: ReactNode
83
- - WorkerEventType : Enumeration type defining the different types of events that can be emitted by a worker. params: N/A returns: N/A
84
- - WorkerNotificationEvent : Type definition for worker notification events, containing event data and metadata. params: N/A returns: N/A
43
+ - ConnectionType : TypeScript type representing the connection type as defined by the Network Information API. It includes values like 'bluetooth', 'cellular', 'ethernet', 'wifi', 'wimax', 'none', 'unknown', 'other' that indicate the physical connection type. e.g. 'bluetooth' | 'cellular' | 'ethernet' | 'wifi' | 'wimax' | 'none' | 'unknown' | 'other'
44
+ - EffectiveConnectionType : TypeScript type representing the effective connection type as defined by the Network Information API. It includes values like 'slow-2g', '2g', '3g', '4g' that indicate the effective network speed the browser detects. e.g. 'slow-2g' | '2g' | '3g' | '4g'
45
+ - IDBController : Controller class managing IndexedDB instance lifecycle, providing methods to open, close, and interact with the database. Use when you need programmatic control over IndexedDB operations beyond basic hooks. — params: constructor(config: IndexedDBConfig) — returns: IDBController instance with open(), close(), getStore(), and transaction methods
46
+ - IndexedDBConfig : Configuration object for IndexedDB operations, specifying database name, version, and store schema. Use when setting up persistent client-side storage with custom store structures. — params: { dbName: string, version?: number, stores: { name: string, keyPath?: string, autoIncrement?: boolean }[] }
47
+ - InjectableProps : An interface defining the props that can be injected into a component. It is used to specify the properties that can be dynamically added to a component. — params: N/A — returns: N/A
48
+ - LLMConfig : Configuration object for setting up an LLM client, including model details, API keys, and connection parameters. Use this to define how the LLM should behave and connect. — params: Optional: { model: string, apiKey: string, endpoint: string, temperature?: number, maxTokens?: number } — returns: A typed configuration object for LLM initialization — e.g. const config: LLMConfig = { model: 'gpt-4', apiKey: 'your-key', endpoint: 'https://api.openai.com/v1' }
49
+ - LLMPayload : Payload structure for sending requests to an LLM, containing the prompt, conversation context, and optional parameters. Use this to format data sent to the LLM service. — params: Optional: { prompt: string, messages?: Message[], temperature?: number, maxTokens?: number, stream?: boolean } — returns: A typed payload object for LLM requests e.g. const payload: LLMPayload = { prompt: 'Translate to French:', messages: [{ role: 'user', content: 'Hello world' }] }
50
+ - NetworkState : TypeScript type representing the complete network state object returned by useNetworkState hook. It includes online status, timestamps, bandwidth information, effective connection type, round-trip time, data saver status, and connection type. — e.g. { online: boolean, since: number, downlink: number, downlinkMax: number, effectiveType: EffectiveConnectionType, rtt: number, saveData: boolean, type: ConnectionType }
51
+ - OGType : Type definition for Open Graph metadata types. Represents the standardized vocabulary for social media sharing metadata, used to control how content appears when shared on platforms like Facebook and Twitter.
52
+ - PreferredTheme : A type alias for the possible theme values ('light' or 'dark'). It is used to ensure type safety when working with theme-related values. — params: N/A — returns: N/A
53
+ - RageClickPayload : Interface describing the payload structure for rage click events, typically containing timestamp, element info, and click count. Used when tracking rapid repeated clicks for UX analysis or error reporting.
54
+ - RunOptions : Options object for controlling execution behavior of threaded operations, including timeout settings, retry logic, and error handling strategies. Used to customize how tasks run in worker threads.
55
+ - ThreadedWorkerMode : Enumeration defining worker modes: 'shared' for SharedWorker instances or 'dedicated' for standard Web Workers. Determines how worker threads are instantiated and shared across components.
56
+ - useClipboard (Hook) : React hook that provides access to the system clipboard, allowing reading and writing of clipboard content. It returns an object with methods to read and write text to the clipboard, handling browser compatibility and permissions. — params: options?: UseClipboardOptions — returns: UseClipboardReturn: { readText: () => Promise<string>, writeText: (text: string) => Promise<void> } — e.g. const { readText, writeText } = useClipboard()
57
+ - UseClipboardOptions : TypeScript type representing the options object for the useClipboard hook. Currently it may include configuration options for clipboard behavior, though the exact properties depend on the implementation. — e.g. {}
58
+ - UseClipboardReturn : TypeScript type representing the return value of the useClipboard hook. It includes readText and writeText methods that return promises for asynchronous clipboard operations. e.g. { readText: () => Promise<string>, writeText: (text: string) => Promise<void> }
59
+ - useEventBus (Hook) : A hook that provides a simple event bus for component communication. It allows components to emit and listen to events without prop drilling. — params: N/A — returns: Object with emit and on methods for event handling
60
+ - useIndexedDB (Hook) : Hook for managing IndexedDB database operations including opening connections, reading, writing, and deleting data. Provides reactive state management for database changes and error handling. — params: dbName: string, options?: { version?: number, objectStores?: string[] } — returns: { db: IDBDatabase | null, error: Error | null, isOpen: boolean, close: () => void } — e.g. const { db, isOpen, error } = useIndexedDB('myDatabase');
61
+ - UseIndexedDBReturn : Return type from useIndexedDB hook containing database instance, store references, and utility methods. Use to access structured data operations and transaction capabilities within React components. — params: { db: IDBDatabase, stores: Record<string, IDBObjectStore>, transaction: (stores: string[], mode?: IDBTransactionMode) => IDBTransaction }
62
+ - useLLMMetadata (Hook) : React hook that retrieves metadata about the underlying LLVM/WebAssembly compilation environment. Provides information about the current runtime capabilities, version, and available features for debugging and optimization. returns: object containing metadata properties — e.g. const metadata = useLLMMetadata()
63
+ - useMutationObserver (Hook) : A hook that observes DOM mutations on a given element and calls a callback when mutations occur. It is useful for reacting to changes in the DOM structure or attributes. — params: element: Element, callback: (mutations: MutationRecord[]) => void, options?: MutationObserverInit — returns: void
64
+ - UseMutationObserverOptions : An interface defining the options for the useMutationObserver hook. It extends MutationObserverInit and includes additional properties specific to the hook. — params: N/A — returns: N/A
65
+ - useNetworkState (Hook) : React hook that returns the current network state of the device, including connection type, effective connection type, and whether the device is online or offline. It uses the browser's Network Information API to provide real-time updates when the network conditions change. — params: options?: { refreshRate?: number } — returns: NetworkState: { online: boolean, since: number, downlink: number, downlinkMax: number, effectiveType: EffectiveConnectionType, rtt: number, saveData: boolean, type: ConnectionType } — e.g. const { online, type, effectiveType } = useNetworkState()
66
+ - usePreferredTheme (Hook) : A hook that provides the user's preferred theme (light or dark) based on system preferences or user settings. It is useful for implementing theme-aware components. — params: N/A — returns: String representing the preferred theme ('light' or 'dark')
67
+ - useRageClick (Hook) : React hook that detects rapid, repeated clicks on an element, commonly known as rage clicks. It helps identify user frustration by tracking multiple clicks in quick succession and provides a callback when such behavior is detected. — params: options?: { threshold?: number, timeWindow?: number, callback?: (event: MouseEvent) => void } — returns: void — e.g. useRageClick({ threshold: 3, timeWindow: 1000, callback: (event) => console.log('Rage click detected!') })
68
+ - UseRageClickOptions : Configuration options for the useRageClick hook, including threshold for clicks per second, timeout duration, and callback handler. Allows customization of rage click detection sensitivity and behavior.
69
+ - useThreadedWorker (Hook) : Hook that creates and manages a Web Worker thread for offloading heavy computations or operations. Returns worker instance and control methods for communication and lifecycle management. — params: options: UseThreadedWorkerOptions — returns: UseThreadedWorkerReturn — e.g. const { worker, postMessage, terminate } = useThreadedWorker({ worker: myWorker });
70
+ - UseThreadedWorkerOptions : Configuration object for useThreadedWorker hook containing worker script URL or blob, mode selection, and optional initialization parameters. Defines how the worker thread should be created and configured.
71
+ - UseThreadedWorkerReturn : Return type from useThreadedWorker hook containing worker instance, message posting method, event listeners, and cleanup functions. Provides complete interface for interacting with the managed worker thread.
72
+ - useTransition (Hook) : A hook that provides a transition state and a function to start a transition. It is used to defer non-urgent updates to avoid blocking the UI during high-priority updates. — params: options?: { timeoutMs?: number } — returns: Array containing a boolean indicating if a transition is in progress and a function to start a transition
73
+ - useWasmCompute (Hook) : Hook that loads and executes WebAssembly modules for high-performance computation in the browser. Use when you need to run CPU-intensive tasks like image processing, cryptography, or numerical computations without blocking the main thread. — params: options: UseWasmComputeOptions — returns: Promise resolving to Wasm module instance with exported functions
74
+ - UseWasmComputeOptions : Configuration object for useWasmCompute hook specifying WASM module source, imports, and execution parameters. Use to configure memory limits, import objects, and execution environment for WebAssembly modules. — params: { moduleUrl: string, imports?: Record<string, any>, memorySize?: number }
75
+ - UseWasmComputeReturn : Type definition for the return value of a WASM compute function. Represents the structured result of a WebAssembly-based computation, typically containing status, data, and error information.
76
+ - useWebRTCIP (Hook) : Hook that retrieves local WebRTC IP addresses by creating a peer connection and parsing ICE candidates. Use when you need to detect client IP addresses for WebRTC signaling or network diagnostics. — params: options?: UseWebRTCIPOptions — returns: UseWebRTCIPReturn containing ipAddresses: string[] and loading: boolean
77
+ - UseWebRTCIPOptions : Configuration options for useWebRTCIP hook, allowing customization of timeout duration and STUN/TURN server configuration. Use to control how long the hook waits for ICE gathering and which servers to use. — params: { timeout?: number, iceServers?: RTCIceServer[] }
78
+ - UseWebRTCIPReturn : Return object from useWebRTCIP hook containing detected IP addresses and loading state. Use to access the gathered IP addresses and determine when the operation is complete. — params: { ipAddresses: string[], loading: boolean }
79
+ - useWorkerNotifications (Hook) : React hook that subscribes to notifications from a Web Worker. Provides real-time updates from background processing tasks, allowing components to react to worker events without manual event listener management. — params: options: UseWorkerNotificationsOptions — returns: UseWorkerNotificationsReturn — e.g. const { notifications, error } = useWorkerNotifications({ worker: myWorker })
80
+ - UseWorkerNotificationsOptions : Configuration object type for the useWorkerNotifications hook. Specifies parameters like the worker instance, event filters, and optional callback handlers for customizing notification subscription behavior.
81
+ - UseWorkerNotificationsReturn : Return type for the useWorkerNotifications hook. Provides an object containing the current notifications array, error state, and optional methods for managing the subscription to worker events.
82
+ - useWrappedChildren (Hook) : A hook that wraps child components with additional functionality or styling. It is useful for applying consistent behavior or appearance to a group of child components. — params: children: ReactNode, wrapper: (child: ReactNode) => ReactNode — returns: ReactNode
83
+ - WorkerEventType : Enumeration of possible event types that can be emitted by a Web Worker. Defines the standard set of notification categories for worker-to-main-thread communication, enabling type-safe event handling.
84
+ - WorkerNotificationEvent : Type definition for a worker notification event object. Contains metadata about a specific event from a Web Worker, including type, timestamp, and payload data for structured communication.
85
85
 
86
86
  Hooks:
87
87
  - useTransition
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "preact-missing-hooks",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
4
4
  "description": "A lightweight, extendable collection of missing React-like hooks for Preact — plus fresh, powerful new ones designed specifically for modern Preact apps.",
5
5
  "author": "Prakhar Dubey",
6
6
  "license": "MIT",
@@ -144,7 +144,7 @@
144
144
  ],
145
145
  "repository": {
146
146
  "type": "git",
147
- "url": "https://github.com/prakhardubey2002/Preact-Missing-Hooks"
147
+ "url": "git+https://github.com/prakhardubey2002/Preact-Missing-Hooks.git"
148
148
  },
149
149
  "dependencies": {
150
150
  "preact": ">=10.0.0"