Delete create-element-hook
This commit is contained in:
parent
cc4b3e19c6
commit
fb53f6aa05
2 changed files with 10 additions and 37 deletions
src
|
@ -34,16 +34,14 @@
|
|||
;;;; factory
|
||||
|
||||
(defun create-element (type props &rest children)
|
||||
(let ((element (make-instance (cond ((functionp type) 'component)
|
||||
((eq type :<>) 'fragment)
|
||||
((eq type :html) 'html-tag)
|
||||
((keywordp type) 'tag)
|
||||
(t (error "element-type must be either a keyword or a function.")))
|
||||
:type type
|
||||
:props props
|
||||
:children (flatten children))))
|
||||
(create-element-hook element)
|
||||
element))
|
||||
(make-instance (cond ((functionp type) 'component)
|
||||
((eq type :<>) 'fragment)
|
||||
((eq type :html) 'html-tag)
|
||||
((keywordp type) 'tag)
|
||||
(t (error "element-type must be either a keyword or a function.")))
|
||||
:type type
|
||||
:props props
|
||||
:children (flatten children)))
|
||||
|
||||
(defun flatten (x)
|
||||
(labels ((rec (x acc)
|
||||
|
@ -54,16 +52,6 @@
|
|||
(rec (cdr x) acc))))))
|
||||
(rec x nil)))
|
||||
|
||||
(defmethod create-element-hook ((element element)))
|
||||
|
||||
(defmethod create-element-hook ((element fragment))
|
||||
(when (element-props element)
|
||||
(error "Cannot pass props to fragment.")))
|
||||
|
||||
(defmethod create-element-hook ((element component))
|
||||
;dry-run to validate props
|
||||
(expand-component element))
|
||||
|
||||
|
||||
;;;; methods
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue