Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions pyi_hashes.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"reflex/components/base/error_boundary.pyi": "cb264905a4e8dd450f7a59c8ccee6280",
"reflex/components/base/fragment.pyi": "bf9f8d708d32ae475e8b492f29a1b853",
"reflex/components/base/link.pyi": "12b3fd940e4acf8ee6016dfb8da34879",
"reflex/components/base/meta.pyi": "96fdfb33ffe5ae3f5324526036be099f",
"reflex/components/base/meta.pyi": "907920173adfabfe1bd6b066032f4ef7",
"reflex/components/base/script.pyi": "43a0e21f257b10d2c76ed359284a9d80",
"reflex/components/base/strict_mode.pyi": "d169c575d676c73edc6a3f593badfd1f",
"reflex/components/core/__init__.pyi": "7ab6923c0e08c8990a1d2e8f7869ca38",
Expand All @@ -20,11 +20,11 @@
"reflex/components/core/helmet.pyi": "20afb0edbadb506d5cf374f153b3c6cf",
"reflex/components/core/html.pyi": "faf9bb353ef4784e7f17ac97c93ef697",
"reflex/components/core/sticky.pyi": "cdf17e6cd287e7300acd25669701d117",
"reflex/components/core/upload.pyi": "3abe07bdedc58a253accfc97f4207db8",
"reflex/components/core/upload.pyi": "4a44f34dc8e9450a383ee60a87a69e2c",
"reflex/components/datadisplay/__init__.pyi": "87eae833026739e8d48a9891e185b3c2",
"reflex/components/datadisplay/code.pyi": "67c4ac180d48cd7708471744e2201205",
"reflex/components/datadisplay/code.pyi": "3787ca724cae7b29d57ea03f981b8c22",
"reflex/components/datadisplay/dataeditor.pyi": "23f777b8a46eff2afd95035dd5fc51a7",
"reflex/components/datadisplay/shiki_code_block.pyi": "71b00d76364a92e246ff393fdd8cddcc",
"reflex/components/datadisplay/shiki_code_block.pyi": "0bf1ed97bcc4159df150d56d92d78945",
"reflex/components/el/__init__.pyi": "93bde7e3672a442bb2562a9b04d8b9d9",
"reflex/components/el/element.pyi": "7faa2cda13a04870d6c1cbfb4b3a2a0a",
"reflex/components/el/elements/__init__.pyi": "6f09637fb00205071f19eb73491d256f",
Expand All @@ -40,7 +40,7 @@
"reflex/components/el/elements/typography.pyi": "dc4e234a7a58be0a9c2c6036a52f9b59",
"reflex/components/gridjs/datatable.pyi": "5c19d2b5788a8520d43a4d6dcc247705",
"reflex/components/lucide/icon.pyi": "e48c9fa2fe6308d366634b6a5157bf3a",
"reflex/components/markdown/markdown.pyi": "68d8f112cf1e2ceff0fd0606a2abcf62",
"reflex/components/markdown/markdown.pyi": "a569dd6a60d67baebfc4d04cddf85020",
"reflex/components/moment/moment.pyi": "4ca29ae9cae720eb5c4955682e4cb7df",
"reflex/components/plotly/plotly.pyi": "1de86aa6881e59d4053206e62e3039c3",
"reflex/components/radix/__init__.pyi": "7dcf3869b498d6cbf3ec9986c9bf3c86",
Expand All @@ -53,7 +53,7 @@
"reflex/components/radix/primitives/slider.pyi": "6dd3197c7d8e4af0a7de3e34ff940597",
"reflex/components/radix/themes/__init__.pyi": "55d491b7e1fe8aaa9ddc9834a819b54d",
"reflex/components/radix/themes/base.pyi": "82885483a3aa7cc88d19b33d596d140a",
"reflex/components/radix/themes/color_mode.pyi": "e2f94787f6e3498e2aaa4e2c37d135c2",
"reflex/components/radix/themes/color_mode.pyi": "889d9f492136a4600da3a79b9a3c5cc4",
"reflex/components/radix/themes/components/__init__.pyi": "4e70d106bc0aba70f2f23fc32c452aee",
"reflex/components/radix/themes/components/alert_dialog.pyi": "ccff6da776d85e93199982c59c412a6d",
"reflex/components/radix/themes/components/aspect_ratio.pyi": "b11efdce4c5954f6cbd2ba6f3b1b544c",
Expand Down Expand Up @@ -111,7 +111,7 @@
"reflex/components/react_player/react_player.pyi": "a9917f411d51cf3f291758c9e01844f2",
"reflex/components/react_player/video.pyi": "ef4730235b7902fa30859083db8b36a3",
"reflex/components/recharts/__init__.pyi": "ea5b61055f486497a1901429a9d7c9df",
"reflex/components/recharts/cartesian.pyi": "75f7506f7854c52ce59517336ae790d0",
"reflex/components/recharts/cartesian.pyi": "d9558034d606669ef40f7212b5644539",
"reflex/components/recharts/charts.pyi": "58415e7aef3d4642494e1b86aea6589c",
"reflex/components/recharts/general.pyi": "a12735989ef36152b2dab954604953c0",
"reflex/components/recharts/polar.pyi": "ff9f90861ae950d6db9c1bc160303182",
Expand Down
19 changes: 4 additions & 15 deletions reflex/components/base/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from reflex.components.base.bare import Bare
from reflex.components.el import elements
from reflex.vars.base import Var


