reflex 0.8.4a1__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 (143) hide show
  1. reflex/.templates/web/utils/react-theme.js +12 -17
  2. reflex/__init__.py +2 -9
  3. reflex/__init__.pyi +4 -2
  4. reflex/app.py +16 -10
  5. reflex/compiler/compiler.py +10 -3
  6. reflex/components/base/app_wrap.pyi +0 -1
  7. reflex/components/base/body.pyi +0 -2
  8. reflex/components/base/document.pyi +0 -12
  9. reflex/components/base/error_boundary.pyi +0 -2
  10. reflex/components/base/fragment.pyi +0 -2
  11. reflex/components/base/link.pyi +0 -4
  12. reflex/components/base/meta.pyi +0 -6
  13. reflex/components/base/script.py +0 -2
  14. reflex/components/base/script.pyi +0 -2
  15. reflex/components/base/strict_mode.pyi +0 -2
  16. reflex/components/component.py +2 -30
  17. reflex/components/core/auto_scroll.pyi +0 -2
  18. reflex/components/core/banner.pyi +0 -10
  19. reflex/components/core/client_side_routing.pyi +0 -2
  20. reflex/components/core/clipboard.py +1 -3
  21. reflex/components/core/clipboard.pyi +0 -2
  22. reflex/components/core/cond.py +0 -2
  23. reflex/components/core/debounce.pyi +0 -1
  24. reflex/components/core/helmet.pyi +0 -2
  25. reflex/components/core/html.pyi +0 -2
  26. reflex/components/core/match.py +1 -2
  27. reflex/components/core/sticky.pyi +0 -4
  28. reflex/components/core/upload.pyi +0 -10
  29. reflex/components/core/window_events.pyi +0 -2
  30. reflex/components/datadisplay/code.py +6 -4
  31. reflex/components/datadisplay/code.pyi +0 -4
  32. reflex/components/datadisplay/dataeditor.pyi +0 -2
  33. reflex/components/datadisplay/shiki_code_block.pyi +0 -6
  34. reflex/components/el/element.pyi +0 -2
  35. reflex/components/el/elements/base.pyi +0 -2
  36. reflex/components/el/elements/forms.py +5 -21
  37. reflex/components/el/elements/forms.pyi +0 -38
  38. reflex/components/el/elements/inline.pyi +0 -56
  39. reflex/components/el/elements/media.pyi +0 -52
  40. reflex/components/el/elements/metadata.pyi +0 -12
  41. reflex/components/el/elements/other.pyi +0 -14
  42. reflex/components/el/elements/scripts.pyi +0 -6
  43. reflex/components/el/elements/sectioning.pyi +0 -30
  44. reflex/components/el/elements/tables.pyi +0 -20
  45. reflex/components/el/elements/typography.pyi +0 -32
  46. reflex/components/gridjs/datatable.pyi +0 -4
  47. reflex/components/lucide/icon.py +12 -1
  48. reflex/components/lucide/icon.pyi +12 -7
  49. reflex/components/markdown/markdown.pyi +0 -2
  50. reflex/components/moment/moment.pyi +0 -2
  51. reflex/components/plotly/plotly.py +25 -17
  52. reflex/components/plotly/plotly.pyi +0 -18
  53. reflex/components/radix/primitives/accordion.pyi +0 -14
  54. reflex/components/radix/primitives/base.pyi +0 -4
  55. reflex/components/radix/primitives/drawer.pyi +0 -22
  56. reflex/components/radix/primitives/form.pyi +0 -20
  57. reflex/components/radix/primitives/progress.pyi +0 -10
  58. reflex/components/radix/primitives/slider.pyi +0 -10
  59. reflex/components/radix/themes/base.py +2 -4
  60. reflex/components/radix/themes/base.pyi +0 -15
  61. reflex/components/radix/themes/color_mode.pyi +0 -5
  62. reflex/components/radix/themes/components/alert_dialog.pyi +0 -11
  63. reflex/components/radix/themes/components/aspect_ratio.pyi +0 -2
  64. reflex/components/radix/themes/components/avatar.pyi +0 -2
  65. reflex/components/radix/themes/components/badge.pyi +0 -2
  66. reflex/components/radix/themes/components/button.pyi +0 -2
  67. reflex/components/radix/themes/components/callout.pyi +0 -10
  68. reflex/components/radix/themes/components/card.pyi +0 -2
  69. reflex/components/radix/themes/components/checkbox.pyi +0 -6
  70. reflex/components/radix/themes/components/checkbox_cards.pyi +0 -4
  71. reflex/components/radix/themes/components/checkbox_group.pyi +0 -4
  72. reflex/components/radix/themes/components/context_menu.pyi +0 -26
  73. reflex/components/radix/themes/components/data_list.pyi +0 -8
  74. reflex/components/radix/themes/components/dialog.pyi +0 -12
  75. reflex/components/radix/themes/components/dropdown_menu.pyi +0 -14
  76. reflex/components/radix/themes/components/hover_card.pyi +0 -7
  77. reflex/components/radix/themes/components/icon_button.pyi +0 -2
  78. reflex/components/radix/themes/components/inset.pyi +0 -2
  79. reflex/components/radix/themes/components/popover.pyi +0 -6
  80. reflex/components/radix/themes/components/progress.pyi +0 -2
  81. reflex/components/radix/themes/components/radio.pyi +0 -2
  82. reflex/components/radix/themes/components/radio_cards.pyi +0 -4
  83. reflex/components/radix/themes/components/radio_group.pyi +0 -8
  84. reflex/components/radix/themes/components/scroll_area.pyi +0 -2
  85. reflex/components/radix/themes/components/segmented_control.pyi +0 -4
  86. reflex/components/radix/themes/components/select.pyi +0 -18
  87. reflex/components/radix/themes/components/separator.pyi +0 -2
  88. reflex/components/radix/themes/components/skeleton.pyi +0 -2
  89. reflex/components/radix/themes/components/slider.pyi +0 -2
  90. reflex/components/radix/themes/components/spinner.pyi +0 -2
  91. reflex/components/radix/themes/components/switch.pyi +0 -2
  92. reflex/components/radix/themes/components/table.pyi +0 -14
  93. reflex/components/radix/themes/components/tabs.pyi +0 -10
  94. reflex/components/radix/themes/components/text_area.pyi +0 -2
  95. reflex/components/radix/themes/components/text_field.pyi +0 -6
  96. reflex/components/radix/themes/components/tooltip.pyi +0 -2
  97. reflex/components/radix/themes/layout/base.pyi +0 -2
  98. reflex/components/radix/themes/layout/box.pyi +0 -2
  99. reflex/components/radix/themes/layout/center.pyi +0 -2
  100. reflex/components/radix/themes/layout/container.pyi +0 -1
  101. reflex/components/radix/themes/layout/flex.pyi +0 -2
  102. reflex/components/radix/themes/layout/grid.pyi +0 -2
  103. reflex/components/radix/themes/layout/list.pyi +0 -10
  104. reflex/components/radix/themes/layout/section.pyi +0 -2
  105. reflex/components/radix/themes/layout/spacer.pyi +0 -2
  106. reflex/components/radix/themes/layout/stack.pyi +0 -6
  107. reflex/components/radix/themes/typography/blockquote.pyi +0 -2
  108. reflex/components/radix/themes/typography/code.pyi +0 -2
  109. reflex/components/radix/themes/typography/heading.pyi +0 -2
  110. reflex/components/radix/themes/typography/link.pyi +0 -2
  111. reflex/components/radix/themes/typography/text.pyi +0 -14
  112. reflex/components/react_player/audio.pyi +0 -2
  113. reflex/components/react_player/react_player.pyi +0 -2
  114. reflex/components/react_player/video.pyi +0 -2
  115. reflex/components/react_router/dom.pyi +0 -2
  116. reflex/components/recharts/cartesian.pyi +0 -38
  117. reflex/components/recharts/charts.pyi +0 -24
  118. reflex/components/recharts/general.pyi +0 -12
  119. reflex/components/recharts/polar.pyi +0 -12
  120. reflex/components/recharts/recharts.pyi +0 -4
  121. reflex/components/sonner/toast.pyi +0 -2
  122. reflex/components/tags/cond_tag.py +4 -3
  123. reflex/components/tags/iter_tag.py +1 -1
  124. reflex/components/tags/match_tag.py +3 -2
  125. reflex/components/tags/tag.py +39 -40
  126. reflex/constants/compiler.py +0 -8
  127. reflex/constants/installer.py +5 -5
  128. reflex/event.py +77 -15
  129. reflex/page.py +62 -4
  130. reflex/reflex.py +2 -5
  131. reflex/utils/misc.py +0 -3
  132. reflex/utils/net.py +7 -2
  133. reflex/utils/prerequisites.py +8 -71
  134. reflex/utils/processes.py +6 -6
  135. {reflex-0.8.4a1.dist-info → reflex-0.8.5a1.dist-info}/METADATA +2 -2
  136. {reflex-0.8.4a1.dist-info → reflex-0.8.5a1.dist-info}/RECORD +139 -143
  137. reflex/components/el/constants/__init__.py +0 -5
  138. reflex/components/el/constants/html.py +0 -343
  139. reflex/components/el/constants/react.py +0 -501
  140. reflex/components/el/constants/reflex.py +0 -51
  141. {reflex-0.8.4a1.dist-info → reflex-0.8.5a1.dist-info}/WHEEL +0 -0
  142. {reflex-0.8.4a1.dist-info → reflex-0.8.5a1.dist-info}/entry_points.txt +0 -0
  143. {reflex-0.8.4a1.dist-info → reflex-0.8.5a1.dist-info}/licenses/LICENSE +0 -0
