reflex 0.7.11__py3-none-any.whl → 0.7.12a1__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 (140) hide show
  1. reflex/app.py +8 -4
  2. reflex/components/base/app_wrap.pyi +1 -0
  3. reflex/components/base/body.pyi +2 -0
  4. reflex/components/base/document.pyi +10 -0
  5. reflex/components/base/error_boundary.pyi +2 -0
  6. reflex/components/base/fragment.pyi +2 -0
  7. reflex/components/base/head.pyi +4 -0
  8. reflex/components/base/link.pyi +4 -0
  9. reflex/components/base/meta.pyi +8 -0
  10. reflex/components/base/script.pyi +2 -0
  11. reflex/components/base/strict_mode.pyi +2 -0
  12. reflex/components/component.py +39 -63
  13. reflex/components/core/auto_scroll.pyi +2 -0
  14. reflex/components/core/banner.pyi +10 -0
  15. reflex/components/core/client_side_routing.pyi +4 -0
  16. reflex/components/core/clipboard.pyi +2 -0
  17. reflex/components/core/debounce.pyi +1 -0
  18. reflex/components/core/html.pyi +2 -0
  19. reflex/components/core/sticky.pyi +4 -0
  20. reflex/components/core/upload.pyi +10 -0
  21. reflex/components/datadisplay/code.pyi +4 -0
  22. reflex/components/datadisplay/dataeditor.py +3 -3
  23. reflex/components/datadisplay/dataeditor.pyi +2 -0
  24. reflex/components/datadisplay/shiki_code_block.pyi +6 -0
  25. reflex/components/el/element.pyi +2 -0
  26. reflex/components/el/elements/base.pyi +2 -0
  27. reflex/components/el/elements/forms.pyi +34 -0
  28. reflex/components/el/elements/inline.pyi +56 -0
  29. reflex/components/el/elements/media.pyi +50 -0
  30. reflex/components/el/elements/metadata.pyi +12 -0
  31. reflex/components/el/elements/other.pyi +14 -0
  32. reflex/components/el/elements/scripts.pyi +6 -0
  33. reflex/components/el/elements/sectioning.pyi +30 -0
  34. reflex/components/el/elements/tables.pyi +20 -0
  35. reflex/components/el/elements/typography.pyi +30 -0
  36. reflex/components/gridjs/datatable.pyi +4 -0
  37. reflex/components/lucide/icon.py +3 -1
  38. reflex/components/lucide/icon.pyi +8 -0
  39. reflex/components/markdown/markdown.pyi +2 -0
  40. reflex/components/moment/moment.pyi +2 -0
  41. reflex/components/next/base.pyi +2 -0
  42. reflex/components/next/image.pyi +2 -0
  43. reflex/components/next/link.pyi +2 -0
  44. reflex/components/next/video.pyi +2 -0
  45. reflex/components/plotly/plotly.pyi +18 -0
  46. reflex/components/radix/primitives/accordion.py +1 -1
  47. reflex/components/radix/primitives/accordion.pyi +14 -0
  48. reflex/components/radix/primitives/base.py +0 -2
  49. reflex/components/radix/primitives/base.pyi +4 -0
  50. reflex/components/radix/primitives/drawer.py +1 -1
  51. reflex/components/radix/primitives/drawer.pyi +22 -0
  52. reflex/components/radix/primitives/form.py +1 -1
  53. reflex/components/radix/primitives/form.pyi +20 -0
  54. reflex/components/radix/primitives/progress.py +1 -1
  55. reflex/components/radix/primitives/progress.pyi +10 -0
  56. reflex/components/radix/primitives/slider.py +1 -1
  57. reflex/components/radix/primitives/slider.pyi +10 -0
  58. reflex/components/radix/themes/base.py +1 -1
  59. reflex/components/radix/themes/base.pyi +15 -0
  60. reflex/components/radix/themes/color_mode.pyi +5 -0
  61. reflex/components/radix/themes/components/alert_dialog.pyi +11 -0
  62. reflex/components/radix/themes/components/aspect_ratio.pyi +2 -0
  63. reflex/components/radix/themes/components/avatar.pyi +2 -0
  64. reflex/components/radix/themes/components/badge.pyi +2 -0
  65. reflex/components/radix/themes/components/button.pyi +2 -0
  66. reflex/components/radix/themes/components/callout.pyi +10 -0
  67. reflex/components/radix/themes/components/card.pyi +2 -0
  68. reflex/components/radix/themes/components/checkbox.pyi +6 -0
  69. reflex/components/radix/themes/components/checkbox_cards.pyi +4 -0
  70. reflex/components/radix/themes/components/checkbox_group.pyi +4 -0
  71. reflex/components/radix/themes/components/context_menu.pyi +26 -0
  72. reflex/components/radix/themes/components/data_list.pyi +8 -0
  73. reflex/components/radix/themes/components/dialog.pyi +12 -0
  74. reflex/components/radix/themes/components/dropdown_menu.pyi +14 -0
  75. reflex/components/radix/themes/components/hover_card.pyi +7 -0
  76. reflex/components/radix/themes/components/icon_button.pyi +2 -0
  77. reflex/components/radix/themes/components/inset.pyi +2 -0
  78. reflex/components/radix/themes/components/popover.pyi +6 -0
  79. reflex/components/radix/themes/components/progress.pyi +2 -0
  80. reflex/components/radix/themes/components/radio.pyi +2 -0
  81. reflex/components/radix/themes/components/radio_cards.pyi +4 -0
  82. reflex/components/radix/themes/components/radio_group.pyi +8 -0
  83. reflex/components/radix/themes/components/scroll_area.pyi +2 -0
  84. reflex/components/radix/themes/components/segmented_control.pyi +4 -0
  85. reflex/components/radix/themes/components/select.pyi +18 -0
  86. reflex/components/radix/themes/components/separator.pyi +2 -0
  87. reflex/components/radix/themes/components/skeleton.pyi +2 -0
  88. reflex/components/radix/themes/components/slider.pyi +2 -0
  89. reflex/components/radix/themes/components/spinner.pyi +2 -0
  90. reflex/components/radix/themes/components/switch.pyi +2 -0
  91. reflex/components/radix/themes/components/table.pyi +14 -0
  92. reflex/components/radix/themes/components/tabs.pyi +10 -0
  93. reflex/components/radix/themes/components/text_area.pyi +2 -0
  94. reflex/components/radix/themes/components/text_field.pyi +6 -0
  95. reflex/components/radix/themes/components/tooltip.pyi +2 -0
  96. reflex/components/radix/themes/layout/base.pyi +2 -0
  97. reflex/components/radix/themes/layout/box.pyi +2 -0
  98. reflex/components/radix/themes/layout/center.pyi +2 -0
  99. reflex/components/radix/themes/layout/container.pyi +1 -0
  100. reflex/components/radix/themes/layout/flex.pyi +2 -0
  101. reflex/components/radix/themes/layout/grid.pyi +2 -0
  102. reflex/components/radix/themes/layout/list.pyi +10 -0
  103. reflex/components/radix/themes/layout/section.pyi +2 -0
  104. reflex/components/radix/themes/layout/spacer.pyi +2 -0
  105. reflex/components/radix/themes/layout/stack.py +5 -4
  106. reflex/components/radix/themes/layout/stack.pyi +70 -16
  107. reflex/components/radix/themes/typography/blockquote.pyi +2 -0
  108. reflex/components/radix/themes/typography/code.pyi +2 -0
  109. reflex/components/radix/themes/typography/heading.pyi +2 -0
  110. reflex/components/radix/themes/typography/link.pyi +2 -0
  111. reflex/components/radix/themes/typography/text.pyi +14 -0
  112. reflex/components/react_player/audio.pyi +2 -0
  113. reflex/components/react_player/react_player.pyi +2 -0
  114. reflex/components/react_player/video.pyi +2 -0
  115. reflex/components/recharts/cartesian.pyi +38 -0
  116. reflex/components/recharts/charts.pyi +24 -0
  117. reflex/components/recharts/general.pyi +12 -0
  118. reflex/components/recharts/polar.pyi +12 -0
  119. reflex/components/recharts/recharts.pyi +4 -0
  120. reflex/components/sonner/toast.pyi +2 -0
  121. reflex/components/suneditor/editor.pyi +2 -0
  122. reflex/constants/compiler.py +12 -6
  123. reflex/constants/installer.py +1 -1
  124. reflex/event.py +21 -0
  125. reflex/experimental/layout.pyi +5 -0
  126. reflex/reflex.py +24 -0
  127. reflex/testing.py +2 -1
  128. reflex/utils/format.py +4 -11
  129. reflex/utils/net.py +35 -2
  130. reflex/utils/prerequisites.py +10 -4
  131. reflex/utils/pyi_generator.py +7 -1
  132. reflex/utils/types.py +7 -5
  133. reflex/vars/base.py +7 -8
  134. reflex/vars/object.py +9 -2
  135. {reflex-0.7.11.dist-info → reflex-0.7.12a1.dist-info}/METADATA +4 -4
  136. {reflex-0.7.11.dist-info → reflex-0.7.12a1.dist-info}/RECORD +140 -139
  137. scripts/hatch_build.py +50 -0
  138. {reflex-0.7.11.dist-info → reflex-0.7.12a1.dist-info}/WHEEL +0 -0
  139. {reflex-0.7.11.dist-info → reflex-0.7.12a1.dist-info}/entry_points.txt +0 -0
  140. {reflex-0.7.11.dist-info → reflex-0.7.12a1.dist-info}/licenses/LICENSE +0 -0
