reflex 0.7.8a1__py3-none-any.whl → 0.7.9__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 (44) hide show
  1. reflex/.templates/jinja/web/tailwind.config.js.jinja2 +65 -31
  2. reflex/.templates/web/utils/state.js +11 -1
  3. reflex/app.py +191 -87
  4. reflex/app_mixins/lifespan.py +2 -2
  5. reflex/compiler/compiler.py +31 -4
  6. reflex/components/base/body.pyi +3 -197
  7. reflex/components/base/link.pyi +4 -392
  8. reflex/components/base/meta.pyi +28 -608
  9. reflex/components/component.py +39 -57
  10. reflex/components/core/upload.py +8 -0
  11. reflex/components/dynamic.py +9 -1
  12. reflex/components/el/elements/metadata.pyi +0 -1
  13. reflex/components/markdown/markdown.py +0 -21
  14. reflex/components/markdown/markdown.pyi +2 -2
  15. reflex/components/radix/primitives/accordion.py +1 -1
  16. reflex/components/radix/primitives/form.py +1 -1
  17. reflex/components/radix/primitives/progress.py +1 -1
  18. reflex/components/radix/primitives/slider.py +1 -1
  19. reflex/components/radix/themes/color_mode.py +1 -1
  20. reflex/components/radix/themes/color_mode.pyi +1 -1
  21. reflex/components/radix/themes/layout/list.pyi +2 -391
  22. reflex/components/recharts/recharts.py +2 -2
  23. reflex/components/sonner/toast.py +1 -1
  24. reflex/config.py +4 -7
  25. reflex/constants/base.py +21 -0
  26. reflex/constants/installer.py +6 -6
  27. reflex/custom_components/custom_components.py +67 -64
  28. reflex/event.py +2 -0
  29. reflex/page.py +8 -0
  30. reflex/reflex.py +277 -265
  31. reflex/testing.py +30 -24
  32. reflex/utils/codespaces.py +6 -2
  33. reflex/utils/console.py +4 -3
  34. reflex/utils/exec.py +60 -24
  35. reflex/utils/format.py +17 -2
  36. reflex/utils/prerequisites.py +43 -30
  37. reflex/utils/processes.py +6 -6
  38. reflex/utils/types.py +11 -6
  39. reflex/vars/base.py +19 -1
  40. {reflex-0.7.8a1.dist-info → reflex-0.7.9.dist-info}/METADATA +6 -9
  41. {reflex-0.7.8a1.dist-info → reflex-0.7.9.dist-info}/RECORD +44 -44
  42. {reflex-0.7.8a1.dist-info → reflex-0.7.9.dist-info}/WHEEL +0 -0
  43. {reflex-0.7.8a1.dist-info → reflex-0.7.9.dist-info}/entry_points.txt +0 -0
  44. {reflex-0.7.8a1.dist-info → reflex-0.7.9.dist-info}/licenses/LICENSE +0 -0
@@ -4,6 +4,7 @@ from __future__ import annotations
4
4
 
5
5
  from collections.abc import Iterable, Sequence
6
6
  from datetime import datetime
7
+ from inspect import getmodule
7
8
  from pathlib import Path
8
9
  from typing import TYPE_CHECKING
9
10
 
