reflex 0.8.4a2__py3-none-any.whl → 0.8.5__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.
- reflex/__init__.py +2 -9
- reflex/__init__.pyi +4 -2
- reflex/app.py +16 -10
- reflex/compiler/compiler.py +10 -3
- reflex/compiler/utils.py +6 -12
- reflex/components/base/app_wrap.pyi +0 -1
- reflex/components/base/body.pyi +0 -2
- reflex/components/base/document.pyi +0 -12
- reflex/components/base/error_boundary.pyi +0 -2
- reflex/components/base/fragment.pyi +0 -2
- reflex/components/base/link.pyi +0 -4
- reflex/components/base/meta.pyi +0 -6
- reflex/components/base/script.py +0 -2
- reflex/components/base/script.pyi +0 -2
- reflex/components/base/strict_mode.pyi +0 -2
- reflex/components/component.py +2 -30
- reflex/components/core/auto_scroll.py +14 -13
- reflex/components/core/auto_scroll.pyi +0 -2
- reflex/components/core/banner.pyi +0 -10
- reflex/components/core/client_side_routing.pyi +0 -2
- reflex/components/core/clipboard.py +1 -3
- reflex/components/core/clipboard.pyi +0 -2
- reflex/components/core/cond.py +0 -2
- reflex/components/core/debounce.pyi +0 -1
- reflex/components/core/helmet.pyi +0 -2
- reflex/components/core/html.pyi +0 -2
- reflex/components/core/match.py +1 -2
- reflex/components/core/sticky.pyi +0 -4
- reflex/components/core/upload.pyi +0 -10
- reflex/components/core/window_events.pyi +0 -2
- reflex/components/datadisplay/code.py +6 -4
- reflex/components/datadisplay/code.pyi +0 -4
- reflex/components/datadisplay/dataeditor.pyi +0 -2
- reflex/components/datadisplay/shiki_code_block.pyi +0 -6
- reflex/components/el/element.pyi +0 -2
- reflex/components/el/elements/base.pyi +0 -2
- reflex/components/el/elements/forms.py +5 -21
- reflex/components/el/elements/forms.pyi +0 -38
- reflex/components/el/elements/inline.pyi +0 -56
- reflex/components/el/elements/media.pyi +0 -52
- reflex/components/el/elements/metadata.pyi +0 -12
- reflex/components/el/elements/other.pyi +0 -14
- reflex/components/el/elements/scripts.pyi +0 -6
- reflex/components/el/elements/sectioning.pyi +0 -30
- reflex/components/el/elements/tables.pyi +0 -20
- reflex/components/el/elements/typography.pyi +0 -32
- reflex/components/gridjs/datatable.pyi +0 -4
- reflex/components/lucide/icon.py +12 -1
- reflex/components/lucide/icon.pyi +12 -7
- reflex/components/markdown/markdown.pyi +0 -2
- reflex/components/moment/moment.pyi +0 -2
- reflex/components/plotly/plotly.py +25 -17
- reflex/components/plotly/plotly.pyi +0 -18
- reflex/components/radix/primitives/accordion.pyi +0 -14
- reflex/components/radix/primitives/base.pyi +0 -4
- reflex/components/radix/primitives/drawer.pyi +0 -22
- reflex/components/radix/primitives/form.pyi +0 -20
- reflex/components/radix/primitives/progress.pyi +0 -10
- reflex/components/radix/primitives/slider.pyi +0 -10
- reflex/components/radix/themes/base.py +2 -4
- reflex/components/radix/themes/base.pyi +0 -15
- reflex/components/radix/themes/color_mode.pyi +0 -5
- reflex/components/radix/themes/components/alert_dialog.pyi +0 -11
- reflex/components/radix/themes/components/aspect_ratio.pyi +0 -2
- reflex/components/radix/themes/components/avatar.pyi +0 -2
- reflex/components/radix/themes/components/badge.pyi +0 -2
- reflex/components/radix/themes/components/button.pyi +0 -2
- reflex/components/radix/themes/components/callout.pyi +0 -10
- reflex/components/radix/themes/components/card.pyi +0 -2
- reflex/components/radix/themes/components/checkbox.pyi +0 -6
- reflex/components/radix/themes/components/checkbox_cards.pyi +0 -4
- reflex/components/radix/themes/components/checkbox_group.pyi +0 -4
- reflex/components/radix/themes/components/context_menu.pyi +0 -26
- reflex/components/radix/themes/components/data_list.pyi +0 -8
- reflex/components/radix/themes/components/dialog.pyi +0 -12
- reflex/components/radix/themes/components/dropdown_menu.pyi +0 -14
- reflex/components/radix/themes/components/hover_card.pyi +0 -7
- reflex/components/radix/themes/components/icon_button.pyi +0 -2
- reflex/components/radix/themes/components/inset.pyi +0 -2
- reflex/components/radix/themes/components/popover.pyi +0 -6
- reflex/components/radix/themes/components/progress.pyi +0 -2
- reflex/components/radix/themes/components/radio.pyi +0 -2
- reflex/components/radix/themes/components/radio_cards.pyi +0 -4
- reflex/components/radix/themes/components/radio_group.pyi +0 -8
- reflex/components/radix/themes/components/scroll_area.pyi +0 -2
- reflex/components/radix/themes/components/segmented_control.pyi +0 -4
- reflex/components/radix/themes/components/select.pyi +0 -18
- reflex/components/radix/themes/components/separator.pyi +0 -2
- reflex/components/radix/themes/components/skeleton.pyi +0 -2
- reflex/components/radix/themes/components/slider.pyi +0 -2
- reflex/components/radix/themes/components/spinner.pyi +0 -2
- reflex/components/radix/themes/components/switch.pyi +0 -2
- reflex/components/radix/themes/components/table.pyi +0 -14
- reflex/components/radix/themes/components/tabs.pyi +0 -10
- reflex/components/radix/themes/components/text_area.pyi +0 -2
- reflex/components/radix/themes/components/text_field.pyi +0 -6
- reflex/components/radix/themes/components/tooltip.pyi +0 -2
- reflex/components/radix/themes/layout/base.pyi +0 -2
- reflex/components/radix/themes/layout/box.pyi +0 -2
- reflex/components/radix/themes/layout/center.pyi +0 -2
- reflex/components/radix/themes/layout/container.pyi +0 -1
- reflex/components/radix/themes/layout/flex.pyi +0 -2
- reflex/components/radix/themes/layout/grid.pyi +0 -2
- reflex/components/radix/themes/layout/list.pyi +0 -10
- reflex/components/radix/themes/layout/section.pyi +0 -2
- reflex/components/radix/themes/layout/spacer.pyi +0 -2
- reflex/components/radix/themes/layout/stack.pyi +0 -6
- reflex/components/radix/themes/typography/blockquote.pyi +0 -2
- reflex/components/radix/themes/typography/code.pyi +0 -2
- reflex/components/radix/themes/typography/heading.pyi +0 -2
- reflex/components/radix/themes/typography/link.pyi +0 -2
- reflex/components/radix/themes/typography/text.pyi +0 -14
- reflex/components/react_player/audio.pyi +0 -2
- reflex/components/react_player/react_player.pyi +0 -2
- reflex/components/react_player/video.pyi +0 -2
- reflex/components/react_router/dom.pyi +0 -2
- reflex/components/recharts/cartesian.pyi +0 -38
- reflex/components/recharts/charts.pyi +0 -24
- reflex/components/recharts/general.pyi +0 -12
- reflex/components/recharts/polar.pyi +0 -12
- reflex/components/recharts/recharts.pyi +0 -4
- reflex/components/sonner/toast.pyi +0 -2
- reflex/components/tags/cond_tag.py +4 -3
- reflex/components/tags/iter_tag.py +1 -1
- reflex/components/tags/match_tag.py +3 -2
- reflex/components/tags/tag.py +39 -40
- reflex/constants/base.py +4 -58
- reflex/constants/compiler.py +0 -8
- reflex/constants/installer.py +5 -5
- reflex/environment.py +0 -10
- reflex/event.py +77 -15
- reflex/page.py +62 -4
- reflex/reflex.py +2 -5
- reflex/utils/net.py +7 -2
- reflex/utils/prerequisites.py +8 -71
- reflex/utils/processes.py +6 -6
- {reflex-0.8.4a2.dist-info → reflex-0.8.5.dist-info}/METADATA +2 -2
- {reflex-0.8.4a2.dist-info → reflex-0.8.5.dist-info}/RECORD +141 -145
- reflex/components/el/constants/__init__.py +0 -5
- reflex/components/el/constants/html.py +0 -343
- reflex/components/el/constants/react.py +0 -501
- reflex/components/el/constants/reflex.py +0 -51
- {reflex-0.8.4a2.dist-info → reflex-0.8.5.dist-info}/WHEEL +0 -0
- {reflex-0.8.4a2.dist-info → reflex-0.8.5.dist-info}/entry_points.txt +0 -0
- {reflex-0.8.4a2.dist-info → reflex-0.8.5.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:
|
|
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:
|
|
22
|
+
false_value: Mapping | None = None
|
|
@@ -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:
|
|
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))
|
reflex/components/tags/tag.py
CHANGED
|
@@ -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:
|
|
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:
|
|
48
|
+
special_props: Sequence[Var] = dataclasses.field(default_factory=list)
|
|
49
49
|
|
|
50
50
|
# The children components.
|
|
51
|
-
children:
|
|
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
|
-
"""
|
|
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
|
-
|
|
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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
-
"""
|
|
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
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
-
"""
|
|
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
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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:
|
reflex/constants/base.py
CHANGED
|
@@ -11,8 +11,6 @@ from typing import Literal
|
|
|
11
11
|
|
|
12
12
|
from platformdirs import PlatformDirs
|
|
13
13
|
|
|
14
|
-
from .utils import classproperty
|
|
15
|
-
|
|
16
14
|
IS_WINDOWS = platform.system() == "Windows"
|
|
17
15
|
IS_MACOS = platform.system() == "Darwin"
|
|
18
16
|
IS_LINUX = platform.system() == "Linux"
|
|
@@ -119,9 +117,6 @@ class ReflexHostingCLI(SimpleNamespace):
|
|
|
119
117
|
class Templates(SimpleNamespace):
|
|
120
118
|
"""Constants related to Templates."""
|
|
121
119
|
|
|
122
|
-
# The route on Reflex backend to query which templates are available and their URLs.
|
|
123
|
-
APP_TEMPLATES_ROUTE = "/app-templates"
|
|
124
|
-
|
|
125
120
|
# The default template
|
|
126
121
|
DEFAULT = "blank"
|
|
127
122
|
|
|
@@ -132,58 +127,12 @@ class Templates(SimpleNamespace):
|
|
|
132
127
|
CHOOSE_TEMPLATES = "choose-templates"
|
|
133
128
|
|
|
134
129
|
# The URL to find reflex templates.
|
|
135
|
-
REFLEX_TEMPLATES_URL =
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
DEFAULT_TEMPLATE_URL = "https://blank-template.reflex.run"
|
|
130
|
+
REFLEX_TEMPLATES_URL = (
|
|
131
|
+
"https://reflex.dev/docs/getting-started/open-source-templates/"
|
|
132
|
+
)
|
|
139
133
|
|
|
140
134
|
# The reflex.build frontend host
|
|
141
|
-
REFLEX_BUILD_FRONTEND = "https://reflex.
|
|
142
|
-
|
|
143
|
-
# The reflex.build backend host
|
|
144
|
-
REFLEX_BUILD_BACKEND = "https://flexgen-prod-flexgen.fly.dev"
|
|
145
|
-
|
|
146
|
-
@classproperty
|
|
147
|
-
@classmethod
|
|
148
|
-
def REFLEX_BUILD_URL(cls):
|
|
149
|
-
"""The URL to redirect to reflex.build.
|
|
150
|
-
|
|
151
|
-
Returns:
|
|
152
|
-
The URL to redirect to reflex.build.
|
|
153
|
-
"""
|
|
154
|
-
from reflex.environment import environment
|
|
155
|
-
|
|
156
|
-
return (
|
|
157
|
-
environment.REFLEX_BUILD_FRONTEND.get()
|
|
158
|
-
+ "/gen?reflex_init_token={reflex_init_token}"
|
|
159
|
-
)
|
|
160
|
-
|
|
161
|
-
@classproperty
|
|
162
|
-
@classmethod
|
|
163
|
-
def REFLEX_BUILD_POLL_URL(cls):
|
|
164
|
-
"""The URL to poll waiting for the user to select a generation.
|
|
165
|
-
|
|
166
|
-
Returns:
|
|
167
|
-
The URL to poll waiting for the user to select a generation.
|
|
168
|
-
"""
|
|
169
|
-
from reflex.environment import environment
|
|
170
|
-
|
|
171
|
-
return environment.REFLEX_BUILD_BACKEND.get() + "/api/init/{reflex_init_token}"
|
|
172
|
-
|
|
173
|
-
@classproperty
|
|
174
|
-
@classmethod
|
|
175
|
-
def REFLEX_BUILD_CODE_URL(cls):
|
|
176
|
-
"""The URL to fetch the generation's reflex code.
|
|
177
|
-
|
|
178
|
-
Returns:
|
|
179
|
-
The URL to fetch the generation's reflex code.
|
|
180
|
-
"""
|
|
181
|
-
from reflex.environment import environment
|
|
182
|
-
|
|
183
|
-
return (
|
|
184
|
-
environment.REFLEX_BUILD_BACKEND.get()
|
|
185
|
-
+ "/api/gen/{generation_hash}/refactored"
|
|
186
|
-
)
|
|
135
|
+
REFLEX_BUILD_FRONTEND = "https://build.reflex.dev"
|
|
187
136
|
|
|
188
137
|
class Dirs(SimpleNamespace):
|
|
189
138
|
"""Folders used by the template system of Reflex."""
|
|
@@ -204,9 +153,6 @@ class Javascript(SimpleNamespace):
|
|
|
204
153
|
# The node modules directory.
|
|
205
154
|
NODE_MODULES = "node_modules"
|
|
206
155
|
|
|
207
|
-
# The package lock file.
|
|
208
|
-
PACKAGE_LOCK = "package-lock.json"
|
|
209
|
-
|
|
210
156
|
|
|
211
157
|
class ReactRouter(Javascript):
|
|
212
158
|
"""Constants related to React Router."""
|
reflex/constants/compiler.py
CHANGED
|
@@ -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."""
|
reflex/constants/installer.py
CHANGED
|
@@ -75,7 +75,7 @@ fetch-retries=0
|
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
def _determine_react_router_version() -> str:
|
|
78
|
-
default_version = "7.7.
|
|
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.
|
|
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.
|
|
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
|
-
"
|
|
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
|
-
"
|
|
152
|
+
"vite": "npm:rolldown-vite@7.0.12",
|
|
153
153
|
}
|
reflex/environment.py
CHANGED
|
@@ -563,16 +563,6 @@ class EnvironmentVariables:
|
|
|
563
563
|
# Whether to skip purging the web directory in dev mode.
|
|
564
564
|
REFLEX_PERSIST_WEB_DIR: EnvVar[bool] = env_var(False)
|
|
565
565
|
|
|
566
|
-
# The reflex.build frontend host.
|
|
567
|
-
REFLEX_BUILD_FRONTEND: EnvVar[str] = env_var(
|
|
568
|
-
constants.Templates.REFLEX_BUILD_FRONTEND
|
|
569
|
-
)
|
|
570
|
-
|
|
571
|
-
# The reflex.build backend host.
|
|
572
|
-
REFLEX_BUILD_BACKEND: EnvVar[str] = env_var(
|
|
573
|
-
constants.Templates.REFLEX_BUILD_BACKEND
|
|
574
|
-
)
|
|
575
|
-
|
|
576
566
|
# This env var stores the execution mode of the app
|
|
577
567
|
REFLEX_ENV_MODE: EnvVar[constants.Env] = env_var(constants.Env.DEV)
|
|
578
568
|
|