reflex 0.7.0a1__py3-none-any.whl → 0.7.0a3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of reflex might be problematic. Click here for more details.

Files changed (129) hide show
  1. reflex/.templates/jinja/web/pages/utils.js.jinja2 +1 -1
  2. reflex/app.py +6 -8
  3. reflex/components/base/app_wrap.pyi +16 -16
  4. reflex/components/base/body.pyi +16 -16
  5. reflex/components/base/document.pyi +76 -76
  6. reflex/components/base/error_boundary.pyi +17 -21
  7. reflex/components/base/fragment.pyi +16 -16
  8. reflex/components/base/head.pyi +31 -31
  9. reflex/components/base/link.pyi +31 -31
  10. reflex/components/base/meta.pyi +61 -61
  11. reflex/components/base/script.pyi +19 -19
  12. reflex/components/base/strict_mode.pyi +16 -16
  13. reflex/components/core/banner.py +95 -19
  14. reflex/components/core/banner.pyi +91 -91
  15. reflex/components/core/client_side_routing.pyi +31 -31
  16. reflex/components/core/clipboard.pyi +17 -20
  17. reflex/components/core/debounce.pyi +17 -17
  18. reflex/components/core/foreach.py +5 -0
  19. reflex/components/core/html.pyi +16 -16
  20. reflex/components/core/sticky.pyi +61 -61
  21. reflex/components/core/upload.pyi +80 -88
  22. reflex/components/datadisplay/code.pyi +31 -31
  23. reflex/components/datadisplay/dataeditor.pyi +40 -54
  24. reflex/components/datadisplay/shiki_code_block.pyi +46 -46
  25. reflex/components/el/element.pyi +16 -16
  26. reflex/components/el/elements/base.pyi +16 -16
  27. reflex/components/el/elements/forms.pyi +222 -256
  28. reflex/components/el/elements/inline.pyi +421 -421
  29. reflex/components/el/elements/media.pyi +376 -376
  30. reflex/components/el/elements/metadata.pyi +91 -91
  31. reflex/components/el/elements/other.pyi +106 -106
  32. reflex/components/el/elements/scripts.pyi +46 -46
  33. reflex/components/el/elements/sectioning.pyi +226 -226
  34. reflex/components/el/elements/tables.pyi +151 -151
  35. reflex/components/el/elements/typography.pyi +226 -226
  36. reflex/components/gridjs/datatable.pyi +31 -31
  37. reflex/components/lucide/icon.pyi +46 -46
  38. reflex/components/markdown/markdown.pyi +16 -16
  39. reflex/components/moment/moment.pyi +17 -19
  40. reflex/components/next/base.pyi +16 -16
  41. reflex/components/next/image.pyi +18 -18
  42. reflex/components/next/link.pyi +16 -16
  43. reflex/components/next/video.pyi +16 -16
  44. reflex/components/plotly/plotly.pyi +34 -44
  45. reflex/components/radix/primitives/accordion.pyi +107 -107
  46. reflex/components/radix/primitives/base.pyi +31 -31
  47. reflex/components/radix/primitives/drawer.pyi +175 -183
  48. reflex/components/radix/primitives/form.pyi +160 -172
  49. reflex/components/radix/primitives/progress.pyi +76 -76
  50. reflex/components/radix/primitives/slider.pyi +78 -82
  51. reflex/components/radix/themes/base.pyi +121 -121
  52. reflex/components/radix/themes/color_mode.pyi +47 -49
  53. reflex/components/radix/themes/components/alert_dialog.pyi +110 -112
  54. reflex/components/radix/themes/components/aspect_ratio.pyi +16 -16
  55. reflex/components/radix/themes/components/avatar.pyi +16 -16
  56. reflex/components/radix/themes/components/badge.pyi +16 -16
  57. reflex/components/radix/themes/components/button.pyi +16 -16
  58. reflex/components/radix/themes/components/callout.pyi +76 -76
  59. reflex/components/radix/themes/components/card.pyi +16 -16
  60. reflex/components/radix/themes/components/checkbox.pyi +49 -55
  61. reflex/components/radix/themes/components/checkbox_cards.pyi +31 -31
  62. reflex/components/radix/themes/components/checkbox_group.pyi +31 -31
  63. reflex/components/radix/themes/components/context_menu.pyi +149 -155
  64. reflex/components/radix/themes/components/data_list.pyi +61 -61
  65. reflex/components/radix/themes/components/dialog.pyi +113 -117
  66. reflex/components/radix/themes/components/dropdown_menu.pyi +133 -137
  67. reflex/components/radix/themes/components/hover_card.pyi +63 -67
  68. reflex/components/radix/themes/components/icon_button.pyi +16 -16
  69. reflex/components/radix/themes/components/inset.pyi +16 -16
  70. reflex/components/radix/themes/components/popover.pyi +68 -70
  71. reflex/components/radix/themes/components/progress.pyi +16 -16
  72. reflex/components/radix/themes/components/radio.pyi +16 -16
  73. reflex/components/radix/themes/components/radio_cards.pyi +32 -34
  74. reflex/components/radix/themes/components/radio_group.pyi +62 -64
  75. reflex/components/radix/themes/components/scroll_area.pyi +16 -16
  76. reflex/components/radix/themes/components/segmented_control.pyi +32 -35
  77. reflex/components/radix/themes/components/select.py +1 -0
  78. reflex/components/radix/themes/components/select.pyi +145 -157
  79. reflex/components/radix/themes/components/separator.pyi +16 -16
  80. reflex/components/radix/themes/components/skeleton.py +3 -0
  81. reflex/components/radix/themes/components/skeleton.pyi +16 -16
  82. reflex/components/radix/themes/components/slider.pyi +22 -28
  83. reflex/components/radix/themes/components/spinner.pyi +16 -16
  84. reflex/components/radix/themes/components/switch.pyi +17 -19
  85. reflex/components/radix/themes/components/table.pyi +106 -106
  86. reflex/components/radix/themes/components/tabs.pyi +78 -82
  87. reflex/components/radix/themes/components/text_area.pyi +19 -33
  88. reflex/components/radix/themes/components/text_field.pyi +52 -80
  89. reflex/components/radix/themes/components/tooltip.py +3 -0
  90. reflex/components/radix/themes/components/tooltip.pyi +19 -21
  91. reflex/components/radix/themes/layout/base.pyi +16 -16
  92. reflex/components/radix/themes/layout/box.pyi +16 -16
  93. reflex/components/radix/themes/layout/center.pyi +16 -16
  94. reflex/components/radix/themes/layout/container.pyi +16 -16
  95. reflex/components/radix/themes/layout/flex.pyi +16 -16
  96. reflex/components/radix/themes/layout/grid.pyi +16 -16
  97. reflex/components/radix/themes/layout/list.pyi +76 -76
  98. reflex/components/radix/themes/layout/section.pyi +16 -16
  99. reflex/components/radix/themes/layout/spacer.pyi +16 -16
  100. reflex/components/radix/themes/layout/stack.pyi +46 -46
  101. reflex/components/radix/themes/typography/blockquote.pyi +16 -16
  102. reflex/components/radix/themes/typography/code.pyi +16 -16
  103. reflex/components/radix/themes/typography/heading.pyi +16 -16
  104. reflex/components/radix/themes/typography/link.pyi +16 -16
  105. reflex/components/radix/themes/typography/text.pyi +106 -106
  106. reflex/components/react_player/audio.pyi +33 -39
  107. reflex/components/react_player/react_player.pyi +32 -38
  108. reflex/components/react_player/video.pyi +33 -39
  109. reflex/components/recharts/cartesian.pyi +282 -282
  110. reflex/components/recharts/charts.pyi +164 -164
  111. reflex/components/recharts/general.pyi +92 -92
  112. reflex/components/recharts/polar.pyi +55 -55
  113. reflex/components/recharts/recharts.pyi +31 -31
  114. reflex/components/sonner/toast.pyi +16 -16
  115. reflex/components/suneditor/editor.pyi +24 -38
  116. reflex/custom_components/custom_components.py +10 -4
  117. reflex/event.py +89 -51
  118. reflex/experimental/layout.pyi +78 -82
  119. reflex/page.py +2 -2
  120. reflex/utils/exceptions.py +13 -0
  121. reflex/utils/format.py +1 -1
  122. reflex/utils/prerequisites.py +3 -3
  123. reflex/utils/pyi_generator.py +9 -8
  124. reflex/vars/base.py +10 -4
  125. {reflex-0.7.0a1.dist-info → reflex-0.7.0a3.dist-info}/METADATA +1 -1
  126. {reflex-0.7.0a1.dist-info → reflex-0.7.0a3.dist-info}/RECORD +129 -129
  127. {reflex-0.7.0a1.dist-info → reflex-0.7.0a3.dist-info}/LICENSE +0 -0
  128. {reflex-0.7.0a1.dist-info → reflex-0.7.0a3.dist-info}/WHEEL +0 -0
  129. {reflex-0.7.0a1.dist-info → reflex-0.7.0a3.dist-info}/entry_points.txt +0 -0