@@ -34,7 +34,6 @@ class ResponsiveContainer(Recharts, MemoizationLeaf):
34
34
  id: Any | None = None,
35
35
  ref: Var | None = None,
36
36
  class_name: Any | None = None,
37
- autofocus: bool | None = None,
38
37
  custom_attrs: dict[str, Var | Any] | None = None,
39
38
  on_blur: EventType[()] | None = None,
40
39
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -71,7 +70,6 @@ class ResponsiveContainer(Recharts, MemoizationLeaf):
71
70
  id: The id for the component.
72
71
  ref: The Var to pass as the ref to the component.
73
72
  class_name: The class name for the component.
74
- autofocus: Whether the component should take the focus once the page is loaded
75
73
  custom_attrs: custom attribute
76
74
  **props: The props of the component.
77
75
 
@@ -136,7 +134,6 @@ class Legend(Recharts):
136
134
  id: Any | None = None,
137
135
  ref: Var | None = None,
138
136
  class_name: Any | None = None,
139
- autofocus: bool | None = None,
140
137
  custom_attrs: dict[str, Var | Any] | None = None,
141
138
  on_blur: EventType[()] | None = None,
142
139
  on_click: EventType[()] | None = None,
@@ -184,7 +181,6 @@ class Legend(Recharts):
184
181
  id: The id for the component.
