reflex 0.7.0a5__py3-none-any.whl → 0.7.1a1__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 (126) hide show
  1. reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js +3 -1
  2. reflex/__init__.py +1 -0
  3. reflex/__init__.pyi +1 -0
  4. reflex/app.py +250 -67
  5. reflex/base.py +4 -10
  6. reflex/compiler/compiler.py +46 -12
  7. reflex/compiler/templates.py +1 -2
  8. reflex/compiler/utils.py +23 -14
  9. reflex/components/base/bare.py +109 -16
  10. reflex/components/component.py +179 -124
  11. reflex/components/core/__init__.py +1 -0
  12. reflex/components/core/__init__.pyi +1 -0
  13. reflex/components/core/auto_scroll.py +111 -0
  14. reflex/components/core/auto_scroll.pyi +284 -0
  15. reflex/components/core/banner.py +35 -5
  16. reflex/components/core/banner.pyi +398 -36
  17. reflex/components/core/breakpoints.py +1 -1
  18. reflex/components/core/cond.py +0 -8
  19. reflex/components/core/foreach.py +12 -2
  20. reflex/components/core/html.pyi +200 -19
  21. reflex/components/core/match.py +4 -4
  22. reflex/components/core/sticky.pyi +874 -90
  23. reflex/components/core/upload.py +3 -5
  24. reflex/components/core/upload.pyi +2 -4
  25. reflex/components/datadisplay/code.py +36 -10
  26. reflex/components/datadisplay/code.pyi +1 -1
  27. reflex/components/datadisplay/dataeditor.py +1 -3
  28. reflex/components/datadisplay/dataeditor.pyi +1 -3
  29. reflex/components/el/elements/base.py +95 -17
  30. reflex/components/el/elements/base.pyi +278 -19
  31. reflex/components/el/elements/forms.py +124 -102
  32. reflex/components/el/elements/forms.pyi +2787 -365
  33. reflex/components/el/elements/inline.py +24 -15
  34. reflex/components/el/elements/inline.pyi +5655 -546
  35. reflex/components/el/elements/media.py +79 -95
  36. reflex/components/el/elements/media.pyi +5167 -565
  37. reflex/components/el/elements/metadata.py +19 -17
  38. reflex/components/el/elements/metadata.pyi +841 -89
  39. reflex/components/el/elements/other.py +3 -5
  40. reflex/components/el/elements/other.pyi +1404 -137
  41. reflex/components/el/elements/scripts.py +10 -13
  42. reflex/components/el/elements/scripts.pyi +634 -65
  43. reflex/components/el/elements/sectioning.pyi +3001 -286
  44. reflex/components/el/elements/tables.py +14 -35
  45. reflex/components/el/elements/tables.pyi +2029 -218
  46. reflex/components/el/elements/typography.py +10 -13
  47. reflex/components/el/elements/typography.pyi +3014 -297
  48. reflex/components/lucide/icon.py +22 -6
  49. reflex/components/markdown/markdown.py +30 -10
  50. reflex/components/markdown/markdown.pyi +3 -2
  51. reflex/components/plotly/plotly.py +1 -3
  52. reflex/components/plotly/plotly.pyi +1 -3
  53. reflex/components/radix/primitives/form.pyi +624 -93
  54. reflex/components/radix/themes/color_mode.py +1 -1
  55. reflex/components/radix/themes/color_mode.pyi +213 -31
  56. reflex/components/radix/themes/components/alert_dialog.pyi +199 -18
  57. reflex/components/radix/themes/components/badge.pyi +199 -18
  58. reflex/components/radix/themes/components/button.pyi +213 -31
  59. reflex/components/radix/themes/components/callout.pyi +1000 -95
  60. reflex/components/radix/themes/components/card.pyi +199 -18
  61. reflex/components/radix/themes/components/context_menu.py +79 -1
  62. reflex/components/radix/themes/components/context_menu.pyi +320 -1
  63. reflex/components/radix/themes/components/dialog.pyi +199 -18
  64. reflex/components/radix/themes/components/hover_card.pyi +199 -18
  65. reflex/components/radix/themes/components/icon_button.pyi +213 -31
  66. reflex/components/radix/themes/components/inset.pyi +199 -18
  67. reflex/components/radix/themes/components/popover.pyi +199 -18
  68. reflex/components/radix/themes/components/table.pyi +1437 -154
  69. reflex/components/radix/themes/components/text_area.py +2 -2
  70. reflex/components/radix/themes/components/text_area.pyi +201 -20
  71. reflex/components/radix/themes/components/text_field.py +1 -1
  72. reflex/components/radix/themes/components/text_field.pyi +444 -88
  73. reflex/components/radix/themes/layout/box.pyi +200 -19
  74. reflex/components/radix/themes/layout/center.pyi +199 -18
  75. reflex/components/radix/themes/layout/container.pyi +199 -18
  76. reflex/components/radix/themes/layout/flex.pyi +199 -18
  77. reflex/components/radix/themes/layout/grid.pyi +199 -18
  78. reflex/components/radix/themes/layout/list.pyi +604 -57
  79. reflex/components/radix/themes/layout/section.pyi +199 -18
  80. reflex/components/radix/themes/layout/spacer.pyi +199 -18
  81. reflex/components/radix/themes/layout/stack.pyi +597 -54
  82. reflex/components/radix/themes/typography/blockquote.pyi +200 -19
  83. reflex/components/radix/themes/typography/code.pyi +199 -18
  84. reflex/components/radix/themes/typography/heading.pyi +199 -18
  85. reflex/components/radix/themes/typography/link.pyi +238 -28
  86. reflex/components/radix/themes/typography/text.pyi +1394 -127
  87. reflex/components/react_player/react_player.py +1 -1
  88. reflex/components/react_player/react_player.pyi +1 -3
  89. reflex/components/sonner/toast.py +19 -1
  90. reflex/components/sonner/toast.pyi +10 -1
  91. reflex/components/tags/iter_tag.py +4 -0
  92. reflex/components/tags/tag.py +3 -3
  93. reflex/config.py +187 -28
  94. reflex/constants/__init__.py +2 -0
  95. reflex/constants/base.py +6 -0
  96. reflex/constants/compiler.py +9 -0
  97. reflex/constants/event.py +1 -0
  98. reflex/constants/installer.py +4 -5
  99. reflex/constants/utils.py +1 -3
  100. reflex/event.py +7 -16
  101. reflex/experimental/layout.pyi +597 -54
  102. reflex/py.typed +0 -0
  103. reflex/reflex.py +30 -41
  104. reflex/state.py +49 -44
  105. reflex/style.py +6 -4
  106. reflex/testing.py +2 -0
  107. reflex/utils/build.py +12 -0
  108. reflex/utils/console.py +4 -0
  109. reflex/utils/decorator.py +25 -0
  110. reflex/utils/exec.py +92 -34
  111. reflex/utils/format.py +35 -6
  112. reflex/utils/path_ops.py +16 -1
  113. reflex/utils/prerequisites.py +34 -8
  114. reflex/utils/processes.py +12 -13
  115. reflex/utils/serializers.py +20 -43
  116. reflex/utils/telemetry.py +4 -15
  117. reflex/utils/types.py +36 -66
  118. reflex/vars/base.py +53 -76
  119. reflex/vars/function.py +17 -5
  120. reflex/vars/number.py +1 -1
  121. reflex/vars/sequence.py +80 -4
  122. {reflex-0.7.0a5.dist-info → reflex-0.7.1a1.dist-info}/METADATA +4 -5
  123. {reflex-0.7.0a5.dist-info → reflex-0.7.1a1.dist-info}/RECORD +126 -122
  124. {reflex-0.7.0a5.dist-info → reflex-0.7.1a1.dist-info}/LICENSE +0 -0
  125. {reflex-0.7.0a5.dist-info → reflex-0.7.1a1.dist-info}/WHEEL +0 -0
  126. {reflex-0.7.0a5.dist-info → reflex-0.7.1a1.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,284 @@
1
+ """Stub file for reflex/components/core/auto_scroll.py"""
2
+
3
+ # ------------------- DO NOT EDIT ----------------------
4
+ # This file was generated by `reflex/utils/pyi_generator.py`!
5
+ # ------------------------------------------------------
6
+ from typing import Any, Dict, Literal, Optional, Union, overload
7
+
8
+ from reflex.components.el.elements.typography import Div
9
+ from reflex.event import EventType
10
+ from reflex.style import Style
11
+ from reflex.utils.imports import ImportDict
12
+ from reflex.vars.base import Var
13
+
14
+ class AutoScroll(Div):
15
+ @overload
16
+ @classmethod
17
+ def create( # type: ignore
18
+ cls,
19
+ *children,
20
+ access_key: Optional[Union[Var[str], str]] = None,
21
+ auto_capitalize: Optional[
22
+ Union[
23
+ Literal["characters", "none", "off", "on", "sentences", "words"],
24
+ Var[Literal["characters", "none", "off", "on", "sentences", "words"]],
25
+ ]
26
+ ] = None,
27
+ content_editable: Optional[
28
+ Union[
29
+ Literal["inherit", "plaintext-only", False, True],
30
+ Var[Literal["inherit", "plaintext-only", False, True]],
31
+ ]
32
+ ] = None,
33
+ context_menu: Optional[Union[Var[str], str]] = None,
34
+ dir: Optional[Union[Var[str], str]] = None,
35
+ draggable: Optional[Union[Var[bool], bool]] = None,
36
+ enter_key_hint: Optional[
37
+ Union[
38
+ Literal["done", "enter", "go", "next", "previous", "search", "send"],
39
+ Var[
40
+ Literal["done", "enter", "go", "next", "previous", "search", "send"]
41
+ ],
42
+ ]
43
+ ] = None,
44
+ hidden: Optional[Union[Var[bool], bool]] = None,
45
+ input_mode: Optional[
46
+ Union[
47
+ Literal[
48
+ "decimal",
49
+ "email",
50
+ "none",
51
+ "numeric",
52
+ "search",
53
+ "tel",
54
+ "text",
55
+ "url",
56
+ ],
57
+ Var[
58
+ Literal[
59
+ "decimal",
60
+ "email",
61
+ "none",
62
+ "numeric",
63
+ "search",
64
+ "tel",
65
+ "text",
66
+ "url",
67
+ ]
68
+ ],
69
+ ]
70
+ ] = None,
71
+ item_prop: Optional[Union[Var[str], str]] = None,
72
+ lang: Optional[Union[Var[str], str]] = None,
73
+ role: Optional[
74
+ Union[
75
+ Literal[
76
+ "alert",
77
+ "alertdialog",
78
+ "application",
79
+ "article",
80
+ "banner",
81
+ "button",
82
+ "cell",
83
+ "checkbox",
84
+ "columnheader",
85
+ "combobox",
86
+ "complementary",
87
+ "contentinfo",
88
+ "definition",
89
+ "dialog",
90
+ "directory",
91
+ "document",
92
+ "feed",
93
+ "figure",
94
+ "form",
95
+ "grid",
96
+ "gridcell",
97
+ "group",
98
+ "heading",
99
+ "img",
100
+ "link",
101
+ "list",
102
+ "listbox",
103
+ "listitem",
104
+ "log",
105
+ "main",
106
+ "marquee",
107
+ "math",
108
+ "menu",
109
+ "menubar",
110
+ "menuitem",
111
+ "menuitemcheckbox",
112
+ "menuitemradio",
113
+ "navigation",
114
+ "none",
115
+ "note",
116
+ "option",
117
+ "presentation",
118
+ "progressbar",
119
+ "radio",
120
+ "radiogroup",
121
+ "region",
122
+ "row",
123
+ "rowgroup",
124
+ "rowheader",
125
+ "scrollbar",
126
+ "search",
127
+ "searchbox",
128
+ "separator",
129
+ "slider",
130
+ "spinbutton",
131
+ "status",
132
+ "switch",
133
+ "tab",
134
+ "table",
135
+ "tablist",
136
+ "tabpanel",
137
+ "term",
138
+ "textbox",
139
+ "timer",
140
+ "toolbar",
141
+ "tooltip",
142
+ "tree",
143
+ "treegrid",
144
+ "treeitem",
145
+ ],
146
+ Var[
147
+ Literal[
148
+ "alert",
149
+ "alertdialog",
150
+ "application",
151
+ "article",
152
+ "banner",
153
+ "button",
154
+ "cell",
155
+ "checkbox",
156
+ "columnheader",
157
+ "combobox",
158
+ "complementary",
159
+ "contentinfo",
160
+ "definition",
161
+ "dialog",
162
+ "directory",
163
+ "document",
164
+ "feed",
165
+ "figure",
166
+ "form",
167
+ "grid",
168
+ "gridcell",
169
+ "group",
170
+ "heading",
171
+ "img",
172
+ "link",
173
+ "list",
174
+ "listbox",
175
+ "listitem",
176
+ "log",
177
+ "main",
178
+ "marquee",
179
+ "math",
180
+ "menu",
181
+ "menubar",
182
+ "menuitem",
183
+ "menuitemcheckbox",
184
+ "menuitemradio",
185
+ "navigation",
186
+ "none",
187
+ "note",
188
+ "option",
189
+ "presentation",
190
+ "progressbar",
191
+ "radio",
192
+ "radiogroup",
193
+ "region",
194
+ "row",
195
+ "rowgroup",
196
+ "rowheader",
197
+ "scrollbar",
198
+ "search",
199
+ "searchbox",
200
+ "separator",
201
+ "slider",
202
+ "spinbutton",
203
+ "status",
204
+ "switch",
205
+ "tab",
206
+ "table",
207
+ "tablist",
208
+ "tabpanel",
209
+ "term",
210
+ "textbox",
211
+ "timer",
212
+ "toolbar",
213
+ "tooltip",
214
+ "tree",
215
+ "treegrid",
216
+ "treeitem",
217
+ ]
218
+ ],
219
+ ]
220
+ ] = None,
221
+ slot: Optional[Union[Var[str], str]] = None,
222
+ spell_check: Optional[Union[Var[bool], bool]] = None,
223
+ tab_index: Optional[Union[Var[int], int]] = None,
224
+ title: Optional[Union[Var[str], str]] = None,
225
+ style: Optional[Style] = None,
226
+ key: Optional[Any] = None,
227
+ id: Optional[Any] = None,
228
+ class_name: Optional[Any] = None,
229
+ autofocus: Optional[bool] = None,
230
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
231
+ on_blur: Optional[EventType[()]] = None,
232
+ on_click: Optional[EventType[()]] = None,
233
+ on_context_menu: Optional[EventType[()]] = None,
234
+ on_double_click: Optional[EventType[()]] = None,
235
+ on_focus: Optional[EventType[()]] = None,
236
+ on_mount: Optional[EventType[()]] = None,
237
+ on_mouse_down: Optional[EventType[()]] = None,
238
+ on_mouse_enter: Optional[EventType[()]] = None,
239
+ on_mouse_leave: Optional[EventType[()]] = None,
240
+ on_mouse_move: Optional[EventType[()]] = None,
241
+ on_mouse_out: Optional[EventType[()]] = None,
242
+ on_mouse_over: Optional[EventType[()]] = None,
243
+ on_mouse_up: Optional[EventType[()]] = None,
244
+ on_scroll: Optional[EventType[()]] = None,
245
+ on_unmount: Optional[EventType[()]] = None,
246
+ **props,
247
+ ) -> "AutoScroll":
248
+ """Create an AutoScroll component.
249
+
250
+ Args:
251
+ *children: The children of the component.
252
+ access_key: Provides a hint for generating a keyboard shortcut for the current element.
253
+ auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
254
+ content_editable: Indicates whether the element's content is editable.
255
+ context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
256
+ dir: Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)
257
+ draggable: Defines whether the element can be dragged.
258
+ enter_key_hint: Hints what media types the media element is able to play.
259
+ hidden: Defines whether the element is hidden.
260
+ input_mode: Defines the type of the element.
261
+ item_prop: Defines the name of the element for metadata purposes.
262
+ lang: Defines the language used in the element.
263
+ role: Defines the role of the element.
264
+ slot: Assigns a slot in a shadow DOM shadow tree to an element.
265
+ spell_check: Defines whether the element may be checked for spelling errors.
266
+ tab_index: Defines the position of the current element in the tabbing order.
267
+ title: Defines a tooltip for the element.
268
+ style: The style of the component.
269
+ key: A unique key for the component.
270
+ id: The id for the component.
271
+ class_name: The class name for the component.
272
+ autofocus: Whether the component should take the focus once the page is loaded
273
+ custom_attrs: custom attribute
274
+ **props: The props of the component.
275
+
276
+ Returns:
277
+ An AutoScroll component.
278
+ """
279
+ ...
280
+
281
+ def add_imports(self) -> ImportDict | list[ImportDict]: ...
282
+ def add_hooks(self) -> list[str | Var]: ...
283
+
284
+ auto_scroll = AutoScroll.create
@@ -17,6 +17,7 @@ from reflex.components.radix.themes.components.dialog import (
17
17
  from reflex.components.radix.themes.layout.flex import Flex
18
18
  from reflex.components.radix.themes.typography.text import Text
19
19
  from reflex.components.sonner.toast import Toaster, ToastProps
20
+ from reflex.config import environment
20
21
  from reflex.constants import Dirs, Hooks, Imports
21
22
  from reflex.constants.compiler import CompileVars
22
23
  from reflex.utils.imports import ImportVar
@@ -109,9 +110,41 @@ class ConnectionToaster(Toaster):
109
110
  id=toast_id,
110
111
  ) # pyright: ignore [reportCallIssue]
111
112
 
113
+ if environment.REFLEX_DOES_BACKEND_COLD_START.get():
114
+ loading_message = Var.create("Backend is starting.")
115
+ backend_is_loading_toast_var = Var(
116
+ f"toast.loading({loading_message!s}, {{...toast_props, description: '', closeButton: false, onDismiss: () => setUserDismissed(true)}},)"
117
+ )
118
+ backend_is_not_responding = Var.create("Backend is not responding.")
119
+ backend_is_down_toast_var = Var(
120
+ f"toast.error({backend_is_not_responding!s}, {{...toast_props, description: '', onDismiss: () => setUserDismissed(true)}},)"
121
+ )
122
+ toast_var = Var(
123
+ f"""
124
+ if (waitedForBackend) {{
125
+ {backend_is_down_toast_var!s}
126
+ }} else {{
127
+ {backend_is_loading_toast_var!s};
128
+ }}
129
+ setTimeout(() => {{
130
+ if ({has_too_many_connection_errors!s}) {{
131
+ setWaitedForBackend(true);
132
+ }}
133
+ }}, {environment.REFLEX_BACKEND_COLD_START_TIMEOUT.get() * 1000});
134
+ """
135
+ )
136
+ else:
137
+ loading_message = Var.create(
138
+ f"Cannot connect to server: {connection_error}."
139
+ )
140
+ toast_var = Var(
141
+ f"toast.error({loading_message!s}, {{...toast_props, onDismiss: () => setUserDismissed(true)}},)"
142
+ )
143
+
112
144
  individual_hooks = [
113
145
  f"const toast_props = {LiteralVar.create(props)!s};",
114
146
  "const [userDismissed, setUserDismissed] = useState(false);",
147
+ "const [waitedForBackend, setWaitedForBackend] = useState(false);",
115
148
  FunctionStringVar(
116
149
  "useEffect",
117
150
  _var_data=VarData(
@@ -127,10 +160,7 @@ class ConnectionToaster(Toaster):
127
160
  () => {{
128
161
  if ({has_too_many_connection_errors!s}) {{
129
162
  if (!userDismissed) {{
130
- toast.error(
131
- `Cannot connect to server: ${{{connection_error}}}.`,
132
- {{...toast_props, onDismiss: () => setUserDismissed(true)}},
133
- )
163
+ {toast_var!s}
134
164
  }}
135
165
  }} else {{
136
166
  toast.dismiss("{toast_id}");
@@ -139,7 +169,7 @@ class ConnectionToaster(Toaster):
139
169
  }}
140
170
  """
141
171
  ),
142
- LiteralArrayVar.create([connect_errors]),
172
+ LiteralArrayVar.create([connect_errors, Var("waitedForBackend")]),
143
173
  ),
144
174
  ]
145
175