@@ -14,7 +14,7 @@ from typing import Optional, Tuple
14
14
  import httpx
15
15
  import tomlkit
16
16
  import typer
17
- from tomlkit.exceptions import TOMLKitError
17
+ from tomlkit.exceptions import NonExistentKey, TOMLKitError
18
18
 
19
19
  from reflex import constants
20
20
  from reflex.config import environment, get_config
@@ -533,7 +533,13 @@ def _get_version_to_publish() -> str:
533
533
  Returns:
534
534
  The version to publish.
535
535
  """
536
- return _get_package_config()["project"]["version"]
536
+ try:
537
+ return _get_package_config()["project"]["version"]
538
+ except NonExistentKey:
539
+ # Try to get the version from dynamic sources
540
+ import build.util
541
+
542
+ return build.util.project_wheel_metadata(".", isolated=True)["version"]
537
543
 
538
544
 
539
545
  def _ensure_dist_dir(version_to_publish: str, build: bool):
@@ -756,7 +762,7 @@ def _min_validate_project_info():
756
762
  )
757
763
  raise typer.Exit(code=1)
758
764
 
759
- if not project.get("version"):
765
+ if not project.get("version") and "version" not in project.get("dynamic", []):
760
766
  console.error(
761
767
  f"The project version is not found in {CustomComponents.PYPROJECT_TOML}"
762
768
  )
@@ -772,7 +778,7 @@ def _validate_project_info():
772
778
  pyproject_toml = _get_package_config()
773
779
  project = pyproject_toml["project"]
774
780
  console.print(
775
- f"Double check the information before publishing: {project['name']} version {project['version']}"
781
+ f"Double check the information before publishing: {project['name']} version {_get_version_to_publish()}"
776
782
  )
777
783
 
778
784
  console.print("Update or enter to keep the current information.")
reflex/event.py CHANGED
@@ -25,12 +25,12 @@ from typing import (
25
25
  )
26
26
 
27
27
  from typing_extensions import (
28
- Concatenate,
29
- ParamSpec,
30
28
  Protocol,
31
29
  TypeAliasType,
32
30
  TypedDict,
33
31
  TypeVar,
32
+ TypeVarTuple,
33
+ Unpack,
34
34
  get_args,
35
35
  get_origin,
36
36
  )
@@ -1092,7 +1092,7 @@ def _callback_arg_spec(eval_result: Any):
1092
1092
 
1093
1093
  def call_script(
1094
1094
  javascript_code: str | Var[str],
1095
- callback: EventType | None = None,
1095
+ callback: EventType[Any] | None = None,
1096
1096
  ) -> EventSpec:
1097
1097
  """Create an event handler that executes arbitrary javascript code.