185
182
  ref: The Var to pass as the ref to the component.
186
183
  class_name: The class name for the component.
187
- autofocus: Whether the component should take the focus once the page is loaded
188
184
  custom_attrs: custom attribute
189
185
  **props: The props of the component.
190
186
 
@@ -226,7 +222,6 @@ class GraphingTooltip(Recharts):
226
222
  id: Any | None = None,
227
223
  ref: Var | None = None,
228
224
  class_name: Any | None = None,
229
- autofocus: bool | None = None,
230
225
  custom_attrs: dict[str, Var | Any] | None = None,
231
226
  on_blur: EventType[()] | None = None,
232
227
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -271,7 +266,6 @@ class GraphingTooltip(Recharts):
271
266
  id: The id for the component.
272
267
  ref: The Var to pass as the ref to the component.
273
268
  class_name: The class name for the component.
274
- autofocus: Whether the component should take the focus once the page is loaded
275
269
  custom_attrs: custom attribute
276
270
  **props: The props of the component.
277
271
 
@@ -339,7 +333,6 @@ class Label(Recharts):
339
333
  id: Any | None = None,
340
334
  ref: Var | None = None,
341
335
  class_name: Any | None = None,
342
- autofocus: bool | None = None,
343
336
  custom_attrs: dict[str, Var | Any] | None = None,
344
337
  on_blur: EventType[()] | None = None,
345
338
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -372,7 +365,6 @@ class Label(Recharts):
372
365
  id: The id for the component.
373
366
  ref: The Var to pass as the ref to the component.
374
367
  class_name: The class name for the component.
375
- autofocus: Whether the component should take the focus once the page is loaded
376
368
  custom_attrs: custom attribute
377
369
  **props: The props of the component.
378
370
 
@@ -441,7 +433,6 @@ class LabelList(Recharts):
441
433
  id: Any | None = None,
442
434
  ref: Var | None = None,
443
435
  class_name: Any | None = None,
444
- autofocus: bool | None = None,
445
436
  custom_attrs: dict[str, Var | Any] | None = None,
446
437
  on_blur: EventType[()] | None = None,
447
438
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -475,7 +466,6 @@ class LabelList(Recharts):
475
466
  id: The id for the component.
476
467
  ref: The Var to pass as the ref to the component.
477
468
  class_name: The class name for the component.
478
- autofocus: Whether the component should take the focus once the page is loaded
479
469
  custom_attrs: custom attribute
480
470
  **props: The props of the component.
481
471
 
@@ -499,7 +489,6 @@ class Cell(Recharts):
499
489
  id: Any | None = None,
500
490
  ref: Var | None = None,
501
491
  class_name: Any | None = None,