@@ -33,6 +33,7 @@ class ResponsiveContainer(Recharts, MemoizationLeaf):
33
33
  | None = None,
34
34
  key: Any | None = None,
35
35
  id: Any | None = None,
36
+ ref: Var | None = None,
36
37
  class_name: Any | None = None,
37
38
  autofocus: bool | None = None,
38
39
  custom_attrs: dict[str, Var | Any] | None = None,
@@ -68,6 +69,7 @@ class ResponsiveContainer(Recharts, MemoizationLeaf):
68
69
  style: The style of the component.
69
70
  key: A unique key for the component.
70
71
  id: The id for the component.
72
+ ref: The Var to pass as the ref to the component.
71
73
  class_name: The class name for the component.
72
74
  autofocus: Whether the component should take the focus once the page is loaded
73
75
  custom_attrs: custom attribute
@@ -134,6 +136,7 @@ class Legend(Recharts):
134
136
  | None = None,
135
137
  key: Any | None = None,
136
138
  id: Any | None = None,
139
+ ref: Var | None = None,
137
140
  class_name: Any | None = None,
138
141
  autofocus: bool | None = None,
139
142
  custom_attrs: dict[str, Var | Any] | None = None,
@@ -180,6 +183,7 @@ class Legend(Recharts):
180
183
  style: The style of the component.
