Skip to content

Commit 00da846

Browse files
committed
Some type hints
1 parent 51990cb commit 00da846

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

examples/full_pwa.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def index():
8181
classes="card",
8282
)
8383
)
84+
8485
return doc
8586

8687

examples/quickstart.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import uvicorn
22
from violetear import App, StyleSheet
3-
from violetear.markup import Document, Element
3+
from violetear.markup import Document, HTML
44
from violetear.color import Colors
55
from violetear.style import Style
66
from violetear.dom import Event
@@ -95,18 +95,18 @@ def index():
9595
doc.style(style, href="/style.css") # Link our style
9696

9797
doc.body.add(
98-
Element("div", classes="counter-card").extend(
99-
Element("h2", text="Isomorphic Counter"),
98+
HTML.div(classes="counter-card").extend(
99+
HTML.h2(text="Isomorphic Counter"),
100100
# The Count
101-
Element("div", id="display", classes="count-display", text="0"),
101+
HTML.div(id="display", classes="count-display", text="0"),
102102
# Controls - Both call the same Python function
103-
Element("button", id="minus", text="-", classes="btn-minus btn").on(
103+
HTML.button(id="minus", text="-", classes="btn-minus btn").on(
104104
"click", handle_change
105105
),
106-
Element("button", id="plus", text="+", classes="btn-plus btn").on(
106+
HTML.button(id="plus", text="+", classes="btn-plus btn").on(
107107
"click", handle_change
108108
),
109-
Element("p", text="Check server console for pings.").style(
109+
HTML.p(text="Check server console for pings.").style(
110110
Style().color(Colors.Gray).margin(top=20)
111111
),
112112
)

examples/rpc_call.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from pydantic import BaseModel
22
from violetear import App
3+
from violetear.dom import Event
34
from violetear.markup import Document, Element, HTML
45

56
app = App(title="RPC Demo")
@@ -24,7 +25,7 @@ async def create_user(name: str, age: int) -> UserData:
2425

2526
# 3. Define the Client Logic
2627
@app.client
27-
async def on_submit(event):
28+
async def on_submit(event: Event):
2829
from violetear.dom import Document
2930

3031
# Get values from DOM

0 commit comments

Comments
 (0)