Rename to expand component
This commit is contained in:
parent
7a697a1c05
commit
56c51ee0f8
2 changed files with 21 additions and 21 deletions
src
|
@ -4,7 +4,7 @@
|
|||
#:element-props
|
||||
#:element-children
|
||||
#:create-element
|
||||
#:expand))
|
||||
#:expand-component))
|
||||
(in-package #:hsx/element)
|
||||
|
||||
;;;; class definitions
|
||||
|
@ -61,22 +61,11 @@
|
|||
|
||||
(defmethod create-element-hook ((elm component-element))
|
||||
;dry-run to validate props
|
||||
(expand elm))
|
||||
(expand-component elm))
|
||||
|
||||
|
||||
;;;; methods
|
||||
|
||||
(defmethod expand ((elm component-element))
|
||||
(with-accessors ((type element-type)
|
||||
(props element-props)
|
||||
(children element-children)) elm
|
||||
(apply type (merge-children-into-props props children))))
|
||||
|
||||
(defun merge-children-into-props (props children)
|
||||
(append props
|
||||
(and children
|
||||
(list :children children))))
|
||||
|
||||
(defmethod print-object ((elm tag-element) stream)
|
||||
(with-accessors ((type element-type)
|
||||
(props element-props)
|
||||
|
@ -117,4 +106,15 @@
|
|||
children))))
|
||||
|
||||
(defmethod print-object ((elm component-element) stream)
|
||||
(print-object (expand elm) stream))
|
||||
(print-object (expand-component elm) stream))
|
||||
|
||||
(defmethod expand-component ((elm component-element))
|
||||
(with-accessors ((type element-type)
|
||||
(props element-props)
|
||||
(children element-children)) elm
|
||||
(apply type (merge-children-into-props props children))))
|
||||
|
||||
(defun merge-children-into-props (props children)
|
||||
(append props
|
||||
(and children
|
||||
(list :children children))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue