22
33import dataclasses
44import inspect
5+ import sys
56import types
67import urllib .parse
78from base64 import b64encode
@@ -1227,19 +1228,6 @@ def download(
12271228 )
12281229
12291230
1230- # This function seems unused. Check if we still need it. If not, remove in 0.7.0
1231- def _callback_arg_spec (eval_result : Any ):
1232- """ArgSpec for call_script callback function.
1233-
1234- Args:
1235- eval_result: The result of the javascript execution.
1236-
1237- Returns:
1238- Args for the callback function
1239- """
1240- return [eval_result ]
1241-
1242-
12431231def call_script (
12441232 javascript_code : str | Var [str ],
12451233 callback : "EventType[Any] | None" = None ,
@@ -2181,7 +2169,9 @@ def __call__(self, *args: Var) -> Any:
21812169class EventNamespace :
21822170 """A namespace for event related classes."""
21832171
2172+ # Core Event Classes
21842173 Event = Event
2174+ EventActionsMixin = EventActionsMixin
21852175 EventHandler = EventHandler
21862176 EventSpec = EventSpec
21872177 CallableEventSpec = CallableEventSpec
@@ -2190,8 +2180,43 @@ class EventNamespace:
21902180 LiteralEventVar = LiteralEventVar
21912181 EventChainVar = EventChainVar
21922182 LiteralEventChainVar = LiteralEventChainVar
2193- EventType = EventType
21942183 EventCallback = EventCallback
2184+ LambdaEventCallback = LambdaEventCallback
2185+
2186+ # Javascript Event Classes
2187+ JavascriptHTMLInputElement = JavascriptHTMLInputElement
2188+ JavascriptInputEvent = JavascriptInputEvent
2189+ JavasciptKeyboardEvent = JavasciptKeyboardEvent
2190+ JavascriptMouseEvent = JavascriptMouseEvent
2191+ JavascriptPointerEvent = JavascriptPointerEvent
2192+
2193+ # Type Info Classes
2194+ KeyInputInfo = KeyInputInfo
2195+ MouseEventInfo = MouseEventInfo
2196+ PointerEventInfo = PointerEventInfo
2197+ IdentityEventReturn = IdentityEventReturn
2198+
2199+ # File Upload
2200+ FileUpload = FileUpload
2201+
2202+ # Type Aliases
2203+ EventType = EventType
2204+ LAMBDA_OR_STATE = LAMBDA_OR_STATE
2205+ BASIC_EVENT_TYPES = BASIC_EVENT_TYPES
2206+ IndividualEventType = IndividualEventType
2207+
2208+ # Constants
2209+ BACKGROUND_TASK_MARKER = BACKGROUND_TASK_MARKER
2210+ _EVENT_FIELDS = _EVENT_FIELDS
2211+ upload_files = upload_files
2212+ stop_propagation = stop_propagation
2213+ prevent_default = prevent_default
2214+
2215+ # Private/Internal Functions
2216+ _values_returned_from_event = staticmethod (_values_returned_from_event )
2217+ _check_event_args_subclass_of_callback = staticmethod (
2218+ _check_event_args_subclass_of_callback
2219+ )
21952220
21962221 @overload
21972222 def __new__ (
@@ -2282,10 +2307,20 @@ def wrapper(
22822307 check_fn_match_arg_spec = staticmethod (check_fn_match_arg_spec )
22832308 resolve_annotation = staticmethod (resolve_annotation )
22842309 parse_args_spec = staticmethod (parse_args_spec )
2310+ unwrap_var_annotation = staticmethod (unwrap_var_annotation )
2311+ get_fn_signature = staticmethod (get_fn_signature )
2312+
2313+ # Event Spec Functions
22852314 passthrough_event_spec = staticmethod (passthrough_event_spec )
22862315 input_event = staticmethod (input_event )
2316+ int_input_event = staticmethod (int_input_event )
2317+ float_input_event = staticmethod (float_input_event )
2318+ checked_input_event = staticmethod (checked_input_event )
22872319 key_event = staticmethod (key_event )
2320+ pointer_event_spec = staticmethod (pointer_event_spec )
22882321 no_args_event_spec = staticmethod (no_args_event_spec )
2322+
2323+ # Server Side Events
22892324 server_side = staticmethod (server_side )
22902325 redirect = staticmethod (redirect )
22912326 console_log = staticmethod (console_log )
@@ -2308,3 +2343,4 @@ def wrapper(
23082343
23092344
23102345event = EventNamespace
2346+ sys .modules [__name__ ] = event # pyright: ignore[reportArgumentType]
0 commit comments