/** * State Diagram Wrapper Class * * A unified API for building, mutating, and querying state diagrams. * Provides a fluent interface that wraps the StateDiagramAST. */ import { DiagramWrapper } from './diagram-wrapper.js'; import type { RenderOptions } from './types/render-options.js'; import type { StateDefinition, StateDiagramAST, StateDirection, StateNote, StateType } from './types/state.js'; /** Options for adding a state */ export interface AddStateOptions { description?: string; type?: StateType; } /** Options for adding a transition */ export interface AddTransitionOptions { label?: string; } /** * A fluent wrapper for StateDiagramAST that supports building, mutating, and querying. */ export declare class StateDiagram extends DiagramWrapper { private constructor(); /** Create a new empty state diagram */ static create(direction?: StateDirection): StateDiagram; /** Create from an existing AST */ static from(ast: StateDiagramAST): StateDiagram; /** Parse Mermaid syntax into a StateDiagram */ static parse(input: string): StateDiagram; render(options?: RenderOptions): string; clone(): StateDiagram; get direction(): StateDirection; get stateCount(): number; get transitionCount(): number; get states(): Map; setDirection(direction: StateDirection): this; /** Add a state */ addState(id: string, options?: AddStateOptions): this; /** Remove a state and optionally its transitions */ removeState(id: string, options?: { removeTransitions?: boolean; }): this; /** Rename a state */ renameState(id: string, newId: string): this; /** Get a state by ID */ getState(id: string): StateDefinition | undefined; /** Check if state exists */ hasState(id: string): boolean; /** Set state description */ setStateDescription(id: string, description: string): this; /** Add a fork state */ addFork(id: string): this; /** Add a join state */ addJoin(id: string): this; /** Add a choice state */ addChoice(id: string): this; /** Add a transition between states */ addTransition(from: string, to: string, options?: AddTransitionOptions): this; /** Add initial transition (from start state) */ addInitial(stateId: string): this; /** Add final transition (to end state) */ addFinal(stateId: string): this; /** Get all transitions */ getTransitions(): Array<{ from: string; to: string; label?: string; }>; /** Get transitions from a state */ getTransitionsFrom(stateId: string): Array<{ to: string; label?: string; }>; /** Get transitions to a state */ getTransitionsTo(stateId: string): Array<{ from: string; label?: string; }>; /** Remove a transition */ removeTransition(from: string, to: string): this; /** Set transition label */ setTransitionLabel(from: string, to: string, label: string): this; /** Add a composite (nested) state */ addComposite(id: string, buildFn: (diagram: StateDiagram) => void): this; /** Check if state is composite */ isComposite(stateId: string): boolean; /** Get nested states of a composite state */ getNestedStates(stateId: string): string[]; /** Add a note to a state */ addNote(stateId: string, text: string, position?: 'left of' | 'right of'): this; /** Get note for a state */ getNote(stateId: string): StateNote | undefined; /** Define a class style */ defineStyle(name: string, styles: string): this; /** Apply style to a state */ applyStyle(stateId: string, styleName: string): this; /** Find states by type */ findStates(query: { type?: StateType; hasNote?: boolean; }): StateDefinition[]; /** Get all reachable states from a given state */ getReachable(stateId: string): string[]; /** Get all states that can reach a given state */ getAncestors(stateId: string): string[]; /** Check if there's a path between two states */ hasPath(from: string, to: string): boolean; /** Get initial states (states with incoming transitions from [*]) */ getInitialStates(): string[]; /** Get final states (states with outgoing transitions to [*]) */ getFinalStates(): string[]; } //# sourceMappingURL=state-diagram.d.ts.map