add ERA rules to detect commented out code (#4472)
* add eradicate rules for commented out code * remove output change * fix pyi messed up indent * fix pyi again * fix layout docstring * fix pyi_generator to remove commented out props from docs * fix pyi_generator and regenerate some pyi * fix double strip * update all pyi * try to fix stuff in pyi_gen * whatever * remove that maybe? i don't know * fix that shit? * fix more shit, idk * better not see you ever again, extra line
This commit is contained in:
parent
e4b5755568
commit
fb444ad112
@ -93,7 +93,7 @@ build-backend = "poetry.core.masonry.api"
|
|||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
target-version = "py39"
|
target-version = "py39"
|
||||||
lint.isort.split-on-trailing-comma = false
|
lint.isort.split-on-trailing-comma = false
|
||||||
lint.select = ["B", "D", "E", "F", "I", "SIM", "W", "RUF", "FURB"]
|
lint.select = ["B", "D", "E", "F", "I", "SIM", "W", "RUF", "FURB", "ERA"]
|
||||||
lint.ignore = ["B008", "D205", "E501", "F403", "SIM115", "RUF006", "RUF012"]
|
lint.ignore = ["B008", "D205", "E501", "F403", "SIM115", "RUF006", "RUF012"]
|
||||||
lint.pydocstyle.convention = "google"
|
lint.pydocstyle.convention = "google"
|
||||||
|
|
||||||
|
@ -965,7 +965,6 @@ class App(MiddlewareMixin, LifespanMixin):
|
|||||||
|
|
||||||
def _submit_work(fn, *args, **kwargs):
|
def _submit_work(fn, *args, **kwargs):
|
||||||
f = executor.submit(fn, *args, **kwargs)
|
f = executor.submit(fn, *args, **kwargs)
|
||||||
# f = executor.apipe(fn, *args, **kwargs)
|
|
||||||
result_futures.append(f)
|
result_futures.append(f)
|
||||||
|
|
||||||
# Compile the pre-compiled pages.
|
# Compile the pre-compiled pages.
|
||||||
|
@ -653,7 +653,6 @@ class Component(BaseComponent, ABC):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The event triggers.
|
The event triggers.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
default_triggers: Dict[str, types.ArgsSpec | Sequence[types.ArgsSpec]] = {
|
default_triggers: Dict[str, types.ArgsSpec | Sequence[types.ArgsSpec]] = {
|
||||||
EventTriggers.ON_FOCUS: no_args_event_spec,
|
EventTriggers.ON_FOCUS: no_args_event_spec,
|
||||||
|
@ -51,27 +51,6 @@ class GridColumnIcons(Enum):
|
|||||||
VideoUri = "video_uri"
|
VideoUri = "video_uri"
|
||||||
|
|
||||||
|
|
||||||
# @serializer
|
|
||||||
# def serialize_gridcolumn_icon(icon: GridColumnIcons) -> str:
|
|
||||||
# """Serialize grid column icon.
|
|
||||||
|
|
||||||
# Args:
|
|
||||||
# icon: the Icon to serialize.
|
|
||||||
|
|
||||||
# Returns:
|
|
||||||
# The serialized value.
|
|
||||||
# """
|
|
||||||
# return "prefix" + str(icon)
|
|
||||||
|
|
||||||
|
|
||||||
# class DataEditorColumn(Base):
|
|
||||||
# """Column."""
|
|
||||||
|
|
||||||
# title: str
|
|
||||||
# id: Optional[str] = None
|
|
||||||
# type_: str = "str"
|
|
||||||
|
|
||||||
|
|
||||||
class DataEditorTheme(Base):
|
class DataEditorTheme(Base):
|
||||||
"""The theme for the DataEditor component."""
|
"""The theme for the DataEditor component."""
|
||||||
|
|
||||||
@ -229,7 +208,7 @@ class DataEditor(NoSSRComponent):
|
|||||||
header_height: Var[int]
|
header_height: Var[int]
|
||||||
|
|
||||||
# Additional header icons:
|
# Additional header icons:
|
||||||
# header_icons: Var[Any] # (TODO: must be a map of name: svg)
|
# header_icons: Var[Any] # (TODO: must be a map of name: svg) #noqa: ERA001
|
||||||
|
|
||||||
# The maximum width a column can be automatically sized to.
|
# The maximum width a column can be automatically sized to.
|
||||||
max_column_auto_width: Var[int]
|
max_column_auto_width: Var[int]
|
||||||
|
@ -288,7 +288,7 @@ class DataEditor(NoSSRComponent):
|
|||||||
freeze_columns: The number of columns which should remain in place when scrolling horizontally. Doesn't include rowMarkers.
|
freeze_columns: The number of columns which should remain in place when scrolling horizontally. Doesn't include rowMarkers.
|
||||||
group_header_height: Controls the header of the group header row.
|
group_header_height: Controls the header of the group header row.
|
||||||
header_height: Controls the height of the header row.
|
header_height: Controls the height of the header row.
|
||||||
max_column_auto_width: Additional header icons: header_icons: Var[Any] # (TODO: must be a map of name: svg) The maximum width a column can be automatically sized to.
|
max_column_auto_width: The maximum width a column can be automatically sized to.
|
||||||
max_column_width: The maximum width a column can be resized to.
|
max_column_width: The maximum width a column can be resized to.
|
||||||
min_column_width: The minimum width a column can be resized to.
|
min_column_width: The minimum width a column can be resized to.
|
||||||
row_height: Determins the height of each row.
|
row_height: Determins the height of each row.
|
||||||
|
@ -490,17 +490,17 @@ class ShikiJsTransformer(ShikiBaseTransformers):
|
|||||||
},
|
},
|
||||||
# White Space
|
# White Space
|
||||||
# ".tab, .space": {
|
# ".tab, .space": {
|
||||||
# "position": "relative",
|
# "position": "relative", # noqa: ERA001
|
||||||
# },
|
# },
|
||||||
# ".tab::before": {
|
# ".tab::before": {
|
||||||
# "content": "'⇥'",
|
# "content": "'⇥'", # noqa: ERA001
|
||||||
# "position": "absolute",
|
# "position": "absolute", # noqa: ERA001
|
||||||
# "opacity": "0.3",
|
# "opacity": "0.3",# noqa: ERA001
|
||||||
# },
|
# },
|
||||||
# ".space::before": {
|
# ".space::before": {
|
||||||
# "content": "'·'",
|
# "content": "'·'", # noqa: ERA001
|
||||||
# "position": "absolute",
|
# "position": "absolute", # noqa: ERA001
|
||||||
# "opacity": "0.3",
|
# "opacity": "0.3", # noqa: ERA001
|
||||||
# },
|
# },
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"""Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
|
"""Base classes."""
|
||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"""Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
|
"""Forms classes."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
@ -84,7 +84,6 @@ class Datalist(BaseHTML):
|
|||||||
"""Display the datalist element."""
|
"""Display the datalist element."""
|
||||||
|
|
||||||
tag = "datalist"
|
tag = "datalist"
|
||||||
# No unique attributes, only common ones are inherited
|
|
||||||
|
|
||||||
|
|
||||||
class Fieldset(Element):
|
class Fieldset(Element):
|
||||||
@ -250,7 +249,6 @@ class Form(BaseHTML):
|
|||||||
_js_expr=f"getRefValue({ref_var!s})",
|
_js_expr=f"getRefValue({ref_var!s})",
|
||||||
_var_data=VarData.merge(ref_var._get_all_var_data()),
|
_var_data=VarData.merge(ref_var._get_all_var_data()),
|
||||||
)
|
)
|
||||||
# print(repr(form_refs))
|
|
||||||
return form_refs
|
return form_refs
|
||||||
|
|
||||||
def _get_vars(self, include_children: bool = True) -> Iterator[Var]:
|
def _get_vars(self, include_children: bool = True) -> Iterator[Var]:
|
||||||
@ -401,7 +399,6 @@ class Legend(BaseHTML):
|
|||||||
"""Display the legend element."""
|
"""Display the legend element."""
|
||||||
|
|
||||||
tag = "legend"
|
tag = "legend"
|
||||||
# No unique attributes, only common ones are inherited
|
|
||||||
|
|
||||||
|
|
||||||
class Meter(BaseHTML):
|
class Meter(BaseHTML):
|
||||||
|
@ -189,7 +189,7 @@ class Datalist(BaseHTML):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
*children: The children of the component.
|
*children: The children of the component.
|
||||||
access_key: No unique attributes, only common ones are inherited Provides a hint for generating a keyboard shortcut for the current element.
|
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|
||||||
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
||||||
content_editable: Indicates whether the element's content is editable.
|
content_editable: Indicates whether the element's content is editable.
|
||||||
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
||||||
@ -730,7 +730,7 @@ class Legend(BaseHTML):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
*children: The children of the component.
|
*children: The children of the component.
|
||||||
access_key: No unique attributes, only common ones are inherited Provides a hint for generating a keyboard shortcut for the current element.
|
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|
||||||
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
||||||
content_editable: Indicates whether the element's content is editable.
|
content_editable: Indicates whether the element's content is editable.
|
||||||
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"""Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
|
"""Inline classes."""
|
||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"""Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
|
"""Media classes."""
|
||||||
|
|
||||||
from typing import Any, Union
|
from typing import Any, Union
|
||||||
|
|
||||||
@ -129,7 +129,6 @@ class Img(BaseHTML):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The component.
|
The component.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return (
|
return (
|
||||||
super().create(src=children[0], **props)
|
super().create(src=children[0], **props)
|
||||||
@ -274,14 +273,12 @@ class Picture(BaseHTML):
|
|||||||
"""Display the picture element."""
|
"""Display the picture element."""
|
||||||
|
|
||||||
tag = "picture"
|
tag = "picture"
|
||||||
# No unique attributes, only common ones are inherited
|
|
||||||
|
|
||||||
|
|
||||||
class Portal(BaseHTML):
|
class Portal(BaseHTML):
|
||||||
"""Display the portal element."""
|
"""Display the portal element."""
|
||||||
|
|
||||||
tag = "portal"
|
tag = "portal"
|
||||||
# No unique attributes, only common ones are inherited
|
|
||||||
|
|
||||||
|
|
||||||
class Source(BaseHTML):
|
class Source(BaseHTML):
|
||||||
|
@ -340,7 +340,6 @@ class Img(BaseHTML):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The component.
|
The component.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
...
|
...
|
||||||
|
|
||||||
@ -987,7 +986,7 @@ class Picture(BaseHTML):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
*children: The children of the component.
|
*children: The children of the component.
|
||||||
access_key: No unique attributes, only common ones are inherited Provides a hint for generating a keyboard shortcut for the current element.
|
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|
||||||
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
||||||
content_editable: Indicates whether the element's content is editable.
|
content_editable: Indicates whether the element's content is editable.
|
||||||
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
||||||
@ -1073,7 +1072,7 @@ class Portal(BaseHTML):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
*children: The children of the component.
|
*children: The children of the component.
|
||||||
access_key: No unique attributes, only common ones are inherited Provides a hint for generating a keyboard shortcut for the current element.
|
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|
||||||
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
||||||
content_editable: Indicates whether the element's content is editable.
|
content_editable: Indicates whether the element's content is editable.
|
||||||
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"""Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
|
"""Metadata classes."""
|
||||||
|
|
||||||
from typing import List, Union
|
from typing import List, Union
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"""Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
|
"""Other classes."""
|
||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
@ -26,31 +26,39 @@ class Dialog(BaseHTML):
|
|||||||
|
|
||||||
|
|
||||||
class Summary(BaseHTML):
|
class Summary(BaseHTML):
|
||||||
"""Display the summary element."""
|
"""Display the summary element.
|
||||||
|
|
||||||
|
Used as a summary or caption for a <details> element.
|
||||||
|
"""
|
||||||
|
|
||||||
tag = "summary"
|
tag = "summary"
|
||||||
# No unique attributes, only common ones are inherited; used as a summary or caption for a <details> element
|
|
||||||
|
|
||||||
|
|
||||||
class Slot(BaseHTML):
|
class Slot(BaseHTML):
|
||||||
"""Display the slot element."""
|
"""Display the slot element.
|
||||||
|
|
||||||
|
Used as a placeholder inside a web component.
|
||||||
|
"""
|
||||||
|
|
||||||
tag = "slot"
|
tag = "slot"
|
||||||
# No unique attributes, only common ones are inherited; used as a placeholder inside a web component
|
|
||||||
|
|
||||||
|
|
||||||
class Template(BaseHTML):
|
class Template(BaseHTML):
|
||||||
"""Display the template element."""
|
"""Display the template element.
|
||||||
|
|
||||||
|
Used for declaring fragments of HTML that can be cloned and inserted in the document.
|
||||||
|
"""
|
||||||
|
|
||||||
tag = "template"
|
tag = "template"
|
||||||
# No unique attributes, only common ones are inherited; used for declaring fragments of HTML that can be cloned and inserted in the document
|
|
||||||
|
|
||||||
|
|
||||||
class Math(BaseHTML):
|
class Math(BaseHTML):
|
||||||
"""Display the math element."""
|
"""Display the math element.
|
||||||
|
|
||||||
|
Represents a mathematical expression.
|
||||||
|
"""
|
||||||
|
|
||||||
tag = "math"
|
tag = "math"
|
||||||
# No unique attributes, only common ones are inherited; used for displaying mathematical expressions
|
|
||||||
|
|
||||||
|
|
||||||
class Html(BaseHTML):
|
class Html(BaseHTML):
|
||||||
|
@ -244,7 +244,7 @@ class Summary(BaseHTML):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
*children: The children of the component.
|
*children: The children of the component.
|
||||||
access_key: No unique attributes, only common ones are inherited; used as a summary or caption for a <details> element Provides a hint for generating a keyboard shortcut for the current element.
|
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|
||||||
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
||||||
content_editable: Indicates whether the element's content is editable.
|
content_editable: Indicates whether the element's content is editable.
|
||||||
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
||||||
@ -330,7 +330,7 @@ class Slot(BaseHTML):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
*children: The children of the component.
|
*children: The children of the component.
|
||||||
access_key: No unique attributes, only common ones are inherited; used as a placeholder inside a web component Provides a hint for generating a keyboard shortcut for the current element.
|
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|
||||||
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
||||||
content_editable: Indicates whether the element's content is editable.
|
content_editable: Indicates whether the element's content is editable.
|
||||||
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
||||||
@ -416,7 +416,7 @@ class Template(BaseHTML):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
*children: The children of the component.
|
*children: The children of the component.
|
||||||
access_key: No unique attributes, only common ones are inherited; used for declaring fragments of HTML that can be cloned and inserted in the document Provides a hint for generating a keyboard shortcut for the current element.
|
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|
||||||
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
||||||
content_editable: Indicates whether the element's content is editable.
|
content_editable: Indicates whether the element's content is editable.
|
||||||
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
||||||
@ -502,7 +502,7 @@ class Math(BaseHTML):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
*children: The children of the component.
|
*children: The children of the component.
|
||||||
access_key: No unique attributes, only common ones are inherited; used for displaying mathematical expressions Provides a hint for generating a keyboard shortcut for the current element.
|
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|
||||||
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
||||||
content_editable: Indicates whether the element's content is editable.
|
content_editable: Indicates whether the element's content is editable.
|
||||||
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"""Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
|
"""Scripts classes."""
|
||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
@ -17,7 +17,6 @@ class Noscript(BaseHTML):
|
|||||||
"""Display the noscript element."""
|
"""Display the noscript element."""
|
||||||
|
|
||||||
tag = "noscript"
|
tag = "noscript"
|
||||||
# No unique attributes, only common ones are inherited
|
|
||||||
|
|
||||||
|
|
||||||
class Script(BaseHTML):
|
class Script(BaseHTML):
|
||||||
|
@ -154,7 +154,7 @@ class Noscript(BaseHTML):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
*children: The children of the component.
|
*children: The children of the component.
|
||||||
access_key: No unique attributes, only common ones are inherited Provides a hint for generating a keyboard shortcut for the current element.
|
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|
||||||
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
||||||
content_editable: Indicates whether the element's content is editable.
|
content_editable: Indicates whether the element's content is editable.
|
||||||
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"""Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
|
"""Sectioning classes."""
|
||||||
|
|
||||||
from .base import BaseHTML
|
from .base import BaseHTML
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"""Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
|
"""Tables classes."""
|
||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"""Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
|
"""Typography classes."""
|
||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ class Image(NextComponent):
|
|||||||
placeholder: Var[str]
|
placeholder: Var[str]
|
||||||
|
|
||||||
# Allows passing CSS styles to the underlying image element.
|
# Allows passing CSS styles to the underlying image element.
|
||||||
# style: Var[Any]
|
# style: Var[Any] #noqa: ERA001
|
||||||
|
|
||||||
# The loading behavior of the image. Defaults to lazy. Can hurt performance, recommended to use `priority` instead.
|
# The loading behavior of the image. Defaults to lazy. Can hurt performance, recommended to use `priority` instead.
|
||||||
loading: Var[Literal["lazy", "eager"]]
|
loading: Var[Literal["lazy", "eager"]]
|
||||||
|
@ -70,7 +70,7 @@ class Image(NextComponent):
|
|||||||
quality: The quality of the optimized image, an integer between 1 and 100, where 100 is the best quality and therefore largest file size. Defaults to 75.
|
quality: The quality of the optimized image, an integer between 1 and 100, where 100 is the best quality and therefore largest file size. Defaults to 75.
|
||||||
priority: When true, the image will be considered high priority and preload. Lazy loading is automatically disabled for images using priority.
|
priority: When true, the image will be considered high priority and preload. Lazy loading is automatically disabled for images using priority.
|
||||||
placeholder: A placeholder to use while the image is loading. Possible values are blur, empty, or data:image/.... Defaults to empty.
|
placeholder: A placeholder to use while the image is loading. Possible values are blur, empty, or data:image/.... Defaults to empty.
|
||||||
loading: Allows passing CSS styles to the underlying image element. style: Var[Any] The loading behavior of the image. Defaults to lazy. Can hurt performance, recommended to use `priority` instead.
|
loading: The loading behavior of the image. Defaults to lazy. Can hurt performance, recommended to use `priority` instead.
|
||||||
blurDataURL: A Data URL to be used as a placeholder image before the src image successfully loads. Only takes effect when combined with placeholder="blur".
|
blurDataURL: A Data URL to be used as a placeholder image before the src image successfully loads. Only takes effect when combined with placeholder="blur".
|
||||||
on_load: Fires when the image has loaded.
|
on_load: Fires when the image has loaded.
|
||||||
on_error: Fires when the image has an error.
|
on_error: Fires when the image has an error.
|
||||||
|
@ -188,7 +188,7 @@ class Slider(ComponentNamespace):
|
|||||||
else:
|
else:
|
||||||
children = [
|
children = [
|
||||||
track,
|
track,
|
||||||
# Foreach.create(props.get("value"), lambda e: SliderThumb.create()), # foreach doesn't render Thumbs properly
|
# Foreach.create(props.get("value"), lambda e: SliderThumb.create()), # foreach doesn't render Thumbs properly # noqa: ERA001
|
||||||
]
|
]
|
||||||
|
|
||||||
return SliderRoot.create(*children, **props)
|
return SliderRoot.create(*children, **props)
|
||||||
|
@ -53,7 +53,7 @@ LiteralAccentColor = Literal[
|
|||||||
class CommonMarginProps(Component):
|
class CommonMarginProps(Component):
|
||||||
"""Many radix-themes elements accept shorthand margin props."""
|
"""Many radix-themes elements accept shorthand margin props."""
|
||||||
|
|
||||||
# Margin: "0" - "9"
|
# Margin: "0" - "9" # noqa: ERA001
|
||||||
m: Var[LiteralSpacing]
|
m: Var[LiteralSpacing]
|
||||||
|
|
||||||
# Margin horizontal: "0" - "9"
|
# Margin horizontal: "0" - "9"
|
||||||
@ -78,7 +78,7 @@ class CommonMarginProps(Component):
|
|||||||
class CommonPaddingProps(Component):
|
class CommonPaddingProps(Component):
|
||||||
"""Many radix-themes elements accept shorthand padding props."""
|
"""Many radix-themes elements accept shorthand padding props."""
|
||||||
|
|
||||||
# Padding: "0" - "9"
|
# Padding: "0" - "9" # noqa: ERA001
|
||||||
p: Var[Responsive[LiteralSpacing]]
|
p: Var[Responsive[LiteralSpacing]]
|
||||||
|
|
||||||
# Padding horizontal: "0" - "9"
|
# Padding horizontal: "0" - "9"
|
||||||
@ -140,11 +140,6 @@ class RadixThemesComponent(Component):
|
|||||||
if component.library is None:
|
if component.library is None:
|
||||||
component.library = RadixThemesComponent.__fields__["library"].default
|
component.library = RadixThemesComponent.__fields__["library"].default
|
||||||
component.alias = "RadixThemes" + (component.tag or type(component).__name__)
|
component.alias = "RadixThemes" + (component.tag or type(component).__name__)
|
||||||
# value = props.get("value")
|
|
||||||
# if value is not None and component.alias == "RadixThemesSelect.Root":
|
|
||||||
# lv = LiteralVar.create(value)
|
|
||||||
# print(repr(lv))
|
|
||||||
# print(f"Warning: Value {value} is not used in {component.alias}.")
|
|
||||||
return component
|
return component
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -427,7 +427,7 @@ class ColorModeSwitch(Switch):
|
|||||||
color_scheme: Override theme color for switch
|
color_scheme: Override theme color for switch
|
||||||
high_contrast: Whether to render the switch with higher contrast color against background
|
high_contrast: Whether to render the switch with higher contrast color against background
|
||||||
radius: Override theme radius for switch: "none" | "small" | "full"
|
radius: Override theme radius for switch: "none" | "small" | "full"
|
||||||
on_change: Props to rename Fired when the value of the switch changes
|
on_change: Fired when the value of the switch changes
|
||||||
style: The style of the component.
|
style: The style of the component.
|
||||||
key: A unique key for the component.
|
key: A unique key for the component.
|
||||||
id: The id for the component.
|
id: The id for the component.
|
||||||
|
@ -153,7 +153,7 @@ class Checkbox(RadixThemesComponent):
|
|||||||
required: Whether the checkbox is required
|
required: Whether the checkbox is required
|
||||||
name: The name of the checkbox control when submitting the form.
|
name: The name of the checkbox control when submitting the form.
|
||||||
value: The value of the checkbox control when submitting the form.
|
value: The value of the checkbox control when submitting the form.
|
||||||
on_change: Props to rename Fired when the checkbox is checked or unchecked.
|
on_change: Fired when the checkbox is checked or unchecked.
|
||||||
style: The style of the component.
|
style: The style of the component.
|
||||||
key: A unique key for the component.
|
key: A unique key for the component.
|
||||||
id: The id for the component.
|
id: The id for the component.
|
||||||
@ -302,7 +302,7 @@ class HighLevelCheckbox(RadixThemesComponent):
|
|||||||
required: Whether the checkbox is required
|
required: Whether the checkbox is required
|
||||||
name: The name of the checkbox control when submitting the form.
|
name: The name of the checkbox control when submitting the form.
|
||||||
value: The value of the checkbox control when submitting the form.
|
value: The value of the checkbox control when submitting the form.
|
||||||
on_change: Props to rename Fired when the checkbox is checked or unchecked.
|
on_change: Fired when the checkbox is checked or unchecked.
|
||||||
style: The style of the component.
|
style: The style of the component.
|
||||||
key: A unique key for the component.
|
key: A unique key for the component.
|
||||||
id: The id for the component.
|
id: The id for the component.
|
||||||
@ -449,7 +449,7 @@ class CheckboxNamespace(ComponentNamespace):
|
|||||||
required: Whether the checkbox is required
|
required: Whether the checkbox is required
|
||||||
name: The name of the checkbox control when submitting the form.
|
name: The name of the checkbox control when submitting the form.
|
||||||
value: The value of the checkbox control when submitting the form.
|
value: The value of the checkbox control when submitting the form.
|
||||||
on_change: Props to rename Fired when the checkbox is checked or unchecked.
|
on_change: Fired when the checkbox is checked or unchecked.
|
||||||
style: The style of the component.
|
style: The style of the component.
|
||||||
key: A unique key for the component.
|
key: A unique key for the component.
|
||||||
id: The id for the component.
|
id: The id for the component.
|
||||||
|
@ -148,7 +148,7 @@ class RadioGroupRoot(RadixThemesComponent):
|
|||||||
disabled: Whether the radio group is disabled
|
disabled: Whether the radio group is disabled
|
||||||
name: The name of the group. Submitted with its owning form as part of a name/value pair.
|
name: The name of the group. Submitted with its owning form as part of a name/value pair.
|
||||||
required: Whether the radio group is required
|
required: Whether the radio group is required
|
||||||
on_change: Props to rename Fired when the value of the radio group changes.
|
on_change: Fired when the value of the radio group changes.
|
||||||
style: The style of the component.
|
style: The style of the component.
|
||||||
key: A unique key for the component.
|
key: A unique key for the component.
|
||||||
id: The id for the component.
|
id: The id for the component.
|
||||||
|
@ -81,7 +81,7 @@ class SelectRoot(RadixThemesComponent):
|
|||||||
name: The name of the select control when submitting the form.
|
name: The name of the select control when submitting the form.
|
||||||
disabled: When True, prevents the user from interacting with select.
|
disabled: When True, prevents the user from interacting with select.
|
||||||
required: When True, indicates that the user must select a value before the owning form can be submitted.
|
required: When True, indicates that the user must select a value before the owning form can be submitted.
|
||||||
on_change: Props to rename Fired when the value of the select changes.
|
on_change: Fired when the value of the select changes.
|
||||||
on_open_change: Fired when the select is opened or closed.
|
on_open_change: Fired when the select is opened or closed.
|
||||||
style: The style of the component.
|
style: The style of the component.
|
||||||
key: A unique key for the component.
|
key: A unique key for the component.
|
||||||
@ -732,7 +732,7 @@ class HighLevelSelect(SelectRoot):
|
|||||||
name: The name of the select control when submitting the form.
|
name: The name of the select control when submitting the form.
|
||||||
disabled: When True, prevents the user from interacting with select.
|
disabled: When True, prevents the user from interacting with select.
|
||||||
required: When True, indicates that the user must select a value before the owning form can be submitted.
|
required: When True, indicates that the user must select a value before the owning form can be submitted.
|
||||||
on_change: Props to rename Fired when the value of the select changes.
|
on_change: Fired when the value of the select changes.
|
||||||
on_open_change: Fired when the select is opened or closed.
|
on_open_change: Fired when the select is opened or closed.
|
||||||
style: The style of the component.
|
style: The style of the component.
|
||||||
key: A unique key for the component.
|
key: A unique key for the component.
|
||||||
@ -912,7 +912,7 @@ class Select(ComponentNamespace):
|
|||||||
name: The name of the select control when submitting the form.
|
name: The name of the select control when submitting the form.
|
||||||
disabled: When True, prevents the user from interacting with select.
|
disabled: When True, prevents the user from interacting with select.
|
||||||
required: When True, indicates that the user must select a value before the owning form can be submitted.
|
required: When True, indicates that the user must select a value before the owning form can be submitted.
|
||||||
on_change: Props to rename Fired when the value of the select changes.
|
on_change: Fired when the value of the select changes.
|
||||||
on_open_change: Fired when the select is opened or closed.
|
on_open_change: Fired when the select is opened or closed.
|
||||||
style: The style of the component.
|
style: The style of the component.
|
||||||
key: A unique key for the component.
|
key: A unique key for the component.
|
||||||
|
@ -195,7 +195,7 @@ class Slider(RadixThemesComponent):
|
|||||||
step: The step value of the slider.
|
step: The step value of the slider.
|
||||||
disabled: Whether the slider is disabled
|
disabled: Whether the slider is disabled
|
||||||
orientation: The orientation of the slider.
|
orientation: The orientation of the slider.
|
||||||
on_change: Props to rename Fired when the value of the slider changes.
|
on_change: Fired when the value of the slider changes.
|
||||||
on_value_commit: Fired when a thumb is released after being dragged.
|
on_value_commit: Fired when a thumb is released after being dragged.
|
||||||
style: The style of the component.
|
style: The style of the component.
|
||||||
key: A unique key for the component.
|
key: A unique key for the component.
|
||||||
|
@ -157,7 +157,7 @@ class Switch(RadixThemesComponent):
|
|||||||
color_scheme: Override theme color for switch
|
color_scheme: Override theme color for switch
|
||||||
high_contrast: Whether to render the switch with higher contrast color against background
|
high_contrast: Whether to render the switch with higher contrast color against background
|
||||||
radius: Override theme radius for switch: "none" | "small" | "full"
|
radius: Override theme radius for switch: "none" | "small" | "full"
|
||||||
on_change: Props to rename Fired when the value of the switch changes
|
on_change: Fired when the value of the switch changes
|
||||||
style: The style of the component.
|
style: The style of the component.
|
||||||
key: A unique key for the component.
|
key: A unique key for the component.
|
||||||
id: The id for the component.
|
id: The id for the component.
|
||||||
|
@ -72,7 +72,7 @@ class TabsRoot(RadixThemesComponent):
|
|||||||
orientation: The orientation of the tabs.
|
orientation: The orientation of the tabs.
|
||||||
dir: Reading direction of the tabs.
|
dir: Reading direction of the tabs.
|
||||||
activation_mode: The mode of activation for the tabs. "automatic" will activate the tab when focused. "manual" will activate the tab when clicked.
|
activation_mode: The mode of activation for the tabs. "automatic" will activate the tab when focused. "manual" will activate the tab when clicked.
|
||||||
on_change: Props to rename Fired when the value of the tabs changes.
|
on_change: Fired when the value of the tabs changes.
|
||||||
style: The style of the component.
|
style: The style of the component.
|
||||||
key: A unique key for the component.
|
key: A unique key for the component.
|
||||||
id: The id for the component.
|
id: The id for the component.
|
||||||
@ -374,7 +374,7 @@ class Tabs(ComponentNamespace):
|
|||||||
orientation: The orientation of the tabs.
|
orientation: The orientation of the tabs.
|
||||||
dir: Reading direction of the tabs.
|
dir: Reading direction of the tabs.
|
||||||
activation_mode: The mode of activation for the tabs. "automatic" will activate the tab when focused. "manual" will activate the tab when clicked.
|
activation_mode: The mode of activation for the tabs. "automatic" will activate the tab when focused. "manual" will activate the tab when clicked.
|
||||||
on_change: Props to rename Fired when the value of the tabs changes.
|
on_change: Fired when the value of the tabs changes.
|
||||||
style: The style of the component.
|
style: The style of the component.
|
||||||
key: A unique key for the component.
|
key: A unique key for the component.
|
||||||
id: The id for the component.
|
id: The id for the component.
|
||||||
|
@ -64,7 +64,6 @@ class BaseList(Component, MarkdownComponentMap):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The list component.
|
The list component.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
items = props.pop("items", None)
|
items = props.pop("items", None)
|
||||||
list_style_type = props.pop("list_style_type", "none")
|
list_style_type = props.pop("list_style_type", "none")
|
||||||
@ -114,7 +113,6 @@ class UnorderedList(BaseList, Ul):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The list component.
|
The list component.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
items = props.pop("items", None)
|
items = props.pop("items", None)
|
||||||
list_style_type = props.pop("list_style_type", "disc")
|
list_style_type = props.pop("list_style_type", "disc")
|
||||||
@ -144,7 +142,6 @@ class OrderedList(BaseList, Ol):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The list component.
|
The list component.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
items = props.pop("items", None)
|
items = props.pop("items", None)
|
||||||
list_style_type = props.pop("list_style_type", "decimal")
|
list_style_type = props.pop("list_style_type", "decimal")
|
||||||
@ -168,7 +165,6 @@ class ListItem(Li, MarkdownComponentMap):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The list item component.
|
The list item component.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
for child in children:
|
for child in children:
|
||||||
if isinstance(child, Text):
|
if isinstance(child, Text):
|
||||||
|
@ -118,7 +118,6 @@ class BaseList(Component, MarkdownComponentMap):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The list component.
|
The list component.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
...
|
...
|
||||||
|
|
||||||
@ -252,7 +251,6 @@ class UnorderedList(BaseList, Ul):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The list component.
|
The list component.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
...
|
...
|
||||||
|
|
||||||
@ -390,7 +388,6 @@ class OrderedList(BaseList, Ol):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The list component.
|
The list component.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
...
|
...
|
||||||
|
|
||||||
@ -477,7 +474,6 @@ class ListItem(Li, MarkdownComponentMap):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The list item component.
|
The list item component.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
...
|
...
|
||||||
|
|
||||||
@ -571,7 +567,6 @@ class List(ComponentNamespace):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The list component.
|
The list component.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
...
|
...
|
||||||
|
|
||||||
|
@ -416,7 +416,7 @@ class Bar(Cartesian):
|
|||||||
radius: Var[Union[int, List[int]]]
|
radius: Var[Union[int, List[int]]]
|
||||||
|
|
||||||
# The active bar is shown when a user enters a bar chart and this chart has tooltip. If set to false, no active bar will be drawn. If set to true, active bar will be drawn with the props calculated internally. If passed an object, active bar will be drawn, and the internally calculated props will be merged with the key value pairs of the passed object.
|
# The active bar is shown when a user enters a bar chart and this chart has tooltip. If set to false, no active bar will be drawn. If set to true, active bar will be drawn with the props calculated internally. If passed an object, active bar will be drawn, and the internally calculated props will be merged with the key value pairs of the passed object.
|
||||||
# active_bar: Var[Union[bool, Dict[str, Any]]]
|
# active_bar: Var[Union[bool, Dict[str, Any]]] #noqa: ERA001
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = ["Cell", "LabelList", "ErrorBar"]
|
_valid_children: List[str] = ["Cell", "LabelList", "ErrorBar"]
|
||||||
|
@ -136,7 +136,7 @@ class Radar(Recharts):
|
|||||||
# Fill color. Default: rx.color("accent", 3)
|
# Fill color. Default: rx.color("accent", 3)
|
||||||
fill: Var[str] = LiteralVar.create(Color("accent", 3))
|
fill: Var[str] = LiteralVar.create(Color("accent", 3))
|
||||||
|
|
||||||
# opacity. Default: 0.6
|
# The opacity to fill the chart. Default: 0.6
|
||||||
fill_opacity: Var[float] = LiteralVar.create(0.6)
|
fill_opacity: Var[float] = LiteralVar.create(0.6)
|
||||||
|
|
||||||
# The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "rect"
|
# The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "rect"
|
||||||
|
@ -204,7 +204,7 @@ class Radar(Recharts):
|
|||||||
dot: If false set, dots will not be drawn. Default: True
|
dot: If false set, dots will not be drawn. Default: True
|
||||||
stroke: Stoke color. Default: rx.color("accent", 9)
|
stroke: Stoke color. Default: rx.color("accent", 9)
|
||||||
fill: Fill color. Default: rx.color("accent", 3)
|
fill: Fill color. Default: rx.color("accent", 3)
|
||||||
fill_opacity: opacity. Default: 0.6
|
fill_opacity: The opacity to fill the chart. Default: 0.6
|
||||||
legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "rect"
|
legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "rect"
|
||||||
label: If false set, labels will not be drawn. Default: True
|
label: If false set, labels will not be drawn. Default: True
|
||||||
is_animation_active: If set false, animation of polygon will be disabled. Default: True in CSR, and False in SSR
|
is_animation_active: If set false, animation of polygon will be disabled. Default: True in CSR, and False in SSR
|
||||||
|
@ -98,7 +98,7 @@ class ToastProps(PropsBase, NoExtrasAllowedProps):
|
|||||||
|
|
||||||
# TODO: fix serialization of icons for toast? (might not be possible yet)
|
# TODO: fix serialization of icons for toast? (might not be possible yet)
|
||||||
# Icon displayed in front of toast's text, aligned vertically.
|
# Icon displayed in front of toast's text, aligned vertically.
|
||||||
# icon: Optional[Icon] = None
|
# icon: Optional[Icon] = None # noqa: ERA001
|
||||||
|
|
||||||
# TODO: fix implementation for action / cancel buttons
|
# TODO: fix implementation for action / cancel buttons
|
||||||
# Renders a primary button, clicking it will close the toast.
|
# Renders a primary button, clicking it will close the toast.
|
||||||
@ -364,9 +364,7 @@ class Toaster(Component):
|
|||||||
return super().create(*children, **props)
|
return super().create(*children, **props)
|
||||||
|
|
||||||
|
|
||||||
# TODO: figure out why loading toast stay open forever
|
# TODO: figure out why loading toast stay open forever when using level="loading" in toast()
|
||||||
# def toast_loading(message: str, **kwargs):
|
|
||||||
# return _toast(message, level="loading", **kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
class ToastNamespace(ComponentNamespace):
|
class ToastNamespace(ComponentNamespace):
|
||||||
@ -379,7 +377,6 @@ class ToastNamespace(ComponentNamespace):
|
|||||||
error = staticmethod(Toaster.toast_error)
|
error = staticmethod(Toaster.toast_error)
|
||||||
success = staticmethod(Toaster.toast_success)
|
success = staticmethod(Toaster.toast_success)
|
||||||
dismiss = staticmethod(Toaster.toast_dismiss)
|
dismiss = staticmethod(Toaster.toast_dismiss)
|
||||||
# loading = staticmethod(toast_loading)
|
|
||||||
__call__ = staticmethod(Toaster.send_toast)
|
__call__ = staticmethod(Toaster.send_toast)
|
||||||
|
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ class Editor(NoSSRComponent):
|
|||||||
# Please refer to the library docs for this.
|
# Please refer to the library docs for this.
|
||||||
# options: "en" | "da" | "de" | "es" | "fr" | "ja" | "ko" | "pt_br" |
|
# options: "en" | "da" | "de" | "es" | "fr" | "ja" | "ko" | "pt_br" |
|
||||||
# "ru" | "zh_cn" | "ro" | "pl" | "ckb" | "lv" | "se" | "ua" | "he" | "it"
|
# "ru" | "zh_cn" | "ro" | "pl" | "ckb" | "lv" | "se" | "ua" | "he" | "it"
|
||||||
# default : "en"
|
# default: "en".
|
||||||
lang: Var[
|
lang: Var[
|
||||||
Union[
|
Union[
|
||||||
Literal[
|
Literal[
|
||||||
@ -172,7 +172,7 @@ class Editor(NoSSRComponent):
|
|||||||
set_options: Var[Dict]
|
set_options: Var[Dict]
|
||||||
|
|
||||||
# Whether all SunEditor plugins should be loaded.
|
# Whether all SunEditor plugins should be loaded.
|
||||||
# default: True
|
# default: True.
|
||||||
set_all_plugins: Var[bool]
|
set_all_plugins: Var[bool]
|
||||||
|
|
||||||
# Set the content of the editor.
|
# Set the content of the editor.
|
||||||
@ -191,19 +191,19 @@ class Editor(NoSSRComponent):
|
|||||||
set_default_style: Var[str]
|
set_default_style: Var[str]
|
||||||
|
|
||||||
# Disable the editor
|
# Disable the editor
|
||||||
# default: False
|
# default: False.
|
||||||
disable: Var[bool]
|
disable: Var[bool]
|
||||||
|
|
||||||
# Hide the editor
|
# Hide the editor
|
||||||
# default: False
|
# default: False.
|
||||||
hide: Var[bool]
|
hide: Var[bool]
|
||||||
|
|
||||||
# Hide the editor toolbar
|
# Hide the editor toolbar
|
||||||
# default: False
|
# default: False.
|
||||||
hide_toolbar: Var[bool]
|
hide_toolbar: Var[bool]
|
||||||
|
|
||||||
# Disable the editor toolbar
|
# Disable the editor toolbar
|
||||||
# default: False
|
# default: False.
|
||||||
disable_toolbar: Var[bool]
|
disable_toolbar: Var[bool]
|
||||||
|
|
||||||
# Fired when the editor content changes.
|
# Fired when the editor content changes.
|
||||||
|
@ -172,7 +172,7 @@ class Editor(NoSSRComponent):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
set_options(Optional[EditorOptions]): Configuration object to further configure the instance.
|
set_options(Optional[EditorOptions]): Configuration object to further configure the instance.
|
||||||
lang: Language of the editor. Alternatively to a string, a dict of your language can be passed to this prop. Please refer to the library docs for this. options: "en" | "da" | "de" | "es" | "fr" | "ja" | "ko" | "pt_br" | "ru" | "zh_cn" | "ro" | "pl" | "ckb" | "lv" | "se" | "ua" | "he" | "it" default : "en"
|
lang: Language of the editor. Alternatively to a string, a dict of your language can be passed to this prop. Please refer to the library docs for this. options: "en" | "da" | "de" | "es" | "fr" | "ja" | "ko" | "pt_br" | "ru" | "zh_cn" | "ro" | "pl" | "ckb" | "lv" | "se" | "ua" | "he" | "it" default: "en".
|
||||||
name: This is used to set the HTML form name of the editor. This means on HTML form submission, it will be submitted together with contents of the editor by the name provided.
|
name: This is used to set the HTML form name of the editor. This means on HTML form submission, it will be submitted together with contents of the editor by the name provided.
|
||||||
default_value: Sets the default value of the editor. This is useful if you don't want the on_change method to be called on render. If you want the on_change method to be called on render please use the set_contents prop
|
default_value: Sets the default value of the editor. This is useful if you don't want the on_change method to be called on render. If you want the on_change method to be called on render please use the set_contents prop
|
||||||
width: Sets the width of the editor. px and percentage values are accepted, eg width="100%" or width="500px" default: 100%
|
width: Sets the width of the editor. px and percentage values are accepted, eg width="100%" or width="500px" default: 100%
|
||||||
@ -180,14 +180,14 @@ class Editor(NoSSRComponent):
|
|||||||
placeholder: Sets the placeholder of the editor.
|
placeholder: Sets the placeholder of the editor.
|
||||||
auto_focus: Should the editor receive focus when initialized?
|
auto_focus: Should the editor receive focus when initialized?
|
||||||
set_options: Pass an EditorOptions instance to modify the behaviour of Editor even more.
|
set_options: Pass an EditorOptions instance to modify the behaviour of Editor even more.
|
||||||
set_all_plugins: Whether all SunEditor plugins should be loaded. default: True
|
set_all_plugins: Whether all SunEditor plugins should be loaded. default: True.
|
||||||
set_contents: Set the content of the editor. Note: To set the initial contents of the editor without calling the on_change event, please use the default_value prop. set_contents is used to set the contents of the editor programmatically. You must be aware that, when the set_contents's prop changes, the on_change event is triggered.
|
set_contents: Set the content of the editor. Note: To set the initial contents of the editor without calling the on_change event, please use the default_value prop. set_contents is used to set the contents of the editor programmatically. You must be aware that, when the set_contents's prop changes, the on_change event is triggered.
|
||||||
append_contents: Append editor content
|
append_contents: Append editor content
|
||||||
set_default_style: Sets the default style of the editor's edit area
|
set_default_style: Sets the default style of the editor's edit area
|
||||||
disable: Disable the editor default: False
|
disable: Disable the editor default: False.
|
||||||
hide: Hide the editor default: False
|
hide: Hide the editor default: False.
|
||||||
hide_toolbar: Hide the editor toolbar default: False
|
hide_toolbar: Hide the editor toolbar default: False.
|
||||||
disable_toolbar: Disable the editor toolbar default: False
|
disable_toolbar: Disable the editor toolbar default: False.
|
||||||
on_change: Fired when the editor content changes.
|
on_change: Fired when the editor content changes.
|
||||||
on_input: Fired when the something is inputted in the editor.
|
on_input: Fired when the something is inputted in the editor.
|
||||||
on_blur: Fired when the editor loses focus.
|
on_blur: Fired when the editor loses focus.
|
||||||
|
@ -1222,7 +1222,7 @@ def call_event_handler(
|
|||||||
except TypeError:
|
except TypeError:
|
||||||
# TODO: In 0.7.0, remove this block and raise the exception
|
# TODO: In 0.7.0, remove this block and raise the exception
|
||||||
# raise TypeError(
|
# raise TypeError(
|
||||||
# f"Could not compare types {args_types_without_vars[i]} and {type_hints_of_provided_callback[arg]} for argument {arg} of {event_handler.fn.__qualname__} provided for {key}."
|
# f"Could not compare types {args_types_without_vars[i]} and {type_hints_of_provided_callback[arg]} for argument {arg} of {event_handler.fn.__qualname__} provided for {key}." # noqa: ERA001
|
||||||
# ) from e
|
# ) from e
|
||||||
console.warn(
|
console.warn(
|
||||||
f"Could not compare types {args_types_without_vars[i]} and {type_hints_of_provided_callback[arg]} for argument {arg} of {event_callback.fn.__qualname__} provided for {key}."
|
f"Could not compare types {args_types_without_vars[i]} and {type_hints_of_provided_callback[arg]} for argument {arg} of {event_callback.fn.__qualname__} provided for {key}."
|
||||||
|
@ -33,12 +33,6 @@ class Sidebar(Box, MemoizationLeaf):
|
|||||||
Returns:
|
Returns:
|
||||||
The sidebar component.
|
The sidebar component.
|
||||||
"""
|
"""
|
||||||
# props.setdefault("border_right", f"1px solid {color('accent', 12)}")
|
|
||||||
# props.setdefault("background_color", color("accent", 1))
|
|
||||||
# props.setdefault("width", "20vw")
|
|
||||||
# props.setdefault("height", "100vh")
|
|
||||||
# props.setdefault("position", "fixed")
|
|
||||||
|
|
||||||
return super().create(
|
return super().create(
|
||||||
Box.create(*children, **props), # sidebar for content
|
Box.create(*children, **props), # sidebar for content
|
||||||
Box.create(width=props.get("width")), # spacer for layout
|
Box.create(width=props.get("width")), # spacer for layout
|
||||||
|
@ -138,9 +138,6 @@ def convert_item(
|
|||||||
if isinstance(style_item, Var):
|
if isinstance(style_item, Var):
|
||||||
return style_item, style_item._get_all_var_data()
|
return style_item, style_item._get_all_var_data()
|
||||||
|
|
||||||
# if isinstance(style_item, str) and REFLEX_VAR_OPENING_TAG not in style_item:
|
|
||||||
# return style_item, None
|
|
||||||
|
|
||||||
# Otherwise, convert to Var to collapse VarData encoded in f-string.
|
# Otherwise, convert to Var to collapse VarData encoded in f-string.
|
||||||
new_var = LiteralVar.create(style_item)
|
new_var = LiteralVar.create(style_item)
|
||||||
var_data = new_var._get_all_var_data() if new_var is not None else None
|
var_data = new_var._get_all_var_data() if new_var is not None else None
|
||||||
|
@ -206,7 +206,7 @@ class AppHarness:
|
|||||||
The full state name
|
The full state name
|
||||||
"""
|
"""
|
||||||
# NOTE: using State.get_name() somehow causes trouble here
|
# NOTE: using State.get_name() somehow causes trouble here
|
||||||
# path = [State.get_name()] + [self.get_state_name(p) for p in path]
|
# path = [State.get_name()] + [self.get_state_name(p) for p in path] # noqa: ERA001
|
||||||
path = ["reflex___state____state"] + [self.get_state_name(p) for p in path]
|
path = ["reflex___state____state"] + [self.get_state_name(p) for p in path]
|
||||||
return ".".join(path)
|
return ".".join(path)
|
||||||
|
|
||||||
@ -436,7 +436,6 @@ class AppHarness:
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The rendered app global code.
|
The rendered app global code.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not inspect.isclass(value) and not inspect.isfunction(value):
|
if not inspect.isclass(value) and not inspect.isfunction(value):
|
||||||
return f"{key} = {value!r}"
|
return f"{key} = {value!r}"
|
||||||
|
@ -712,7 +712,6 @@ def format_array_ref(refs: str, idx: Var | None) -> str:
|
|||||||
"""
|
"""
|
||||||
clean_ref = re.sub(r"[^\w]+", "_", refs)
|
clean_ref = re.sub(r"[^\w]+", "_", refs)
|
||||||
if idx is not None:
|
if idx is not None:
|
||||||
# idx._var_is_local = True
|
|
||||||
return f"refs_{clean_ref}[{idx!s}]"
|
return f"refs_{clean_ref}[{idx!s}]"
|
||||||
return f"refs_{clean_ref}"
|
return f"refs_{clean_ref}"
|
||||||
|
|
||||||
|
@ -196,12 +196,7 @@ def _get_type_hint(value, type_hint_globals, is_optional=True) -> str:
|
|||||||
elif isinstance(value, str):
|
elif isinstance(value, str):
|
||||||
ev = eval(value, type_hint_globals)
|
ev = eval(value, type_hint_globals)
|
||||||
if rx_types.is_optional(ev):
|
if rx_types.is_optional(ev):
|
||||||
# hints = {
|
|
||||||
# _get_type_hint(arg, type_hint_globals, is_optional=False)
|
|
||||||
# for arg in ev.__args__
|
|
||||||
# }
|
|
||||||
return _get_type_hint(ev, type_hint_globals, is_optional=False)
|
return _get_type_hint(ev, type_hint_globals, is_optional=False)
|
||||||
# return f"Optional[{', '.join(hints)}]"
|
|
||||||
|
|
||||||
if rx_types.is_union(ev):
|
if rx_types.is_union(ev):
|
||||||
res = [
|
res = [
|
||||||
@ -260,8 +255,15 @@ def _generate_docstrings(clzs: list[Type[Component]], props: list[str]) -> str:
|
|||||||
# We've reached the functions, so stop.
|
# We've reached the functions, so stop.
|
||||||
break
|
break
|
||||||
|
|
||||||
|
if line == "":
|
||||||
|
# We hit a blank line, so clear comments to avoid commented out prop appearing in next prop docs.
|
||||||
|
comments.clear()
|
||||||
|
continue
|
||||||
|
|
||||||
# Get comments for prop
|
# Get comments for prop
|
||||||
if line.strip().startswith("#"):
|
if line.strip().startswith("#"):
|
||||||
|
# Remove noqa from the comments.
|
||||||
|
line = line.partition(" # noqa")[0]
|
||||||
comments.append(line)
|
comments.append(line)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -97,7 +97,6 @@ StateIterVar = Union[list, set, tuple]
|
|||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from reflex.vars.base import Var
|
from reflex.vars.base import Var
|
||||||
|
|
||||||
# ArgsSpec = Callable[[Var], list[Var]]
|
|
||||||
ArgsSpec = (
|
ArgsSpec = (
|
||||||
Callable[[], Sequence[Var]]
|
Callable[[], Sequence[Var]]
|
||||||
| Callable[[Var], Sequence[Var]]
|
| Callable[[Var], Sequence[Var]]
|
||||||
|
@ -106,7 +106,6 @@ def ComputedVars():
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
# raise Exception(State.count3._deps(objclass=State))
|
|
||||||
app = rx.App()
|
app = rx.App()
|
||||||
app.add_page(index)
|
app.add_page(index)
|
||||||
|
|
||||||
|
@ -183,6 +183,6 @@ async def test_fully_controlled_input(fully_controlled_input: AppHarness):
|
|||||||
clear_button.click()
|
clear_button.click()
|
||||||
assert AppHarness._poll_for(lambda: on_change_input.get_attribute("value") == "")
|
assert AppHarness._poll_for(lambda: on_change_input.get_attribute("value") == "")
|
||||||
# potential bug: clearing the on_change field doesn't itself trigger on_change
|
# potential bug: clearing the on_change field doesn't itself trigger on_change
|
||||||
# assert backend_state.text == ""
|
# assert backend_state.text == "" #noqa: ERA001
|
||||||
# assert debounce_input.get_attribute("value") == ""
|
# assert debounce_input.get_attribute("value") == "" #noqa: ERA001
|
||||||
# assert value_input.get_attribute("value") == ""
|
# assert value_input.get_attribute("value") == "" #noqa: ERA001
|
||||||
|
@ -13,9 +13,6 @@ STATE_VAR = Var(_js_expr="default_state.name")
|
|||||||
("{}", '{"{}"}'),
|
("{}", '{"{}"}'),
|
||||||
(None, '{""}'),
|
(None, '{""}'),
|
||||||
(STATE_VAR, "{default_state.name}"),
|
(STATE_VAR, "{default_state.name}"),
|
||||||
# This behavior is now unsupported.
|
|
||||||
# ("${default_state.name}", "${default_state.name}"),
|
|
||||||
# ("{state.name}", "{state.name}"),
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_fstrings(contents, expected):
|
def test_fstrings(contents, expected):
|
||||||
|
@ -42,7 +42,7 @@ def test_set_src_str():
|
|||||||
"`pic2.jpeg`",
|
"`pic2.jpeg`",
|
||||||
)
|
)
|
||||||
# For plain rx.el.img, an explicit var is not created, so the quoting happens later
|
# For plain rx.el.img, an explicit var is not created, so the quoting happens later
|
||||||
# assert str(image.src) == "pic2.jpeg" # type: ignore
|
# assert str(image.src) == "pic2.jpeg" # type: ignore #noqa: ERA001
|
||||||
|
|
||||||
|
|
||||||
def test_set_src_img(pil_image: Img):
|
def test_set_src_img(pil_image: Img):
|
||||||
|
@ -918,17 +918,17 @@ def test_invalid_event_handler_args(component2, test_state):
|
|||||||
# # Event Handler types must match
|
# # Event Handler types must match
|
||||||
# with pytest.raises(EventHandlerArgTypeMismatch):
|
# with pytest.raises(EventHandlerArgTypeMismatch):
|
||||||
# component2.create(
|
# component2.create(
|
||||||
# on_user_visited_count_changed=test_state.do_something_with_bool
|
# on_user_visited_count_changed=test_state.do_something_with_bool # noqa: ERA001 RUF100
|
||||||
# )
|
# ) # noqa: ERA001 RUF100
|
||||||
# with pytest.raises(EventHandlerArgTypeMismatch):
|
# with pytest.raises(EventHandlerArgTypeMismatch):
|
||||||
# component2.create(on_user_list_changed=test_state.do_something_with_int)
|
# component2.create(on_user_list_changed=test_state.do_something_with_int) #noqa: ERA001
|
||||||
# with pytest.raises(EventHandlerArgTypeMismatch):
|
# with pytest.raises(EventHandlerArgTypeMismatch):
|
||||||
# component2.create(on_user_list_changed=test_state.do_something_with_list_int)
|
# component2.create(on_user_list_changed=test_state.do_something_with_list_int) #noqa: ERA001
|
||||||
|
|
||||||
# component2.create(on_open=test_state.do_something_with_int)
|
# component2.create(on_open=test_state.do_something_with_int) #noqa: ERA001
|
||||||
# component2.create(on_open=test_state.do_something_with_bool)
|
# component2.create(on_open=test_state.do_something_with_bool) #noqa: ERA001
|
||||||
# component2.create(on_user_visited_count_changed=test_state.do_something_with_int)
|
# component2.create(on_user_visited_count_changed=test_state.do_something_with_int) #noqa: ERA001
|
||||||
# component2.create(on_user_list_changed=test_state.do_something_with_list_str)
|
# component2.create(on_user_list_changed=test_state.do_something_with_list_str) #noqa: ERA001
|
||||||
|
|
||||||
# lambda cannot return weird values.
|
# lambda cannot return weird values.
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
@ -1437,8 +1437,6 @@ def test_get_vars(component, exp_vars):
|
|||||||
comp_vars,
|
comp_vars,
|
||||||
sorted(exp_vars, key=lambda v: v._js_expr),
|
sorted(exp_vars, key=lambda v: v._js_expr),
|
||||||
):
|
):
|
||||||
# print(str(comp_var), str(exp_var))
|
|
||||||
# print(comp_var._get_all_var_data(), exp_var._get_all_var_data())
|
|
||||||
assert comp_var.equals(exp_var)
|
assert comp_var.equals(exp_var)
|
||||||
|
|
||||||
|
|
||||||
|
@ -899,8 +899,6 @@ class DynamicState(BaseState):
|
|||||||
loaded: int = 0
|
loaded: int = 0
|
||||||
counter: int = 0
|
counter: int = 0
|
||||||
|
|
||||||
# side_effect_counter: int = 0
|
|
||||||
|
|
||||||
def on_load(self):
|
def on_load(self):
|
||||||
"""Event handler for page on_load, should trigger for all navigation events."""
|
"""Event handler for page on_load, should trigger for all navigation events."""
|
||||||
self.loaded = self.loaded + 1
|
self.loaded = self.loaded + 1
|
||||||
@ -917,7 +915,6 @@ class DynamicState(BaseState):
|
|||||||
Returns:
|
Returns:
|
||||||
same as self.dynamic
|
same as self.dynamic
|
||||||
"""
|
"""
|
||||||
# self.side_effect_counter = self.side_effect_counter + 1
|
|
||||||
return self.dynamic
|
return self.dynamic
|
||||||
|
|
||||||
on_load_internal = OnLoadInternalState.on_load_internal.fn
|
on_load_internal = OnLoadInternalState.on_load_internal.fn
|
||||||
@ -1059,7 +1056,6 @@ async def test_dynamic_route_var_route_change_completed_on_load(
|
|||||||
arg_name: exp_val,
|
arg_name: exp_val,
|
||||||
f"comp_{arg_name}": exp_val,
|
f"comp_{arg_name}": exp_val,
|
||||||
constants.CompileVars.IS_HYDRATED: False,
|
constants.CompileVars.IS_HYDRATED: False,
|
||||||
# "side_effect_counter": exp_index,
|
|
||||||
"router": exp_router,
|
"router": exp_router,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1155,8 +1151,6 @@ async def test_dynamic_route_var_route_change_completed_on_load(
|
|||||||
state = await app.state_manager.get_state(substate_token)
|
state = await app.state_manager.get_state(substate_token)
|
||||||
assert state.loaded == len(exp_vals)
|
assert state.loaded == len(exp_vals)
|
||||||
assert state.counter == len(exp_vals)
|
assert state.counter == len(exp_vals)
|
||||||
# print(f"Expected {exp_vals} rendering side effects, got {state.side_effect_counter}")
|
|
||||||
# assert state.side_effect_counter == len(exp_vals)
|
|
||||||
|
|
||||||
if isinstance(app.state_manager, StateManagerRedis):
|
if isinstance(app.state_manager, StateManagerRedis):
|
||||||
await app.state_manager.close()
|
await app.state_manager.close()
|
||||||
|
@ -209,10 +209,6 @@ def test_event_redirect(input, output):
|
|||||||
assert isinstance(spec, EventSpec)
|
assert isinstance(spec, EventSpec)
|
||||||
assert spec.handler.fn.__qualname__ == "_redirect"
|
assert spec.handler.fn.__qualname__ == "_redirect"
|
||||||
|
|
||||||
# this asserts need comment about what it's testing (they fail with Var as input)
|
|
||||||
# assert spec.args[0][0].equals(Var(_js_expr="path"))
|
|
||||||
# assert spec.args[0][1].equals(Var(_js_expr="/path"))
|
|
||||||
|
|
||||||
assert format.format_event(spec) == output
|
assert format.format_event(spec) == output
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,8 +127,8 @@ def test_automigration(
|
|||||||
assert result[0].b == 4.2
|
assert result[0].b == 4.2
|
||||||
|
|
||||||
# No-op
|
# No-op
|
||||||
# assert Model.migrate(autogenerate=True)
|
# assert Model.migrate(autogenerate=True) #noqa: ERA001
|
||||||
# assert len(list(versions.glob("*.py"))) == 4
|
# assert len(list(versions.glob("*.py"))) == 4 #noqa: ERA001
|
||||||
|
|
||||||
# drop table (AlembicSecond)
|
# drop table (AlembicSecond)
|
||||||
model_registry.get_metadata().clear()
|
model_registry.get_metadata().clear()
|
||||||
|
@ -791,7 +791,6 @@ async def test_process_event_simple(test_state):
|
|||||||
assert test_state.num1 == 69
|
assert test_state.num1 == 69
|
||||||
|
|
||||||
# The delta should contain the changes, including computed vars.
|
# The delta should contain the changes, including computed vars.
|
||||||
# assert update.delta == {"test_state": {"num1": 69, "sum": 72.14}}
|
|
||||||
assert update.delta == {
|
assert update.delta == {
|
||||||
TestState.get_full_name(): {"num1": 69, "sum": 72.14, "upper": ""},
|
TestState.get_full_name(): {"num1": 69, "sum": 72.14, "upper": ""},
|
||||||
GrandchildState3.get_full_name(): {"computed": ""},
|
GrandchildState3.get_full_name(): {"computed": ""},
|
||||||
@ -3490,10 +3489,10 @@ def test_mutable_models():
|
|||||||
state.dirty_vars.clear()
|
state.dirty_vars.clear()
|
||||||
|
|
||||||
# Not yet supported ENG-4083
|
# Not yet supported ENG-4083
|
||||||
# assert isinstance(state.dc, MutableProxy)
|
# assert isinstance(state.dc, MutableProxy) #noqa: ERA001
|
||||||
# state.dc.foo = "baz"
|
# state.dc.foo = "baz" #noqa: ERA001
|
||||||
# assert state.dirty_vars == {"dc"}
|
# assert state.dirty_vars == {"dc"} #noqa: ERA001
|
||||||
# state.dirty_vars.clear()
|
# state.dirty_vars.clear() #noqa: ERA001
|
||||||
|
|
||||||
|
|
||||||
def test_get_value():
|
def test_get_value():
|
||||||
|
@ -34,12 +34,6 @@ def test_disable():
|
|||||||
@pytest.mark.parametrize("event", ["init", "reinit", "run-dev", "run-prod", "export"])
|
@pytest.mark.parametrize("event", ["init", "reinit", "run-dev", "run-prod", "export"])
|
||||||
def test_send(mocker, event):
|
def test_send(mocker, event):
|
||||||
httpx_post_mock = mocker.patch("httpx.post")
|
httpx_post_mock = mocker.patch("httpx.post")
|
||||||
# mocker.patch(
|
|
||||||
# "builtins.open",
|
|
||||||
# mocker.mock_open(
|
|
||||||
# read_data='{"project_hash": "78285505863498957834586115958872998605"}'
|
|
||||||
# ),
|
|
||||||
# )
|
|
||||||
|
|
||||||
# Mock the read_text method of Path
|
# Mock the read_text method of Path
|
||||||
pathlib_path_read_text_mock = mocker.patch(
|
pathlib_path_read_text_mock = mocker.patch(
|
||||||
|
@ -1495,8 +1495,6 @@ def test_valid_var_operations(operand1_var: Var, operand2_var, operators: List[s
|
|||||||
)
|
)
|
||||||
eval(f"operand1_var {operator} operand2_var")
|
eval(f"operand1_var {operator} operand2_var")
|
||||||
eval(f"operand2_var {operator} operand1_var")
|
eval(f"operand2_var {operator} operand1_var")
|
||||||
# operand1_var.operation(op=operator, other=operand2_var)
|
|
||||||
# operand1_var.operation(op=operator, other=operand2_var, flip=True)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -1773,11 +1771,9 @@ def test_invalid_var_operations(operand1_var: Var, operand2_var, operators: List
|
|||||||
print(f"testing {operator} on {operand1_var!s} and {operand2_var!s}")
|
print(f"testing {operator} on {operand1_var!s} and {operand2_var!s}")
|
||||||
with pytest.raises(TypeError):
|
with pytest.raises(TypeError):
|
||||||
print(eval(f"operand1_var {operator} operand2_var"))
|
print(eval(f"operand1_var {operator} operand2_var"))
|
||||||
# operand1_var.operation(op=operator, other=operand2_var)
|
|
||||||
|
|
||||||
with pytest.raises(TypeError):
|
with pytest.raises(TypeError):
|
||||||
print(eval(f"operand2_var {operator} operand1_var"))
|
print(eval(f"operand2_var {operator} operand1_var"))
|
||||||
# operand1_var.operation(op=operator, other=operand2_var, flip=True)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
Loading…
Reference in New Issue
Block a user