1098
1098
 
@@ -1131,7 +1131,7 @@ def call_script(
1131
1131
 
1132
1132
  def call_function(
1133
1133
  javascript_code: str | Var,
1134
- callback: EventType | None = None,
1134
+ callback: EventType[Any] | None = None,
1135
1135
  ) -> EventSpec:
1136
1136
  """Create an event handler that executes arbitrary javascript code.
1137
1137
 
@@ -1165,7 +1165,7 @@ def call_function(
1165
1165
 
1166
1166
  def run_script(
1167
1167
  javascript_code: str | Var,
1168
- callback: EventType | None = None,
1168
+ callback: EventType[Any] | None = None,
1169
1169
  ) -> EventSpec:
1170
1170
  """Create an event handler that executes arbitrary javascript code.
1171
1171
 
@@ -1763,8 +1763,8 @@ class LiteralEventChainVar(ArgsFunctionOperationBuilder, LiteralVar, EventChainV
1763
1763
  )
1764
1764
 
1765
1765
 
1766
- P = ParamSpec("P")
1767
- Q = ParamSpec("Q")
1766
+ P = TypeVarTuple("P")
1767
+ Q = TypeVarTuple("Q")
1768
1768
  T = TypeVar("T")
1769
1769
  V = TypeVar("V")
1770
1770
  V2 = TypeVar("V2")
@@ -1773,10 +1773,10 @@ V4 = TypeVar("V4")
1773
1773
  V5 = TypeVar("V5")
1774
1774
 
1775
1775
 
1776
- class EventCallback(Generic[P, T]):
1776
+ class EventCallback(Generic[Unpack[P]]):
1777
1777
  """A descriptor that wraps a function to be used as an event."""
1778
1778
 
1779
- def __init__(self, func: Callable[Concatenate[Any, P], T]):
1779
+ def __init__(self, func: Callable[[Any, Unpack[P]], Any]):
1780
1780
  """Initialize the descriptor with the function to be wrapped.
1781
1781
 
1782
1782
  Args:
@@ -1804,37 +1804,37 @@ class EventCallback(Generic[P, T]):
1804
1804
 
1805
1805
  @overload
1806
1806
  def __call__(
1807
- self: EventCallback[Q, T],
1808
- ) -> EventCallback[Q, T]: ...
1807
+ self: EventCallback[Unpack[Q]],
1808
+ ) -> EventCallback[Unpack[Q]]: ...
1809
1809
 
1810
1810
  @overload
1811
1811
  def __call__(
1812
- self: EventCallback[Concatenate[V, Q], T], value: V | Var[V]
1813
- ) -> EventCallback[Q, T]: ...
1812
+ self: EventCallback[V, Unpack[Q]], value: V | Var[V]
1813
+ ) -> EventCallback[Unpack[Q]]: ...
1814
1814
 
1815
1815
  @overload
1816
1816
  def __call__(
1817
- self: EventCallback[Concatenate[V, V2, Q], T],
1817
+ self: EventCallback[V, V2, Unpack[Q]],
1818
1818
  value: V | Var[V],
1819
1819
  value2: V2 | Var[V2],
1820
- ) -> EventCallback[Q, T]: ...
1820
+ ) -> EventCallback[Unpack[Q]]: ...
1821
1821
 
1822
1822
  @overload
1823
1823
  def __call__(
1824
- self: EventCallback[Concatenate[V, V2, V3, Q], T],
1824
+ self: EventCallback[V, V2, V3, Unpack[Q]],
1825
1825
  value: V | Var[V],
1826
1826
  value2: V2 | Var[V2],
1827
1827
  value3: V3 | Var[V3],
1828
- ) -> EventCallback[Q, T]: ...
1828
+ ) -> EventCallback[Unpack[Q]]: ...
1829
1829
 
1830
1830
  @overload
1831
1831
  def __call__(
1832
- self: EventCallback[Concatenate[V, V2, V3, V4, Q], T],
1832
+ self: EventCallback[V, V2, V3, V4, Unpack[Q]],
1833
1833
  value: V | Var[V],
1834
1834
  value2: V2 | Var[V2],
1835
1835
  value3: V3 | Var[V3],
1836
1836
  value4: V4 | Var[V4],
1837
- ) -> EventCallback[Q, T]: ...
1837
+ ) -> EventCallback[Unpack[Q]]: ...
1838
1838
 
1839
1839
  def __call__(self, *values) -> EventCallback: # pyright: ignore [reportInconsistentOverload]
1840
1840
  """Call the function with the values.
@@ -1845,15 +1845,15 @@ class EventCallback(Generic[P, T]):
1845
1845
  Returns:
1846
1846
  The function with the values.
1847
1847
  """
1848
- return self.func(*values) # pyright: ignore [reportCallIssue, reportReturnType]
1848
+ return self.func(*values) # pyright: ignore [reportArgumentType]
1849
1849
 
1850
1850
  @overload
1851
1851
  def __get__(
1852
- self: EventCallback[P, T], instance: None, owner: Any
1853
- ) -> EventCallback[P, T]: ...
1852
+ self: EventCallback[Unpack[P]], instance: None, owner: Any
1853
+ ) -> EventCallback[Unpack[P]]: ...
1854
1854
 
1855
1855
  @overload
1856
- def __get__(self, instance: Any, owner: Any) -> Callable[P, T]: ...
1856
+ def __get__(self, instance: Any, owner: Any) -> Callable[[Unpack[P]]]: ...
1857
1857
 
1858
1858
  def __get__(self, instance: Any, owner: Any) -> Callable:
1859
1859
  """Get the function with the instance bound to it.
@@ -1871,33 +1871,69 @@ class EventCallback(Generic[P, T]):
1871
1871
  return partial(self.func, instance)
1872
1872
 
1873
1873
 
1874
- G = ParamSpec("G")
1874
+ class LambdaEventCallback(Protocol[Unpack[P]]):
1875
+ """A protocol for a lambda event callback."""
1875
1876
 
1876
- if TYPE_CHECKING:
1877
- from reflex.state import BaseState
1877
+ @overload
1878
+ def __call__(self: LambdaEventCallback[()]) -> Any: ...
1878
1879
 
1879
- BASE_STATE = TypeVar("BASE_STATE", bound=BaseState)
1880
- else:
1881
- BASE_STATE = TypeVar("BASE_STATE")
1880
+ @overload
1881
+ def __call__(self: LambdaEventCallback[V], value: Var[V], /) -> Any: ...
1882
+
1883
+ @overload
1884
+ def __call__(
1885
+ self: LambdaEventCallback[V, V2], value: Var[V], value2: Var[V2], /
1886
+ ) -> Any: ...
1887
+
1888
+ @overload
1889
+ def __call__(
1890
+ self: LambdaEventCallback[V, V2, V3],
1891
+ value: Var[V],
1892
+ value2: Var[V2],
1893
+ value3: Var[V3],
1894
+ /,
1895
+ ) -> Any: ...
1896
+
1897
+ def __call__(self, *args: Var) -> Any:
1898
+ """Call the lambda with the args.
1899
+
1900
+ Args:
1901
+ *args: The args to call the lambda with.
1902
+ """
1903
+
1904
+
1905
+ ARGS = TypeVarTuple("ARGS")
1906
+
1907
+
1908
+ LAMBDA_OR_STATE = TypeAliasType(
1909
+ "LAMBDA_OR_STATE",
1910
+ LambdaEventCallback[Unpack[ARGS]] | EventCallback[Unpack[ARGS]],
1911
+ type_params=(ARGS,),
1912
+ )
1913
+
1914
+ ItemOrList = V | List[V]
1915
+
1916
+ BASIC_EVENT_TYPES = TypeAliasType(
1917
+ "BASIC_EVENT_TYPES", EventSpec | EventHandler | Var[Any], type_params=()
1918
+ )
1919
+
1920
+ IndividualEventType = TypeAliasType(
1921
+ "IndividualEventType",
1922
+ LAMBDA_OR_STATE[Unpack[ARGS]] | BASIC_EVENT_TYPES,
1923
+ type_params=(ARGS,),
1924
+ )
1882
1925
 
1883
- StateCallable = TypeAliasType(
1884
- "StateCallable",
1885
- Callable[Concatenate[BASE_STATE, G], Any],
1886
- type_params=(G, BASE_STATE),
1926
+ EventType = TypeAliasType(
1927
+ "EventType", ItemOrList[IndividualEventType[Unpack[ARGS]]], type_params=(ARGS,)
1887
1928
  )
1888
1929
 
1889
- IndividualEventType = Union[
1890
- EventSpec,
1891
- EventHandler,
1892
- Callable[G, Any],
1893
- StateCallable[G, BASE_STATE],
1894
- EventCallback[G, Any],
1895
- Var[Any],
1896
- ]
1897
1930
 
1898
- ItemOrList = Union[V, List[V]]
1931
+ if TYPE_CHECKING:
1932
+ from reflex.state import BaseState
1899
1933
 
1900
- EventType = ItemOrList[IndividualEventType[G, BASE_STATE]]
1934
+ BASE_STATE = TypeVar("BASE_STATE", bound=BaseState)
1935
+ else:
1936
+ BASE_STATE = TypeVar("BASE_STATE")
1901
1937
 
1902
1938
 
1903
1939
  class EventNamespace(types.SimpleNamespace):
@@ -1919,24 +1955,26 @@ class EventNamespace(types.SimpleNamespace):
1919
1955
  @staticmethod
1920
1956
  def __call__(
1921
1957
  func: None = None, *, background: bool | None = None
1922
- ) -> Callable[[Callable[Concatenate[BASE_STATE, P], T]], EventCallback[P, T]]: ... # pyright: ignore [reportInvalidTypeVarUse]
1958
+ ) -> Callable[
1959
+ [Callable[[BASE_STATE, Unpack[P]], Any]], EventCallback[Unpack[P]] # pyright: ignore [reportInvalidTypeVarUse]
1960
+ ]: ...
1923
1961
 
1924
1962
  @overload
1925
1963
  @staticmethod
1926
1964
  def __call__(
1927
- func: Callable[Concatenate[BASE_STATE, P], T],
1965
+ func: Callable[[BASE_STATE, Unpack[P]], Any],
1928
1966
  *,
1929
1967
  background: bool | None = None,
1930
- ) -> EventCallback[P, T]: ...
1968
+ ) -> EventCallback[Unpack[P]]: ...
1931
1969
 
