forked from litestar-org/litestar-htmx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.py
More file actions
51 lines (35 loc) · 1.29 KB
/
Copy pathtypes.py
File metadata and controls
51 lines (35 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal, TypedDict, Union
__all__ = ("EventAfterType", "HtmxHeaderType", "LocationType", "PushUrlType", "ReSwapMethod", "TriggerEventType")
if TYPE_CHECKING:
from typing_extensions import Required
EventAfterType = Literal["receive", "settle", "swap", None]
PushUrlType = Union[str, bool]
ReSwapMethod = Literal[
"innerHTML", "outerHTML", "beforebegin", "afterbegin", "beforeend", "afterend", "delete", "none", None
]
class LocationType(TypedDict):
"""Type for HX-Location header."""
path: Required[str]
source: str | None
event: str | None
target: str | None
select: str | None
swap: ReSwapMethod | None
values: dict[str, str] | None
hx_headers: dict[str, Any] | None
class TriggerEventType(TypedDict):
"""Type for HX-Trigger header."""
name: Required[str]
params: dict[str, Any] | None
after: EventAfterType | None
class HtmxHeaderType(TypedDict, total=False):
"""Type for hx_headers parameter in get_headers()."""
location: LocationType | None
redirect: str | None
refresh: bool
push_url: PushUrlType | None
replace_url: PushUrlType | None
re_swap: ReSwapMethod | None
re_target: str | None
trigger_event: TriggerEventType | None