reflex 0.8.4a1__py3-none-any.whl → 0.8.5a1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of reflex might be problematic. Click here for more details.
- reflex/.templates/web/utils/react-theme.js +12 -17
- reflex/__init__.py +2 -9
- reflex/__init__.pyi +4 -2
- reflex/app.py +16 -10
- reflex/compiler/compiler.py +10 -3
- reflex/components/base/app_wrap.pyi +0 -1
- reflex/components/base/body.pyi +0 -2
- reflex/components/base/document.pyi +0 -12
- reflex/components/base/error_boundary.pyi +0 -2
- reflex/components/base/fragment.pyi +0 -2
- reflex/components/base/link.pyi +0 -4
- reflex/components/base/meta.pyi +0 -6
- reflex/components/base/script.py +0 -2
- reflex/components/base/script.pyi +0 -2
- reflex/components/base/strict_mode.pyi +0 -2
- reflex/components/component.py +2 -30
- reflex/components/core/auto_scroll.pyi +0 -2
- reflex/components/core/banner.pyi +0 -10
- reflex/components/core/client_side_routing.pyi +0 -2
- reflex/components/core/clipboard.py +1 -3
- reflex/components/core/clipboard.pyi +0 -2
- reflex/components/core/cond.py +0 -2
- reflex/components/core/debounce.pyi +0 -1
- reflex/components/core/helmet.pyi +0 -2
- reflex/components/core/html.pyi +0 -2
- reflex/components/core/match.py +1 -2
- reflex/components/core/sticky.pyi +0 -4
- reflex/components/core/upload.pyi +0 -10
- reflex/components/core/window_events.pyi +0 -2
- reflex/components/datadisplay/code.py +6 -4
- reflex/components/datadisplay/code.pyi +0 -4
- reflex/components/datadisplay/dataeditor.pyi +0 -2
- reflex/components/datadisplay/shiki_code_block.pyi +0 -6
- reflex/components/el/element.pyi +0 -2
- reflex/components/el/elements/base.pyi +0 -2
- reflex/components/el/elements/forms.py +5 -21
- reflex/components/el/elements/forms.pyi +0 -38
- reflex/components/el/elements/inline.pyi +0 -56
- reflex/components/el/elements/media.pyi +0 -52
- reflex/components/el/elements/metadata.pyi +0 -12
- reflex/components/el/elements/other.pyi +0 -14
- reflex/components/el/elements/scripts.pyi +0 -6
- reflex/components/el/elements/sectioning.pyi +0 -30
- reflex/components/el/elements/tables.pyi +0 -20
- reflex/components/el/elements/typography.pyi +0 -32
- reflex/components/gridjs/datatable.pyi +0 -4
- reflex/components/lucide/icon.py +12 -1
- reflex/components/lucide/icon.pyi +12 -7
- reflex/components/markdown/markdown.pyi +0 -2
- reflex/components/moment/moment.pyi +0 -2
- reflex/components/plotly/plotly.py +25 -17
- reflex/components/plotly/plotly.pyi +0 -18
- reflex/components/radix/primitives/accordion.pyi +0 -14
- reflex/components/radix/primitives/base.pyi +0 -4
- reflex/components/radix/primitives/drawer.pyi +0 -22
- reflex/components/radix/primitives/form.pyi +0 -20
- reflex/components/radix/primitives/progress.pyi +0 -10
- reflex/components/radix/primitives/slider.pyi +0 -10
- reflex/components/radix/themes/base.py +2 -4
- reflex/components/radix/themes/base.pyi +0 -15
- reflex/components/radix/themes/color_mode.pyi +0 -5
- reflex/components/radix/themes/components/alert_dialog.pyi +0 -11
- reflex/components/radix/themes/components/aspect_ratio.pyi +0 -2
- reflex/components/radix/themes/components/avatar.pyi +0 -2
- reflex/components/radix/themes/components/badge.pyi +0 -2
- reflex/components/radix/themes/components/button.pyi +0 -2
- reflex/components/radix/themes/components/callout.pyi +0 -10
- reflex/components/radix/themes/components/card.pyi +0 -2
- reflex/components/radix/themes/components/checkbox.pyi +0 -6
- reflex/components/radix/themes/components/checkbox_cards.pyi +0 -4
- reflex/components/radix/themes/components/checkbox_group.pyi +0 -4
- reflex/components/radix/themes/components/context_menu.pyi +0 -26
- reflex/components/radix/themes/components/data_list.pyi +0 -8
- reflex/components/radix/themes/components/dialog.pyi +0 -12
- reflex/components/radix/themes/components/dropdown_menu.pyi +0 -14
- reflex/components/radix/themes/components/hover_card.pyi +0 -7
- reflex/components/radix/themes/components/icon_button.pyi +0 -2
- reflex/components/radix/themes/components/inset.pyi +0 -2
- reflex/components/radix/themes/components/popover.pyi +0 -6
- reflex/components/radix/themes/components/progress.pyi +0 -2
- reflex/components/radix/themes/components/radio.pyi +0 -2
- reflex/components/radix/themes/components/radio_cards.pyi +0 -4
- reflex/components/radix/themes/components/radio_group.pyi +0 -8
- reflex/components/radix/themes/components/scroll_area.pyi +0 -2
- reflex/components/radix/themes/components/segmented_control.pyi +0 -4
- reflex/components/radix/themes/components/select.pyi +0 -18
- reflex/components/radix/themes/components/separator.pyi +0 -2
- reflex/components/radix/themes/components/skeleton.pyi +0 -2
- reflex/components/radix/themes/components/slider.pyi +0 -2
- reflex/components/radix/themes/components/spinner.pyi +0 -2
- reflex/components/radix/themes/components/switch.pyi +0 -2
- reflex/components/radix/themes/components/table.pyi +0 -14
- reflex/components/radix/themes/components/tabs.pyi +0 -10
- reflex/components/radix/themes/components/text_area.pyi +0 -2
- reflex/components/radix/themes/components/text_field.pyi +0 -6
- reflex/components/radix/themes/components/tooltip.pyi +0 -2
- reflex/components/radix/themes/layout/base.pyi +0 -2
- reflex/components/radix/themes/layout/box.pyi +0 -2
- reflex/components/radix/themes/layout/center.pyi +0 -2
- reflex/components/radix/themes/layout/container.pyi +0 -1
- reflex/components/radix/themes/layout/flex.pyi +0 -2
- reflex/components/radix/themes/layout/grid.pyi +0 -2
- reflex/components/radix/themes/layout/list.pyi +0 -10
- reflex/components/radix/themes/layout/section.pyi +0 -2
- reflex/components/radix/themes/layout/spacer.pyi +0 -2
- reflex/components/radix/themes/layout/stack.pyi +0 -6
- reflex/components/radix/themes/typography/blockquote.pyi +0 -2
- reflex/components/radix/themes/typography/code.pyi +0 -2
- reflex/components/radix/themes/typography/heading.pyi +0 -2
- reflex/components/radix/themes/typography/link.pyi +0 -2
- reflex/components/radix/themes/typography/text.pyi +0 -14
- reflex/components/react_player/audio.pyi +0 -2
- reflex/components/react_player/react_player.pyi +0 -2
- reflex/components/react_player/video.pyi +0 -2
- reflex/components/react_router/dom.pyi +0 -2
- reflex/components/recharts/cartesian.pyi +0 -38
- reflex/components/recharts/charts.pyi +0 -24
- reflex/components/recharts/general.pyi +0 -12
- reflex/components/recharts/polar.pyi +0 -12
- reflex/components/recharts/recharts.pyi +0 -4
- reflex/components/sonner/toast.pyi +0 -2
- reflex/components/tags/cond_tag.py +4 -3
- reflex/components/tags/iter_tag.py +1 -1
- reflex/components/tags/match_tag.py +3 -2
- reflex/components/tags/tag.py +39 -40
- reflex/constants/compiler.py +0 -8
- reflex/constants/installer.py +5 -5
- reflex/event.py +77 -15
- reflex/page.py +62 -4
- reflex/reflex.py +2 -5
- reflex/utils/misc.py +0 -3
- reflex/utils/net.py +7 -2
- reflex/utils/prerequisites.py +8 -71
- reflex/utils/processes.py +6 -6
- {reflex-0.8.4a1.dist-info → reflex-0.8.5a1.dist-info}/METADATA +2 -2
- {reflex-0.8.4a1.dist-info → reflex-0.8.5a1.dist-info}/RECORD +139 -143
- reflex/components/el/constants/__init__.py +0 -5
- reflex/components/el/constants/html.py +0 -343
- reflex/components/el/constants/react.py +0 -501
- reflex/components/el/constants/reflex.py +0 -51
- {reflex-0.8.4a1.dist-info → reflex-0.8.5a1.dist-info}/WHEEL +0 -0
- {reflex-0.8.4a1.dist-info → reflex-0.8.5a1.dist-info}/entry_points.txt +0 -0
- {reflex-0.8.4a1.dist-info → reflex-0.8.5a1.dist-info}/licenses/LICENSE +0 -0
reflex/page.py
CHANGED
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import sys
|
|
5
6
|
from collections import defaultdict
|
|
6
|
-
from
|
|
7
|
-
from typing import Any
|
|
7
|
+
from typing import TYPE_CHECKING
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
from
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from collections.abc import Callable
|
|
11
|
+
from typing import Any
|
|
12
|
+
|
|
13
|
+
from reflex.event import EventType
|
|
11
14
|
|
|
12
15
|
DECORATED_PAGES: dict[str, list] = defaultdict(list)
|
|
13
16
|
|
|
@@ -42,6 +45,7 @@ def page(
|
|
|
42
45
|
Returns:
|
|
43
46
|
The decorated function.
|
|
44
47
|
"""
|
|
48
|
+
from reflex.config import get_config
|
|
45
49
|
|
|
46
50
|
def decorator(render_fn: Callable):
|
|
47
51
|
kwargs = {}
|
|
@@ -65,3 +69,57 @@ def page(
|
|
|
65
69
|
return render_fn
|
|
66
70
|
|
|
67
71
|
return decorator
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class PageNamespace:
|
|
75
|
+
"""A namespace for page names."""
|
|
76
|
+
|
|
77
|
+
DECORATED_PAGES = DECORATED_PAGES
|
|
78
|
+
|
|
79
|
+
def __new__(
|
|
80
|
+
cls,
|
|
81
|
+
route: str | None = None,
|
|
82
|
+
title: str | None = None,
|
|
83
|
+
image: str | None = None,
|
|
84
|
+
description: str | None = None,
|
|
85
|
+
meta: list[Any] | None = None,
|
|
86
|
+
script_tags: list[Any] | None = None,
|
|
87
|
+
on_load: EventType[()] | None = None,
|
|
88
|
+
):
|
|
89
|
+
"""Decorate a function as a page.
|
|
90
|
+
|
|
91
|
+
rx.App() will automatically call add_page() for any method decorated with page
|
|
92
|
+
when App.compile is called.
|
|
93
|
+
|
|
94
|
+
All defaults are None because they will use the one from add_page().
|
|
95
|
+
|
|
96
|
+
Note: the decorated functions still need to be imported.
|
|
97
|
+
|
|
98
|
+
Args:
|
|
99
|
+
route: The route to reach the page.
|
|
100
|
+
title: The title of the page.
|
|
101
|
+
image: The favicon of the page.
|
|
102
|
+
description: The description of the page.
|
|
103
|
+
meta: Additional meta to add to the page.
|
|
104
|
+
on_load: The event handler(s) called when the page load.
|
|
105
|
+
script_tags: scripts to attach to the page
|
|
106
|
+
|
|
107
|
+
Returns:
|
|
108
|
+
The decorated function.
|
|
109
|
+
"""
|
|
110
|
+
return page(
|
|
111
|
+
route=route,
|
|
112
|
+
title=title,
|
|
113
|
+
image=image,
|
|
114
|
+
description=description,
|
|
115
|
+
meta=meta,
|
|
116
|
+
script_tags=script_tags,
|
|
117
|
+
on_load=on_load,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
page = staticmethod(page)
|
|
121
|
+
__file__ = __file__
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
page_namespace = PageNamespace
|
|
125
|
+
sys.modules[__name__] = page_namespace # pyright: ignore[reportArgumentType]
|
reflex/reflex.py
CHANGED
|
@@ -216,12 +216,9 @@ def _run(
|
|
|
216
216
|
*args,
|
|
217
217
|
**kwargs,
|
|
218
218
|
)
|
|
219
|
-
|
|
219
|
+
compile_future.result()
|
|
220
220
|
else:
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
if not validation_result:
|
|
224
|
-
raise click.exceptions.Exit(1)
|
|
221
|
+
app_task(*args, **kwargs)
|
|
225
222
|
|
|
226
223
|
# Get the frontend and backend commands, based on the environment.
|
|
227
224
|
setup_frontend = frontend_cmd = backend_cmd = None
|
reflex/utils/misc.py
CHANGED
|
@@ -113,8 +113,6 @@ if (typeof document !== 'undefined') {
|
|
|
113
113
|
const systemPreference = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
114
114
|
const resolvedTheme = theme === "system" ? systemPreference : theme;
|
|
115
115
|
|
|
116
|
-
console.log("[PRELOAD] Theme applied:", resolvedTheme, "from theme:", theme, "system:", systemPreference);
|
|
117
|
-
|
|
118
116
|
// Apply theme immediately - blocks until complete
|
|
119
117
|
// Use classList to avoid overwriting other classes
|
|
120
118
|
document.documentElement.classList.remove("light", "dark");
|
|
@@ -124,7 +122,6 @@ if (typeof document !== 'undefined') {
|
|
|
124
122
|
} catch (e) {
|
|
125
123
|
// Fallback to system preference on any error (resolve "system" to actual theme)
|
|
126
124
|
const fallbackTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
127
|
-
console.log("[PRELOAD] Error, falling back to:", fallbackTheme);
|
|
128
125
|
document.documentElement.classList.remove("light", "dark");
|
|
129
126
|
document.documentElement.classList.add(fallbackTheme);
|
|
130
127
|
document.documentElement.style.colorScheme = fallbackTheme;
|
reflex/utils/net.py
CHANGED
|
@@ -152,14 +152,19 @@ def _httpx_client():
|
|
|
152
152
|
import httpx
|
|
153
153
|
from httpx._utils import get_environment_proxies
|
|
154
154
|
|
|
155
|
+
verify_setting = _httpx_verify_kwarg()
|
|
155
156
|
return httpx.Client(
|
|
156
157
|
transport=httpx.HTTPTransport(
|
|
157
158
|
local_address=_httpx_local_address_kwarg(),
|
|
158
|
-
verify=
|
|
159
|
+
verify=verify_setting,
|
|
159
160
|
),
|
|
160
161
|
mounts={
|
|
161
162
|
key: (
|
|
162
|
-
None
|
|
163
|
+
None
|
|
164
|
+
if url is None
|
|
165
|
+
else httpx.HTTPTransport(
|
|
166
|
+
proxy=httpx.Proxy(url=url), verify=verify_setting
|
|
167
|
+
)
|
|
163
168
|
)
|
|
164
169
|
for key, url in get_environment_proxies().items()
|
|
165
170
|
},
|
reflex/utils/prerequisites.py
CHANGED
|
@@ -7,8 +7,6 @@ import dataclasses
|
|
|
7
7
|
import functools
|
|
8
8
|
import importlib
|
|
9
9
|
import importlib.metadata
|
|
10
|
-
import importlib.util
|
|
11
|
-
import io
|
|
12
10
|
import json
|
|
13
11
|
import os
|
|
14
12
|
import platform
|
|
@@ -498,86 +496,25 @@ def compile_app(
|
|
|
498
496
|
)
|
|
499
497
|
|
|
500
498
|
|
|
501
|
-
def _can_colorize() -> bool:
|
|
502
|
-
"""Check if the output can be colorized.
|
|
503
|
-
|
|
504
|
-
Copied from _colorize.can_colorize.
|
|
505
|
-
|
|
506
|
-
https://raw.githubusercontent.com/python/cpython/refs/heads/main/Lib/_colorize.py
|
|
507
|
-
|
|
508
|
-
Returns:
|
|
509
|
-
If the output can be colorized
|
|
510
|
-
"""
|
|
511
|
-
file = sys.stdout
|
|
512
|
-
|
|
513
|
-
if not sys.flags.ignore_environment:
|
|
514
|
-
if os.environ.get("PYTHON_COLORS") == "0":
|
|
515
|
-
return False
|
|
516
|
-
if os.environ.get("PYTHON_COLORS") == "1":
|
|
517
|
-
return True
|
|
518
|
-
if os.environ.get("NO_COLOR"):
|
|
519
|
-
return False
|
|
520
|
-
if os.environ.get("FORCE_COLOR"):
|
|
521
|
-
return True
|
|
522
|
-
if os.environ.get("TERM") == "dumb":
|
|
523
|
-
return False
|
|
524
|
-
|
|
525
|
-
if not hasattr(file, "fileno"):
|
|
526
|
-
return False
|
|
527
|
-
|
|
528
|
-
if sys.platform == "win32":
|
|
529
|
-
try:
|
|
530
|
-
import nt
|
|
531
|
-
|
|
532
|
-
if not nt._supports_virtual_terminal():
|
|
533
|
-
return False
|
|
534
|
-
except (ImportError, AttributeError):
|
|
535
|
-
return False
|
|
536
|
-
|
|
537
|
-
try:
|
|
538
|
-
return os.isatty(file.fileno())
|
|
539
|
-
except io.UnsupportedOperation:
|
|
540
|
-
return file.isatty()
|
|
541
|
-
|
|
542
|
-
|
|
543
499
|
def compile_or_validate_app(
|
|
544
500
|
compile: bool = False,
|
|
545
501
|
check_if_schema_up_to_date: bool = False,
|
|
546
502
|
prerender_routes: bool = False,
|
|
547
|
-
)
|
|
503
|
+
):
|
|
548
504
|
"""Compile or validate the app module based on the default config.
|
|
549
505
|
|
|
550
506
|
Args:
|
|
551
507
|
compile: Whether to compile the app.
|
|
552
508
|
check_if_schema_up_to_date: If True, check if the schema is up to date.
|
|
553
509
|
prerender_routes: Whether to prerender routes.
|
|
554
|
-
|
|
555
|
-
Returns:
|
|
556
|
-
If the app is compiled successfully.
|
|
557
510
|
"""
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
validate_app(check_if_schema_up_to_date=check_if_schema_up_to_date)
|
|
566
|
-
except Exception as e:
|
|
567
|
-
if isinstance(e, click.exceptions.Exit):
|
|
568
|
-
return False
|
|
569
|
-
|
|
570
|
-
import traceback
|
|
571
|
-
|
|
572
|
-
sys_exception = sys.exception()
|
|
573
|
-
|
|
574
|
-
try:
|
|
575
|
-
colorize = _can_colorize()
|
|
576
|
-
traceback.print_exception(e, colorize=colorize) # pyright: ignore[reportCallIssue]
|
|
577
|
-
except Exception:
|
|
578
|
-
traceback.print_exception(sys_exception)
|
|
579
|
-
return False
|
|
580
|
-
return True
|
|
511
|
+
if compile:
|
|
512
|
+
compile_app(
|
|
513
|
+
check_if_schema_up_to_date=check_if_schema_up_to_date,
|
|
514
|
+
prerender_routes=prerender_routes,
|
|
515
|
+
)
|
|
516
|
+
else:
|
|
517
|
+
validate_app(check_if_schema_up_to_date=check_if_schema_up_to_date)
|
|
581
518
|
|
|
582
519
|
|
|
583
520
|
def get_redis() -> Redis | None:
|
reflex/utils/processes.py
CHANGED
|
@@ -87,13 +87,13 @@ def _can_bind_at_any_port(address_family: socket.AddressFamily | int) -> bool:
|
|
|
87
87
|
Returns:
|
|
88
88
|
Whether any port is available for binding.
|
|
89
89
|
"""
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
try:
|
|
91
|
+
with closing(socket.socket(address_family, socket.SOCK_STREAM)) as sock:
|
|
92
92
|
sock.bind(("", 0)) # Bind to any available port
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
return True
|
|
94
|
+
except (OverflowError, PermissionError, OSError) as e:
|
|
95
|
+
console.debug(f"Unable to bind to any port for {address_family}: {e}")
|
|
96
|
+
return False
|
|
97
97
|
|
|
98
98
|
|
|
99
99
|
def is_process_on_port(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: reflex
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.5a1
|
|
4
4
|
Summary: Web apps in pure Python.
|
|
5
5
|
Project-URL: homepage, https://reflex.dev
|
|
6
6
|
Project-URL: repository, https://github.com/reflex-dev/reflex
|
|
@@ -30,7 +30,7 @@ Requires-Dist: pydantic<3.0,>=1.10.21
|
|
|
30
30
|
Requires-Dist: python-multipart<1.0,>=0.0.20
|
|
31
31
|
Requires-Dist: python-socketio<6.0,>=5.12.0
|
|
32
32
|
Requires-Dist: redis<7.0,>=5.2.1
|
|
33
|
-
Requires-Dist: reflex-hosting-cli>=0.1.
|
|
33
|
+
Requires-Dist: reflex-hosting-cli>=0.1.53
|
|
34
34
|
Requires-Dist: rich<15,>=13
|
|
35
35
|
Requires-Dist: sqlmodel<0.1,>=0.0.24
|
|
36
36
|
Requires-Dist: starlette>=0.47.0
|