reflex 0.4.2a1__py3-none-any.whl → 0.4.3a2__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 -1
- reflex/.templates/apps/sidebar/README.md +3 -2
- reflex/.templates/apps/sidebar/assets/reflex_white.svg +8 -0
- reflex/.templates/apps/sidebar/code/components/sidebar.py +26 -22
- reflex/.templates/apps/sidebar/code/pages/dashboard.py +6 -5
- reflex/.templates/apps/sidebar/code/pages/settings.py +45 -6
- reflex/.templates/apps/sidebar/code/styles.py +15 -17
- reflex/.templates/apps/sidebar/code/templates/__init__.py +1 -1
- reflex/.templates/apps/sidebar/code/templates/template.py +54 -40
- reflex/.templates/jinja/custom_components/README.md.jinja2 +9 -0
- reflex/.templates/jinja/custom_components/__init__.py.jinja2 +1 -0
- reflex/.templates/jinja/custom_components/demo_app.py.jinja2 +36 -0
- reflex/.templates/jinja/custom_components/pyproject.toml.jinja2 +35 -0
- reflex/.templates/jinja/custom_components/src.py.jinja2 +57 -0
- reflex/.templates/jinja/web/utils/context.js.jinja2 +26 -6
- reflex/.templates/web/utils/state.js +206 -146
- reflex/app.py +21 -18
- reflex/compiler/compiler.py +6 -2
- reflex/compiler/templates.py +17 -0
- reflex/compiler/utils.py +2 -2
- reflex/components/core/__init__.py +2 -1
- reflex/components/core/banner.py +99 -11
- reflex/components/core/banner.pyi +215 -2
- reflex/components/el/elements/__init__.py +1 -0
- reflex/components/el/elements/forms.py +6 -0
- reflex/components/el/elements/forms.pyi +4 -0
- reflex/components/markdown/markdown.py +13 -25
- reflex/components/markdown/markdown.pyi +5 -5
- reflex/components/plotly/plotly.py +3 -0
- reflex/components/plotly/plotly.pyi +2 -0
- reflex/components/radix/primitives/drawer.py +3 -7
- reflex/components/radix/themes/components/select.py +4 -4
- reflex/components/radix/themes/components/text_field.pyi +4 -0
- reflex/constants/__init__.py +4 -0
- reflex/constants/colors.py +1 -0
- reflex/constants/compiler.py +4 -3
- reflex/constants/custom_components.py +30 -0
- reflex/custom_components/__init__.py +1 -0
- reflex/custom_components/custom_components.py +565 -0
- reflex/reflex.py +11 -2
- reflex/route.py +4 -0
- reflex/state.py +594 -124
- reflex/testing.py +6 -0
- reflex/utils/exec.py +9 -0
- reflex/utils/prerequisites.py +28 -2
- reflex/utils/telemetry.py +3 -1
- reflex/utils/types.py +23 -0
- reflex/vars.py +48 -17
- reflex/vars.pyi +8 -3
- {reflex-0.4.2a1.dist-info → reflex-0.4.3a2.dist-info}/METADATA +4 -2
- {reflex-0.4.2a1.dist-info → reflex-0.4.3a2.dist-info}/RECORD +55 -51
- {reflex-0.4.2a1.dist-info → reflex-0.4.3a2.dist-info}/WHEEL +1 -1
- reflex/components/base/bare.pyi +0 -84
- reflex/constants/base.pyi +0 -94
- reflex/constants/event.pyi +0 -59
- reflex/constants/route.pyi +0 -50
- reflex/constants/style.pyi +0 -20
- /reflex/.templates/apps/sidebar/assets/{icon.svg → reflex_black.svg} +0 -0
- {reflex-0.4.2a1.dist-info → reflex-0.4.3a2.dist-info}/LICENSE +0 -0
- {reflex-0.4.2a1.dist-info → reflex-0.4.3a2.dist-info}/entry_points.txt +0 -0
|
@@ -8,15 +8,15 @@ from hashlib import md5
|
|
|
8
8
|
from typing import Any, Callable, Dict, Union
|
|
9
9
|
|
|
10
10
|
from reflex.compiler import utils
|
|
11
|
-
from reflex.components.
|
|
11
|
+
from reflex.components.component import Component, CustomComponent
|
|
12
|
+
from reflex.components.radix.themes.layout.list import (
|
|
12
13
|
ListItem,
|
|
13
14
|
OrderedList,
|
|
14
15
|
UnorderedList,
|
|
15
16
|
)
|
|
16
|
-
from reflex.components.
|
|
17
|
-
from reflex.components.
|
|
18
|
-
from reflex.components.
|
|
19
|
-
from reflex.components.component import Component, CustomComponent
|
|
17
|
+
from reflex.components.radix.themes.typography.heading import Heading
|
|
18
|
+
from reflex.components.radix.themes.typography.link import Link
|
|
19
|
+
from reflex.components.radix.themes.typography.text import Text
|
|
20
20
|
from reflex.components.tags.tag import Tag
|
|
21
21
|
from reflex.style import Style
|
|
22
22
|
from reflex.utils import console, imports, types
|
|
@@ -50,28 +50,16 @@ def get_base_component_map() -> dict[str, Callable]:
|
|
|
50
50
|
Returns:
|
|
51
51
|
The base component map.
|
|
52
52
|
"""
|
|
53
|
-
from reflex.components.chakra.datadisplay.code import Code
|
|
54
53
|
from reflex.components.datadisplay.code import CodeBlock
|
|
54
|
+
from reflex.components.radix.themes.typography.code import Code
|
|
55
55
|
|
|
56
56
|
return {
|
|
57
|
-
"h1": lambda value: Heading.create(
|
|
58
|
-
|
|
59
|
-
),
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
),
|
|
63
|
-
"h3": lambda value: Heading.create(
|
|
64
|
-
value, as_="h3", size="lg", margin_y="0.5em"
|
|
65
|
-
),
|
|
66
|
-
"h4": lambda value: Heading.create(
|
|
67
|
-
value, as_="h4", size="md", margin_y="0.5em"
|
|
68
|
-
),
|
|
69
|
-
"h5": lambda value: Heading.create(
|
|
70
|
-
value, as_="h5", size="sm", margin_y="0.5em"
|
|
71
|
-
),
|
|
72
|
-
"h6": lambda value: Heading.create(
|
|
73
|
-
value, as_="h6", size="xs", margin_y="0.5em"
|
|
74
|
-
),
|
|
57
|
+
"h1": lambda value: Heading.create(value, as_="h1", size="6", margin_y="0.5em"),
|
|
58
|
+
"h2": lambda value: Heading.create(value, as_="h2", size="5", margin_y="0.5em"),
|
|
59
|
+
"h3": lambda value: Heading.create(value, as_="h3", size="4", margin_y="0.5em"),
|
|
60
|
+
"h4": lambda value: Heading.create(value, as_="h4", size="3", margin_y="0.5em"),
|
|
61
|
+
"h5": lambda value: Heading.create(value, as_="h5", size="2", margin_y="0.5em"),
|
|
62
|
+
"h6": lambda value: Heading.create(value, as_="h6", size="1", margin_y="0.5em"),
|
|
75
63
|
"p": lambda value: Text.create(value, margin_y="1em"),
|
|
76
64
|
"ul": lambda value: UnorderedList.create(value, margin_y="1em"), # type: ignore
|
|
77
65
|
"ol": lambda value: OrderedList.create(value, margin_y="1em"), # type: ignore
|
|
@@ -165,8 +153,8 @@ class Markdown(Component):
|
|
|
165
153
|
|
|
166
154
|
def _get_imports(self) -> imports.ImportDict:
|
|
167
155
|
# Import here to avoid circular imports.
|
|
168
|
-
from reflex.components.chakra.datadisplay.code import Code
|
|
169
156
|
from reflex.components.datadisplay.code import CodeBlock
|
|
157
|
+
from reflex.components.radix.themes.typography.code import Code
|
|
170
158
|
|
|
171
159
|
imports = super()._get_imports()
|
|
172
160
|
|
|
@@ -12,15 +12,15 @@ from functools import lru_cache
|
|
|
12
12
|
from hashlib import md5
|
|
13
13
|
from typing import Any, Callable, Dict, Union
|
|
14
14
|
from reflex.compiler import utils
|
|
15
|
-
from reflex.components.
|
|
15
|
+
from reflex.components.component import Component, CustomComponent
|
|
16
|
+
from reflex.components.radix.themes.layout.list import (
|
|
16
17
|
ListItem,
|
|
17
18
|
OrderedList,
|
|
18
19
|
UnorderedList,
|
|
19
20
|
)
|
|
20
|
-
from reflex.components.
|
|
21
|
-
from reflex.components.
|
|
22
|
-
from reflex.components.
|
|
23
|
-
from reflex.components.component import Component, CustomComponent
|
|
21
|
+
from reflex.components.radix.themes.typography.heading import Heading
|
|
22
|
+
from reflex.components.radix.themes.typography.link import Link
|
|
23
|
+
from reflex.components.radix.themes.typography.text import Text
|
|
24
24
|
from reflex.components.tags.tag import Tag
|
|
25
25
|
from reflex.style import Style
|
|
26
26
|
from reflex.utils import console, imports, types
|
|
@@ -103,6 +103,7 @@ class Plotly(PlotlyLib):
|
|
|
103
103
|
*children,
|
|
104
104
|
data: Optional[Union[Var[Figure], Figure]] = None, # type: ignore
|
|
105
105
|
layout: Optional[Union[Var[Dict], Dict]] = None,
|
|
106
|
+
config: Optional[Union[Var[Dict], Dict]] = None,
|
|
106
107
|
width: Optional[Union[Var[str], str]] = None,
|
|
107
108
|
height: Optional[Union[Var[str], str]] = None,
|
|
108
109
|
use_resize_handler: Optional[Union[Var[bool], bool]] = None,
|
|
@@ -165,6 +166,7 @@ class Plotly(PlotlyLib):
|
|
|
165
166
|
*children: The children of the component.
|
|
166
167
|
data: The figure to display. This can be a plotly figure or a plotly data json.
|
|
167
168
|
layout: The layout of the graph.
|
|
169
|
+
config: The config of the graph.
|
|
168
170
|
width: The width of the graph.
|
|
169
171
|
height: The height of the graph.
|
|
170
172
|
use_resize_handler: If true, the graph will resize when the window is resized.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""Drawer components based on Radix primitives."""
|
|
2
|
+
|
|
2
3
|
# Based on Vaul: https://github.com/emilkowalski/vaul
|
|
3
4
|
# Style based on https://ui.shadcn.com/docs/components/drawer
|
|
4
5
|
from __future__ import annotations
|
|
@@ -20,12 +21,7 @@ class DrawerComponent(RadixPrimitiveComponent):
|
|
|
20
21
|
lib_dependencies: List[str] = ["@radix-ui/react-dialog@^1.0.5"]
|
|
21
22
|
|
|
22
23
|
|
|
23
|
-
LiteralDirectionType = Literal[
|
|
24
|
-
"top",
|
|
25
|
-
"bottom",
|
|
26
|
-
"left",
|
|
27
|
-
"right",
|
|
28
|
-
]
|
|
24
|
+
LiteralDirectionType = Literal["top", "bottom", "left", "right"]
|
|
29
25
|
|
|
30
26
|
|
|
31
27
|
class DrawerRoot(DrawerComponent):
|
|
@@ -70,7 +66,7 @@ class DrawerRoot(DrawerComponent):
|
|
|
70
66
|
"""
|
|
71
67
|
return {
|
|
72
68
|
**super().get_event_triggers(),
|
|
73
|
-
EventTriggers.ON_OPEN_CHANGE: lambda e0: [e0
|
|
69
|
+
EventTriggers.ON_OPEN_CHANGE: lambda e0: [e0],
|
|
74
70
|
}
|
|
75
71
|
|
|
76
72
|
|
|
@@ -205,11 +205,11 @@ class HighLevelSelect(SelectRoot):
|
|
|
205
205
|
if prop in props
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
|
|
208
|
+
color_scheme = props.pop("color_scheme", None)
|
|
209
209
|
|
|
210
|
-
if
|
|
211
|
-
content_props["color_scheme"] =
|
|
212
|
-
trigger_props["color_scheme"] =
|
|
210
|
+
if color_scheme is not None:
|
|
211
|
+
content_props["color_scheme"] = color_scheme
|
|
212
|
+
trigger_props["color_scheme"] = color_scheme
|
|
213
213
|
|
|
214
214
|
label = props.pop("label", None)
|
|
215
215
|
|
|
@@ -256,6 +256,8 @@ class TextFieldInput(el.Input, TextFieldRoot):
|
|
|
256
256
|
checked: Optional[
|
|
257
257
|
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
258
258
|
] = None,
|
|
259
|
+
default_checked: Optional[Union[Var[bool], bool]] = None,
|
|
260
|
+
default_value: Optional[Union[Var[str], str]] = None,
|
|
259
261
|
dirname: Optional[
|
|
260
262
|
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
261
263
|
] = None,
|
|
@@ -499,6 +501,8 @@ class TextFieldInput(el.Input, TextFieldRoot):
|
|
|
499
501
|
auto_focus: Automatically focuses the input when the page loads
|
|
500
502
|
capture: Captures media from the user (camera or microphone)
|
|
501
503
|
checked: Indicates whether the input is checked (for checkboxes and radio buttons)
|
|
504
|
+
default_checked: The initial value (for checkboxes and radio buttons)
|
|
505
|
+
default_value: The initial value for a text field
|
|
502
506
|
dirname: Name part of the input to submit in 'dir' and 'name' pair when form is submitted
|
|
503
507
|
disabled: Disables the input
|
|
504
508
|
form: Associates the input with a form (by id)
|
reflex/constants/__init__.py
CHANGED
|
@@ -40,6 +40,9 @@ from .config import (
|
|
|
40
40
|
GitIgnore,
|
|
41
41
|
RequirementsTxt,
|
|
42
42
|
)
|
|
43
|
+
from .custom_components import (
|
|
44
|
+
CustomComponents,
|
|
45
|
+
)
|
|
43
46
|
from .event import Endpoint, EventTriggers, SocketEvent
|
|
44
47
|
from .installer import (
|
|
45
48
|
Bun,
|
|
@@ -67,6 +70,7 @@ __ALL__ = [
|
|
|
67
70
|
Config,
|
|
68
71
|
COOKIES,
|
|
69
72
|
ComponentName,
|
|
73
|
+
CustomComponents,
|
|
70
74
|
DefaultPage,
|
|
71
75
|
Dirs,
|
|
72
76
|
Endpoint,
|
reflex/constants/colors.py
CHANGED
reflex/constants/compiler.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""Compiler variables."""
|
|
2
|
+
|
|
2
3
|
import enum
|
|
3
4
|
from enum import Enum
|
|
4
5
|
from types import SimpleNamespace
|
|
@@ -55,13 +56,13 @@ class CompileVars(SimpleNamespace):
|
|
|
55
56
|
# The name of the function to add events to the queue.
|
|
56
57
|
ADD_EVENTS = "addEvents"
|
|
57
58
|
# The name of the var storing any connection error.
|
|
58
|
-
CONNECT_ERROR = "
|
|
59
|
+
CONNECT_ERROR = "connectErrors"
|
|
59
60
|
# The name of the function for converting a dict to an event.
|
|
60
61
|
TO_EVENT = "Event"
|
|
61
62
|
# The name of the internal on_load event.
|
|
62
|
-
ON_LOAD_INTERNAL = "on_load_internal"
|
|
63
|
+
ON_LOAD_INTERNAL = "on_load_internal_state.on_load_internal"
|
|
63
64
|
# The name of the internal event to update generic state vars.
|
|
64
|
-
UPDATE_VARS_INTERNAL = "update_vars_internal"
|
|
65
|
+
UPDATE_VARS_INTERNAL = "update_vars_internal_state.update_vars_internal"
|
|
65
66
|
|
|
66
67
|
|
|
67
68
|
class PageNames(SimpleNamespace):
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""Constants for the custom components."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from types import SimpleNamespace
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class CustomComponents(SimpleNamespace):
|
|
9
|
+
"""Constants for the custom components."""
|
|
10
|
+
|
|
11
|
+
# The name of the custom components source directory.
|
|
12
|
+
SRC_DIR = "custom_components"
|
|
13
|
+
# The name of the custom components pyproject.toml file.
|
|
14
|
+
PYPROJECT_TOML = "pyproject.toml"
|
|
15
|
+
# The name of the custom components package README file.
|
|
16
|
+
PACKAGE_README = "README.md"
|
|
17
|
+
# The name of the custom components package .gitignore file.
|
|
18
|
+
PACKAGE_GITIGNORE = ".gitignore"
|
|
19
|
+
# The name of the distribution directory as result of a build.
|
|
20
|
+
DIST_DIR = "dist"
|
|
21
|
+
# The name of the init file.
|
|
22
|
+
INIT_FILE = "__init__.py"
|
|
23
|
+
# Suffixes for the distribution files.
|
|
24
|
+
DISTRIBUTION_FILE_SUFFIXES = [".tar.gz", ".whl"]
|
|
25
|
+
# The name to the URL of python package repositories.
|
|
26
|
+
REPO_URLS = {
|
|
27
|
+
# Note: the trailing slash is required for below URLs.
|
|
28
|
+
"pypi": "https://upload.pypi.org/legacy/",
|
|
29
|
+
"testpypi": "https://test.pypi.org/legacy/",
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""The Reflex custom components."""
|