refactor: simplify slot API (#1202)

Closes #1096
This commit is contained in:
Juro Oravec 2025-05-20 09:48:45 +02:00 committed by GitHub
parent 7a49a7806c
commit f069255b64
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 404 additions and 72 deletions

View file

@ -458,7 +458,7 @@ class Component(metaclass=ComponentMeta):
Table.render(
slots=Table.Slots(
header="HELLO IM HEADER",
footer=Slot(lambda: ...),
footer=Slot(lambda ctx: ...),
),
)
```
@ -2132,8 +2132,8 @@ class Component(metaclass=ComponentMeta):
Button.render(
slots={
"content": "Click me!"
"content2": lambda *a, **kwa: "Click me!",
"content3": Slot(lambda *a, **kwa: "Click me!"),
"content2": lambda ctx: "Click me!",
"content3": Slot(lambda ctx: "Click me!"),
},
)
```
@ -2260,7 +2260,7 @@ class Component(metaclass=ComponentMeta):
age=30,
),
slots=Button.Slots(
footer=Slot(lambda *a, **kwa: "Click me!"),
footer=Slot(lambda ctx: "Click me!"),
),
)
```