reflex 0.8.7a1__py3-none-any.whl → 0.8.8__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/web/utils/state.js +5 -5
- reflex/app.py +15 -7
- reflex/app_mixins/lifespan.py +8 -2
- reflex/compiler/compiler.py +14 -14
- reflex/compiler/templates.py +629 -102
- reflex/compiler/utils.py +30 -21
- reflex/components/base/bare.py +17 -0
- reflex/components/component.py +38 -34
- reflex/components/core/cond.py +6 -12
- reflex/components/core/foreach.py +1 -1
- reflex/components/core/match.py +83 -60
- reflex/components/dynamic.py +3 -3
- reflex/components/el/elements/forms.py +31 -14
- reflex/components/el/elements/forms.pyi +0 -5
- reflex/components/lucide/icon.py +2 -1
- reflex/components/lucide/icon.pyi +2 -1
- reflex/components/markdown/markdown.py +2 -2
- reflex/components/radix/primitives/accordion.py +1 -1
- reflex/components/radix/primitives/drawer.py +10 -22
- reflex/components/radix/primitives/drawer.pyi +4 -0
- reflex/components/radix/primitives/form.py +1 -1
- reflex/components/radix/primitives/slider.py +1 -1
- reflex/components/tags/cond_tag.py +14 -5
- reflex/components/tags/iter_tag.py +0 -26
- reflex/components/tags/match_tag.py +15 -6
- reflex/components/tags/tag.py +3 -6
- reflex/components/tags/tagless.py +14 -0
- reflex/constants/base.py +0 -2
- reflex/constants/compiler.py +1 -1
- reflex/constants/installer.py +4 -4
- reflex/custom_components/custom_components.py +202 -15
- reflex/event.py +1 -1
- reflex/experimental/client_state.py +1 -1
- reflex/istate/manager.py +2 -1
- reflex/plugins/shared_tailwind.py +87 -62
- reflex/plugins/tailwind_v3.py +2 -2
- reflex/plugins/tailwind_v4.py +4 -4
- reflex/state.py +5 -1
- reflex/utils/format.py +3 -4
- reflex/utils/frontend_skeleton.py +2 -2
- reflex/utils/imports.py +18 -0
- reflex/utils/pyi_generator.py +10 -2
- reflex/utils/telemetry.py +4 -1
- reflex/utils/templates.py +1 -6
- {reflex-0.8.7a1.dist-info → reflex-0.8.8.dist-info}/METADATA +3 -4
- {reflex-0.8.7a1.dist-info → reflex-0.8.8.dist-info}/RECORD +49 -71
- reflex/.templates/jinja/app/rxconfig.py.jinja2 +0 -9
- reflex/.templates/jinja/custom_components/README.md.jinja2 +0 -9
- reflex/.templates/jinja/custom_components/__init__.py.jinja2 +0 -1
- reflex/.templates/jinja/custom_components/demo_app.py.jinja2 +0 -39
- reflex/.templates/jinja/custom_components/pyproject.toml.jinja2 +0 -25
- reflex/.templates/jinja/custom_components/src.py.jinja2 +0 -57
- reflex/.templates/jinja/web/package.json.jinja2 +0 -27
- reflex/.templates/jinja/web/pages/_app.js.jinja2 +0 -62
- reflex/.templates/jinja/web/pages/_document.js.jinja2 +0 -9
- reflex/.templates/jinja/web/pages/base_page.js.jinja2 +0 -21
- reflex/.templates/jinja/web/pages/component.js.jinja2 +0 -2
- reflex/.templates/jinja/web/pages/custom_component.js.jinja2 +0 -22
- reflex/.templates/jinja/web/pages/index.js.jinja2 +0 -18
- reflex/.templates/jinja/web/pages/macros.js.jinja2 +0 -38
- reflex/.templates/jinja/web/pages/stateful_component.js.jinja2 +0 -15
- reflex/.templates/jinja/web/pages/stateful_components.js.jinja2 +0 -5
- reflex/.templates/jinja/web/pages/utils.js.jinja2 +0 -93
- reflex/.templates/jinja/web/styles/styles.css.jinja2 +0 -6
- reflex/.templates/jinja/web/utils/context.js.jinja2 +0 -129
- reflex/.templates/jinja/web/utils/theme.js.jinja2 +0 -1
- reflex/.templates/jinja/web/vite.config.js.jinja2 +0 -74
- reflex/components/core/client_side_routing.pyi +0 -68
- {reflex-0.8.7a1.dist-info → reflex-0.8.8.dist-info}/WHEEL +0 -0
- {reflex-0.8.7a1.dist-info → reflex-0.8.8.dist-info}/entry_points.txt +0 -0
- {reflex-0.8.7a1.dist-info → reflex-0.8.8.dist-info}/licenses/LICENSE +0 -0
|
@@ -6,8 +6,6 @@ from collections.abc import Iterator
|
|
|
6
6
|
from hashlib import md5
|
|
7
7
|
from typing import Any, ClassVar, Literal
|
|
8
8
|
|
|
9
|
-
from jinja2 import Environment
|
|
10
|
-
|
|
11
9
|
from reflex.components.el.element import Element
|
|
12
10
|
from reflex.components.tags.tag import Tag
|
|
13
11
|
from reflex.constants import Dirs, EventTriggers
|
|
@@ -31,21 +29,40 @@ from reflex.vars.number import ternary_operation
|
|
|
31
29
|
|
|
32
30
|
from .base import BaseHTML
|
|
33
31
|
|
|
34
|
-
|
|
32
|
+
|
|
33
|
+
def _handle_submit_js_template(
|
|
34
|
+
handle_submit_unique_name: str,
|
|
35
|
+
form_data: str,
|
|
36
|
+
field_ref_mapping: str,
|
|
37
|
+
on_submit_event_chain: str,
|
|
38
|
+
reset_on_submit: str,
|
|
39
|
+
) -> str:
|
|
40
|
+
"""Generate handle submit JS using f-string formatting.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
handle_submit_unique_name: Unique name for the handle submit function.
|
|
44
|
+
form_data: Name of the form data variable.
|
|
45
|
+
field_ref_mapping: JSON string of field reference mappings.
|
|
46
|
+
on_submit_event_chain: Event chain for the submit handler.
|
|
47
|
+
reset_on_submit: Boolean string indicating if form should reset after submit.
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
JavaScript code for the form submit handler.
|
|
35
51
|
"""
|
|
36
|
-
|
|
52
|
+
return f"""
|
|
53
|
+
const handleSubmit_{handle_submit_unique_name} = useCallback((ev) => {{
|
|
37
54
|
const $form = ev.target
|
|
38
55
|
ev.preventDefault()
|
|
39
|
-
const {
|
|
56
|
+
const {form_data} = {{...Object.fromEntries(new FormData($form).entries()), ...{field_ref_mapping}}};
|
|
40
57
|
|
|
41
|
-
({
|
|
58
|
+
({on_submit_event_chain}(ev));
|
|
42
59
|
|
|
43
|
-
if ({
|
|
60
|
+
if ({reset_on_submit}) {{
|
|
44
61
|
$form.reset()
|
|
45
|
-
}
|
|
46
|
-
})
|
|
62
|
+
}}
|
|
63
|
+
}})
|
|
47
64
|
"""
|
|
48
|
-
|
|
65
|
+
|
|
49
66
|
|
|
50
67
|
ButtonType = Literal["submit", "reset", "button"]
|
|
51
68
|
|
|
@@ -198,14 +215,14 @@ class Form(BaseHTML):
|
|
|
198
215
|
if EventTriggers.ON_SUBMIT not in self.event_triggers:
|
|
199
216
|
return []
|
|
200
217
|
return [
|
|
201
|
-
|
|
202
|
-
handle_submit_unique_name=self.handle_submit_unique_name,
|
|
203
|
-
form_data=FORM_DATA,
|
|
218
|
+
_handle_submit_js_template(
|
|
219
|
+
handle_submit_unique_name=str(self.handle_submit_unique_name),
|
|
220
|
+
form_data=str(FORM_DATA),
|
|
204
221
|
field_ref_mapping=str(LiteralVar.create(self._get_form_refs())),
|
|
205
222
|
on_submit_event_chain=str(
|
|
206
223
|
LiteralVar.create(self.event_triggers[EventTriggers.ON_SUBMIT])
|
|
207
224
|
),
|
|
208
|
-
reset_on_submit=self.reset_on_submit,
|
|
225
|
+
reset_on_submit=str(self.reset_on_submit).lower(),
|
|
209
226
|
)
|
|
210
227
|
]
|
|
211
228
|
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
from collections.abc import Mapping, Sequence
|
|
7
7
|
from typing import Any, Literal
|
|
8
8
|
|
|
9
|
-
from jinja2 import Environment
|
|
10
|
-
|
|
11
9
|
from reflex.components.core.breakpoints import Breakpoints
|
|
12
10
|
from reflex.components.el.element import Element
|
|
13
11
|
from reflex.event import EventType, KeyInputInfo, PointerEventInfo
|
|
@@ -16,9 +14,6 @@ from reflex.vars.base import Var
|
|
|
16
14
|
|
|
17
15
|
from .base import BaseHTML
|
|
18
16
|
|
|
19
|
-
HANDLE_SUBMIT_JS_JINJA2 = Environment().from_string(
|
|
20
|
-
"\n const handleSubmit_{{ handle_submit_unique_name }} = useCallback((ev) => {\n const $form = ev.target\n ev.preventDefault()\n const {{ form_data }} = {...Object.fromEntries(new FormData($form).entries()), ...{{ field_ref_mapping }}};\n\n ({{ on_submit_event_chain }}(ev));\n\n if ({{ reset_on_submit }}) {\n $form.reset()\n }\n })\n "
|
|
21
|
-
)
|
|
22
17
|
ButtonType = Literal["submit", "reset", "button"]
|
|
23
18
|
|
|
24
19
|
class Button(BaseHTML):
|
reflex/components/lucide/icon.py
CHANGED
|
@@ -6,7 +6,7 @@ from reflex.utils.imports import ImportVar
|
|
|
6
6
|
from reflex.vars.base import LiteralVar, Var
|
|
7
7
|
from reflex.vars.sequence import LiteralStringVar, StringVar
|
|
8
8
|
|
|
9
|
-
LUCIDE_LIBRARY = "lucide-react@0.
|
|
9
|
+
LUCIDE_LIBRARY = "lucide-react@0.541.0"
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class LucideIconComponent(Component):
|
|
@@ -1330,6 +1330,7 @@ LUCIDE_ICON_LIST = [
|
|
|
1330
1330
|
"rocket",
|
|
1331
1331
|
"rocking_chair",
|
|
1332
1332
|
"roller_coaster",
|
|
1333
|
+
"rose",
|
|
1333
1334
|
"rotate_3d",
|
|
1334
1335
|
"rotate_ccw_key",
|
|
1335
1336
|
"rotate_ccw_square",
|
|
@@ -11,7 +11,7 @@ from reflex.components.core.breakpoints import Breakpoints
|
|
|
11
11
|
from reflex.event import EventType, PointerEventInfo
|
|
12
12
|
from reflex.vars.base import Var
|
|
13
13
|
|
|
14
|
-
LUCIDE_LIBRARY = "lucide-react@0.
|
|
14
|
+
LUCIDE_LIBRARY = "lucide-react@0.541.0"
|
|
15
15
|
|
|
16
16
|
class LucideIconComponent(Component):
|
|
17
17
|
@classmethod
|
|
@@ -1395,6 +1395,7 @@ LUCIDE_ICON_LIST = [
|
|
|
1395
1395
|
"rocket",
|
|
1396
1396
|
"rocking_chair",
|
|
1397
1397
|
"roller_coaster",
|
|
1398
|
+
"rose",
|
|
1398
1399
|
"rotate_3d",
|
|
1399
1400
|
"rotate_ccw_key",
|
|
1400
1401
|
"rotate_ccw_square",
|
|
@@ -422,12 +422,12 @@ let {_LANGUAGE!s} = match ? match[1] : '';
|
|
|
422
422
|
|
|
423
423
|
def _get_custom_code(self) -> str | None:
|
|
424
424
|
hooks = {}
|
|
425
|
-
from reflex.compiler.templates import
|
|
425
|
+
from reflex.compiler.templates import _render_hooks
|
|
426
426
|
|
|
427
427
|
for _component in self.component_map.values():
|
|
428
428
|
comp = _component(_MOCK_ARG)
|
|
429
429
|
hooks.update(comp._get_all_hooks())
|
|
430
|
-
formatted_hooks =
|
|
430
|
+
formatted_hooks = _render_hooks(hooks)
|
|
431
431
|
return f"""
|
|
432
432
|
function {self._get_component_map_name()} () {{
|
|
433
433
|
{formatted_hooks}
|
|
@@ -54,7 +54,7 @@ def _inherited_variant_selector(
|
|
|
54
54
|
class AccordionComponent(RadixPrimitiveComponent):
|
|
55
55
|
"""Base class for all @radix-ui/accordion components."""
|
|
56
56
|
|
|
57
|
-
library = "@radix-ui/react-accordion@1.2.
|
|
57
|
+
library = "@radix-ui/react-accordion@1.2.12"
|
|
58
58
|
|
|
59
59
|
# The color scheme of the component.
|
|
60
60
|
color_scheme: Var[LiteralAccentColor]
|
|
@@ -21,7 +21,7 @@ class DrawerComponent(RadixPrimitiveComponent):
|
|
|
21
21
|
|
|
22
22
|
library = "vaul@1.1.2"
|
|
23
23
|
|
|
24
|
-
lib_dependencies: list[str] = ["@radix-ui/react-dialog@1.1.
|
|
24
|
+
lib_dependencies: list[str] = ["@radix-ui/react-dialog@1.1.15"]
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
LiteralDirectionType = Literal["top", "bottom", "left", "right"]
|
|
@@ -124,13 +124,13 @@ class DrawerContent(DrawerComponent):
|
|
|
124
124
|
alias = "Vaul" + tag
|
|
125
125
|
|
|
126
126
|
# Style set partially based on the source code at https://ui.shadcn.com/docs/components/drawer
|
|
127
|
-
def
|
|
127
|
+
def add_style(self) -> dict:
|
|
128
128
|
"""Get the style for the component.
|
|
129
129
|
|
|
130
130
|
Returns:
|
|
131
131
|
The dictionary of the component style as value and the style notation as key.
|
|
132
132
|
"""
|
|
133
|
-
|
|
133
|
+
return {
|
|
134
134
|
"left": "0",
|
|
135
135
|
"right": "0",
|
|
136
136
|
"bottom": "0",
|
|
@@ -139,9 +139,6 @@ class DrawerContent(DrawerComponent):
|
|
|
139
139
|
"z_index": 50,
|
|
140
140
|
"display": "flex",
|
|
141
141
|
}
|
|
142
|
-
style = self.style or {}
|
|
143
|
-
base_style.update(style)
|
|
144
|
-
return {"css": base_style}
|
|
145
142
|
|
|
146
143
|
# Fired when the drawer content is opened.
|
|
147
144
|
on_open_auto_focus: EventHandler[no_args_event_spec]
|
|
@@ -186,13 +183,13 @@ class DrawerOverlay(DrawerComponent):
|
|
|
186
183
|
alias = "Vaul" + tag
|
|
187
184
|
|
|
188
185
|
# Style set based on the source code at https://ui.shadcn.com/docs/components/drawer
|
|
189
|
-
def
|
|
186
|
+
def add_style(self) -> dict:
|
|
190
187
|
"""Get the style for the component.
|
|
191
188
|
|
|
192
189
|
Returns:
|
|
193
190
|
The dictionary of the component style as value and the style notation as key.
|
|
194
191
|
"""
|
|
195
|
-
|
|
192
|
+
return {
|
|
196
193
|
"position": "fixed",
|
|
197
194
|
"left": "0",
|
|
198
195
|
"right": "0",
|
|
@@ -201,9 +198,6 @@ class DrawerOverlay(DrawerComponent):
|
|
|
201
198
|
"z_index": 50,
|
|
202
199
|
"background": "rgba(0, 0, 0, 0.5)",
|
|
203
200
|
}
|
|
204
|
-
style = self.style or {}
|
|
205
|
-
base_style.update(style)
|
|
206
|
-
return {"css": base_style}
|
|
207
201
|
|
|
208
202
|
|
|
209
203
|
class DrawerClose(DrawerTrigger):
|
|
@@ -222,21 +216,18 @@ class DrawerTitle(DrawerComponent):
|
|
|
222
216
|
alias = "Vaul" + tag
|
|
223
217
|
|
|
224
218
|
# Style set based on the source code at https://ui.shadcn.com/docs/components/drawer
|
|
225
|
-
def
|
|
219
|
+
def add_style(self) -> dict:
|
|
226
220
|
"""Get the style for the component.
|
|
227
221
|
|
|
228
222
|
Returns:
|
|
229
223
|
The dictionary of the component style as value and the style notation as key.
|
|
230
224
|
"""
|
|
231
|
-
|
|
225
|
+
return {
|
|
232
226
|
"font-size": "1.125rem",
|
|
233
227
|
"font-weight": "600",
|
|
234
|
-
"line-
|
|
228
|
+
"line-height": "1",
|
|
235
229
|
"letter-spacing": "-0.05em",
|
|
236
230
|
}
|
|
237
|
-
style = self.style or {}
|
|
238
|
-
base_style.update(style)
|
|
239
|
-
return {"css": base_style}
|
|
240
231
|
|
|
241
232
|
|
|
242
233
|
class DrawerDescription(DrawerComponent):
|
|
@@ -247,18 +238,15 @@ class DrawerDescription(DrawerComponent):
|
|
|
247
238
|
alias = "Vaul" + tag
|
|
248
239
|
|
|
249
240
|
# Style set based on the source code at https://ui.shadcn.com/docs/components/drawer
|
|
250
|
-
def
|
|
241
|
+
def add_style(self) -> dict:
|
|
251
242
|
"""Get the style for the component.
|
|
252
243
|
|
|
253
244
|
Returns:
|
|
254
245
|
The dictionary of the component style as value and the style notation as key.
|
|
255
246
|
"""
|
|
256
|
-
|
|
247
|
+
return {
|
|
257
248
|
"font-size": "0.875rem",
|
|
258
249
|
}
|
|
259
|
-
style = self.style or {}
|
|
260
|
-
base_style.update(style)
|
|
261
|
-
return {"css": base_style}
|
|
262
250
|
|
|
263
251
|
|
|
264
252
|
class DrawerHandle(DrawerComponent):
|
|
@@ -249,6 +249,7 @@ class DrawerPortal(DrawerComponent):
|
|
|
249
249
|
"""
|
|
250
250
|
|
|
251
251
|
class DrawerContent(DrawerComponent):
|
|
252
|
+
def add_style(self) -> dict: ...
|
|
252
253
|
@classmethod
|
|
253
254
|
def create(
|
|
254
255
|
cls,
|
|
@@ -309,6 +310,7 @@ class DrawerContent(DrawerComponent):
|
|
|
309
310
|
"""
|
|
310
311
|
|
|
311
312
|
class DrawerOverlay(DrawerComponent):
|
|
313
|
+
def add_style(self) -> dict: ...
|
|
312
314
|
@classmethod
|
|
313
315
|
def create(
|
|
314
316
|
cls,
|
|
@@ -411,6 +413,7 @@ class DrawerClose(DrawerTrigger):
|
|
|
411
413
|
"""
|
|
412
414
|
|
|
413
415
|
class DrawerTitle(DrawerComponent):
|
|
416
|
+
def add_style(self) -> dict: ...
|
|
414
417
|
@classmethod
|
|
415
418
|
def create(
|
|
416
419
|
cls,
|
|
@@ -462,6 +465,7 @@ class DrawerTitle(DrawerComponent):
|
|
|
462
465
|
"""
|
|
463
466
|
|
|
464
467
|
class DrawerDescription(DrawerComponent):
|
|
468
|
+
def add_style(self) -> dict: ...
|
|
465
469
|
@classmethod
|
|
466
470
|
def create(
|
|
467
471
|
cls,
|
|
@@ -17,7 +17,7 @@ from .base import RadixPrimitiveComponentWithClassName
|
|
|
17
17
|
class FormComponent(RadixPrimitiveComponentWithClassName):
|
|
18
18
|
"""Base class for all @radix-ui/react-form components."""
|
|
19
19
|
|
|
20
|
-
library = "@radix-ui/react-form@0.1.
|
|
20
|
+
library = "@radix-ui/react-form@0.1.8"
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
class FormRoot(FormComponent, HTMLForm):
|
|
@@ -17,7 +17,7 @@ LiteralSliderDir = Literal["ltr", "rtl"]
|
|
|
17
17
|
class SliderComponent(RadixPrimitiveComponentWithClassName):
|
|
18
18
|
"""Base class for all @radix-ui/react-slider components."""
|
|
19
19
|
|
|
20
|
-
library = "@radix-ui/react-slider@1.3.
|
|
20
|
+
library = "@radix-ui/react-slider@1.3.6"
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
def on_value_event_spec(
|
|
@@ -1,22 +1,31 @@
|
|
|
1
1
|
"""Tag to conditionally render components."""
|
|
2
2
|
|
|
3
3
|
import dataclasses
|
|
4
|
-
from collections.abc import Mapping
|
|
4
|
+
from collections.abc import Iterator, Mapping
|
|
5
5
|
from typing import Any
|
|
6
6
|
|
|
7
7
|
from reflex.components.tags.tag import Tag
|
|
8
|
-
from reflex.vars.base import Var
|
|
9
8
|
|
|
10
9
|
|
|
11
|
-
@dataclasses.dataclass(frozen=True)
|
|
10
|
+
@dataclasses.dataclass(frozen=True, kw_only=True)
|
|
12
11
|
class CondTag(Tag):
|
|
13
12
|
"""A conditional tag."""
|
|
14
13
|
|
|
15
14
|
# The condition to determine which component to render.
|
|
16
|
-
|
|
15
|
+
cond_state: str
|
|
17
16
|
|
|
18
17
|
# The code to render if the condition is true.
|
|
19
|
-
true_value: Mapping
|
|
18
|
+
true_value: Mapping
|
|
20
19
|
|
|
21
20
|
# The code to render if the condition is false.
|
|
22
21
|
false_value: Mapping | None = None
|
|
22
|
+
|
|
23
|
+
def __iter__(self) -> Iterator[tuple[str, Any]]:
|
|
24
|
+
"""Iterate over the tag's attributes.
|
|
25
|
+
|
|
26
|
+
Yields:
|
|
27
|
+
An iterator over the tag's attributes.
|
|
28
|
+
"""
|
|
29
|
+
yield ("cond_state", self.cond_state)
|
|
30
|
+
yield ("true_value", self.true_value)
|
|
31
|
+
yield ("false_value", self.false_value)
|
|
@@ -68,32 +68,6 @@ class IterTag(Tag):
|
|
|
68
68
|
_var_type=self.get_iterable_var_type(),
|
|
69
69
|
).guess_type()
|
|
70
70
|
|
|
71
|
-
def get_index_var_arg(self) -> Var:
|
|
72
|
-
"""Get the index var for the tag (without curly braces).
|
|
73
|
-
|
|
74
|
-
This is used to render the index var in the .map() function.
|
|
75
|
-
|
|
76
|
-
Returns:
|
|
77
|
-
The index var.
|
|
78
|
-
"""
|
|
79
|
-
return Var(
|
|
80
|
-
_js_expr=self.index_var_name,
|
|
81
|
-
_var_type=int,
|
|
82
|
-
).guess_type()
|
|
83
|
-
|
|
84
|
-
def get_arg_var_arg(self) -> Var:
|
|
85
|
-
"""Get the arg var for the tag (without curly braces).
|
|
86
|
-
|
|
87
|
-
This is used to render the arg var in the .map() function.
|
|
88
|
-
|
|
89
|
-
Returns:
|
|
90
|
-
The arg var.
|
|
91
|
-
"""
|
|
92
|
-
return Var(
|
|
93
|
-
_js_expr=self.arg_var_name,
|
|
94
|
-
_var_type=self.get_iterable_var_type(),
|
|
95
|
-
).guess_type()
|
|
96
|
-
|
|
97
71
|
def render_component(self) -> Component:
|
|
98
72
|
"""Render the component.
|
|
99
73
|
|
|
@@ -1,22 +1,31 @@
|
|
|
1
1
|
"""Tag to conditionally match cases."""
|
|
2
2
|
|
|
3
3
|
import dataclasses
|
|
4
|
-
from collections.abc import Sequence
|
|
4
|
+
from collections.abc import Iterator, Mapping, Sequence
|
|
5
5
|
from typing import Any
|
|
6
6
|
|
|
7
7
|
from reflex.components.tags.tag import Tag
|
|
8
|
-
from reflex.vars.base import Var
|
|
9
8
|
|
|
10
9
|
|
|
11
|
-
@dataclasses.dataclass(frozen=True)
|
|
10
|
+
@dataclasses.dataclass(frozen=True, kw_only=True)
|
|
12
11
|
class MatchTag(Tag):
|
|
13
12
|
"""A match tag."""
|
|
14
13
|
|
|
15
14
|
# The condition to determine which case to match.
|
|
16
|
-
cond:
|
|
15
|
+
cond: str
|
|
17
16
|
|
|
18
17
|
# The list of match cases to be matched.
|
|
19
|
-
match_cases: Sequence[
|
|
18
|
+
match_cases: Sequence[tuple[Sequence[str], Mapping]]
|
|
20
19
|
|
|
21
20
|
# The catchall case to match.
|
|
22
|
-
default: Any
|
|
21
|
+
default: Any
|
|
22
|
+
|
|
23
|
+
def __iter__(self) -> Iterator[tuple[str, Any]]:
|
|
24
|
+
"""Iterate over the tag's attributes.
|
|
25
|
+
|
|
26
|
+
Yields:
|
|
27
|
+
An iterator over the tag's attributes.
|
|
28
|
+
"""
|
|
29
|
+
yield ("cond", self.cond)
|
|
30
|
+
yield ("match_cases", self.match_cases)
|
|
31
|
+
yield ("default", self.default)
|
reflex/components/tags/tag.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import dataclasses
|
|
6
|
-
from collections.abc import Mapping, Sequence
|
|
6
|
+
from collections.abc import Iterator, Mapping, Sequence
|
|
7
7
|
from typing import Any
|
|
8
8
|
|
|
9
9
|
from reflex.event import EventChain
|
|
@@ -41,16 +41,13 @@ class Tag:
|
|
|
41
41
|
# The props of the tag.
|
|
42
42
|
props: Mapping[str, Any] = dataclasses.field(default_factory=dict)
|
|
43
43
|
|
|
44
|
-
# The inner contents of the tag.
|
|
45
|
-
contents: str = ""
|
|
46
|
-
|
|
47
44
|
# Special props that aren't key value pairs.
|
|
48
45
|
special_props: Sequence[Var] = dataclasses.field(default_factory=list)
|
|
49
46
|
|
|
50
47
|
# The children components.
|
|
51
48
|
children: Sequence[Any] = dataclasses.field(default_factory=list)
|
|
52
49
|
|
|
53
|
-
def format_props(self) -> list:
|
|
50
|
+
def format_props(self) -> list[str]:
|
|
54
51
|
"""Format the tag's props.
|
|
55
52
|
|
|
56
53
|
Returns:
|
|
@@ -69,7 +66,7 @@ class Tag:
|
|
|
69
66
|
"""
|
|
70
67
|
return dataclasses.replace(self, **kwargs)
|
|
71
68
|
|
|
72
|
-
def __iter__(self):
|
|
69
|
+
def __iter__(self) -> Iterator[tuple[str, Any]]:
|
|
73
70
|
"""Iterate over the tag's fields.
|
|
74
71
|
|
|
75
72
|
Yields:
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
"""A tag with no tag."""
|
|
2
2
|
|
|
3
|
+
import dataclasses
|
|
4
|
+
|
|
3
5
|
from reflex.components.tags import Tag
|
|
4
6
|
from reflex.utils import format
|
|
5
7
|
|
|
6
8
|
|
|
9
|
+
@dataclasses.dataclass(frozen=True, kw_only=True)
|
|
7
10
|
class Tagless(Tag):
|
|
8
11
|
"""A tag with no tag."""
|
|
9
12
|
|
|
13
|
+
# The inner contents of the tag.
|
|
14
|
+
contents: str
|
|
15
|
+
|
|
10
16
|
def __str__(self) -> str:
|
|
11
17
|
"""Return the string representation of the tag.
|
|
12
18
|
|
|
@@ -20,3 +26,11 @@ class Tagless(Tag):
|
|
|
20
26
|
if len(self.contents) > 0 and self.contents[-1] == " ":
|
|
21
27
|
out = out + space
|
|
22
28
|
return out
|
|
29
|
+
|
|
30
|
+
def __iter__(self):
|
|
31
|
+
"""Iterate over the tag's fields.
|
|
32
|
+
|
|
33
|
+
Yields:
|
|
34
|
+
tuple[str, Any]: The field name and value.
|
|
35
|
+
"""
|
|
36
|
+
yield "contents", self.contents
|
reflex/constants/base.py
CHANGED
|
@@ -141,8 +141,6 @@ class Templates(SimpleNamespace):
|
|
|
141
141
|
BASE = Reflex.ROOT_DIR / Reflex.MODULE_NAME / ".templates"
|
|
142
142
|
# The web subdirectory of the template directory.
|
|
143
143
|
WEB_TEMPLATE = BASE / "web"
|
|
144
|
-
# The jinja template directory.
|
|
145
|
-
JINJA_TEMPLATE = BASE / "jinja"
|
|
146
144
|
# Where the code for the templates is stored.
|
|
147
145
|
CODE = "code"
|
|
148
146
|
|
reflex/constants/compiler.py
CHANGED
|
@@ -64,7 +64,7 @@ class CompileVars(SimpleNamespace):
|
|
|
64
64
|
# The name of the var storing any connection error.
|
|
65
65
|
CONNECT_ERROR = "connectErrors"
|
|
66
66
|
# The name of the function for converting a dict to an event.
|
|
67
|
-
TO_EVENT = "
|
|
67
|
+
TO_EVENT = "ReflexEvent"
|
|
68
68
|
# The name of the internal on_load event.
|
|
69
69
|
ON_LOAD_INTERNAL = "reflex___state____on_load_internal_state.on_load_internal"
|
|
70
70
|
# The name of the internal event to update generic state vars.
|
reflex/constants/installer.py
CHANGED
|
@@ -75,7 +75,7 @@ fetch-retries=0
|
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
def _determine_react_router_version() -> str:
|
|
78
|
-
default_version = "7.8.
|
|
78
|
+
default_version = "7.8.1"
|
|
79
79
|
if (version := os.getenv("REACT_ROUTER_VERSION")) and version != default_version:
|
|
80
80
|
from reflex.utils import console
|
|
81
81
|
|
|
@@ -131,7 +131,7 @@ class PackageJson(SimpleNamespace):
|
|
|
131
131
|
"react": cls._react_version,
|
|
132
132
|
"react-helmet": "6.1.0",
|
|
133
133
|
"react-dom": cls._react_version,
|
|
134
|
-
"isbot": "5.1.
|
|
134
|
+
"isbot": "5.1.30",
|
|
135
135
|
"socket.io-client": "4.8.1",
|
|
136
136
|
"universal-cookie": "7.2.2",
|
|
137
137
|
}
|
|
@@ -143,11 +143,11 @@ class PackageJson(SimpleNamespace):
|
|
|
143
143
|
"postcss-import": "16.1.1",
|
|
144
144
|
"@react-router/dev": _react_router_version,
|
|
145
145
|
"@react-router/fs-routes": _react_router_version,
|
|
146
|
-
"vite": "npm:rolldown-vite@7.1.
|
|
146
|
+
"vite": "npm:rolldown-vite@7.1.3",
|
|
147
147
|
}
|
|
148
148
|
OVERRIDES = {
|
|
149
149
|
# This should always match the `react` version in DEPENDENCIES for recharts compatibility.
|
|
150
150
|
"react-is": _react_version,
|
|
151
151
|
"cookie": "1.0.2",
|
|
152
|
-
"vite": "npm:rolldown-vite@7.1.
|
|
152
|
+
"vite": "npm:rolldown-vite@7.1.3",
|
|
153
153
|
}
|