reflex-components-core 0.9.0a1__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.
- reflex_components_core/__init__.py +20 -0
- reflex_components_core/__init__.pyi +8 -0
- reflex_components_core/base/__init__.py +29 -0
- reflex_components_core/base/__init__.pyi +35 -0
- reflex_components_core/base/app_wrap.py +19 -0
- reflex_components_core/base/app_wrap.pyi +52 -0
- reflex_components_core/base/bare.py +247 -0
- reflex_components_core/base/body.py +7 -0
- reflex_components_core/base/body.pyi +56 -0
- reflex_components_core/base/document.py +39 -0
- reflex_components_core/base/document.pyi +271 -0
- reflex_components_core/base/error_boundary.py +179 -0
- reflex_components_core/base/error_boundary.pyi +65 -0
- reflex_components_core/base/fragment.py +13 -0
- reflex_components_core/base/fragment.pyi +58 -0
- reflex_components_core/base/link.py +38 -0
- reflex_components_core/base/link.pyi +99 -0
- reflex_components_core/base/meta.py +47 -0
- reflex_components_core/base/meta.pyi +146 -0
- reflex_components_core/base/script.py +77 -0
- reflex_components_core/base/script.pyi +61 -0
- reflex_components_core/base/strict_mode.py +10 -0
- reflex_components_core/base/strict_mode.pyi +56 -0
- reflex_components_core/core/__init__.py +60 -0
- reflex_components_core/core/__init__.pyi +85 -0
- reflex_components_core/core/_upload.py +719 -0
- reflex_components_core/core/auto_scroll.py +123 -0
- reflex_components_core/core/auto_scroll.pyi +62 -0
- reflex_components_core/core/banner.py +481 -0
- reflex_components_core/core/banner.pyi +307 -0
- reflex_components_core/core/breakpoints.py +4 -0
- reflex_components_core/core/clipboard.py +101 -0
- reflex_components_core/core/clipboard.pyi +67 -0
- reflex_components_core/core/colors.py +53 -0
- reflex_components_core/core/cond.py +197 -0
- reflex_components_core/core/debounce.py +150 -0
- reflex_components_core/core/debounce.pyi +78 -0
- reflex_components_core/core/foreach.py +180 -0
- reflex_components_core/core/helmet.py +14 -0
- reflex_components_core/core/helmet.pyi +58 -0
- reflex_components_core/core/html.py +48 -0
- reflex_components_core/core/html.pyi +61 -0
- reflex_components_core/core/layout/__init__.py +1 -0
- reflex_components_core/core/markdown_component_map.py +77 -0
- reflex_components_core/core/match.py +300 -0
- reflex_components_core/core/responsive.py +69 -0
- reflex_components_core/core/sticky.py +130 -0
- reflex_components_core/core/sticky.pyi +181 -0
- reflex_components_core/core/upload.py +490 -0
- reflex_components_core/core/upload.pyi +330 -0
- reflex_components_core/core/window_events.py +142 -0
- reflex_components_core/core/window_events.pyi +77 -0
- reflex_components_core/datadisplay/__init__.py +20 -0
- reflex_components_core/datadisplay/__init__.pyi +18 -0
- reflex_components_core/datadisplay/logo.py +72 -0
- reflex_components_core/el/__init__.py +24 -0
- reflex_components_core/el/__init__.pyi +520 -0
- reflex_components_core/el/element.py +22 -0
- reflex_components_core/el/element.pyi +56 -0
- reflex_components_core/el/elements/__init__.py +160 -0
- reflex_components_core/el/elements/__init__.pyi +655 -0
- reflex_components_core/el/elements/base.py +142 -0
- reflex_components_core/el/elements/base.pyi +134 -0
- reflex_components_core/el/elements/forms.py +799 -0
- reflex_components_core/el/elements/forms.pyi +1271 -0
- reflex_components_core/el/elements/inline.py +256 -0
- reflex_components_core/el/elements/inline.pyi +1259 -0
- reflex_components_core/el/elements/media.py +1018 -0
- reflex_components_core/el/elements/media.pyi +2251 -0
- reflex_components_core/el/elements/metadata.py +106 -0
- reflex_components_core/el/elements/metadata.pyi +280 -0
- reflex_components_core/el/elements/other.py +81 -0
- reflex_components_core/el/elements/other.pyi +323 -0
- reflex_components_core/el/elements/scripts.py +58 -0
- reflex_components_core/el/elements/scripts.pyi +147 -0
- reflex_components_core/el/elements/sectioning.py +110 -0
- reflex_components_core/el/elements/sectioning.pyi +675 -0
- reflex_components_core/el/elements/tables.py +114 -0
- reflex_components_core/el/elements/tables.pyi +455 -0
- reflex_components_core/el/elements/typography.py +153 -0
- reflex_components_core/el/elements/typography.pyi +718 -0
- reflex_components_core/react_router/__init__.py +5 -0
- reflex_components_core/react_router/dom.py +75 -0
- reflex_components_core/react_router/dom.pyi +71 -0
- reflex_components_core-0.9.0a1.dist-info/METADATA +17 -0
- reflex_components_core-0.9.0a1.dist-info/RECORD +87 -0
- reflex_components_core-0.9.0a1.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""Reflex base UI components package."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from reflex_base.utils import lazy_loader
|
|
6
|
+
|
|
7
|
+
_SUBMODULES: set[str] = {
|
|
8
|
+
"base",
|
|
9
|
+
"core",
|
|
10
|
+
"datadisplay",
|
|
11
|
+
"el",
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
_SUBMOD_ATTRS: dict[str, list[str]] = {}
|
|
15
|
+
|
|
16
|
+
__getattr__, __dir__, __all__ = lazy_loader.attach(
|
|
17
|
+
__name__,
|
|
18
|
+
submodules=_SUBMODULES,
|
|
19
|
+
submod_attrs=_SUBMOD_ATTRS,
|
|
20
|
+
)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""Stub file for reflex_components_core/__init__.py"""
|
|
2
|
+
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
4
|
+
# ------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
from . import base, core, datadisplay, el
|
|
7
|
+
|
|
8
|
+
__all__ = ["base", "core", "datadisplay", "el"]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Base components."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from reflex_base.utils import lazy_loader
|
|
6
|
+
|
|
7
|
+
_SUBMODULES: set[str] = {"app_wrap", "bare"}
|
|
8
|
+
|
|
9
|
+
_SUBMOD_ATTRS: dict[str, list[str]] = {
|
|
10
|
+
"body": ["Body"],
|
|
11
|
+
"document": ["Scripts", "Outlet", "ScrollRestoration", "Links", "Meta"],
|
|
12
|
+
"fragment": [
|
|
13
|
+
"Fragment",
|
|
14
|
+
"fragment",
|
|
15
|
+
],
|
|
16
|
+
"error_boundary": [
|
|
17
|
+
"ErrorBoundary",
|
|
18
|
+
"error_boundary",
|
|
19
|
+
],
|
|
20
|
+
"link": ["RawLink", "ScriptTag"],
|
|
21
|
+
"meta": ["Description", "Image", "Meta", "Title"],
|
|
22
|
+
"script": ["Script", "script"],
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
__getattr__, __dir__, __all__ = lazy_loader.attach(
|
|
26
|
+
__name__,
|
|
27
|
+
submodules=_SUBMODULES,
|
|
28
|
+
submod_attrs=_SUBMOD_ATTRS,
|
|
29
|
+
)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Stub file for reflex_components_core/base/__init__.py"""
|
|
2
|
+
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
4
|
+
# ------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
from . import app_wrap, bare
|
|
7
|
+
from .body import Body
|
|
8
|
+
from .document import Links, Outlet, Scripts, ScrollRestoration
|
|
9
|
+
from .error_boundary import ErrorBoundary, error_boundary
|
|
10
|
+
from .fragment import Fragment, fragment
|
|
11
|
+
from .link import RawLink, ScriptTag
|
|
12
|
+
from .meta import Description, Image, Meta, Title
|
|
13
|
+
from .script import Script, script
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"Body",
|
|
17
|
+
"Description",
|
|
18
|
+
"ErrorBoundary",
|
|
19
|
+
"Fragment",
|
|
20
|
+
"Image",
|
|
21
|
+
"Links",
|
|
22
|
+
"Meta",
|
|
23
|
+
"Outlet",
|
|
24
|
+
"RawLink",
|
|
25
|
+
"Script",
|
|
26
|
+
"ScriptTag",
|
|
27
|
+
"Scripts",
|
|
28
|
+
"ScrollRestoration",
|
|
29
|
+
"Title",
|
|
30
|
+
"app_wrap",
|
|
31
|
+
"bare",
|
|
32
|
+
"error_boundary",
|
|
33
|
+
"fragment",
|
|
34
|
+
"script",
|
|
35
|
+
]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Top-level component that wraps the entire app."""
|
|
2
|
+
|
|
3
|
+
from reflex_base.components.component import Component
|
|
4
|
+
from reflex_base.vars.base import Var
|
|
5
|
+
|
|
6
|
+
from reflex_components_core.base.fragment import Fragment
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class AppWrap(Fragment):
|
|
10
|
+
"""Top-level component that wraps the entire app."""
|
|
11
|
+
|
|
12
|
+
@classmethod
|
|
13
|
+
def create(cls) -> Component:
|
|
14
|
+
"""Create a new AppWrap component.
|
|
15
|
+
|
|
16
|
+
Returns:
|
|
17
|
+
A new AppWrap component containing {children}.
|
|
18
|
+
"""
|
|
19
|
+
return super().create(Var(_js_expr="children"))
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""Stub file for reflex_components_core/base/app_wrap.py"""
|
|
2
|
+
|
|
3
|
+
# ------------------- DO NOT EDIT ----------------------
|
|
4
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
5
|
+
# ------------------------------------------------------
|
|
6
|
+
from collections.abc import Mapping, Sequence
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from reflex_base.event import EventType, PointerEventInfo
|
|
10
|
+
from reflex_base.vars.base import Var
|
|
11
|
+
|
|
12
|
+
from reflex_components_core.base.fragment import Fragment
|
|
13
|
+
from reflex_components_core.core.breakpoints import Breakpoints
|
|
14
|
+
|
|
15
|
+
class AppWrap(Fragment):
|
|
16
|
+
@classmethod
|
|
17
|
+
def create(
|
|
18
|
+
cls,
|
|
19
|
+
*children,
|
|
20
|
+
style: Sequence[Mapping[str, Any]]
|
|
21
|
+
| Mapping[str, Any]
|
|
22
|
+
| Var[Mapping[str, Any]]
|
|
23
|
+
| Breakpoints
|
|
24
|
+
| None = None,
|
|
25
|
+
key: Any | None = None,
|
|
26
|
+
id: Any | None = None,
|
|
27
|
+
ref: Var | None = None,
|
|
28
|
+
class_name: Any | None = None,
|
|
29
|
+
custom_attrs: dict[str, Var | Any] | None = None,
|
|
30
|
+
on_blur: EventType[()] | None = None,
|
|
31
|
+
on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
32
|
+
on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
33
|
+
on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
34
|
+
on_focus: EventType[()] | None = None,
|
|
35
|
+
on_mount: EventType[()] | None = None,
|
|
36
|
+
on_mouse_down: EventType[()] | None = None,
|
|
37
|
+
on_mouse_enter: EventType[()] | None = None,
|
|
38
|
+
on_mouse_leave: EventType[()] | None = None,
|
|
39
|
+
on_mouse_move: EventType[()] | None = None,
|
|
40
|
+
on_mouse_out: EventType[()] | None = None,
|
|
41
|
+
on_mouse_over: EventType[()] | None = None,
|
|
42
|
+
on_mouse_up: EventType[()] | None = None,
|
|
43
|
+
on_scroll: EventType[()] | None = None,
|
|
44
|
+
on_scroll_end: EventType[()] | None = None,
|
|
45
|
+
on_unmount: EventType[()] | None = None,
|
|
46
|
+
**props,
|
|
47
|
+
) -> AppWrap:
|
|
48
|
+
"""Create a new AppWrap component.
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
A new AppWrap component containing {children}.
|
|
52
|
+
"""
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
"""A bare component."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from collections.abc import Iterator, Sequence
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from reflex_base.components.component import BaseComponent, Component, ComponentStyle
|
|
9
|
+
from reflex_base.components.tags import Tag
|
|
10
|
+
from reflex_base.components.tags.tagless import Tagless
|
|
11
|
+
from reflex_base.environment import PerformanceMode, environment
|
|
12
|
+
from reflex_base.utils import console
|
|
13
|
+
from reflex_base.utils.decorator import once
|
|
14
|
+
from reflex_base.utils.imports import ParsedImportDict
|
|
15
|
+
from reflex_base.vars import BooleanVar, ObjectVar, Var
|
|
16
|
+
from reflex_base.vars.base import GLOBAL_CACHE, VarData
|
|
17
|
+
from reflex_base.vars.sequence import LiteralStringVar
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@once
|
|
21
|
+
def get_performance_mode():
|
|
22
|
+
"""Get the performance mode.
|
|
23
|
+
|
|
24
|
+
Returns:
|
|
25
|
+
The performance mode.
|
|
26
|
+
"""
|
|
27
|
+
return environment.REFLEX_PERF_MODE.get()
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def validate_str(value: str):
|
|
31
|
+
"""Validate a string value.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
value: The value to validate.
|
|
35
|
+
|
|
36
|
+
Raises:
|
|
37
|
+
ValueError: If the value is a Var and the performance mode is set to raise.
|
|
38
|
+
"""
|
|
39
|
+
perf_mode = get_performance_mode()
|
|
40
|
+
if perf_mode != PerformanceMode.OFF and value.startswith("reflex___state"):
|
|
41
|
+
if perf_mode == PerformanceMode.WARN:
|
|
42
|
+
console.warn(
|
|
43
|
+
f"Output includes {value!s} which will be displayed as a string. If you are calling `str` on a Var, consider using .to_string() instead."
|
|
44
|
+
)
|
|
45
|
+
elif perf_mode == PerformanceMode.RAISE:
|
|
46
|
+
msg = f"Output includes {value!s} which will be displayed as a string. If you are calling `str` on a Var, consider using .to_string() instead."
|
|
47
|
+
raise ValueError(msg)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _components_from_var(var: Var) -> Sequence[BaseComponent]:
|
|
51
|
+
var_data = var._get_all_var_data()
|
|
52
|
+
return var_data.components if var_data else ()
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class Bare(Component):
|
|
56
|
+
"""A component with no tag."""
|
|
57
|
+
|
|
58
|
+
contents: Var[Any]
|
|
59
|
+
|
|
60
|
+
@classmethod
|
|
61
|
+
def create(cls, contents: Any) -> Component:
|
|
62
|
+
"""Create a Bare component, with no tag.
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
contents: The contents of the component.
|
|
66
|
+
|
|
67
|
+
Returns:
|
|
68
|
+
The component.
|
|
69
|
+
"""
|
|
70
|
+
if isinstance(contents, Var):
|
|
71
|
+
if isinstance(contents, LiteralStringVar):
|
|
72
|
+
validate_str(contents._var_value)
|
|
73
|
+
return cls._unsafe_create(children=[], contents=contents)
|
|
74
|
+
if isinstance(contents, str):
|
|
75
|
+
validate_str(contents)
|
|
76
|
+
contents = Var.create(contents if contents is not None else "")
|
|
77
|
+
|
|
78
|
+
return cls._unsafe_create(children=[], contents=contents)
|
|
79
|
+
|
|
80
|
+
def _get_all_hooks_internal(self) -> dict[str, VarData | None]:
|
|
81
|
+
"""Include the hooks for the component.
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
The hooks for the component.
|
|
85
|
+
"""
|
|
86
|
+
hooks = super()._get_all_hooks_internal()
|
|
87
|
+
if isinstance(self.contents, Var):
|
|
88
|
+
for component in _components_from_var(self.contents):
|
|
89
|
+
hooks |= component._get_all_hooks_internal()
|
|
90
|
+
return hooks
|
|
91
|
+
|
|
92
|
+
def _get_all_hooks(self) -> dict[str, VarData | None]:
|
|
93
|
+
"""Include the hooks for the component.
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
The hooks for the component.
|
|
97
|
+
"""
|
|
98
|
+
hooks = super()._get_all_hooks()
|
|
99
|
+
if isinstance(self.contents, Var):
|
|
100
|
+
for component in _components_from_var(self.contents):
|
|
101
|
+
hooks |= component._get_all_hooks()
|
|
102
|
+
return hooks
|
|
103
|
+
|
|
104
|
+
def _get_all_imports(self, collapse: bool = False) -> ParsedImportDict:
|
|
105
|
+
"""Include the imports for the component.
|
|
106
|
+
|
|
107
|
+
Args:
|
|
108
|
+
collapse: Whether to collapse the imports.
|
|
109
|
+
|
|
110
|
+
Returns:
|
|
111
|
+
The imports for the component.
|
|
112
|
+
"""
|
|
113
|
+
imports = super()._get_all_imports(collapse=collapse)
|
|
114
|
+
if isinstance(self.contents, Var):
|
|
115
|
+
var_data = self.contents._get_all_var_data()
|
|
116
|
+
if var_data:
|
|
117
|
+
imports |= {k: list(v) for k, v in var_data.imports}
|
|
118
|
+
return imports
|
|
119
|
+
|
|
120
|
+
def _get_all_dynamic_imports(self) -> set[str]:
|
|
121
|
+
"""Get dynamic imports for the component.
|
|
122
|
+
|
|
123
|
+
Returns:
|
|
124
|
+
The dynamic imports.
|
|
125
|
+
"""
|
|
126
|
+
dynamic_imports = super()._get_all_dynamic_imports()
|
|
127
|
+
if isinstance(self.contents, Var):
|
|
128
|
+
for component in _components_from_var(self.contents):
|
|
129
|
+
dynamic_imports |= component._get_all_dynamic_imports()
|
|
130
|
+
return dynamic_imports
|
|
131
|
+
|
|
132
|
+
def _get_all_custom_code(self) -> dict[str, None]:
|
|
133
|
+
"""Get custom code for the component.
|
|
134
|
+
|
|
135
|
+
Returns:
|
|
136
|
+
The custom code.
|
|
137
|
+
"""
|
|
138
|
+
custom_code = super()._get_all_custom_code()
|
|
139
|
+
if isinstance(self.contents, Var):
|
|
140
|
+
for component in _components_from_var(self.contents):
|
|
141
|
+
custom_code |= component._get_all_custom_code()
|
|
142
|
+
return custom_code
|
|
143
|
+
|
|
144
|
+
def _get_all_app_wrap_components(
|
|
145
|
+
self, *, ignore_ids: set[int] | None = None
|
|
146
|
+
) -> dict[tuple[int, str], Component]:
|
|
147
|
+
"""Get the components that should be wrapped in the app.
|
|
148
|
+
|
|
149
|
+
Args:
|
|
150
|
+
ignore_ids: The ids to ignore when collecting components.
|
|
151
|
+
|
|
152
|
+
Returns:
|
|
153
|
+
The components that should be wrapped in the app.
|
|
154
|
+
"""
|
|
155
|
+
ignore_ids = ignore_ids or set()
|
|
156
|
+
app_wrap_components = super()._get_all_app_wrap_components(
|
|
157
|
+
ignore_ids=ignore_ids
|
|
158
|
+
)
|
|
159
|
+
if isinstance(self.contents, Var):
|
|
160
|
+
for component in _components_from_var(self.contents):
|
|
161
|
+
component_id = id(component)
|
|
162
|
+
if isinstance(component, Component) and component_id not in ignore_ids:
|
|
163
|
+
ignore_ids.add(component_id)
|
|
164
|
+
app_wrap_components |= component._get_all_app_wrap_components(
|
|
165
|
+
ignore_ids=ignore_ids
|
|
166
|
+
)
|
|
167
|
+
return app_wrap_components
|
|
168
|
+
|
|
169
|
+
def _get_all_refs(self) -> dict[str, None]:
|
|
170
|
+
"""Get the refs for the children of the component.
|
|
171
|
+
|
|
172
|
+
Returns:
|
|
173
|
+
The refs for the children.
|
|
174
|
+
"""
|
|
175
|
+
refs = super()._get_all_refs()
|
|
176
|
+
if isinstance(self.contents, Var):
|
|
177
|
+
for component in _components_from_var(self.contents):
|
|
178
|
+
refs |= component._get_all_refs()
|
|
179
|
+
return refs
|
|
180
|
+
|
|
181
|
+
def _render(self) -> Tag:
|
|
182
|
+
contents = (
|
|
183
|
+
Var.create(self.contents)
|
|
184
|
+
if not isinstance(self.contents, Var)
|
|
185
|
+
else self.contents
|
|
186
|
+
)
|
|
187
|
+
if isinstance(contents, (BooleanVar, ObjectVar)):
|
|
188
|
+
return Tagless(contents=f"{contents.to_string()!s}")
|
|
189
|
+
return Tagless(contents=f"{contents!s}")
|
|
190
|
+
|
|
191
|
+
def render(self) -> dict:
|
|
192
|
+
"""Render the component as a dictionary.
|
|
193
|
+
|
|
194
|
+
This is overridden to provide a short performant path for rendering.
|
|
195
|
+
|
|
196
|
+
Returns:
|
|
197
|
+
The rendered component.
|
|
198
|
+
"""
|
|
199
|
+
contents = (
|
|
200
|
+
Var.create(self.contents)
|
|
201
|
+
if not isinstance(self.contents, Var)
|
|
202
|
+
else self.contents
|
|
203
|
+
)
|
|
204
|
+
if isinstance(contents, (BooleanVar, ObjectVar)):
|
|
205
|
+
return {"contents": f"{contents.to_string()!s}"}
|
|
206
|
+
return {"contents": f"{contents!s}"}
|
|
207
|
+
|
|
208
|
+
def _add_style_recursive(
|
|
209
|
+
self, style: ComponentStyle, theme: Component | None = None
|
|
210
|
+
) -> Component:
|
|
211
|
+
"""Add style to the component and its children.
|
|
212
|
+
|
|
213
|
+
Args:
|
|
214
|
+
style: The style to add.
|
|
215
|
+
theme: The theme to add.
|
|
216
|
+
|
|
217
|
+
Returns:
|
|
218
|
+
The component with the style added.
|
|
219
|
+
"""
|
|
220
|
+
new_self = super()._add_style_recursive(style, theme)
|
|
221
|
+
|
|
222
|
+
are_components_touched = False
|
|
223
|
+
|
|
224
|
+
if isinstance(self.contents, Var):
|
|
225
|
+
for component in _components_from_var(self.contents):
|
|
226
|
+
if isinstance(component, Component):
|
|
227
|
+
component._add_style_recursive(style, theme)
|
|
228
|
+
are_components_touched = True
|
|
229
|
+
|
|
230
|
+
if are_components_touched:
|
|
231
|
+
GLOBAL_CACHE.clear()
|
|
232
|
+
|
|
233
|
+
return new_self
|
|
234
|
+
|
|
235
|
+
def _get_vars(
|
|
236
|
+
self, include_children: bool = False, ignore_ids: set[int] | None = None
|
|
237
|
+
) -> Iterator[Var]:
|
|
238
|
+
"""Walk all Vars used in this component.
|
|
239
|
+
|
|
240
|
+
Args:
|
|
241
|
+
include_children: Whether to include Vars from children.
|
|
242
|
+
ignore_ids: The ids to ignore.
|
|
243
|
+
|
|
244
|
+
Yields:
|
|
245
|
+
The contents if it is a Var, otherwise nothing.
|
|
246
|
+
"""
|
|
247
|
+
yield self.contents
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""Stub file for reflex_components_core/base/body.py"""
|
|
2
|
+
|
|
3
|
+
# ------------------- DO NOT EDIT ----------------------
|
|
4
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
5
|
+
# ------------------------------------------------------
|
|
6
|
+
from collections.abc import Mapping, Sequence
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from reflex_base.event import EventType, PointerEventInfo
|
|
10
|
+
from reflex_base.vars.base import Var
|
|
11
|
+
|
|
12
|
+
from reflex_components_core.core.breakpoints import Breakpoints
|
|
13
|
+
from reflex_components_core.el import elements
|
|
14
|
+
|
|
15
|
+
class Body(elements.Body):
|
|
16
|
+
@classmethod
|
|
17
|
+
def create(
|
|
18
|
+
cls,
|
|
19
|
+
*children,
|
|
20
|
+
style: Sequence[Mapping[str, Any]]
|
|
21
|
+
| Mapping[str, Any]
|
|
22
|
+
| Var[Mapping[str, Any]]
|
|
23
|
+
| Breakpoints
|
|
24
|
+
| None = None,
|
|
25
|
+
key: Any | None = None,
|
|
26
|
+
id: Any | None = None,
|
|
27
|
+
ref: Var | None = None,
|
|
28
|
+
class_name: Any | None = None,
|
|
29
|
+
custom_attrs: dict[str, Var | Any] | None = None,
|
|
30
|
+
on_blur: EventType[()] | None = None,
|
|
31
|
+
on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
32
|
+
on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
33
|
+
on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
34
|
+
on_focus: EventType[()] | None = None,
|
|
35
|
+
on_mount: EventType[()] | None = None,
|
|
36
|
+
on_mouse_down: EventType[()] | None = None,
|
|
37
|
+
on_mouse_enter: EventType[()] | None = None,
|
|
38
|
+
on_mouse_leave: EventType[()] | None = None,
|
|
39
|
+
on_mouse_move: EventType[()] | None = None,
|
|
40
|
+
on_mouse_out: EventType[()] | None = None,
|
|
41
|
+
on_mouse_over: EventType[()] | None = None,
|
|
42
|
+
on_mouse_up: EventType[()] | None = None,
|
|
43
|
+
on_scroll: EventType[()] | None = None,
|
|
44
|
+
on_scroll_end: EventType[()] | None = None,
|
|
45
|
+
on_unmount: EventType[()] | None = None,
|
|
46
|
+
**props,
|
|
47
|
+
) -> Body:
|
|
48
|
+
"""Create the component.
|
|
49
|
+
|
|
50
|
+
Args:
|
|
51
|
+
*children: The children of the component.
|
|
52
|
+
**props: The props of the component.
|
|
53
|
+
|
|
54
|
+
Returns:
|
|
55
|
+
The component.
|
|
56
|
+
"""
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""Document components."""
|
|
2
|
+
|
|
3
|
+
from reflex_base.components.component import Component
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ReactRouterLib(Component):
|
|
7
|
+
"""Root document components."""
|
|
8
|
+
|
|
9
|
+
library = "react-router"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Meta(ReactRouterLib):
|
|
13
|
+
"""The document meta tags."""
|
|
14
|
+
|
|
15
|
+
tag = "Meta"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Links(ReactRouterLib):
|
|
19
|
+
"""The document link tags."""
|
|
20
|
+
|
|
21
|
+
tag = "Links"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class ScrollRestoration(ReactRouterLib):
|
|
25
|
+
"""The document scroll restoration."""
|
|
26
|
+
|
|
27
|
+
tag = "ScrollRestoration"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class Outlet(ReactRouterLib):
|
|
31
|
+
"""The document outlet."""
|
|
32
|
+
|
|
33
|
+
tag = "Outlet"
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class Scripts(ReactRouterLib):
|
|
37
|
+
"""The document main scripts."""
|
|
38
|
+
|
|
39
|
+
tag = "Scripts"
|