actor-kit
Version:
Actor Kit is a library for running state machines in Cloudflare Workers, leveraging XState for robust state management. It provides a framework for managing the logic, lifecycle, persistence, synchronization, and access control of actors in a distributed
33 lines (32 loc) • 1.4 kB
text/typescript
import { b as ClientEventFrom, k as MatchesProps, t as ActorKitClient, u as AnyActorKitStateMachine, v as CallerSnapshotFrom } from "./types-C31KX9CW.mjs";
import { t as ActorKitClientProps } from "./createActorKitClient-d0mY6Uo3.mjs";
import React, { ReactNode } from "react";
import { StateValueFrom } from "xstate";
//#region src/createActorKitContext.d.ts
declare function createActorKitContext<TMachine extends AnyActorKitStateMachine>(actorType: string): {
Provider: React.FC<{
children: ReactNode;
} & Omit<ActorKitClientProps<TMachine>, "actorType">>;
ProviderFromClient: React.FC<{
children: ReactNode;
client: ActorKitClient<TMachine>;
}>;
useClient: () => ActorKitClient<TMachine>;
useSelector: <T>(selector: (snapshot: CallerSnapshotFrom<TMachine>) => T) => T;
useSend: () => (event: ClientEventFrom<TMachine>) => void;
useMatches: (stateValue: StateValueFrom<TMachine>) => boolean;
Matches: React.FC<MatchesProps<TMachine> & {
children: ReactNode;
}> & {
create: (state: StateValueFrom<TMachine>, options?: {
and?: StateValueFrom<TMachine>;
or?: StateValueFrom<TMachine>;
not?: boolean;
}) => React.FC<Omit<MatchesProps<TMachine>, "state" | "and" | "or" | "not"> & {
children: ReactNode;
}>;
};
};
//#endregion
export { createActorKitContext as t };
//# sourceMappingURL=createActorKitContext-Dfz-tllh.d.mts.map