- Name
reason- Kind
- property
- Type
RatingReason- Requirement
- required
DocsAPI referenceUI machinesrating
rating machine
The public state machine contract for @grassroot/ui-machines/rating. The machine owns behaviour; the matching headless layer owns composition.
@grassroot/ui-machines/rating
Package
Service example
rating.tsts
import { createService } from "@grassroot/statechart";import { ratingMachine } from "@grassroot/ui-machines/rating"; const service = createService(ratingMachine, { input: {} });service.start();service.send({ type: "…" });service.stop();10 of 10
Exports
RatingCommand
typeRatingCommandts
type RatingCommand = CommandObject & { readonly type: "VALUE_CHANGE_REQUEST"; readonly value: number; readonly reason: RatingReason;};Name
Kind
Type
Requirement
reasonproperty
RatingReasonrequired
typeproperty
stringrequired
valueproperty
numberrequired
- Name
type- Kind
- property
- Type
string- Requirement
- required
- Name
value- Kind
- property
- Type
number- Requirement
- required
RatingContext
typeRatingContextts
type RatingContext = { readonly value: number; readonly mode: BindingMode;};Name
Kind
Type
Requirement
modeproperty
BindingModerequired
valueproperty
numberrequired
- Name
mode- Kind
- property
- Type
BindingMode- Requirement
- required
- Name
value- Kind
- property
- Type
number- Requirement
- required
RatingDiagnosticCodes
valueRatingDiagnosticCodests
export declare const RatingDiagnosticCodes: readonly DiagnosticCatalogueEntry[];RatingEvent
typeRatingEventts
type RatingEvent = { readonly type: "SET"; readonly value: number; readonly reason: RatingReason;} | { readonly type: "RESET";};RatingInput
typeRatingInputts
type RatingInput = { readonly max?: number; readonly value?: number; readonly defaultValue?: number; readonly readOnly?: boolean;};Name
Kind
Type
Requirement
defaultValueproperty
numberoptional
maxproperty
numberoptional
readOnlyproperty
booleanoptional
valueproperty
numberoptional
- Name
defaultValue- Kind
- property
- Type
number- Requirement
- optional
- Name
max- Kind
- property
- Type
number- Requirement
- optional
- Name
readOnly- Kind
- property
- Type
boolean- Requirement
- optional
- Name
value- Kind
- property
- Type
number- Requirement
- optional
ratingMachine
valueratingMachinets
export declare const ratingMachine: Machine<RatingInput, "ready", RatingContext, RatingEvent, RatingCommand>;RatingReason
typeRatingReasonts
type RatingReason = "pointer" | "keyboard" | "programmatic";ratingReplaySequence
valueratingReplaySequencets
export declare const ratingReplaySequence: readonly RatingEvent[];ratingSelectors
valueratingSelectorsts
export declare const ratingSelectors: { value: (snapshot: RatingSnapshot) => number;};Name
Kind
Type
Requirement
valueproperty
(snapshot: RatingSnapshot) => numberrequired
- Name
value- Kind
- property
- Type
(snapshot: RatingSnapshot) => number- Requirement
- required
RatingSnapshot
typeRatingSnapshotts
type RatingSnapshot = Snapshot<"ready", RatingContext>;