502
- autofocus: bool | None = None,
503
492
  custom_attrs: dict[str, Var | Any] | None = None,
504
493
  on_blur: EventType[()] | None = None,
505
494
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -530,7 +519,6 @@ class Cell(Recharts):
530
519
  id: The id for the component.
531
520
  ref: The Var to pass as the ref to the component.
532
521
  class_name: The class name for the component.
533
- autofocus: Whether the component should take the focus once the page is loaded
534
522
  custom_attrs: custom attribute
535
523
  **props: The props of the component.
536
524
 
@@ -82,7 +82,6 @@ class Pie(Recharts):
82
82
  id: Any | None = None,
83
83
  ref: Var | None = None,
84
84
  class_name: Any | None = None,
85
- autofocus: bool | None = None,
86
85
  custom_attrs: dict[str, Var | Any] | None = None,
87
86
  on_animation_end: EventType[()] | None = None,
88
87
  on_animation_start: EventType[()] | None = None,
@@ -124,7 +123,6 @@ class Pie(Recharts):
124
123
  id: The id for the component.
125
124
  ref: The Var to pass as the ref to the component.
126
125
  class_name: The class name for the component.
127
- autofocus: Whether the component should take the focus once the page is loaded
128
126
  custom_attrs: custom attribute
129
127
  **props: The props of the component.
130
128
 
@@ -192,7 +190,6 @@ class Radar(Recharts):
192
190
  id: Any | None = None,
193
191
  ref: Var | None = None,
194
192
  class_name: Any | None = None,
195
- autofocus: bool | None = None,
196
193
  custom_attrs: dict[str, Var | Any] | None = None,
197
194
  on_animation_end: EventType[()] | None = None,
198
195
  on_animation_start: EventType[()] | None = None,
@@ -219,7 +216,6 @@ class Radar(Recharts):
219
216
  id: The id for the component.
220
217
  ref: The Var to pass as the ref to the component.
221
218
  class_name: The class name for the component.
222
- autofocus: Whether the component should take the focus once the page is loaded
223
219
  custom_attrs: custom attribute
224
220
  **props: The props of the component.
225
221
 
@@ -285,7 +281,6 @@ class RadialBar(Recharts):
285
281
  id: Any | None = None,
286
282
  ref: Var | None = None,
287
283
  class_name: Any | None = None,
288
- autofocus: bool | None = None,
289
284
  custom_attrs: dict[str, Var | Any] | None = None,
290
285
  on_animation_end: EventType[()] | None = None,
291
286
  on_animation_start: EventType[()] | None = None,
@@ -316,7 +311,6 @@ class RadialBar(Recharts):
316
311
  id: The id for the component.
317
312
  ref: The Var to pass as the ref to the component.
318
313
  class_name: The class name for the component.
319
- autofocus: Whether the component should take the focus once the page is loaded
320
314
  custom_attrs: custom attribute
321
315
  **props: The props of the component.
322
316
 
@@ -352,7 +346,6 @@ class PolarAngleAxis(Recharts):
352
346
  id: Any | None = None,
353
347
  ref: Var | None = None,
354
348
  class_name: Any | None = None,
355
- autofocus: bool | None = None,
356
349
  custom_attrs: dict[str, Var | Any] | None = None,
357
350
  on_blur: EventType[()] | None = None,
358
351
  on_click: EventType[()] | None = None,
@@ -401,7 +394,6 @@ class PolarAngleAxis(Recharts):
401
394
  id: The id for the component.
402
395
  ref: The Var to pass as the ref to the component.
403
396
  class_name: The class name for the component.
404
- autofocus: Whether the component should take the focus once the page is loaded
405
397
  custom_attrs: custom attribute
406
398
  **props: The props of the component.
407
399
 
@@ -433,7 +425,6 @@ class PolarGrid(Recharts):
433
425
  id: Any | None = None,
434
426
  ref: Var | None = None,
435
427
  class_name: Any | None = None,
436
- autofocus: bool | None = None,
437
428
  custom_attrs: dict[str, Var | Any] | None = None,
438
429
  on_blur: EventType[()] | None = None,
439
430
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -470,7 +461,6 @@ class PolarGrid(Recharts):
470
461
  id: The id for the component.
471
462
  ref: The Var to pass as the ref to the component.
472
463
  class_name: The class name for the component.
473
- autofocus: Whether the component should take the focus once the page is loaded
474
464
  custom_attrs: custom attribute
475
465
  **props: The props of the component.
476
466
 
@@ -547,7 +537,6 @@ class PolarRadiusAxis(Recharts):
547
537
  id: Any | None = None,