@@ -55,7 +56,7 @@ def _normalize_library_name(lib: str) -> str:
55
56
  """
56
57
  if lib == "react":
57
58
  return "React"
58
- return lib.replace("@", "").replace("/", "_").replace("-", "_")
59
+ return lib.replace("$/", "").replace("@", "").replace("/", "_").replace("-", "_")
59
60
 
60
61
 
61
62
  def _compile_app(app_root: Component) -> str:
@@ -71,9 +72,6 @@ def _compile_app(app_root: Component) -> str:
71
72
 
72
73
  window_libraries = [
73
74
  (_normalize_library_name(name), name) for name in bundled_libraries
74
- ] + [
75
- ("utils_context", f"$/{constants.Dirs.UTILS}/context"),
76
- ("utils_state", f"$/{constants.Dirs.UTILS}/state"),
77
75
  ]
78
76
 
79
77
  return templates.APP_ROOT.render(
@@ -676,6 +674,35 @@ def _into_component_once(
676
674
  return None
677
675
 
678
676
 
677
+ def readable_name_from_component(
678
+ component: Component | ComponentCallable,
679
+ ) -> str | None:
680
+ """Get the readable name of a component.
681
+
682
+ Args:
683
+ component: The component to get the name of.
684
+
685
+ Returns:
686
+ The readable name of the component.
687
+ """
688
+ if isinstance(component, Component):
689
+ return type(component).__name__
690
+ if isinstance(component, (Var, int, float, str)):
691
+ return str(component)
692
+ if isinstance(component, Sequence):
693
+ return ", ".join(str(c) for c in component)
694
+ if callable(component):
695
+ module_name = getattr(component, "__module__", None)
696
+ if module_name is not None:
697
+ module = getmodule(component)
698
+ if module is not None:
699
+ module_name = module.__name__
700
+ if module_name is not None:
701
+ return f"{module_name}.{component.__name__}"
702
+ return component.__name__
703
+ return None
704
+
705
+
679
706
  def into_component(component: Component | ComponentCallable) -> Component:
680
707
  """Convert a component to a Component.
681
708
 
@@ -4,197 +4,19 @@
4
4
  # This file was generated by `reflex/utils/pyi_generator.py`!
5
5
  # ------------------------------------------------------
6
6
  from collections.abc import Mapping, Sequence
7
- from typing import Any, Literal, overload
7
+ from typing import Any, overload
8
8
 
9
+ from reflex.components.component import Component
9
10
  from reflex.components.core.breakpoints import Breakpoints
10
- from reflex.components.el import elements
11
11
  from reflex.event import EventType
12
12
  from reflex.vars.base import Var
13
13
 
14
- class Body(elements.Body):
14
+ class Body(Component):
15
15
  @overload
16
16
  @classmethod
