reflex 0.8.6a1__py3-none-any.whl → 0.8.7__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/vite.config.js.jinja2 +4 -1
- reflex/.templates/web/app/routes.js +0 -1
- reflex/.templates/web/utils/state.js +1 -11
- reflex/app.py +15 -23
- reflex/components/component.py +6 -4
- reflex/components/lucide/icon.py +4 -1
- reflex/components/lucide/icon.pyi +4 -1
- reflex/components/plotly/plotly.py +9 -9
- reflex/components/recharts/recharts.py +2 -2
- reflex/components/sonner/toast.py +7 -7
- reflex/components/sonner/toast.pyi +8 -8
- reflex/config.py +9 -2
- reflex/constants/base.py +2 -0
- reflex/constants/installer.py +6 -6
- reflex/constants/state.py +1 -0
- reflex/custom_components/custom_components.py +3 -3
- reflex/reflex.py +7 -6
- reflex/route.py +4 -0
- reflex/state.py +1 -1
- reflex/testing.py +3 -5
- reflex/utils/build.py +21 -3
- reflex/utils/exec.py +11 -11
- reflex/utils/frontend_skeleton.py +254 -0
- reflex/utils/js_runtimes.py +411 -0
- reflex/utils/prerequisites.py +17 -1383
- reflex/utils/rename.py +170 -0
- reflex/utils/telemetry.py +101 -10
- reflex/utils/templates.py +443 -0
- reflex/vars/base.py +3 -3
- {reflex-0.8.6a1.dist-info → reflex-0.8.7.dist-info}/METADATA +2 -2
- {reflex-0.8.6a1.dist-info → reflex-0.8.7.dist-info}/RECORD +34 -33
- reflex/.templates/web/utils/client_side_routing.js +0 -45
- reflex/components/core/client_side_routing.py +0 -70
- reflex/components/core/client_side_routing.pyi +0 -68
- {reflex-0.8.6a1.dist-info → reflex-0.8.7.dist-info}/WHEEL +0 -0
- {reflex-0.8.6a1.dist-info → reflex-0.8.7.dist-info}/entry_points.txt +0 -0
- {reflex-0.8.6a1.dist-info → reflex-0.8.7.dist-info}/licenses/LICENSE +0 -0
|
@@ -25,13 +25,13 @@ function alwaysUseReactDomServerNode() {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export default defineConfig((config) => ({
|
|
28
|
-
base: "{{base}}",
|
|
29
28
|
plugins: [
|
|
30
29
|
alwaysUseReactDomServerNode(),
|
|
31
30
|
reactRouter(),
|
|
32
31
|
safariCacheBustPlugin(),
|
|
33
32
|
],
|
|
34
33
|
build: {
|
|
34
|
+
assetsDir: "{{base}}assets".slice(1),
|
|
35
35
|
rollupOptions: {
|
|
36
36
|
jsx: {},
|
|
37
37
|
output: {
|
|
@@ -46,6 +46,9 @@ export default defineConfig((config) => ({
|
|
|
46
46
|
},
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
|
+
experimental: {
|
|
50
|
+
enableNativePlugin: false,
|
|
51
|
+
},
|
|
49
52
|
server: {
|
|
50
53
|
port: process.env.PORT,
|
|
51
54
|
watch: {
|
|
@@ -2,7 +2,6 @@ import { route } from "@react-router/dev/routes";
|
|
|
2
2
|
import { flatRoutes } from "@react-router/fs-routes";
|
|
3
3
|
|
|
4
4
|
export default [
|
|
5
|
-
route("404", "routes/[404]._index.jsx", { id: "404" }),
|
|
6
5
|
...(await flatRoutes({
|
|
7
6
|
ignoredRouteFiles: ["routes/\\[404\\]._index.jsx"],
|
|
8
7
|
})),
|
|
@@ -969,17 +969,7 @@ export const useEventLoop = (
|
|
|
969
969
|
useEffect(() => {
|
|
970
970
|
if (!sentHydrate.current) {
|
|
971
971
|
queueEvents(
|
|
972
|
-
initial_events()
|
|
973
|
-
...e,
|
|
974
|
-
router_data: {
|
|
975
|
-
pathname: location.pathname,
|
|
976
|
-
query: {
|
|
977
|
-
...Object.fromEntries(searchParams.entries()),
|
|
978
|
-
...params.current,
|
|
979
|
-
},
|
|
980
|
-
asPath: location.pathname + location.search,
|
|
981
|
-
},
|
|
982
|
-
})),
|
|
972
|
+
initial_events(),
|
|
983
973
|
socket,
|
|
984
974
|
true,
|
|
985
975
|
navigate,
|
reflex/app.py
CHANGED
|
@@ -67,10 +67,6 @@ from reflex.components.core.banner import (
|
|
|
67
67
|
connection_toaster,
|
|
68
68
|
)
|
|
69
69
|
from reflex.components.core.breakpoints import set_breakpoints
|
|
70
|
-
from reflex.components.core.client_side_routing import (
|
|
71
|
-
default_404_page,
|
|
72
|
-
wait_for_client_redirect,
|
|
73
|
-
)
|
|
74
70
|
from reflex.components.core.sticky import sticky
|
|
75
71
|
from reflex.components.core.upload import Upload, get_upload_dir
|
|
76
72
|
from reflex.components.radix import themes
|
|
@@ -109,6 +105,8 @@ from reflex.utils import (
|
|
|
109
105
|
console,
|
|
110
106
|
exceptions,
|
|
111
107
|
format,
|
|
108
|
+
frontend_skeleton,
|
|
109
|
+
js_runtimes,
|
|
112
110
|
path_ops,
|
|
113
111
|
prerequisites,
|
|
114
112
|
types,
|
|
@@ -598,10 +596,6 @@ class App(MiddlewareMixin, LifespanMixin):
|
|
|
598
596
|
"""
|
|
599
597
|
from reflex.vars.base import GLOBAL_CACHE
|
|
600
598
|
|
|
601
|
-
# For py3.9 compatibility when redis is used, we MUST add any decorator pages
|
|
602
|
-
# before compiling the app in a thread to avoid event loop error (REF-2172).
|
|
603
|
-
self._apply_decorated_pages()
|
|
604
|
-
|
|
605
599
|
self._compile(prerender_routes=is_prod_mode())
|
|
606
600
|
|
|
607
601
|
config = get_config()
|
|
@@ -777,8 +771,10 @@ class App(MiddlewareMixin, LifespanMixin):
|
|
|
777
771
|
|
|
778
772
|
if route == constants.Page404.SLUG:
|
|
779
773
|
if component is None:
|
|
780
|
-
|
|
781
|
-
|
|
774
|
+
from reflex.components.el.elements import span
|
|
775
|
+
|
|
776
|
+
component = span("404: Page not found")
|
|
777
|
+
component = self._generate_component(component)
|
|
782
778
|
title = title or constants.Page404.TITLE
|
|
783
779
|
description = description or constants.Page404.DESCRIPTION
|
|
784
780
|
image = image or constants.Page404.IMAGE
|
|
@@ -866,7 +862,7 @@ class App(MiddlewareMixin, LifespanMixin):
|
|
|
866
862
|
"""
|
|
867
863
|
from reflex.route import get_router
|
|
868
864
|
|
|
869
|
-
return get_router(list(self._unevaluated_pages))
|
|
865
|
+
return get_router(list(dict.fromkeys([*self._unevaluated_pages, *self._pages])))
|
|
870
866
|
|
|
871
867
|
def get_load_events(self, path: str) -> list[IndividualEventType[()]]:
|
|
872
868
|
"""Get the load events for a route.
|
|
@@ -992,7 +988,7 @@ class App(MiddlewareMixin, LifespanMixin):
|
|
|
992
988
|
continue
|
|
993
989
|
_frontend_packages.append(package)
|
|
994
990
|
page_imports.update(_frontend_packages)
|
|
995
|
-
|
|
991
|
+
js_runtimes.install_frontend_packages(page_imports, get_config())
|
|
996
992
|
|
|
997
993
|
def _app_root(self, app_wrappers: dict[tuple[int, str], Component]) -> Component:
|
|
998
994
|
for component in tuple(app_wrappers.values()):
|
|
@@ -1065,16 +1061,8 @@ class App(MiddlewareMixin, LifespanMixin):
|
|
|
1065
1061
|
self.app_wraps[(0, "StickyBadge")] = lambda _: memoized_badge()
|
|
1066
1062
|
|
|
1067
1063
|
def _apply_decorated_pages(self):
|
|
1068
|
-
"""Add @rx.page decorated pages to the app.
|
|
1069
|
-
|
|
1070
|
-
This has to be done in the MainThread for py38 and py39 compatibility, so the
|
|
1071
|
-
decorated pages are added to the app before the app is compiled (in a thread)
|
|
1072
|
-
to workaround REF-2172.
|
|
1073
|
-
|
|
1074
|
-
This can move back into `compile_` when py39 support is dropped.
|
|
1075
|
-
"""
|
|
1064
|
+
"""Add @rx.page decorated pages to the app."""
|
|
1076
1065
|
app_name = get_config().app_name
|
|
1077
|
-
# Add the @rx.page decorated pages to collect on_load events.
|
|
1078
1066
|
for render, kwargs in DECORATED_PAGES[app_name]:
|
|
1079
1067
|
self.add_page(render, **kwargs)
|
|
1080
1068
|
|
|
@@ -1124,6 +1112,8 @@ class App(MiddlewareMixin, LifespanMixin):
|
|
|
1124
1112
|
"""
|
|
1125
1113
|
from reflex.utils.exceptions import ReflexRuntimeError
|
|
1126
1114
|
|
|
1115
|
+
self._apply_decorated_pages()
|
|
1116
|
+
|
|
1127
1117
|
self._pages = {}
|
|
1128
1118
|
|
|
1129
1119
|
def get_compilation_time() -> str:
|
|
@@ -1320,7 +1310,9 @@ class App(MiddlewareMixin, LifespanMixin):
|
|
|
1320
1310
|
self.head_components,
|
|
1321
1311
|
html_lang=self.html_lang,
|
|
1322
1312
|
html_custom_attrs=(
|
|
1323
|
-
{
|
|
1313
|
+
{"suppressHydrationWarning": "true", **self.html_custom_attrs}
|
|
1314
|
+
if self.html_custom_attrs
|
|
1315
|
+
else {"suppressHydrationWarning": "true"}
|
|
1324
1316
|
),
|
|
1325
1317
|
)
|
|
1326
1318
|
)
|
|
@@ -1440,7 +1432,7 @@ class App(MiddlewareMixin, LifespanMixin):
|
|
|
1440
1432
|
self._get_frontend_packages(all_imports)
|
|
1441
1433
|
|
|
1442
1434
|
# Setup the react-router.config.js
|
|
1443
|
-
|
|
1435
|
+
frontend_skeleton.update_react_router_config(
|
|
1444
1436
|
prerender_routes=prerender_routes,
|
|
1445
1437
|
)
|
|
1446
1438
|
|
reflex/components/component.py
CHANGED
|
@@ -37,7 +37,7 @@ from reflex.constants import (
|
|
|
37
37
|
PageNames,
|
|
38
38
|
)
|
|
39
39
|
from reflex.constants.compiler import SpecialAttributes
|
|
40
|
-
from reflex.constants.state import FRONTEND_EVENT_STATE
|
|
40
|
+
from reflex.constants.state import FRONTEND_EVENT_STATE, MEMO_MARKER
|
|
41
41
|
from reflex.event import (
|
|
42
42
|
EventCallback,
|
|
43
43
|
EventChain,
|
|
@@ -2005,7 +2005,7 @@ class CustomComponent(Component):
|
|
|
2005
2005
|
|
|
2006
2006
|
super()._post_init(
|
|
2007
2007
|
event_triggers={
|
|
2008
|
-
key: EventChain.create(
|
|
2008
|
+
key + MEMO_MARKER: EventChain.create(
|
|
2009
2009
|
value=props[key],
|
|
2010
2010
|
args_spec=get_args_spec(key),
|
|
2011
2011
|
key=key,
|
|
@@ -2016,7 +2016,9 @@ class CustomComponent(Component):
|
|
|
2016
2016
|
)
|
|
2017
2017
|
|
|
2018
2018
|
to_camel_cased_props = {
|
|
2019
|
-
format.to_camel_case(key
|
|
2019
|
+
format.to_camel_case(key + MEMO_MARKER)
|
|
2020
|
+
for key in props
|
|
2021
|
+
if key not in event_types
|
|
2020
2022
|
}
|
|
2021
2023
|
self.get_props = lambda: to_camel_cased_props # pyright: ignore [reportIncompatibleVariableOverride]
|
|
2022
2024
|
|
|
@@ -2031,7 +2033,7 @@ class CustomComponent(Component):
|
|
|
2031
2033
|
if key not in props_types:
|
|
2032
2034
|
continue
|
|
2033
2035
|
|
|
2034
|
-
camel_cased_key = format.to_camel_case(key)
|
|
2036
|
+
camel_cased_key = format.to_camel_case(key + MEMO_MARKER)
|
|
2035
2037
|
|
|
2036
2038
|
# Get the type based on the annotation.
|
|
2037
2039
|
type_ = props_types[key]
|
reflex/components/lucide/icon.py
CHANGED
|
@@ -6,7 +6,7 @@ from reflex.utils.imports import ImportVar
|
|
|
6
6
|
from reflex.vars.base import LiteralVar, Var
|
|
7
7
|
from reflex.vars.sequence import LiteralStringVar, StringVar
|
|
8
8
|
|
|
9
|
-
LUCIDE_LIBRARY = "lucide-react@0.
|
|
9
|
+
LUCIDE_LIBRARY = "lucide-react@0.539.0"
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class LucideIconComponent(Component):
|
|
@@ -343,6 +343,7 @@ LUCIDE_ICON_LIST = [
|
|
|
343
343
|
"brain_cog",
|
|
344
344
|
"brain",
|
|
345
345
|
"brick_wall_fire",
|
|
346
|
+
"brick_wall_shield",
|
|
346
347
|
"brick_wall",
|
|
347
348
|
"briefcase_business",
|
|
348
349
|
"briefcase_conveyor_belt",
|
|
@@ -494,6 +495,7 @@ LUCIDE_ICON_LIST = [
|
|
|
494
495
|
"circle_slash_2",
|
|
495
496
|
"circle_slash",
|
|
496
497
|
"circle_small",
|
|
498
|
+
"circle_star",
|
|
497
499
|
"circle_stop",
|
|
498
500
|
"circle_user_round",
|
|
499
501
|
"circle_user",
|
|
@@ -950,6 +952,7 @@ LUCIDE_ICON_LIST = [
|
|
|
950
952
|
"japanese_yen",
|
|
951
953
|
"joystick",
|
|
952
954
|
"kanban",
|
|
955
|
+
"kayak",
|
|
953
956
|
"key_round",
|
|
954
957
|
"key_square",
|
|
955
958
|
"key",
|
|
@@ -11,7 +11,7 @@ from reflex.components.core.breakpoints import Breakpoints
|
|
|
11
11
|
from reflex.event import EventType, PointerEventInfo
|
|
12
12
|
from reflex.vars.base import Var
|
|
13
13
|
|
|
14
|
-
LUCIDE_LIBRARY = "lucide-react@0.
|
|
14
|
+
LUCIDE_LIBRARY = "lucide-react@0.539.0"
|
|
15
15
|
|
|
16
16
|
class LucideIconComponent(Component):
|
|
17
17
|
@classmethod
|
|
@@ -408,6 +408,7 @@ LUCIDE_ICON_LIST = [
|
|
|
408
408
|
"brain_cog",
|
|
409
409
|
"brain",
|
|
410
410
|
"brick_wall_fire",
|
|
411
|
+
"brick_wall_shield",
|
|
411
412
|
"brick_wall",
|
|
412
413
|
"briefcase_business",
|
|
413
414
|
"briefcase_conveyor_belt",
|
|
@@ -559,6 +560,7 @@ LUCIDE_ICON_LIST = [
|
|
|
559
560
|
"circle_slash_2",
|
|
560
561
|
"circle_slash",
|
|
561
562
|
"circle_small",
|
|
563
|
+
"circle_star",
|
|
562
564
|
"circle_stop",
|
|
563
565
|
"circle_user_round",
|
|
564
566
|
"circle_user",
|
|
@@ -1015,6 +1017,7 @@ LUCIDE_ICON_LIST = [
|
|
|
1015
1017
|
"japanese_yen",
|
|
1016
1018
|
"joystick",
|
|
1017
1019
|
"kanban",
|
|
1020
|
+
"kayak",
|
|
1018
1021
|
"key_round",
|
|
1019
1022
|
"key_square",
|
|
1020
1023
|
"key",
|
|
@@ -72,7 +72,7 @@ class Plotly(NoSSRComponent):
|
|
|
72
72
|
|
|
73
73
|
library = "react-plotly.js@2.6.0"
|
|
74
74
|
|
|
75
|
-
lib_dependencies: list[str] = ["plotly.js@3.0
|
|
75
|
+
lib_dependencies: list[str] = ["plotly.js@3.1.0"]
|
|
76
76
|
|
|
77
77
|
tag = "Plot"
|
|
78
78
|
|
|
@@ -303,7 +303,7 @@ class PlotlyBasic(Plotly):
|
|
|
303
303
|
|
|
304
304
|
library = "react-plotly.js@2.6.0"
|
|
305
305
|
|
|
306
|
-
lib_dependencies: list[str] = ["plotly.js-basic-dist-min@3.0
|
|
306
|
+
lib_dependencies: list[str] = ["plotly.js-basic-dist-min@3.1.0"]
|
|
307
307
|
|
|
308
308
|
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
309
309
|
"""Add imports for the plotly basic component.
|
|
@@ -329,7 +329,7 @@ class PlotlyCartesian(Plotly):
|
|
|
329
329
|
|
|
330
330
|
library = "react-plotly.js@2.6.0"
|
|
331
331
|
|
|
332
|
-
lib_dependencies: list[str] = ["plotly.js-cartesian-dist-min@3.0
|
|
332
|
+
lib_dependencies: list[str] = ["plotly.js-cartesian-dist-min@3.1.0"]
|
|
333
333
|
|
|
334
334
|
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
335
335
|
"""Add imports for the plotly cartesian component.
|
|
@@ -355,7 +355,7 @@ class PlotlyGeo(Plotly):
|
|
|
355
355
|
|
|
356
356
|
library = "react-plotly.js@2.6.0"
|
|
357
357
|
|
|
358
|
-
lib_dependencies: list[str] = ["plotly.js-geo-dist-min@3.0
|
|
358
|
+
lib_dependencies: list[str] = ["plotly.js-geo-dist-min@3.1.0"]
|
|
359
359
|
|
|
360
360
|
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
361
361
|
"""Add imports for the plotly geo component.
|
|
@@ -381,7 +381,7 @@ class PlotlyGl3d(Plotly):
|
|
|
381
381
|
|
|
382
382
|
library = "react-plotly.js@2.6.0"
|
|
383
383
|
|
|
384
|
-
lib_dependencies: list[str] = ["plotly.js-gl3d-dist-min@3.0
|
|
384
|
+
lib_dependencies: list[str] = ["plotly.js-gl3d-dist-min@3.1.0"]
|
|
385
385
|
|
|
386
386
|
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
387
387
|
"""Add imports for the plotly 3d component.
|
|
@@ -407,7 +407,7 @@ class PlotlyGl2d(Plotly):
|
|
|
407
407
|
|
|
408
408
|
library = "react-plotly.js@2.6.0"
|
|
409
409
|
|
|
410
|
-
lib_dependencies: list[str] = ["plotly.js-gl2d-dist-min@3.0
|
|
410
|
+
lib_dependencies: list[str] = ["plotly.js-gl2d-dist-min@3.1.0"]
|
|
411
411
|
|
|
412
412
|
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
413
413
|
"""Add imports for the plotly 2d component.
|
|
@@ -433,7 +433,7 @@ class PlotlyMapbox(Plotly):
|
|
|
433
433
|
|
|
434
434
|
library = "react-plotly.js@2.6.0"
|
|
435
435
|
|
|
436
|
-
lib_dependencies: list[str] = ["plotly.js-mapbox-dist-min@3.0
|
|
436
|
+
lib_dependencies: list[str] = ["plotly.js-mapbox-dist-min@3.1.0"]
|
|
437
437
|
|
|
438
438
|
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
439
439
|
"""Add imports for the plotly mapbox component.
|
|
@@ -459,7 +459,7 @@ class PlotlyFinance(Plotly):
|
|
|
459
459
|
|
|
460
460
|
library = "react-plotly.js@2.6.0"
|
|
461
461
|
|
|
462
|
-
lib_dependencies: list[str] = ["plotly.js-finance-dist-min@3.0
|
|
462
|
+
lib_dependencies: list[str] = ["plotly.js-finance-dist-min@3.1.0"]
|
|
463
463
|
|
|
464
464
|
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
465
465
|
"""Add imports for the plotly finance component.
|
|
@@ -485,7 +485,7 @@ class PlotlyStrict(Plotly):
|
|
|
485
485
|
|
|
486
486
|
library = "react-plotly.js@2.6.0"
|
|
487
487
|
|
|
488
|
-
lib_dependencies: list[str] = ["plotly.js-strict-dist-min@3.0
|
|
488
|
+
lib_dependencies: list[str] = ["plotly.js-strict-dist-min@3.1.0"]
|
|
489
489
|
|
|
490
490
|
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
491
491
|
"""Add imports for the plotly strict component.
|
|
@@ -8,7 +8,7 @@ from reflex.components.component import Component, MemoizationLeaf, NoSSRCompone
|
|
|
8
8
|
class Recharts(Component):
|
|
9
9
|
"""A component that wraps a recharts lib."""
|
|
10
10
|
|
|
11
|
-
library = "recharts@3.1.
|
|
11
|
+
library = "recharts@3.1.2"
|
|
12
12
|
|
|
13
13
|
def _get_style(self) -> dict:
|
|
14
14
|
return {"wrapperStyle": self.style}
|
|
@@ -17,7 +17,7 @@ class Recharts(Component):
|
|
|
17
17
|
class RechartsCharts(NoSSRComponent, MemoizationLeaf):
|
|
18
18
|
"""A component that wraps a recharts lib."""
|
|
19
19
|
|
|
20
|
-
library = "recharts@3.1.
|
|
20
|
+
library = "recharts@3.1.2"
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
LiteralAnimationEasing = Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"]
|
|
@@ -238,7 +238,7 @@ class Toaster(Component):
|
|
|
238
238
|
|
|
239
239
|
@staticmethod
|
|
240
240
|
def send_toast(
|
|
241
|
-
message: str | Var = "",
|
|
241
|
+
message: str | Var[str] = "",
|
|
242
242
|
level: str | None = None,
|
|
243
243
|
fallback_to_alert: bool = False,
|
|
244
244
|
**props,
|
|
@@ -292,7 +292,7 @@ class Toaster(Component):
|
|
|
292
292
|
return run_script(toast)
|
|
293
293
|
|
|
294
294
|
@staticmethod
|
|
295
|
-
def toast_info(message: str | Var = "", **kwargs: Any):
|
|
295
|
+
def toast_info(message: str | Var[str] = "", **kwargs: Any) -> EventSpec:
|
|
296
296
|
"""Display an info toast message.
|
|
297
297
|
|
|
298
298
|
Args:
|
|
@@ -305,7 +305,7 @@ class Toaster(Component):
|
|
|
305
305
|
return Toaster.send_toast(message, level="info", **kwargs)
|
|
306
306
|
|
|
307
307
|
@staticmethod
|
|
308
|
-
def toast_warning(message: str | Var = "", **kwargs: Any):
|
|
308
|
+
def toast_warning(message: str | Var[str] = "", **kwargs: Any) -> EventSpec:
|
|
309
309
|
"""Display a warning toast message.
|
|
310
310
|
|
|
311
311
|
Args:
|
|
@@ -318,7 +318,7 @@ class Toaster(Component):
|
|
|
318
318
|
return Toaster.send_toast(message, level="warning", **kwargs)
|
|
319
319
|
|
|
320
320
|
@staticmethod
|
|
321
|
-
def toast_error(message: str | Var = "", **kwargs: Any):
|
|
321
|
+
def toast_error(message: str | Var[str] = "", **kwargs: Any) -> EventSpec:
|
|
322
322
|
"""Display an error toast message.
|
|
323
323
|
|
|
324
324
|
Args:
|
|
@@ -331,7 +331,7 @@ class Toaster(Component):
|
|
|
331
331
|
return Toaster.send_toast(message, level="error", **kwargs)
|
|
332
332
|
|
|
333
333
|
@staticmethod
|
|
334
|
-
def toast_success(message: str | Var = "", **kwargs: Any):
|
|
334
|
+
def toast_success(message: str | Var[str] = "", **kwargs: Any) -> EventSpec:
|
|
335
335
|
"""Display a success toast message.
|
|
336
336
|
|
|
337
337
|
Args:
|
|
@@ -344,7 +344,7 @@ class Toaster(Component):
|
|
|
344
344
|
return Toaster.send_toast(message, level="success", **kwargs)
|
|
345
345
|
|
|
346
346
|
@staticmethod
|
|
347
|
-
def toast_loading(message: str | Var = "", **kwargs: Any):
|
|
347
|
+
def toast_loading(message: str | Var[str] = "", **kwargs: Any) -> EventSpec:
|
|
348
348
|
"""Display a loading toast message.
|
|
349
349
|
|
|
350
350
|
Args:
|
|
@@ -357,7 +357,7 @@ class Toaster(Component):
|
|
|
357
357
|
return Toaster.send_toast(message, level="loading", **kwargs)
|
|
358
358
|
|
|
359
359
|
@staticmethod
|
|
360
|
-
def toast_dismiss(id: Var | str | None = None):
|
|
360
|
+
def toast_dismiss(id: Var[str] | str | None = None) -> EventSpec:
|
|
361
361
|
"""Dismiss a toast.
|
|
362
362
|
|
|
363
363
|
Args:
|
|
@@ -65,23 +65,23 @@ class Toaster(Component):
|
|
|
65
65
|
def add_hooks(self) -> list[Var | str]: ...
|
|
66
66
|
@staticmethod
|
|
67
67
|
def send_toast(
|
|
68
|
-
message: str | Var = "",
|
|
68
|
+
message: str | Var[str] = "",
|
|
69
69
|
level: str | None = None,
|
|
70
70
|
fallback_to_alert: bool = False,
|
|
71
71
|
**props,
|
|
72
72
|
) -> EventSpec: ...
|
|
73
73
|
@staticmethod
|
|
74
|
-
def toast_info(message: str | Var = "", **kwargs: Any): ...
|
|
74
|
+
def toast_info(message: str | Var[str] = "", **kwargs: Any) -> EventSpec: ...
|
|
75
75
|
@staticmethod
|
|
76
|
-
def toast_warning(message: str | Var = "", **kwargs: Any): ...
|
|
76
|
+
def toast_warning(message: str | Var[str] = "", **kwargs: Any) -> EventSpec: ...
|
|
77
77
|
@staticmethod
|
|
78
|
-
def toast_error(message: str | Var = "", **kwargs: Any): ...
|
|
78
|
+
def toast_error(message: str | Var[str] = "", **kwargs: Any) -> EventSpec: ...
|
|
79
79
|
@staticmethod
|
|
80
|
-
def toast_success(message: str | Var = "", **kwargs: Any): ...
|
|
80
|
+
def toast_success(message: str | Var[str] = "", **kwargs: Any) -> EventSpec: ...
|
|
81
81
|
@staticmethod
|
|
82
|
-
def toast_loading(message: str | Var = "", **kwargs: Any): ...
|
|
82
|
+
def toast_loading(message: str | Var[str] = "", **kwargs: Any) -> EventSpec: ...
|
|
83
83
|
@staticmethod
|
|
84
|
-
def toast_dismiss(id: Var | str | None = None): ...
|
|
84
|
+
def toast_dismiss(id: Var[str] | str | None = None) -> EventSpec: ...
|
|
85
85
|
@classmethod
|
|
86
86
|
def create(
|
|
87
87
|
cls,
|
|
@@ -188,7 +188,7 @@ class ToastNamespace(ComponentNamespace):
|
|
|
188
188
|
|
|
189
189
|
@staticmethod
|
|
190
190
|
def __call__(
|
|
191
|
-
message: str | Var = "",
|
|
191
|
+
message: str | Var[str] | str = "",
|
|
192
192
|
level: str | None = None,
|
|
193
193
|
fallback_to_alert: bool = False,
|
|
194
194
|
**props,
|
reflex/config.py
CHANGED
|
@@ -254,6 +254,9 @@ class BaseConfig:
|
|
|
254
254
|
# List of fully qualified import paths of plugins to disable in the app (e.g. reflex.plugins.sitemap.SitemapPlugin).
|
|
255
255
|
disable_plugins: list[str] = dataclasses.field(default_factory=list)
|
|
256
256
|
|
|
257
|
+
# Whether to skip plugin checks.
|
|
258
|
+
_skip_plugins_checks: bool = dataclasses.field(default=False, repr=False)
|
|
259
|
+
|
|
257
260
|
_prefixes: ClassVar[list[str]] = ["REFLEX_"]
|
|
258
261
|
|
|
259
262
|
|
|
@@ -284,6 +287,9 @@ class Config(BaseConfig):
|
|
|
284
287
|
See the [configuration](https://reflex.dev/docs/getting-started/configuration/) docs for more info.
|
|
285
288
|
"""
|
|
286
289
|
|
|
290
|
+
# Track whether the app name has already been validated for this Config instance.
|
|
291
|
+
_app_name_is_valid: bool = dataclasses.field(default=False, repr=False)
|
|
292
|
+
|
|
287
293
|
def _post_init(self, **kwargs):
|
|
288
294
|
"""Post-initialization method to set up the config.
|
|
289
295
|
|
|
@@ -315,7 +321,8 @@ class Config(BaseConfig):
|
|
|
315
321
|
setattr(self, key, env_value)
|
|
316
322
|
|
|
317
323
|
# Add builtin plugins if not disabled.
|
|
318
|
-
self.
|
|
324
|
+
if not self._skip_plugins_checks:
|
|
325
|
+
self._add_builtin_plugins()
|
|
319
326
|
|
|
320
327
|
# Update default URLs if ports were set
|
|
321
328
|
kwargs.update(env_kwargs)
|
|
@@ -531,7 +538,7 @@ def _get_config() -> Config:
|
|
|
531
538
|
if not spec:
|
|
532
539
|
# we need this condition to ensure that a ModuleNotFound error is not thrown when
|
|
533
540
|
# running unit/integration tests or during `reflex init`.
|
|
534
|
-
return Config(app_name="")
|
|
541
|
+
return Config(app_name="", _skip_plugins_checks=True)
|
|
535
542
|
rxconfig = importlib.import_module(constants.Config.MODULE)
|
|
536
543
|
return rxconfig.config
|
|
537
544
|
|
reflex/constants/base.py
CHANGED
reflex/constants/installer.py
CHANGED
|
@@ -14,7 +14,7 @@ class Bun(SimpleNamespace):
|
|
|
14
14
|
"""Bun constants."""
|
|
15
15
|
|
|
16
16
|
# The Bun version.
|
|
17
|
-
VERSION = "1.2.
|
|
17
|
+
VERSION = "1.2.20"
|
|
18
18
|
|
|
19
19
|
# Min Bun Version
|
|
20
20
|
MIN_VERSION = "1.2.17"
|
|
@@ -75,7 +75,7 @@ fetch-retries=0
|
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
def _determine_react_router_version() -> str:
|
|
78
|
-
default_version = "7.
|
|
78
|
+
default_version = "7.8.0"
|
|
79
79
|
if (version := os.getenv("REACT_ROUTER_VERSION")) and version != default_version:
|
|
80
80
|
from reflex.utils import console
|
|
81
81
|
|
|
@@ -106,7 +106,7 @@ class PackageJson(SimpleNamespace):
|
|
|
106
106
|
|
|
107
107
|
DEV = "react-router dev --host"
|
|
108
108
|
EXPORT = "react-router build"
|
|
109
|
-
PROD = "
|
|
109
|
+
PROD = "sirv ./build/client --single 404.html --host"
|
|
110
110
|
|
|
111
111
|
PATH = "package.json"
|
|
112
112
|
|
|
@@ -127,7 +127,7 @@ class PackageJson(SimpleNamespace):
|
|
|
127
127
|
"react-router": cls._react_router_version,
|
|
128
128
|
"react-router-dom": cls._react_router_version,
|
|
129
129
|
"@react-router/node": cls._react_router_version,
|
|
130
|
-
"
|
|
130
|
+
"sirv-cli": "3.0.1",
|
|
131
131
|
"react": cls._react_version,
|
|
132
132
|
"react-helmet": "6.1.0",
|
|
133
133
|
"react-dom": cls._react_version,
|
|
@@ -143,11 +143,11 @@ class PackageJson(SimpleNamespace):
|
|
|
143
143
|
"postcss-import": "16.1.1",
|
|
144
144
|
"@react-router/dev": _react_router_version,
|
|
145
145
|
"@react-router/fs-routes": _react_router_version,
|
|
146
|
-
"vite": "npm:rolldown-vite@7.
|
|
146
|
+
"vite": "npm:rolldown-vite@7.1.2",
|
|
147
147
|
}
|
|
148
148
|
OVERRIDES = {
|
|
149
149
|
# This should always match the `react` version in DEPENDENCIES for recharts compatibility.
|
|
150
150
|
"react-is": _react_version,
|
|
151
151
|
"cookie": "1.0.2",
|
|
152
|
-
"vite": "npm:rolldown-vite@7.
|
|
152
|
+
"vite": "npm:rolldown-vite@7.1.2",
|
|
153
153
|
}
|
reflex/constants/state.py
CHANGED
|
@@ -15,7 +15,7 @@ import click
|
|
|
15
15
|
|
|
16
16
|
from reflex import constants
|
|
17
17
|
from reflex.constants import CustomComponents
|
|
18
|
-
from reflex.utils import console
|
|
18
|
+
from reflex.utils import console, frontend_skeleton
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def set_loglevel(ctx: Any, self: Any, value: str | None):
|
|
@@ -328,7 +328,7 @@ def init(
|
|
|
328
328
|
Raises:
|
|
329
329
|
Exit: If the pyproject.toml already exists.
|
|
330
330
|
"""
|
|
331
|
-
from reflex.utils import exec
|
|
331
|
+
from reflex.utils import exec
|
|
332
332
|
|
|
333
333
|
if CustomComponents.PYPROJECT_TOML.exists():
|
|
334
334
|
console.error(f"A {CustomComponents.PYPROJECT_TOML} already exists. Aborting.")
|
|
@@ -347,7 +347,7 @@ def init(
|
|
|
347
347
|
_populate_demo_app(name_variants)
|
|
348
348
|
|
|
349
349
|
# Initialize the .gitignore.
|
|
350
|
-
|
|
350
|
+
frontend_skeleton.initialize_gitignore(
|
|
351
351
|
gitignore_file=CustomComponents.FILE, files_to_ignore=CustomComponents.DEFAULTS
|
|
352
352
|
)
|
|
353
353
|
|
reflex/reflex.py
CHANGED
|
@@ -58,7 +58,7 @@ def _init(
|
|
|
58
58
|
ai: bool = False,
|
|
59
59
|
):
|
|
60
60
|
"""Initialize a new Reflex app in the given directory."""
|
|
61
|
-
from reflex.utils import exec, prerequisites
|
|
61
|
+
from reflex.utils import exec, frontend_skeleton, prerequisites, templates
|
|
62
62
|
|
|
63
63
|
# Show system info
|
|
64
64
|
exec.output_system_info()
|
|
@@ -80,13 +80,13 @@ def _init(
|
|
|
80
80
|
prerequisites.initialize_frontend_dependencies()
|
|
81
81
|
|
|
82
82
|
# Initialize the app.
|
|
83
|
-
template =
|
|
83
|
+
template = templates.initialize_app(app_name, template)
|
|
84
84
|
|
|
85
85
|
# Initialize the .gitignore.
|
|
86
|
-
|
|
86
|
+
frontend_skeleton.initialize_gitignore()
|
|
87
87
|
|
|
88
88
|
# Initialize the requirements.txt.
|
|
89
|
-
needs_user_manual_update =
|
|
89
|
+
needs_user_manual_update = frontend_skeleton.initialize_requirements_txt()
|
|
90
90
|
|
|
91
91
|
template_msg = f" using the {template} template" if template else ""
|
|
92
92
|
# Finish initializing the app.
|
|
@@ -371,7 +371,7 @@ def compile(dry: bool):
|
|
|
371
371
|
_init(name=get_config().app_name)
|
|
372
372
|
get_config(reload=True)
|
|
373
373
|
starting_time = time.monotonic()
|
|
374
|
-
prerequisites.
|
|
374
|
+
prerequisites.get_compiled_app(dry_run=dry)
|
|
375
375
|
elapsed_time = time.monotonic() - starting_time
|
|
376
376
|
console.success(f"App compiled successfully in {elapsed_time:.3f} seconds.")
|
|
377
377
|
|
|
@@ -737,9 +737,10 @@ def deploy(
|
|
|
737
737
|
def rename(new_name: str):
|
|
738
738
|
"""Rename the app in the current directory."""
|
|
739
739
|
from reflex.utils import prerequisites
|
|
740
|
+
from reflex.utils.rename import rename_app
|
|
740
741
|
|
|
741
742
|
prerequisites.validate_app_name(new_name)
|
|
742
|
-
|
|
743
|
+
rename_app(new_name, get_config().loglevel)
|
|
743
744
|
|
|
744
745
|
|
|
745
746
|
if TYPE_CHECKING:
|
reflex/route.py
CHANGED
|
@@ -6,6 +6,7 @@ import re
|
|
|
6
6
|
from collections.abc import Callable
|
|
7
7
|
|
|
8
8
|
from reflex import constants
|
|
9
|
+
from reflex.config import get_config
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
def verify_route_validity(route: str) -> None:
|
|
@@ -211,6 +212,9 @@ def get_router(routes: list[str]) -> Callable[[str], str | None]:
|
|
|
211
212
|
Returns:
|
|
212
213
|
The first matching route, or None if no match is found.
|
|
213
214
|
"""
|
|
215
|
+
config = get_config()
|
|
216
|
+
if config.frontend_path:
|
|
217
|
+
path = path.removeprefix(config.frontend_path)
|
|
214
218
|
path = "/" + path.removeprefix("/").removesuffix("/")
|
|
215
219
|
if path == "/index":
|
|
216
220
|
path = "/"
|
reflex/state.py
CHANGED
|
@@ -2491,7 +2491,7 @@ class OnLoadInternalState(State):
|
|
|
2491
2491
|
# Cache the app reference for subsequent calls.
|
|
2492
2492
|
if type(self)._app_ref is None:
|
|
2493
2493
|
type(self)._app_ref = app
|
|
2494
|
-
load_events = app.get_load_events(self.router.
|
|
2494
|
+
load_events = app.get_load_events(self.router.url.path)
|
|
2495
2495
|
if not load_events:
|
|
2496
2496
|
self.is_hydrated = True
|
|
2497
2497
|
return None # Fast path for navigation with no on_load events defined.
|