548
538
  ref: Var | None = None,
549
539
  class_name: Any | None = None,
550
- autofocus: bool | None = None,
551
540
  custom_attrs: dict[str, Var | Any] | None = None,
552
541
  on_click: EventType[()] | None = None,
553
542
  on_mouse_enter: EventType[()] | None = None,
@@ -579,7 +568,6 @@ class PolarRadiusAxis(Recharts):
579
568
  id: The id for the component.
580
569
  ref: The Var to pass as the ref to the component.
581
570
  class_name: The class name for the component.
582
- autofocus: Whether the component should take the focus once the page is loaded
583
571
  custom_attrs: custom attribute
584
572
  **props: The props of the component.
585
573
 
@@ -25,7 +25,6 @@ class Recharts(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 Recharts(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 RechartsCharts(NoSSRComponent, MemoizationLeaf):
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 RechartsCharts(NoSSRComponent, MemoizationLeaf):
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 +127,6 @@ class Toaster(Component):
127
127
  id: Any | None = None,
128
128
  ref: Var | None = None,
129
129
  class_name: Any | None = None,
130
- autofocus: bool | None = None,
131
130
  custom_attrs: dict[str, Var | Any] | None = None,
132
131
  on_blur: EventType[()] | None = None,
133
132
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -170,7 +169,6 @@ class Toaster(Component):
170
169
  id: The id for the component.
171
170
  ref: The Var to pass as the ref to the component.
172
171
  class_name: The class name for the component.
173
- autofocus: Whether the component should take the focus once the page is loaded
174
172
  custom_attrs: custom attribute
175
173
  **props: The properties of the toaster.
176
174
 
@@ -1,13 +1,14 @@
1
1
  """Tag to conditionally render components."""
2
2
 
3
3
  import dataclasses
4
+ from collections.abc import Mapping
4
5
  from typing import Any
5
6
 
6
7
  from reflex.components.tags.tag import Tag
7
8
  from reflex.vars.base import Var
8
9
 
9
10
 
10
- @dataclasses.dataclass()
11
+ @dataclasses.dataclass(frozen=True)
11
12
  class CondTag(Tag):
12
13
  """A conditional tag."""
13
14
 
@@ -15,7 +16,7 @@ class CondTag(Tag):
15
16
  cond: Var[Any] = dataclasses.field(default_factory=lambda: Var.create(True))
16
17
 
17
18
  # The code to render if the condition is true.
18
- true_value: dict = dataclasses.field(default_factory=dict)
19
+ true_value: Mapping = dataclasses.field(default_factory=dict)
19
20
 
20
21
  # The code to render if the condition is false.
21
- false_value: dict | None = None
22
+ false_value: Mapping | None = None
@@ -16,7 +16,7 @@ if TYPE_CHECKING:
16
16
  from reflex.components.component import Component
17
17
 
18
18
 
19
- @dataclasses.dataclass()
19
+ @dataclasses.dataclass(frozen=True)
20
20
  class IterTag(Tag):
21
21
  """An iterator tag."""
22
22
 
@@ -1,13 +1,14 @@
1
1
  """Tag to conditionally match cases."""
2
2
 
3
3
  import dataclasses
4
+ from collections.abc import Sequence
4
5
  from typing import Any
5
6
 
6
7
  from reflex.components.tags.tag import Tag
7
8
  from reflex.vars.base import Var
8
9
 
9
10
 
10
- @dataclasses.dataclass()
11
+ @dataclasses.dataclass(frozen=True)
11
12
  class MatchTag(Tag):
12
13
  """A match tag."""
13
14
 
@@ -15,7 +16,7 @@ class MatchTag(Tag):
15
16
  cond: Var[Any] = dataclasses.field(default_factory=lambda: Var.create(True))
16
17
 
17
18
  # The list of match cases to be matched.
18
- match_cases: list[Any] = dataclasses.field(default_factory=list)
19
+ match_cases: Sequence[Any] = dataclasses.field(default_factory=list)
19
20
 
20
21
  # The catchall case to match.
21
22
  default: Any = dataclasses.field(default=Var.create(None))
@@ -31,7 +31,7 @@ def render_prop(value: Any) -> Any:
31
31
  return value
32
32
 
33
33
 
34
- @dataclasses.dataclass()
34
+ @dataclasses.dataclass(frozen=True)
35
35
  class Tag:
36
36
  """A React tag."""
37
37
 
@@ -39,24 +39,16 @@ class Tag:
39
39
  name: str = ""
40
40
 
41
41
  # The props of the tag.
42
- props: dict[str, Any] = dataclasses.field(default_factory=dict)
42
+ props: Mapping[str, Any] = dataclasses.field(default_factory=dict)
43
43
 
44
44
  # The inner contents of the tag.
45
45
  contents: str = ""
46
46
 
47
47
  # Special props that aren't key value pairs.
48
- special_props: list[Var] = dataclasses.field(default_factory=list)
48
+ special_props: Sequence[Var] = dataclasses.field(default_factory=list)
49
49
 
50
50
  # The children components.
51
- children: list[Any] = dataclasses.field(default_factory=list)
52
-
53
- def __post_init__(self):
54
- """Post initialize the tag."""
55
- object.__setattr__(
56
- self,
57
- "props",
58
- {name: LiteralVar.create(value) for name, value in self.props.items()},
59
- )
51
+ children: Sequence[Any] = dataclasses.field(default_factory=list)
60
52
 
61
53
  def format_props(self) -> list:
62
54
  """Format the tag's props.
@@ -67,18 +59,15 @@ class Tag:
67
59
  return format.format_props(*self.special_props, **self.props)
68
60
 
69
61
  def set(self, **kwargs: Any):
70
- """Set the tag's fields.
62
+ """Return a new tag with the given fields set.
71
63
 
72
64
  Args:
73
65
  **kwargs: The fields to set.
74
66
 
75
67
  Returns:
76
- The tag with the fields
68
+ The tag with the fields set.
77
69
  """
78
- for name, value in kwargs.items():
79
- setattr(self, name, value)
80
-
81
- return self
70
+ return dataclasses.replace(self, **kwargs)
82
71
 
83
72
  def __iter__(self):
84
73
  """Iterate over the tag's fields.
@@ -87,12 +76,15 @@ class Tag:
87
76
  tuple[str, Any]: The field name and value.
88
77
  """
89
78
  for field in dataclasses.fields(self):
90
- rendered_value = render_prop(getattr(self, field.name))
91
- if rendered_value is not None:
92
- yield field.name, rendered_value
79
+ if field.name == "props":
80
+ yield "props", self.format_props()
81
+ elif field.name != "special_props":
82
+ rendered_value = render_prop(getattr(self, field.name))
83
+ if rendered_value is not None:
84
+ yield field.name, rendered_value
93
85
 
94
86
  def add_props(self, **kwargs: Any | None) -> Tag:
95
- """Add props to the tag.
87
+ """Return a new tag with the given props added.
96
88
 
97
89
  Args:
98
90
  **kwargs: The props to add.
@@ -100,33 +92,40 @@ class Tag:
100
92
  Returns:
101
93
  The tag with the props added.
102
94
  """
103
- self.props.update(
104
- {
105
- format.to_camel_case(name, treat_hyphens_as_underscores=False): (
106
- prop
107
- if isinstance(prop, (EventChain, Mapping))
108
- else LiteralVar.create(prop)
109
- )
110
- for name, prop in kwargs.items()
111
- if self.is_valid_prop(prop)
112
- }
95
+ return dataclasses.replace(
96
+ self,
97
+ props={
98
+ **self.props,
99
+ **{
100
+ format.to_camel_case(name, treat_hyphens_as_underscores=False): (
101
+ prop
102
+ if isinstance(prop, (EventChain, Mapping))
103
+ else LiteralVar.create(prop)
104
+ )
105
+ for name, prop in kwargs.items()
106
+ if self.is_valid_prop(prop)
107
+ },
108
+ },
113
109
  )
114
- return self
115
110
 
116
111
  def remove_props(self, *args: str) -> Tag:
117
- """Remove props from the tag.
112
+ """Return a new tag with the given props removed.
118
113
 
119
114
  Args:
120
- *args: The props to remove.
115
+ *args: The names of the props to remove.
121
116
 
122
117
  Returns:
123
118
  The tag with the props removed.
124
119
  """
125
- for name in args:
126
- prop_name = format.to_camel_case(name)
127
- if prop_name in self.props:
128
- del self.props[prop_name]
129
- return self
120
+ formatted_args = [format.to_camel_case(arg) for arg in args]
121
+ return dataclasses.replace(
122
+ self,
123
+ props={
124
+ name: value
125
+ for name, value in self.props.items()
126
+ if name not in formatted_args
127
+ },
128
+ )
130
129
 
131
130
  @staticmethod
132
131
  def is_valid_prop(prop: Var | None) -> bool:
@@ -136,14 +136,6 @@ class Hooks(SimpleNamespace):
136
136
  """Common sets of hook declarations."""
137
137
 
138
138
  EVENTS = f"const [{CompileVars.ADD_EVENTS}, {CompileVars.CONNECT_ERROR}] = useContext(EventLoopContext);"
139
- AUTOFOCUS = """
140
- // Set focus to the specified element.
141
- const focusRef = useRef(null)
142
- useEffect(() => {
143
- if (focusRef.current) {
144
- focusRef.current.focus();
145
- }
146
- })"""
147
139
 
148
140
  class HookPosition(enum.Enum):
149
141
  """The position of the hook in the component."""
@@ -75,7 +75,7 @@ fetch-retries=0
75
75
 
76
76
 
77
77
  def _determine_react_router_version() -> str:
78
- default_version = "7.7.0"
78
+ default_version = "7.7.1"
79
79
  if (version := os.getenv("REACT_ROUTER_VERSION")) and version != default_version:
80
80
  from reflex.utils import console
81
81
 
@@ -87,7 +87,7 @@ def _determine_react_router_version() -> str:
87
87
 
88
88
 
89
89
  def _determine_react_version() -> str:
90
- default_version = "19.1.0"
90
+ default_version = "19.1.1"
91
91
  if (version := os.getenv("REACT_VERSION")) and version != default_version:
92
92
  from reflex.utils import console
93
93
 
@@ -131,7 +131,7 @@ class PackageJson(SimpleNamespace):
131
131
  "react": cls._react_version,
132
132
  "react-helmet": "6.1.0",
133
133
  "react-dom": cls._react_version,
134
- "isbot": "5.1.28",
134
+ "isbot": "5.1.29",
135
135
  "socket.io-client": "4.8.1",
136
136
  "universal-cookie": "7.2.2",
137
137
  }
@@ -143,11 +143,11 @@ class PackageJson(SimpleNamespace):
143
143
  "postcss-import": "16.1.1",
144
144
  "@react-router/dev": _react_router_version,
145
145
  "@react-router/fs-routes": _react_router_version,
146
- "rolldown-vite": "7.0.9",
146
+ "vite": "npm:rolldown-vite@7.0.12",
147
147
  }