class Title(elements.Title):
Expand All @@ -28,31 +29,19 @@ def render(self) -> dict:
class Meta(elements.Meta):
"""A component that displays metadata for the current page."""

# The description of character encoding.
char_set: str | None = None

# The value of meta.
content: str | None = None

# The name of metadata.
name: str | None = None

# The type of metadata value.
property: str | None = None
Comment on lines -31 to -41
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we removing these?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they are inherited


# The type of metadata value.
http_equiv: str | None = None
property: Var[str]


class Description(elements.Meta):
"""A component that displays the title of the current page."""

# The type of the description.
name: str | None = "description"
name: Var[str] = Var.create("description")


class Image(elements.Meta):
"""A component that displays the title of the current page."""

# The type of the image.
property: str | None = "og:image"
property: Var[str] = Var.create("og:image")
4 changes: 2 additions & 2 deletions reflex/components/core/foreach.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing import Any

from reflex.components.base.fragment import Fragment
from reflex.components.component import Component
from reflex.components.component import Component, field
from reflex.components.core.cond import cond
from reflex.components.tags import IterTag
from reflex.constants import MemoizationMode
Expand Down Expand Up @@ -36,7 +36,7 @@ class Foreach(Component):
iterable: Var[Iterable]

# A function from the render args to the component.
render_fn: Callable = Fragment.create
render_fn: Callable = field(default=Fragment.create, is_javascript_property=False)

@classmethod
def create(
Expand Down
6 changes: 3 additions & 3 deletions reflex/components/core/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Any

from reflex.components.base import Fragment
from reflex.components.component import BaseComponent, Component, MemoizationLeaf
from reflex.components.component import BaseComponent, Component, MemoizationLeaf, field
from reflex.components.tags import MatchTag, Tag
from reflex.style import Style
from reflex.utils import format
Expand All @@ -21,10 +21,10 @@ class Match(MemoizationLeaf):
cond: Var[Any]

# The list of match cases to be matched.
match_cases: list[Any] = []
match_cases: list[Any] = field(default_factory=list, is_javascript_property=False)

# The catchall case to match.
default: Any
default: Any = field(default=None, is_javascript_property=False)

@classmethod
def create(cls, cond: Any, *cases) -> Component | Var:
Expand Down
3 changes: 2 additions & 1 deletion reflex/components/core/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
ComponentNamespace,
MemoizationLeaf,
StatefulComponent,
field,
)
from reflex.components.core.cond import cond
from reflex.components.el.elements.forms import Input
Expand Down Expand Up @@ -234,7 +235,7 @@ class Upload(MemoizationLeaf):
on_drop: EventHandler[_on_drop_spec]

# Style rules to apply when actively dragging.
drag_active_style: Style | None = None
drag_active_style: Style | None = field(default=None, is_javascript_property=False)

@classmethod
def create(cls, *children, **props) -> Component:
Expand Down
19 changes: 12 additions & 7 deletions reflex/components/datadisplay/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import dataclasses
from typing import ClassVar, Literal

from reflex.components.component import Component, ComponentNamespace
from reflex.components.component import Component, ComponentNamespace, field
from reflex.components.core.cond import color_mode_cond
from reflex.components.lucide.icon import Icon
from reflex.components.markdown.markdown import MarkdownComponentMap
Expand Down Expand Up @@ -407,16 +407,24 @@ class CodeBlock(Component, MarkdownComponentMap):
wrap_long_lines: Var[bool]

# A custom style for the code block.
custom_style: dict[str, str | Var | Color] = {}
custom_style: dict[str, str | Var | Color] = field(
default_factory=dict, is_javascript_property=False
)

# Props passed down to the code tag.
code_tag_props: Var[dict[str, str]]

# Whether a copy button should appear.
can_copy: bool | None = False
can_copy: bool | None = field(
default=False,
is_javascript_property=False,
)

# A custom copy button to override the default one.
copy_button: bool | Component | None = None
copy_button: bool | Component | None = field(
default=None,
is_javascript_property=False,
)

