[REF-3012] Add defs, lineargradient and stop html elements (#3467)

This commit is contained in:
Carlos 2024-06-12 18:21:36 +02:00 committed by GitHub
parent 8c8156f3aa
commit 991f6e0183
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 499 additions and 0 deletions

View File

@ -101,6 +101,9 @@ from .elements.media import picture as picture
from .elements.media import portal as portal
from .elements.media import source as source
from .elements.media import svg as svg
from .elements.media import defs as defs
from .elements.media import lineargradient as lineargradient
from .elements.media import stop as stop
from .elements.media import path as path
from .elements.media import Area as Area
from .elements.media import Audio as Audio
@ -115,6 +118,9 @@ from .elements.media import Picture as Picture
from .elements.media import Portal as Portal
from .elements.media import Source as Source
from .elements.media import Svg as Svg
from .elements.media import Defs as Defs
from .elements.media import Lineargradient as Lineargradient
from .elements.media import Stop as Stop
from .elements.media import Path as Path
from .elements.metadata import base as base
from .elements.metadata import head as head

View File

@ -64,6 +64,9 @@ _MAPPING = {
"portal",
"source",
"svg",
"defs",
"lineargradient",
"stop",
"path",
],
"metadata": [

View File

@ -99,6 +99,9 @@ from .media import picture as picture
from .media import portal as portal
from .media import source as source
from .media import svg as svg
from .media import defs as defs
from .media import lineargradient as lineargradient
from .media import stop as stop
from .media import path as path
from .media import Area as Area
from .media import Audio as Audio
@ -113,6 +116,9 @@ from .media import Picture as Picture
from .media import Portal as Portal
from .media import Source as Source
from .media import Svg as Svg
from .media import Defs as Defs
from .media import Lineargradient as Lineargradient
from .media import Stop as Stop
from .media import Path as Path
from .metadata import base as base
from .metadata import head as head
@ -285,6 +291,9 @@ _MAPPING = {
"portal",
"source",
"svg",
"defs",
"lineargradient",
"stop",
"path",
],
"metadata": ["base", "head", "link", "meta", "title"],

View File

@ -2,6 +2,7 @@
from typing import Any, Union
from reflex import Component
from reflex.constants.colors import Color
from reflex.vars import Var as Var
from .base import BaseHTML
@ -309,6 +310,54 @@ class Svg(BaseHTML):
tag = "svg"
class Defs(BaseHTML):
"""Display the defs element."""
tag = "defs"
class Lineargradient(BaseHTML):
"""Display the linearGradient element."""
tag = "linearGradient"
# Units for the gradient
gradient_units: Var[Union[str, bool]]
# Transform applied to the gradient
gradient_transform: Var[Union[str, bool]]
# Method used to spread the gradient
spread_method: Var[Union[str, bool]]
# X coordinate of the starting point of the gradient
x1: Var[Union[str, int, bool]]
# X coordinate of the ending point of the gradient
x2: Var[Union[str, int, bool]]
# Y coordinate of the starting point of the gradient
y1: Var[Union[str, int, bool]]
# Y coordinate of the ending point of the gradient
y2: Var[Union[str, int, bool]]
class Stop(BaseHTML):
"""Display the stop element."""
tag = "stop"
# Offset of the gradient stop
offset: Var[Union[str, float, int]]
# Color of the gradient stop
stop_color: Var[Union[str, Color, bool]]
# Opacity of the gradient stop
stop_opacity: Var[Union[str, float, int, bool]]
class Path(BaseHTML):
"""Display the path element."""
@ -331,4 +380,7 @@ picture = Picture.create
portal = Portal.create
source = Source.create
svg = Svg.create
defs = Defs.create
lineargradient = Lineargradient.create
stop = Stop.create
path = Path.create

View File

@ -9,6 +9,7 @@ from reflex.event import EventChain, EventHandler, EventSpec
from reflex.style import Style
from typing import Any, Union
from reflex import Component
from reflex.constants.colors import Color
from reflex.vars import Var as Var
from .base import BaseHTML
@ -1953,6 +1954,430 @@ class Svg(BaseHTML):
"""
...
class Defs(BaseHTML):
@overload
@classmethod
def create( # type: ignore
cls,
*children,
access_key: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
auto_capitalize: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
content_editable: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
context_menu: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
dir: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
draggable: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
enter_key_hint: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
hidden: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
input_mode: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
item_prop: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
lang: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
role: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
slot: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
spell_check: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
tab_index: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
title: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
style: Optional[Style] = None,
key: Optional[Any] = None,
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
on_blur: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_click: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_context_menu: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_double_click: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_focus: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mount: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_down: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_enter: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_leave: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_move: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_out: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_over: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_up: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_scroll: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_unmount: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
**props
) -> "Defs":
"""Create the component.
Args:
*children: The children of the component.
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.
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.
dir: Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)
draggable: Defines whether the element can be dragged.
enter_key_hint: Hints what media types the media element is able to play.
hidden: Defines whether the element is hidden.
input_mode: Defines the type of the element.
item_prop: Defines the name of the element for metadata purposes.
lang: Defines the language used in the element.
role: Defines the role of the element.
slot: Assigns a slot in a shadow DOM shadow tree to an element.
spell_check: Defines whether the element may be checked for spelling errors.
tab_index: Defines the position of the current element in the tabbing order.
title: Defines a tooltip for the element.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
class_name: The class name for the component.
autofocus: Whether the component should take the focus once the page is loaded
custom_attrs: custom attribute
**props: The props of the component.
Returns:
The component.
"""
...
class Lineargradient(BaseHTML):
@overload
@classmethod
def create( # type: ignore
cls,
*children,
gradient_units: Optional[Union[Var[Union[str, bool]], Union[str, bool]]] = None,
gradient_transform: Optional[
Union[Var[Union[str, bool]], Union[str, bool]]
] = None,
spread_method: Optional[Union[Var[Union[str, bool]], Union[str, bool]]] = None,
x1: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
x2: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
y1: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
y2: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
access_key: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
auto_capitalize: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
content_editable: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
context_menu: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
dir: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
draggable: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
enter_key_hint: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
hidden: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
input_mode: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
item_prop: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
lang: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
role: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
slot: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
spell_check: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
tab_index: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
title: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
style: Optional[Style] = None,
key: Optional[Any] = None,
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
on_blur: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_click: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_context_menu: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_double_click: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_focus: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mount: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_down: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_enter: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_leave: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_move: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_out: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_over: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_up: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_scroll: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_unmount: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
**props
) -> "Lineargradient":
"""Create the component.
Args:
*children: The children of the component.
gradient_units: Units for the gradient
gradient_transform: Transform applied to the gradient
spread_method: Method used to spread the gradient
x1: X coordinate of the starting point of the gradient
x2: X coordinate of the ending point of the gradient
y1: Y coordinate of the starting point of the gradient
y2: Y coordinate of the ending point of the gradient
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.
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.
dir: Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)
draggable: Defines whether the element can be dragged.
enter_key_hint: Hints what media types the media element is able to play.
hidden: Defines whether the element is hidden.
input_mode: Defines the type of the element.
item_prop: Defines the name of the element for metadata purposes.
lang: Defines the language used in the element.
role: Defines the role of the element.
slot: Assigns a slot in a shadow DOM shadow tree to an element.
spell_check: Defines whether the element may be checked for spelling errors.
tab_index: Defines the position of the current element in the tabbing order.
title: Defines a tooltip for the element.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
class_name: The class name for the component.
autofocus: Whether the component should take the focus once the page is loaded
custom_attrs: custom attribute
**props: The props of the component.
Returns:
The component.
"""
...
class Stop(BaseHTML):
@overload
@classmethod
def create( # type: ignore
cls,
*children,
offset: Optional[
Union[Var[Union[str, float, int]], Union[str, float, int]]
] = None,
stop_color: Optional[
Union[Var[Union[str, Color, bool]], Union[str, Color, bool]]
] = None,
stop_opacity: Optional[
Union[Var[Union[str, float, int, bool]], Union[str, float, int, bool]]
] = None,
access_key: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
auto_capitalize: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
content_editable: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
context_menu: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
dir: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
draggable: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
enter_key_hint: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
hidden: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
input_mode: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
item_prop: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
lang: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
role: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
slot: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
spell_check: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
tab_index: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
title: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
style: Optional[Style] = None,
key: Optional[Any] = None,
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
on_blur: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_click: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_context_menu: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_double_click: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_focus: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mount: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_down: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_enter: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_leave: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_move: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_out: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_over: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_up: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_scroll: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_unmount: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
**props
) -> "Stop":
"""Create the component.
Args:
*children: The children of the component.
offset: Offset of the gradient stop
stop_color: Color of the gradient stop
stop_opacity: Opacity of the gradient stop
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.
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.
dir: Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)
draggable: Defines whether the element can be dragged.
enter_key_hint: Hints what media types the media element is able to play.
hidden: Defines whether the element is hidden.
input_mode: Defines the type of the element.
item_prop: Defines the name of the element for metadata purposes.
lang: Defines the language used in the element.
role: Defines the role of the element.
slot: Assigns a slot in a shadow DOM shadow tree to an element.
spell_check: Defines whether the element may be checked for spelling errors.
tab_index: Defines the position of the current element in the tabbing order.
title: Defines a tooltip for the element.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
class_name: The class name for the component.
autofocus: Whether the component should take the focus once the page is loaded
custom_attrs: custom attribute
**props: The props of the component.
Returns:
The component.
"""
...
class Path(BaseHTML):
@overload
@classmethod
@ -2100,4 +2525,7 @@ picture = Picture.create
portal = Portal.create
source = Source.create
svg = Svg.create
defs = Defs.create
lineargradient = Lineargradient.create
stop = Stop.create
path = Path.create

View File

@ -143,6 +143,7 @@ class AreaChart(CategoricalChartBase):
"Legend",
"GraphingTooltip",
"Area",
"Defs",
]