reflex 0.8.4a2__py3-none-any.whl → 0.8.5a1__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 (141) hide show
  1. reflex/__init__.py +2 -9
  2. reflex/__init__.pyi +4 -2
  3. reflex/app.py +16 -10
  4. reflex/compiler/compiler.py +10 -3
  5. reflex/components/base/app_wrap.pyi +0 -1
  6. reflex/components/base/body.pyi +0 -2
  7. reflex/components/base/document.pyi +0 -12
  8. reflex/components/base/error_boundary.pyi +0 -2
  9. reflex/components/base/fragment.pyi +0 -2
  10. reflex/components/base/link.pyi +0 -4
  11. reflex/components/base/meta.pyi +0 -6
  12. reflex/components/base/script.py +0 -2
  13. reflex/components/base/script.pyi +0 -2
  14. reflex/components/base/strict_mode.pyi +0 -2
  15. reflex/components/component.py +2 -30
  16. reflex/components/core/auto_scroll.pyi +0 -2
  17. reflex/components/core/banner.pyi +0 -10
  18. reflex/components/core/client_side_routing.pyi +0 -2
  19. reflex/components/core/clipboard.py +1 -3
  20. reflex/components/core/clipboard.pyi +0 -2
  21. reflex/components/core/cond.py +0 -2
  22. reflex/components/core/debounce.pyi +0 -1
  23. reflex/components/core/helmet.pyi +0 -2
  24. reflex/components/core/html.pyi +0 -2
  25. reflex/components/core/match.py +1 -2
  26. reflex/components/core/sticky.pyi +0 -4
  27. reflex/components/core/upload.pyi +0 -10
  28. reflex/components/core/window_events.pyi +0 -2
  29. reflex/components/datadisplay/code.py +6 -4
  30. reflex/components/datadisplay/code.pyi +0 -4
  31. reflex/components/datadisplay/dataeditor.pyi +0 -2
  32. reflex/components/datadisplay/shiki_code_block.pyi +0 -6
  33. reflex/components/el/element.pyi +0 -2
  34. reflex/components/el/elements/base.pyi +0 -2
  35. reflex/components/el/elements/forms.py +5 -21
  36. reflex/components/el/elements/forms.pyi +0 -38
  37. reflex/components/el/elements/inline.pyi +0 -56
  38. reflex/components/el/elements/media.pyi +0 -52
  39. reflex/components/el/elements/metadata.pyi +0 -12
  40. reflex/components/el/elements/other.pyi +0 -14
  41. reflex/components/el/elements/scripts.pyi +0 -6
  42. reflex/components/el/elements/sectioning.pyi +0 -30
  43. reflex/components/el/elements/tables.pyi +0 -20
  44. reflex/components/el/elements/typography.pyi +0 -32
  45. reflex/components/gridjs/datatable.pyi +0 -4
  46. reflex/components/lucide/icon.py +12 -1
  47. reflex/components/lucide/icon.pyi +12 -7
  48. reflex/components/markdown/markdown.pyi +0 -2
  49. reflex/components/moment/moment.pyi +0 -2
  50. reflex/components/plotly/plotly.py +25 -17
  51. reflex/components/plotly/plotly.pyi +0 -18
  52. reflex/components/radix/primitives/accordion.pyi +0 -14
  53. reflex/components/radix/primitives/base.pyi +0 -4
  54. reflex/components/radix/primitives/drawer.pyi +0 -22
  55. reflex/components/radix/primitives/form.pyi +0 -20
  56. reflex/components/radix/primitives/progress.pyi +0 -10
  57. reflex/components/radix/primitives/slider.pyi +0 -10
  58. reflex/components/radix/themes/base.py +2 -4
  59. reflex/components/radix/themes/base.pyi +0 -15
  60. reflex/components/radix/themes/color_mode.pyi +0 -5
  61. reflex/components/radix/themes/components/alert_dialog.pyi +0 -11
  62. reflex/components/radix/themes/components/aspect_ratio.pyi +0 -2
  63. reflex/components/radix/themes/components/avatar.pyi +0 -2
  64. reflex/components/radix/themes/components/badge.pyi +0 -2
  65. reflex/components/radix/themes/components/button.pyi +0 -2
  66. reflex/components/radix/themes/components/callout.pyi +0 -10
  67. reflex/components/radix/themes/components/card.pyi +0 -2
  68. reflex/components/radix/themes/components/checkbox.pyi +0 -6
  69. reflex/components/radix/themes/components/checkbox_cards.pyi +0 -4
  70. reflex/components/radix/themes/components/checkbox_group.pyi +0 -4
  71. reflex/components/radix/themes/components/context_menu.pyi +0 -26
  72. reflex/components/radix/themes/components/data_list.pyi +0 -8
  73. reflex/components/radix/themes/components/dialog.pyi +0 -12
  74. reflex/components/radix/themes/components/dropdown_menu.pyi +0 -14
  75. reflex/components/radix/themes/components/hover_card.pyi +0 -7
  76. reflex/components/radix/themes/components/icon_button.pyi +0 -2
  77. reflex/components/radix/themes/components/inset.pyi +0 -2
  78. reflex/components/radix/themes/components/popover.pyi +0 -6
  79. reflex/components/radix/themes/components/progress.pyi +0 -2
  80. reflex/components/radix/themes/components/radio.pyi +0 -2
  81. reflex/components/radix/themes/components/radio_cards.pyi +0 -4
  82. reflex/components/radix/themes/components/radio_group.pyi +0 -8
  83. reflex/components/radix/themes/components/scroll_area.pyi +0 -2
  84. reflex/components/radix/themes/components/segmented_control.pyi +0 -4
  85. reflex/components/radix/themes/components/select.pyi +0 -18
  86. reflex/components/radix/themes/components/separator.pyi +0 -2
  87. reflex/components/radix/themes/components/skeleton.pyi +0 -2
  88. reflex/components/radix/themes/components/slider.pyi +0 -2
  89. reflex/components/radix/themes/components/spinner.pyi +0 -2
  90. reflex/components/radix/themes/components/switch.pyi +0 -2
  91. reflex/components/radix/themes/components/table.pyi +0 -14
  92. reflex/components/radix/themes/components/tabs.pyi +0 -10
  93. reflex/components/radix/themes/components/text_area.pyi +0 -2
  94. reflex/components/radix/themes/components/text_field.pyi +0 -6
  95. reflex/components/radix/themes/components/tooltip.pyi +0 -2
  96. reflex/components/radix/themes/layout/base.pyi +0 -2
  97. reflex/components/radix/themes/layout/box.pyi +0 -2
  98. reflex/components/radix/themes/layout/center.pyi +0 -2
  99. reflex/components/radix/themes/layout/container.pyi +0 -1
  100. reflex/components/radix/themes/layout/flex.pyi +0 -2
  101. reflex/components/radix/themes/layout/grid.pyi +0 -2
  102. reflex/components/radix/themes/layout/list.pyi +0 -10
  103. reflex/components/radix/themes/layout/section.pyi +0 -2
  104. reflex/components/radix/themes/layout/spacer.pyi +0 -2
  105. reflex/components/radix/themes/layout/stack.pyi +0 -6
  106. reflex/components/radix/themes/typography/blockquote.pyi +0 -2
  107. reflex/components/radix/themes/typography/code.pyi +0 -2
  108. reflex/components/radix/themes/typography/heading.pyi +0 -2
  109. reflex/components/radix/themes/typography/link.pyi +0 -2
  110. reflex/components/radix/themes/typography/text.pyi +0 -14
  111. reflex/components/react_player/audio.pyi +0 -2
  112. reflex/components/react_player/react_player.pyi +0 -2
  113. reflex/components/react_player/video.pyi +0 -2
  114. reflex/components/react_router/dom.pyi +0 -2
  115. reflex/components/recharts/cartesian.pyi +0 -38
  116. reflex/components/recharts/charts.pyi +0 -24
  117. reflex/components/recharts/general.pyi +0 -12
  118. reflex/components/recharts/polar.pyi +0 -12
  119. reflex/components/recharts/recharts.pyi +0 -4
  120. reflex/components/sonner/toast.pyi +0 -2
  121. reflex/components/tags/cond_tag.py +4 -3
  122. reflex/components/tags/iter_tag.py +1 -1
  123. reflex/components/tags/match_tag.py +3 -2
  124. reflex/components/tags/tag.py +39 -40
  125. reflex/constants/compiler.py +0 -8
  126. reflex/constants/installer.py +5 -5
  127. reflex/event.py +77 -15
  128. reflex/page.py +62 -4
  129. reflex/reflex.py +2 -5
  130. reflex/utils/net.py +7 -2
  131. reflex/utils/prerequisites.py +8 -71
  132. reflex/utils/processes.py +6 -6
  133. {reflex-0.8.4a2.dist-info → reflex-0.8.5a1.dist-info}/METADATA +2 -2
  134. {reflex-0.8.4a2.dist-info → reflex-0.8.5a1.dist-info}/RECORD +137 -141
  135. reflex/components/el/constants/__init__.py +0 -5
  136. reflex/components/el/constants/html.py +0 -343
  137. reflex/components/el/constants/react.py +0 -501
  138. reflex/components/el/constants/reflex.py +0 -51
  139. {reflex-0.8.4a2.dist-info → reflex-0.8.5a1.dist-info}/WHEEL +0 -0
  140. {reflex-0.8.4a2.dist-info → reflex-0.8.5a1.dist-info}/entry_points.txt +0 -0
  141. {reflex-0.8.4a2.dist-info → reflex-0.8.5a1.dist-info}/licenses/LICENSE +0 -0
