Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/datastar_py/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
import re
from collections.abc import Iterable, Iterator, Mapping
from itertools import chain
from typing import Literal, Self, TypeAlias, TypeVar, Union, overload
from typing import TYPE_CHECKING, Literal, TypeAlias, Union, overload

if TYPE_CHECKING:
from typing import Self

__all__ = ["attribute_generator"]

Expand Down Expand Up @@ -379,17 +382,14 @@ def __str__(self) -> str:
__html__ = __str__


TAttr = TypeVar("TAttr", bound=BaseAttr)


class TimingMod:
def debounce(
self: TAttr,
self: Self,
wait: int | float | str,
*,
leading: bool = False,
notrail: bool = False,
) -> TAttr:
) -> Self:
"""Debounce the event listener.

:param wait: The minimum interval between events.
Expand All @@ -406,12 +406,12 @@ def debounce(
return self

def throttle(
self: TAttr,
self: Self,
wait: int | float | str,
*,
noleading: bool = False,
trail: bool = False,
) -> TAttr:
) -> Self:
"""Throttle the event listener.

:param wait: The minimum interval between events.
Expand All @@ -430,7 +430,7 @@ def throttle(

class ViewtransitionMod:
@property
def viewtransition(self: TAttr) -> TAttr:
def viewtransition(self: Self) -> Self:
"""Wrap the expression in document.startViewTransition()."""
self._mods["view-transition"] = []
return self
Expand Down