123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- import { StateValue, ActivityMap, EventObject, HistoryValue, ActionObject, StateConfig, SCXML, StateSchema, TransitionDefinition, Typestate, ActorRef, StateMachine, SimpleEventsOf } from './types';
- import { StateNode } from './StateNode';
- import { TypegenDisabled, TypegenEnabled } from './typegenTypes';
- import { BaseActionObject, Prop } from './types';
- export declare function stateValuesEqual(a: StateValue | undefined, b: StateValue | undefined): boolean;
- export declare function isStateConfig<TContext, TEvent extends EventObject>(state: any): state is StateConfig<TContext, TEvent>;
- export declare const isState: typeof isStateConfig;
- export declare function bindActionToState<TC, TE extends EventObject>(action: ActionObject<TC, TE>, state: State<TC, TE, any, any, any>): ActionObject<TC, TE>;
- export declare class State<TContext, TEvent extends EventObject = EventObject, TStateSchema extends StateSchema<TContext> = any, TTypestate extends Typestate<TContext> = {
- value: any;
- context: TContext;
- }, TResolvedTypesMeta = TypegenDisabled> {
- value: StateValue;
- context: TContext;
- historyValue?: HistoryValue | undefined;
- history?: State<TContext, TEvent, TStateSchema, TTypestate, TResolvedTypesMeta>;
- actions: Array<ActionObject<TContext, TEvent>>;
- activities: ActivityMap;
- meta: any;
- events: TEvent[];
- event: TEvent;
- _event: SCXML.Event<TEvent>;
- _sessionid: string | null;
-
- changed: boolean | undefined;
-
- done: boolean | undefined;
-
- configuration: Array<StateNode<TContext, any, TEvent, any, any>>;
-
- nextEvents: Array<TEvent['type']>;
-
- transitions: Array<TransitionDefinition<TContext, TEvent>>;
-
- children: Record<string, ActorRef<any>>;
- tags: Set<string>;
- machine: StateMachine<TContext, any, TEvent, TTypestate, BaseActionObject, any, TResolvedTypesMeta> | undefined;
-
- static from<TC, TE extends EventObject = EventObject>(stateValue: State<TC, TE, any, any, any> | StateValue, context?: TC | undefined): State<TC, TE, any, any, any>;
-
- static create<TC, TE extends EventObject = EventObject>(config: StateConfig<TC, TE>): State<TC, TE, any, any, any>;
-
- static inert<TC, TE extends EventObject = EventObject>(stateValue: State<TC, TE, any, any, any> | StateValue, context: TC): State<TC, TE>;
-
- constructor(config: StateConfig<TContext, TEvent>);
- /**
- * Returns an array of all the string leaf state node paths.
- * @param stateValue
- * @param delimiter The character(s) that separate each subpath in the string state node path.
- */
- toStrings(stateValue?: StateValue, delimiter?: string): string[];
- toJSON(): Omit<this, "configuration" | "transitions" | "tags" | "machine" | "toStrings" | "toJSON" | "matches" | "hasTag" | "can"> & {
- tags: string[];
- };
-
- matches<TSV extends TResolvedTypesMeta extends TypegenEnabled ? Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'matchesStates'> : never>(parentStateValue: TSV): boolean;
- matches<TSV extends TResolvedTypesMeta extends TypegenDisabled ? TTypestate['value'] : never>(parentStateValue: TSV): this is State<(TTypestate extends any ? {
- value: TSV;
- context: any;
- } extends TTypestate ? TTypestate : never : never)['context'], TEvent, TStateSchema, TTypestate, TResolvedTypesMeta> & {
- value: TSV;
- };
-
- hasTag(tag: TResolvedTypesMeta extends TypegenEnabled ? Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'tags'> : string): boolean;
-
- can(event: TEvent | SimpleEventsOf<TEvent>['type']): boolean;
- }
|