1932
1970
  @staticmethod
1933
1971
  def __call__(
1934
- func: Callable[Concatenate[BASE_STATE, P], T] | None = None,
1972
+ func: Callable[[BASE_STATE, Unpack[P]], Any] | None = None,
1935
1973
  *,
1936
1974
  background: bool | None = None,
1937
1975
  ) -> Union[
1938
- EventCallback[P, T],
1939
- Callable[[Callable[Concatenate[BASE_STATE, P], T]], EventCallback[P, T]],
1976
+ EventCallback[Unpack[P]],
1977
+ Callable[[Callable[[BASE_STATE, Unpack[P]], Any]], EventCallback[Unpack[P]]],
1940
1978
  ]:
1941
1979
  """Wrap a function to be used as an event.
1942
1980
 
@@ -1952,8 +1990,8 @@ class EventNamespace(types.SimpleNamespace):
1952
1990
  """
1953
1991
 
1954
1992
  def wrapper(
1955
- func: Callable[Concatenate[BASE_STATE, P], T],
1956
- ) -> EventCallback[P, T]:
1993
+ func: Callable[[BASE_STATE, Unpack[P]], T],
1994
+ ) -> EventCallback[Unpack[P]]:
1957
1995
  if background is True:
1958
1996
  if not inspect.iscoroutinefunction(
1959
1997
  func
@@ -10,7 +10,7 @@ from reflex.components.base.fragment import Fragment
10
10
  from reflex.components.component import Component, ComponentNamespace, MemoizationLeaf
11
11
  from reflex.components.radix.primitives.drawer import DrawerRoot
12
12
  from reflex.components.radix.themes.layout.box import Box
13
- from reflex.event import BASE_STATE, EventType
13
+ from reflex.event import EventType
14
14
  from reflex.state import ComponentState
15
15
  from reflex.style import Style
16
16
  from reflex.vars.base import Var
@@ -51,21 +51,21 @@ class Sidebar(Box, MemoizationLeaf):
51
51
  class_name: Optional[Any] = None,
52
52
  autofocus: Optional[bool] = None,
53
53
  custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
54
- on_blur: Optional[EventType[[], BASE_STATE]] = None,
55
- on_click: Optional[EventType[[], BASE_STATE]] = None,
56
- on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
57
- on_double_click: Optional[EventType[[], BASE_STATE]] = None,
58
- on_focus: Optional[EventType[[], BASE_STATE]] = None,
59
- on_mount: Optional[EventType[[], BASE_STATE]] = None,
60
- on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
61
- on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
62
- on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
63
- on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
64
- on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
65
- on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
66
- on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
67
- on_scroll: Optional[EventType[[], BASE_STATE]] = None,
68
- on_unmount: Optional[EventType[[], BASE_STATE]] = None,
54
+ on_blur: Optional[EventType[()]] = None,
55
+ on_click: Optional[EventType[()]] = None,
56
+ on_context_menu: Optional[EventType[()]] = None,
57
+ on_double_click: Optional[EventType[()]] = None,
58
+ on_focus: Optional[EventType[()]] = None,
59
+ on_mount: Optional[EventType[()]] = None,
60
+ on_mouse_down: Optional[EventType[()]] = None,
61
+ on_mouse_enter: Optional[EventType[()]] = None,
62
+ on_mouse_leave: Optional[EventType[()]] = None,
63
+ on_mouse_move: Optional[EventType[()]] = None,
64
+ on_mouse_out: Optional[EventType[()]] = None,
65
+ on_mouse_over: Optional[EventType[()]] = None,
66
+ on_mouse_up: Optional[EventType[()]] = None,
67
+ on_scroll: Optional[EventType[()]] = None,
68
+ on_unmount: Optional[EventType[()]] = None,
69
69
  **props,
70
70
  ) -> "Sidebar":
