EluciusFTW.SpectreTuff.Elmish
0.14.14
dotnet add package EluciusFTW.SpectreTuff.Elmish --version 0.14.14
NuGet\Install-Package EluciusFTW.SpectreTuff.Elmish -Version 0.14.14
<PackageReference Include="EluciusFTW.SpectreTuff.Elmish" Version="0.14.14" />
<PackageVersion Include="EluciusFTW.SpectreTuff.Elmish" Version="0.14.14" />
<PackageReference Include="EluciusFTW.SpectreTuff.Elmish" />
paket add EluciusFTW.SpectreTuff.Elmish --version 0.14.14
#r "nuget: EluciusFTW.SpectreTuff.Elmish, 0.14.14"
#:package EluciusFTW.SpectreTuff.Elmish@0.14.14
#addin nuget:?package=EluciusFTW.SpectreTuff.Elmish&version=0.14.14
#tool nuget:?package=EluciusFTW.SpectreTuff.Elmish&version=0.14.14
SpectreTuff
Spectre Tui for F# - A thin, opinionated wrapper around Spectre.Tui
This library, as well as Spectre.Tui is currently under construction and may change at any time.
Key bindings
SpectreTuff.Keymap lets one list of bindings drive both input handling and the help bar, so a key and its description can't drift apart:
open SpectreTuff.Keymap
let bindings = [
KeyBinding.createSpecial ConsoleKey.UpArrow "up" MoveUp |> KeyBinding.orKey (CharKey 'k')
KeyBinding.dynamic (CharKey 's') (fun model -> {
Description = "save"
Message = if model.Dirty then Some Save else None // None: disabled and hidden from help
})
]
KeyBinding.handleKey bindings key model // ConsoleKeyInfo -> 'Msg option
KeyBinding.toKeyMap bindings model // IKeyMap for the help widget
Elmish
The EluciusFTW.SpectreTuff.Elmish package runs an Elmish program on SpectreTuff. It sets up the terminal, serializes rendering and handles exiting. A minimal app that shows the last key pressed:
open System
open Elmish
open SpectreTuff.Widgets
open SpectreTuff.Elmish
type Model = { LastKey: string }
type Msg = KeyPressed of ConsoleKeyInfo
let init () = { LastKey = "none" }, Cmd.none
let update msg model =
match msg with
| KeyPressed key when key.KeyChar = 'q' -> model, TuiCmd.exit
| KeyPressed key -> { LastKey = string key.Key }, Cmd.none
let view model _dispatch =
textBox $"Last key: {model.LastKey} (press q to quit)"
Program.mkProgram init update view
|> Program.withSubscription (fun _ -> Subscriptions.keys KeyPressed)
|> Tui.run // blocks until TuiCmd.exit
For periodic updates, add Subscriptions.tick (TimeSpan.FromSeconds 1.0) Tick to the subscriptions. To forward a child component's subscriptions to its parent, use Elmish's Sub.map "child" ChildMsg childSubs.
Versioning
We are using NerdBank.GitVersioning and follow the version scheme: <major>.<minor>.<git-depth> for out releases.
Since this package is a wrapper around Spectre.Tui, we will synchronize our major and minor versions with the ones of the Spectre dependency we are wrapping.
<b>Note</b>: In particular, the third number in the version does not have the same meaning as the patches in SemVer. Increments in that number may contain breaking changes, in contrast to patch versions in SemVer.
License
Copyright © Guy Buss, Daniel Muckelbauer
SpectreTuff is provided as-is under the MIT license. See the LICENSE.md file included in the repository.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Elmish (>= 5.0.2)
- EluciusFTW.SpectreTuff (>= 0.14.14)
- FSharp.Core (>= 10.1.402)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on EluciusFTW.SpectreTuff.Elmish:
| Package | Downloads |
|---|---|
|
EluciusFTW.Tui48
A 2048-style sliding tile game as an Elmish component: host it in any SpectreTuff.Elmish program, e.g. as a pop-up game, with pluggable highscore storage. |
|
|
EluciusFTW.Tuisweeper
Minesweeper as an Elmish component: host it in any SpectreTuff.Elmish program, e.g. as a pop-up game, with pluggable highscore storage. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.14.14 | 178 | 10/17/2026 |
Initial release