reflex 0.8.13a1__py3-none-any.whl → 0.8.14a1__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/app.py +25 -5
- reflex/components/core/upload.py +9 -13
- reflex/components/plotly/plotly.py +9 -9
- reflex/components/radix/primitives/slider.py +3 -17
- reflex/components/radix/primitives/slider.pyi +2 -4
- reflex/components/radix/themes/components/slider.py +1 -2
- reflex/components/radix/themes/components/slider.pyi +3 -6
- reflex/components/react_player/audio.pyi +23 -46
- reflex/components/react_player/react_player.pyi +40 -45
- reflex/components/react_player/video.pyi +23 -46
- reflex/constants/colors.py +1 -3
- reflex/constants/installer.py +5 -5
- reflex/custom_components/custom_components.py +18 -18
- reflex/environment.py +3 -0
- reflex/plugins/shared_tailwind.py +1 -1
- reflex/reflex.py +62 -24
- reflex/state.py +3 -2
- reflex/utils/exec.py +23 -4
- reflex/utils/frontend_skeleton.py +3 -5
- reflex/utils/js_runtimes.py +10 -10
- reflex/utils/prerequisites.py +5 -6
- reflex/utils/processes.py +10 -11
- reflex/utils/rename.py +3 -5
- reflex/utils/serializers.py +3 -7
- reflex/utils/templates.py +20 -22
- reflex/vars/color.py +2 -68
- {reflex-0.8.13a1.dist-info → reflex-0.8.14a1.dist-info}/METADATA +1 -1
- {reflex-0.8.13a1.dist-info → reflex-0.8.14a1.dist-info}/RECORD +31 -31
- {reflex-0.8.13a1.dist-info → reflex-0.8.14a1.dist-info}/WHEEL +0 -0
- {reflex-0.8.13a1.dist-info → reflex-0.8.14a1.dist-info}/entry_points.txt +0 -0
- {reflex-0.8.13a1.dist-info → reflex-0.8.14a1.dist-info}/licenses/LICENSE +0 -0
reflex/app.py
CHANGED
|
@@ -69,7 +69,6 @@ from reflex.components.core.banner import (
|
|
|
69
69
|
)
|
|
70
70
|
from reflex.components.core.breakpoints import set_breakpoints
|
|
71
71
|
from reflex.components.core.sticky import sticky
|
|
72
|
-
from reflex.components.core.upload import Upload, get_upload_dir
|
|
73
72
|
from reflex.components.radix import themes
|
|
74
73
|
from reflex.components.sonner.toast import toast
|
|
75
74
|
from reflex.config import get_config
|
|
@@ -628,6 +627,18 @@ class App(MiddlewareMixin, LifespanMixin):
|
|
|
628
627
|
|
|
629
628
|
asgi_app = self._api
|
|
630
629
|
|
|
630
|
+
if environment.REFLEX_MOUNT_FRONTEND_COMPILED_APP.get():
|
|
631
|
+
asgi_app.mount(
|
|
632
|
+
"/" + config.frontend_path.strip("/"),
|
|
633
|
+
StaticFiles(
|
|
634
|
+
directory=prerequisites.get_web_dir()
|
|
635
|
+
/ constants.Dirs.STATIC
|
|
636
|
+
/ config.frontend_path.strip("/"),
|
|
637
|
+
html=True,
|
|
638
|
+
),
|
|
639
|
+
name="frontend",
|
|
640
|
+
)
|
|
641
|
+
|
|
631
642
|
if self.api_transformer is not None:
|
|
632
643
|
api_transformers: Sequence[Starlette | Callable[[ASGIApp], ASGIApp]] = (
|
|
633
644
|
[self.api_transformer]
|
|
@@ -670,6 +681,8 @@ class App(MiddlewareMixin, LifespanMixin):
|
|
|
670
681
|
|
|
671
682
|
def _add_optional_endpoints(self):
|
|
672
683
|
"""Add optional api endpoints (_upload)."""
|
|
684
|
+
from reflex.components.core.upload import Upload, get_upload_dir
|
|
685
|
+
|
|
673
686
|
if not self._api:
|
|
674
687
|
return
|
|
675
688
|
upload_is_used_marker = (
|
|
@@ -1010,11 +1023,18 @@ class App(MiddlewareMixin, LifespanMixin):
|
|
|
1010
1023
|
for component in tuple(app_wrappers.values()):
|
|
1011
1024
|
app_wrappers.update(component._get_all_app_wrap_components())
|
|
1012
1025
|
order = sorted(app_wrappers, key=lambda k: k[0], reverse=True)
|
|
1013
|
-
root =
|
|
1014
|
-
|
|
1026
|
+
root = copy.deepcopy(app_wrappers[order[0]])
|
|
1027
|
+
|
|
1028
|
+
def reducer(parent: Component, key: tuple[int, str]) -> Component:
|
|
1015
1029
|
child = copy.deepcopy(app_wrappers[key])
|
|
1016
1030
|
parent.children.append(child)
|
|
1017
|
-
|
|
1031
|
+
return child
|
|
1032
|
+
|
|
1033
|
+
functools.reduce(
|
|
1034
|
+
lambda parent, key: reducer(parent, key),
|
|
1035
|
+
order[1:],
|
|
1036
|
+
root,
|
|
1037
|
+
)
|
|
1018
1038
|
return root
|
|
1019
1039
|
|
|
1020
1040
|
def _should_compile(self) -> bool:
|
|
@@ -1274,7 +1294,7 @@ class App(MiddlewareMixin, LifespanMixin):
|
|
|
1274
1294
|
|
|
1275
1295
|
toast_provider = Fragment.create(memoized_toast_provider())
|
|
1276
1296
|
|
|
1277
|
-
app_wrappers[(
|
|
1297
|
+
app_wrappers[(44, "ToasterProvider")] = toast_provider
|
|
1278
1298
|
|
|
1279
1299
|
# Add the app wraps to the app.
|
|
1280
1300
|
for key, app_wrap in chain(
|
reflex/components/core/upload.py
CHANGED
|
@@ -6,6 +6,7 @@ from collections.abc import Callable, Sequence
|
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
from typing import Any, ClassVar
|
|
8
8
|
|
|
9
|
+
from reflex.app import UploadFile
|
|
9
10
|
from reflex.components.base.fragment import Fragment
|
|
10
11
|
from reflex.components.component import (
|
|
11
12
|
Component,
|
|
@@ -29,7 +30,9 @@ from reflex.event import (
|
|
|
29
30
|
call_event_fn,
|
|
30
31
|
call_event_handler,
|
|
31
32
|
parse_args_spec,
|
|
33
|
+
passthrough_event_spec,
|
|
32
34
|
run_script,
|
|
35
|
+
upload_files,
|
|
33
36
|
)
|
|
34
37
|
from reflex.style import Style
|
|
35
38
|
from reflex.utils import format
|
|
@@ -168,16 +171,7 @@ def get_upload_url(file_path: str | Var[str]) -> Var[str]:
|
|
|
168
171
|
return Var.create(f"{uploaded_files_url_prefix}/{file_path}")
|
|
169
172
|
|
|
170
173
|
|
|
171
|
-
|
|
172
|
-
"""Args spec for the on_drop event trigger.
|
|
173
|
-
|
|
174
|
-
Args:
|
|
175
|
-
files: The files to upload.
|
|
176
|
-
|
|
177
|
-
Returns:
|
|
178
|
-
Signature for on_drop handler including the files to upload.
|
|
179
|
-
"""
|
|
180
|
-
return (files,)
|
|
174
|
+
_on_drop_spec = passthrough_event_spec(list[UploadFile])
|
|
181
175
|
|
|
182
176
|
|
|
183
177
|
def _default_drop_rejected(rejected_files: ArrayVar[list[dict[str, Any]]]) -> EventSpec:
|
|
@@ -302,11 +296,11 @@ class Upload(MemoizationLeaf):
|
|
|
302
296
|
}
|
|
303
297
|
|
|
304
298
|
# Create the component.
|
|
305
|
-
upload_props["id"] = props.get("id", DEFAULT_UPLOAD_ID)
|
|
299
|
+
upload_props["id"] = upload_id = props.get("id", DEFAULT_UPLOAD_ID)
|
|
306
300
|
|
|
307
301
|
if upload_props.get("on_drop") is None:
|
|
308
302
|
# If on_drop is not provided, save files to be uploaded later.
|
|
309
|
-
upload_props["on_drop"] = upload_file(
|
|
303
|
+
upload_props["on_drop"] = upload_file(upload_id)
|
|
310
304
|
else:
|
|
311
305
|
on_drop = (
|
|
312
306
|
[on_drop_prop]
|
|
@@ -314,7 +308,9 @@ class Upload(MemoizationLeaf):
|
|
|
314
308
|
else list(on_drop_prop)
|
|
315
309
|
)
|
|
316
310
|
for ix, event in enumerate(on_drop):
|
|
317
|
-
if isinstance(event,
|
|
311
|
+
if isinstance(event, EventHandler):
|
|
312
|
+
event = event(upload_files(upload_id))
|
|
313
|
+
if isinstance(event, EventSpec):
|
|
318
314
|
# Call the lambda to get the event chain.
|
|
319
315
|
event = call_event_handler(event, _on_drop_spec)
|
|
320
316
|
elif isinstance(event, Callable):
|
|
@@ -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.1.
|
|
75
|
+
lib_dependencies: list[str] = ["plotly.js@3.1.1"]
|
|
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.1.
|
|
306
|
+
lib_dependencies: list[str] = ["plotly.js-basic-dist-min@3.1.1"]
|
|
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.1.
|
|
332
|
+
lib_dependencies: list[str] = ["plotly.js-cartesian-dist-min@3.1.1"]
|
|
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.1.
|
|
358
|
+
lib_dependencies: list[str] = ["plotly.js-geo-dist-min@3.1.1"]
|
|
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.1.
|
|
384
|
+
lib_dependencies: list[str] = ["plotly.js-gl3d-dist-min@3.1.1"]
|
|
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.1.
|
|
410
|
+
lib_dependencies: list[str] = ["plotly.js-gl2d-dist-min@3.1.1"]
|
|
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.1.
|
|
436
|
+
lib_dependencies: list[str] = ["plotly.js-mapbox-dist-min@3.1.1"]
|
|
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.1.
|
|
462
|
+
lib_dependencies: list[str] = ["plotly.js-finance-dist-min@3.1.1"]
|
|
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.1.
|
|
488
|
+
lib_dependencies: list[str] = ["plotly.js-strict-dist-min@3.1.1"]
|
|
489
489
|
|
|
490
490
|
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
491
491
|
"""Add imports for the plotly strict component.
|
|
@@ -7,7 +7,7 @@ from typing import Any, Literal
|
|
|
7
7
|
|
|
8
8
|
from reflex.components.component import Component, ComponentNamespace
|
|
9
9
|
from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName
|
|
10
|
-
from reflex.event import EventHandler
|
|
10
|
+
from reflex.event import EventHandler, passthrough_event_spec
|
|
11
11
|
from reflex.vars.base import Var
|
|
12
12
|
|
|
13
13
|
LiteralSliderOrientation = Literal["horizontal", "vertical"]
|
|
@@ -20,20 +20,6 @@ class SliderComponent(RadixPrimitiveComponentWithClassName):
|
|
|
20
20
|
library = "@radix-ui/react-slider@1.3.6"
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
def on_value_event_spec(
|
|
24
|
-
value: Var[list[int]],
|
|
25
|
-
) -> tuple[Var[list[int]]]:
|
|
26
|
-
"""Event handler spec for the value event.
|
|
27
|
-
|
|
28
|
-
Args:
|
|
29
|
-
value: The value of the event.
|
|
30
|
-
|
|
31
|
-
Returns:
|
|
32
|
-
The event handler spec.
|
|
33
|
-
"""
|
|
34
|
-
return (value,)
|
|
35
|
-
|
|
36
|
-
|
|
37
23
|
class SliderRoot(SliderComponent):
|
|
38
24
|
"""The Slider component containing all slider parts."""
|
|
39
25
|
|
|
@@ -63,10 +49,10 @@ class SliderRoot(SliderComponent):
|
|
|
63
49
|
min_steps_between_thumbs: Var[int]
|
|
64
50
|
|
|
65
51
|
# Fired when the value of a thumb changes.
|
|
66
|
-
on_value_change: EventHandler[
|
|
52
|
+
on_value_change: EventHandler[passthrough_event_spec(list[float])]
|
|
67
53
|
|
|
68
54
|
# Fired when a thumb is released.
|
|
69
|
-
on_value_commit: EventHandler[
|
|
55
|
+
on_value_commit: EventHandler[passthrough_event_spec(list[float])]
|
|
70
56
|
|
|
71
57
|
def add_style(self) -> dict[str, Any] | None:
|
|
72
58
|
"""Add style to the component.
|
|
@@ -66,8 +66,6 @@ class SliderComponent(RadixPrimitiveComponentWithClassName):
|
|
|
66
66
|
The component.
|
|
67
67
|
"""
|
|
68
68
|
|
|
69
|
-
def on_value_event_spec(value: Var[list[int]]) -> tuple[Var[list[int]]]: ...
|
|
70
|
-
|
|
71
69
|
class SliderRoot(SliderComponent):
|
|
72
70
|
def add_style(self) -> dict[str, Any] | None: ...
|
|
73
71
|
@classmethod
|
|
@@ -114,8 +112,8 @@ class SliderRoot(SliderComponent):
|
|
|
114
112
|
on_scroll: EventType[()] | None = None,
|
|
115
113
|
on_scroll_end: EventType[()] | None = None,
|
|
116
114
|
on_unmount: EventType[()] | None = None,
|
|
117
|
-
on_value_change: EventType[()] | EventType[list[
|
|
118
|
-
on_value_commit: EventType[()] | EventType[list[
|
|
115
|
+
on_value_change: EventType[()] | EventType[list[float]] | None = None,
|
|
116
|
+
on_value_commit: EventType[()] | EventType[list[float]] | None = None,
|
|
119
117
|
**props,
|
|
120
118
|
) -> SliderRoot:
|
|
121
119
|
"""Create the component.
|
|
@@ -13,9 +13,8 @@ from reflex.utils.types import typehint_issubclass
|
|
|
13
13
|
from reflex.vars.base import Var
|
|
14
14
|
|
|
15
15
|
on_value_event_spec = (
|
|
16
|
-
passthrough_event_spec(list[int | float]),
|
|
17
|
-
passthrough_event_spec(list[int]),
|
|
18
16
|
passthrough_event_spec(list[float]),
|
|
17
|
+
passthrough_event_spec(list[int]),
|
|
19
18
|
)
|
|
20
19
|
|
|
21
20
|
|
|
@@ -12,9 +12,8 @@ from reflex.event import EventType, PointerEventInfo, passthrough_event_spec
|
|
|
12
12
|
from reflex.vars.base import Var
|
|
13
13
|
|
|
14
14
|
on_value_event_spec = (
|
|
15
|
-
passthrough_event_spec(list[int | float]),
|
|
16
|
-
passthrough_event_spec(list[int]),
|
|
17
15
|
passthrough_event_spec(list[float]),
|
|
16
|
+
passthrough_event_spec(list[int]),
|
|
18
17
|
)
|
|
19
18
|
|
|
20
19
|
class Slider(RadixThemesComponent):
|
|
@@ -120,9 +119,8 @@ class Slider(RadixThemesComponent):
|
|
|
120
119
|
custom_attrs: dict[str, Var | Any] | None = None,
|
|
121
120
|
on_blur: EventType[()] | None = None,
|
|
122
121
|
on_change: EventType[()]
|
|
123
|
-
| EventType[list[
|
|
122
|
+
| EventType[list[float]]
|
|
124
123
|
| (EventType[()] | EventType[list[int]])
|
|
125
|
-
| (EventType[()] | EventType[list[float]])
|
|
126
124
|
| None = None,
|
|
127
125
|
on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
128
126
|
on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
@@ -140,9 +138,8 @@ class Slider(RadixThemesComponent):
|
|
|
140
138
|
on_scroll_end: EventType[()] | None = None,
|
|
141
139
|
on_unmount: EventType[()] | None = None,
|
|
142
140
|
on_value_commit: EventType[()]
|
|
143
|
-
| EventType[list[
|
|
141
|
+
| EventType[list[float]]
|
|
144
142
|
| (EventType[()] | EventType[list[int]])
|
|
145
|
-
| (EventType[()] | EventType[list[float]])
|
|
146
143
|
| None = None,
|
|
147
144
|
**props,
|
|
148
145
|
) -> Slider:
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
from collections.abc import Mapping, Sequence
|
|
7
7
|
from typing import Any
|
|
8
8
|
|
|
9
|
-
import reflex
|
|
10
9
|
from reflex.components.core.breakpoints import Breakpoints
|
|
11
10
|
from reflex.components.react_player.react_player import ReactPlayer
|
|
12
11
|
from reflex.event import EventType, PointerEventInfo
|
|
@@ -17,13 +16,18 @@ class Audio(ReactPlayer):
|
|
|
17
16
|
def create(
|
|
18
17
|
cls,
|
|
19
18
|
*children,
|
|
20
|
-
|
|
19
|
+
src: Var[list[dict[str, str]] | list[str] | str]
|
|
20
|
+
| list[dict[str, str]]
|
|
21
|
+
| list[str]
|
|
22
|
+
| str
|
|
23
|
+
| None = None,
|
|
21
24
|
playing: Var[bool] | bool | None = None,
|
|
22
25
|
loop: Var[bool] | bool | None = None,
|
|
23
26
|
controls: Var[bool] | bool | None = None,
|
|
24
27
|
light: Var[bool] | bool | None = None,
|
|
25
28
|
volume: Var[float] | float | None = None,
|
|
26
29
|
muted: Var[bool] | bool | None = None,
|
|
30
|
+
config: Var[dict[str, Any]] | dict[str, Any] | None = None,
|
|
27
31
|
style: Sequence[Mapping[str, Any]]
|
|
28
32
|
| Mapping[str, Any]
|
|
29
33
|
| Var[Mapping[str, Any]]
|
|
@@ -35,18 +39,16 @@ class Audio(ReactPlayer):
|
|
|
35
39
|
class_name: Any | None = None,
|
|
36
40
|
custom_attrs: dict[str, Var | Any] | None = None,
|
|
37
41
|
on_blur: EventType[()] | None = None,
|
|
38
|
-
on_buffer: EventType[()] | None = None,
|
|
39
|
-
on_buffer_end: EventType[()] | None = None,
|
|
40
42
|
on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
41
43
|
on_click_preview: EventType[()] | None = None,
|
|
42
44
|
on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
43
|
-
on_disable_pip: EventType[()] | None = None,
|
|
44
45
|
on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
45
|
-
|
|
46
|
-
on_enable_pip: EventType[()] | None = None,
|
|
46
|
+
on_duration_change: EventType[Any] | None = None,
|
|
47
47
|
on_ended: EventType[()] | None = None,
|
|
48
|
+
on_enter_picture_in_picture: EventType[()] | None = None,
|
|
48
49
|
on_error: EventType[()] | None = None,
|
|
49
50
|
on_focus: EventType[()] | None = None,
|
|
51
|
+
on_leave_picture_in_picture: EventType[()] | None = None,
|
|
50
52
|
on_mount: EventType[()] | None = None,
|
|
51
53
|
on_mouse_down: EventType[()] | None = None,
|
|
52
54
|
on_mouse_enter: EventType[()] | None = None,
|
|
@@ -57,54 +59,29 @@ class Audio(ReactPlayer):
|
|
|
57
59
|
on_mouse_up: EventType[()] | None = None,
|
|
58
60
|
on_pause: EventType[()] | None = None,
|
|
59
61
|
on_play: EventType[()] | None = None,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
| EventType[reflex.components.react_player.react_player.Progress]
|
|
64
|
-
| None = None,
|
|
62
|
+
on_playing: EventType[()] | None = None,
|
|
63
|
+
on_progress: EventType[Any] | None = None,
|
|
64
|
+
on_rate_change: EventType[Any] | None = None,
|
|
65
65
|
on_ready: EventType[()] | None = None,
|
|
66
66
|
on_scroll: EventType[()] | None = None,
|
|
67
67
|
on_scroll_end: EventType[()] | None = None,
|
|
68
|
-
|
|
68
|
+
on_seeked: EventType[Any] | None = None,
|
|
69
|
+
on_seeking: EventType[()] | None = None,
|
|
69
70
|
on_start: EventType[()] | None = None,
|
|
71
|
+
on_time_update: EventType[Any] | None = None,
|
|
70
72
|
on_unmount: EventType[()] | None = None,
|
|
73
|
+
on_waiting: EventType[()] | None = None,
|
|
71
74
|
**props,
|
|
72
75
|
) -> Audio:
|
|
73
|
-
"""Create
|
|
76
|
+
"""Create a component.
|
|
74
77
|
|
|
75
78
|
Args:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
playing: Set to true or false to pause or play the media
|
|
79
|
-
loop: Set to true or false to loop the media
|
|
80
|
-
controls: Set to true or false to display native player controls.
|
|
81
|
-
light: Set to true to show just the video thumbnail, which loads the full player on click
|
|
82
|
-
volume: Set the volume of the player, between 0 and 1
|
|
83
|
-
muted: Mutes the player
|
|
84
|
-
on_ready: Called when media is loaded and ready to play. If playing is set to true, media will play immediately.
|
|
85
|
-
on_start: Called when media starts playing.
|
|
86
|
-
on_play: Called when media starts or resumes playing after pausing or buffering.
|
|
87
|
-
on_progress: Callback containing played and loaded progress as a fraction, and playedSeconds and loadedSeconds in seconds. eg { played: 0.12, playedSeconds: 11.3, loaded: 0.34, loadedSeconds: 16.7 }
|
|
88
|
-
on_duration: Callback containing duration of the media, in seconds.
|
|
89
|
-
on_pause: Called when media is paused.
|
|
90
|
-
on_buffer: Called when media starts buffering.
|
|
91
|
-
on_buffer_end: Called when media has finished buffering. Works for files, YouTube and Facebook.
|
|
92
|
-
on_seek: Called when media seeks with seconds parameter.
|
|
93
|
-
on_playback_rate_change: Called when playback rate of the player changed. Only supported by YouTube, Vimeo (if enabled), Wistia, and file paths.
|
|
94
|
-
on_playback_quality_change: Called when playback quality of the player changed. Only supported by YouTube (if enabled).
|
|
95
|
-
on_ended: Called when media finishes playing. Does not fire when loop is set to true.
|
|
96
|
-
on_error: Called when an error occurs whilst attempting to play media.
|
|
97
|
-
on_click_preview: Called when user clicks the light mode preview.
|
|
98
|
-
on_enable_pip: Called when picture-in-picture mode is enabled.
|
|
99
|
-
on_disable_pip: Called when picture-in-picture mode is disabled.
|
|
100
|
-
style: The style of the component.
|
|
101
|
-
key: A unique key for the component.
|
|
102
|
-
id: The id for the component.
|
|
103
|
-
ref: The Var to pass as the ref to the component.
|
|
104
|
-
class_name: The class name for the component.
|
|
105
|
-
custom_attrs: custom attribute
|
|
106
|
-
**props: The props of the component.
|
|
79
|
+
children: The children of the component.
|
|
80
|
+
props: The props of the component.
|
|
107
81
|
|
|
108
82
|
Returns:
|
|
109
|
-
The component.
|
|
83
|
+
The created component.
|
|
84
|
+
|
|
85
|
+
Raises:
|
|
86
|
+
ValueError: If both a deprecated prop and its replacement are both passed.
|
|
110
87
|
"""
|
|
@@ -6,29 +6,49 @@
|
|
|
6
6
|
from collections.abc import Mapping, Sequence
|
|
7
7
|
from typing import Any, TypedDict
|
|
8
8
|
|
|
9
|
-
from reflex.components.component import
|
|
9
|
+
from reflex.components.component import Component
|
|
10
10
|
from reflex.components.core.breakpoints import Breakpoints
|
|
11
11
|
from reflex.event import EventType, PointerEventInfo
|
|
12
12
|
from reflex.vars.base import Var
|
|
13
|
+
from reflex.vars.object import ObjectVar
|
|
14
|
+
|
|
15
|
+
ReactPlayerEvent = ObjectVar[dict[str, dict[str, dict[str, Any]]]]
|
|
13
16
|
|
|
14
17
|
class Progress(TypedDict):
|
|
15
18
|
played: float
|
|
16
19
|
playedSeconds: float
|
|
17
20
|
loaded: float
|
|
18
21
|
loadedSeconds: float
|
|
22
|
+
duration: float
|
|
23
|
+
|
|
24
|
+
_DEPRECATED_PROP_MAP = {
|
|
25
|
+
"url": "src",
|
|
26
|
+
"on_duration": "on_duration_change",
|
|
27
|
+
"on_playback_rate_change": "on_rate_change",
|
|
28
|
+
"on_seek": "on_seeked",
|
|
29
|
+
"on_buffer": "on_waiting",
|
|
30
|
+
"on_buffer_end": "on_playing",
|
|
31
|
+
"on_enable_pip": "on_enter_picture_in_picture",
|
|
32
|
+
"on_disable_pip": "on_leave_picture_in_picture",
|
|
33
|
+
}
|
|
19
34
|
|
|
20
|
-
class ReactPlayer(
|
|
35
|
+
class ReactPlayer(Component):
|
|
21
36
|
@classmethod
|
|
22
37
|
def create(
|
|
23
38
|
cls,
|
|
24
39
|
*children,
|
|
25
|
-
|
|
40
|
+
src: Var[list[dict[str, str]] | list[str] | str]
|
|
41
|
+
| list[dict[str, str]]
|
|
42
|
+
| list[str]
|
|
43
|
+
| str
|
|
44
|
+
| None = None,
|
|
26
45
|
playing: Var[bool] | bool | None = None,
|
|
27
46
|
loop: Var[bool] | bool | None = None,
|
|
28
47
|
controls: Var[bool] | bool | None = None,
|
|
29
48
|
light: Var[bool] | bool | None = None,
|
|
30
49
|
volume: Var[float] | float | None = None,
|
|
31
50
|
muted: Var[bool] | bool | None = None,
|
|
51
|
+
config: Var[dict[str, Any]] | dict[str, Any] | None = None,
|
|
32
52
|
style: Sequence[Mapping[str, Any]]
|
|
33
53
|
| Mapping[str, Any]
|
|
34
54
|
| Var[Mapping[str, Any]]
|
|
@@ -40,18 +60,16 @@ class ReactPlayer(NoSSRComponent):
|
|
|
40
60
|
class_name: Any | None = None,
|
|
41
61
|
custom_attrs: dict[str, Var | Any] | None = None,
|
|
42
62
|
on_blur: EventType[()] | None = None,
|
|
43
|
-
on_buffer: EventType[()] | None = None,
|
|
44
|
-
on_buffer_end: EventType[()] | None = None,
|
|
45
63
|
on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
46
64
|
on_click_preview: EventType[()] | None = None,
|
|
47
65
|
on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
48
|
-
on_disable_pip: EventType[()] | None = None,
|
|
49
66
|
on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
50
|
-
|
|
51
|
-
on_enable_pip: EventType[()] | None = None,
|
|
67
|
+
on_duration_change: EventType[Any] | None = None,
|
|
52
68
|
on_ended: EventType[()] | None = None,
|
|
69
|
+
on_enter_picture_in_picture: EventType[()] | None = None,
|
|
53
70
|
on_error: EventType[()] | None = None,
|
|
54
71
|
on_focus: EventType[()] | None = None,
|
|
72
|
+
on_leave_picture_in_picture: EventType[()] | None = None,
|
|
55
73
|
on_mount: EventType[()] | None = None,
|
|
56
74
|
on_mouse_down: EventType[()] | None = None,
|
|
57
75
|
on_mouse_enter: EventType[()] | None = None,
|
|
@@ -62,52 +80,29 @@ class ReactPlayer(NoSSRComponent):
|
|
|
62
80
|
on_mouse_up: EventType[()] | None = None,
|
|
63
81
|
on_pause: EventType[()] | None = None,
|
|
64
82
|
on_play: EventType[()] | None = None,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
83
|
+
on_playing: EventType[()] | None = None,
|
|
84
|
+
on_progress: EventType[Any] | None = None,
|
|
85
|
+
on_rate_change: EventType[Any] | None = None,
|
|
68
86
|
on_ready: EventType[()] | None = None,
|
|
69
87
|
on_scroll: EventType[()] | None = None,
|
|
70
88
|
on_scroll_end: EventType[()] | None = None,
|
|
71
|
-
|
|
89
|
+
on_seeked: EventType[Any] | None = None,
|
|
90
|
+
on_seeking: EventType[()] | None = None,
|
|
72
91
|
on_start: EventType[()] | None = None,
|
|
92
|
+
on_time_update: EventType[Any] | None = None,
|
|
73
93
|
on_unmount: EventType[()] | None = None,
|
|
94
|
+
on_waiting: EventType[()] | None = None,
|
|
74
95
|
**props,
|
|
75
96
|
) -> ReactPlayer:
|
|
76
|
-
"""Create
|
|
97
|
+
"""Create a component.
|
|
77
98
|
|
|
78
99
|
Args:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
playing: Set to true or false to pause or play the media
|
|
82
|
-
loop: Set to true or false to loop the media
|
|
83
|
-
controls: Set to true or false to display native player controls.
|
|
84
|
-
light: Set to true to show just the video thumbnail, which loads the full player on click
|
|
85
|
-
volume: Set the volume of the player, between 0 and 1
|
|
86
|
-
muted: Mutes the player
|
|
87
|
-
on_ready: Called when media is loaded and ready to play. If playing is set to true, media will play immediately.
|
|
88
|
-
on_start: Called when media starts playing.
|
|
89
|
-
on_play: Called when media starts or resumes playing after pausing or buffering.
|
|
90
|
-
on_progress: Callback containing played and loaded progress as a fraction, and playedSeconds and loadedSeconds in seconds. eg { played: 0.12, playedSeconds: 11.3, loaded: 0.34, loadedSeconds: 16.7 }
|
|
91
|
-
on_duration: Callback containing duration of the media, in seconds.
|
|
92
|
-
on_pause: Called when media is paused.
|
|
93
|
-
on_buffer: Called when media starts buffering.
|
|
94
|
-
on_buffer_end: Called when media has finished buffering. Works for files, YouTube and Facebook.
|
|
95
|
-
on_seek: Called when media seeks with seconds parameter.
|
|
96
|
-
on_playback_rate_change: Called when playback rate of the player changed. Only supported by YouTube, Vimeo (if enabled), Wistia, and file paths.
|
|
97
|
-
on_playback_quality_change: Called when playback quality of the player changed. Only supported by YouTube (if enabled).
|
|
98
|
-
on_ended: Called when media finishes playing. Does not fire when loop is set to true.
|
|
99
|
-
on_error: Called when an error occurs whilst attempting to play media.
|
|
100
|
-
on_click_preview: Called when user clicks the light mode preview.
|
|
101
|
-
on_enable_pip: Called when picture-in-picture mode is enabled.
|
|
102
|
-
on_disable_pip: Called when picture-in-picture mode is disabled.
|
|
103
|
-
style: The style of the component.
|
|
104
|
-
key: A unique key for the component.
|
|
105
|
-
id: The id for the component.
|
|
106
|
-
ref: The Var to pass as the ref to the component.
|
|
107
|
-
class_name: The class name for the component.
|
|
108
|
-
custom_attrs: custom attribute
|
|
109
|
-
**props: The props of the component.
|
|
100
|
+
children: The children of the component.
|
|
101
|
+
props: The props of the component.
|
|
110
102
|
|
|
111
103
|
Returns:
|
|
112
|
-
The component.
|
|
104
|
+
The created component.
|
|
105
|
+
|
|
106
|
+
Raises:
|
|
107
|
+
ValueError: If both a deprecated prop and its replacement are both passed.
|
|
113
108
|
"""
|