71
71
  """Create the sidebar component.
@@ -119,27 +119,23 @@ class DrawerSidebar(DrawerRoot):
119
119
  class_name: Optional[Any] = None,
120
120
  autofocus: Optional[bool] = None,
121
121
  custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
122
- on_animation_end: Optional[
123
- Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
124
- ] = None,
125
- on_blur: Optional[EventType[[], BASE_STATE]] = None,
126
- on_click: Optional[EventType[[], BASE_STATE]] = None,
127
- on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
128
- on_double_click: Optional[EventType[[], BASE_STATE]] = None,
129
- on_focus: Optional[EventType[[], BASE_STATE]] = None,
130
- on_mount: Optional[EventType[[], BASE_STATE]] = None,
131
- on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
132
- on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
133
- on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
134
- on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
135
- on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
136
- on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
137
- on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
138
- on_open_change: Optional[
139
- Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
140
- ] = None,
141
- on_scroll: Optional[EventType[[], BASE_STATE]] = None,
142
- on_unmount: Optional[EventType[[], BASE_STATE]] = None,
122
+ on_animation_end: Optional[Union[EventType[()], EventType[bool]]] = None,
123
+ on_blur: Optional[EventType[()]] = None,
124
+ on_click: Optional[EventType[()]] = None,
125
+ on_context_menu: Optional[EventType[()]] = None,
126
+ on_double_click: Optional[EventType[()]] = None,
127
+ on_focus: Optional[EventType[()]] = None,
128
+ on_mount: Optional[EventType[()]] = None,
129
+ on_mouse_down: Optional[EventType[()]] = None,
130
+ on_mouse_enter: Optional[EventType[()]] = None,
131
+ on_mouse_leave: Optional[EventType[()]] = None,
132
+ on_mouse_move: Optional[EventType[()]] = None,
133
+ on_mouse_out: Optional[EventType[()]] = None,
134
+ on_mouse_over: Optional[EventType[()]] = None,
135
+ on_mouse_up: Optional[EventType[()]] = None,
136
+ on_open_change: Optional[Union[EventType[()], EventType[bool]]] = None,
137
+ on_scroll: Optional[EventType[()]] = None,
138
+ on_unmount: Optional[EventType[()]] = None,
143
139
  **props,
144
140
  ) -> "DrawerSidebar":
145
141
  """Create the sidebar component.
