@spaceandtimelabs/makeinfinite-ui 0.50.0 → 0.51.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/dist/index.d.ts CHANGED
@@ -1372,12 +1372,50 @@ declare const useVariants: () => {
1372
1372
  setVariants: any;
1373
1373
  };
1374
1374
 
1375
+ /**
1376
+ * Hook for managing a WebSocket connection with automatic reconnection
1377
+ *
1378
+ * @param url WebSocket URL to connect to (set to null to prevent connection)
1379
+ * @param onMessageReceived Callback function to handle received messages
1380
+ * @param options Connection options
1381
+ */
1382
+ export declare const useWebSocketManager: (url: string | null, onMessageReceived: (data: any) => void, options?: WebSocketOptions) => UseWebSocketManagerReturn;
1383
+
1384
+ /**
1385
+ * Return type for useWebSocketManager hook
1386
+ */
1387
+ declare interface UseWebSocketManagerReturn {
1388
+ /** Current connection status */
1389
+ connectionStatus: WebSocketStatus;
1390
+ /** Function to send messages over the WebSocket */
1391
+ sendMessage: (message: object) => boolean;
1392
+ /** Most recent error during connection or message handling */
1393
+ lastError: Error | null;
1394
+ }
1395
+
1375
1396
  export declare namespace Variants {
1376
1397
  export {
1377
1398
  DEFAULT
1378
1399
  }
1379
1400
  }
1380
1401
 
1402
+ /**
1403
+ * Options for WebSocket connection management
1404
+ */
1405
+ declare interface WebSocketOptions {
1406
+ /** Maximum number of reconnection attempts (default: 5) */
1407
+ maxReconnectAttempts?: number;
1408
+ /** Initial delay in ms before first reconnection attempt (default: 1000) */
1409
+ reconnectInitialDelay?: number;
1410
+ /** Exponential backoff factor for subsequent reconnect attempts (default: 2) */
1411
+ reconnectBackoffFactor?: number;
1412
+ }
1413
+
1414
+ /**
1415
+ * WebSocket connection status
1416
+ */
1417
+ declare type WebSocketStatus = "idle" | "connecting" | "open" | "closing" | "closed";
1418
+
1381
1419
  export { }
1382
1420
 
1383
1421