DocsAPI referenceUI machinesvoice-input

voice-input machine

The public state machine contract for @grassroot/ui-machines/voice-input. The machine owns behaviour; the matching headless layer owns composition.

@grassroot/ui-machines/voice-input

Package

9 exports
View source packages/ui-machines/src/voice-input/index.ts

Service example

voice-input.tsts
import { createService } from "@grassroot/statechart";
import { voiceInputMachine } from "@grassroot/ui-machines/voice-input";
const service = createService(voiceInputMachine, { input: {} });
service.start();
service.send({ type: "…" });
service.stop();

Exports

VoiceInput

type
DeclarationView source
VoiceInputts
type VoiceInput = {
readonly transcript?: string;
};
Name
Kind
Type
Requirement
transcript
property
string
optional
Name
transcript
Kind
property
Type
string
Requirement
optional
DeclarationView source
VoiceInputContextts
type VoiceInputContext = {
readonly transcript?: string;
readonly error?: unknown;
};
Name
Kind
Type
Requirement
error
property
unknown
optional
transcript
property
string
optional
Name
error
Kind
property
Type
unknown
Requirement
optional
Name
transcript
Kind
property
Type
string
Requirement
optional
DeclarationView source
VoiceInputDiagnosticCodests
export declare const VoiceInputDiagnosticCodes: readonly DiagnosticCatalogueEntry[];
DeclarationView source
VoiceInputEventts
type VoiceInputEvent = {
readonly type: "REQUEST_PERMISSION";
} | {
readonly type: "PERMISSION_GRANTED";
} | {
readonly type: "PERMISSION_DENIED";
readonly error?: unknown;
} | {
readonly type: "RECORDING_STOPPED";
} | {
readonly type: "TRANSCRIPT";
readonly transcript: string;
} | {
readonly type: "TRANSCRIPT_DONE";
readonly transcript?: string;
} | {
readonly type: "FAILED";
readonly error?: unknown;
} | {
readonly type: "ABORT";
readonly error?: unknown;
} | {
readonly type: "RESET";
};
DeclarationView source
voiceInputMachinets
export declare const voiceInputMachine: Machine<VoiceInput, VoiceInputValue, VoiceInputContext, VoiceInputEvent, never>;
DeclarationView source
voiceInputReplaySequencets
export declare const voiceInputReplaySequence: readonly VoiceInputEvent[];
DeclarationView source
voiceInputSelectorsts
export declare const voiceInputSelectors: {
isActive(snapshot: VoiceInputSnapshot): boolean;
isTerminal(snapshot: VoiceInputSnapshot): boolean;
canStart(snapshot: VoiceInputSnapshot): boolean;
transcript(snapshot: VoiceInputSnapshot): string;
error(snapshot: VoiceInputSnapshot): unknown;
};
Name
Kind
Type
Requirement
canStart
method
(snapshot: VoiceInputSnapshot) => boolean
required
error
method
(snapshot: VoiceInputSnapshot) => unknown
required
isActive
method
(snapshot: VoiceInputSnapshot) => boolean
required
isTerminal
method
(snapshot: VoiceInputSnapshot) => boolean
required
transcript
method
(snapshot: VoiceInputSnapshot) => string
required
Name
canStart
Kind
method
Type
(snapshot: VoiceInputSnapshot) => boolean
Requirement
required
Name
error
Kind
method
Type
(snapshot: VoiceInputSnapshot) => unknown
Requirement
required
Name
isActive
Kind
method
Type
(snapshot: VoiceInputSnapshot) => boolean
Requirement
required
Name
isTerminal
Kind
method
Type
(snapshot: VoiceInputSnapshot) => boolean
Requirement
required
Name
transcript
Kind
method
Type
(snapshot: VoiceInputSnapshot) => string
Requirement
required
DeclarationView source
VoiceInputSnapshotts
type VoiceInputSnapshot = Snapshot<VoiceInputValue, VoiceInputContext>;
DeclarationView source
VoiceInputValuets
type VoiceInputValue = "idle" | "permission" | "recording" | "transcribing" | "done" | "denied" | "failed";