181
184
  key: A unique key for the component.
182
185
  id: The id for the component.
186
+ ref: The Var to pass as the ref to the component.
183
187
  class_name: The class name for the component.
184
188
  autofocus: Whether the component should take the focus once the page is loaded
185
189
  custom_attrs: custom attribute
@@ -223,6 +227,7 @@ class GraphingTooltip(Recharts):
223
227
  | None = None,
224
228
  key: Any | None = None,
225
229
  id: Any | None = None,
230
+ ref: Var | None = None,
226
231
  class_name: Any | None = None,
227
232
  autofocus: bool | None = None,
228
233
  custom_attrs: dict[str, Var | Any] | None = None,
@@ -266,6 +271,7 @@ class GraphingTooltip(Recharts):
266
271
  style: The style of the component.
267
272
  key: A unique key for the component.
268
273
  id: The id for the component.
274
+ ref: The Var to pass as the ref to the component.
269
275
  class_name: The class name for the component.
270
276
  autofocus: Whether the component should take the focus once the page is loaded
271
277
  custom_attrs: custom attribute
@@ -335,6 +341,7 @@ class Label(Recharts):
335
341
  | None = None,
336
342
  key: Any | None = None,
337
343
  id: Any | None = None,
344
+ ref: Var | None = None,
338
345
  class_name: Any | None = None,
339
346
  autofocus: bool | None = None,
340
347
  custom_attrs: dict[str, Var | Any] | None = None,
@@ -366,6 +373,7 @@ class Label(Recharts):
366
373
  style: The style of the component.
367
374
  key: A unique key for the component.
368
375
  id: The id for the component.
376
+ ref: The Var to pass as the ref to the component.
369
377
  class_name: The class name for the component.
370
378
  autofocus: Whether the component should take the focus once the page is loaded
371
379
  custom_attrs: custom attribute
@@ -436,6 +444,7 @@ class LabelList(Recharts):
436
444
  | None = None,
437
445
  key: Any | None = None,
438
446
  id: Any | None = None,
447
+ ref: Var | None = None,
439
448
  class_name: Any | None = None,
440
449
  autofocus: bool | None = None,
441
450
  custom_attrs: dict[str, Var | Any] | None = None,
@@ -468,6 +477,7 @@ class LabelList(Recharts):
468
477
  style: The style of the component.
469
478
  key: A unique key for the component.
470
479
  id: The id for the component.
480
+ ref: The Var to pass as the ref to the component.
471
481
  class_name: The class name for the component.
472
482
  autofocus: Whether the component should take the focus once the page is loaded
473
483
  custom_attrs: custom attribute
@@ -493,6 +503,7 @@ class Cell(Recharts):
493
503
  | None = None,
494
504
  key: Any | None = None,
495
505
  id: Any | None = None,
506
+ ref: Var | None = None,
496
507
  class_name: Any | None = None,
497
508
  autofocus: bool | None = None,
498
509
  custom_attrs: dict[str, Var | Any] | None = None,
@@ -522,6 +533,7 @@ class Cell(Recharts):
522
533
  style: The style of the component.
523
534
  key: A unique key for the component.
524
535
  id: The id for the component.
536
+ ref: The Var to pass as the ref to the component.
525
537
  class_name: The class name for the component.
526
538
  autofocus: Whether the component should take the focus once the page is loaded
527
539
  custom_attrs: custom attribute
@@ -80,6 +80,7 @@ class Pie(Recharts):
80
80
  | None = None,
81
81
  key: Any | None = None,
82
82
  id: Any | None = None,
83
+ ref: Var | None = None,
83
84
  class_name: Any | None = None,
84
85
  autofocus: bool | None = None,
85
86
  custom_attrs: dict[str, Var | Any] | None = None,
@@ -121,6 +122,7 @@ class Pie(Recharts):
121
122
  style: The style of the component.
122
123
  key: A unique key for the component.
123
124
  id: The id for the component.
125
+ ref: The Var to pass as the ref to the component.
124
126
  class_name: The class name for the component.
125
127
  autofocus: Whether the component should take the focus once the page is loaded
126
128
  custom_attrs: custom attribute
@@ -189,6 +191,7 @@ class Radar(Recharts):
189
191
  | None = None,
