diff --git a/README.md b/README.md index 434bde1..01fb158 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,7 @@ A terminal user interface framework for Clojure, inspired by [Bubbletea](https://github.com/charmbracelet/bubbletea) (Go). Build interactive CLI applications using the Elm Architecture with Hiccup-style views. -``` -╭──────────────────────────────────────╮ -│ │ -│ ╭────────────────────╮ │ -│ │ Counter: 42 │ │ -│ ╰────────────────────╯ │ -│ │ -│ j/k: change r: reset q: quit │ -│ │ -╰──────────────────────────────────────╯ -``` +![Counter Example](assets/counter.gif) ## Features @@ -93,18 +83,67 @@ Output: j/k: change r: reset q: quit ``` -## Running Examples +## Examples + +### Counter +Simple counter demonstrating basic Elm Architecture. + +![Counter](assets/counter.gif) ```bash -# With Babashka (simple sync runtime) bb counter -bb timer -bb list -bb spinner -bb views -bb http +``` -# With Clojure (full async support) +### Timer +Countdown timer with pause/resume - demonstrates async commands. + +![Timer](assets/timer.gif) + +```bash +bb timer +``` + +### List Selection +Multi-select list with cursor navigation. + +![List Selection](assets/list.gif) + +```bash +bb list +``` + +### Spinner +Animated loading spinners with multiple styles. + +![Spinner](assets/spinner.gif) + +```bash +bb spinner +``` + +### Views +State machine pattern with multiple views and navigation. + +![Views](assets/views.gif) + +```bash +bb views +``` + +### HTTP +Async HTTP requests with loading states. + +![HTTP](assets/http.gif) + +```bash +bb http +``` + +### Running with Full Clojure + +For full async support (core.async), run with Clojure: + +```bash clojure -A:dev -M -m examples.counter ``` diff --git a/assets/counter.gif b/assets/counter.gif new file mode 100644 index 0000000..7daed64 Binary files /dev/null and b/assets/counter.gif differ diff --git a/assets/counter.tape b/assets/counter.tape new file mode 100644 index 0000000..29d5e62 --- /dev/null +++ b/assets/counter.tape @@ -0,0 +1,48 @@ +# Counter Example +Output assets/counter.gif + +Set Shell "bash" +Set FontSize 16 +Set Width 600 +Set Height 400 +Set Theme "Catppuccin Mocha" + +Type "bb counter" +Enter +Sleep 1s + +# Increment a few times +Type "k" +Sleep 400ms +Type "k" +Sleep 400ms +Type "k" +Sleep 400ms +Type "k" +Sleep 400ms +Type "k" +Sleep 600ms + +# Decrement +Type "j" +Sleep 400ms +Type "j" +Sleep 400ms +Type "j" +Sleep 600ms + +# Reset +Type "r" +Sleep 800ms + +# Go negative +Type "j" +Sleep 400ms +Type "j" +Sleep 400ms +Type "j" +Sleep 600ms + +# Quit +Type "q" +Sleep 500ms diff --git a/assets/http.gif b/assets/http.gif new file mode 100644 index 0000000..6db2837 Binary files /dev/null and b/assets/http.gif differ diff --git a/assets/http.tape b/assets/http.tape new file mode 100644 index 0000000..8994cc6 --- /dev/null +++ b/assets/http.tape @@ -0,0 +1,28 @@ +# HTTP Example +Output assets/http.gif + +Set Shell "bash" +Set FontSize 16 +Set Width 650 +Set Height 400 +Set Theme "Catppuccin Mocha" + +Type "bb http" +Enter +Sleep 1s + +# Start fetch +Enter +Sleep 2s + +# Reset +Type "r" +Sleep 800ms + +# Fetch again +Enter +Sleep 2s + +# Quit +Type "q" +Sleep 500ms diff --git a/assets/list.gif b/assets/list.gif new file mode 100644 index 0000000..7e81ad1 Binary files /dev/null and b/assets/list.gif differ diff --git a/assets/list.tape b/assets/list.tape new file mode 100644 index 0000000..e22907d --- /dev/null +++ b/assets/list.tape @@ -0,0 +1,56 @@ +# List Selection Example +Output assets/list.gif + +Set Shell "bash" +Set FontSize 16 +Set Width 700 +Set Height 500 +Set Theme "Catppuccin Mocha" + +Type "bb list" +Enter +Sleep 1s + +# Navigate down and select +Type "j" +Sleep 300ms +Type " " +Sleep 400ms + +Type "j" +Sleep 300ms +Type "j" +Sleep 300ms +Type " " +Sleep 400ms + +Type "j" +Sleep 300ms +Type "j" +Sleep 300ms +Type " " +Sleep 400ms + +# Navigate up +Type "k" +Sleep 300ms +Type "k" +Sleep 300ms + +# Deselect +Type " " +Sleep 400ms + +# Navigate and select more +Type "j" +Sleep 300ms +Type "j" +Sleep 300ms +Type "j" +Sleep 300ms +Type " " +Sleep 600ms + +# Submit +Enter +Sleep 1s diff --git a/assets/spinner.gif b/assets/spinner.gif new file mode 100644 index 0000000..bdc20cd Binary files /dev/null and b/assets/spinner.gif differ diff --git a/assets/spinner.tape b/assets/spinner.tape new file mode 100644 index 0000000..a39851b --- /dev/null +++ b/assets/spinner.tape @@ -0,0 +1,41 @@ +# Spinner Example +Output assets/spinner.gif + +Set Shell "bash" +Set FontSize 16 +Set Width 650 +Set Height 400 +Set Theme "Catppuccin Mocha" + +Type "bb spinner" +Enter +Sleep 1.5s + +# Watch spinner animate +Sleep 1s + +# Change style +Tab +Sleep 1s +Tab +Sleep 1s +Tab +Sleep 1s +Tab +Sleep 1s + +# Complete +Type " " +Sleep 800ms + +# Restart +Type "r" +Sleep 1.5s + +# Change style again +Tab +Sleep 1s + +# Quit +Type "q" +Sleep 500ms diff --git a/assets/timer.gif b/assets/timer.gif new file mode 100644 index 0000000..a774846 Binary files /dev/null and b/assets/timer.gif differ diff --git a/assets/timer.tape b/assets/timer.tape new file mode 100644 index 0000000..aae2caf --- /dev/null +++ b/assets/timer.tape @@ -0,0 +1,31 @@ +# Timer Example +Output assets/timer.gif + +Set Shell "bash" +Set FontSize 16 +Set Width 600 +Set Height 400 +Set Theme "Catppuccin Mocha" + +Type "bb timer" +Enter +Sleep 1s + +# Watch countdown +Sleep 2s + +# Pause +Type " " +Sleep 1s + +# Resume +Type " " +Sleep 2s + +# Reset +Type "r" +Sleep 3s + +# Quit +Type "q" +Sleep 500ms diff --git a/assets/views.gif b/assets/views.gif new file mode 100644 index 0000000..cce1b4f Binary files /dev/null and b/assets/views.gif differ diff --git a/assets/views.tape b/assets/views.tape new file mode 100644 index 0000000..22cb25a --- /dev/null +++ b/assets/views.tape @@ -0,0 +1,48 @@ +# Views Example +Output assets/views.gif + +Set Shell "bash" +Set FontSize 16 +Set Width 700 +Set Height 450 +Set Theme "Catppuccin Mocha" + +Type "bb views" +Enter +Sleep 1s + +# Navigate menu +Type "j" +Sleep 400ms +Type "j" +Sleep 400ms + +# Enter detail view +Enter +Sleep 1s + +# Go back +Type "b" +Sleep 600ms + +# Navigate to another item +Type "j" +Sleep 400ms +Enter +Sleep 1s + +# Try to quit - shows confirm dialog +Type "q" +Sleep 800ms + +# Say no +Type "n" +Sleep 600ms + +# Go back to menu +Escape +Sleep 600ms + +# Actually quit +Type "q" +Sleep 500ms