docs: clarify static Research Shelf specification
This commit is contained in:
parent
cbbd5122ba
commit
aeaaea1aba
@ -429,12 +429,15 @@ user's prior local additions cannot collide with the generated dataset."
|
||||
|
||||
(defun etaf-research-shelf--filter-label (form key fallback)
|
||||
"Return the static FILTER label from FORM for KEY, or FALLBACK."
|
||||
(let ((entry (etaf-research-shelf--static-child form 'filter)))
|
||||
(let ((entry
|
||||
(etaf-research-shelf--static-child
|
||||
form 'research-shelf-filter-spec)))
|
||||
(or (and entry (eq (plist-get (cdr entry) :key) key)
|
||||
(plist-get (cdr entry) :label))
|
||||
(let ((entry (cl-find-if
|
||||
(lambda (item)
|
||||
(and (consp item) (eq (car item) 'filter)
|
||||
(and (consp item)
|
||||
(eq (car item) 'research-shelf-filter-spec)
|
||||
(eq (plist-get (cdr item) :key) key)))
|
||||
(cdr form))))
|
||||
(or (and entry (plist-get (cdr entry) :label)) fallback)))))
|
||||
@ -653,11 +656,21 @@ user's prior local additions cannot collide with the generated dataset."
|
||||
(lambda ()
|
||||
(etaf-research-shelf--theme-defaults model))
|
||||
:name 'research-shelf-theme))
|
||||
(header (etaf-research-shelf--static-child static-form 'header))
|
||||
(filters (etaf-research-shelf--static-child static-form 'filters))
|
||||
(main (etaf-research-shelf--static-child static-form 'main))
|
||||
(library (etaf-research-shelf--static-child main 'library))
|
||||
(detail (etaf-research-shelf--static-child main 'detail)))
|
||||
(header
|
||||
(etaf-research-shelf--static-child
|
||||
static-form 'research-shelf-header-spec))
|
||||
(filters
|
||||
(etaf-research-shelf--static-child
|
||||
static-form 'research-shelf-filter-specs))
|
||||
(content
|
||||
(etaf-research-shelf--static-child
|
||||
static-form 'research-shelf-content-spec))
|
||||
(library
|
||||
(etaf-research-shelf--static-child
|
||||
content 'research-shelf-library-spec))
|
||||
(detail
|
||||
(etaf-research-shelf--static-child
|
||||
content 'research-shelf-detail-spec)))
|
||||
(unless initial-result
|
||||
(etaf-on-mounted
|
||||
(lambda ()
|
||||
|
||||
@ -1,16 +1,21 @@
|
||||
;; Static composition only. Storage, state, Components, and events live in
|
||||
;; the same-basename `.el' companion.
|
||||
;; Static application specification only.
|
||||
;;
|
||||
;; `research-shelf-shell' is the runtime Component defined in the same-basename
|
||||
;; `.el' companion. The `*-spec' forms below are inert configuration nodes;
|
||||
;; they are read by that Component and are not built-in ETAF tags or implicit
|
||||
;; Components. Storage, state, behavior, and events stay in the companion.
|
||||
(research-shelf-shell
|
||||
:title "Research Shelf"
|
||||
:subtitle "A quiet place for unfinished ideas"
|
||||
(header :eyebrow "A quiet place for unfinished ideas")
|
||||
(filters
|
||||
(filter :key all :label "All")
|
||||
(filter :key reading :label "In progress")
|
||||
(filter :key unread :label "Unread")
|
||||
(filter :key finished :label "Finished")
|
||||
(filter :key starred :label "★ Starred"))
|
||||
(main
|
||||
(library :title "Reading queue")
|
||||
(detail :title "Selected item"))
|
||||
(footer :label "SQLite · saved locally"))
|
||||
(research-shelf-header-spec
|
||||
:eyebrow "A quiet place for unfinished ideas")
|
||||
(research-shelf-filter-specs
|
||||
(research-shelf-filter-spec :key all :label "All")
|
||||
(research-shelf-filter-spec :key reading :label "In progress")
|
||||
(research-shelf-filter-spec :key unread :label "Unread")
|
||||
(research-shelf-filter-spec :key finished :label "Finished")
|
||||
(research-shelf-filter-spec :key starred :label "★ Starred"))
|
||||
(research-shelf-content-spec
|
||||
(research-shelf-library-spec :title "Reading queue")
|
||||
(research-shelf-detail-spec :title "Selected item"))
|
||||
(research-shelf-footer-spec :label "SQLite · saved locally"))
|
||||
|
||||
@ -169,14 +169,19 @@ database and mounts a test buffer before running BODY."
|
||||
(should (equal (plist-get (cdr form) :title) "Research Shelf"))
|
||||
(should (equal (mapcar #'car
|
||||
(cl-remove-if-not #'consp (cdr form)))
|
||||
'(header filters main footer)))
|
||||
'(research-shelf-header-spec
|
||||
research-shelf-filter-specs
|
||||
research-shelf-content-spec
|
||||
research-shelf-footer-spec)))
|
||||
(let* ((filters (cl-find-if
|
||||
(lambda (entry) (and (consp entry)
|
||||
(eq (car entry) 'filters)))
|
||||
(eq (car entry)
|
||||
'research-shelf-filter-specs)))
|
||||
(cdr form)))
|
||||
(all-filter (cl-find-if
|
||||
(lambda (entry) (and (consp entry)
|
||||
(eq (car entry) 'filter)
|
||||
(eq (car entry)
|
||||
'research-shelf-filter-spec)
|
||||
(eq (plist-get (cdr entry) :key)
|
||||
'all)))
|
||||
(cdr filters))))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user