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

@ -131,7 +131,7 @@ MyComponent.render(
```py
MyComponent.render(
kwargs={"position": "left"},
slots={"content": lambda *a, **kwa: "Hello, Alice"}
slots={"content": lambda ctx: "Hello, Alice"}
)
```

View file

@ -513,7 +513,7 @@ Button.render(
age=30,
),
slots=Button.Slots(
footer=Slot(lambda *a, **kwa: "Click me!"),
footer=Slot(lambda ctx: "Click me!"),
),
)
```

View file

@ -128,7 +128,7 @@ Button.render(
age=30,
),
slots=Button.Slots(
footer=Slot(lambda *a, **kwa: "Click me!"),
footer=Slot(lambda ctx: "Click me!"),
),
)
```
@ -601,7 +601,7 @@ Button.render(
},
slots={
"my_slot": "...",
"another_slot": Slot(lambda: ...),
"another_slot": Slot(lambda ctx: ...),
},
)
```
@ -662,7 +662,7 @@ Button.render(
),
slots=Button.Slots(
my_slot="...",
another_slot=Slot(lambda: ...),
another_slot=Slot(lambda ctx: ...),
),
)
```