reflex 0.4.6a4__py3-none-any.whl → 0.4.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/apps/blank/code/blank.py +1 -0
- reflex/.templates/jinja/custom_components/pyproject.toml.jinja2 +1 -1
- reflex/.templates/jinja/custom_components/src.py.jinja2 +8 -8
- reflex/.templates/jinja/web/pages/index.js.jinja2 +0 -4
- reflex/.templates/jinja/web/pages/stateful_component.js.jinja2 +2 -6
- reflex/.templates/web/utils/state.js +6 -1
- reflex/__init__.py +2 -0
- reflex/__init__.pyi +2 -0
- reflex/app.py +12 -16
- reflex/app.pyi +2 -0
- reflex/compiler/compiler.py +10 -11
- reflex/compiler/utils.py +3 -3
- reflex/components/chakra/forms/pininput.py +2 -1
- reflex/components/component.py +71 -104
- reflex/components/core/banner.py +1 -1
- reflex/components/core/upload.py +2 -1
- reflex/components/datadisplay/__init__.py +1 -0
- reflex/components/datadisplay/logo.py +49 -0
- reflex/components/el/elements/forms.py +7 -4
- reflex/components/el/elements/forms.pyi +0 -1
- reflex/components/lucide/icon.py +3 -2
- reflex/components/lucide/icon.pyi +2 -2
- reflex/components/markdown/markdown.py +10 -6
- reflex/components/markdown/markdown.pyi +0 -3
- reflex/components/radix/themes/components/select.py +10 -3
- reflex/config.py +1 -1
- reflex/config.pyi +1 -1
- reflex/constants/base.py +4 -5
- reflex/constants/base.pyi +94 -0
- reflex/constants/compiler.py +8 -0
- reflex/custom_components/custom_components.py +33 -38
- reflex/experimental/__init__.py +14 -0
- reflex/experimental/hooks.py +75 -0
- reflex/page.py +1 -1
- reflex/reflex.py +18 -32
- reflex/style.py +4 -4
- reflex/testing.py +1 -1
- reflex/utils/console.py +6 -4
- reflex/utils/exec.py +17 -1
- reflex/utils/export.py +0 -3
- reflex/utils/prerequisites.py +243 -43
- reflex/utils/processes.py +6 -1
- reflex/utils/telemetry.py +14 -2
- reflex/utils/types.py +3 -2
- reflex/vars.py +6 -6
- reflex/vars.pyi +2 -1
- {reflex-0.4.6a4.dist-info → reflex-0.4.7.dist-info}/METADATA +15 -10
- {reflex-0.4.6a4.dist-info → reflex-0.4.7.dist-info}/RECORD +51 -65
- {reflex-0.4.6a4.dist-info → reflex-0.4.7.dist-info}/WHEEL +1 -1
- reflex/.templates/apps/sidebar/README.md +0 -69
- reflex/.templates/apps/sidebar/assets/favicon.ico +0 -0
- reflex/.templates/apps/sidebar/assets/github.svg +0 -10
- reflex/.templates/apps/sidebar/assets/logo.svg +0 -68
- reflex/.templates/apps/sidebar/assets/paneleft.svg +0 -13
- reflex/.templates/apps/sidebar/assets/reflex_black.svg +0 -37
- reflex/.templates/apps/sidebar/assets/reflex_white.svg +0 -8
- reflex/.templates/apps/sidebar/code/__init__.py +0 -1
- reflex/.templates/apps/sidebar/code/components/__init__.py +0 -0
- reflex/.templates/apps/sidebar/code/components/sidebar.py +0 -152
- reflex/.templates/apps/sidebar/code/pages/__init__.py +0 -3
- reflex/.templates/apps/sidebar/code/pages/dashboard.py +0 -22
- reflex/.templates/apps/sidebar/code/pages/index.py +0 -18
- reflex/.templates/apps/sidebar/code/pages/settings.py +0 -61
- reflex/.templates/apps/sidebar/code/sidebar.py +0 -16
- reflex/.templates/apps/sidebar/code/styles.py +0 -60
- reflex/.templates/apps/sidebar/code/templates/__init__.py +0 -1
- reflex/.templates/apps/sidebar/code/templates/template.py +0 -145
- {reflex-0.4.6a4.dist-info → reflex-0.4.7.dist-info}/LICENSE +0 -0
- {reflex-0.4.6a4.dist-info → reflex-0.4.7.dist-info}/entry_points.txt +0 -0
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"""The dashboard page."""
|
|
2
|
-
|
|
3
|
-
from code.templates import template
|
|
4
|
-
|
|
5
|
-
import reflex as rx
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@template(route="/dashboard", title="Dashboard")
|
|
9
|
-
def dashboard() -> rx.Component:
|
|
10
|
-
"""The dashboard page.
|
|
11
|
-
|
|
12
|
-
Returns:
|
|
13
|
-
The UI for the dashboard page.
|
|
14
|
-
"""
|
|
15
|
-
return rx.vstack(
|
|
16
|
-
rx.heading("Dashboard", size="8"),
|
|
17
|
-
rx.text("Welcome to Reflex!"),
|
|
18
|
-
rx.text(
|
|
19
|
-
"You can edit this page in ",
|
|
20
|
-
rx.code("{your_app}/pages/dashboard.py"),
|
|
21
|
-
),
|
|
22
|
-
)
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"""The home page of the app."""
|
|
2
|
-
|
|
3
|
-
from code import styles
|
|
4
|
-
from code.templates import template
|
|
5
|
-
|
|
6
|
-
import reflex as rx
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
@template(route="/", title="Home", image="/github.svg")
|
|
10
|
-
def index() -> rx.Component:
|
|
11
|
-
"""The home page.
|
|
12
|
-
|
|
13
|
-
Returns:
|
|
14
|
-
The UI for the home page.
|
|
15
|
-
"""
|
|
16
|
-
with open("README.md", encoding="utf-8") as readme:
|
|
17
|
-
content = readme.read()
|
|
18
|
-
return rx.markdown(content, component_map=styles.markdown_style)
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"""The settings page."""
|
|
2
|
-
|
|
3
|
-
from code.templates import ThemeState, template
|
|
4
|
-
|
|
5
|
-
import reflex as rx
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@template(route="/settings", title="Settings")
|
|
9
|
-
def settings() -> rx.Component:
|
|
10
|
-
"""The settings page.
|
|
11
|
-
|
|
12
|
-
Returns:
|
|
13
|
-
The UI for the settings page.
|
|
14
|
-
"""
|
|
15
|
-
return rx.vstack(
|
|
16
|
-
rx.heading("Settings", size="8"),
|
|
17
|
-
rx.hstack(
|
|
18
|
-
rx.text("Dark mode: "),
|
|
19
|
-
rx.color_mode.switch(),
|
|
20
|
-
),
|
|
21
|
-
rx.hstack(
|
|
22
|
-
rx.text("Theme color: "),
|
|
23
|
-
rx.select(
|
|
24
|
-
[
|
|
25
|
-
"tomato",
|
|
26
|
-
"red",
|
|
27
|
-
"ruby",
|
|
28
|
-
"crimson",
|
|
29
|
-
"pink",
|
|
30
|
-
"plum",
|
|
31
|
-
"purple",
|
|
32
|
-
"violet",
|
|
33
|
-
"iris",
|
|
34
|
-
"indigo",
|
|
35
|
-
"blue",
|
|
36
|
-
"cyan",
|
|
37
|
-
"teal",
|
|
38
|
-
"jade",
|
|
39
|
-
"green",
|
|
40
|
-
"grass",
|
|
41
|
-
"brown",
|
|
42
|
-
"orange",
|
|
43
|
-
"sky",
|
|
44
|
-
"mint",
|
|
45
|
-
"lime",
|
|
46
|
-
"yellow",
|
|
47
|
-
"amber",
|
|
48
|
-
"gold",
|
|
49
|
-
"bronze",
|
|
50
|
-
"gray",
|
|
51
|
-
],
|
|
52
|
-
value=ThemeState.accent_color,
|
|
53
|
-
on_change=ThemeState.set_accent_color,
|
|
54
|
-
),
|
|
55
|
-
),
|
|
56
|
-
rx.text(
|
|
57
|
-
"You can edit this page in ",
|
|
58
|
-
rx.code("{your_app}/pages/settings.py"),
|
|
59
|
-
size="1",
|
|
60
|
-
),
|
|
61
|
-
)
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"""Welcome to Reflex!."""
|
|
2
|
-
|
|
3
|
-
from code import styles
|
|
4
|
-
|
|
5
|
-
# Import all the pages.
|
|
6
|
-
from code.pages import *
|
|
7
|
-
|
|
8
|
-
import reflex as rx
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class State(rx.State):
|
|
12
|
-
"""Define empty state to allow access to rx.State.router."""
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
# Create the app.
|
|
16
|
-
app = rx.App(style=styles.base_style)
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"""Styles for the app."""
|
|
2
|
-
|
|
3
|
-
import reflex as rx
|
|
4
|
-
|
|
5
|
-
border_radius = "0.375rem"
|
|
6
|
-
box_shadow = "0px 0px 0px 1px rgba(84, 82, 95, 0.14)"
|
|
7
|
-
border = f"1px solid {rx.color('accent', 12)}"
|
|
8
|
-
text_color = rx.color("gray", 11)
|
|
9
|
-
accent_text_color = rx.color("accent", 10)
|
|
10
|
-
accent_color = rx.color("accent", 1)
|
|
11
|
-
hover_accent_color = {"_hover": {"color": accent_text_color}}
|
|
12
|
-
hover_accent_bg = {"_hover": {"background_color": accent_color}}
|
|
13
|
-
content_width_vw = "90vw"
|
|
14
|
-
sidebar_width = "20em"
|
|
15
|
-
|
|
16
|
-
template_page_style = {"padding_top": "5em", "padding_x": ["auto", "2em"], "flex": "1"}
|
|
17
|
-
|
|
18
|
-
template_content_style = {
|
|
19
|
-
"align_items": "flex-start",
|
|
20
|
-
"box_shadow": box_shadow,
|
|
21
|
-
"border_radius": border_radius,
|
|
22
|
-
"padding": "1em",
|
|
23
|
-
"margin_bottom": "2em",
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
link_style = {
|
|
27
|
-
"color": accent_text_color,
|
|
28
|
-
"text_decoration": "none",
|
|
29
|
-
**hover_accent_color,
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
overlapping_button_style = {
|
|
33
|
-
"background_color": "white",
|
|
34
|
-
"border": border,
|
|
35
|
-
"border_radius": border_radius,
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
base_style = {
|
|
39
|
-
rx.menu.trigger: {
|
|
40
|
-
**overlapping_button_style,
|
|
41
|
-
},
|
|
42
|
-
rx.menu.item: hover_accent_bg,
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
markdown_style = {
|
|
46
|
-
"code": lambda text: rx.code(text, color=accent_text_color, bg=accent_color),
|
|
47
|
-
"a": lambda text, **props: rx.link(
|
|
48
|
-
text,
|
|
49
|
-
**props,
|
|
50
|
-
font_weight="bold",
|
|
51
|
-
color=accent_text_color,
|
|
52
|
-
text_decoration="underline",
|
|
53
|
-
text_decoration_color=accent_text_color,
|
|
54
|
-
_hover={
|
|
55
|
-
"color": accent_color,
|
|
56
|
-
"text_decoration": "underline",
|
|
57
|
-
"text_decoration_color": accent_color,
|
|
58
|
-
},
|
|
59
|
-
),
|
|
60
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .template import ThemeState, template
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"""Common templates used between pages in the app."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
from code import styles
|
|
6
|
-
from code.components.sidebar import sidebar
|
|
7
|
-
from typing import Callable
|
|
8
|
-
|
|
9
|
-
import reflex as rx
|
|
10
|
-
|
|
11
|
-
# Meta tags for the app.
|
|
12
|
-
default_meta = [
|
|
13
|
-
{
|
|
14
|
-
"name": "viewport",
|
|
15
|
-
"content": "width=device-width, shrink-to-fit=no, initial-scale=1",
|
|
16
|
-
},
|
|
17
|
-
]
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def menu_item_link(text, href):
|
|
21
|
-
return rx.menu.item(
|
|
22
|
-
rx.link(
|
|
23
|
-
text,
|
|
24
|
-
href=href,
|
|
25
|
-
width="100%",
|
|
26
|
-
color="inherit",
|
|
27
|
-
),
|
|
28
|
-
_hover={
|
|
29
|
-
"color": styles.accent_color,
|
|
30
|
-
"background_color": styles.accent_text_color,
|
|
31
|
-
},
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def menu_button() -> rx.Component:
|
|
36
|
-
"""The menu button on the top right of the page.
|
|
37
|
-
|
|
38
|
-
Returns:
|
|
39
|
-
The menu button component.
|
|
40
|
-
"""
|
|
41
|
-
from reflex.page import get_decorated_pages
|
|
42
|
-
|
|
43
|
-
return rx.box(
|
|
44
|
-
rx.menu.root(
|
|
45
|
-
rx.menu.trigger(
|
|
46
|
-
rx.icon(
|
|
47
|
-
"menu",
|
|
48
|
-
size=36,
|
|
49
|
-
color=styles.accent_text_color,
|
|
50
|
-
),
|
|
51
|
-
background_color=styles.accent_color,
|
|
52
|
-
),
|
|
53
|
-
rx.menu.content(
|
|
54
|
-
*[
|
|
55
|
-
menu_item_link(page["title"], page["route"])
|
|
56
|
-
for page in get_decorated_pages()
|
|
57
|
-
],
|
|
58
|
-
rx.menu.separator(),
|
|
59
|
-
menu_item_link("About", "https://github.com/reflex-dev"),
|
|
60
|
-
menu_item_link("Contact", "mailto:founders@=reflex.dev"),
|
|
61
|
-
),
|
|
62
|
-
),
|
|
63
|
-
position="fixed",
|
|
64
|
-
right="1.5em",
|
|
65
|
-
top="1.5em",
|
|
66
|
-
z_index="500",
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
class ThemeState(rx.State):
|
|
71
|
-
"""The state for the theme of the app."""
|
|
72
|
-
|
|
73
|
-
accent_color: str = "crimson"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
def template(
|
|
77
|
-
route: str | None = None,
|
|
78
|
-
title: str | None = None,
|
|
79
|
-
image: str | None = None,
|
|
80
|
-
description: str | None = None,
|
|
81
|
-
meta: str | None = None,
|
|
82
|
-
script_tags: list[rx.Component] | None = None,
|
|
83
|
-
on_load: rx.event.EventHandler | list[rx.event.EventHandler] | None = None,
|
|
84
|
-
) -> Callable[[Callable[[], rx.Component]], rx.Component]:
|
|
85
|
-
"""The template for each page of the app.
|
|
86
|
-
|
|
87
|
-
Args:
|
|
88
|
-
route: The route to reach the page.
|
|
89
|
-
title: The title of the page.
|
|
90
|
-
image: The favicon of the page.
|
|
91
|
-
description: The description of the page.
|
|
92
|
-
meta: Additionnal meta to add to the page.
|
|
93
|
-
on_load: The event handler(s) called when the page load.
|
|
94
|
-
script_tags: Scripts to attach to the page.
|
|
95
|
-
|
|
96
|
-
Returns:
|
|
97
|
-
The template with the page content.
|
|
98
|
-
"""
|
|
99
|
-
|
|
100
|
-
def decorator(page_content: Callable[[], rx.Component]) -> rx.Component:
|
|
101
|
-
"""The template for each page of the app.
|
|
102
|
-
|
|
103
|
-
Args:
|
|
104
|
-
page_content: The content of the page.
|
|
105
|
-
|
|
106
|
-
Returns:
|
|
107
|
-
The template with the page content.
|
|
108
|
-
"""
|
|
109
|
-
# Get the meta tags for the page.
|
|
110
|
-
all_meta = [*default_meta, *(meta or [])]
|
|
111
|
-
|
|
112
|
-
def templated_page():
|
|
113
|
-
return rx.hstack(
|
|
114
|
-
sidebar(),
|
|
115
|
-
rx.box(
|
|
116
|
-
rx.box(
|
|
117
|
-
page_content(),
|
|
118
|
-
**styles.template_content_style,
|
|
119
|
-
),
|
|
120
|
-
**styles.template_page_style,
|
|
121
|
-
),
|
|
122
|
-
menu_button(),
|
|
123
|
-
align="start",
|
|
124
|
-
transition="left 0.5s, width 0.5s",
|
|
125
|
-
position="relative",
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
@rx.page(
|
|
129
|
-
route=route,
|
|
130
|
-
title=title,
|
|
131
|
-
image=image,
|
|
132
|
-
description=description,
|
|
133
|
-
meta=all_meta,
|
|
134
|
-
script_tags=script_tags,
|
|
135
|
-
on_load=on_load,
|
|
136
|
-
)
|
|
137
|
-
def theme_wrap():
|
|
138
|
-
return rx.theme(
|
|
139
|
-
templated_page(),
|
|
140
|
-
accent_color=ThemeState.accent_color,
|
|
141
|
-
)
|
|
142
|
-
|
|
143
|
-
return theme_wrap
|
|
144
|
-
|
|
145
|
-
return decorator
|
|
File without changes
|
|
File without changes
|