190
192
  key: Any | None = None,
191
193
  id: Any | None = None,
194
+ ref: Var | None = None,
192
195
  class_name: Any | None = None,
193
196
  autofocus: bool | None = None,
194
197
  custom_attrs: dict[str, Var | Any] | None = None,
@@ -215,6 +218,7 @@ class Radar(Recharts):
215
218
  style: The style of the component.
216
219
  key: A unique key for the component.
217
220
  id: The id for the component.
221
+ ref: The Var to pass as the ref to the component.
218
222
  class_name: The class name for the component.
219
223
  autofocus: Whether the component should take the focus once the page is loaded
220
224
  custom_attrs: custom attribute
@@ -281,6 +285,7 @@ class RadialBar(Recharts):
281
285
  | None = None,
282
286
  key: Any | None = None,
283
287
  id: Any | None = None,
288
+ ref: Var | None = None,
284
289
  class_name: Any | None = None,
285
290
  autofocus: bool | None = None,
286
291
  custom_attrs: dict[str, Var | Any] | None = None,
@@ -311,6 +316,7 @@ class RadialBar(Recharts):
311
316
  style: The style of the component.
312
317
  key: A unique key for the component.
313
318
  id: The id for the component.
319
+ ref: The Var to pass as the ref to the component.
314
320
  class_name: The class name for the component.
315
321
  autofocus: Whether the component should take the focus once the page is loaded
316
322
  custom_attrs: custom attribute
@@ -348,6 +354,7 @@ class PolarAngleAxis(Recharts):
348
354
  | None = None,
349
355
  key: Any | None = None,
350
356
  id: Any | None = None,
357
+ ref: Var | None = None,
351
358
  class_name: Any | None = None,
352
359
  autofocus: bool | None = None,
353
360
  custom_attrs: dict[str, Var | Any] | None = None,
@@ -395,6 +402,7 @@ class PolarAngleAxis(Recharts):
395
402
  style: The style of the component.
396
403
  key: A unique key for the component.
397
404
  id: The id for the component.
405
+ ref: The Var to pass as the ref to the component.
398
406
  class_name: The class name for the component.
399
407
  autofocus: Whether the component should take the focus once the page is loaded
400
408
  custom_attrs: custom attribute
@@ -428,6 +436,7 @@ class PolarGrid(Recharts):
428
436
  | None = None,
429
437
  key: Any | None = None,
430
438
  id: Any | None = None,
439
+ ref: Var | None = None,
431
440
  class_name: Any | None = None,
432
441
  autofocus: bool | None = None,
433
442
  custom_attrs: dict[str, Var | Any] | None = None,
@@ -463,6 +472,7 @@ class PolarGrid(Recharts):
463
472
  style: The style of the component.
464
473
  key: A unique key for the component.
465
474
  id: The id for the component.
475
+ ref: The Var to pass as the ref to the component.
466
476
  class_name: The class name for the component.
467
477
  autofocus: Whether the component should take the focus once the page is loaded
468
478
  custom_attrs: custom attribute
@@ -540,6 +550,7 @@ class PolarRadiusAxis(Recharts):
540
550
  | None = None,
541
551
  key: Any | None = None,
542
552
  id: Any | None = None,
553
+ ref: Var | None = None,
543
554
  class_name: Any | None = None,
544
555
  autofocus: bool | None = None,
545
556
  custom_attrs: dict[str, Var | Any] | None = None,
@@ -571,6 +582,7 @@ class PolarRadiusAxis(Recharts):
571
582
  style: The style of the component.
572
583
  key: A unique key for the component.
573
584
  id: The id for the component.
585
+ ref: The Var to pass as the ref to the component.
574
586
  class_name: The class name for the component.
575
587
  autofocus: Whether the component should take the focus once the page is loaded
576
588
  custom_attrs: custom attribute
@@ -24,6 +24,7 @@ class Recharts(Component):
24
24
  | None = None,
25
25
  key: Any | None = None,
26
26
  id: Any | None = None,
27
+ ref: Var | None = None,
27
28
  class_name: Any | None = None,
28
29
  autofocus: bool | None = None,
29
30
  custom_attrs: dict[str, Var | Any] | None = None,
@@ -51,6 +52,7 @@ class Recharts(Component):
51
52
  style: The style of the component.
52
53
  key: A unique key for the component.
53
54
  id: The id for the component.
55
+ ref: The Var to pass as the ref to the component.
54
56
  class_name: The class name for the component.
55
57
  autofocus: Whether the component should take the focus once the page is loaded
56
58
  custom_attrs: custom attribute
@@ -74,6 +76,7 @@ class RechartsCharts(NoSSRComponent, MemoizationLeaf):
74
76
  | None = None,
75
77
  key: Any | None = None,
76
78
  id: Any | None = None,
79
+ ref: Var | None = None,
77
80
  class_name: Any | None = None,
78
81
  autofocus: bool | None = None,
79
82
  custom_attrs: dict[str, Var | Any] | None = None,
@@ -101,6 +104,7 @@ class RechartsCharts(NoSSRComponent, MemoizationLeaf):
101
104
  style: The style of the component.
