diff --git a/cl-tty.asd b/cl-tty.asd index 9e6bc53..21429d8 100644 --- a/cl-tty.asd +++ b/cl-tty.asd @@ -16,18 +16,18 @@ (:module "src/layout" :components ((:file "layout"))) - (:module "src/rendering" - :components - ((:file "framebuffer"))) - (:module "src/components" + (:module "src/rendering" + :components + ((:file "framebuffer"))) + (:module "src/components" :components ((:file "package") (:file "dirty") (:file "box" :depends-on ("package")) - (:file "text" :depends-on ("package" "box")) - (:file "render" :depends-on ("package" "box" "text")) - (:file "theme" :depends-on ("package")) - ;; Input system (v0.5.0) + (:file "text" :depends-on ("package" "box")) + (:file "render" :depends-on ("package" "box" "text")) + (:file "theme" :depends-on ("package")) + ;; Input system (v0.5.0) (:file "input-package" :depends-on ("package")) (:file "input" :depends-on ("input-package" "dirty" "box")) (:file "text-input" :depends-on ("input-package" "input" "box")) @@ -82,8 +82,9 @@ (:cl-tty-input-test "INPUT-SUITE") (:cl-tty-scrollbox-test "SCROLLBOX-SUITE") (:cl-tty-markdown-test) - (:cl-tty-dialog-test "DIALOG-SUITE") - (:cl-tty-slot-test "SLOT-SUITE") + (:cl-tty-dialog-test "DIALOG-SUITE") + (:cl-tty-theme-test "THEME-SUITE") + (:cl-tty-slot-test "SLOT-SUITE") (:cl-tty-layout-test "LAYOUT-SUITE") (:cl-tty-modern-backend-test "MODERN-BACKEND-SUITE") (:cl-tty-framebuffer-test "FRAMEBUFFER-SUITE"))) diff --git a/org/package.org b/org/package.org index 15b98a7..da1ce95 100644 --- a/org/package.org +++ b/org/package.org @@ -173,9 +173,6 @@ theme object is passed in from the application level. This separation means themes can be swapped without touching component instances. #+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/package.lisp - ;; Theme engine - #:theme #:make-theme #:theme-mode - #:theme-color #:load-preset #:define-preset ;; Container components (merged from cl-tty.container) #:scroll-box #:make-scroll-box #:scroll-box-scroll-y #:scroll-box-scroll-x diff --git a/org/theme.org b/org/theme.org index bd2bf5a..f871f0b 100644 --- a/org/theme.org +++ b/org/theme.org @@ -43,6 +43,17 @@ and the backend's ~*theme-colors*~ for SGR resolution. - ~:default~ — gold/accent on dark blue-gray - ~:nord~ — cool blue nord palette +* Package definition + +#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/theme.lisp +(defpackage :cl-tty.theme + (:use :cl :cl-tty.backend) + (:export + #:theme #:make-theme #:theme-mode + #:theme-color #:load-preset #:define-preset)) +(in-package :cl-tty.theme) +#+END_SRC + * Tests ** Test header @@ -50,8 +61,18 @@ and the backend's ~*theme-colors*~ for SGR resolution. Package declaration and test suite registration. #+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/theme-tests.lisp -(in-package :cl-tty-box-test) -(in-suite box-suite) +(defpackage :cl-tty-theme-test + (:use :cl :cl-tty.theme :fiveam) + (:export #:run-tests)) +(in-package :cl-tty-theme-test) + +(def-suite theme-suite :description "Theme engine tests") +(in-suite theme-suite) + +(defun run-tests () + (let ((result (run 'theme-suite))) + (fiveam:explain! result) + (uiop:quit 0))) #+END_SRC ** Test: theme-create-default @@ -201,7 +222,7 @@ hash table). Using ~make-hash-table~ as the ~:initform~ ensures each instance gets its own table instead of sharing one. #+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/theme.lisp -(in-package :cl-tty.box) +(in-package :cl-tty.theme) (defclass theme () ((mode :initform :dark :initarg :mode :accessor theme-mode) diff --git a/run-all-tests.lisp b/run-all-tests.lisp index 21f2c16..16a206e 100644 --- a/run-all-tests.lisp +++ b/run-all-tests.lisp @@ -27,6 +27,7 @@ (:cl-tty-scrollbox-test "SCROLLBOX-SUITE") (:cl-tty-markdown-test :cl-tty-markdown-test) (:cl-tty-dialog-test "DIALOG-SUITE") + (:cl-tty-theme-test "THEME-SUITE") (:cl-tty-slot-test "SLOT-SUITE") (:cl-tty-layout-test "LAYOUT-SUITE") (:cl-tty-modern-backend-test "MODERN-BACKEND-SUITE")