reflex/__init__.py CHANGED
@@ -84,20 +84,11 @@ In the example above, you will be able to do `rx.list`
84
84
 
85
85
  from __future__ import annotations
86
86
 
87
- from types import ModuleType
88
- from typing import Any
89
-
90
87
  from reflex.utils import (
91
88
  compat, # for side-effects
92
89
  lazy_loader,
93
90
  )
94
91
 
95
- from .event import event as event
96
-
97
- # import this here explicitly to avoid returning the page module since page attr has the
98
- # same name as page module(page.py)
99
- from .page import page as page
100
-
101
92
  # Remove the `compat` name from the namespace, it was imported for side-effects only.
102
93
  del compat
103
94
 
@@ -301,6 +292,7 @@ _MAPPING: dict = {
301
292
  "constants": ["Env"],
302
293
  "constants.colors": ["Color"],
303
294
  "event": [
295
+ "event",
304
296
  "EventChain",
305
297
  "EventHandler",
306
298
  "call_script",
@@ -331,6 +323,7 @@ _MAPPING: dict = {
331
323
  ],
332
324
  "middleware": ["middleware", "Middleware"],
333
325
  "model": ["asession", "session", "Model"],
326
+ "page": ["page"],
334
327
  "state": [
335
328
  "var",
336
329
  "ComponentState",
reflex/__init__.pyi CHANGED
@@ -130,6 +130,7 @@ from .event import (
130
130
  clear_session_storage,
131
131
  console_log,
132
132
  download,
133
+ event,
133
134
  noop,
134
135
  prevent_default,
135
136
  redirect,
@@ -145,13 +146,12 @@ from .event import (
145
146
  upload_files,
146
147
  window_alert,
147
148
  )
148
- from .event import event as event
149
149
  from .experimental import _x
150
150
  from .istate.storage import Cookie, LocalStorage, SessionStorage
151
151
  from .istate.wrappers import get_state
152
152
  from .middleware import Middleware, middleware
153
153
  from .model import Model, asession, session
154
- from .page import page as page
154
+ from .page import page
155
155
  from .state import ComponentState, State, dynamic, var
156
156
  from .style import Style, toggle_color_mode
157
157
  from .utils.imports import ImportDict, ImportVar
@@ -256,6 +256,7 @@ __all__ = [
256
256
  "dropdown_menu",
257
257
  "dynamic",
258
258
  "el",
259
+ "event",
259
260
  "field",
260
261
  "flex",
261
262
  "foreach",
@@ -290,6 +291,7 @@ __all__ = [
290
291
  "moment",
291
292
  "noop",
292
293
  "ordered_list",
294
+ "page",
293
295
  "plotly",
294
296
  "plugins",
295
297
  "popover",
reflex/app.py CHANGED
@@ -1186,8 +1186,8 @@ class App(MiddlewareMixin, LifespanMixin):
1186
1186
  progress.start()
1187
1187
  task = progress.add_task(
1188
1188
  f"[{get_compilation_time()}] Compiling:",
1189
- total=len(self._pages)
1190
- + (len(self._unevaluated_pages) * 2)
1189
+ total=len(self._unevaluated_pages)
1190
+ + ((len(self._unevaluated_pages) + len(self._pages)) * 3)
1191
1191
  + fixed_pages_within_executor
1192
1192
  + adhoc_steps_without_executor
1193
1193
  + plugin_count,
@@ -1272,14 +1272,17 @@ class App(MiddlewareMixin, LifespanMixin):
1272
1272
  all_imports.update(custom_components_imports)
1273
1273
  progress.advance(task)
1274
1274
 
1275
- # This has to happen before compiling stateful components as that
1276
- # prevents recursive functions from reaching all components.
1277
- for component in self._pages.values():
1278
- # Add component._get_all_imports() to all_imports.
1279
- all_imports.update(component._get_all_imports())
1275
+ with console.timing("Collect all imports and app wraps"):
1276
+ # This has to happen before compiling stateful components as that
1277
+ # prevents recursive functions from reaching all components.
1278
+ for component in self._pages.values():
1279
+ # Add component._get_all_imports() to all_imports.
1280
+ all_imports.update(component._get_all_imports())
1280
1281
 
1281
- # Add the app wrappers from this component.
1282
- app_wrappers.update(component._get_all_app_wrap_components())
1282
+ # Add the app wrappers from this component.
1283
+ app_wrappers.update(component._get_all_app_wrap_components())
1284
+
1285
+ progress.advance(task)
1283
1286
 
1284
1287
  # Perform auto-memoization of stateful components.
1285
1288
  with console.timing("Auto-memoize StatefulComponents"):
@@ -1287,7 +1290,10 @@ class App(MiddlewareMixin, LifespanMixin):
1287
1290
  stateful_components_path,
1288
1291
  stateful_components_code,
1289
1292
  page_components,
1290
- ) = compiler.compile_stateful_components(self._pages.values())
1293
+ ) = compiler.compile_stateful_components(
1294
+ self._pages.values(),
1295
+ progress_function=lambda task=task: progress.advance(task),
1296
+ )
1291
1297
  progress.advance(task)
1292
1298
 
1293
1299
  # Catch "static" apps (that do not define a rx.State subclass) which are trying to access rx.State.
@@ -3,7 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import sys
6
- from collections.abc import Iterable, Sequence
6
+ from collections.abc import Callable, Iterable, Sequence
7
7
  from inspect import getmodule
8
8
  from pathlib import Path
9
9
  from typing import TYPE_CHECKING
@@ -588,6 +588,7 @@ def compile_components(
588
588
 
589
589
  def compile_stateful_components(
590
590
  pages: Iterable[Component],
591
+ progress_function: Callable[[], None],
591
592
  ) -> tuple[str, str, list[BaseComponent]]:
592
593
  """Separately compile components that depend on State vars.
593
594
 
@@ -597,14 +598,20 @@ def compile_stateful_components(
597
598
 
598
599
  Args:
599
600
  pages: The pages to extract stateful components from.
601
+ progress_function: A function to call to indicate progress, called once per page.
600
602
 
601
603
  Returns:
602
604
  The path and code of the compiled stateful components.
603
605
  """
604
606
  output_path = utils.get_stateful_components_path()
605
607
 
606
- # Compile the stateful components.
607
- page_components = [StatefulComponent.compile_from(page) or page for page in pages]
608
+ page_components = []
609
+ for page in pages:
610
+ # Compile the stateful components
611
+ page_component = StatefulComponent.compile_from(page) or page
612
+ progress_function()
613
+ page_components.append(page_component)
614
+
608
615
  code = _compile_stateful_components(page_components)
609
616
  return output_path, code, page_components
610
617
 
@@ -25,7 +25,6 @@ class AppWrap(Fragment):
25
25
  id: Any | None = None,
26
26
  ref: Var | None = None,
27
27
  class_name: Any | None = None,
28
- autofocus: bool | None = None,
29
28
  custom_attrs: dict[str, Var | Any] | None = None,
30
29
  on_blur: EventType[()] | None = None,
31
30
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -203,7 +203,6 @@ class Body(elements.Body):
203
203
  id: Any | None = None,
204
204
  ref: Var | None = None,
205
205
  class_name: Any | None = None,
206
- autofocus: bool | None = None,
207
206
  custom_attrs: dict[str, Var | Any] | None = None,
208
207
  on_blur: EventType[()] | None = None,
209
208
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -248,7 +247,6 @@ class Body(elements.Body):
248
247
  id: The id for the component.
249
248
  ref: The Var to pass as the ref to the component.
250
249
  class_name: The class name for the component.
251
- autofocus: Whether the component should take the focus once the page is loaded
252
250
  custom_attrs: custom attribute
253
251
  **props: The props of the component.
254
252
 
@@ -25,7 +25,6 @@ class ReactRouterLib(Component):
25
25
  id: Any | None = None,
26
26
  ref: Var | None = None,
27
27
  class_name: Any | None = None,
28
- autofocus: bool | None = None,
29
28
  custom_attrs: dict[str, Var | Any] | None = None,
30
29
  on_blur: EventType[()] | None = None,
31
30
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -54,7 +53,6 @@ class ReactRouterLib(Component):
54
53
  id: The id for the component.
55
54
  ref: The Var to pass as the ref to the component.
56
55
  class_name: The class name for the component.
57
- autofocus: Whether the component should take the focus once the page is loaded
58
56
  custom_attrs: custom attribute
59
57
  **props: The props of the component.
60
58
 
@@ -76,7 +74,6 @@ class Meta(ReactRouterLib):
76
74
  id: Any | None = None,
77
75
  ref: Var | None = None,
78
76
  class_name: Any | None = None,
79
- autofocus: bool | None = None,
80
77
  custom_attrs: dict[str, Var | Any] | None = None,
81
78
  on_blur: EventType[()] | None = None,
82
79
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -105,7 +102,6 @@ class Meta(ReactRouterLib):
105
102
  id: The id for the component.
106
103
  ref: The Var to pass as the ref to the component.
107
104
  class_name: The class name for the component.
108
- autofocus: Whether the component should take the focus once the page is loaded
109
105
  custom_attrs: custom attribute
110
106
  **props: The props of the component.
111
107
 
@@ -127,7 +123,6 @@ class Links(ReactRouterLib):
127
123
  id: Any | None = None,
128
124
  ref: Var | None = None,
129
125
  class_name: Any | None = None,
130
- autofocus: bool | None = None,
131
126
  custom_attrs: dict[str, Var | Any] | None = None,
132
127
  on_blur: EventType[()] | None = None,
133
128
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -156,7 +151,6 @@ class Links(ReactRouterLib):
156
151
  id: The id for the component.
157
152
  ref: The Var to pass as the ref to the component.
158
153
  class_name: The class name for the component.
159
- autofocus: Whether the component should take the focus once the page is loaded
160
154
  custom_attrs: custom attribute
161
155
  **props: The props of the component.
162
156
 
@@ -178,7 +172,6 @@ class ScrollRestoration(ReactRouterLib):
178
172
  id: Any | None = None,
179
173
  ref: Var | None = None,
180
174
  class_name: Any | None = None,
181
- autofocus: bool | None = None,
182
175
  custom_attrs: dict[str, Var | Any] | None = None,
183
176
  on_blur: EventType[()] | None = None,
184
177
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -207,7 +200,6 @@ class ScrollRestoration(ReactRouterLib):
207
200
  id: The id for the component.
208
201
  ref: The Var to pass as the ref to the component.
209
202
  class_name: The class name for the component.
210
- autofocus: Whether the component should take the focus once the page is loaded
211
203
  custom_attrs: custom attribute
212
204
  **props: The props of the component.
213
205
 
@@ -229,7 +221,6 @@ class Outlet(ReactRouterLib):
229
221
  id: Any | None = None,
230
222
  ref: Var | None = None,
231
223
  class_name: Any | None = None,
232
- autofocus: bool | None = None,
233
224
  custom_attrs: dict[str, Var | Any] | None = None,
234
225
  on_blur: EventType[()] | None = None,
235
226
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -258,7 +249,6 @@ class Outlet(ReactRouterLib):
258
249
  id: The id for the component.
259
250
  ref: The Var to pass as the ref to the component.
260
251
  class_name: The class name for the component.
261
- autofocus: Whether the component should take the focus once the page is loaded
262
252
  custom_attrs: custom attribute
263
253
  **props: The props of the component.
264
254
 
@@ -280,7 +270,6 @@ class Scripts(ReactRouterLib):
280
270
  id: Any | None = None,
281
271
  ref: Var | None = None,
282
272
  class_name: Any | None = None,
283
- autofocus: bool | None = None,
284
273
  custom_attrs: dict[str, Var | Any] | None = None,
285
274
  on_blur: EventType[()] | None = None,
286
275
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -309,7 +298,6 @@ class Scripts(ReactRouterLib):
309
298
  id: The id for the component.
310
299
  ref: The Var to pass as the ref to the component.
311
300
  class_name: The class name for the component.
312
- autofocus: Whether the component should take the focus once the page is loaded
313
301
  custom_attrs: custom attribute
314
302
  **props: The props of the component.
315
303
 
@@ -31,7 +31,6 @@ class ErrorBoundary(Component):
31
31
  id: Any | None = None,
32
32
  ref: Var | None = None,
33
33
  class_name: Any | None = None,
34
- autofocus: bool | None = None,
35
34
  custom_attrs: dict[str, Var | Any] | None = None,
36
35
  on_blur: EventType[()] | None = None,
37
36
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -63,7 +62,6 @@ class ErrorBoundary(Component):
63
62
  id: The id for the component.
64
63
  ref: The Var to pass as the ref to the component.
65
64
  class_name: The class name for the component.
66
- autofocus: Whether the component should take the focus once the page is loaded
67
65
  custom_attrs: custom attribute
68
66
  **props: The props of the component.
69
67
 
@@ -25,7 +25,6 @@ class Fragment(Component):
25
25
  id: Any | None = None,
26
26
  ref: Var | None = None,
27
27
  class_name: Any | None = None,
28
- autofocus: bool | None = None,
29
28
  custom_attrs: dict[str, Var | Any] | None = None,
30
29
  on_blur: EventType[()] | None = None,
31
30
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -54,7 +53,6 @@ class Fragment(Component):
54
53
  id: The id for the component.
55
54
  ref: The Var to pass as the ref to the component.
56
55
  class_name: The class name for the component.
57
- autofocus: Whether the component should take the focus once the page is loaded
58
56
  custom_attrs: custom attribute
59
57
  **props: The props of the component.
60
58
 
@@ -205,7 +205,6 @@ class RawLink(BaseHTML):
205
205
  id: Any | None = None,
206
206
  ref: Var | None = None,
207
207
  class_name: Any | None = None,
208
- autofocus: bool | None = None,
209
208
  custom_attrs: dict[str, Var | Any] | None = None,
210
209
  on_blur: EventType[()] | None = None,
211
210
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -252,7 +251,6 @@ class RawLink(BaseHTML):
252
251
  id: The id for the component.
253
252
  ref: The Var to pass as the ref to the component.
254
253
  class_name: The class name for the component.
255
- autofocus: Whether the component should take the focus once the page is loaded
256
254
  custom_attrs: custom attribute
257
255
  **props: The props of the component.
258
256
 
@@ -459,7 +457,6 @@ class ScriptTag(BaseHTML):
459
457
  id: Any | None = None,
460
458
  ref: Var | None = None,
461
459
  class_name: Any | None = None,
462
- autofocus: bool | None = None,
463
460
  custom_attrs: dict[str, Var | Any] | None = None,
464
461
  on_blur: EventType[()] | None = None,
465
462
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -511,7 +508,6 @@ class ScriptTag(BaseHTML):
511
508
  id: The id for the component.
512
509
  ref: The Var to pass as the ref to the component.
513
510
  class_name: The class name for the component.
514
- autofocus: Whether the component should take the focus once the page is loaded
515
511
  custom_attrs: custom attribute
516
512
  **props: The props of the component.
517
513
 
@@ -27,7 +27,6 @@ class Title(elements.Title):
27
27
  id: Any | None = None,
28
28
  ref: Var | None = None,
29
29
  class_name: Any | None = None,
30
- autofocus: bool | None = None,
31
30
  custom_attrs: dict[str, Var | Any] | None = None,
32
31
  on_blur: EventType[()] | None = None,
33
32
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -56,7 +55,6 @@ class Title(elements.Title):
56
55
  id: The id for the component.
57
56
  ref: The Var to pass as the ref to the component.
58
57
  class_name: The class name for the component.
59
- autofocus: Whether the component should take the focus once the page is loaded
60
58
  custom_attrs: custom attribute
61
59
  **props: The props of the component.
62
60
 
@@ -261,7 +259,6 @@ class Description(elements.Meta):
261
259
  id: Any | None = None,
262
260
  ref: Var | None = None,
263
261
  class_name: Any | None = None,
264
- autofocus: bool | None = None,
265
262
  custom_attrs: dict[str, Var | Any] | None = None,
266
263
  on_blur: EventType[()] | None = None,
267
264
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -311,7 +308,6 @@ class Description(elements.Meta):
311
308
  id: The id for the component.
312
309
  ref: The Var to pass as the ref to the component.
313
310
  class_name: The class name for the component.
314
- autofocus: Whether the component should take the focus once the page is loaded
315
311
  custom_attrs: custom attribute
316
312
  **props: The props of the component.
317
313
 
@@ -516,7 +512,6 @@ class Image(elements.Meta):
516
512
  id: Any | None = None,
517
513
  ref: Var | None = None,
518
514
  class_name: Any | None = None,
519
- autofocus: bool | None = None,
520
515
  custom_attrs: dict[str, Var | Any] | None = None,
521
516
  on_blur: EventType[()] | None = None,
522
517
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -566,7 +561,6 @@ class Image(elements.Meta):
566
561
  id: The id for the component.
567
562
  ref: The Var to pass as the ref to the component.
568
563
  class_name: The class name for the component.
569
- autofocus: Whether the component should take the focus once the page is loaded
570
564
  custom_attrs: custom attribute
571
565
  **props: The props of the component.
572
566
 
@@ -39,7 +39,6 @@ class Script(elements.Script):
39
39
  key = props.pop("key", None)
40
40
  id = props.pop("id", None)
41
41
  class_name = props.pop("class_name", None)
42
- autofocus = props.pop("autofocus", None)
43
42
  custom_attrs = props.pop("custom_attrs", None)
44
43
  on_mount = props.pop("on_mount", None)
45
44
  on_unmount = props.pop("on_unmount", None)
@@ -67,7 +66,6 @@ class Script(elements.Script):
67
66
  key=key,
68
67
  id=id,
69
68
  class_name=class_name,
70
- autofocus=autofocus,
71
69
  custom_attrs=custom_attrs,
72
70
  on_mount=on_mount,
73
71
  on_unmount=on_unmount,
@@ -237,7 +237,6 @@ class Script(elements.Script):
237
237
  id: Any | None = None,
238
238
  ref: Var | None = None,
239
239
  class_name: Any | None = None,
240
- autofocus: bool | None = None,
241
240
  custom_attrs: dict[str, Var | Any] | None = None,
242
241
  on_blur: EventType[()] | None = None,
243
242
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -290,7 +289,6 @@ class Script(elements.Script):
290
289
  id: The id for the component.
291
290
  ref: The Var to pass as the ref to the component.
292
291
  class_name: The class name for the component.
293
- autofocus: Whether the component should take the focus once the page is loaded
294
292
  custom_attrs: custom attribute
295
293
  **props: The properties of the element.
296
294
 
@@ -25,7 +25,6 @@ class StrictMode(Component):
25
25
  id: Any | None = None,
26
26
  ref: Var | None = None,
27
27
  class_name: Any | None = None,
28
- autofocus: bool | None = None,
29
28
  custom_attrs: dict[str, Var | Any] | None = None,
30
29
  on_blur: EventType[()] | None = None,
31
30
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -54,7 +53,6 @@ class StrictMode(Component):
54
53
  id: The id for the component.
55
54
  ref: The Var to pass as the ref to the component.
56
55
  class_name: The class name for the component.
57
- autofocus: Whether the component should take the focus once the page is loaded
58
56
  custom_attrs: custom attribute
59
57
  **props: The props of the component.
60
58
 
@@ -588,9 +588,6 @@ class Component(BaseComponent, ABC):
588
588
  # Special component props.
589
589
  special_props: list[Var] = field(default_factory=list, is_javascript_property=False)
590
590
 
591
- # Whether the component should take the focus once the page is loaded
592
- autofocus: bool = field(default=False, is_javascript_property=False)
593
-
594
591
  # components that cannot be children
595
592
  _invalid_children: ClassVar[list[str]] = []
596
593
 
@@ -964,7 +961,7 @@ class Component(BaseComponent, ABC):
964
961
  # Create the base tag.
965
962
  tag = Tag(
966
963
  name=name,
967
- special_props=self.special_props,
964
+ special_props=self.special_props.copy(),
968
965
  )
969
966
 
970
967
  if props is None:
@@ -1274,9 +1271,7 @@ class Component(BaseComponent, ABC):
1274
1271
  tag.set(
1275
1272
  children=[child.render() for child in self.children],
1276
1273
  contents=str(tag.contents),
1277
- props=tag.format_props(),
1278
- ),
1279
- autofocus=self.autofocus,
1274
+ )
1280
1275
  )
1281
1276
  self._replace_prop_names(rendered_dict)
1282
1277
  return rendered_dict
@@ -1435,7 +1430,6 @@ class Component(BaseComponent, ABC):
1435
1430
  self.class_name,
1436
1431
  self.id,
1437
1432
  self.key,
1438
- self.autofocus,
1439
1433
  *self.custom_attrs.values(),
1440
1434
  ):
1441
1435
  if isinstance(comp_prop, Var):
@@ -1627,15 +1621,6 @@ class Component(BaseComponent, ABC):
1627
1621
  # Handle hooks for `on_mount` / `on_unmount`.
1628
1622
  _imports.setdefault("react", set()).add(ImportVar(tag="useEffect"))
1629
1623
 
1630
- if self._get_special_hooks():
1631
- # Handle additional internal hooks (autofocus, etc).
1632
- _imports.setdefault("react", set()).update(
1633
- {
1634
- ImportVar(tag="useRef"),
1635
- ImportVar(tag="useEffect"),
1636
- },
1637
- )
1638
-
1639
1624
  other_imports = []
1640
1625
  user_hooks = self._get_hooks()
1641
1626
  user_hooks_data = (
@@ -1781,18 +1766,6 @@ class Component(BaseComponent, ABC):
1781
1766
  else {}
1782
1767
  )
1783
1768
 
1784
- def _get_special_hooks(self) -> dict[str, VarData | None]:
1785
- """Get the hooks required by special actions referenced in this component.
1786
-
1787
- Returns:
1788
- The hooks for special actions.
1789
- """
1790
- return (
1791
- {Hooks.AUTOFOCUS: VarData(position=Hooks.HookPosition.INTERNAL)}
1792
- if self.autofocus
1793
- else {}
1794
- )
1795
-
1796
1769
  def _get_hooks_internal(self) -> dict[str, VarData | None]:
1797
1770
  """Get the React hooks for this component managed by the framework.
1798
1771
 
@@ -1810,7 +1783,6 @@ class Component(BaseComponent, ABC):
1810
1783
  },
1811
1784
  **self._get_vars_hooks(),
1812
1785
  **self._get_events_hooks(),
1813
- **self._get_special_hooks(),
1814
1786
  }
1815
1787
 
1816
1788
  def _get_added_hooks(self) -> dict[str, VarData | None]:
@@ -204,7 +204,6 @@ class AutoScroll(Div):
204
204
  id: Any | None = None,
205
205
  ref: Var | None = None,
206
206
  class_name: Any | None = None,
207
- autofocus: bool | None = None,
208
207
  custom_attrs: dict[str, Var | Any] | None = None,
209
208
  on_blur: EventType[()] | None = None,
210
209
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -249,7 +248,6 @@ class AutoScroll(Div):
249
248
  id: The id for the component.
250
249
  ref: The Var to pass as the ref to the component.
251
250
  class_name: The class name for the component.
252
- autofocus: Whether the component should take the focus once the page is loaded
253
251
  custom_attrs: custom attribute
254
252
  **props: The props of the component.
255
253
 
@@ -57,7 +57,6 @@ class ConnectionToaster(Fragment):
57
57
  id: Any | None = None,
58
58
  ref: Var | None = None,
59
59
  class_name: Any | None = None,
60
- autofocus: bool | None = None,
61
60
  custom_attrs: dict[str, Var | Any] | None = None,
62
61
  on_blur: EventType[()] | None = None,
63
62
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -86,7 +85,6 @@ class ConnectionToaster(Fragment):
86
85
  id: The id for the component.
87
86
  ref: The Var to pass as the ref to the component.
88
87
  class_name: The class name for the component.
89
- autofocus: Whether the component should take the focus once the page is loaded
90
88
  custom_attrs: custom attribute
91
89
  **props: The properties of the component.
92
90
 
@@ -108,7 +106,6 @@ class ConnectionBanner(Component):
108
106
  id: Any | None = None,
109
107
  ref: Var | None = None,
110
108
  class_name: Any | None = None,
111
- autofocus: bool | None = None,
112
109
  custom_attrs: dict[str, Var | Any] | None = None,
113
110
  on_blur: EventType[()] | None = None,
114
111
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -151,7 +148,6 @@ class ConnectionModal(Component):
151
148
  id: Any | None = None,
152
149
  ref: Var | None = None,
153
150
  class_name: Any | None = None,
154
- autofocus: bool | None = None,
155
151
  custom_attrs: dict[str, Var | Any] | None = None,
156
152
  on_blur: EventType[()] | None = None,
157
153
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -195,7 +191,6 @@ class WifiOffPulse(Icon):
195
191
  id: Any | None = None,
196
192
  ref: Var | None = None,
197
193
  class_name: Any | None = None,
198
- autofocus: bool | None = None,
199
194
  custom_attrs: dict[str, Var | Any] | None = None,
200
195
  on_blur: EventType[()] | None = None,
201
196
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -225,7 +220,6 @@ class WifiOffPulse(Icon):
225
220
  id: The id for the component.
226
221
  ref: The Var to pass as the ref to the component.
227
222
  class_name: The class name for the component.
228
- autofocus: Whether the component should take the focus once the page is loaded
229
223
  custom_attrs: custom attribute
230
224
  **props: The properties of the component.
231
225
 
@@ -427,7 +421,6 @@ class ConnectionPulser(Div):
427
421
  id: Any | None = None,
428
422
  ref: Var | None = None,
429
423
  class_name: Any | None = None,
430
- autofocus: bool | None = None,
431
424
  custom_attrs: dict[str, Var | Any] | None = None,
432
425
  on_blur: EventType[()] | None = None,
433
426
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -471,7 +464,6 @@ class ConnectionPulser(Div):
471
464
  id: The id for the component.
472
465
  ref: The Var to pass as the ref to the component.
473
466
  class_name: The class name for the component.
474
- autofocus: Whether the component should take the focus once the page is loaded
475
467
  custom_attrs: custom attribute
476
468
  **props: The properties of the component.
477
469
 
@@ -671,7 +663,6 @@ class BackendDisabled(Div):
671
663
  id: Any | None = None,
672
664
  ref: Var | None = None,
673
665
  class_name: Any | None = None,
674
- autofocus: bool | None = None,
675
666
  custom_attrs: dict[str, Var | Any] | None = None,
676
667
  on_blur: EventType[()] | None = None,
677
668
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -715,7 +706,6 @@ class BackendDisabled(Div):
715
706
  id: The id for the component.
716
707
  ref: The Var to pass as the ref to the component.
717
708
  class_name: The class name for the component.
718
- autofocus: Whether the component should take the focus once the page is loaded
719
709
  custom_attrs: custom attribute
720
710
  **props: The properties of the component.
721
711
 
@@ -29,7 +29,6 @@ class ClientSideRouting(Component):
29
29
  id: Any | None = None,
30
30
  ref: Var | None = None,
31
31
  class_name: Any | None = None,
32
- autofocus: bool | None = None,
33
32
  custom_attrs: dict[str, Var | Any] | None = None,
34
33
  on_blur: EventType[()] | None = None,
35
34
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -58,7 +57,6 @@ class ClientSideRouting(Component):
58
57
  id: The id for the component.
59
58
  ref: The Var to pass as the ref to the component.
60
59
  class_name: The class name for the component.
61
- autofocus: Whether the component should take the focus once the page is loaded
62
60
  custom_attrs: custom attribute
63
61
  **props: The props of the component.
64
62
 
@@ -56,10 +56,8 @@ class Clipboard(Fragment):
56
56
 
57
57
  def _render(self) -> Tag:
58
58
  tag = super()._render()
59
- tag.remove_props("targets")
60
59
  # Ensure a different Fragment component is created whenever targets differ
61
- tag.add_props(key=self.targets)
62
- return tag
60
+ return tag.remove_props("targets").add_props(key=self.targets)
63
61
 
64
62
  def add_imports(self) -> dict[str, ImportVar]:
65
63
  """Add the imports for the Clipboard component.
@@ -30,7 +30,6 @@ class Clipboard(Fragment):
30
30
  id: Any | None = None,
31
31
  ref: Var | None = None,
32
32
  class_name: Any | None = None,
33
- autofocus: bool | None = None,
34
33
  custom_attrs: dict[str, Var | Any] | None = None,
35
34
  on_blur: EventType[()] | None = None,
36
35
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -63,7 +62,6 @@ class Clipboard(Fragment):
63
62
  id: The id for the component.
64
63
  ref: The Var to pass as the ref to the component.
65
64
  class_name: The class name for the component.
66
- autofocus: Whether the component should take the focus once the page is loaded
67
65
  custom_attrs: custom attribute
68
66
  **props: The properties of the component.
69
67