17
17
  def create( # type: ignore
18
18
  cls,
19
19
  *children,
20
- access_key: Var[str] | str | None = None,
21
- auto_capitalize: Literal[
22
- "characters", "none", "off", "on", "sentences", "words"
23
- ]
24
- | Var[Literal["characters", "none", "off", "on", "sentences", "words"]]
25
- | None = None,
26
- content_editable: Literal["inherit", "plaintext-only", False, True]
27
- | Var[Literal["inherit", "plaintext-only", False, True]]
28
- | None = None,
29
- context_menu: Var[str] | str | None = None,
30
- dir: Var[str] | str | None = None,
31
- draggable: Var[bool] | bool | None = None,
32
- enter_key_hint: Literal[
33
- "done", "enter", "go", "next", "previous", "search", "send"
34
- ]
35
- | Var[Literal["done", "enter", "go", "next", "previous", "search", "send"]]
36
- | None = None,
37
- hidden: Var[bool] | bool | None = None,
38
- input_mode: Literal[
39
- "decimal", "email", "none", "numeric", "search", "tel", "text", "url"
40
- ]
41
- | Var[
42
- Literal[
43
- "decimal", "email", "none", "numeric", "search", "tel", "text", "url"
44
- ]
45
- ]
46
- | None = None,
47
- item_prop: Var[str] | str | None = None,
48
- lang: Var[str] | str | None = None,
49
- role: Literal[
50
- "alert",
51
- "alertdialog",
52
- "application",
53
- "article",
54
- "banner",
55
- "button",
56
- "cell",
57
- "checkbox",
58
- "columnheader",
59
- "combobox",
60
- "complementary",
61
- "contentinfo",
62
- "definition",
63
- "dialog",
64
- "directory",
65
- "document",
66
- "feed",
67
- "figure",
68
- "form",
69
- "grid",
70
- "gridcell",
71
- "group",
72
- "heading",
73
- "img",
74
- "link",
75
- "list",
76
- "listbox",
77
- "listitem",
78
- "log",
79
- "main",
80
- "marquee",
81
- "math",
82
- "menu",
83
- "menubar",
84
- "menuitem",
85
- "menuitemcheckbox",
86
- "menuitemradio",
87
- "navigation",
88
- "none",
89
- "note",
90
- "option",
91
- "presentation",
92
- "progressbar",
93
- "radio",
94
- "radiogroup",
95
- "region",
96
- "row",
97
- "rowgroup",
98
- "rowheader",
99
- "scrollbar",
100
- "search",
101
- "searchbox",
102
- "separator",
103
- "slider",
104
- "spinbutton",
105
- "status",
106
- "switch",
107
- "tab",
108
- "table",
109
- "tablist",
110
- "tabpanel",
111
- "term",
112
- "textbox",
113
- "timer",
114
- "toolbar",
115
- "tooltip",
116
- "tree",
117
- "treegrid",
118
- "treeitem",
119
- ]
120
- | Var[
121
- Literal[
122
- "alert",
123
- "alertdialog",
124
- "application",
125
- "article",
126
- "banner",
127
- "button",
128
- "cell",
129
- "checkbox",
130
- "columnheader",
131
- "combobox",
132
- "complementary",
133
- "contentinfo",
134
- "definition",
135
- "dialog",
136
- "directory",
137
- "document",
138
- "feed",
139
- "figure",
140
- "form",
141
- "grid",
142
- "gridcell",
143
- "group",
144
- "heading",
145
- "img",
146
- "link",
147
- "list",
148
- "listbox",
149
- "listitem",
150
- "log",
151
- "main",
152
- "marquee",
153
- "math",
154
- "menu",
155
- "menubar",
156
- "menuitem",
157
- "menuitemcheckbox",
158
- "menuitemradio",
159
- "navigation",
160
- "none",
161
- "note",
162
- "option",
163
- "presentation",
164
- "progressbar",
165
- "radio",
166
- "radiogroup",
167
- "region",
168
- "row",
169
- "rowgroup",
170
- "rowheader",
171
- "scrollbar",
172
- "search",
173
- "searchbox",
174
- "separator",
175
- "slider",
176
- "spinbutton",
177
- "status",
178
- "switch",
179
- "tab",
180
- "table",
181
- "tablist",
182
- "tabpanel",
183
- "term",
184
- "textbox",
185
- "timer",
186
- "toolbar",
187
- "tooltip",
188
- "tree",
189
- "treegrid",
190
- "treeitem",
191
- ]
192
- ]
193
- | None = None,
194
- slot: Var[str] | str | None = None,
195
- spell_check: Var[bool] | bool | None = None,
196
- tab_index: Var[int] | int | None = None,
197
- title: Var[str] | str | None = None,
198
20
  style: Sequence[Mapping[str, Any]]
199
21
  | Mapping[str, Any]
200
22
  | Var[Mapping[str, Any]]
@@ -226,22 +48,6 @@ class Body(elements.Body):
226
48
 
227
49
  Args:
228
50
  *children: The children of the component.
229
- access_key: Provides a hint for generating a keyboard shortcut for the current element.
230
- auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
231
- content_editable: Indicates whether the element's content is editable.
232
- context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
233
- dir: Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)
234
- draggable: Defines whether the element can be dragged.
235
- enter_key_hint: Hints what media types the media element is able to play.
236
- hidden: Defines whether the element is hidden.
237
- input_mode: Defines the type of the element.
238
- item_prop: Defines the name of the element for metadata purposes.
239
- lang: Defines the language used in the element.
240
- role: Defines the role of the element.
241
- slot: Assigns a slot in a shadow DOM shadow tree to an element.
242
- spell_check: Defines whether the element may be checked for spelling errors.
243
- tab_index: Defines the position of the current element in the tabbing order.
244
- title: Defines a tooltip for the element.
245
51
  style: The style of the component.
246
52
  key: A unique key for the component.
247
53
  id: The id for the component.