reflex 0.6.8a1__py3-none-any.whl → 0.7.0__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/custom_components/pyproject.toml.jinja2 +1 -1
- reflex/.templates/jinja/web/pages/_app.js.jinja2 +7 -7
- reflex/.templates/jinja/web/pages/utils.js.jinja2 +3 -3
- reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js +1 -4
- reflex/.templates/web/utils/state.js +65 -36
- reflex/__init__.py +4 -17
- reflex/__init__.pyi +1 -2
- reflex/app.py +286 -135
- reflex/app_mixins/lifespan.py +9 -9
- reflex/app_mixins/middleware.py +6 -6
- reflex/app_module_for_backend.py +3 -7
- reflex/base.py +7 -7
- reflex/compiler/compiler.py +8 -0
- reflex/compiler/utils.py +57 -18
- reflex/components/base/app_wrap.pyi +16 -16
- reflex/components/base/bare.py +1 -1
- reflex/components/base/body.pyi +16 -16
- reflex/components/base/document.pyi +76 -76
- reflex/components/base/error_boundary.py +2 -1
- reflex/components/base/error_boundary.pyi +19 -22
- reflex/components/base/fragment.pyi +16 -16
- reflex/components/base/head.pyi +31 -31
- reflex/components/base/link.pyi +31 -31
- reflex/components/base/meta.py +2 -2
- reflex/components/base/meta.pyi +61 -61
- reflex/components/base/script.pyi +19 -19
- reflex/components/base/strict_mode.py +10 -0
- reflex/components/base/strict_mode.pyi +57 -0
- reflex/components/component.py +38 -77
- reflex/components/core/banner.py +159 -4
- reflex/components/core/banner.pyi +162 -76
- reflex/components/core/breakpoints.py +3 -1
- reflex/components/core/client_side_routing.py +1 -1
- reflex/components/core/client_side_routing.pyi +32 -32
- reflex/components/core/clipboard.pyi +17 -20
- reflex/components/core/cond.py +9 -10
- reflex/components/core/debounce.py +1 -1
- reflex/components/core/debounce.pyi +17 -17
- reflex/components/core/foreach.py +28 -3
- reflex/components/core/html.py +1 -1
- reflex/components/core/html.pyi +16 -16
- reflex/components/core/match.py +5 -5
- reflex/components/core/sticky.py +134 -0
- reflex/components/core/sticky.pyi +449 -0
- reflex/components/core/upload.py +2 -2
- reflex/components/core/upload.pyi +80 -88
- reflex/components/datadisplay/code.py +5 -14
- reflex/components/datadisplay/code.pyi +31 -31
- reflex/components/datadisplay/dataeditor.py +7 -4
- reflex/components/datadisplay/dataeditor.pyi +40 -54
- reflex/components/datadisplay/logo.py +13 -8
- reflex/components/datadisplay/shiki_code_block.py +14 -9
- reflex/components/datadisplay/shiki_code_block.pyi +46 -46
- reflex/components/dynamic.py +22 -3
- reflex/components/el/constants/reflex.py +1 -1
- reflex/components/el/element.py +1 -1
- reflex/components/el/element.pyi +16 -16
- reflex/components/el/elements/base.pyi +16 -16
- reflex/components/el/elements/forms.py +4 -4
- reflex/components/el/elements/forms.pyi +224 -258
- reflex/components/el/elements/inline.pyi +421 -421
- reflex/components/el/elements/media.pyi +376 -376
- reflex/components/el/elements/metadata.pyi +91 -91
- reflex/components/el/elements/other.pyi +106 -106
- reflex/components/el/elements/scripts.pyi +46 -46
- reflex/components/el/elements/sectioning.pyi +226 -226
- reflex/components/el/elements/tables.pyi +151 -151
- reflex/components/el/elements/typography.pyi +226 -226
- reflex/components/gridjs/datatable.pyi +31 -31
- reflex/components/lucide/icon.py +46 -8
- reflex/components/lucide/icon.pyi +85 -31
- reflex/components/markdown/markdown.py +10 -8
- reflex/components/markdown/markdown.pyi +16 -16
- reflex/components/moment/moment.py +2 -2
- reflex/components/moment/moment.pyi +17 -19
- reflex/components/next/base.pyi +16 -16
- reflex/components/next/image.py +16 -4
- reflex/components/next/image.pyi +22 -20
- reflex/components/next/link.py +1 -1
- reflex/components/next/link.pyi +16 -16
- reflex/components/next/video.pyi +16 -16
- reflex/components/plotly/__init__.py +29 -2
- reflex/components/plotly/plotly.py +240 -5
- reflex/components/plotly/plotly.pyi +799 -44
- reflex/components/props.py +3 -3
- reflex/components/radix/__init__.pyi +1 -1
- reflex/components/radix/primitives/accordion.py +9 -5
- reflex/components/radix/primitives/accordion.pyi +110 -108
- reflex/components/radix/primitives/base.pyi +31 -31
- reflex/components/radix/primitives/drawer.py +5 -2
- reflex/components/radix/primitives/drawer.pyi +179 -187
- reflex/components/radix/primitives/form.pyi +160 -172
- reflex/components/radix/primitives/progress.py +1 -1
- reflex/components/radix/primitives/progress.pyi +76 -76
- reflex/components/radix/primitives/slider.py +1 -1
- reflex/components/radix/primitives/slider.pyi +78 -82
- reflex/components/radix/themes/base.pyi +121 -121
- reflex/components/radix/themes/color_mode.py +11 -9
- reflex/components/radix/themes/color_mode.pyi +47 -49
- reflex/components/radix/themes/components/alert_dialog.py +3 -0
- reflex/components/radix/themes/components/alert_dialog.pyi +110 -112
- reflex/components/radix/themes/components/aspect_ratio.pyi +16 -16
- reflex/components/radix/themes/components/avatar.pyi +16 -16
- reflex/components/radix/themes/components/badge.pyi +16 -16
- reflex/components/radix/themes/components/button.pyi +16 -16
- reflex/components/radix/themes/components/callout.pyi +76 -76
- reflex/components/radix/themes/components/card.py +1 -1
- reflex/components/radix/themes/components/card.pyi +17 -17
- reflex/components/radix/themes/components/checkbox.pyi +49 -55
- reflex/components/radix/themes/components/checkbox_cards.pyi +31 -31
- reflex/components/radix/themes/components/checkbox_group.pyi +31 -31
- reflex/components/radix/themes/components/context_menu.py +5 -0
- reflex/components/radix/themes/components/context_menu.pyi +149 -155
- reflex/components/radix/themes/components/data_list.pyi +61 -61
- reflex/components/radix/themes/components/dialog.py +3 -0
- reflex/components/radix/themes/components/dialog.pyi +113 -117
- reflex/components/radix/themes/components/dropdown_menu.py +5 -0
- reflex/components/radix/themes/components/dropdown_menu.pyi +133 -137
- reflex/components/radix/themes/components/hover_card.py +3 -0
- reflex/components/radix/themes/components/hover_card.pyi +63 -67
- reflex/components/radix/themes/components/icon_button.py +2 -2
- reflex/components/radix/themes/components/icon_button.pyi +17 -16
- reflex/components/radix/themes/components/inset.pyi +16 -16
- reflex/components/radix/themes/components/popover.py +3 -0
- reflex/components/radix/themes/components/popover.pyi +68 -70
- reflex/components/radix/themes/components/progress.pyi +16 -16
- reflex/components/radix/themes/components/radio.pyi +16 -16
- reflex/components/radix/themes/components/radio_cards.py +2 -0
- reflex/components/radix/themes/components/radio_cards.pyi +32 -34
- reflex/components/radix/themes/components/radio_group.py +1 -1
- reflex/components/radix/themes/components/radio_group.pyi +62 -64
- reflex/components/radix/themes/components/scroll_area.pyi +16 -16
- reflex/components/radix/themes/components/segmented_control.pyi +32 -35
- reflex/components/radix/themes/components/select.py +4 -0
- reflex/components/radix/themes/components/select.pyi +145 -157
- reflex/components/radix/themes/components/separator.pyi +16 -16
- reflex/components/radix/themes/components/skeleton.py +3 -0
- reflex/components/radix/themes/components/skeleton.pyi +16 -16
- reflex/components/radix/themes/components/slider.pyi +22 -28
- reflex/components/radix/themes/components/spinner.pyi +16 -16
- reflex/components/radix/themes/components/switch.pyi +17 -19
- reflex/components/radix/themes/components/table.pyi +106 -106
- reflex/components/radix/themes/components/tabs.py +3 -0
- reflex/components/radix/themes/components/tabs.pyi +78 -82
- reflex/components/radix/themes/components/text_area.py +12 -0
- reflex/components/radix/themes/components/text_area.pyi +21 -33
- reflex/components/radix/themes/components/text_field.py +1 -1
- reflex/components/radix/themes/components/text_field.pyi +52 -80
- reflex/components/radix/themes/components/tooltip.py +6 -1
- reflex/components/radix/themes/components/tooltip.pyi +20 -21
- reflex/components/radix/themes/layout/__init__.pyi +1 -1
- reflex/components/radix/themes/layout/base.pyi +16 -16
- reflex/components/radix/themes/layout/box.pyi +16 -16
- reflex/components/radix/themes/layout/center.pyi +16 -16
- reflex/components/radix/themes/layout/container.pyi +16 -16
- reflex/components/radix/themes/layout/flex.pyi +16 -16
- reflex/components/radix/themes/layout/grid.pyi +16 -16
- reflex/components/radix/themes/layout/list.py +2 -2
- reflex/components/radix/themes/layout/list.pyi +76 -76
- reflex/components/radix/themes/layout/section.pyi +16 -16
- reflex/components/radix/themes/layout/spacer.pyi +16 -16
- reflex/components/radix/themes/layout/stack.py +2 -2
- reflex/components/radix/themes/layout/stack.pyi +46 -46
- reflex/components/radix/themes/typography/blockquote.pyi +16 -16
- reflex/components/radix/themes/typography/code.pyi +16 -16
- reflex/components/radix/themes/typography/heading.pyi +16 -16
- reflex/components/radix/themes/typography/link.py +1 -1
- reflex/components/radix/themes/typography/link.pyi +16 -16
- reflex/components/radix/themes/typography/text.py +2 -2
- reflex/components/radix/themes/typography/text.pyi +106 -106
- reflex/components/react_player/audio.pyi +33 -39
- reflex/components/react_player/react_player.py +1 -1
- reflex/components/react_player/react_player.pyi +32 -38
- reflex/components/react_player/video.pyi +33 -39
- reflex/components/recharts/__init__.py +2 -0
- reflex/components/recharts/__init__.pyi +2 -0
- reflex/components/recharts/cartesian.pyi +282 -282
- reflex/components/recharts/charts.py +15 -15
- reflex/components/recharts/charts.pyi +164 -164
- reflex/components/recharts/general.py +19 -4
- reflex/components/recharts/general.pyi +132 -81
- reflex/components/recharts/polar.py +2 -2
- reflex/components/recharts/polar.pyi +55 -55
- reflex/components/recharts/recharts.py +4 -4
- reflex/components/recharts/recharts.pyi +31 -31
- reflex/components/sonner/toast.py +15 -13
- reflex/components/sonner/toast.pyi +22 -22
- reflex/components/suneditor/editor.py +6 -4
- reflex/components/suneditor/editor.pyi +26 -40
- reflex/components/tags/iter_tag.py +3 -3
- reflex/components/tags/tag.py +25 -3
- reflex/config.py +48 -20
- reflex/constants/__init__.py +1 -0
- reflex/constants/base.py +4 -1
- reflex/constants/compiler.py +5 -2
- reflex/constants/config.py +8 -1
- reflex/constants/installer.py +9 -9
- reflex/constants/style.py +1 -1
- reflex/custom_components/custom_components.py +18 -10
- reflex/event.py +228 -233
- reflex/experimental/__init__.py +19 -11
- reflex/experimental/client_state.py +53 -28
- reflex/experimental/hooks.py +5 -5
- reflex/experimental/layout.py +8 -5
- reflex/experimental/layout.pyi +79 -83
- reflex/experimental/misc.py +3 -3
- reflex/istate/wrappers.py +1 -1
- reflex/middleware/hydrate_middleware.py +2 -2
- reflex/model.py +11 -6
- reflex/page.py +5 -5
- reflex/reflex.py +104 -26
- reflex/route.py +1 -1
- reflex/state.py +358 -401
- reflex/style.py +27 -3
- reflex/testing.py +34 -39
- reflex/utils/build.py +6 -2
- reflex/utils/codespaces.py +1 -4
- reflex/utils/compat.py +6 -5
- reflex/utils/console.py +71 -21
- reflex/utils/exceptions.py +89 -26
- reflex/utils/exec.py +69 -74
- reflex/utils/export.py +6 -1
- reflex/utils/format.py +8 -40
- reflex/utils/imports.py +5 -2
- reflex/utils/lazy_loader.py +7 -1
- reflex/utils/path_ops.py +74 -14
- reflex/utils/prerequisites.py +345 -68
- reflex/utils/processes.py +45 -32
- reflex/utils/pyi_generator.py +39 -33
- reflex/utils/registry.py +4 -4
- reflex/utils/serializers.py +1 -1
- reflex/utils/telemetry.py +5 -4
- reflex/utils/types.py +42 -18
- reflex/vars/base.py +695 -330
- reflex/vars/datetime.py +6 -7
- reflex/vars/dep_tracking.py +344 -0
- reflex/vars/function.py +11 -5
- reflex/vars/number.py +31 -43
- reflex/vars/object.py +74 -64
- reflex/vars/sequence.py +79 -67
- {reflex-0.6.8a1.dist-info → reflex-0.7.0.dist-info}/METADATA +7 -10
- reflex-0.7.0.dist-info/RECORD +401 -0
- {reflex-0.6.8a1.dist-info → reflex-0.7.0.dist-info}/WHEEL +1 -1
- reflex/experimental/assets.py +0 -37
- reflex/proxy.py +0 -119
- reflex-0.6.8a1.dist-info/RECORD +0 -398
- {reflex-0.6.8a1.dist-info → reflex-0.7.0.dist-info}/LICENSE +0 -0
- {reflex-0.6.8a1.dist-info → reflex-0.7.0.dist-info}/entry_points.txt +0 -0
|
@@ -132,7 +132,7 @@ class ToastProps(PropsBase, NoExtrasAllowedProps):
|
|
|
132
132
|
# Function that gets called when the toast disappears automatically after it's timeout (duration` prop).
|
|
133
133
|
on_auto_close: Optional[Any]
|
|
134
134
|
|
|
135
|
-
def dict(self, *args, **kwargs) -> dict[str, Any]:
|
|
135
|
+
def dict(self, *args: Any, **kwargs: Any) -> dict[str, Any]:
|
|
136
136
|
"""Convert the object to a dictionary.
|
|
137
137
|
|
|
138
138
|
Args:
|
|
@@ -142,7 +142,7 @@ class ToastProps(PropsBase, NoExtrasAllowedProps):
|
|
|
142
142
|
Returns:
|
|
143
143
|
The object as a dictionary with ToastAction fields intact.
|
|
144
144
|
"""
|
|
145
|
-
kwargs.setdefault("exclude_none", True)
|
|
145
|
+
kwargs.setdefault("exclude_none", True)
|
|
146
146
|
d = super().dict(*args, **kwargs)
|
|
147
147
|
# Keep these fields as ToastAction so they can be serialized specially
|
|
148
148
|
if "action" in d:
|
|
@@ -167,7 +167,7 @@ class ToastProps(PropsBase, NoExtrasAllowedProps):
|
|
|
167
167
|
class Toaster(Component):
|
|
168
168
|
"""A Toaster Component for displaying toast notifications."""
|
|
169
169
|
|
|
170
|
-
library: str = "sonner@1.7.
|
|
170
|
+
library: str | None = "sonner@1.7.2"
|
|
171
171
|
|
|
172
172
|
tag = "Toaster"
|
|
173
173
|
|
|
@@ -222,6 +222,8 @@ class Toaster(Component):
|
|
|
222
222
|
Returns:
|
|
223
223
|
The hooks for the toaster component.
|
|
224
224
|
"""
|
|
225
|
+
if self.library is None:
|
|
226
|
+
return []
|
|
225
227
|
hook = Var(
|
|
226
228
|
_js_expr=f"{toast_ref} = toast",
|
|
227
229
|
_var_data=VarData(
|
|
@@ -266,7 +268,7 @@ class Toaster(Component):
|
|
|
266
268
|
raise ValueError("Toast message or title or description must be provided.")
|
|
267
269
|
|
|
268
270
|
if props:
|
|
269
|
-
args = LiteralVar.create(ToastProps(component_name="rx.toast", **props)) # pyright: ignore [reportCallIssue
|
|
271
|
+
args = LiteralVar.create(ToastProps(component_name="rx.toast", **props)) # pyright: ignore [reportCallIssue]
|
|
270
272
|
toast = toast_command.call(message, args)
|
|
271
273
|
else:
|
|
272
274
|
toast = toast_command.call(message)
|
|
@@ -274,12 +276,12 @@ class Toaster(Component):
|
|
|
274
276
|
return run_script(toast)
|
|
275
277
|
|
|
276
278
|
@staticmethod
|
|
277
|
-
def toast_info(message: str | Var = "", **kwargs):
|
|
279
|
+
def toast_info(message: str | Var = "", **kwargs: Any):
|
|
278
280
|
"""Display an info toast message.
|
|
279
281
|
|
|
280
282
|
Args:
|
|
281
283
|
message: The message to display.
|
|
282
|
-
kwargs: Additional toast props.
|
|
284
|
+
**kwargs: Additional toast props.
|
|
283
285
|
|
|
284
286
|
Returns:
|
|
285
287
|
The toast event.
|
|
@@ -287,12 +289,12 @@ class Toaster(Component):
|
|
|
287
289
|
return Toaster.send_toast(message, level="info", **kwargs)
|
|
288
290
|
|
|
289
291
|
@staticmethod
|
|
290
|
-
def toast_warning(message: str | Var = "", **kwargs):
|
|
292
|
+
def toast_warning(message: str | Var = "", **kwargs: Any):
|
|
291
293
|
"""Display a warning toast message.
|
|
292
294
|
|
|
293
295
|
Args:
|
|
294
296
|
message: The message to display.
|
|
295
|
-
kwargs: Additional toast props.
|
|
297
|
+
**kwargs: Additional toast props.
|
|
296
298
|
|
|
297
299
|
Returns:
|
|
298
300
|
The toast event.
|
|
@@ -300,12 +302,12 @@ class Toaster(Component):
|
|
|
300
302
|
return Toaster.send_toast(message, level="warning", **kwargs)
|
|
301
303
|
|
|
302
304
|
@staticmethod
|
|
303
|
-
def toast_error(message: str | Var = "", **kwargs):
|
|
305
|
+
def toast_error(message: str | Var = "", **kwargs: Any):
|
|
304
306
|
"""Display an error toast message.
|
|
305
307
|
|
|
306
308
|
Args:
|
|
307
309
|
message: The message to display.
|
|
308
|
-
kwargs: Additional toast props.
|
|
310
|
+
**kwargs: Additional toast props.
|
|
309
311
|
|
|
310
312
|
Returns:
|
|
311
313
|
The toast event.
|
|
@@ -313,12 +315,12 @@ class Toaster(Component):
|
|
|
313
315
|
return Toaster.send_toast(message, level="error", **kwargs)
|
|
314
316
|
|
|
315
317
|
@staticmethod
|
|
316
|
-
def toast_success(message: str | Var = "", **kwargs):
|
|
318
|
+
def toast_success(message: str | Var = "", **kwargs: Any):
|
|
317
319
|
"""Display a success toast message.
|
|
318
320
|
|
|
319
321
|
Args:
|
|
320
322
|
message: The message to display.
|
|
321
|
-
kwargs: Additional toast props.
|
|
323
|
+
**kwargs: Additional toast props.
|
|
322
324
|
|
|
323
325
|
Returns:
|
|
324
326
|
The toast event.
|
|
@@ -350,7 +352,7 @@ class Toaster(Component):
|
|
|
350
352
|
return run_script(dismiss_action)
|
|
351
353
|
|
|
352
354
|
@classmethod
|
|
353
|
-
def create(cls, *children, **props) -> Component:
|
|
355
|
+
def create(cls, *children: Any, **props: Any) -> Component:
|
|
354
356
|
"""Create a toaster component.
|
|
355
357
|
|
|
356
358
|
Args:
|
|
@@ -9,7 +9,7 @@ from reflex.base import Base
|
|
|
9
9
|
from reflex.components.component import Component, ComponentNamespace
|
|
10
10
|
from reflex.components.lucide.icon import Icon
|
|
11
11
|
from reflex.components.props import NoExtrasAllowedProps, PropsBase
|
|
12
|
-
from reflex.event import
|
|
12
|
+
from reflex.event import EventSpec, EventType
|
|
13
13
|
from reflex.style import Style
|
|
14
14
|
from reflex.utils.serializers import serializer
|
|
15
15
|
from reflex.vars.base import Var
|
|
@@ -51,7 +51,7 @@ class ToastProps(PropsBase, NoExtrasAllowedProps):
|
|
|
51
51
|
on_dismiss: Optional[Any]
|
|
52
52
|
on_auto_close: Optional[Any]
|
|
53
53
|
|
|
54
|
-
def dict(self, *args, **kwargs) -> dict[str, Any]: ...
|
|
54
|
+
def dict(self, *args: Any, **kwargs: Any) -> dict[str, Any]: ...
|
|
55
55
|
|
|
56
56
|
class Toaster(Component):
|
|
57
57
|
is_used: ClassVar[bool] = False
|
|
@@ -62,13 +62,13 @@ class Toaster(Component):
|
|
|
62
62
|
message: str | Var = "", level: str | None = None, **props
|
|
63
63
|
) -> EventSpec: ...
|
|
64
64
|
@staticmethod
|
|
65
|
-
def toast_info(message: str | Var = "", **kwargs): ...
|
|
65
|
+
def toast_info(message: str | Var = "", **kwargs: Any): ...
|
|
66
66
|
@staticmethod
|
|
67
|
-
def toast_warning(message: str | Var = "", **kwargs): ...
|
|
67
|
+
def toast_warning(message: str | Var = "", **kwargs: Any): ...
|
|
68
68
|
@staticmethod
|
|
69
|
-
def toast_error(message: str | Var = "", **kwargs): ...
|
|
69
|
+
def toast_error(message: str | Var = "", **kwargs: Any): ...
|
|
70
70
|
@staticmethod
|
|
71
|
-
def toast_success(message: str | Var = "", **kwargs): ...
|
|
71
|
+
def toast_success(message: str | Var = "", **kwargs: Any): ...
|
|
72
72
|
@staticmethod
|
|
73
73
|
def toast_dismiss(id: Var | str | None = None): ...
|
|
74
74
|
@overload
|
|
@@ -117,21 +117,21 @@ class Toaster(Component):
|
|
|
117
117
|
class_name: Optional[Any] = None,
|
|
118
118
|
autofocus: Optional[bool] = None,
|
|
119
119
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
120
|
-
on_blur: Optional[EventType[
|
|
121
|
-
on_click: Optional[EventType[
|
|
122
|
-
on_context_menu: Optional[EventType[
|
|
123
|
-
on_double_click: Optional[EventType[
|
|
124
|
-
on_focus: Optional[EventType[
|
|
125
|
-
on_mount: Optional[EventType[
|
|
126
|
-
on_mouse_down: Optional[EventType[
|
|
127
|
-
on_mouse_enter: Optional[EventType[
|
|
128
|
-
on_mouse_leave: Optional[EventType[
|
|
129
|
-
on_mouse_move: Optional[EventType[
|
|
130
|
-
on_mouse_out: Optional[EventType[
|
|
131
|
-
on_mouse_over: Optional[EventType[
|
|
132
|
-
on_mouse_up: Optional[EventType[
|
|
133
|
-
on_scroll: Optional[EventType[
|
|
134
|
-
on_unmount: Optional[EventType[
|
|
120
|
+
on_blur: Optional[EventType[()]] = None,
|
|
121
|
+
on_click: Optional[EventType[()]] = None,
|
|
122
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
123
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
124
|
+
on_focus: Optional[EventType[()]] = None,
|
|
125
|
+
on_mount: Optional[EventType[()]] = None,
|
|
126
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
127
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
128
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
129
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
130
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
131
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
132
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
133
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
134
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
135
135
|
**props,
|
|
136
136
|
) -> "Toaster":
|
|
137
137
|
"""Create a toaster component.
|
|
@@ -177,7 +177,7 @@ class ToastNamespace(ComponentNamespace):
|
|
|
177
177
|
@staticmethod
|
|
178
178
|
def __call__(
|
|
179
179
|
message: Union[str, Var] = "", level: Optional[str] = None, **props
|
|
180
|
-
) -> "
|
|
180
|
+
) -> "EventSpec":
|
|
181
181
|
"""Send a toast message.
|
|
182
182
|
|
|
183
183
|
Args:
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import enum
|
|
6
|
-
from typing import Dict, List, Literal, Optional, Tuple, Union
|
|
6
|
+
from typing import Any, Dict, List, Literal, Optional, Tuple, Union
|
|
7
7
|
|
|
8
8
|
from reflex.base import Base
|
|
9
9
|
from reflex.components.component import Component, NoSSRComponent
|
|
@@ -115,7 +115,7 @@ class Editor(NoSSRComponent):
|
|
|
115
115
|
# Alternatively to a string, a dict of your language can be passed to this prop.
|
|
116
116
|
# Please refer to the library docs for this.
|
|
117
117
|
# options: "en" | "da" | "de" | "es" | "fr" | "ja" | "ko" | "pt_br" |
|
|
118
|
-
#
|
|
118
|
+
# "ru" | "zh_cn" | "ro" | "pl" | "ckb" | "lv" | "se" | "ua" | "he" | "it"
|
|
119
119
|
# default: "en".
|
|
120
120
|
lang: Var[
|
|
121
121
|
Union[
|
|
@@ -244,11 +244,13 @@ class Editor(NoSSRComponent):
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
@classmethod
|
|
247
|
-
def create(
|
|
247
|
+
def create(
|
|
248
|
+
cls, set_options: Optional[EditorOptions] = None, **props: Any
|
|
249
|
+
) -> Component:
|
|
248
250
|
"""Create an instance of Editor. No children allowed.
|
|
249
251
|
|
|
250
252
|
Args:
|
|
251
|
-
set_options
|
|
253
|
+
set_options: Configuration object to further configure the instance.
|
|
252
254
|
**props: Any properties to be passed to the Editor
|
|
253
255
|
|
|
254
256
|
Returns:
|
|
@@ -8,7 +8,7 @@ from typing import Any, Dict, List, Literal, Optional, Tuple, Union, overload
|
|
|
8
8
|
|
|
9
9
|
from reflex.base import Base
|
|
10
10
|
from reflex.components.component import NoSSRComponent
|
|
11
|
-
from reflex.event import
|
|
11
|
+
from reflex.event import EventType
|
|
12
12
|
from reflex.style import Style
|
|
13
13
|
from reflex.utils.imports import ImportDict
|
|
14
14
|
from reflex.vars.base import Var
|
|
@@ -127,52 +127,38 @@ class Editor(NoSSRComponent):
|
|
|
127
127
|
class_name: Optional[Any] = None,
|
|
128
128
|
autofocus: Optional[bool] = None,
|
|
129
129
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
130
|
-
on_blur: Optional[
|
|
131
|
-
|
|
132
|
-
] = None,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
] = None,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
] = None,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
|
|
149
|
-
on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
|
|
150
|
-
on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
|
|
151
|
-
on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
|
|
152
|
-
on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
|
|
153
|
-
on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
|
|
130
|
+
on_blur: Optional[Union[EventType[()], EventType[str]]] = None,
|
|
131
|
+
on_change: Optional[Union[EventType[()], EventType[str]]] = None,
|
|
132
|
+
on_click: Optional[EventType[()]] = None,
|
|
133
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
134
|
+
on_copy: Optional[EventType[()]] = None,
|
|
135
|
+
on_cut: Optional[EventType[()]] = None,
|
|
136
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
137
|
+
on_focus: Optional[EventType[()]] = None,
|
|
138
|
+
on_input: Optional[EventType[()]] = None,
|
|
139
|
+
on_load: Optional[Union[EventType[()], EventType[bool]]] = None,
|
|
140
|
+
on_mount: Optional[EventType[()]] = None,
|
|
141
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
142
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
143
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
144
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
145
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
146
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
147
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
154
148
|
on_paste: Optional[
|
|
155
|
-
Union[
|
|
156
|
-
EventType[[], BASE_STATE],
|
|
157
|
-
EventType[[str], BASE_STATE],
|
|
158
|
-
EventType[[str, bool], BASE_STATE],
|
|
159
|
-
]
|
|
160
|
-
] = None,
|
|
161
|
-
on_scroll: Optional[EventType[[], BASE_STATE]] = None,
|
|
162
|
-
on_unmount: Optional[EventType[[], BASE_STATE]] = None,
|
|
163
|
-
toggle_code_view: Optional[
|
|
164
|
-
Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
|
|
165
|
-
] = None,
|
|
166
|
-
toggle_full_screen: Optional[
|
|
167
|
-
Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
|
|
149
|
+
Union[EventType[()], EventType[str], EventType[str, bool]]
|
|
168
150
|
] = None,
|
|
151
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
152
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
153
|
+
toggle_code_view: Optional[Union[EventType[()], EventType[bool]]] = None,
|
|
154
|
+
toggle_full_screen: Optional[Union[EventType[()], EventType[bool]]] = None,
|
|
169
155
|
**props,
|
|
170
156
|
) -> "Editor":
|
|
171
157
|
"""Create an instance of Editor. No children allowed.
|
|
172
158
|
|
|
173
159
|
Args:
|
|
174
|
-
set_options
|
|
175
|
-
lang: Language of the editor. Alternatively to a string, a dict of your language can be passed to this prop. Please refer to the library docs for this. options: "en" | "da" | "de" | "es" | "fr" | "ja" | "ko" | "pt_br" |
|
|
160
|
+
set_options: Configuration object to further configure the instance.
|
|
161
|
+
lang: Language of the editor. Alternatively to a string, a dict of your language can be passed to this prop. Please refer to the library docs for this. options: "en" | "da" | "de" | "es" | "fr" | "ja" | "ko" | "pt_br" | "ru" | "zh_cn" | "ro" | "pl" | "ckb" | "lv" | "se" | "ua" | "he" | "it" default: "en".
|
|
176
162
|
name: This is used to set the HTML form name of the editor. This means on HTML form submission, it will be submitted together with contents of the editor by the name provided.
|
|
177
163
|
default_value: Sets the default value of the editor. This is useful if you don't want the on_change method to be called on render. If you want the on_change method to be called on render please use the set_contents prop
|
|
178
164
|
width: Sets the width of the editor. px and percentage values are accepted, eg width="100%" or width="500px" default: 100%
|
|
@@ -41,14 +41,14 @@ class IterTag(Tag):
|
|
|
41
41
|
try:
|
|
42
42
|
if iterable._var_type.mro()[0] is dict:
|
|
43
43
|
# Arg is a tuple of (key, value).
|
|
44
|
-
return Tuple[get_args(iterable._var_type)] #
|
|
44
|
+
return Tuple[get_args(iterable._var_type)] # pyright: ignore [reportReturnType]
|
|
45
45
|
elif iterable._var_type.mro()[0] is tuple:
|
|
46
46
|
# Arg is a union of any possible values in the tuple.
|
|
47
|
-
return Union[get_args(iterable._var_type)] #
|
|
47
|
+
return Union[get_args(iterable._var_type)] # pyright: ignore [reportReturnType]
|
|
48
48
|
else:
|
|
49
49
|
return get_args(iterable._var_type)[0]
|
|
50
50
|
except Exception:
|
|
51
|
-
return Any
|
|
51
|
+
return Any # pyright: ignore [reportReturnType]
|
|
52
52
|
|
|
53
53
|
def get_index_var(self) -> Var:
|
|
54
54
|
"""Get the index var for the tag (with curly braces).
|
reflex/components/tags/tag.py
CHANGED
|
@@ -3,13 +3,33 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import dataclasses
|
|
6
|
-
from typing import Any, Dict, List, Optional, Union
|
|
6
|
+
from typing import Any, Dict, List, Optional, Sequence, Union
|
|
7
7
|
|
|
8
8
|
from reflex.event import EventChain
|
|
9
9
|
from reflex.utils import format, types
|
|
10
10
|
from reflex.vars.base import LiteralVar, Var
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
def render_prop(value: Any) -> Any:
|
|
14
|
+
"""Render the prop.
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
value: The value to render.
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
The rendered value.
|
|
21
|
+
"""
|
|
22
|
+
from reflex.components.component import BaseComponent
|
|
23
|
+
|
|
24
|
+
if isinstance(value, BaseComponent):
|
|
25
|
+
return value.render()
|
|
26
|
+
if isinstance(value, Sequence) and not isinstance(value, str):
|
|
27
|
+
return [render_prop(v) for v in value]
|
|
28
|
+
if callable(value) and not isinstance(value, Var):
|
|
29
|
+
return None
|
|
30
|
+
return value
|
|
31
|
+
|
|
32
|
+
|
|
13
33
|
@dataclasses.dataclass()
|
|
14
34
|
class Tag:
|
|
15
35
|
"""A React tag."""
|
|
@@ -49,7 +69,7 @@ class Tag:
|
|
|
49
69
|
"""Set the tag's fields.
|
|
50
70
|
|
|
51
71
|
Args:
|
|
52
|
-
kwargs: The fields to set.
|
|
72
|
+
**kwargs: The fields to set.
|
|
53
73
|
|
|
54
74
|
Returns:
|
|
55
75
|
The tag with the fields
|
|
@@ -66,7 +86,9 @@ class Tag:
|
|
|
66
86
|
Tuple[str, Any]: The field name and value.
|
|
67
87
|
"""
|
|
68
88
|
for field in dataclasses.fields(self):
|
|
69
|
-
|
|
89
|
+
rendered_value = render_prop(getattr(self, field.name))
|
|
90
|
+
if rendered_value is not None:
|
|
91
|
+
yield field.name, rendered_value
|
|
70
92
|
|
|
71
93
|
def add_props(self, **kwargs: Optional[Any]) -> Tag:
|
|
72
94
|
"""Add props to the tag.
|
reflex/config.py
CHANGED
|
@@ -12,6 +12,7 @@ import threading
|
|
|
12
12
|
import urllib.parse
|
|
13
13
|
from importlib.util import find_spec
|
|
14
14
|
from pathlib import Path
|
|
15
|
+
from types import ModuleType
|
|
15
16
|
from typing import (
|
|
16
17
|
TYPE_CHECKING,
|
|
17
18
|
Any,
|
|
@@ -26,7 +27,6 @@ from typing import (
|
|
|
26
27
|
|
|
27
28
|
from typing_extensions import Annotated, get_type_hints
|
|
28
29
|
|
|
29
|
-
from reflex.utils.console import set_log_level
|
|
30
30
|
from reflex.utils.exceptions import ConfigError, EnvironmentVarValueError
|
|
31
31
|
from reflex.utils.types import GenericType, is_union, value_inside_optional
|
|
32
32
|
|
|
@@ -390,7 +390,7 @@ class EnvVar(Generic[T]):
|
|
|
390
390
|
os.environ[self.name] = str(value)
|
|
391
391
|
|
|
392
392
|
|
|
393
|
-
class env_var: #
|
|
393
|
+
class env_var: # noqa: N801 # pyright: ignore [reportRedeclaration]
|
|
394
394
|
"""Descriptor for environment variables."""
|
|
395
395
|
|
|
396
396
|
name: str
|
|
@@ -407,7 +407,7 @@ class env_var: # type: ignore
|
|
|
407
407
|
self.default = default
|
|
408
408
|
self.internal = internal
|
|
409
409
|
|
|
410
|
-
def __set_name__(self, owner, name):
|
|
410
|
+
def __set_name__(self, owner: Any, name: str):
|
|
411
411
|
"""Set the name of the descriptor.
|
|
412
412
|
|
|
413
413
|
Args:
|
|
@@ -416,7 +416,7 @@ class env_var: # type: ignore
|
|
|
416
416
|
"""
|
|
417
417
|
self.name = name
|
|
418
418
|
|
|
419
|
-
def __get__(self, instance, owner):
|
|
419
|
+
def __get__(self, instance: Any, owner: Any):
|
|
420
420
|
"""Get the EnvVar instance.
|
|
421
421
|
|
|
422
422
|
Args:
|
|
@@ -435,7 +435,7 @@ class env_var: # type: ignore
|
|
|
435
435
|
|
|
436
436
|
if TYPE_CHECKING:
|
|
437
437
|
|
|
438
|
-
def env_var(default, internal=False) -> EnvVar:
|
|
438
|
+
def env_var(default: Any, internal: bool = False) -> EnvVar:
|
|
439
439
|
"""Typing helper for the env_var descriptor.
|
|
440
440
|
|
|
441
441
|
Args:
|
|
@@ -490,6 +490,9 @@ class EnvironmentVariables:
|
|
|
490
490
|
# The working directory for the next.js commands.
|
|
491
491
|
REFLEX_WEB_WORKDIR: EnvVar[Path] = env_var(Path(constants.Dirs.WEB))
|
|
492
492
|
|
|
493
|
+
# The working directory for the states directory.
|
|
494
|
+
REFLEX_STATES_WORKDIR: EnvVar[Path] = env_var(Path(constants.Dirs.STATES))
|
|
495
|
+
|
|
493
496
|
# Path to the alembic config file
|
|
494
497
|
ALEMBIC_CONFIG: EnvVar[ExistingPath] = env_var(Path(constants.ALEMBIC_CONFIG))
|
|
495
498
|
|
|
@@ -556,9 +559,6 @@ class EnvironmentVariables:
|
|
|
556
559
|
# Arguments to pass to the app harness driver.
|
|
557
560
|
APP_HARNESS_DRIVER_ARGS: EnvVar[str] = env_var("")
|
|
558
561
|
|
|
559
|
-
# Where to save screenshots when tests fail.
|
|
560
|
-
SCREENSHOT_DIR: EnvVar[Optional[Path]] = env_var(None)
|
|
561
|
-
|
|
562
562
|
# Whether to check for outdated package versions.
|
|
563
563
|
REFLEX_CHECK_LATEST_VERSION: EnvVar[bool] = env_var(True)
|
|
564
564
|
|
|
@@ -568,6 +568,9 @@ class EnvironmentVariables:
|
|
|
568
568
|
# The maximum size of the reflex state in kilobytes.
|
|
569
569
|
REFLEX_STATE_SIZE_LIMIT: EnvVar[int] = env_var(1000)
|
|
570
570
|
|
|
571
|
+
# Whether to use the turbopack bundler.
|
|
572
|
+
REFLEX_USE_TURBOPACK: EnvVar[bool] = env_var(True)
|
|
573
|
+
|
|
571
574
|
|
|
572
575
|
environment = EnvironmentVariables()
|
|
573
576
|
|
|
@@ -597,15 +600,17 @@ class Config(Base):
|
|
|
597
600
|
See the [configuration](https://reflex.dev/docs/getting-started/configuration/) docs for more info.
|
|
598
601
|
"""
|
|
599
602
|
|
|
600
|
-
class Config:
|
|
603
|
+
class Config: # pyright: ignore [reportIncompatibleVariableOverride]
|
|
601
604
|
"""Pydantic config for the config."""
|
|
602
605
|
|
|
603
|
-
use_enum_values = False
|
|
604
606
|
validate_assignment = True
|
|
605
607
|
|
|
606
608
|
# The name of the app (should match the name of the app directory).
|
|
607
609
|
app_name: str
|
|
608
610
|
|
|
611
|
+
# The path to the app module.
|
|
612
|
+
app_module_import: Optional[str] = None
|
|
613
|
+
|
|
609
614
|
# The log level to use.
|
|
610
615
|
loglevel: constants.LogLevel = constants.LogLevel.DEFAULT
|
|
611
616
|
|
|
@@ -698,6 +703,12 @@ class Config(Base):
|
|
|
698
703
|
# Path to file containing key-values pairs to override in the environment; Dotenv format.
|
|
699
704
|
env_file: Optional[str] = None
|
|
700
705
|
|
|
706
|
+
# Whether to display the sticky "Built with Reflex" badge on all pages.
|
|
707
|
+
show_built_with_reflex: bool = True
|
|
708
|
+
|
|
709
|
+
# Whether the app is running in the reflex cloud environment.
|
|
710
|
+
is_reflex_cloud: bool = False
|
|
711
|
+
|
|
701
712
|
def __init__(self, *args, **kwargs):
|
|
702
713
|
"""Initialize the config values.
|
|
703
714
|
|
|
@@ -720,9 +731,6 @@ class Config(Base):
|
|
|
720
731
|
self._non_default_attributes.update(kwargs)
|
|
721
732
|
self._replace_defaults(**kwargs)
|
|
722
733
|
|
|
723
|
-
# Set the log level for this process
|
|
724
|
-
set_log_level(self.loglevel)
|
|
725
|
-
|
|
726
734
|
if (
|
|
727
735
|
self.state_manager_mode == constants.StateManagerMode.REDIS
|
|
728
736
|
and not self.redis_url
|
|
@@ -731,6 +739,19 @@ class Config(Base):
|
|
|
731
739
|
"REDIS_URL is required when using the redis state manager."
|
|
732
740
|
)
|
|
733
741
|
|
|
742
|
+
@property
|
|
743
|
+
def app_module(self) -> ModuleType | None:
|
|
744
|
+
"""Return the app module if `app_module_import` is set.
|
|
745
|
+
|
|
746
|
+
Returns:
|
|
747
|
+
The app module.
|
|
748
|
+
"""
|
|
749
|
+
return (
|
|
750
|
+
importlib.import_module(self.app_module_import)
|
|
751
|
+
if self.app_module_import
|
|
752
|
+
else None
|
|
753
|
+
)
|
|
754
|
+
|
|
734
755
|
@property
|
|
735
756
|
def module(self) -> str:
|
|
736
757
|
"""Get the module name of the app.
|
|
@@ -738,6 +759,8 @@ class Config(Base):
|
|
|
738
759
|
Returns:
|
|
739
760
|
The module name.
|
|
740
761
|
"""
|
|
762
|
+
if self.app_module is not None:
|
|
763
|
+
return self.app_module.__name__
|
|
741
764
|
return ".".join([self.app_name, self.app_name])
|
|
742
765
|
|
|
743
766
|
def update_from_env(self) -> dict[str, Any]:
|
|
@@ -749,7 +772,7 @@ class Config(Base):
|
|
|
749
772
|
"""
|
|
750
773
|
if self.env_file:
|
|
751
774
|
try:
|
|
752
|
-
from dotenv import load_dotenv #
|
|
775
|
+
from dotenv import load_dotenv # pyright: ignore [reportMissingImports]
|
|
753
776
|
|
|
754
777
|
# load env file if exists
|
|
755
778
|
load_dotenv(self.env_file, override=True)
|
|
@@ -809,16 +832,16 @@ class Config(Base):
|
|
|
809
832
|
if "api_url" not in self._non_default_attributes:
|
|
810
833
|
# If running in Github Codespaces, override API_URL
|
|
811
834
|
codespace_name = os.getenv("CODESPACE_NAME")
|
|
812
|
-
|
|
835
|
+
github_codespaces_port_forwarding_domain = os.getenv(
|
|
813
836
|
"GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN"
|
|
814
837
|
)
|
|
815
838
|
# If running on Replit.com interactively, override API_URL to ensure we maintain the backend_port
|
|
816
839
|
replit_dev_domain = os.getenv("REPLIT_DEV_DOMAIN")
|
|
817
840
|
backend_port = kwargs.get("backend_port", self.backend_port)
|
|
818
|
-
if codespace_name and
|
|
841
|
+
if codespace_name and github_codespaces_port_forwarding_domain:
|
|
819
842
|
self.api_url = (
|
|
820
843
|
f"https://{codespace_name}-{kwargs.get('backend_port', self.backend_port)}"
|
|
821
|
-
f".{
|
|
844
|
+
f".{github_codespaces_port_forwarding_domain}"
|
|
822
845
|
)
|
|
823
846
|
elif replit_dev_domain and backend_port:
|
|
824
847
|
self.api_url = f"https://{replit_dev_domain}:{backend_port}"
|
|
@@ -876,7 +899,7 @@ def get_config(reload: bool = False) -> Config:
|
|
|
876
899
|
return cached_rxconfig.config
|
|
877
900
|
|
|
878
901
|
with _config_lock:
|
|
879
|
-
|
|
902
|
+
orig_sys_path = sys.path.copy()
|
|
880
903
|
sys.path.clear()
|
|
881
904
|
sys.path.append(str(Path.cwd()))
|
|
882
905
|
try:
|
|
@@ -884,9 +907,14 @@ def get_config(reload: bool = False) -> Config:
|
|
|
884
907
|
return _get_config()
|
|
885
908
|
except Exception:
|
|
886
909
|
# If the module import fails, try to import with the original sys.path.
|
|
887
|
-
sys.path.extend(
|
|
910
|
+
sys.path.extend(orig_sys_path)
|
|
888
911
|
return _get_config()
|
|
889
912
|
finally:
|
|
913
|
+
# Find any entries added to sys.path by rxconfig.py itself.
|
|
914
|
+
extra_paths = [
|
|
915
|
+
p for p in sys.path if p not in orig_sys_path and p != str(Path.cwd())
|
|
916
|
+
]
|
|
890
917
|
# Restore the original sys.path.
|
|
891
918
|
sys.path.clear()
|
|
892
|
-
sys.path.extend(
|
|
919
|
+
sys.path.extend(extra_paths)
|
|
920
|
+
sys.path.extend(orig_sys_path)
|
reflex/constants/__init__.py
CHANGED
reflex/constants/base.py
CHANGED
|
@@ -52,7 +52,7 @@ class Dirs(SimpleNamespace):
|
|
|
52
52
|
# The name of the postcss config file.
|
|
53
53
|
POSTCSS_JS = "postcss.config.js"
|
|
54
54
|
# The name of the states directory.
|
|
55
|
-
STATES = "states"
|
|
55
|
+
STATES = ".states"
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
class Reflex(SimpleNamespace):
|
|
@@ -75,6 +75,8 @@ class Reflex(SimpleNamespace):
|
|
|
75
75
|
# If user sets REFLEX_DIR envroment variable use that instead.
|
|
76
76
|
DIR = PlatformDirs(MODULE_NAME, False).user_data_path
|
|
77
77
|
|
|
78
|
+
LOGS_DIR = DIR / "logs"
|
|
79
|
+
|
|
78
80
|
# The root directory of the reflex library.
|
|
79
81
|
ROOT_DIR = Path(__file__).parents[2]
|
|
80
82
|
|
|
@@ -257,6 +259,7 @@ SESSION_STORAGE = "session_storage"
|
|
|
257
259
|
# Testing variables.
|
|
258
260
|
# Testing os env set by pytest when running a test case.
|
|
259
261
|
PYTEST_CURRENT_TEST = "PYTEST_CURRENT_TEST"
|
|
262
|
+
APP_HARNESS_FLAG = "APP_HARNESS_FLAG"
|
|
260
263
|
|
|
261
264
|
REFLEX_VAR_OPENING_TAG = "<reflex.Var>"
|
|
262
265
|
REFLEX_VAR_CLOSING_TAG = "</reflex.Var>"
|
reflex/constants/compiler.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"""Compiler variables."""
|
|
2
2
|
|
|
3
|
+
import dataclasses
|
|
3
4
|
import enum
|
|
4
5
|
from enum import Enum
|
|
5
6
|
from types import SimpleNamespace
|
|
6
7
|
|
|
7
|
-
from reflex.base import Base
|
|
8
8
|
from reflex.constants import Dirs
|
|
9
9
|
from reflex.utils.imports import ImportVar
|
|
10
10
|
|
|
@@ -28,6 +28,8 @@ class Ext(SimpleNamespace):
|
|
|
28
28
|
ZIP = ".zip"
|
|
29
29
|
# The extension for executable files on Windows.
|
|
30
30
|
EXE = ".exe"
|
|
31
|
+
# The extension for markdown files.
|
|
32
|
+
MD = ".md"
|
|
31
33
|
|
|
32
34
|
|
|
33
35
|
class CompileVars(SimpleNamespace):
|
|
@@ -149,7 +151,8 @@ class MemoizationDisposition(enum.Enum):
|
|
|
149
151
|
NEVER = "never"
|
|
150
152
|
|
|
151
153
|
|
|
152
|
-
|
|
154
|
+
@dataclasses.dataclass(frozen=True)
|
|
155
|
+
class MemoizationMode:
|
|
153
156
|
"""The mode for memoizing a Component."""
|
|
154
157
|
|
|
155
158
|
# The conditions under which the component should be memoized.
|