Wizards¶
Textual-free contracts for consumer-owned setup wizards.
Choice
dataclass
¶
Choice(key: str, label: str, description: str)
ChoiceStep
dataclass
¶
ChoiceStep(
key: str,
title: str,
choices: tuple[Choice, ...],
purpose: str | None = None,
kind: Literal[CHOICE] = WizardStepKind.CHOICE,
)
FormStep
dataclass
¶
FormStep(
key: str,
title: str,
fields: tuple[FieldSpec, ...],
purpose: str | None = None,
kind: Literal[FORM] = WizardStepKind.FORM,
)
ReviewChange
dataclass
¶
ReviewChange(
field: str,
before: object,
after: object,
sensitive: bool = False,
)
ReviewStep
dataclass
¶
ReviewStep(
key: str,
title: str,
review: WizardReview,
purpose: str | None = None,
kind: Literal[REVIEW] = WizardStepKind.REVIEW,
)
WizardController ¶
Bases: Protocol
Consumer-owned state machine for one wizard session.
WizardDefinitionError ¶
Bases: ValueError
Raised when a wizard declares duplicate or unusable keys.
WizardResult
dataclass
¶
WizardResult(
status: WizardResultStatus,
summary: str,
detail: object | None = None,
refresh_pages: frozenset[str] = frozenset(),
)
WizardResultStatus ¶
WizardReview
dataclass
¶
WizardReview(
changes: tuple[ReviewChange, ...] = (),
effects: tuple[str, ...] = (),
warnings: tuple[str, ...] = (),
ready_to_apply: bool = True,
)
Presentation-safe review data. Real candidates stay in the controller.
WizardSnapshot
dataclass
¶
WizardSnapshot(
spec: WizardSpec,
step: WizardStep,
step_index: int,
step_count: int,
values: Mapping[str, object] = dict(),
issues: tuple[ValidationIssue, ...] = (),
can_back: bool = False,
can_next: bool = True,
can_apply: bool = False,
expected_revision: str | None = None,
)
Complete render state for one wizard moment.
values
class-attribute
instance-attribute
¶
values: Mapping[str, object] = field(default_factory=dict)
WizardSpec
dataclass
¶
WizardSpec(
key: str,
title: str,
purpose: str,
apply_label: str = "Apply",
)
WizardStepKind ¶
WizardTransition
dataclass
¶
WizardTransition(
snapshot: WizardSnapshot,
issues: tuple[ValidationIssue, ...] = (),
)
redact_wizard_value ¶
redact_wizard_value(
field: FieldSpec, value: object
) -> object
Return the presentation value for a field without exposing secrets.
Generic wizard screen rendered from Textual-free wizard contracts.
WizardScreen ¶
WizardScreen(controller: WizardController)
Bases: ModalScreen[WizardResult]
Reusable one-step-at-a-time wizard surface.