File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44import re
55from collections .abc import Iterable , Iterator , Mapping
66from itertools import chain
7- from typing import TYPE_CHECKING , Literal , TypeAlias , Union
7+ from typing import TYPE_CHECKING , Literal , TypeAlias
88
99if TYPE_CHECKING :
1010 from typing import Self
100100]
101101
102102
103- SignalValue : TypeAlias = Union [
104- str ,
105- int ,
106- float ,
107- bool ,
108- dict [str , "SignalValue" ],
109- list ["SignalValue" ],
110- None ,
111- ]
103+ SignalValue : TypeAlias = (
104+ str | int | float | bool | dict [str , "SignalValue" ] | list ["SignalValue" ] | None
105+ )
112106
113107
114108class AttributeGenerator :
@@ -624,6 +618,17 @@ def full(self) -> Self:
624618 self ._mods ["full" ] = []
625619 return self
626620
621+ @property
622+ def exit (self ) -> Self :
623+ """Trigger the event listener when the element exits the viewport."""
624+ self ._mods ["exit" ] = []
625+ return self
626+
627+ def threshold (self , threshold : int ) -> Self :
628+ """Trigger the event listener when the element enters the viewport at the specified percentage."""
629+ self ._mods ["threshold" ] = [str (threshold )]
630+ return self
631+
627632
628633class OnIntervalAttr (BaseAttr , ViewtransitionMod ):
629634 _attr = "on-interval"
You can’t perform that action at this time.
0 commit comments