@@ -173,21 +169,21 @@ class SidebarTrigger(Fragment):
173
169
  class_name: Optional[Any] = None,
174
170
  autofocus: Optional[bool] = None,
175
171
  custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
176
- on_blur: Optional[EventType[[], BASE_STATE]] = None,
177
- on_click: Optional[EventType[[], BASE_STATE]] = None,
178
- on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
179
- on_double_click: Optional[EventType[[], BASE_STATE]] = None,
180
- on_focus: Optional[EventType[[], BASE_STATE]] = None,
181
- on_mount: Optional[EventType[[], BASE_STATE]] = None,
182
- on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
183
- on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
184
- on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
185
- on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
186
- on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
187
- on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
188
- on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
189
- on_scroll: Optional[EventType[[], BASE_STATE]] = None,
190
- on_unmount: Optional[EventType[[], BASE_STATE]] = None,
172
+ on_blur: Optional[EventType[()]] = None,
173
+ on_click: Optional[EventType[()]] = None,
174
+ on_context_menu: Optional[EventType[()]] = None,
175
+ on_double_click: Optional[EventType[()]] = None,
176
+ on_focus: Optional[EventType[()]] = None,
177
+ on_mount: Optional[EventType[()]] = None,
178
+ on_mouse_down: Optional[EventType[()]] = None,
179
+ on_mouse_enter: Optional[EventType[()]] = None,
180
+ on_mouse_leave: Optional[EventType[()]] = None,
181
+ on_mouse_move: Optional[EventType[()]] = None,
182
+ on_mouse_out: Optional[EventType[()]] = None,
183
+ on_mouse_over: Optional[EventType[()]] = None,
184
+ on_mouse_up: Optional[EventType[()]] = None,
185
+ on_scroll: Optional[EventType[()]] = None,
186
+ on_unmount: Optional[EventType[()]] = None,
191
187
  **props,
