22
33import sys
44from collections import namedtuple
5- from collections .abc import Mapping , Sequence
5+ from collections .abc import Awaitable , Mapping , Sequence
66from dataclasses import dataclass
77from pathlib import Path
88from types import TracebackType
99from typing import (
1010 TYPE_CHECKING ,
1111 Any ,
12- Awaitable ,
1312 Callable ,
1413 Generic ,
1514 Literal ,
1615 NamedTuple ,
16+ NotRequired ,
1717 Protocol ,
1818 TypeVar ,
1919 overload ,
@@ -101,6 +101,9 @@ async def __aexit__(
101101VdomAttributes = TypedDict (
102102 "VdomAttributes" ,
103103 {
104+ "key" : Key ,
105+ "value" : Any ,
106+ "defaultValue" : Any ,
104107 "dangerouslySetInnerHTML" : dict [str , str ],
105108 "suppressContentEditableWarning" : bool ,
106109 "suppressHydrationWarning" : bool ,
@@ -225,9 +228,7 @@ async def __aexit__(
225228 "onSubmitCapture" : EventFunc ,
226229 "formAction" : str | Callable ,
227230 "checked" : bool ,
228- "value" : str ,
229231 "defaultChecked" : bool ,
230- "defaultValue" : str ,
231232 "accept" : str ,
232233 "alt" : str ,
233234 "capture" : str ,
@@ -340,24 +341,20 @@ async def __aexit__(
340341 "onWaitingCapture" : EventFunc ,
341342 },
342343 total = False ,
343- extra_items = Any ,
344+ # TODO: Enable this when Python 3.14 typing extensions are released
345+ # extra_items=Any,
344346)
345347
346348
347- class _VdomDictOptional (TypedDict , total = False ):
348- key : Key | None
349- children : Sequence [ComponentType | VdomChild ]
350- attributes : VdomAttributes
351- eventHandlers : EventHandlerDict
352- importSource : ImportSourceDict
353-
349+ class VdomDict (TypedDict ):
350+ """A :ref:`VDOM` dictionary"""
354351
355- class _VdomDictRequired (TypedDict , total = True ):
356352 tagName : str
357-
358-
359- class VdomDict (_VdomDictRequired , _VdomDictOptional ):
360- """A :ref:`VDOM` dictionary"""
353+ key : NotRequired [Key | None ]
354+ children : NotRequired [Sequence [ComponentType | VdomChild ]]
355+ attributes : NotRequired [VdomAttributes ]
356+ eventHandlers : NotRequired [EventHandlerDict ]
357+ importSource : NotRequired [ImportSourceDict ]
361358
362359
363360VdomChild : TypeAlias = "ComponentType | VdomDict | str | None | Any"
@@ -378,7 +375,7 @@ class _OptionalVdomJson(TypedDict, total=False):
378375 key : Key
379376 error : str
380377 children : list [Any ]
381- attributes : dict [ str , Any ]
378+ attributes : VdomAttributes
382379 eventHandlers : dict [str , _JsonEventTarget ]
383380 importSource : _JsonImportSource
384381
0 commit comments