// SCHEMA export interface StepStateScaffold { active: { type: string; entry: any, states: { mode: { type: string; states: { readiness: { initial: string; states: { enabled: any; disabled: any; }; }; interaction: { initial: string; states: { pristine: any; touched: any; dirty: any; }; }; focus: { initial: string; states: { blurred: any; focused: any; }; }; }; }; operation: { initial: string; states: { idle: any; editing: { }; submitted: any; }; }; }; }; passive: any; } export interface StepStates extends StepStateScaffold { active: { type: 'parallel', entry: any, states: { mode: { type: 'parallel', states: { readiness: { initial: string; states: { enabled: {}; disabled: {}; }; }; interaction: { initial: string; states: { pristine: {}; touched: {}; dirty: {}; }; }; focus: { initial: string; states: { blurred: {}; focused: {}; }; }; }; }; operation: { initial: string; states: { idle: {}; editing: { }; submitted: {}; }; on: any }; }; }; passive: {}; } // EVENTS that the machine handles export type Step_Event_Validating = { type: 'VALIDATING'; value: any }; export type Step_Event_Validated = { type: 'VALIDATED'; value: any } export type Step_Event_Invalidated = { type: 'INVALIDATED'; value: any } export type Step_Event_Submit = { type: 'SUBMIT'; value: any } export type Step_Event_Submitted = { type: 'SUBMITTED'; value: any } export type Step_Event_Disable = { type: 'DISABLE'; value: any } export type Step_Event_Enable = { type: 'ENABLE'; value: any } export type Step_Event_Focus = { type: 'FOCUS'; value: any } export type Step_Event_Blur = { type: 'BLUR'; value: any } export type Step_Event_Change = { type: 'CHANGE'; value: any } export type Step_Event_PausePlay = { type: 'PAUSEPLAY' } export type Step_Event_ResetTimer = { type: 'RESET_TIMER' } export type Step_Event_SetActive = { type: 'SET_ACTIVE'; id: string } export type StepEvent = | Step_Event_Validating | Step_Event_Validated | Step_Event_Invalidated | Step_Event_Submit | Step_Event_Submitted | Step_Event_Disable | Step_Event_Enable | Step_Event_Focus | Step_Event_Blur | Step_Event_Change | Step_Event_PausePlay | Step_Event_ResetTimer; export interface StepEventsScaffold { 'VALIDATING': Function, 'VALIDATED': Function, 'INVALIDATED': Function, 'SUBMIT': Function, 'SUBMITTED': Function, 'DISABLE': Function, 'ENABLE': Function, 'FOCUS': Function, 'BLUR': Function, 'CHANGE': Function, 'PAUSEPLAY': Function, 'SET_ACTIVE': Function, 'RESET_TIMER': Function } // CONTEXT export interface StepContext { field: any; specialistMachine: any; validationMachine: any; delayMachine: any; delay: { elapsed: number; duration: number; // Note: this will come from the parent form interval: number; initialDelay: number; // Note: this will come from field type speed: number; // Note: this will come from the parent form }; } interface StepContextUndefined { field: undefined; specialistMachine: undefined; validationMachine: undefined; delayMachine: undefined; delay: { elapsed: 0; duration: 0; interval: 0; initialDelay: 0; speed: 0 }; } export interface StepStateSchema { id: string; initial: string; context: StepContext; states: StepStates }; // export type StepState = // { // value: 'active'; // context: StepContext & StepContextUndefined; // };