192
188
  ) -> "SidebarTrigger":
193
189
  """Create the sidebar trigger component.
@@ -238,21 +234,21 @@ class Layout(Box):
238
234
  class_name: Optional[Any] = None,
239
235
  autofocus: Optional[bool] = None,
240
236
  custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
241
- on_blur: Optional[EventType[[], BASE_STATE]] = None,
242
- on_click: Optional[EventType[[], BASE_STATE]] = None,
243
- on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
244
- on_double_click: Optional[EventType[[], BASE_STATE]] = None,
245
- on_focus: Optional[EventType[[], BASE_STATE]] = None,
246
- on_mount: Optional[EventType[[], BASE_STATE]] = None,
247
- on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
248
- on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
249
- on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
250
- on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
251
- on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
252
- on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
253
- on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
254
- on_scroll: Optional[EventType[[], BASE_STATE]] = None,
255
- on_unmount: Optional[EventType[[], BASE_STATE]] = None,
237
+ on_blur: Optional[EventType[()]] = None,
238
+ on_click: Optional[EventType[()]] = None,
239
+ on_context_menu: Optional[EventType[()]] = None,
240
+ on_double_click: Optional[EventType[()]] = None,
241
+ on_focus: Optional[EventType[()]] = None,
242
+ on_mount: Optional[EventType[()]] = None,
243
+ on_mouse_down: Optional[EventType[()]] = None,
244
+ on_mouse_enter: Optional[EventType[()]] = None,
245
+ on_mouse_leave: Optional[EventType[()]] = None,
246
+ on_mouse_move: Optional[EventType[()]] = None,
247
+ on_mouse_out: Optional[EventType[()]] = None,
248
+ on_mouse_over: Optional[EventType[()]] = None,
249
+ on_mouse_up: Optional[EventType[()]] = None,
250
+ on_scroll: Optional[EventType[()]] = None,
251
+ on_unmount: Optional[EventType[()]] = None,
256
252
  **props,
257
253
  ) -> "Layout":
258
254
  """Create the layout component.
@@ -306,21 +302,21 @@ class LayoutNamespace(ComponentNamespace):
306
302
  class_name: Optional[Any] = None,
307
303
  autofocus: Optional[bool] = None,
308
304
  custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
309
- on_blur: Optional[EventType[[], BASE_STATE]] = None,
310
- on_click: Optional[EventType[[], BASE_STATE]] = None,
311
- on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
312
- on_double_click: Optional[EventType[[], BASE_STATE]] = None,
313
- on_focus: Optional[EventType[[], BASE_STATE]] = None,
314
- on_mount: Optional[EventType[[], BASE_STATE]] = None,
315
- on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
316
- on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
317
- on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
318
- on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
319
- on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
320
- on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
321
- on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
322
- on_scroll: Optional[EventType[[], BASE_STATE]] = None,
323
- on_unmount: Optional[EventType[[], BASE_STATE]] = None,
305
+ on_blur: Optional[EventType[()]] = None,
306
+ on_click: Optional[EventType[()]] = None,
307
+ on_context_menu: Optional[EventType[()]] = None,
308
+ on_double_click: Optional[EventType[()]] = None,
309
+ on_focus: Optional[EventType[()]] = None,
310
+ on_mount: Optional[EventType[()]] = None,
311
+ on_mouse_down: Optional[EventType[()]] = None,
312
+ on_mouse_enter: Optional[EventType[()]] = None,
313
+ on_mouse_leave: Optional[EventType[()]] = None,
314
+ on_mouse_move: Optional[EventType[()]] = None,
315
+ on_mouse_out: Optional[EventType[()]] = None,
316
+ on_mouse_over: Optional[EventType[()]] = None,
317
+ on_mouse_up: Optional[EventType[()]] = None,
318
+ on_scroll: Optional[EventType[()]] = None,
319
+ on_unmount: Optional[EventType[()]] = None,
324
320
  **props,
325
321
  ) -> "Layout":
326
322
  """Create the layout component.
reflex/page.py CHANGED
@@ -6,7 +6,7 @@ from collections import defaultdict
6
6
  from typing import Any, Callable, Dict, List
7
7
 
8
8
  from reflex.config import get_config
9
- from reflex.event import BASE_STATE, EventType
9
+ from reflex.event import EventType
10
10
 
11
11
  DECORATED_PAGES: Dict[str, List] = defaultdict(list)
12
12
 
@@ -18,7 +18,7 @@ def page(
18
18
  description: str | None = None,
19
19
  meta: list[Any] | None = None,
20
20
  script_tags: list[Any] | None = None,
21
- on_load: EventType[[], BASE_STATE] | None = None,
21
+ on_load: EventType[()] | None = None,
22
22
  ):
23
23
  """Decorate a function as a page.
24
24
 
@@ -91,6 +91,19 @@ class UntypedComputedVarError(ReflexError, TypeError):
91
91
  super().__init__(f"Computed var '{var_name}' must have a type annotation.")
92
92
 
93
93
 
