reflex 0.3.2a1__py3-none-any.whl → 0.3.3a1__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/jinja/web/pages/custom_component.js.jinja2 +20 -3
- reflex/.templates/web/next.config.js +1 -0
- reflex/.templates/web/utils/helpers/range.js +43 -0
- reflex/.templates/web/utils/state.js +10 -6
- reflex/__init__.py +312 -40
- reflex/__init__.pyi +477 -0
- reflex/compiler/compiler.py +3 -0
- reflex/components/__init__.py +138 -138
- reflex/components/component.py +29 -22
- reflex/components/datadisplay/__init__.py +3 -1
- reflex/components/datadisplay/code.py +388 -14
- reflex/components/datadisplay/code.pyi +1146 -10
- reflex/components/forms/button.py +3 -0
- reflex/components/forms/checkbox.py +3 -0
- reflex/components/forms/form.py +90 -27
- reflex/components/forms/input.py +3 -0
- reflex/components/forms/numberinput.py +3 -0
- reflex/components/forms/pininput.py +77 -21
- reflex/components/forms/radio.py +3 -0
- reflex/components/forms/rangeslider.py +3 -0
- reflex/components/forms/select.py +3 -0
- reflex/components/forms/slider.py +3 -0
- reflex/components/forms/switch.py +3 -0
- reflex/components/forms/textarea.py +3 -0
- reflex/components/layout/foreach.py +12 -6
- reflex/components/libs/chakra.py +2 -0
- reflex/components/libs/chakra.pyi +323 -24
- reflex/components/tags/iter_tag.py +18 -18
- reflex/components/tags/tag.py +3 -2
- reflex/components/typography/markdown.py +10 -0
- reflex/config.py +12 -0
- reflex/constants/installer.py +4 -4
- reflex/event.py +4 -0
- reflex/page.py +3 -4
- reflex/page.pyi +17 -0
- reflex/reflex.py +3 -0
- reflex/state.py +31 -12
- reflex/testing.py +1 -1
- reflex/utils/build.py +24 -19
- reflex/utils/console.py +5 -1
- reflex/utils/format.py +26 -9
- reflex/utils/prerequisites.py +27 -28
- reflex/utils/processes.py +5 -4
- reflex/vars.py +80 -12
- reflex/vars.pyi +7 -0
- {reflex-0.3.2a1.dist-info → reflex-0.3.3a1.dist-info}/METADATA +3 -2
- {reflex-0.3.2a1.dist-info → reflex-0.3.3a1.dist-info}/RECORD +50 -53
- reflex/.templates/web/.pytest_cache/.gitignore +0 -2
- reflex/.templates/web/.pytest_cache/CACHEDIR.TAG +0 -4
- reflex/.templates/web/.pytest_cache/README.md +0 -8
- reflex/.templates/web/.pytest_cache/v/cache/nodeids +0 -1
- reflex/.templates/web/.pytest_cache/v/cache/stepwise +0 -1
- reflex/.templates/web/styles/code/prism.js +0 -1015
- {reflex-0.3.2a1.dist-info → reflex-0.3.3a1.dist-info}/LICENSE +0 -0
- {reflex-0.3.2a1.dist-info → reflex-0.3.3a1.dist-info}/WHEEL +0 -0
- {reflex-0.3.2a1.dist-info → reflex-0.3.3a1.dist-info}/entry_points.txt +0 -0
|
@@ -1,14 +1,330 @@
|
|
|
1
|
-
"""Stub file for chakra.py"""
|
|
1
|
+
"""Stub file for reflex/components/libs/chakra.py"""
|
|
2
2
|
# ------------------- DO NOT EDIT ----------------------
|
|
3
3
|
# This file was generated by `scripts/pyi_generator.py`!
|
|
4
4
|
# ------------------------------------------------------
|
|
5
5
|
|
|
6
|
-
from typing import Literal,
|
|
7
|
-
from reflex.components.component import Component
|
|
6
|
+
from typing import Optional, Literal, Any, overload, List, Union, Dict
|
|
8
7
|
from reflex.vars import Var, BaseVar, ComputedVar
|
|
9
|
-
from reflex.event import
|
|
8
|
+
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
|
+
from reflex.style import Style
|
|
10
|
+
from typing import List, Literal
|
|
11
|
+
from reflex.components.component import Component
|
|
12
|
+
from reflex.utils import imports
|
|
13
|
+
from reflex.vars import ImportVar, Var
|
|
14
|
+
|
|
15
|
+
class ChakraComponent(Component):
|
|
16
|
+
...
|
|
17
|
+
|
|
18
|
+
@overload
|
|
19
|
+
@classmethod
|
|
20
|
+
def create( # type: ignore
|
|
21
|
+
cls,
|
|
22
|
+
*children,
|
|
23
|
+
style: Optional[Style] = None,
|
|
24
|
+
key: Optional[Any] = None,
|
|
25
|
+
id: Optional[Any] = None,
|
|
26
|
+
class_name: Optional[Any] = None,
|
|
27
|
+
autofocus: Optional[bool] = None,
|
|
28
|
+
custom_attrs: Optional[Dict[str, str]] = None,
|
|
29
|
+
on_blur: Optional[
|
|
30
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
31
|
+
] = None,
|
|
32
|
+
on_click: Optional[
|
|
33
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
34
|
+
] = None,
|
|
35
|
+
on_context_menu: Optional[
|
|
36
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
37
|
+
] = None,
|
|
38
|
+
on_double_click: Optional[
|
|
39
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
40
|
+
] = None,
|
|
41
|
+
on_focus: Optional[
|
|
42
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
43
|
+
] = None,
|
|
44
|
+
on_mount: Optional[
|
|
45
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
46
|
+
] = None,
|
|
47
|
+
on_mouse_down: Optional[
|
|
48
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
49
|
+
] = None,
|
|
50
|
+
on_mouse_enter: Optional[
|
|
51
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
52
|
+
] = None,
|
|
53
|
+
on_mouse_leave: Optional[
|
|
54
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
55
|
+
] = None,
|
|
56
|
+
on_mouse_move: Optional[
|
|
57
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
58
|
+
] = None,
|
|
59
|
+
on_mouse_out: Optional[
|
|
60
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
61
|
+
] = None,
|
|
62
|
+
on_mouse_over: Optional[
|
|
63
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
64
|
+
] = None,
|
|
65
|
+
on_mouse_up: Optional[
|
|
66
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
67
|
+
] = None,
|
|
68
|
+
on_scroll: Optional[
|
|
69
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
70
|
+
] = None,
|
|
71
|
+
on_unmount: Optional[
|
|
72
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
73
|
+
] = None,
|
|
74
|
+
**props
|
|
75
|
+
) -> "ChakraComponent":
|
|
76
|
+
"""Create the component.
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
*children: The children of the component.
|
|
80
|
+
style: The style of the component.
|
|
81
|
+
key: A unique key for the component.
|
|
82
|
+
id: The id for the component.
|
|
83
|
+
class_name: The class name for the component.
|
|
84
|
+
autofocus: Whether the component should take the focus once the page is loaded
|
|
85
|
+
custom_attrs: custom attribute
|
|
86
|
+
**props: The props of the component.
|
|
87
|
+
|
|
88
|
+
Returns:
|
|
89
|
+
The component.
|
|
90
|
+
|
|
91
|
+
Raises:
|
|
92
|
+
TypeError: If an invalid child is passed.
|
|
93
|
+
"""
|
|
94
|
+
...
|
|
95
|
+
|
|
96
|
+
class Global(Component):
|
|
97
|
+
...
|
|
98
|
+
|
|
99
|
+
@overload
|
|
100
|
+
@classmethod
|
|
101
|
+
def create( # type: ignore
|
|
102
|
+
cls,
|
|
103
|
+
*children,
|
|
104
|
+
styles: Optional[Union[Var[str], str]] = None,
|
|
105
|
+
style: Optional[Style] = None,
|
|
106
|
+
key: Optional[Any] = None,
|
|
107
|
+
id: Optional[Any] = None,
|
|
108
|
+
class_name: Optional[Any] = None,
|
|
109
|
+
autofocus: Optional[bool] = None,
|
|
110
|
+
custom_attrs: Optional[Dict[str, str]] = None,
|
|
111
|
+
on_blur: Optional[
|
|
112
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
113
|
+
] = None,
|
|
114
|
+
on_click: Optional[
|
|
115
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
116
|
+
] = None,
|
|
117
|
+
on_context_menu: Optional[
|
|
118
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
119
|
+
] = None,
|
|
120
|
+
on_double_click: Optional[
|
|
121
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
122
|
+
] = None,
|
|
123
|
+
on_focus: Optional[
|
|
124
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
125
|
+
] = None,
|
|
126
|
+
on_mount: Optional[
|
|
127
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
128
|
+
] = None,
|
|
129
|
+
on_mouse_down: Optional[
|
|
130
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
131
|
+
] = None,
|
|
132
|
+
on_mouse_enter: Optional[
|
|
133
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
134
|
+
] = None,
|
|
135
|
+
on_mouse_leave: Optional[
|
|
136
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
137
|
+
] = None,
|
|
138
|
+
on_mouse_move: Optional[
|
|
139
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
140
|
+
] = None,
|
|
141
|
+
on_mouse_out: Optional[
|
|
142
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
143
|
+
] = None,
|
|
144
|
+
on_mouse_over: Optional[
|
|
145
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
146
|
+
] = None,
|
|
147
|
+
on_mouse_up: Optional[
|
|
148
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
149
|
+
] = None,
|
|
150
|
+
on_scroll: Optional[
|
|
151
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
152
|
+
] = None,
|
|
153
|
+
on_unmount: Optional[
|
|
154
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
155
|
+
] = None,
|
|
156
|
+
**props
|
|
157
|
+
) -> "Global":
|
|
158
|
+
"""Create the component.
|
|
159
|
+
|
|
160
|
+
Args:
|
|
161
|
+
*children: The children of the component.
|
|
162
|
+
style: The style of the component.
|
|
163
|
+
key: A unique key for the component.
|
|
164
|
+
id: The id for the component.
|
|
165
|
+
class_name: The class name for the component.
|
|
166
|
+
autofocus: Whether the component should take the focus once the page is loaded
|
|
167
|
+
custom_attrs: custom attribute
|
|
168
|
+
**props: The props of the component.
|
|
169
|
+
|
|
170
|
+
Returns:
|
|
171
|
+
The component.
|
|
172
|
+
|
|
173
|
+
Raises:
|
|
174
|
+
TypeError: If an invalid child is passed.
|
|
175
|
+
"""
|
|
176
|
+
...
|
|
177
|
+
|
|
178
|
+
class ChakraProvider(ChakraComponent):
|
|
179
|
+
@overload
|
|
180
|
+
@classmethod
|
|
181
|
+
def create( # type: ignore
|
|
182
|
+
cls,
|
|
183
|
+
*children,
|
|
184
|
+
theme: Optional[Union[Var[str], str]] = None,
|
|
185
|
+
style: Optional[Style] = None,
|
|
186
|
+
key: Optional[Any] = None,
|
|
187
|
+
id: Optional[Any] = None,
|
|
188
|
+
class_name: Optional[Any] = None,
|
|
189
|
+
autofocus: Optional[bool] = None,
|
|
190
|
+
custom_attrs: Optional[Dict[str, str]] = None,
|
|
191
|
+
on_blur: Optional[
|
|
192
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
193
|
+
] = None,
|
|
194
|
+
on_click: Optional[
|
|
195
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
196
|
+
] = None,
|
|
197
|
+
on_context_menu: Optional[
|
|
198
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
199
|
+
] = None,
|
|
200
|
+
on_double_click: Optional[
|
|
201
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
202
|
+
] = None,
|
|
203
|
+
on_focus: Optional[
|
|
204
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
205
|
+
] = None,
|
|
206
|
+
on_mount: Optional[
|
|
207
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
208
|
+
] = None,
|
|
209
|
+
on_mouse_down: Optional[
|
|
210
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
211
|
+
] = None,
|
|
212
|
+
on_mouse_enter: Optional[
|
|
213
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
214
|
+
] = None,
|
|
215
|
+
on_mouse_leave: Optional[
|
|
216
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
217
|
+
] = None,
|
|
218
|
+
on_mouse_move: Optional[
|
|
219
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
220
|
+
] = None,
|
|
221
|
+
on_mouse_out: Optional[
|
|
222
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
223
|
+
] = None,
|
|
224
|
+
on_mouse_over: Optional[
|
|
225
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
226
|
+
] = None,
|
|
227
|
+
on_mouse_up: Optional[
|
|
228
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
229
|
+
] = None,
|
|
230
|
+
on_scroll: Optional[
|
|
231
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
232
|
+
] = None,
|
|
233
|
+
on_unmount: Optional[
|
|
234
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
235
|
+
] = None,
|
|
236
|
+
**props
|
|
237
|
+
) -> "ChakraProvider":
|
|
238
|
+
"""Create a new ChakraProvider component.
|
|
239
|
+
|
|
240
|
+
Returns:
|
|
241
|
+
A new ChakraProvider component.
|
|
242
|
+
"""
|
|
243
|
+
...
|
|
244
|
+
|
|
245
|
+
class ChakraColorModeProvider(Component):
|
|
246
|
+
...
|
|
247
|
+
|
|
248
|
+
@overload
|
|
249
|
+
@classmethod
|
|
250
|
+
def create( # type: ignore
|
|
251
|
+
cls,
|
|
252
|
+
*children,
|
|
253
|
+
style: Optional[Style] = None,
|
|
254
|
+
key: Optional[Any] = None,
|
|
255
|
+
id: Optional[Any] = None,
|
|
256
|
+
class_name: Optional[Any] = None,
|
|
257
|
+
autofocus: Optional[bool] = None,
|
|
258
|
+
custom_attrs: Optional[Dict[str, str]] = None,
|
|
259
|
+
on_blur: Optional[
|
|
260
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
261
|
+
] = None,
|
|
262
|
+
on_click: Optional[
|
|
263
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
264
|
+
] = None,
|
|
265
|
+
on_context_menu: Optional[
|
|
266
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
267
|
+
] = None,
|
|
268
|
+
on_double_click: Optional[
|
|
269
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
270
|
+
] = None,
|
|
271
|
+
on_focus: Optional[
|
|
272
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
273
|
+
] = None,
|
|
274
|
+
on_mount: Optional[
|
|
275
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
276
|
+
] = None,
|
|
277
|
+
on_mouse_down: Optional[
|
|
278
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
279
|
+
] = None,
|
|
280
|
+
on_mouse_enter: Optional[
|
|
281
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
282
|
+
] = None,
|
|
283
|
+
on_mouse_leave: Optional[
|
|
284
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
285
|
+
] = None,
|
|
286
|
+
on_mouse_move: Optional[
|
|
287
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
288
|
+
] = None,
|
|
289
|
+
on_mouse_out: Optional[
|
|
290
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
291
|
+
] = None,
|
|
292
|
+
on_mouse_over: Optional[
|
|
293
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
294
|
+
] = None,
|
|
295
|
+
on_mouse_up: Optional[
|
|
296
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
297
|
+
] = None,
|
|
298
|
+
on_scroll: Optional[
|
|
299
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
300
|
+
] = None,
|
|
301
|
+
on_unmount: Optional[
|
|
302
|
+
Union[EventHandler, EventSpec, List, function, BaseVar]
|
|
303
|
+
] = None,
|
|
304
|
+
**props
|
|
305
|
+
) -> "ChakraColorModeProvider":
|
|
306
|
+
"""Create the component.
|
|
307
|
+
|
|
308
|
+
Args:
|
|
309
|
+
*children: The children of the component.
|
|
310
|
+
style: The style of the component.
|
|
311
|
+
key: A unique key for the component.
|
|
312
|
+
id: The id for the component.
|
|
313
|
+
class_name: The class name for the component.
|
|
314
|
+
autofocus: Whether the component should take the focus once the page is loaded
|
|
315
|
+
custom_attrs: custom attribute
|
|
316
|
+
**props: The props of the component.
|
|
317
|
+
|
|
318
|
+
Returns:
|
|
319
|
+
The component.
|
|
320
|
+
|
|
321
|
+
Raises:
|
|
322
|
+
TypeError: If an invalid child is passed.
|
|
323
|
+
"""
|
|
324
|
+
...
|
|
10
325
|
|
|
11
326
|
LiteralColorScheme = Literal[
|
|
327
|
+
"none",
|
|
12
328
|
"gray",
|
|
13
329
|
"red",
|
|
14
330
|
"orange",
|
|
@@ -32,6 +348,7 @@ LiteralColorScheme = Literal[
|
|
|
32
348
|
LiteralVariant = Literal["solid", "subtle", "outline"]
|
|
33
349
|
LiteralDividerVariant = Literal["solid", "dashed"]
|
|
34
350
|
LiteralTheme = Literal["light", "dark"]
|
|
351
|
+
|
|
35
352
|
LiteralTagColorScheme = Literal[
|
|
36
353
|
"gray",
|
|
37
354
|
"red",
|
|
@@ -94,8 +411,8 @@ LiteralCardVariant = Literal["outline", "filled", "elevated", "unstyled"]
|
|
|
94
411
|
LiteralStackDirection = Literal["row", "column"]
|
|
95
412
|
LiteralImageLoading = Literal["eager", "lazy"]
|
|
96
413
|
LiteralTagSize = Literal["sm", "md", "lg"]
|
|
97
|
-
LiteralSpinnerSize = Literal[Literal[LiteralTagSize], "xs"]
|
|
98
|
-
LiteralAvatarSize = Literal[Literal[LiteralTagSize], "xs", "2xl", "full", "2xs"]
|
|
414
|
+
LiteralSpinnerSize = Literal[Literal[LiteralTagSize], "xs", "xl"]
|
|
415
|
+
LiteralAvatarSize = Literal[Literal[LiteralTagSize], "xl", "xs", "2xl", "full", "2xs"]
|
|
99
416
|
LiteralButtonSize = Literal["sm", "md", "lg", "xs"]
|
|
100
417
|
# Applies to AlertDialog and Modal
|
|
101
418
|
LiteralAlertDialogSize = Literal[
|
|
@@ -108,21 +425,3 @@ LiteralMenuOption = Literal["checkbox", "radio"]
|
|
|
108
425
|
LiteralPopOverTrigger = Literal["click", "hover"]
|
|
109
426
|
|
|
110
427
|
LiteralHeadingSize = Literal["lg", "md", "sm", "xs", "xl", "2xl", "3xl", "4xl"]
|
|
111
|
-
|
|
112
|
-
class ChakraComponent(Component):
|
|
113
|
-
@overload
|
|
114
|
-
@classmethod
|
|
115
|
-
def create(cls, *children, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_context_menu: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_double_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_focus: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_down: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_enter: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_leave: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_move: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_out: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_over: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_up: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_scroll: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_unmount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, **props) -> "ChakraComponent": # type: ignore
|
|
116
|
-
"""Create the component.
|
|
117
|
-
|
|
118
|
-
Args:
|
|
119
|
-
*children: The children of the component.
|
|
120
|
-
**props: The props of the component.
|
|
121
|
-
|
|
122
|
-
Returns:
|
|
123
|
-
The component.
|
|
124
|
-
|
|
125
|
-
Raises:
|
|
126
|
-
TypeError: If an invalid child is passed.
|
|
127
|
-
"""
|
|
128
|
-
...
|
|
@@ -11,9 +11,6 @@ if TYPE_CHECKING:
|
|
|
11
11
|
from reflex.components.component import Component
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
INDEX_VAR = "i"
|
|
15
|
-
|
|
16
|
-
|
|
17
14
|
class IterTag(Tag):
|
|
18
15
|
"""An iterator tag."""
|
|
19
16
|
|
|
@@ -23,37 +20,40 @@ class IterTag(Tag):
|
|
|
23
20
|
# The component render function for each item in the iterable.
|
|
24
21
|
render_fn: Callable
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
# The name of the index var.
|
|
24
|
+
index_var_name: str = "i"
|
|
25
|
+
|
|
26
|
+
def get_index_var(self) -> Var:
|
|
27
|
+
"""Get the index var for the tag (with curly braces).
|
|
28
|
+
|
|
29
|
+
This is used to reference the index var within the tag.
|
|
29
30
|
|
|
30
31
|
Returns:
|
|
31
32
|
The index var.
|
|
32
33
|
"""
|
|
33
34
|
return BaseVar(
|
|
34
|
-
_var_name=
|
|
35
|
+
_var_name=self.index_var_name,
|
|
35
36
|
_var_type=int,
|
|
36
37
|
)
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
def get_index_var_arg(self) -> Var:
|
|
40
|
+
"""Get the index var for the tag (without curly braces).
|
|
41
|
+
|
|
42
|
+
This is used to render the index var in the .map() function.
|
|
41
43
|
|
|
42
44
|
Returns:
|
|
43
45
|
The index var.
|
|
44
46
|
"""
|
|
45
47
|
return BaseVar(
|
|
46
|
-
_var_name=
|
|
48
|
+
_var_name=self.index_var_name,
|
|
47
49
|
_var_type=int,
|
|
48
50
|
_var_is_local=True,
|
|
49
51
|
)
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
def render_component(render_fn: Callable, arg: Var) -> Component:
|
|
53
|
+
def render_component(self, arg: Var) -> Component:
|
|
53
54
|
"""Render the component.
|
|
54
55
|
|
|
55
56
|
Args:
|
|
56
|
-
render_fn: The render function.
|
|
57
57
|
arg: The argument to pass to the render function.
|
|
58
58
|
|
|
59
59
|
Returns:
|
|
@@ -65,16 +65,16 @@ class IterTag(Tag):
|
|
|
65
65
|
from reflex.components.layout.fragment import Fragment
|
|
66
66
|
|
|
67
67
|
# Get the render function arguments.
|
|
68
|
-
args = inspect.getfullargspec(render_fn).args
|
|
69
|
-
index =
|
|
68
|
+
args = inspect.getfullargspec(self.render_fn).args
|
|
69
|
+
index = self.get_index_var()
|
|
70
70
|
|
|
71
71
|
if len(args) == 1:
|
|
72
72
|
# If the render function doesn't take the index as an argument.
|
|
73
|
-
component = render_fn(arg)
|
|
73
|
+
component = self.render_fn(arg)
|
|
74
74
|
else:
|
|
75
75
|
# If the render function takes the index as an argument.
|
|
76
76
|
assert len(args) == 2
|
|
77
|
-
component = render_fn(arg, index)
|
|
77
|
+
component = self.render_fn(arg, index)
|
|
78
78
|
|
|
79
79
|
# Nested foreach components or cond must be wrapped in fragments.
|
|
80
80
|
if isinstance(component, (Foreach, Cond)):
|
reflex/components/tags/tag.py
CHANGED
|
@@ -83,8 +83,9 @@ class Tag(Base):
|
|
|
83
83
|
The tag with the props removed.
|
|
84
84
|
"""
|
|
85
85
|
for name in args:
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
prop_name = format.to_camel_case(name)
|
|
87
|
+
if prop_name in self.props:
|
|
88
|
+
del self.props[prop_name]
|
|
88
89
|
return self
|
|
89
90
|
|
|
90
91
|
@staticmethod
|
|
@@ -240,6 +240,16 @@ class Markdown(Component):
|
|
|
240
240
|
] = f"""{{({{inline, className, {_CHILDREN._var_name}, {_PROPS._var_name}}}) => {{
|
|
241
241
|
const match = (className || '').match(/language-(?<lang>.*)/);
|
|
242
242
|
const language = match ? match[1] : '';
|
|
243
|
+
if (language) {{
|
|
244
|
+
(async () => {{
|
|
245
|
+
try {{
|
|
246
|
+
const module = await import(`react-syntax-highlighter/dist/cjs/languages/prism/${{language}}`);
|
|
247
|
+
SyntaxHighlighter.registerLanguage(language, module.default);
|
|
248
|
+
}} catch (error) {{
|
|
249
|
+
console.error(`Error importing language module for ${{language}}:`, error);
|
|
250
|
+
}}
|
|
251
|
+
}})();
|
|
252
|
+
}}
|
|
243
253
|
return inline ? (
|
|
244
254
|
{self.format_component("code")}
|
|
245
255
|
) : (
|
reflex/config.py
CHANGED
|
@@ -314,6 +314,18 @@ class Config(Base):
|
|
|
314
314
|
):
|
|
315
315
|
self.deploy_url = f"http://localhost:{kwargs['frontend_port']}"
|
|
316
316
|
|
|
317
|
+
# If running in Github Codespaces, override API_URL
|
|
318
|
+
codespace_name = os.getenv("CODESPACE_NAME")
|
|
319
|
+
if "api_url" not in self._non_default_attributes and codespace_name:
|
|
320
|
+
GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN = os.getenv(
|
|
321
|
+
"GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN"
|
|
322
|
+
)
|
|
323
|
+
if codespace_name:
|
|
324
|
+
self.api_url = (
|
|
325
|
+
f"https://{codespace_name}-{kwargs.get('backend_port', self.backend_port)}"
|
|
326
|
+
f".{GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}"
|
|
327
|
+
)
|
|
328
|
+
|
|
317
329
|
def _set_persistent(self, **kwargs):
|
|
318
330
|
"""Set values in this config and in the environment so they persist into subprocess.
|
|
319
331
|
|
reflex/constants/installer.py
CHANGED
|
@@ -95,8 +95,8 @@ class PackageJson(SimpleNamespace):
|
|
|
95
95
|
"""The commands to define in package.json."""
|
|
96
96
|
|
|
97
97
|
DEV = "next dev"
|
|
98
|
-
EXPORT = "next build
|
|
99
|
-
EXPORT_SITEMAP = "next build && next-sitemap
|
|
98
|
+
EXPORT = "next build"
|
|
99
|
+
EXPORT_SITEMAP = "next build && next-sitemap"
|
|
100
100
|
PROD = "next start"
|
|
101
101
|
|
|
102
102
|
PATH = os.path.join(Dirs.WEB, "package.json")
|
|
@@ -106,7 +106,7 @@ class PackageJson(SimpleNamespace):
|
|
|
106
106
|
"focus-visible": "5.2.0",
|
|
107
107
|
"framer-motion": "10.16.4",
|
|
108
108
|
"json5": "2.2.3",
|
|
109
|
-
"next": "
|
|
109
|
+
"next": "14.0.1",
|
|
110
110
|
"next-sitemap": "4.1.8",
|
|
111
111
|
"next-themes": "0.2.0",
|
|
112
112
|
"react": "18.2.0",
|
|
@@ -116,5 +116,5 @@ class PackageJson(SimpleNamespace):
|
|
|
116
116
|
}
|
|
117
117
|
DEV_DEPENDENCIES = {
|
|
118
118
|
"autoprefixer": "10.4.14",
|
|
119
|
-
"postcss": "8.4.
|
|
119
|
+
"postcss": "8.4.31",
|
|
120
120
|
}
|
reflex/event.py
CHANGED
|
@@ -270,6 +270,10 @@ class FileUpload(Base):
|
|
|
270
270
|
pass
|
|
271
271
|
|
|
272
272
|
|
|
273
|
+
# Alias for rx.upload_files
|
|
274
|
+
upload_files = FileUpload
|
|
275
|
+
|
|
276
|
+
|
|
273
277
|
# Special server-side events.
|
|
274
278
|
def server_side(name: str, sig: inspect.Signature, **kwargs) -> EventSpec:
|
|
275
279
|
"""A server-side event.
|
reflex/page.py
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from
|
|
6
|
-
from reflex.event import EventHandler
|
|
5
|
+
from typing import Any
|
|
7
6
|
|
|
8
7
|
DECORATED_PAGES = []
|
|
9
8
|
|
|
@@ -14,8 +13,8 @@ def page(
|
|
|
14
13
|
image: str | None = None,
|
|
15
14
|
description: str | None = None,
|
|
16
15
|
meta: str | None = None,
|
|
17
|
-
script_tags: list[
|
|
18
|
-
on_load:
|
|
16
|
+
script_tags: list[Any] | None = None,
|
|
17
|
+
on_load: Any | list[Any] | None = None,
|
|
19
18
|
):
|
|
20
19
|
"""Decorate a function as a page.
|
|
21
20
|
|
reflex/page.pyi
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""The page decorator and associated variables and functions."""
|
|
2
|
+
|
|
3
|
+
from reflex.components.component import Component
|
|
4
|
+
from reflex.event import EventHandler
|
|
5
|
+
|
|
6
|
+
DECORATED_PAGES: list
|
|
7
|
+
|
|
8
|
+
def page(
|
|
9
|
+
route: str | None = None,
|
|
10
|
+
title: str | None = None,
|
|
11
|
+
image: str | None = None,
|
|
12
|
+
description: str | None = None,
|
|
13
|
+
meta: str | None = None,
|
|
14
|
+
script_tags: list[Component] | None = None,
|
|
15
|
+
on_load: EventHandler | list[EventHandler] | None = None,
|
|
16
|
+
): ...
|
|
17
|
+
def get_decorated_pages() -> list[dict]: ...
|
reflex/reflex.py
CHANGED
|
@@ -184,6 +184,7 @@ def _run(
|
|
|
184
184
|
console.rule("[bold]Starting Reflex App")
|
|
185
185
|
|
|
186
186
|
if frontend:
|
|
187
|
+
prerequisites.update_next_config()
|
|
187
188
|
# Get the app module.
|
|
188
189
|
prerequisites.get_app()
|
|
189
190
|
|
|
@@ -337,6 +338,8 @@ def export(
|
|
|
337
338
|
console.rule("[bold]Compiling production app and preparing for export.")
|
|
338
339
|
|
|
339
340
|
if frontend:
|
|
341
|
+
# Update some parameters for export
|
|
342
|
+
prerequisites.update_next_config(export=True)
|
|
340
343
|
# Ensure module can be imported and app.compile() is called.
|
|
341
344
|
prerequisites.get_app()
|
|
342
345
|
# Set up .web directory and install frontend dependencies.
|
reflex/state.py
CHANGED
|
@@ -43,9 +43,11 @@ from reflex.event import (
|
|
|
43
43
|
)
|
|
44
44
|
from reflex.utils import console, format, prerequisites, types
|
|
45
45
|
from reflex.utils.exceptions import ImmutableStateError, LockExpiredError
|
|
46
|
+
from reflex.utils.serializers import SerializedType, serialize, serializer
|
|
46
47
|
from reflex.vars import BaseVar, ComputedVar, Var
|
|
47
48
|
|
|
48
49
|
Delta = Dict[str, Any]
|
|
50
|
+
var = ComputedVar
|
|
49
51
|
|
|
50
52
|
|
|
51
53
|
class HeaderData(Base):
|
|
@@ -1900,7 +1902,7 @@ class MutableProxy(wrapt.ObjectProxy):
|
|
|
1900
1902
|
"""
|
|
1901
1903
|
return self._wrap_recursive(wrapped(*args, **kwargs))
|
|
1902
1904
|
|
|
1903
|
-
def
|
|
1905
|
+
def __getattr__(self, __name: str) -> Any:
|
|
1904
1906
|
"""Get the attribute on the proxied object and return a proxy if mutable.
|
|
1905
1907
|
|
|
1906
1908
|
Args:
|
|
@@ -1909,26 +1911,24 @@ class MutableProxy(wrapt.ObjectProxy):
|
|
|
1909
1911
|
Returns:
|
|
1910
1912
|
The attribute value.
|
|
1911
1913
|
"""
|
|
1912
|
-
value = super().
|
|
1914
|
+
value = super().__getattr__(__name)
|
|
1913
1915
|
|
|
1914
1916
|
if callable(value):
|
|
1915
|
-
if __name in
|
|
1917
|
+
if __name in self.__mark_dirty_attrs__:
|
|
1916
1918
|
# Wrap special callables, like "append", which should mark state dirty.
|
|
1917
|
-
value = wrapt.FunctionWrapper(
|
|
1918
|
-
value,
|
|
1919
|
-
super().__getattribute__("_mark_dirty"),
|
|
1920
|
-
)
|
|
1919
|
+
value = wrapt.FunctionWrapper(value, self._mark_dirty)
|
|
1921
1920
|
|
|
1922
|
-
if __name in
|
|
1921
|
+
if __name in self.__wrap_mutable_attrs__:
|
|
1923
1922
|
# Wrap methods that may return mutable objects tied to the state.
|
|
1924
1923
|
value = wrapt.FunctionWrapper(
|
|
1925
1924
|
value,
|
|
1926
|
-
|
|
1925
|
+
self._wrap_recursive_decorator,
|
|
1927
1926
|
)
|
|
1928
1927
|
|
|
1929
|
-
if isinstance(
|
|
1930
|
-
|
|
1931
|
-
|
|
1928
|
+
if isinstance(value, self.__mutable_types__) and __name not in (
|
|
1929
|
+
"__wrapped__",
|
|
1930
|
+
"_self_state",
|
|
1931
|
+
):
|
|
1932
1932
|
# Recursively wrap mutable attribute values retrieved through this proxy.
|
|
1933
1933
|
return self._wrap_recursive(value)
|
|
1934
1934
|
|
|
@@ -2018,6 +2018,25 @@ class MutableProxy(wrapt.ObjectProxy):
|
|
|
2018
2018
|
return copy.deepcopy(self.__wrapped__, memo=memo)
|
|
2019
2019
|
|
|
2020
2020
|
|
|
2021
|
+
@serializer
|
|
2022
|
+
def serialize_mutable_proxy(mp: MutableProxy) -> SerializedType:
|
|
2023
|
+
"""Serialize the wrapped value of a MutableProxy.
|
|
2024
|
+
|
|
2025
|
+
Args:
|
|
2026
|
+
mp: The MutableProxy to serialize.
|
|
2027
|
+
|
|
2028
|
+
Returns:
|
|
2029
|
+
The serialized wrapped object.
|
|
2030
|
+
|
|
2031
|
+
Raises:
|
|
2032
|
+
ValueError: when the wrapped object is not serializable.
|
|
2033
|
+
"""
|
|
2034
|
+
value = serialize(mp.__wrapped__)
|
|
2035
|
+
if value is None:
|
|
2036
|
+
raise ValueError(f"Cannot serialize {type(mp.__wrapped__)}")
|
|
2037
|
+
return value
|
|
2038
|
+
|
|
2039
|
+
|
|
2021
2040
|
class ImmutableMutableProxy(MutableProxy):
|
|
2022
2041
|
"""A proxy for a mutable object that tracks changes.
|
|
2023
2042
|
|