@classmethod
def create(
Expand Down Expand Up @@ -498,9 +506,6 @@ def _render(self):

return out

def _exclude_props(self) -> list[str]:
return ["can_copy", "copy_button"]


class CodeblockNamespace(ComponentNamespace):
"""Namespace for the CodeBlock component."""
Expand Down
8 changes: 5 additions & 3 deletions reflex/components/datadisplay/shiki_code_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from dataclasses import dataclass
from typing import Any, Literal

from reflex.components.component import Component, ComponentNamespace
from reflex.components.component import Component, ComponentNamespace, field
from reflex.components.core.colors import color
from reflex.components.core.cond import color_mode_cond
from reflex.components.el.elements.forms import Button
Expand Down Expand Up @@ -721,10 +721,12 @@ class ShikiHighLevelCodeBlock(ShikiCodeBlock):
show_line_numbers: Var[bool]

# Whether a copy button should appear.
can_copy: bool = False
can_copy: bool = field(default=False, is_javascript_property=False)

# copy_button: A custom copy button to override the default one.
copy_button: Component | bool | None = None
copy_button: Component | bool | None = field(
default=None, is_javascript_property=False
)

@classmethod
def create(
Expand Down
8 changes: 5 additions & 3 deletions reflex/components/markdown/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from hashlib import md5
from typing import Any

from reflex.components.component import BaseComponent, Component, CustomComponent
from reflex.components.component import BaseComponent, Component, CustomComponent, field
from reflex.components.tags.tag import Tag
from reflex.utils.imports import ImportDict, ImportVar
from reflex.vars.base import LiteralVar, Var, VarData
Expand Down Expand Up @@ -150,10 +150,12 @@ class Markdown(Component):
is_default = True

# The component map from a tag to a lambda that creates a component.
component_map: dict[str, Any] = {}
component_map: dict[str, Any] = field(
default_factory=dict, is_javascript_property=False
)

# The hash of the component map, generated at create() time.
component_map_hash: str = ""
component_map_hash: str = field(default="", is_javascript_property=False)

@classmethod
def create(cls, *children, **props) -> Component:
Expand Down
11 changes: 5 additions & 6 deletions reflex/components/radix/themes/color_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from typing import Any, Literal, get_args

from reflex.components.component import BaseComponent
from reflex.components.component import BaseComponent, field
from reflex.components.core.cond import Cond, color_mode_cond, cond
from reflex.components.lucide.icon import Icon
from reflex.components.radix.themes.components.dropdown_menu import dropdown_menu
Expand Down Expand Up @@ -99,10 +99,12 @@ class ColorModeIconButton(IconButton):
"""Icon Button for toggling light / dark mode via toggle_color_mode."""

# The position of the icon button. Follow document flow if None.
position: LiteralPosition | Var[LiteralPosition] | None = None
position: LiteralPosition | Var[LiteralPosition] | None = field(
default=None, is_javascript_property=False
)

# Allow picking the "system" value for the color mode.
allow_system: bool = False
allow_system: bool = field(default=False, is_javascript_property=False)

@classmethod
def create(
Expand Down Expand Up @@ -168,9 +170,6 @@ def color_mode_item(_color_mode: Literal["light", "dark", "system"]):
**props,
)

def _exclude_props(self) -> list[str]:
return ["position", "allow_system"]


class ColorModeSwitch(Switch):
"""Switch for toggling light / dark mode via toggle_color_mode."""
Expand Down
11 changes: 9 additions & 2 deletions reflex/components/recharts/cartesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

from collections.abc import Sequence
from typing import Any, ClassVar
from typing import Any, ClassVar, TypedDict

from reflex.constants import EventTriggers
from reflex.constants.colors import Color
Expand Down Expand Up @@ -663,6 +663,13 @@ class Reference(Recharts):
is_front: Var[bool]


class Segment(TypedDict):
"""A segment in a ReferenceLine or ReferenceArea."""

x: str | int
y: str | int


class ReferenceLine(Reference):
"""A ReferenceLine component in Recharts."""

Expand All @@ -686,7 +693,7 @@ class ReferenceLine(Reference):
_valid_children: ClassVar[list[str]] = ["Label"]

# Array of endpoints in { x, y } format. These endpoints would be used to draw the ReferenceLine.
segment: Sequence[Any] = []
segment: Var[Sequence[Segment]]


class ReferenceDot(Reference):
Expand Down
2 changes: 1 addition & 1 deletion tests/units/components/markdown/test_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def test_create_map_fn_var_subclass(cls, fn_body, fn_args, explicit_return, expe
(
"code",
{},
r"""(({node, inline, className, children, ...props}) => { const match = (className || '').match(/language-(?<lang>.*)/); let _language = match ? match[1] : ''; ; return inline ? ( jsx(RadixThemesCode,{...props},children,) ) : ( jsx(SyntaxHighlighter,{children:((Array.isArray(children)) ? children.join("\n") : children),css:({ ["marginTop"] : "1em", ["marginBottom"] : "1em" }),customStyle:({ ["marginTop"] : "1em", ["marginBottom"] : "1em" }),language:_language,style:((resolvedColorMode === "light") ? oneLight : oneDark),wrapLongLines:true,...props},) ); })""",
r"""(({node, inline, className, children, ...props}) => { const match = (className || '').match(/language-(?<lang>.*)/); let _language = match ? match[1] : ''; ; return inline ? ( jsx(RadixThemesCode,{...props},children,) ) : ( jsx(SyntaxHighlighter,{children:((Array.isArray(children)) ? children.join("\n") : children),css:({ ["marginTop"] : "1em", ["marginBottom"] : "1em" }),language:_language,style:((resolvedColorMode === "light") ? oneLight : oneDark),wrapLongLines:true,...props},) ); })""",
),
(
"code",
Expand Down
Loading