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
reflex/components/next/image.pyi
CHANGED
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
# ------------------------------------------------------
|
|
6
6
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
7
7
|
|
|
8
|
-
from reflex.event import
|
|
8
|
+
from reflex.event import EventType
|
|
9
9
|
from reflex.style import Style
|
|
10
10
|
from reflex.vars.base import Var
|
|
11
11
|
|
|
12
12
|
from .base import NextComponent
|
|
13
13
|
|
|
14
|
+
DEFAULT_W_H = "100%"
|
|
15
|
+
|
|
14
16
|
class Image(NextComponent):
|
|
15
17
|
@overload
|
|
16
18
|
@classmethod
|
|
@@ -30,30 +32,30 @@ class Image(NextComponent):
|
|
|
30
32
|
loading: Optional[
|
|
31
33
|
Union[Literal["eager", "lazy"], Var[Literal["eager", "lazy"]]]
|
|
32
34
|
] = None,
|
|
33
|
-
|
|
35
|
+
blur_data_url: Optional[Union[Var[str], str]] = None,
|
|
34
36
|
style: Optional[Style] = None,
|
|
35
37
|
key: Optional[Any] = None,
|
|
36
38
|
id: Optional[Any] = None,
|
|
37
39
|
class_name: Optional[Any] = None,
|
|
38
40
|
autofocus: Optional[bool] = None,
|
|
39
41
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
40
|
-
on_blur: Optional[EventType[
|
|
41
|
-
on_click: Optional[EventType[
|
|
42
|
-
on_context_menu: Optional[EventType[
|
|
43
|
-
on_double_click: Optional[EventType[
|
|
44
|
-
on_error: Optional[EventType[
|
|
45
|
-
on_focus: Optional[EventType[
|
|
46
|
-
on_load: Optional[EventType[
|
|
47
|
-
on_mount: Optional[EventType[
|
|
48
|
-
on_mouse_down: Optional[EventType[
|
|
49
|
-
on_mouse_enter: Optional[EventType[
|
|
50
|
-
on_mouse_leave: Optional[EventType[
|
|
51
|
-
on_mouse_move: Optional[EventType[
|
|
52
|
-
on_mouse_out: Optional[EventType[
|
|
53
|
-
on_mouse_over: Optional[EventType[
|
|
54
|
-
on_mouse_up: Optional[EventType[
|
|
55
|
-
on_scroll: Optional[EventType[
|
|
56
|
-
on_unmount: Optional[EventType[
|
|
42
|
+
on_blur: Optional[EventType[()]] = None,
|
|
43
|
+
on_click: Optional[EventType[()]] = None,
|
|
44
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
45
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
46
|
+
on_error: Optional[EventType[()]] = None,
|
|
47
|
+
on_focus: Optional[EventType[()]] = None,
|
|
48
|
+
on_load: Optional[EventType[()]] = None,
|
|
49
|
+
on_mount: Optional[EventType[()]] = None,
|
|
50
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
51
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
52
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
53
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
54
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
55
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
56
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
57
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
58
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
57
59
|
**props,
|
|
58
60
|
) -> "Image":
|
|
59
61
|
"""Create an Image component from next/image.
|
|
@@ -71,7 +73,7 @@ class Image(NextComponent):
|
|
|
71
73
|
priority: When true, the image will be considered high priority and preload. Lazy loading is automatically disabled for images using priority.
|
|
72
74
|
placeholder: A placeholder to use while the image is loading. Possible values are blur, empty, or data:image/.... Defaults to empty.
|
|
73
75
|
loading: The loading behavior of the image. Defaults to lazy. Can hurt performance, recommended to use `priority` instead.
|
|
74
|
-
|
|
76
|
+
blur_data_url: A Data URL to be used as a placeholder image before the src image successfully loads. Only takes effect when combined with placeholder="blur".
|
|
75
77
|
on_load: Fires when the image has loaded.
|
|
76
78
|
on_error: Fires when the image has an error.
|
|
77
79
|
style: The style of the component.
|
reflex/components/next/link.py
CHANGED
reflex/components/next/link.pyi
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
from typing import Any, Dict, Optional, Union, overload
|
|
7
7
|
|
|
8
8
|
from reflex.components.component import Component
|
|
9
|
-
from reflex.event import
|
|
9
|
+
from reflex.event import EventType
|
|
10
10
|
from reflex.style import Style
|
|
11
11
|
from reflex.vars.base import Var
|
|
12
12
|
|
|
@@ -24,21 +24,21 @@ class NextLink(Component):
|
|
|
24
24
|
class_name: Optional[Any] = None,
|
|
25
25
|
autofocus: Optional[bool] = None,
|
|
26
26
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
27
|
-
on_blur: Optional[EventType[
|
|
28
|
-
on_click: Optional[EventType[
|
|
29
|
-
on_context_menu: Optional[EventType[
|
|
30
|
-
on_double_click: Optional[EventType[
|
|
31
|
-
on_focus: Optional[EventType[
|
|
32
|
-
on_mount: Optional[EventType[
|
|
33
|
-
on_mouse_down: Optional[EventType[
|
|
34
|
-
on_mouse_enter: Optional[EventType[
|
|
35
|
-
on_mouse_leave: Optional[EventType[
|
|
36
|
-
on_mouse_move: Optional[EventType[
|
|
37
|
-
on_mouse_out: Optional[EventType[
|
|
38
|
-
on_mouse_over: Optional[EventType[
|
|
39
|
-
on_mouse_up: Optional[EventType[
|
|
40
|
-
on_scroll: Optional[EventType[
|
|
41
|
-
on_unmount: Optional[EventType[
|
|
27
|
+
on_blur: Optional[EventType[()]] = None,
|
|
28
|
+
on_click: Optional[EventType[()]] = None,
|
|
29
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
30
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
31
|
+
on_focus: Optional[EventType[()]] = None,
|
|
32
|
+
on_mount: Optional[EventType[()]] = None,
|
|
33
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
34
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
35
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
36
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
37
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
38
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
39
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
40
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
41
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
42
42
|
**props,
|
|
43
43
|
) -> "NextLink":
|
|
44
44
|
"""Create the component.
|
reflex/components/next/video.pyi
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
from typing import Any, Dict, Optional, Union, overload
|
|
7
7
|
|
|
8
8
|
from reflex.components.component import Component
|
|
9
|
-
from reflex.event import
|
|
9
|
+
from reflex.event import EventType
|
|
10
10
|
from reflex.style import Style
|
|
11
11
|
from reflex.vars.base import Var
|
|
12
12
|
|
|
@@ -26,21 +26,21 @@ class Video(NextComponent):
|
|
|
26
26
|
class_name: Optional[Any] = None,
|
|
27
27
|
autofocus: Optional[bool] = None,
|
|
28
28
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
29
|
-
on_blur: Optional[EventType[
|
|
30
|
-
on_click: Optional[EventType[
|
|
31
|
-
on_context_menu: Optional[EventType[
|
|
32
|
-
on_double_click: Optional[EventType[
|
|
33
|
-
on_focus: Optional[EventType[
|
|
34
|
-
on_mount: Optional[EventType[
|
|
35
|
-
on_mouse_down: Optional[EventType[
|
|
36
|
-
on_mouse_enter: Optional[EventType[
|
|
37
|
-
on_mouse_leave: Optional[EventType[
|
|
38
|
-
on_mouse_move: Optional[EventType[
|
|
39
|
-
on_mouse_out: Optional[EventType[
|
|
40
|
-
on_mouse_over: Optional[EventType[
|
|
41
|
-
on_mouse_up: Optional[EventType[
|
|
42
|
-
on_scroll: Optional[EventType[
|
|
43
|
-
on_unmount: Optional[EventType[
|
|
29
|
+
on_blur: Optional[EventType[()]] = None,
|
|
30
|
+
on_click: Optional[EventType[()]] = None,
|
|
31
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
32
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
33
|
+
on_focus: Optional[EventType[()]] = None,
|
|
34
|
+
on_mount: Optional[EventType[()]] = None,
|
|
35
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
36
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
37
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
38
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
39
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
40
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
41
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
42
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
43
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
44
44
|
**props,
|
|
45
45
|
) -> "Video":
|
|
46
46
|
"""Create a Video component.
|
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
"""Plotly components."""
|
|
2
2
|
|
|
3
|
-
from .
|
|
3
|
+
from reflex.components.component import ComponentNamespace
|
|
4
4
|
|
|
5
|
-
plotly
|
|
5
|
+
from .plotly import (
|
|
6
|
+
Plotly,
|
|
7
|
+
PlotlyBasic,
|
|
8
|
+
PlotlyCartesian,
|
|
9
|
+
PlotlyFinance,
|
|
10
|
+
PlotlyGeo,
|
|
11
|
+
PlotlyGl2d,
|
|
12
|
+
PlotlyGl3d,
|
|
13
|
+
PlotlyMapbox,
|
|
14
|
+
PlotlyStrict,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class PlotlyNamespace(ComponentNamespace):
|
|
19
|
+
"""Plotly namespace."""
|
|
20
|
+
|
|
21
|
+
__call__ = Plotly.create
|
|
22
|
+
basic = PlotlyBasic.create
|
|
23
|
+
cartesian = PlotlyCartesian.create
|
|
24
|
+
geo = PlotlyGeo.create
|
|
25
|
+
gl2d = PlotlyGl2d.create
|
|
26
|
+
gl3d = PlotlyGl3d.create
|
|
27
|
+
finance = PlotlyFinance.create
|
|
28
|
+
mapbox = PlotlyMapbox.create
|
|
29
|
+
strict = PlotlyStrict.create
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
plotly = PlotlyNamespace()
|
|
@@ -10,6 +10,7 @@ from reflex.components.component import Component, NoSSRComponent
|
|
|
10
10
|
from reflex.components.core.cond import color_mode_cond
|
|
11
11
|
from reflex.event import EventHandler, no_args_event_spec
|
|
12
12
|
from reflex.utils import console
|
|
13
|
+
from reflex.utils.imports import ImportDict, ImportVar
|
|
13
14
|
from reflex.vars.base import LiteralVar, Var
|
|
14
15
|
|
|
15
16
|
try:
|
|
@@ -18,8 +19,8 @@ try:
|
|
|
18
19
|
Template = layout.Template
|
|
19
20
|
except ImportError:
|
|
20
21
|
console.warn("Plotly is not installed. Please run `pip install plotly`.")
|
|
21
|
-
Figure = Any
|
|
22
|
-
Template = Any
|
|
22
|
+
Figure = Any
|
|
23
|
+
Template = Any
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
def _event_points_data_signature(e0: Var) -> Tuple[Var[List[Point]]]:
|
|
@@ -95,20 +96,20 @@ class Plotly(NoSSRComponent):
|
|
|
95
96
|
|
|
96
97
|
library = "react-plotly.js@2.6.0"
|
|
97
98
|
|
|
98
|
-
lib_dependencies: List[str] = ["plotly.js@2.35.
|
|
99
|
+
lib_dependencies: List[str] = ["plotly.js@2.35.3"]
|
|
99
100
|
|
|
100
101
|
tag = "Plot"
|
|
101
102
|
|
|
102
103
|
is_default = True
|
|
103
104
|
|
|
104
105
|
# The figure to display. This can be a plotly figure or a plotly data json.
|
|
105
|
-
data: Var[Figure] #
|
|
106
|
+
data: Var[Figure] # pyright: ignore [reportInvalidTypeForm]
|
|
106
107
|
|
|
107
108
|
# The layout of the graph.
|
|
108
109
|
layout: Var[Dict]
|
|
109
110
|
|
|
110
111
|
# The template for visual appearance of the graph.
|
|
111
|
-
template: Var[Template] #
|
|
112
|
+
template: Var[Template] # pyright: ignore [reportInvalidTypeForm]
|
|
112
113
|
|
|
113
114
|
# The config of the graph.
|
|
114
115
|
config: Var[Dict]
|
|
@@ -278,3 +279,237 @@ const extractPoints = (points) => {
|
|
|
278
279
|
# Spread the figure dict over props, nothing to merge.
|
|
279
280
|
tag.special_props.append(Var(_js_expr=f"{{...{figure!s}}}"))
|
|
280
281
|
return tag
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
CREATE_PLOTLY_COMPONENT: ImportDict = {
|
|
285
|
+
"react-plotly.js": [
|
|
286
|
+
ImportVar(
|
|
287
|
+
tag="createPlotlyComponent",
|
|
288
|
+
is_default=True,
|
|
289
|
+
package_path="/factory",
|
|
290
|
+
),
|
|
291
|
+
]
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def dynamic_plotly_import(name: str, package: str) -> str:
|
|
296
|
+
"""Create a dynamic import for a plotly component.
|
|
297
|
+
|
|
298
|
+
Args:
|
|
299
|
+
name: The name of the component.
|
|
300
|
+
package: The package path of the component.
|
|
301
|
+
|
|
302
|
+
Returns:
|
|
303
|
+
The dynamic import for the plotly component.
|
|
304
|
+
"""
|
|
305
|
+
return f"""
|
|
306
|
+
const {name} = dynamic(() => import('{package}').then(mod => createPlotlyComponent(mod)), {{ssr: false}})
|
|
307
|
+
"""
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
class PlotlyBasic(Plotly):
|
|
311
|
+
"""Display a basic plotly graph."""
|
|
312
|
+
|
|
313
|
+
tag: str = "BasicPlotlyPlot"
|
|
314
|
+
|
|
315
|
+
library = "react-plotly.js@2.6.0"
|
|
316
|
+
|
|
317
|
+
lib_dependencies: list[str] = ["plotly.js-basic-dist-min@3.0.0"]
|
|
318
|
+
|
|
319
|
+
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
320
|
+
"""Add imports for the plotly basic component.
|
|
321
|
+
|
|
322
|
+
Returns:
|
|
323
|
+
The imports for the plotly basic component.
|
|
324
|
+
"""
|
|
325
|
+
return CREATE_PLOTLY_COMPONENT
|
|
326
|
+
|
|
327
|
+
def _get_dynamic_imports(self) -> str:
|
|
328
|
+
"""Get the dynamic imports for the plotly basic component.
|
|
329
|
+
|
|
330
|
+
Returns:
|
|
331
|
+
The dynamic imports for the plotly basic component.
|
|
332
|
+
"""
|
|
333
|
+
return dynamic_plotly_import(self.tag, "plotly.js-basic-dist-min")
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
class PlotlyCartesian(Plotly):
|
|
337
|
+
"""Display a plotly cartesian graph."""
|
|
338
|
+
|
|
339
|
+
tag: str = "CartesianPlotlyPlot"
|
|
340
|
+
|
|
341
|
+
library = "react-plotly.js@2.6.0"
|
|
342
|
+
|
|
343
|
+
lib_dependencies: list[str] = ["plotly.js-cartesian-dist-min@3.0.0"]
|
|
344
|
+
|
|
345
|
+
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
346
|
+
"""Add imports for the plotly cartesian component.
|
|
347
|
+
|
|
348
|
+
Returns:
|
|
349
|
+
The imports for the plotly cartesian component.
|
|
350
|
+
"""
|
|
351
|
+
return CREATE_PLOTLY_COMPONENT
|
|
352
|
+
|
|
353
|
+
def _get_dynamic_imports(self) -> str:
|
|
354
|
+
"""Get the dynamic imports for the plotly cartesian component.
|
|
355
|
+
|
|
356
|
+
Returns:
|
|
357
|
+
The dynamic imports for the plotly cartesian component.
|
|
358
|
+
"""
|
|
359
|
+
return dynamic_plotly_import(self.tag, "plotly.js-cartesian-dist-min")
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
class PlotlyGeo(Plotly):
|
|
363
|
+
"""Display a plotly geo graph."""
|
|
364
|
+
|
|
365
|
+
tag: str = "GeoPlotlyPlot"
|
|
366
|
+
|
|
367
|
+
library = "react-plotly.js@2.6.0"
|
|
368
|
+
|
|
369
|
+
lib_dependencies: list[str] = ["plotly.js-geo-dist-min@3.0.0"]
|
|
370
|
+
|
|
371
|
+
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
372
|
+
"""Add imports for the plotly geo component.
|
|
373
|
+
|
|
374
|
+
Returns:
|
|
375
|
+
The imports for the plotly geo component.
|
|
376
|
+
"""
|
|
377
|
+
return CREATE_PLOTLY_COMPONENT
|
|
378
|
+
|
|
379
|
+
def _get_dynamic_imports(self) -> str:
|
|
380
|
+
"""Get the dynamic imports for the plotly geo component.
|
|
381
|
+
|
|
382
|
+
Returns:
|
|
383
|
+
The dynamic imports for the plotly geo component.
|
|
384
|
+
"""
|
|
385
|
+
return dynamic_plotly_import(self.tag, "plotly.js-geo-dist-min")
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
class PlotlyGl3d(Plotly):
|
|
389
|
+
"""Display a plotly 3d graph."""
|
|
390
|
+
|
|
391
|
+
tag: str = "Gl3dPlotlyPlot"
|
|
392
|
+
|
|
393
|
+
library = "react-plotly.js@2.6.0"
|
|
394
|
+
|
|
395
|
+
lib_dependencies: list[str] = ["plotly.js-gl3d-dist-min@3.0.0"]
|
|
396
|
+
|
|
397
|
+
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
398
|
+
"""Add imports for the plotly 3d component.
|
|
399
|
+
|
|
400
|
+
Returns:
|
|
401
|
+
The imports for the plotly 3d component.
|
|
402
|
+
"""
|
|
403
|
+
return CREATE_PLOTLY_COMPONENT
|
|
404
|
+
|
|
405
|
+
def _get_dynamic_imports(self) -> str:
|
|
406
|
+
"""Get the dynamic imports for the plotly 3d component.
|
|
407
|
+
|
|
408
|
+
Returns:
|
|
409
|
+
The dynamic imports for the plotly 3d component.
|
|
410
|
+
"""
|
|
411
|
+
return dynamic_plotly_import(self.tag, "plotly.js-gl3d-dist-min")
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
class PlotlyGl2d(Plotly):
|
|
415
|
+
"""Display a plotly 2d graph."""
|
|
416
|
+
|
|
417
|
+
tag: str = "Gl2dPlotlyPlot"
|
|
418
|
+
|
|
419
|
+
library = "react-plotly.js@2.6.0"
|
|
420
|
+
|
|
421
|
+
lib_dependencies: list[str] = ["plotly.js-gl2d-dist-min@3.0.0"]
|
|
422
|
+
|
|
423
|
+
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
424
|
+
"""Add imports for the plotly 2d component.
|
|
425
|
+
|
|
426
|
+
Returns:
|
|
427
|
+
The imports for the plotly 2d component.
|
|
428
|
+
"""
|
|
429
|
+
return CREATE_PLOTLY_COMPONENT
|
|
430
|
+
|
|
431
|
+
def _get_dynamic_imports(self) -> str:
|
|
432
|
+
"""Get the dynamic imports for the plotly 2d component.
|
|
433
|
+
|
|
434
|
+
Returns:
|
|
435
|
+
The dynamic imports for the plotly 2d component.
|
|
436
|
+
"""
|
|
437
|
+
return dynamic_plotly_import(self.tag, "plotly.js-gl2d-dist-min")
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
class PlotlyMapbox(Plotly):
|
|
441
|
+
"""Display a plotly mapbox graph."""
|
|
442
|
+
|
|
443
|
+
tag: str = "MapboxPlotlyPlot"
|
|
444
|
+
|
|
445
|
+
library = "react-plotly.js@2.6.0"
|
|
446
|
+
|
|
447
|
+
lib_dependencies: list[str] = ["plotly.js-mapbox-dist-min@3.0.0"]
|
|
448
|
+
|
|
449
|
+
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
450
|
+
"""Add imports for the plotly mapbox component.
|
|
451
|
+
|
|
452
|
+
Returns:
|
|
453
|
+
The imports for the plotly mapbox component.
|
|
454
|
+
"""
|
|
455
|
+
return CREATE_PLOTLY_COMPONENT
|
|
456
|
+
|
|
457
|
+
def _get_dynamic_imports(self) -> str:
|
|
458
|
+
"""Get the dynamic imports for the plotly mapbox component.
|
|
459
|
+
|
|
460
|
+
Returns:
|
|
461
|
+
The dynamic imports for the plotly mapbox component.
|
|
462
|
+
"""
|
|
463
|
+
return dynamic_plotly_import(self.tag, "plotly.js-mapbox-dist-min")
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
class PlotlyFinance(Plotly):
|
|
467
|
+
"""Display a plotly finance graph."""
|
|
468
|
+
|
|
469
|
+
tag: str = "FinancePlotlyPlot"
|
|
470
|
+
|
|
471
|
+
library = "react-plotly.js@2.6.0"
|
|
472
|
+
|
|
473
|
+
lib_dependencies: list[str] = ["plotly.js-finance-dist-min@3.0.0"]
|
|
474
|
+
|
|
475
|
+
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
476
|
+
"""Add imports for the plotly finance component.
|
|
477
|
+
|
|
478
|
+
Returns:
|
|
479
|
+
The imports for the plotly finance component.
|
|
480
|
+
"""
|
|
481
|
+
return CREATE_PLOTLY_COMPONENT
|
|
482
|
+
|
|
483
|
+
def _get_dynamic_imports(self) -> str:
|
|
484
|
+
"""Get the dynamic imports for the plotly finance component.
|
|
485
|
+
|
|
486
|
+
Returns:
|
|
487
|
+
The dynamic imports for the plotly finance component.
|
|
488
|
+
"""
|
|
489
|
+
return dynamic_plotly_import(self.tag, "plotly.js-finance-dist-min")
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
class PlotlyStrict(Plotly):
|
|
493
|
+
"""Display a plotly strict graph."""
|
|
494
|
+
|
|
495
|
+
tag: str = "StrictPlotlyPlot"
|
|
496
|
+
|
|
497
|
+
library = "react-plotly.js@2.6.0"
|
|
498
|
+
|
|
499
|
+
lib_dependencies: list[str] = ["plotly.js-strict-dist-min@3.0.0"]
|
|
500
|
+
|
|
501
|
+
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
502
|
+
"""Add imports for the plotly strict component.
|
|
503
|
+
|
|
504
|
+
Returns:
|
|
505
|
+
The imports for the plotly strict component.
|
|
506
|
+
"""
|
|
507
|
+
return CREATE_PLOTLY_COMPONENT
|
|
508
|
+
|
|
509
|
+
def _get_dynamic_imports(self) -> str:
|
|
510
|
+
"""Get the dynamic imports for the plotly strict component.
|
|
511
|
+
|
|
512
|
+
Returns:
|
|
513
|
+
The dynamic imports for the plotly strict component.
|
|
514
|
+
"""
|
|
515
|
+
return dynamic_plotly_import(self.tag, "plotly.js-strict-dist-min")
|