exclude props we don't need from compiling.
use regular model fields where necessary
This commit is contained in:
parent
11a38adffa
commit
57d2662977
@ -412,10 +412,10 @@ class CodeBlock(Component):
|
|||||||
code_tag_props: Var[Dict[str, str]]
|
code_tag_props: Var[Dict[str, str]]
|
||||||
|
|
||||||
# Whether a copy button should appear.
|
# Whether a copy button should appear.
|
||||||
can_copy: Var[Optional[bool]] = Var.create(False)
|
can_copy: Optional[bool] = False
|
||||||
|
|
||||||
# A custom copy button to override the default one.
|
# A custom copy button to override the default one.
|
||||||
copy_button: Var[Optional[Union[bool, Component]]] = Var.create(None)
|
copy_button: Optional[Union[bool, Component]] = None
|
||||||
|
|
||||||
def add_imports(self) -> ImportDict:
|
def add_imports(self) -> ImportDict:
|
||||||
"""Add imports for the CodeBlock component.
|
"""Add imports for the CodeBlock component.
|
||||||
@ -540,6 +540,9 @@ class CodeBlock(Component):
|
|||||||
|
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
def _exclude_props(self) -> list[str]:
|
||||||
|
return ["can_copy", "copy_button"]
|
||||||
|
|
||||||
|
|
||||||
class CodeblockNamespace(ComponentNamespace):
|
class CodeblockNamespace(ComponentNamespace):
|
||||||
"""Namespace for the CodeBlock component."""
|
"""Namespace for the CodeBlock component."""
|
||||||
|
@ -931,10 +931,8 @@ class CodeBlock(Component):
|
|||||||
wrap_long_lines: Optional[Union[Var[bool], bool]] = None,
|
wrap_long_lines: Optional[Union[Var[bool], bool]] = None,
|
||||||
custom_style: Optional[Dict[str, Union[str, Var, Color]]] = None,
|
custom_style: Optional[Dict[str, Union[str, Var, Color]]] = None,
|
||||||
code_tag_props: Optional[Union[Dict[str, str], Var[Dict[str, str]]]] = None,
|
code_tag_props: Optional[Union[Dict[str, str], Var[Dict[str, str]]]] = None,
|
||||||
can_copy: Optional[Union[Var[Optional[bool]], bool]] = None,
|
can_copy: Optional[bool] = None,
|
||||||
copy_button: Optional[
|
copy_button: Optional[Union[Component, bool]] = None,
|
||||||
Union[Component, Var[Optional[Union[Component, bool]]], bool]
|
|
||||||
] = None,
|
|
||||||
style: Optional[Style] = None,
|
style: Optional[Style] = None,
|
||||||
key: Optional[Any] = None,
|
key: Optional[Any] = None,
|
||||||
id: Optional[Any] = None,
|
id: Optional[Any] = None,
|
||||||
@ -1568,10 +1566,8 @@ class CodeblockNamespace(ComponentNamespace):
|
|||||||
wrap_long_lines: Optional[Union[Var[bool], bool]] = None,
|
wrap_long_lines: Optional[Union[Var[bool], bool]] = None,
|
||||||
custom_style: Optional[Dict[str, Union[str, Var, Color]]] = None,
|
custom_style: Optional[Dict[str, Union[str, Var, Color]]] = None,
|
||||||
code_tag_props: Optional[Union[Dict[str, str], Var[Dict[str, str]]]] = None,
|
code_tag_props: Optional[Union[Dict[str, str], Var[Dict[str, str]]]] = None,
|
||||||
can_copy: Optional[Union[Var[Optional[bool]], bool]] = None,
|
can_copy: Optional[bool] = None,
|
||||||
copy_button: Optional[
|
copy_button: Optional[Union[Component, bool]] = None,
|
||||||
Union[Component, Var[Optional[Union[Component, bool]]], bool]
|
|
||||||
] = None,
|
|
||||||
style: Optional[Style] = None,
|
style: Optional[Style] = None,
|
||||||
key: Optional[Any] = None,
|
key: Optional[Any] = None,
|
||||||
id: Optional[Any] = None,
|
id: Optional[Any] = None,
|
||||||
|
@ -194,10 +194,9 @@ class AccordionItem(AccordionComponent):
|
|||||||
disabled: Var[bool]
|
disabled: Var[bool]
|
||||||
|
|
||||||
# The header of the accordion item.
|
# The header of the accordion item.
|
||||||
header: Var[Optional[Union[Component, str]]] = Var.create(None)
|
header: Optional[Union[Component, str, Var[Union[Component, str]]]] = None
|
||||||
|
|
||||||
# The content of the accordion item.
|
# The content of the accordion item.
|
||||||
content: Var[Optional[Union[Component, str]]] = Var.create(None)
|
content: Optional[Union[Component, str, Var[Union[Component, str]]]] = None
|
||||||
|
|
||||||
_valid_children: List[str] = [
|
_valid_children: List[str] = [
|
||||||
"AccordionHeader",
|
"AccordionHeader",
|
||||||
@ -296,6 +295,9 @@ class AccordionItem(AccordionComponent):
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _exclude_props(self) -> list[str]:
|
||||||
|
return ["header", "content"]
|
||||||
|
|
||||||
|
|
||||||
class AccordionHeader(AccordionComponent):
|
class AccordionHeader(AccordionComponent):
|
||||||
"""An accordion component."""
|
"""An accordion component."""
|
||||||
|
@ -305,10 +305,10 @@ class AccordionItem(AccordionComponent):
|
|||||||
value: Optional[Union[Var[str], str]] = None,
|
value: Optional[Union[Var[str], str]] = None,
|
||||||
disabled: Optional[Union[Var[bool], bool]] = None,
|
disabled: Optional[Union[Var[bool], bool]] = None,
|
||||||
header: Optional[
|
header: Optional[
|
||||||
Union[Component, Var[Optional[Union[Component, str]]], str]
|
Union[Component, Union[Component, Var[Union[Component, str]], str], str]
|
||||||
] = None,
|
] = None,
|
||||||
content: Optional[
|
content: Optional[
|
||||||
Union[Component, Var[Optional[Union[Component, str]]], str]
|
Union[Component, Union[Component, Var[Union[Component, str]], str], str]
|
||||||
] = None,
|
] = None,
|
||||||
color_scheme: Optional[
|
color_scheme: Optional[
|
||||||
Union[
|
Union[
|
||||||
|
@ -97,10 +97,10 @@ class ColorModeIconButton(IconButton):
|
|||||||
"""Icon Button for toggling light / dark mode via toggle_color_mode."""
|
"""Icon Button for toggling light / dark mode via toggle_color_mode."""
|
||||||
|
|
||||||
# The position of the icon button. Follow document flow if None.
|
# The position of the icon button. Follow document flow if None.
|
||||||
position: Var[Optional[LiteralPosition]] = Var.create(None)
|
position: Optional[LiteralPosition] = None
|
||||||
|
|
||||||
# Allow picking the "system" value for the color mode.
|
# Allow picking the "system" value for the color mode.
|
||||||
allow_system: Var[bool] = Var.create(False)
|
allow_system: bool = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(
|
def create(
|
||||||
@ -166,6 +166,9 @@ class ColorModeIconButton(IconButton):
|
|||||||
**props,
|
**props,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def _exclude_props(self) -> list[str]:
|
||||||
|
return ["position", "allow_system"]
|
||||||
|
|
||||||
|
|
||||||
class ColorModeSwitch(Switch):
|
class ColorModeSwitch(Switch):
|
||||||
"""Switch for toggling light / dark mode via toggle_color_mode."""
|
"""Switch for toggling light / dark mode via toggle_color_mode."""
|
||||||
|
@ -76,16 +76,9 @@ class ColorModeIconButton(IconButton):
|
|||||||
cls,
|
cls,
|
||||||
*children,
|
*children,
|
||||||
position: Optional[
|
position: Optional[
|
||||||
Union[
|
Literal["bottom-left", "bottom-right", "top-left", "top-right"]
|
||||||
Literal["bottom-left", "bottom-right", "top-left", "top-right"],
|
|
||||||
Var[
|
|
||||||
Optional[
|
|
||||||
Literal["bottom-left", "bottom-right", "top-left", "top-right"]
|
|
||||||
]
|
|
||||||
],
|
|
||||||
]
|
|
||||||
] = None,
|
] = None,
|
||||||
allow_system: Optional[Union[Var[bool], bool]] = None,
|
allow_system: Optional[bool] = None,
|
||||||
as_child: Optional[Union[Var[bool], bool]] = None,
|
as_child: Optional[Union[Var[bool], bool]] = None,
|
||||||
size: Optional[
|
size: Optional[
|
||||||
Union[
|
Union[
|
||||||
|
@ -42,12 +42,12 @@ class BaseList(Component):
|
|||||||
tag = "ul"
|
tag = "ul"
|
||||||
|
|
||||||
# The style of the list. Default to "none".
|
# The style of the list. Default to "none".
|
||||||
list_style_type: Var[
|
list_style_type: Union[
|
||||||
Union[LiteralListStyleTypeUnordered, LiteralListStyleTypeOrdered]
|
LiteralListStyleTypeUnordered, LiteralListStyleTypeOrdered
|
||||||
] = Var.create("none")
|
] = "none"
|
||||||
|
|
||||||
# A list of items to add to the list.
|
# A list of items to add to the list.
|
||||||
items: Var[Optional[Var[Iterable]]] = Var.create(None)
|
items: Optional[Union[Iterable, Var[Iterable]]] = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(
|
def create(
|
||||||
@ -91,7 +91,7 @@ class BaseList(Component):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def _exclude_props(self) -> list[str]:
|
def _exclude_props(self) -> list[str]:
|
||||||
return ["items"]
|
return ["items", "list_style_type"]
|
||||||
|
|
||||||
|
|
||||||
class UnorderedList(BaseList, Ul):
|
class UnorderedList(BaseList, Ul):
|
||||||
@ -100,7 +100,7 @@ class UnorderedList(BaseList, Ul):
|
|||||||
tag = "ul"
|
tag = "ul"
|
||||||
|
|
||||||
# The style of the list.
|
# The style of the list.
|
||||||
list_style_type: Var[LiteralListStyleTypeOrdered] = Var.create("disc")
|
list_style_type: LiteralListStyleTypeOrdered = "disc"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(
|
def create(
|
||||||
@ -133,7 +133,7 @@ class OrderedList(BaseList, Ol):
|
|||||||
tag = "ol"
|
tag = "ol"
|
||||||
|
|
||||||
# The style of the list.
|
# The style of the list.
|
||||||
list_style_type: Var[LiteralListStyleTypeOrdered] = Var.create("decimal")
|
list_style_type: LiteralListStyleTypeOrdered = "decimal"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(
|
def create(
|
||||||
|
@ -35,54 +35,26 @@ class BaseList(Component):
|
|||||||
def create( # type: ignore
|
def create( # type: ignore
|
||||||
cls,
|
cls,
|
||||||
*children,
|
*children,
|
||||||
list_style_type: Optional[
|
list_style_type: Union[
|
||||||
Union[
|
Literal["circle", "disc", "none", "square"],
|
||||||
Literal[
|
Literal[
|
||||||
"armenian",
|
"armenian",
|
||||||
"decimal",
|
"decimal",
|
||||||
"decimal-leading-zero",
|
"decimal-leading-zero",
|
||||||
"georgian",
|
"georgian",
|
||||||
"hiragana",
|
"hiragana",
|
||||||
"katakana",
|
"katakana",
|
||||||
"lower-alpha",
|
"lower-alpha",
|
||||||
"lower-greek",
|
"lower-greek",
|
||||||
"lower-latin",
|
"lower-latin",
|
||||||
"lower-roman",
|
"lower-roman",
|
||||||
"none",
|
"none",
|
||||||
"upper-alpha",
|
"upper-alpha",
|
||||||
"upper-latin",
|
"upper-latin",
|
||||||
"upper-roman",
|
"upper-roman",
|
||||||
],
|
],
|
||||||
Literal["circle", "disc", "none", "square"],
|
|
||||||
Var[
|
|
||||||
Union[
|
|
||||||
Literal[
|
|
||||||
"armenian",
|
|
||||||
"decimal",
|
|
||||||
"decimal-leading-zero",
|
|
||||||
"georgian",
|
|
||||||
"hiragana",
|
|
||||||
"katakana",
|
|
||||||
"lower-alpha",
|
|
||||||
"lower-greek",
|
|
||||||
"lower-latin",
|
|
||||||
"lower-roman",
|
|
||||||
"none",
|
|
||||||
"upper-alpha",
|
|
||||||
"upper-latin",
|
|
||||||
"upper-roman",
|
|
||||||
],
|
|
||||||
Literal["circle", "disc", "none", "square"],
|
|
||||||
]
|
|
||||||
],
|
|
||||||
]
|
|
||||||
] = None,
|
|
||||||
items: Optional[
|
|
||||||
Union[
|
|
||||||
Union[Iterable, Var[Iterable]],
|
|
||||||
Var[Optional[Union[Iterable, Var[Iterable]]]],
|
|
||||||
]
|
|
||||||
] = None,
|
] = None,
|
||||||
|
items: Optional[Union[Iterable, Union[Iterable, Var[Iterable]]]] = None,
|
||||||
style: Optional[Style] = None,
|
style: Optional[Style] = None,
|
||||||
key: Optional[Any] = None,
|
key: Optional[Any] = None,
|
||||||
id: Optional[Any] = None,
|
id: Optional[Any] = None,
|
||||||
@ -134,50 +106,8 @@ class UnorderedList(BaseList, Ul):
|
|||||||
def create( # type: ignore
|
def create( # type: ignore
|
||||||
cls,
|
cls,
|
||||||
*children,
|
*children,
|
||||||
list_style_type: Optional[
|
list_style_type: Optional[LiteralListStyleTypeOrdered] = None,
|
||||||
Union[
|
items: Optional[Union[Iterable, Union[Iterable, Var[Iterable]]]] = None,
|
||||||
Literal[
|
|
||||||
"armenian",
|
|
||||||
"decimal",
|
|
||||||
"decimal-leading-zero",
|
|
||||||
"georgian",
|
|
||||||
"hiragana",
|
|
||||||
"katakana",
|
|
||||||
"lower-alpha",
|
|
||||||
"lower-greek",
|
|
||||||
"lower-latin",
|
|
||||||
"lower-roman",
|
|
||||||
"none",
|
|
||||||
"upper-alpha",
|
|
||||||
"upper-latin",
|
|
||||||
"upper-roman",
|
|
||||||
],
|
|
||||||
Var[
|
|
||||||
Literal[
|
|
||||||
"armenian",
|
|
||||||
"decimal",
|
|
||||||
"decimal-leading-zero",
|
|
||||||
"georgian",
|
|
||||||
"hiragana",
|
|
||||||
"katakana",
|
|
||||||
"lower-alpha",
|
|
||||||
"lower-greek",
|
|
||||||
"lower-latin",
|
|
||||||
"lower-roman",
|
|
||||||
"none",
|
|
||||||
"upper-alpha",
|
|
||||||
"upper-latin",
|
|
||||||
"upper-roman",
|
|
||||||
]
|
|
||||||
],
|
|
||||||
]
|
|
||||||
] = None,
|
|
||||||
items: Optional[
|
|
||||||
Union[
|
|
||||||
Union[Iterable, Var[Iterable]],
|
|
||||||
Var[Optional[Union[Iterable, Var[Iterable]]]],
|
|
||||||
]
|
|
||||||
] = None,
|
|
||||||
access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
||||||
auto_capitalize: Optional[
|
auto_capitalize: Optional[
|
||||||
Union[Var[Union[bool, int, str]], bool, int, str]
|
Union[Var[Union[bool, int, str]], bool, int, str]
|
||||||
@ -267,50 +197,8 @@ class OrderedList(BaseList, Ol):
|
|||||||
def create( # type: ignore
|
def create( # type: ignore
|
||||||
cls,
|
cls,
|
||||||
*children,
|
*children,
|
||||||
list_style_type: Optional[
|
list_style_type: Optional[LiteralListStyleTypeOrdered] = None,
|
||||||
Union[
|
items: Optional[Union[Iterable, Union[Iterable, Var[Iterable]]]] = None,
|
||||||
Literal[
|
|
||||||
"armenian",
|
|
||||||
"decimal",
|
|
||||||
"decimal-leading-zero",
|
|
||||||
"georgian",
|
|
||||||
"hiragana",
|
|
||||||
"katakana",
|
|
||||||
"lower-alpha",
|
|
||||||
"lower-greek",
|
|
||||||
"lower-latin",
|
|
||||||
"lower-roman",
|
|
||||||
"none",
|
|
||||||
"upper-alpha",
|
|
||||||
"upper-latin",
|
|
||||||
"upper-roman",
|
|
||||||
],
|
|
||||||
Var[
|
|
||||||
Literal[
|
|
||||||
"armenian",
|
|
||||||
"decimal",
|
|
||||||
"decimal-leading-zero",
|
|
||||||
"georgian",
|
|
||||||
"hiragana",
|
|
||||||
"katakana",
|
|
||||||
"lower-alpha",
|
|
||||||
"lower-greek",
|
|
||||||
"lower-latin",
|
|
||||||
"lower-roman",
|
|
||||||
"none",
|
|
||||||
"upper-alpha",
|
|
||||||
"upper-latin",
|
|
||||||
"upper-roman",
|
|
||||||
]
|
|
||||||
],
|
|
||||||
]
|
|
||||||
] = None,
|
|
||||||
items: Optional[
|
|
||||||
Union[
|
|
||||||
Union[Iterable, Var[Iterable]],
|
|
||||||
Var[Optional[Union[Iterable, Var[Iterable]]]],
|
|
||||||
]
|
|
||||||
] = None,
|
|
||||||
reversed: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
reversed: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
||||||
start: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
start: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
||||||
type: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
type: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
||||||
@ -495,54 +383,26 @@ class List(ComponentNamespace):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def __call__(
|
def __call__(
|
||||||
*children,
|
*children,
|
||||||
list_style_type: Optional[
|
list_style_type: Union[
|
||||||
Union[
|
Literal["circle", "disc", "none", "square"],
|
||||||
Literal[
|
Literal[
|
||||||
"armenian",
|
"armenian",
|
||||||
"decimal",
|
"decimal",
|
||||||
"decimal-leading-zero",
|
"decimal-leading-zero",
|
||||||
"georgian",
|
"georgian",
|
||||||
"hiragana",
|
"hiragana",
|
||||||
"katakana",
|
"katakana",
|
||||||
"lower-alpha",
|
"lower-alpha",
|
||||||
"lower-greek",
|
"lower-greek",
|
||||||
"lower-latin",
|
"lower-latin",
|
||||||
"lower-roman",
|
"lower-roman",
|
||||||
"none",
|
"none",
|
||||||
"upper-alpha",
|
"upper-alpha",
|
||||||
"upper-latin",
|
"upper-latin",
|
||||||
"upper-roman",
|
"upper-roman",
|
||||||
],
|
],
|
||||||
Literal["circle", "disc", "none", "square"],
|
|
||||||
Var[
|
|
||||||
Union[
|
|
||||||
Literal[
|
|
||||||
"armenian",
|
|
||||||
"decimal",
|
|
||||||
"decimal-leading-zero",
|
|
||||||
"georgian",
|
|
||||||
"hiragana",
|
|
||||||
"katakana",
|
|
||||||
"lower-alpha",
|
|
||||||
"lower-greek",
|
|
||||||
"lower-latin",
|
|
||||||
"lower-roman",
|
|
||||||
"none",
|
|
||||||
"upper-alpha",
|
|
||||||
"upper-latin",
|
|
||||||
"upper-roman",
|
|
||||||
],
|
|
||||||
Literal["circle", "disc", "none", "square"],
|
|
||||||
]
|
|
||||||
],
|
|
||||||
]
|
|
||||||
] = None,
|
|
||||||
items: Optional[
|
|
||||||
Union[
|
|
||||||
Union[Iterable, Var[Iterable]],
|
|
||||||
Var[Optional[Union[Iterable, Var[Iterable]]]],
|
|
||||||
]
|
|
||||||
] = None,
|
] = None,
|
||||||
|
items: Optional[Union[Iterable, Union[Iterable, Var[Iterable]]]] = None,
|
||||||
style: Optional[Style] = None,
|
style: Optional[Style] = None,
|
||||||
key: Optional[Any] = None,
|
key: Optional[Any] = None,
|
||||||
id: Optional[Any] = None,
|
id: Optional[Any] = None,
|
||||||
|
Loading…
Reference in New Issue
Block a user