94
+ class ComputedVarSignatureError(ReflexError, TypeError):
95
+ """Custom TypeError for computed var signature errors."""
96
+
97
+ def __init__(self, var_name: str, signature: str):
98
+ """Initialize the ComputedVarSignatureError.
99
+
100
+ Args:
101
+ var_name: The name of the var.
102
+ signature: The invalid signature.
103
+ """
104
+ super().__init__(f"Computed var `{var_name}{signature}` cannot take arguments.")
105
+
106
+
94
107
  class MissingAnnotationError(ReflexError, TypeError):
95
108
  """Custom TypeError for missing annotations."""
96
109
 
reflex/utils/format.py CHANGED
@@ -502,7 +502,7 @@ if TYPE_CHECKING:
502
502
 
503
503
 
504
504
  def format_queue_events(
505
- events: EventType | None = None,
505
+ events: EventType[Any] | None = None,
506
506
  args_spec: Optional[ArgsSpec] = None,
507
507
  ) -> Var[EventChain]:
508
508
  """Format a list of event handler / event spec as a javascript callback.
@@ -64,7 +64,7 @@ class Template:
64
64
  name: str
65
65
  description: str
66
66
  code_url: str
67
- demo_url: str
67
+ demo_url: str | None = None
68
68
 
69
69
 
70
70
  @dataclasses.dataclass(frozen=True)
@@ -1293,7 +1293,7 @@ def validate_bun():
1293
1293
  """
1294
1294
  bun_path = path_ops.get_bun_path()
1295
1295
 
1296
- if bun_path and bun_path.samefile(constants.Bun.DEFAULT_PATH):
1296
+ if bun_path and not bun_path.samefile(constants.Bun.DEFAULT_PATH):
1297
1297
  console.info(f"Using custom Bun path: {bun_path}")
1298
1298
  bun_version = get_bun_version()
1299
1299
  if not bun_version:
@@ -1461,7 +1461,7 @@ def prompt_for_template_options(templates: list[Template]) -> str:
1461
1461
  # Show the user the URLs of each template to preview.
1462
1462
  console.print("\nGet started with a template:")
1463
1463
 
1464
- def format_demo_url_str(url: str) -> str:
1464
+ def format_demo_url_str(url: str | None) -> str:
1465
1465
  return f" ({url})" if url else ""
1466
1466
 
1467
1467
  # Prompt the user to select a template.
@@ -75,7 +75,6 @@ DEFAULT_IMPORTS = {
75
75
  "EventHandler",
76
76
  "EventSpec",
77
77
  "EventType",
78
- "BASE_STATE",
79
78
  "KeyInputInfo",
80
79
  ],
81
80
  "reflex.style": ["Style"],
@@ -502,7 +501,7 @@ def _generate_component_create_functiondef(
502
501
 
503
502
  def figure_out_return_type(annotation: Any):
504
503
  if inspect.isclass(annotation) and issubclass(annotation, inspect._empty):
505
- return ast.Name(id="EventType[..., BASE_STATE]")
504
+ return ast.Name(id="EventType[Any]")
506
505
 
507
506
  if not isinstance(annotation, str) and get_origin(annotation) is tuple:
508
507
  arguments = get_args(annotation)
@@ -518,8 +517,10 @@ def _generate_component_create_functiondef(
518
517
  # Get all prefixes of the type arguments
519
518
  all_count_args_type = [
520
519
  ast.Name(
521
- f"EventType[[{', '.join([ast.unparse(arg) for arg in type_args[:i]])}], BASE_STATE]"
520
+ f"EventType[{', '.join([ast.unparse(arg) for arg in type_args[:i]])}]"
522
521
  )
522
+ if i > 0
523
+ else ast.Name("EventType[()]")
523
524
  for i in range(len(type_args) + 1)
524
525
  ]
525
526
 
@@ -532,7 +533,7 @@ def _generate_component_create_functiondef(
532
533
  inside_of_tuple = annotation.removeprefix("Tuple[").removesuffix("]")
533
534
 
534
535
  if inside_of_tuple == "()":
535
- return ast.Name(id="EventType[[], BASE_STATE]")
536
+ return ast.Name(id="EventType[()]")
536
537
 
537
538
  arguments = [""]
538
539
 
@@ -559,16 +560,16 @@ def _generate_component_create_functiondef(
559
560
  ]
560
561
 
561
562
  all_count_args_type = [
562
- ast.Name(
563
- f"EventType[[{', '.join(arguments_without_var[:i])}], BASE_STATE]"
564
- )
563
+ ast.Name(f"EventType[{', '.join(arguments_without_var[:i])}]")
564
+ if i > 0
565
+ else ast.Name("EventType[()]")
565
566
  for i in range(len(arguments) + 1)
566
567
  ]
567
568
 
568
569
  return ast.Name(
569
570
  id=f"Union[{', '.join(map(ast.unparse, all_count_args_type))}]"
570
571
  )
571
- return ast.Name(id="EventType[..., BASE_STATE]")
572
+ return ast.Name(id="EventType[Any]")
572
573
 
573
574
  event_triggers = clz().get_event_triggers()
574
575