v1.0.0: extract theme from cl-tty.box to own cl-tty.theme package
The theme system (theme class, define-preset, load-preset, theme-color) was part of the bloated cl-tty.box package even though it had nothing to do with boxes, spans, or component rendering. It only used cl-tty.backend for the *theme-colors* hash table. Changes: - added defpackage :cl-tty.theme as the first block in theme.lisp (inline defpackage avoids ASDF dependency ordering issues with separate package files) - removed theme exports from cl-tty.box defpackage - theme tests now run in their own THEME-SUITE (16 tests) instead of part of BOX-SUITE - box suite drops from 64 to 48 tests (16 moved to theme suite) - updated ASDF, run-all-tests.lisp All 15 test suites pass at 100%.
This commit is contained in:
21
cl-tty.asd
21
cl-tty.asd
@@ -16,18 +16,18 @@
|
|||||||
(:module "src/layout"
|
(:module "src/layout"
|
||||||
:components
|
:components
|
||||||
((:file "layout")))
|
((:file "layout")))
|
||||||
(:module "src/rendering"
|
(:module "src/rendering"
|
||||||
:components
|
:components
|
||||||
((:file "framebuffer")))
|
((:file "framebuffer")))
|
||||||
(:module "src/components"
|
(:module "src/components"
|
||||||
:components
|
:components
|
||||||
((:file "package")
|
((:file "package")
|
||||||
(:file "dirty")
|
(:file "dirty")
|
||||||
(:file "box" :depends-on ("package"))
|
(:file "box" :depends-on ("package"))
|
||||||
(:file "text" :depends-on ("package" "box"))
|
(:file "text" :depends-on ("package" "box"))
|
||||||
(:file "render" :depends-on ("package" "box" "text"))
|
(:file "render" :depends-on ("package" "box" "text"))
|
||||||
(:file "theme" :depends-on ("package"))
|
(:file "theme" :depends-on ("package"))
|
||||||
;; Input system (v0.5.0)
|
;; Input system (v0.5.0)
|
||||||
(:file "input-package" :depends-on ("package"))
|
(:file "input-package" :depends-on ("package"))
|
||||||
(:file "input" :depends-on ("input-package" "dirty" "box"))
|
(:file "input" :depends-on ("input-package" "dirty" "box"))
|
||||||
(:file "text-input" :depends-on ("input-package" "input" "box"))
|
(:file "text-input" :depends-on ("input-package" "input" "box"))
|
||||||
@@ -82,8 +82,9 @@
|
|||||||
(:cl-tty-input-test "INPUT-SUITE")
|
(:cl-tty-input-test "INPUT-SUITE")
|
||||||
(:cl-tty-scrollbox-test "SCROLLBOX-SUITE")
|
(:cl-tty-scrollbox-test "SCROLLBOX-SUITE")
|
||||||
(:cl-tty-markdown-test)
|
(:cl-tty-markdown-test)
|
||||||
(:cl-tty-dialog-test "DIALOG-SUITE")
|
(:cl-tty-dialog-test "DIALOG-SUITE")
|
||||||
(:cl-tty-slot-test "SLOT-SUITE")
|
(:cl-tty-theme-test "THEME-SUITE")
|
||||||
|
(:cl-tty-slot-test "SLOT-SUITE")
|
||||||
(:cl-tty-layout-test "LAYOUT-SUITE")
|
(:cl-tty-layout-test "LAYOUT-SUITE")
|
||||||
(:cl-tty-modern-backend-test "MODERN-BACKEND-SUITE")
|
(:cl-tty-modern-backend-test "MODERN-BACKEND-SUITE")
|
||||||
(:cl-tty-framebuffer-test "FRAMEBUFFER-SUITE")))
|
(:cl-tty-framebuffer-test "FRAMEBUFFER-SUITE")))
|
||||||
|
|||||||
@@ -173,9 +173,6 @@ theme object is passed in from the application level. This separation
|
|||||||
means themes can be swapped without touching component instances.
|
means themes can be swapped without touching component instances.
|
||||||
|
|
||||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/package.lisp
|
#+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)
|
;; Container components (merged from cl-tty.container)
|
||||||
#:scroll-box #:make-scroll-box
|
#:scroll-box #:make-scroll-box
|
||||||
#:scroll-box-scroll-y #:scroll-box-scroll-x
|
#:scroll-box-scroll-y #:scroll-box-scroll-x
|
||||||
|
|||||||
@@ -43,6 +43,17 @@ and the backend's ~*theme-colors*~ for SGR resolution.
|
|||||||
- ~:default~ — gold/accent on dark blue-gray
|
- ~:default~ — gold/accent on dark blue-gray
|
||||||
- ~:nord~ — cool blue nord palette
|
- ~: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
|
* Tests
|
||||||
|
|
||||||
** Test header
|
** Test header
|
||||||
@@ -50,8 +61,18 @@ and the backend's ~*theme-colors*~ for SGR resolution.
|
|||||||
Package declaration and test suite registration.
|
Package declaration and test suite registration.
|
||||||
|
|
||||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/theme-tests.lisp
|
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/theme-tests.lisp
|
||||||
(in-package :cl-tty-box-test)
|
(defpackage :cl-tty-theme-test
|
||||||
(in-suite box-suite)
|
(: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
|
#+END_SRC
|
||||||
|
|
||||||
** Test: theme-create-default
|
** 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.
|
instance gets its own table instead of sharing one.
|
||||||
|
|
||||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/theme.lisp
|
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/theme.lisp
|
||||||
(in-package :cl-tty.box)
|
(in-package :cl-tty.theme)
|
||||||
|
|
||||||
(defclass theme ()
|
(defclass theme ()
|
||||||
((mode :initform :dark :initarg :mode :accessor theme-mode)
|
((mode :initform :dark :initarg :mode :accessor theme-mode)
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
(:cl-tty-scrollbox-test "SCROLLBOX-SUITE")
|
(:cl-tty-scrollbox-test "SCROLLBOX-SUITE")
|
||||||
(:cl-tty-markdown-test :cl-tty-markdown-test)
|
(:cl-tty-markdown-test :cl-tty-markdown-test)
|
||||||
(:cl-tty-dialog-test "DIALOG-SUITE")
|
(:cl-tty-dialog-test "DIALOG-SUITE")
|
||||||
|
(:cl-tty-theme-test "THEME-SUITE")
|
||||||
(:cl-tty-slot-test "SLOT-SUITE")
|
(:cl-tty-slot-test "SLOT-SUITE")
|
||||||
(:cl-tty-layout-test "LAYOUT-SUITE")
|
(:cl-tty-layout-test "LAYOUT-SUITE")
|
||||||
(:cl-tty-modern-backend-test "MODERN-BACKEND-SUITE")
|
(:cl-tty-modern-backend-test "MODERN-BACKEND-SUITE")
|
||||||
|
|||||||
Reference in New Issue
Block a user