Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

@blac/react

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blac/react - npm Package Compare versions

Comparing version
2.0.0-rc.4
to
2.0.0-rc.5
+87
-2
dist/index.d.cts
import { RefObject } from "react";
//#region ../blac/src/core/StateContainerRegistry.d.ts
//#region ../blac/src/types/events.d.ts
/**
* Base event interface for type-safe event system
*/
/**
* Base event interface
* Used by Vertex for event-driven state management
*/
interface BaseEvent {
readonly type: string;
readonly timestamp: number;
readonly source?: string;
}
//#endregion
//#region ../blac/src/core/Vertex.d.ts
/**
* Event handler signature (synchronous only)
*/
type EventHandler<E$1 extends BaseEvent, S$1> = (event: E$1, emit: (state: S$1) => void) => void;
/**
* Type-safe event constructor
*/
type EventConstructor<T$1 extends BaseEvent = BaseEvent> = new (...args: never[]) => T$1;
/**
* Vertex is an event-driven state container (Bloc pattern)
*
* Includes its own simple event system since events are only needed
* for the Vertex pattern, not for the base StateContainer.
*/
declare abstract class Vertex<S$1, E$1 extends BaseEvent = BaseEvent> extends StateContainer<S$1> {
private eventHandlers;
private isProcessing;
private eventQueue;
/**
* Create a new Vertex
* @param initialState Initial state value
* @param config Configuration options
*/
constructor(initialState: S$1, config?: StateContainerConfig);
/**
* Register an event handler
* Arrow function to maintain correct 'this' binding
*/
protected on: <T extends E$1>(EventClass: EventConstructor<T>, handler: EventHandler<T, S$1>) => void;
/**
* Add an event to be processed
* Arrow function to maintain correct 'this' binding in React
*/
add: (event: E$1) => void;
/**
* Process an event (synchronously)
*/
private processEvent;
/**
* Handle a single event (synchronously)
*/
private handleEvent;
/**
* Hook for handling event processing errors
*/
protected onEventError(event: E$1, error: Error): void;
}
//#endregion
//#region ../blac/src/core/StateContainerRegistry.d.ts
/**
* Lifecycle events that can be observed
*/
type LifecycleEvent = 'created' | 'stateChanged' | 'eventAdded' | 'disposed';
/**
* Listener function types for each lifecycle event
*/
type LifecycleListener<E$1 extends LifecycleEvent> = E$1 extends 'created' ? (container: StateContainer<any>) => void : E$1 extends 'stateChanged' ? (container: StateContainer<any>, previousState: any, currentState: any) => void : E$1 extends 'eventAdded' ? (container: Vertex<any, any>, event: any) => void : E$1 extends 'disposed' ? (container: StateContainer<any>) => void : never;
/**
* Registry for managing StateContainer instances

@@ -11,2 +83,3 @@ */

private readonly types;
private readonly listeners;
/**

@@ -55,2 +128,14 @@ * Register a type with isolation mode

hasInstance<T extends StateContainer<any>>(constructor: new (...args: any[]) => T, key?: string): boolean;
/**
* Subscribe to lifecycle events
* @param event - The lifecycle event to listen for
* @param listener - The listener function to call when the event occurs
* @returns Unsubscribe function
*/
on<E extends LifecycleEvent>(event: E, listener: LifecycleListener<E>): () => void;
/**
* Emit lifecycle event to all listeners
* @internal - Called by StateContainer/Vertex lifecycle methods
*/
emit(event: LifecycleEvent, ...args: any[]): void;
}

@@ -78,3 +163,3 @@ //#endregion

declare abstract class StateContainer<S$1> {
private static _registry;
protected static _registry: StateContainerRegistry;
/**

@@ -81,0 +166,0 @@ * Set a custom registry (mainly for testing)

import { RefObject } from "react";
//#region ../blac/src/core/StateContainerRegistry.d.ts
//#region ../blac/src/types/events.d.ts
/**
* Base event interface for type-safe event system
*/
/**
* Base event interface
* Used by Vertex for event-driven state management
*/
interface BaseEvent {
readonly type: string;
readonly timestamp: number;
readonly source?: string;
}
//#endregion
//#region ../blac/src/core/Vertex.d.ts
/**
* Event handler signature (synchronous only)
*/
type EventHandler<E$1 extends BaseEvent, S$1> = (event: E$1, emit: (state: S$1) => void) => void;
/**
* Type-safe event constructor
*/
type EventConstructor<T$1 extends BaseEvent = BaseEvent> = new (...args: never[]) => T$1;
/**
* Vertex is an event-driven state container (Bloc pattern)
*
* Includes its own simple event system since events are only needed
* for the Vertex pattern, not for the base StateContainer.
*/
declare abstract class Vertex<S$1, E$1 extends BaseEvent = BaseEvent> extends StateContainer<S$1> {
private eventHandlers;
private isProcessing;
private eventQueue;
/**
* Create a new Vertex
* @param initialState Initial state value
* @param config Configuration options
*/
constructor(initialState: S$1, config?: StateContainerConfig);
/**
* Register an event handler
* Arrow function to maintain correct 'this' binding
*/
protected on: <T extends E$1>(EventClass: EventConstructor<T>, handler: EventHandler<T, S$1>) => void;
/**
* Add an event to be processed
* Arrow function to maintain correct 'this' binding in React
*/
add: (event: E$1) => void;
/**
* Process an event (synchronously)
*/
private processEvent;
/**
* Handle a single event (synchronously)
*/
private handleEvent;
/**
* Hook for handling event processing errors
*/
protected onEventError(event: E$1, error: Error): void;
}
//#endregion
//#region ../blac/src/core/StateContainerRegistry.d.ts
/**
* Lifecycle events that can be observed
*/
type LifecycleEvent = 'created' | 'stateChanged' | 'eventAdded' | 'disposed';
/**
* Listener function types for each lifecycle event
*/
type LifecycleListener<E$1 extends LifecycleEvent> = E$1 extends 'created' ? (container: StateContainer<any>) => void : E$1 extends 'stateChanged' ? (container: StateContainer<any>, previousState: any, currentState: any) => void : E$1 extends 'eventAdded' ? (container: Vertex<any, any>, event: any) => void : E$1 extends 'disposed' ? (container: StateContainer<any>) => void : never;
/**
* Registry for managing StateContainer instances

@@ -11,2 +83,3 @@ */

private readonly types;
private readonly listeners;
/**

@@ -55,2 +128,14 @@ * Register a type with isolation mode

hasInstance<T extends StateContainer<any>>(constructor: new (...args: any[]) => T, key?: string): boolean;
/**
* Subscribe to lifecycle events
* @param event - The lifecycle event to listen for
* @param listener - The listener function to call when the event occurs
* @returns Unsubscribe function
*/
on<E extends LifecycleEvent>(event: E, listener: LifecycleListener<E>): () => void;
/**
* Emit lifecycle event to all listeners
* @internal - Called by StateContainer/Vertex lifecycle methods
*/
emit(event: LifecycleEvent, ...args: any[]): void;
}

@@ -78,3 +163,3 @@ //#endregion

declare abstract class StateContainer<S$1> {
private static _registry;
protected static _registry: StateContainerRegistry;
/**

@@ -81,0 +166,0 @@ * Set a custom registry (mainly for testing)

+3
-3
{
"name": "@blac/react",
"version": "2.0.0-rc.4",
"version": "2.0.0-rc.5",
"license": "MIT",

@@ -39,3 +39,3 @@ "author": "Brendan Mullins <jsnanigans@gmail.com>",

"react": "^18.0.0 || ^19.0.0",
"@blac/core": "2.0.0-rc.4"
"@blac/core": "2.0.0-rc.5"
},

@@ -69,3 +69,3 @@ "peerDependenciesMeta": {

"vitest": "^3.2.4",
"@blac/core": "2.0.0-rc.4"
"@blac/core": "2.0.0-rc.5"
},

@@ -72,0 +72,0 @@ "scripts": {