reflex 0.8.0a6__py3-none-any.whl → 0.8.1__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/.templates/web/utils/state.js +18 -1
- reflex/.templates/web/vite-plugin-safari-cachebust.js +160 -0
- reflex/.templates/web/vite.config.js +28 -6
- reflex/app.py +1 -1
- reflex/components/__init__.py +1 -0
- reflex/components/__init__.pyi +2 -0
- reflex/components/component.py +53 -1
- reflex/components/core/banner.py +3 -13
- reflex/components/core/upload.py +5 -5
- reflex/components/core/upload.pyi +2 -2
- reflex/components/el/__init__.py +7 -1
- reflex/components/el/__init__.pyi +2 -1
- reflex/components/radix/primitives/accordion.py +10 -29
- reflex/components/radix/primitives/accordion.pyi +7 -1
- reflex/components/radix/themes/typography/link.py +1 -30
- reflex/components/radix/themes/typography/link.pyi +1 -304
- reflex/components/react_router/__init__.py +5 -0
- reflex/components/react_router/dom.py +69 -0
- reflex/components/react_router/dom.pyi +321 -0
- reflex/components/recharts/recharts.py +2 -2
- reflex/config.py +7 -36
- reflex/constants/compiler.py +1 -1
- reflex/constants/installer.py +2 -2
- reflex/environment.py +116 -0
- reflex/event.py +18 -1
- reflex/istate/data.py +142 -69
- reflex/plugins/tailwind_v4.py +2 -2
- reflex/state.py +3 -3
- reflex/utils/exec.py +35 -8
- reflex/utils/lazy_loader.py +7 -1
- reflex/utils/misc.py +1 -2
- reflex/utils/processes.py +27 -3
- reflex/utils/pyi_generator.py +17 -2
- {reflex-0.8.0a6.dist-info → reflex-0.8.1.dist-info}/METADATA +3 -3
- {reflex-0.8.0a6.dist-info → reflex-0.8.1.dist-info}/RECORD +38 -34
- {reflex-0.8.0a6.dist-info → reflex-0.8.1.dist-info}/WHEEL +0 -0
- {reflex-0.8.0a6.dist-info → reflex-0.8.1.dist-info}/entry_points.txt +0 -0
- {reflex-0.8.0a6.dist-info → reflex-0.8.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -11,315 +11,12 @@ from reflex.components.core.breakpoints import Breakpoints
|
|
|
11
11
|
from reflex.components.el.elements.inline import A
|
|
12
12
|
from reflex.components.markdown.markdown import MarkdownComponentMap
|
|
13
13
|
from reflex.components.radix.themes.base import RadixThemesComponent
|
|
14
|
+
from reflex.components.react_router.dom import ReactRouterLink
|
|
14
15
|
from reflex.event import EventType, PointerEventInfo
|
|
15
16
|
from reflex.utils.imports import ImportDict
|
|
16
17
|
from reflex.vars.base import Var
|
|
17
18
|
|
|
18
19
|
LiteralLinkUnderline = Literal["auto", "hover", "always", "none"]
|
|
19
|
-
LiteralLinkDiscover = Literal["none", "render"]
|
|
20
|
-
|
|
21
|
-
class ReactRouterLink(A):
|
|
22
|
-
@classmethod
|
|
23
|
-
def create(
|
|
24
|
-
cls,
|
|
25
|
-
*children,
|
|
26
|
-
to: Var[str] | str | None = None,
|
|
27
|
-
replace: Var[bool] | bool | None = None,
|
|
28
|
-
reload_document: Var[bool] | bool | None = None,
|
|
29
|
-
prevent_scroll_reset: Var[bool] | bool | None = None,
|
|
30
|
-
discover: Literal["none", "render"]
|
|
31
|
-
| Var[Literal["none", "render"]]
|
|
32
|
-
| None = None,
|
|
33
|
-
view_transition: Var[bool] | bool | None = None,
|
|
34
|
-
download: Var[bool | str] | bool | str | None = None,
|
|
35
|
-
href: Var[str] | str | None = None,
|
|
36
|
-
href_lang: Var[str] | str | None = None,
|
|
37
|
-
media: Var[str] | str | None = None,
|
|
38
|
-
ping: Var[str] | str | None = None,
|
|
39
|
-
referrer_policy: Literal[
|
|
40
|
-
"",
|
|
41
|
-
"no-referrer",
|
|
42
|
-
"no-referrer-when-downgrade",
|
|
43
|
-
"origin",
|
|
44
|
-
"origin-when-cross-origin",
|
|
45
|
-
"same-origin",
|
|
46
|
-
"strict-origin",
|
|
47
|
-
"strict-origin-when-cross-origin",
|
|
48
|
-
"unsafe-url",
|
|
49
|
-
]
|
|
50
|
-
| Var[
|
|
51
|
-
Literal[
|
|
52
|
-
"",
|
|
53
|
-
"no-referrer",
|
|
54
|
-
"no-referrer-when-downgrade",
|
|
55
|
-
"origin",
|
|
56
|
-
"origin-when-cross-origin",
|
|
57
|
-
"same-origin",
|
|
58
|
-
"strict-origin",
|
|
59
|
-
"strict-origin-when-cross-origin",
|
|
60
|
-
"unsafe-url",
|
|
61
|
-
]
|
|
62
|
-
]
|
|
63
|
-
| None = None,
|
|
64
|
-
rel: Var[str] | str | None = None,
|
|
65
|
-
target: Literal["_blank", "_parent", "_self", "_top"]
|
|
66
|
-
| Var[Literal["_blank", "_parent", "_self", "_top"] | str]
|
|
67
|
-
| str
|
|
68
|
-
| None = None,
|
|
69
|
-
access_key: Var[str] | str | None = None,
|
|
70
|
-
auto_capitalize: Literal[
|
|
71
|
-
"characters", "none", "off", "on", "sentences", "words"
|
|
72
|
-
]
|
|
73
|
-
| Var[Literal["characters", "none", "off", "on", "sentences", "words"]]
|
|
74
|
-
| None = None,
|
|
75
|
-
content_editable: Literal["inherit", "plaintext-only", False, True]
|
|
76
|
-
| Var[Literal["inherit", "plaintext-only", False, True]]
|
|
77
|
-
| None = None,
|
|
78
|
-
context_menu: Var[str] | str | None = None,
|
|
79
|
-
dir: Var[str] | str | None = None,
|
|
80
|
-
draggable: Var[bool] | bool | None = None,
|
|
81
|
-
enter_key_hint: Literal[
|
|
82
|
-
"done", "enter", "go", "next", "previous", "search", "send"
|
|
83
|
-
]
|
|
84
|
-
| Var[Literal["done", "enter", "go", "next", "previous", "search", "send"]]
|
|
85
|
-
| None = None,
|
|
86
|
-
hidden: Var[bool] | bool | None = None,
|
|
87
|
-
input_mode: Literal[
|
|
88
|
-
"decimal", "email", "none", "numeric", "search", "tel", "text", "url"
|
|
89
|
-
]
|
|
90
|
-
| Var[
|
|
91
|
-
Literal[
|
|
92
|
-
"decimal", "email", "none", "numeric", "search", "tel", "text", "url"
|
|
93
|
-
]
|
|
94
|
-
]
|
|
95
|
-
| None = None,
|
|
96
|
-
item_prop: Var[str] | str | None = None,
|
|
97
|
-
lang: Var[str] | str | None = None,
|
|
98
|
-
role: Literal[
|
|
99
|
-
"alert",
|
|
100
|
-
"alertdialog",
|
|
101
|
-
"application",
|
|
102
|
-
"article",
|
|
103
|
-
"banner",
|
|
104
|
-
"button",
|
|
105
|
-
"cell",
|
|
106
|
-
"checkbox",
|
|
107
|
-
"columnheader",
|
|
108
|
-
"combobox",
|
|
109
|
-
"complementary",
|
|
110
|
-
"contentinfo",
|
|
111
|
-
"definition",
|
|
112
|
-
"dialog",
|
|
113
|
-
"directory",
|
|
114
|
-
"document",
|
|
115
|
-
"feed",
|
|
116
|
-
"figure",
|
|
117
|
-
"form",
|
|
118
|
-
"grid",
|
|
119
|
-
"gridcell",
|
|
120
|
-
"group",
|
|
121
|
-
"heading",
|
|
122
|
-
"img",
|
|
123
|
-
"link",
|
|
124
|
-
"list",
|
|
125
|
-
"listbox",
|
|
126
|
-
"listitem",
|
|
127
|
-
"log",
|
|
128
|
-
"main",
|
|
129
|
-
"marquee",
|
|
130
|
-
"math",
|
|
131
|
-
"menu",
|
|
132
|
-
"menubar",
|
|
133
|
-
"menuitem",
|
|
134
|
-
"menuitemcheckbox",
|
|
135
|
-
"menuitemradio",
|
|
136
|
-
"navigation",
|
|
137
|
-
"none",
|
|
138
|
-
"note",
|
|
139
|
-
"option",
|
|
140
|
-
"presentation",
|
|
141
|
-
"progressbar",
|
|
142
|
-
"radio",
|
|
143
|
-
"radiogroup",
|
|
144
|
-
"region",
|
|
145
|
-
"row",
|
|
146
|
-
"rowgroup",
|
|
147
|
-
"rowheader",
|
|
148
|
-
"scrollbar",
|
|
149
|
-
"search",
|
|
150
|
-
"searchbox",
|
|
151
|
-
"separator",
|
|
152
|
-
"slider",
|
|
153
|
-
"spinbutton",
|
|
154
|
-
"status",
|
|
155
|
-
"switch",
|
|
156
|
-
"tab",
|
|
157
|
-
"table",
|
|
158
|
-
"tablist",
|
|
159
|
-
"tabpanel",
|
|
160
|
-
"term",
|
|
161
|
-
"textbox",
|
|
162
|
-
"timer",
|
|
163
|
-
"toolbar",
|
|
164
|
-
"tooltip",
|
|
165
|
-
"tree",
|
|
166
|
-
"treegrid",
|
|
167
|
-
"treeitem",
|
|
168
|
-
]
|
|
169
|
-
| Var[
|
|
170
|
-
Literal[
|
|
171
|
-
"alert",
|
|
172
|
-
"alertdialog",
|
|
173
|
-
"application",
|
|
174
|
-
"article",
|
|
175
|
-
"banner",
|
|
176
|
-
"button",
|
|
177
|
-
"cell",
|
|
178
|
-
"checkbox",
|
|
179
|
-
"columnheader",
|
|
180
|
-
"combobox",
|
|
181
|
-
"complementary",
|
|
182
|
-
"contentinfo",
|
|
183
|
-
"definition",
|
|
184
|
-
"dialog",
|
|
185
|
-
"directory",
|
|
186
|
-
"document",
|
|
187
|
-
"feed",
|
|
188
|
-
"figure",
|
|
189
|
-
"form",
|
|
190
|
-
"grid",
|
|
191
|
-
"gridcell",
|
|
192
|
-
"group",
|
|
193
|
-
"heading",
|
|
194
|
-
"img",
|
|
195
|
-
"link",
|
|
196
|
-
"list",
|
|
197
|
-
"listbox",
|
|
198
|
-
"listitem",
|
|
199
|
-
"log",
|
|
200
|
-
"main",
|
|
201
|
-
"marquee",
|
|
202
|
-
"math",
|
|
203
|
-
"menu",
|
|
204
|
-
"menubar",
|
|
205
|
-
"menuitem",
|
|
206
|
-
"menuitemcheckbox",
|
|
207
|
-
"menuitemradio",
|
|
208
|
-
"navigation",
|
|
209
|
-
"none",
|
|
210
|
-
"note",
|
|
211
|
-
"option",
|
|
212
|
-
"presentation",
|
|
213
|
-
"progressbar",
|
|
214
|
-
"radio",
|
|
215
|
-
"radiogroup",
|
|
216
|
-
"region",
|
|
217
|
-
"row",
|
|
218
|
-
"rowgroup",
|
|
219
|
-
"rowheader",
|
|
220
|
-
"scrollbar",
|
|
221
|
-
"search",
|
|
222
|
-
"searchbox",
|
|
223
|
-
"separator",
|
|
224
|
-
"slider",
|
|
225
|
-
"spinbutton",
|
|
226
|
-
"status",
|
|
227
|
-
"switch",
|
|
228
|
-
"tab",
|
|
229
|
-
"table",
|
|
230
|
-
"tablist",
|
|
231
|
-
"tabpanel",
|
|
232
|
-
"term",
|
|
233
|
-
"textbox",
|
|
234
|
-
"timer",
|
|
235
|
-
"toolbar",
|
|
236
|
-
"tooltip",
|
|
237
|
-
"tree",
|
|
238
|
-
"treegrid",
|
|
239
|
-
"treeitem",
|
|
240
|
-
]
|
|
241
|
-
]
|
|
242
|
-
| None = None,
|
|
243
|
-
slot: Var[str] | str | None = None,
|
|
244
|
-
spell_check: Var[bool] | bool | None = None,
|
|
245
|
-
tab_index: Var[int] | int | None = None,
|
|
246
|
-
title: Var[str] | str | None = None,
|
|
247
|
-
style: Sequence[Mapping[str, Any]]
|
|
248
|
-
| Mapping[str, Any]
|
|
249
|
-
| Var[Mapping[str, Any]]
|
|
250
|
-
| Breakpoints
|
|
251
|
-
| None = None,
|
|
252
|
-
key: Any | None = None,
|
|
253
|
-
id: Any | None = None,
|
|
254
|
-
ref: Var | None = None,
|
|
255
|
-
class_name: Any | None = None,
|
|
256
|
-
autofocus: bool | None = None,
|
|
257
|
-
custom_attrs: dict[str, Var | Any] | None = None,
|
|
258
|
-
on_blur: EventType[()] | None = None,
|
|
259
|
-
on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
260
|
-
on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
261
|
-
on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
262
|
-
on_focus: EventType[()] | None = None,
|
|
263
|
-
on_mount: EventType[()] | None = None,
|
|
264
|
-
on_mouse_down: EventType[()] | None = None,
|
|
265
|
-
on_mouse_enter: EventType[()] | None = None,
|
|
266
|
-
on_mouse_leave: EventType[()] | None = None,
|
|
267
|
-
on_mouse_move: EventType[()] | None = None,
|
|
268
|
-
on_mouse_out: EventType[()] | None = None,
|
|
269
|
-
on_mouse_over: EventType[()] | None = None,
|
|
270
|
-
on_mouse_up: EventType[()] | None = None,
|
|
271
|
-
on_scroll: EventType[()] | None = None,
|
|
272
|
-
on_scroll_end: EventType[()] | None = None,
|
|
273
|
-
on_unmount: EventType[()] | None = None,
|
|
274
|
-
**props,
|
|
275
|
-
) -> ReactRouterLink:
|
|
276
|
-
"""Create the component.
|
|
277
|
-
|
|
278
|
-
Args:
|
|
279
|
-
*children: The children of the component.
|
|
280
|
-
to: The page to link to.
|
|
281
|
-
replace: Replaces the current entry in the history stack instead of pushing a new one onto it.
|
|
282
|
-
reload_document: Will use document navigation instead of client side routing when the link is clicked: the browser will handle the transition normally (as if it were an <a href>).
|
|
283
|
-
prevent_scroll_reset: Prevents the scroll position from being reset to the top of the window when the link is clicked and the app is using ScrollRestoration. This only prevents new locations resetting scroll to the top, scroll position will be restored for back/forward button navigation.
|
|
284
|
-
discover: Defines the link discovery behavior
|
|
285
|
-
view_transition: Enables a View Transition for this navigation.
|
|
286
|
-
download: Specifies that the target (the file specified in the href attribute) will be downloaded when a user clicks on the hyperlink.
|
|
287
|
-
href: Specifies the URL of the page the link goes to
|
|
288
|
-
href_lang: Specifies the language of the linked document
|
|
289
|
-
media: Specifies what media/device the linked document is optimized for
|
|
290
|
-
ping: Specifies which referrer is sent when fetching the resource
|
|
291
|
-
referrer_policy: Specifies the relationship between the current document and the linked document
|
|
292
|
-
rel: Specifies the relationship between the linked document and the current document
|
|
293
|
-
target: Specifies where to open the linked document
|
|
294
|
-
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|
|
295
|
-
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
|
296
|
-
content_editable: Indicates whether the element's content is editable.
|
|
297
|
-
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
|
298
|
-
dir: Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)
|
|
299
|
-
draggable: Defines whether the element can be dragged.
|
|
300
|
-
enter_key_hint: Hints what media types the media element is able to play.
|
|
301
|
-
hidden: Defines whether the element is hidden.
|
|
302
|
-
input_mode: Defines the type of the element.
|
|
303
|
-
item_prop: Defines the name of the element for metadata purposes.
|
|
304
|
-
lang: Defines the language used in the element.
|
|
305
|
-
role: Defines the role of the element.
|
|
306
|
-
slot: Assigns a slot in a shadow DOM shadow tree to an element.
|
|
307
|
-
spell_check: Defines whether the element may be checked for spelling errors.
|
|
308
|
-
tab_index: Defines the position of the current element in the tabbing order.
|
|
309
|
-
title: Defines a tooltip for the element.
|
|
310
|
-
style: The style of the component.
|
|
311
|
-
key: A unique key for the component.
|
|
312
|
-
id: The id for the component.
|
|
313
|
-
ref: The Var to pass as the ref to the component.
|
|
314
|
-
class_name: The class name for the component.
|
|
315
|
-
autofocus: Whether the component should take the focus once the page is loaded
|
|
316
|
-
custom_attrs: custom attribute
|
|
317
|
-
**props: The props of the component.
|
|
318
|
-
|
|
319
|
-
Returns:
|
|
320
|
-
The component.
|
|
321
|
-
"""
|
|
322
|
-
|
|
323
20
|
_KNOWN_REACT_ROUTER_LINK_PROPS = frozenset(ReactRouterLink.get_props())
|
|
324
21
|
|
|
325
22
|
class Link(RadixThemesComponent, A, MemoizationLeaf, MarkdownComponentMap):
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""Components for client side navigation within React Router applications."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import ClassVar, Literal, TypedDict
|
|
6
|
+
|
|
7
|
+
from reflex.components.el.elements.inline import A
|
|
8
|
+
from reflex.vars.base import Var
|
|
9
|
+
|
|
10
|
+
LiteralLinkDiscover = Literal["none", "render"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class To(TypedDict):
|
|
14
|
+
"""Structured object for navigating via the `to` prop."""
|
|
15
|
+
|
|
16
|
+
# A URL pathname, beginning with a /
|
|
17
|
+
pathname: str
|
|
18
|
+
|
|
19
|
+
# A URL search string, beginning with a ?.
|
|
20
|
+
search: str
|
|
21
|
+
|
|
22
|
+
# A URL fragment identifier, beginning with a #.
|
|
23
|
+
hash: str
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ReactRouterLink(A):
|
|
27
|
+
"""Links are accessible elements used primarily for navigation. This component is styled to resemble a hyperlink and semantically renders an <a>."""
|
|
28
|
+
|
|
29
|
+
library = "react-router"
|
|
30
|
+
|
|
31
|
+
tag = "Link"
|
|
32
|
+
|
|
33
|
+
alias = "ReactRouterLink"
|
|
34
|
+
|
|
35
|
+
# The page to link to.
|
|
36
|
+
to: Var[str | To]
|
|
37
|
+
|
|
38
|
+
# Replaces the current entry in the history stack instead of pushing a new one onto it.
|
|
39
|
+
replace: Var[bool]
|
|
40
|
+
|
|
41
|
+
# Will use document navigation instead of client side routing when the link is clicked: the browser will handle the transition normally (as if it were an <a href>).
|
|
42
|
+
reload_document: Var[bool]
|
|
43
|
+
|
|
44
|
+
# Prevents the scroll position from being reset to the top of the window when the link is clicked and the app is using ScrollRestoration. This only prevents new locations resetting scroll to the top, scroll position will be restored for back/forward button navigation.
|
|
45
|
+
prevent_scroll_reset: Var[bool]
|
|
46
|
+
|
|
47
|
+
# Defines the link discovery behavior
|
|
48
|
+
discover: Var[LiteralLinkDiscover]
|
|
49
|
+
|
|
50
|
+
# Enables a View Transition for this navigation.
|
|
51
|
+
view_transition: Var[bool]
|
|
52
|
+
|
|
53
|
+
@classmethod
|
|
54
|
+
def create(cls, *children, **props):
|
|
55
|
+
"""Create a ReactRouterLink component for client-side navigation.
|
|
56
|
+
|
|
57
|
+
Args:
|
|
58
|
+
*children: The children of the component.
|
|
59
|
+
**props: The props of the component.
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
The ReactRouterLink component.
|
|
63
|
+
"""
|
|
64
|
+
# React Router special behavior is triggered on the `to` prop, not href.
|
|
65
|
+
if "to" not in props and "href" in props:
|
|
66
|
+
props["to"] = props.pop("href")
|
|
67
|
+
return super().create(*children, **props)
|
|
68
|
+
|
|
69
|
+
_invalid_children: ClassVar[list[str]] = ["A", "ReactRouterLink"]
|