102
105
  key: A unique key for the component.
103
106
  id: The id for the component.
107
+ ref: The Var to pass as the ref to the component.
104
108
  class_name: The class name for the component.
105
109
  autofocus: Whether the component should take the focus once the page is loaded
106
110
  custom_attrs: custom attribute
@@ -126,6 +126,7 @@ class Toaster(Component):
126
126
  | None = None,
127
127
  key: Any | None = None,
128
128
  id: Any | None = None,
129
+ ref: Var | None = None,
129
130
  class_name: Any | None = None,
130
131
  autofocus: bool | None = None,
131
132
  custom_attrs: dict[str, Var | Any] | None = None,
@@ -167,6 +168,7 @@ class Toaster(Component):
167
168
  style: The style of the component.
168
169
  key: A unique key for the component.
169
170
  id: The id for the component.
171
+ ref: The Var to pass as the ref to the component.
170
172
  class_name: The class name for the component.
171
173
  autofocus: Whether the component should take the focus once the page is loaded
172
174
  custom_attrs: custom attribute
@@ -124,6 +124,7 @@ class Editor(NoSSRComponent):
124
124
  | None = None,
125
125
  key: Any | None = None,
126
126
  id: Any | None = None,
127
+ ref: Var | None = None,
127
128
  class_name: Any | None = None,
128
129
  autofocus: bool | None = None,
129
130
  custom_attrs: dict[str, Var | Any] | None = None,
@@ -184,6 +185,7 @@ class Editor(NoSSRComponent):
184
185
  style: The style of the component.
185
186
  key: A unique key for the component.
186
187
  id: The id for the component.
188
+ ref: The Var to pass as the ref to the component.
187
189
  class_name: The class name for the component.
188
190
  autofocus: Whether the component should take the focus once the page is loaded
189
191
  custom_attrs: custom attribute
@@ -171,6 +171,12 @@ class MemoizationMode:
171
171
  recursive: bool = True
172
172
 
173
173
 
174
+ DATA_UNDERSCORE = "data_"
175
+ DATA_DASH = "data-"
176
+ ARIA_UNDERSCORE = "aria_"
177
+ ARIA_DASH = "aria-"
178
+
179
+
174
180
  class SpecialAttributes(enum.Enum):
175
181
  """Special attributes for components.
176
182
 
@@ -178,11 +184,6 @@ class SpecialAttributes(enum.Enum):
178
184
  to a style prop.
179
185
  """
180
186
 
181
- DATA_UNDERSCORE = "data_"
182
- DATA_DASH = "data-"
183
- ARIA_UNDERSCORE = "aria_"
184
- ARIA_DASH = "aria-"
185
-
186
187
  @classmethod
187
188
  def is_special(cls, attr: str) -> bool:
188
189
  """Check if the attribute is special.
@@ -193,4 +194,9 @@ class SpecialAttributes(enum.Enum):
193
194
  Returns:
194
195
  True if the attribute is special.
195
196
  """
196
- return any(attr.startswith(value.value) for value in cls)
197
+ return (
198
+ attr.startswith(DATA_UNDERSCORE)
199
+ or attr.startswith(DATA_DASH)
200
+ or attr.startswith(ARIA_UNDERSCORE)
201
+ or attr.startswith(ARIA_DASH)
202
+ )
@@ -14,7 +14,7 @@ class Bun(SimpleNamespace):
14
14
  """Bun constants."""
15
15
 
16
16
  # The Bun version.
17
- VERSION = "1.2.12"
17
+ VERSION = "1.2.13"
18
18
 
19
19
  # Min Bun Version
20
20
  MIN_VERSION = "1.2.8"
