From 346fc7cb6c10f4faa70cf9c53c78b79c1aacdcc1 Mon Sep 17 00:00:00 2001 From: paku Date: Mon, 15 Apr 2024 22:08:57 +0900 Subject: [PATCH] Rename ...props to props --- README.md | 6 +++--- src/elements.lisp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5666a00..7bd88e4 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ It's - `nil`: Nothing is rendered. - `t`: Only the key is rendered. - non-boolean: The key/value pair is rendered. - - `...props`: If the properties given to a component are not declared with `define-element` macro, they are gathered into `...props` property list. This allows flexible props passing to components. + - `props`: If the properties given to a component are not declared with `define-element` macro, they are gathered into `props` property list. This allows flexible props passing to components. ```lisp (<> @@ -28,7 +28,7 @@ It's ;
(define-element view-more () - (a ...props + (a props "View More")) (view-more :href "/detail" :class "m-1") @@ -36,7 +36,7 @@ It's ; View More (define-element custom-button (variant) - (button `(:class ,variant ,@...props) + (button `(:class ,variant ,@props) children)) (custom-button :type "submit" :variant "big" :onclick "doSomething()" diff --git a/src/elements.lisp b/src/elements.lisp index faaac83..f98ce5d 100644 --- a/src/elements.lisp +++ b/src/elements.lisp @@ -19,7 +19,7 @@ #:tag #:children #:attrs - #:...props + #:props #:attrs-alist #:make-attrs #:copy-attrs @@ -223,13 +223,13 @@ (let ,(mapcar (lambda (prop) (list prop `(attr attrs (make-keyword ',prop)))) props) - (let ((...props + (let ((props (loop :for (key . value) in (attrs-alist attrs) :unless (member key ',(mapcar #'make-keyword props)) :append (list key value)))) - (declare (ignorable ...props)) + (declare (ignorable props)) (progn ,@body)))))))) (defmacro ,name (&body attrs-and-children) `(,',%name ,@attrs-and-children)))))