API reference

The public exports of @carere/solux, grouped by the job they do. Import from the package entry point.

Events, handlers, slices, and stores

ExportContract
createEvent<P>(name, prepare?)Create typed events. The optional single-argument prepare callback returns { payload }. Creator.type and .match inspect event types.
createHandler<S>(builderCallback)Build a synchronous Handler<S> with addHandler(eventCreator, handler).
createSlice({ initialState, handlers })Return { getInitialState, handler }. Initial state is retained, not freshly allocated by getInitialState.
combineSlices(map)Compose keyed slices into a root slice; state keys and types follow the map.
configureStore({ rootSlice, preloadedState?, enhancers? })Create a reactive store. rootSlice is required at runtime. preloadedState supplies the complete starting state.
store.state / store.dispatch(event)Read reactive state; synchronously handle an event, then notify subscribers.
store.subscribe(listener)Observe { state, event }; live subscriptions replay the latest event if any. Returns an RxJS Subscription.
store.subscribeToEvent(creator, listener)Type-filter the same event stream. Returns an RxJS Subscription.
store.dispose() · unreleasedIdempotently close the core event stream and registered enhancer cleanup. No automatic effect cancellation.

Context, enhancers, and epics

ExportContract
SoluxProviderPass store through Solid context; does not assume disposal ownership.
useSolux<S>()Return Store<S> | undefined from context. Provider is optional for direct store access.
devtools<S>(options)Opt-in Redux DevTools enhancer. options requires instanceId. See command semantics and release caveats.
applyMiddlewares<S>(middlewares)Wrap dispatch in a left-to-right reduction (last middleware is outermost).
epicMiddleware<S, C>({ rootEpic, container? })Connect an RxJS epic to dispatch. No automatic teardown on store disposal.
combineEpics<S, C>(...epics)Merge outputs of epics receiving the same event stream, state, and container.
nanoid(size = 21)Generate a non-cryptographic random ID. Not suitable for secrets or security tokens.

Entity helpers

createEntityAdapter<T>({ selectId, sortComparer }) returns addOne, addMany, setOne, setMany, setAll, removeOne, removeMany, removeAll, getInitialState, and getSelectors. EntityState<T> has ids: string[] and entities: Record<string, T>. Selectors are selectIds, selectEntities, selectAll, selectTotal, and selectById.

Public types

Events and handlers: Event, EventWithPayload, Handler, Dispatch, BasicEventCreator, EventCreatorWithPayload, EventCreatorWithoutPayload, EventCreatorWithPreparedPayload, PayloadEventCreator, PrepareCallback, and AnyEventCreator.

State and composition: Store, StoreOption, Slice, SliceOption, SlicesMapObject, StateFromSlicesMapObject, EventHandlerMapBuilder, Middleware, MiddlewareApi, Enhancer, EnhancedStore, Epic, and DevToolsOptions.

Entities: EntityState, EntityAdapterOptions, EntityStateAdapter, and EntitySelectors. IfUndefined and IfPrepareActionMethodNotProvided are exported inference helpers marked internal; application code should generally let factory calls infer those details.

EnhancedStore adds initialState, setState, and onDispose for enhancer implementation. These capabilities are not present on the returned public store. Preserve the remaining store methods when implementing custom enhancers.