148
148
  OVERRIDES = {
149
149
  # This should always match the `react` version in DEPENDENCIES for recharts compatibility.
150
150
  "react-is": _react_version,
151
151
  "cookie": "1.0.2",
152
- "rollup": "4.45.1",
152
+ "vite": "npm:rolldown-vite@7.0.12",
153
153
  }
reflex/event.py CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  import dataclasses
4
4
  import inspect
5
+ import sys
5
6
  import types
6
7
  import urllib.parse
7
8
  from base64 import b64encode
@@ -403,7 +404,7 @@ class CallableEventSpec(EventSpec):
403
404
 
404
405
  Args:
405
406
  fn: The function to decorate.
406
- **kwargs: The kwargs to pass to pydantic initializer
407
+ **kwargs: The kwargs to pass to the EventSpec constructor.
407
408
  """
408
409
  if fn is not None:
409
410
  default_event_spec = fn()
@@ -635,6 +636,27 @@ def checked_input_event(e: ObjectVar[JavascriptInputEvent]) -> tuple[Var[bool]]:
635
636
  return (e.target.checked,)
636
637
 
637
638
 
639
+ FORM_DATA = Var(_js_expr="form_data")
640
+
641
+
642
+ def on_submit_event() -> tuple[Var[dict[str, Any]]]:
643
+ """Event handler spec for the on_submit event.
644
+
645
+ Returns:
646
+ The event handler spec.
647
+ """
648
+ return (FORM_DATA,)
649
+
650
+
651
+ def on_submit_string_event() -> tuple[Var[dict[str, str]]]:
652
+ """Event handler spec for the on_submit event.
653
+
654
+ Returns:
655
+ The event handler spec.
656
+ """
657
+ return (FORM_DATA,)
658
+
659
+
638
660
  class KeyInputInfo(TypedDict):
639
661
  """Information about a key input event."""
640
662
 
@@ -1243,19 +1265,6 @@ def download(
1243
1265
  )
1244
1266
 
1245
1267
 
1246
- # This function seems unused. Check if we still need it. If not, remove in 0.7.0
1247
- def _callback_arg_spec(eval_result: Any):
1248
- """ArgSpec for call_script callback function.
1249
-
1250
- Args:
1251
- eval_result: The result of the javascript execution.
1252
-
1253
- Returns:
1254
- Args for the callback function
1255
- """
1256
- return [eval_result]
1257
-
1258
-
1259
1268
  def call_script(
1260
1269
  javascript_code: str | Var[str],
1261
1270
  callback: "EventType[Any] | None" = None,
@@ -2197,7 +2206,9 @@ else:
2197
2206
  class EventNamespace:
2198
2207
  """A namespace for event related classes."""
2199
2208
 
2209
+ # Core Event Classes
2200
2210
  Event = Event
2211
+ EventActionsMixin = EventActionsMixin
2201
2212
  EventHandler = EventHandler
2202
2213
  EventSpec = EventSpec
2203
2214
  CallableEventSpec = CallableEventSpec
@@ -2206,8 +2217,44 @@ class EventNamespace:
2206
2217
  LiteralEventVar = LiteralEventVar
2207
2218
  EventChainVar = EventChainVar
2208
2219
  LiteralEventChainVar = LiteralEventChainVar
2209
- EventType = EventType
2210
2220
  EventCallback = EventCallback
2221
+ LambdaEventCallback = LambdaEventCallback
2222
+
2223
+ # Javascript Event Classes
2224
+ JavascriptHTMLInputElement = JavascriptHTMLInputElement
2225
+ JavascriptInputEvent = JavascriptInputEvent
2226
+ JavascriptKeyboardEvent = JavascriptKeyboardEvent
2227
+ JavascriptMouseEvent = JavascriptMouseEvent
2228
+ JavascriptPointerEvent = JavascriptPointerEvent
2229
+
2230
+ # Type Info Classes
2231
+ KeyInputInfo = KeyInputInfo
2232
+ MouseEventInfo = MouseEventInfo
2233
+ PointerEventInfo = PointerEventInfo
2234
+ IdentityEventReturn = IdentityEventReturn
2235
+
2236
+ # File Upload
2237
+ FileUpload = FileUpload
2238
+
2239
+ # Type Aliases
2240
+ EventType = EventType
2241
+ LAMBDA_OR_STATE = LAMBDA_OR_STATE
2242
+ BASIC_EVENT_TYPES = BASIC_EVENT_TYPES
2243
+ IndividualEventType = IndividualEventType
2244
+
2245
+ # Constants
2246
+ BACKGROUND_TASK_MARKER = BACKGROUND_TASK_MARKER
2247
+ _EVENT_FIELDS = _EVENT_FIELDS
2248
+ FORM_DATA = FORM_DATA
2249
+ upload_files = upload_files
2250
+ stop_propagation = stop_propagation
2251
+ prevent_default = prevent_default
2252
+
2253
+ # Private/Internal Functions
2254
+ _values_returned_from_event = staticmethod(_values_returned_from_event)
2255
+ _check_event_args_subclass_of_callback = staticmethod(
2256
+ _check_event_args_subclass_of_callback
2257
+ )
2211
2258
 
2212
2259
  @overload
2213
2260
  def __new__(
@@ -2359,10 +2406,22 @@ class EventNamespace:
2359
2406
  check_fn_match_arg_spec = staticmethod(check_fn_match_arg_spec)
2360
2407
  resolve_annotation = staticmethod(resolve_annotation)
2361
2408
  parse_args_spec = staticmethod(parse_args_spec)
2409
+ unwrap_var_annotation = staticmethod(unwrap_var_annotation)
2410
+ get_fn_signature = staticmethod(get_fn_signature)
2411
+
2412
+ # Event Spec Functions
2362
2413
  passthrough_event_spec = staticmethod(passthrough_event_spec)
2363
2414
  input_event = staticmethod(input_event)
2415
+ int_input_event = staticmethod(int_input_event)
2416
+ float_input_event = staticmethod(float_input_event)
2417
+ checked_input_event = staticmethod(checked_input_event)
2364
2418
  key_event = staticmethod(key_event)
2419
+ pointer_event_spec = staticmethod(pointer_event_spec)
2365
2420
  no_args_event_spec = staticmethod(no_args_event_spec)
2421
+ on_submit_event = staticmethod(on_submit_event)
2422
+ on_submit_string_event = staticmethod(on_submit_string_event)
2423
+
2424
+ # Server Side Events
2366
2425
  server_side = staticmethod(server_side)
2367
2426
  redirect = staticmethod(redirect)
2368
2427
  console_log = staticmethod(console_log)
@@ -2383,6 +2442,9 @@ class EventNamespace:
2383
2442
  call_script = staticmethod(call_script)
2384
2443
  call_function = staticmethod(call_function)
2385
2444
  run_script = staticmethod(run_script)
2445
+ __file__ = __file__
2386
2446
 
2387
2447
 
2388
2448
  event = EventNamespace
2449
+ event.event = event # pyright: ignore[reportAttributeAccessIssue]
2450
+ sys.modules[__name__] = event # pyright: ignore[reportArgumentType]