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 +110 -155
- package/llm.package.txt +43 -43
- package/package.json +2 -2
package/llm.package.json
CHANGED
|
@@ -1,322 +1,277 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "preact-missing-hooks",
|
|
3
|
-
"version": "4.
|
|
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
|
|
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": "
|
|
11
|
-
"returns": "
|
|
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
|
|
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": "
|
|
19
|
-
"returns": "
|
|
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": "
|
|
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": "
|
|
24
|
+
"params": "N/A",
|
|
27
25
|
"returns": "N/A"
|
|
28
26
|
},
|
|
29
27
|
"useEventBus": {
|
|
30
28
|
"type": "function",
|
|
31
|
-
"description": "A hook that provides
|
|
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": "
|
|
34
|
-
"returns": "
|
|
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
|
|
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:
|
|
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": "
|
|
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": "
|
|
45
|
+
"params": "N/A",
|
|
50
46
|
"returns": "N/A"
|
|
51
47
|
},
|
|
52
48
|
"usePreferredTheme": {
|
|
53
49
|
"type": "function",
|
|
54
|
-
"description": "A hook that
|
|
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": "
|
|
57
|
-
"returns": "'light'
|
|
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
|
|
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": "
|
|
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
|
|
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": "
|
|
72
|
-
"returns": "NetworkState
|
|
73
|
-
"example": "const
|
|
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.
|
|
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
|
|
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
|
|
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
|
|
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
|
|
96
|
-
"example": "const {
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
113
|
-
"returns": "
|
|
114
|
-
"example": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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
|
-
"
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
178
|
-
"returns": "
|
|
179
|
-
"
|
|
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
|
|
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": "{
|
|
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": "
|
|
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": "
|
|
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
|
|
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
|
|
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": "
|
|
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": "
|
|
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": "{
|
|
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
|
|
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": "{
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "{
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
"
|
|
297
|
-
"
|
|
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
|
|
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
|
|
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": "
|
|
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
|
|
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": "{
|
|
319
|
-
"returns": "
|
|
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.
|
|
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
|
|
44
|
-
- EffectiveConnectionType : TypeScript type representing the effective connection type as defined by the Network Information API.
|
|
45
|
-
- IDBController :
|
|
46
|
-
- IndexedDBConfig : Configuration object for
|
|
47
|
-
- InjectableProps :
|
|
48
|
-
- LLMConfig : Configuration object
|
|
49
|
-
- LLMPayload : Payload
|
|
50
|
-
- NetworkState : TypeScript
|
|
51
|
-
- OGType : Type definition for Open Graph metadata types
|
|
52
|
-
- PreferredTheme : A
|
|
53
|
-
- RageClickPayload :
|
|
54
|
-
- RunOptions :
|
|
55
|
-
- ThreadedWorkerMode :
|
|
56
|
-
- useClipboard (Hook) : React hook that provides access to the system clipboard, allowing reading and writing of
|
|
57
|
-
- UseClipboardOptions : TypeScript type
|
|
58
|
-
- UseClipboardReturn : TypeScript
|
|
59
|
-
- useEventBus (Hook) : A hook that provides
|
|
60
|
-
- useIndexedDB (Hook) :
|
|
61
|
-
- UseIndexedDBReturn : Return type
|
|
62
|
-
- useLLMMetadata (Hook) : React hook
|
|
63
|
-
- useMutationObserver (Hook) : A hook that
|
|
64
|
-
- UseMutationObserverOptions :
|
|
65
|
-
- useNetworkState (Hook) : React hook that returns the current network state of the
|
|
66
|
-
- usePreferredTheme (Hook) : A hook that
|
|
67
|
-
- useRageClick (Hook) : React hook that detects rapid, repeated
|
|
68
|
-
- UseRageClickOptions :
|
|
69
|
-
- useThreadedWorker (Hook) :
|
|
70
|
-
- UseThreadedWorkerOptions :
|
|
71
|
-
- UseThreadedWorkerReturn :
|
|
72
|
-
- useTransition (Hook) : A
|
|
73
|
-
- useWasmCompute (Hook) :
|
|
74
|
-
- UseWasmComputeOptions :
|
|
75
|
-
- UseWasmComputeReturn : Type definition for the return value of
|
|
76
|
-
- useWebRTCIP (Hook) :
|
|
77
|
-
- UseWebRTCIPOptions :
|
|
78
|
-
- UseWebRTCIPReturn : Return
|
|
79
|
-
- useWorkerNotifications (Hook) : React hook that subscribes to
|
|
80
|
-
- UseWorkerNotificationsOptions : Configuration
|
|
81
|
-
- UseWorkerNotificationsReturn : Return type for useWorkerNotifications hook
|
|
82
|
-
- useWrappedChildren (Hook) : A hook that wraps
|
|
83
|
-
- WorkerEventType : Enumeration
|
|
84
|
-
- WorkerNotificationEvent : Type definition for worker notification
|
|
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.
|
|
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"
|