v0.11.0: Plugin / Slot system

- defslot: register render functions into named slots with ordering
- slot-render: call all registered render-fns for a slot
- Slot modes designed (stack/replace/single-winner) but mode dispatch
  is implicit via the registration API
- slot-p, clear-slot, list-slots for lifecycle management
- Slots stored in a hash table keyed by string (equal test)
- 4 tests, 100% passing
This commit is contained in:
Hermes
2026-05-11 20:30:43 +00:00
parent 949bfe46bf
commit f9349c2ac8
5 changed files with 169 additions and 4 deletions

View File

@@ -2,7 +2,7 @@
(asdf:defsystem :cl-tty
:description "Reusable Common Lisp Terminal UI Framework"
:author "Amr Gharbeia"
:version "0.10.0"
:version "0.11.0"
:license "TBD"
:depends-on (:fiveam :sb-posix)
:components
@@ -44,7 +44,10 @@
(:file "dialog" :depends-on ("dialog-package" "dirty" "select" "text-input"))
;; Mouse support (v0.10.0)
(:file "mouse-package" :depends-on ("package" "input-package"))
(:file "mouse" :depends-on ("mouse-package" "dirty" "input")))))
(:file "mouse" :depends-on ("mouse-package" "dirty" "input"))
;; Slot system (v0.11.0)
(:file "slot-package" :depends-on ("package"))
(:file "slot" :depends-on ("slot-package")))))
:in-order-to ((test-op (test-op :cl-tty-tests))))
(asdf:defsystem :cl-tty-tests
@@ -68,7 +71,8 @@
(:file "select-tests" :pathname "../../tests/select-tests.lisp")
(:file "markdown-tests" :pathname "../../tests/markdown-tests.lisp")
(:file "dialog-tests" :pathname "../../tests/dialog-tests.lisp")
(:file "mouse-tests" :pathname "../../tests/mouse-tests.lisp"))))
(:file "mouse-tests" :pathname "../../tests/mouse-tests.lisp")
(:file "slot-tests" :pathname "../../tests/slot-tests.lisp"))))
:perform (test-op (o c)
(let ((run (find-symbol "RUN" :fiveam))
(explain (find-symbol "EXPLAIN!" :fiveam)))
@@ -78,7 +82,9 @@
(:cl-tty-scrollbox-test "SCROLLBOX-SUITE")
(:cl-tty-select-test "SELECT-SUITE")
(:cl-tty-markdown-test "MARKDOWN-SUITE")
(:cl-tty-dialog-test "DIALOG-SUITE")))
(:cl-tty-dialog-test "DIALOG-SUITE")
(:cl-tty-mouse-test "MOUSE-SUITE")
(:cl-tty-slot-test "SLOT-SUITE")))
(let* ((pkg (find-package (first suite)))
(s (and pkg (find-symbol (second suite) pkg))))
(when s