reflex/event.py CHANGED
@@ -14,6 +14,7 @@ from typing import (
14
14
  Annotated,
15
15
  Any,
16
16
  Generic,
17
+ NoReturn,
17
18
  Protocol,
18
19
  TypedDict,
19
20
  TypeVar,
@@ -1683,6 +1684,16 @@ prevent_default = noop().prevent_default
1683
1684
  class EventVar(ObjectVar, python_types=(EventSpec, EventHandler)):
1684
1685
  """Base class for event vars."""
1685
1686
 
1687
+ def bool(self) -> NoReturn:
1688
+ """Get the boolean value of the var.
1689
+
1690
+ Raises:
1691
+ TypeError: EventVar cannot be converted to a boolean.
1692
+ """
1693
+ raise TypeError(
1694
+ f"Cannot convert {self._js_expr} of type {type(self).__name__} to bool."
1695
+ )
1696
+
1686
1697
 
1687
1698
  @dataclasses.dataclass(
1688
1699
  eq=False,
@@ -1759,6 +1770,16 @@ class LiteralEventVar(VarOperationCall, LiteralVar, EventVar):
1759
1770
  class EventChainVar(BuilderFunctionVar, python_types=EventChain):
1760
1771
  """Base class for event chain vars."""
1761
1772
 
1773
+ def bool(self) -> NoReturn:
1774
+ """Get the boolean value of the var.
1775
+
1776
+ Raises:
1777
+ TypeError: EventChainVar cannot be converted to a boolean.
1778
+ """
1779
+ raise TypeError(
1780
+ f"Cannot convert {self._js_expr} of type {type(self).__name__} to bool."
1781
+ )
1782
+
1762
1783
 
1763
1784
  @dataclasses.dataclass(
1764
1785
  eq=False,
@@ -207,6 +207,7 @@ class Sidebar(Box, MemoizationLeaf):
207
207
  | None = None,
208
208
  key: Any | None = None,
209
209
  id: Any | None = None,
210
+ ref: Var | None = None,
210
211
  class_name: Any | None = None,
211
212
  autofocus: bool | None = None,
212
213
  custom_attrs: dict[str, Var | Any] | None = None,
@@ -276,6 +277,7 @@ class DrawerSidebar(DrawerRoot):
276
277
  | None = None,
277
278
  key: Any | None = None,
278
279
  id: Any | None = None,
280
+ ref: Var | None = None,
279
281
  class_name: Any | None = None,
280
282
  autofocus: bool | None = None,
281
283
  custom_attrs: dict[str, Var | Any] | None = None,
@@ -330,6 +332,7 @@ class SidebarTrigger(Fragment):
330
332
  | None = None,
331
333
  key: Any | None = None,
332
334
  id: Any | None = None,
335
+ ref: Var | None = None,
333
336
  class_name: Any | None = None,
334
337
  autofocus: bool | None = None,
335
338
  custom_attrs: dict[str, Var | Any] | None = None,
@@ -553,6 +556,7 @@ class Layout(Box):
553
556
  | None = None,
554
557
  key: Any | None = None,
555
558
  id: Any | None = None,
559
+ ref: Var | None = None,
556
560
  class_name: Any | None = None,
557
561
  autofocus: bool | None = None,
558
562
  custom_attrs: dict[str, Var | Any] | None = None,
@@ -779,6 +783,7 @@ class LayoutNamespace(ComponentNamespace):
779
783
  | None = None,
780
784
  key: Any | None = None,
781
785
  id: Any | None = None,
786
+ ref: Var | None = None,
782
787
  class_name: Any | None = None,
783
788
  autofocus: bool | None = None,
784
789
  custom_attrs: dict[str, Var | Any] | None = None,
reflex/reflex.py CHANGED
@@ -351,6 +351,30 @@ def run(
351
351
  )
352
352
 
353
353
 
354
+ @cli.command()
355
+ @loglevel_option
356
+ @click.option(
357
+ "--dry",
358
+ is_flag=True,
359
+ default=False,
360
+ help="Run the command without making any changes.",
361
+ )
362
+ def compile(dry: bool):
363
+ """Compile the app in the current directory."""
364
+ import time
365
+
366
+ from reflex.utils import prerequisites
367
+
368
+ # Check the app.
369
+ if prerequisites.needs_reinit():
370
+ _init(name=get_config().app_name)
371
+ get_config(reload=True)
372
+ starting_time = time.monotonic()
373
+ prerequisites.compile_app(dry_run=dry)
374
+ elapsed_time = time.monotonic() - starting_time
375
+ console.success(f"App compiled successfully in {elapsed_time:.3f} seconds.")
376
+
377
+
354
378
  @cli.command()
355
379
  @loglevel_option
356
380
  @click.option(
reflex/testing.py CHANGED
@@ -14,6 +14,7 @@ import signal
14
14
  import socket
15
15
  import socketserver
16
16
  import subprocess
17
+ import sys
17
18
  import textwrap
18
19
  import threading
19
20
  import time
@@ -475,7 +476,7 @@ class AppHarness:
475
476
  frontend_children = psutil.Process(self.frontend_process.pid).children(
476
477
  recursive=True,
477
478
  )
478
- if platform.system() == "Windows":
479
+ if sys.platform == "win32":
479
480
  self.frontend_process.terminate()
480
481
  else:
481
482
  pgrp = os.getpgid(self.frontend_process.pid)
reflex/utils/format.py CHANGED
@@ -436,19 +436,12 @@ def format_props(*single_props, **key_value_props) -> list[str]:
436
436
  The formatted props list.
437
437
  """
438
438
  # Format all the props.
439
- from reflex.vars.base import LiteralVar, Var
439
+ from reflex.vars import LiteralStringVar, LiteralVar, Var
440
440
 
441
441
  return [
442
- ":".join(
443
- [
444
- str(name if "-" not in name else LiteralVar.create(name)),
445
- str(
446
- format_prop(
447
- prop if isinstance(prop, Var) else LiteralVar.create(prop)
448
- )
449
- ),
450
- ]
451
- )
442
+ (str(LiteralStringVar.create(name)) if "-" in name else name)
443
+ + ":"
444
+ + str(format_prop(prop if isinstance(prop, Var) else LiteralVar.create(prop)))
452
445
  for name, prop in sorted(key_value_props.items())
453
446
  if prop is not None
454
447
  ] + [(f"...{LiteralVar.create(prop)!s}") for prop in single_props]
reflex/utils/net.py CHANGED
@@ -8,6 +8,7 @@ from typing import ParamSpec, TypeVar
8
8
  import httpx
9
9
 
10
10
  from reflex.utils.decorator import once
11
+ from reflex.utils.types import Unset
11
12
 
12
13
  from . import console
13
14
 
@@ -63,6 +64,30 @@ def _wrap_https_func(
63
64
  return wrapper
64
65
 
65
66
 
67
+ def _wrap_https_lazy_func(
68
+ func: Callable[[], Callable[_P, _T]],
69
+ ) -> Callable[_P, _T]:
70
+ """Wrap an HTTPS function with logging.
71
+
72
+ Args:
73
+ func: The function to wrap.
74
+
75
+ Returns:
76
+ The wrapped function.
77
+ """
78
+ unset = Unset()
79
+ f: Callable[_P, _T] | Unset = unset
80
+
81
+ def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> _T:
82
+ nonlocal f
83
+ if isinstance(f, Unset):
84
+ f = _wrap_https_func(func())
85
+ functools.update_wrapper(wrapper, f)
86
+ return f(*args, **kwargs)
87
+
88
+ return wrapper
89
+
90
+
66
91
  def _is_ipv4_supported() -> bool:
67
92
  """Determine if the system supports IPv4.
68
93
 
@@ -120,12 +145,20 @@ def _httpx_client() -> httpx.Client:
120
145
  Returns:
121
146
  An HTTPX client.
122
147
  """
148
+ from httpx._utils import get_environment_proxies
149
+
123
150
  return httpx.Client(
124
151
  transport=httpx.HTTPTransport(
125
152
  local_address=_httpx_local_address_kwarg(),
126
153
  verify=_httpx_verify_kwarg(),
127
- )
154
+ ),
155
+ mounts={
156
+ key: (
157
+ None if url is None else httpx.HTTPTransport(proxy=httpx.Proxy(url=url))
158
+ )
159
+ for key, url in get_environment_proxies().items()
160
+ },
128
161
  )
129
162
 
130
163
 
131
- get = _wrap_https_func(_httpx_client().get)
164
+ get = _wrap_https_lazy_func(lambda: _httpx_client().get)
@@ -431,12 +431,15 @@ def validate_app(reload: bool = False) -> None:
431
431
  get_and_validate_app(reload=reload)
432
432
 
433
433
 
434
- def get_compiled_app(reload: bool = False, export: bool = False) -> ModuleType:
434
+ def get_compiled_app(
435
+ reload: bool = False, export: bool = False, dry_run: bool = False
436
+ ) -> ModuleType:
435
437
  """Get the app module based on the default config after first compiling it.
436
438
 
437
439
  Args:
438
440
  reload: Re-import the app module from disk
439
441
  export: Compile the app for export
442
+ dry_run: If True, do not write the compiled app to disk.
440
443
 
441
444
  Returns:
442
445
  The compiled app based on the default config.
@@ -445,18 +448,21 @@ def get_compiled_app(reload: bool = False, export: bool = False) -> ModuleType:
445
448
  # For py3.9 compatibility when redis is used, we MUST add any decorator pages
446
449
  # before compiling the app in a thread to avoid event loop error (REF-2172).
447
450
  app._apply_decorated_pages()
448
- app._compile(export=export)
451
+ app._compile(export=export, dry_run=dry_run)
449
452
  return app_module
450
453
 
451
454
 
452
- def compile_app(reload: bool = False, export: bool = False) -> None:
455
+ def compile_app(
456
+ reload: bool = False, export: bool = False, dry_run: bool = False
457
+ ) -> None:
453
458
  """Compile the app module based on the default config.
454
459
 
455
460
  Args:
456
461
  reload: Re-import the app module from disk
457
462
  export: Compile the app for export
463
+ dry_run: If True, do not write the compiled app to disk.
458
464
  """
459
- get_compiled_app(reload=reload, export=export)
465
+ get_compiled_app(reload=reload, export=export, dry_run=dry_run)
460
466
 
461
467
 
462
468
  def _can_colorize() -> bool:
@@ -221,6 +221,12 @@ def _get_type_hint(
221
221
  if ev.__name__ == "Var"
222
222
  else value
223
223
  )
224
+ elif isinstance(value, list):
225
+ res = [
226
+ _get_type_hint(arg, type_hint_globals, rx_types.is_optional(arg))
227
+ for arg in value
228
+ ]
229
+ return f"[{', '.join(res)}]"
224
230
  else:
225
231
  res = value.__name__
226
232
  if is_optional and not res.startswith("Optional") and not res.endswith("| None"):
@@ -1029,7 +1035,7 @@ class StubGenerator(ast.NodeTransformer):
1029
1035
  return node
1030
1036
  if isinstance(node.target, ast.Name) and node.target.id.startswith("_"):
1031
1037
  return None
1032
- if self.current_class in self.classes:
1038
+ if self._current_class_is_component():
1033
1039
  # Remove annotated assignments in Component classes (props)
1034
1040
  return None
1035
1041
  # Blank out assignments in type stubs.
reflex/utils/types.py CHANGED
@@ -24,17 +24,13 @@ from typing import ( # noqa: UP035
24
24
  _GenericAlias, # pyright: ignore [reportAttributeAccessIssue]
25
25
  _SpecialGenericAlias, # pyright: ignore [reportAttributeAccessIssue]
26
26
  get_args,
27
+ is_typeddict,
27
28
  )
28
29
  from typing import get_origin as get_origin_og
29
30
  from typing import get_type_hints as get_type_hints_og
30
31
 
31
- import sqlalchemy
32
32
  from pydantic.v1.fields import ModelField
33
- from sqlalchemy.ext.associationproxy import AssociationProxyInstance
34
- from sqlalchemy.ext.hybrid import hybrid_property
35
- from sqlalchemy.orm import DeclarativeBase, Mapped, QueryableAttribute, Relationship
36
33
  from typing_extensions import Self as Self
37
- from typing_extensions import is_typeddict
38
34
  from typing_extensions import override as override
39
35
 
40
36
  import reflex
@@ -331,6 +327,8 @@ def get_property_hint(attr: Any | None) -> GenericType | None:
331
327
  Returns:
332
328
  The type hint of the property, if it is a property, else None.
333
329
  """
330
+ from sqlalchemy.ext.hybrid import hybrid_property
331
+
334
332
  if not isinstance(attr, (property, hybrid_property)):
335
333
  return None
336
334
  hints = get_type_hints(attr.fget)
@@ -349,6 +347,10 @@ def get_attribute_access_type(cls: GenericType, name: str) -> GenericType | None
349
347
  Returns:
350
348
  The type of the attribute, if accessible, or None
351
349
  """
350
+ import sqlalchemy
351
+ from sqlalchemy.ext.associationproxy import AssociationProxyInstance
352
+ from sqlalchemy.orm import DeclarativeBase, Mapped, QueryableAttribute, Relationship
353
+
352
354
  from reflex.model import Model
353
355
 
354
356
  try:
reflex/vars/base.py CHANGED
@@ -40,7 +40,6 @@ from typing import ( # noqa: UP035
40
40
  )
41
41
 
42
42
  from rich.markup import escape
43
- from sqlalchemy.orm import DeclarativeBase
44
43
  from typing_extensions import deprecated, override
45
44
 
46
45
  from reflex import constants
@@ -171,7 +170,8 @@ class VarData:
171
170
  object.__setattr__(self, "components", tuple(components or []))
172
171
 
173
172
  if hooks and any(hooks.values()):
174
- merged_var_data = VarData.merge(self, *hooks.values())
173
+ # Merge our dependencies first, so they can be referenced.
174
+ merged_var_data = VarData.merge(*hooks.values(), self)
175
175
  if merged_var_data is not None:
176
176
  object.__setattr__(self, "state", merged_var_data.state)
177
177
  object.__setattr__(self, "field_name", merged_var_data.field_name)
@@ -3330,18 +3330,17 @@ def dispatch(
3330
3330
  ).guess_type()
3331
3331
 
3332
3332
 
3333
- V = TypeVar("V")
3334
-
3335
- BASE_TYPE = TypeVar("BASE_TYPE", bound=Base | None)
3336
- SQLA_TYPE = TypeVar("SQLA_TYPE", bound=DeclarativeBase | None)
3337
-
3338
3333
  if TYPE_CHECKING:
3339
3334
  from _typeshed import DataclassInstance
3335
+ from sqlalchemy.orm import DeclarativeBase
3340
3336
 
3337
+ SQLA_TYPE = TypeVar("SQLA_TYPE", bound=DeclarativeBase | None)
3338
+ BASE_TYPE = TypeVar("BASE_TYPE", bound=Base | None)
3341
3339
  DATACLASS_TYPE = TypeVar("DATACLASS_TYPE", bound=DataclassInstance | None)
3340
+ MAPPING_TYPE = TypeVar("MAPPING_TYPE", bound=Mapping | None)
3341
+ V = TypeVar("V")
3342
3342
 
3343
3343
  FIELD_TYPE = TypeVar("FIELD_TYPE")
3344
- MAPPING_TYPE = TypeVar("MAPPING_TYPE", bound=Mapping | None)
3345
3344
 
3346
3345
 
3347
3346
  class Field(Generic[FIELD_TYPE]):
reflex/vars/object.py CHANGED
@@ -7,10 +7,17 @@ import dataclasses
7
7
  import typing
8
8
  from collections.abc import Mapping
9
9
  from inspect import isclass
10
- from typing import Any, NoReturn, TypeVar, get_args, get_type_hints, overload
10
+ from typing import (
11
+ Any,
12
+ NoReturn,
13
+ TypeVar,
14
+ get_args,
15
+ get_type_hints,
16
+ is_typeddict,
17
+ overload,
18
+ )
11
19
 
12
20
  from rich.markup import escape
13
- from typing_extensions import is_typeddict
14
21
 
15
22
  from reflex.utils import types
16
23
  from reflex.utils.exceptions import VarAttributeError