instruction stringlengths 0 1k | input stringlengths 1 1k | output stringlengths 10 6.51k |
|---|---|---|
"""Utility functions for the component docs page."""
import hashlib
import inspect
import os
import re
import textwrap
from types import UnionType
from typing import (
Any,
Literal,
Sequence,
Type,
Union,
_GenericAlias,
get_args,
get_origin,
)
import reflex as rx
from flexdown.document... |
from reflex.components.el.elements.base import BaseHTML
from reflex.components.radix.primitives.base import RadixPrimitiveComponent
from reflex.components.radix.themes.base import RadixThemesComponent
from pcweb.flexdown import markdown, xd
from pcweb.templates.docpage import docdemobox, docpage, get_toc, h1_comp, h2... | from reflex.components.component import Component |
"""Utility functions for the component docs page."""
import hashlib
import inspect
import os
import re
import textwrap
from types import UnionType
from typing import (
Any,
Literal,
Sequence,
Type,
Union,
_GenericAlias,
get_args,
get_origin,
)
import reflex as rx
from flexdown.document... |
from reflex.components.radix.primitives.base import RadixPrimitiveComponent
from reflex.components.radix.themes.base import RadixThemesComponent
from pcweb.flexdown import markdown, xd
from pcweb.templates.docpage import docdemobox, docpage, get_toc, h1_comp, h2_comp
def get_code_style(color: str):
return {
... | from reflex.components.el.elements.base import BaseHTML |
"""Utility functions for the component docs page."""
import hashlib
import inspect
import os
import re
import textwrap
from types import UnionType
from typing import (
Any,
Literal,
Sequence,
Type,
Union,
_GenericAlias,
get_args,
get_origin,
)
import reflex as rx
from flexdown.document... |
from reflex.components.radix.themes.base import RadixThemesComponent
from pcweb.flexdown import markdown, xd
from pcweb.templates.docpage import docdemobox, docpage, get_toc, h1_comp, h2_comp
def get_code_style(color: str):
return {
"color": rx.color(color, 11),
"border_radius": "0.25rem",
... | from reflex.components.radix.primitives.base import RadixPrimitiveComponent |
"""Utility functions for the component docs page."""
import hashlib
import inspect
import os
import re
import textwrap
from types import UnionType
from typing import (
Any,
Literal,
Sequence,
Type,
Union,
_GenericAlias,
get_args,
get_origin,
)
import reflex as rx
from flexdown.document... |
from pcweb.flexdown import markdown, xd
from pcweb.templates.docpage import docdemobox, docpage, get_toc, h1_comp, h2_comp
def get_code_style(color: str):
return {
"color": rx.color(color, 11),
"border_radius": "0.25rem",
"border": f"1px solid {rx.color(color, 5)}",
"background":... | from reflex.components.radix.themes.base import RadixThemesComponent |
"""Utility functions for the component docs page."""
import hashlib
import inspect
import os
import re
import textwrap
from types import UnionType
from typing import (
Any,
Literal,
Sequence,
Type,
Union,
_GenericAlias,
get_args,
get_origin,
)
import reflex as rx
from flexdown.document... |
from pcweb.templates.docpage import docdemobox, docpage, get_toc, h1_comp, h2_comp
def get_code_style(color: str):
return {
"color": rx.color(color, 11),
"border_radius": "0.25rem",
"border": f"1px solid {rx.color(color, 5)}",
"background": rx.color(color, 3),
}
class Prop(B... | from pcweb.flexdown import markdown, xd |
"""Utility functions for the component docs page."""
import hashlib
import inspect
import os
import re
import textwrap
from types import UnionType
from typing import (
Any,
Literal,
Sequence,
Type,
Union,
_GenericAlias,
get_args,
get_origin,
)
import reflex as rx
from flexdown.document... |
def get_code_style(color: str):
return {
"color": rx.color(color, 11),
"border_radius": "0.25rem",
"border": f"1px solid {rx.color(color, 5)}",
"background": rx.color(color, 3),
}
class Prop(Base):
"""Hold information about a prop."""
# The name of the prop.
nam... | from pcweb.templates.docpage import docdemobox, docpage, get_toc, h1_comp, h2_comp |
"""Utility functions for the component docs page."""
import hashlib
import inspect
import os
import re
import textwrap
from types import UnionType
from typing import (
Any,
Literal,
Sequence,
Type,
Union,
_GenericAlias,
get_args,
get_origin,
)
import reflex as rx
from flexdown.document... |
class Prop(Base):
"""Hold information about a prop."""
# The name of the prop.
name: str
# The type of the prop.
type_: Any
# The description of the prop.
description: str
# The default value of the prop.
default_value: str
def get_default_value(lines: list[str], start_index... | def get_code_style(color: str):
return {
"color": rx.color(color, 11),
"border_radius": "0.25rem",
"border": f"1px solid {rx.color(color, 5)}",
"background": rx.color(color, 3),
} |
ns for the component docs page."""
import hashlib
import inspect
import os
import re
import textwrap
from types import UnionType
from typing import (
Any,
Literal,
Sequence,
Type,
Union,
_GenericAlias,
get_args,
get_origin,
)
import reflex as rx
from flexdown.document import Document
f... |
def get_default_value(lines: list[str], start_index: int) -> str:
"""Process lines of code to get the value of a prop, handling multi-line values.
Args:
lines: The lines of code to process.
start_index: The index of the line where the prop is defined.
Returns:
The default value ... | class Prop(Base):
"""Hold information about a prop."""
# The name of the prop.
name: str
# The type of the prop.
type_: Any
# The description of the prop.
description: str
# The default value of the prop.
default_value: str |
reflex as rx
from flexdown.document import Document
from reflex.base import Base
from reflex.components.base.fragment import Fragment
from reflex.components.component import Component
from reflex.components.el.elements.base import BaseHTML
from reflex.components.radix.primitives.base import RadixPrimitiveComponent
fro... |
class Source(Base):
"""Parse the source code of a component."""
# The component to parse.
component: Type[Component]
# The source code.
code: list[str] = []
def __init__(self, *args, **kwargs):
"""Initialize the source code parser."""
super().__init__(*args, **kwargs)
... | def get_default_value(lines: list[str], start_index: int) -> str:
"""Process lines of code to get the value of a prop, handling multi-line values.
Args:
lines: The lines of code to process.
start_index: The index of the line where the prop is defined.
Returns:
The default value of ... |
_toc, h1_comp, h2_comp
def get_code_style(color: str):
return {
"color": rx.color(color, 11),
"border_radius": "0.25rem",
"border": f"1px solid {rx.color(color, 5)}",
"background": rx.color(color, 3),
}
class Prop(Base):
"""Hold information about a prop."""
# The nam... |
# Get the initial line
line = lines[start_index]
parts = line.split("=", 1)
if len(parts) != 2:
return ""
value = parts[1].strip()
# Check if the value is complete
open_brackets = value.count("{") - value.count("}")
open_parentheses = value.count("(") - value.count(")")
#... | if start_index > 0:
comment_line = lines[start_index - 1].strip()
if comment_line.startswith("#"):
default_match = re.search(r"Default:\s*(.+)$", comment_line)
if default_match:
default_value = default_match.group(1).strip()
return default_value |
get_code_style(color: str):
return {
"color": rx.color(color, 11),
"border_radius": "0.25rem",
"border": f"1px solid {rx.color(color, 5)}",
"background": rx.color(color, 3),
}
class Prop(Base):
"""Hold information about a prop."""
# The name of the prop.
name: str... |
if comment_line.startswith("#"):
default_match = re.search(r"Default:\s*(.+)$", comment_line)
if default_match:
default_value = default_match.group(1).strip()
return default_value
# Get the initial line
line = lines[start_index]
parts = line.... | comment_line = lines[start_index - 1].strip() |
or": rx.color(color, 11),
"border_radius": "0.25rem",
"border": f"1px solid {rx.color(color, 5)}",
"background": rx.color(color, 3),
}
class Prop(Base):
"""Hold information about a prop."""
# The name of the prop.
name: str
# The type of the prop.
type_: Any
# Th... |
# Get the initial line
line = lines[start_index]
parts = line.split("=", 1)
if len(parts) != 2:
return ""
value = parts[1].strip()
# Check if the value is complete
open_brackets = value.count("{") - value.count("}")
open_parentheses = value.count("(") - value.count(")")
#... | if comment_line.startswith("#"):
default_match = re.search(r"Default:\s*(.+)$", comment_line)
if default_match:
default_value = default_match.group(1).strip()
return default_value |
ius": "0.25rem",
"border": f"1px solid {rx.color(color, 5)}",
"background": rx.color(color, 3),
}
class Prop(Base):
"""Hold information about a prop."""
# The name of the prop.
name: str
# The type of the prop.
type_: Any
# The description of the prop.
description: s... |
if default_match:
default_value = default_match.group(1).strip()
return default_value
# Get the initial line
line = lines[start_index]
parts = line.split("=", 1)
if len(parts) != 2:
return ""
value = parts[1].strip()
# Check if the value is ... | default_match = re.search(r"Default:\s*(.+)$", comment_line) |
"background": rx.color(color, 3),
}
class Prop(Base):
"""Hold information about a prop."""
# The name of the prop.
name: str
# The type of the prop.
type_: Any
# The description of the prop.
description: str
# The default value of the prop.
default_value: str
def get... |
# Get the initial line
line = lines[start_index]
parts = line.split("=", 1)
if len(parts) != 2:
return ""
value = parts[1].strip()
# Check if the value is complete
open_brackets = value.count("{") - value.count("}")
open_parentheses = value.count("(") - value.count(")")
#... | if default_match:
default_value = default_match.group(1).strip()
return default_value |
3),
}
class Prop(Base):
"""Hold information about a prop."""
# The name of the prop.
name: str
# The type of the prop.
type_: Any
# The description of the prop.
description: str
# The default value of the prop.
default_value: str
def get_default_value(lines: list[str], s... |
return default_value
# Get the initial line
line = lines[start_index]
parts = line.split("=", 1)
if len(parts) != 2:
return ""
value = parts[1].strip()
# Check if the value is complete
open_brackets = value.count("{") - value.count("}")
open_parentheses = value... | default_value = default_match.group(1).strip() |
# The type of the prop.
type_: Any
# The description of the prop.
description: str
# The default value of the prop.
default_value: str
def get_default_value(lines: list[str], start_index: int) -> str:
"""Process lines of code to get the value of a prop, handling multi-line values.
A... |
parts = line.split("=", 1)
if len(parts) != 2:
return ""
value = parts[1].strip()
# Check if the value is complete
open_brackets = value.count("{") - value.count("}")
open_parentheses = value.count("(") - value.count(")")
# If brackets or parentheses are not balanced, collect more... | line = lines[start_index] |
type_: Any
# The description of the prop.
description: str
# The default value of the prop.
default_value: str
def get_default_value(lines: list[str], start_index: int) -> str:
"""Process lines of code to get the value of a prop, handling multi-line values.
Args:
lines: The lines ... |
if len(parts) != 2:
return ""
value = parts[1].strip()
# Check if the value is complete
open_brackets = value.count("{") - value.count("}")
open_parentheses = value.count("(") - value.count(")")
# If brackets or parentheses are not balanced, collect more lines
current_index = star... | parts = line.split("=", 1) |
tion of the prop.
description: str
# The default value of the prop.
default_value: str
def get_default_value(lines: list[str], start_index: int) -> str:
"""Process lines of code to get the value of a prop, handling multi-line values.
Args:
lines: The lines of code to process.
sta... |
value = parts[1].strip()
# Check if the value is complete
open_brackets = value.count("{") - value.count("}")
open_parentheses = value.count("(") - value.count(")")
# If brackets or parentheses are not balanced, collect more lines
current_index = start_index + 1
while (open_brackets > 0 o... | if len(parts) != 2:
return "" |
# The default value of the prop.
default_value: str
def get_default_value(lines: list[str], start_index: int) -> str:
"""Process lines of code to get the value of a prop, handling multi-line values.
Args:
lines: The lines of code to process.
start_index: The index of the line where the ... |
# Check if the value is complete
open_brackets = value.count("{") - value.count("}")
open_parentheses = value.count("(") - value.count(")")
# If brackets or parentheses are not balanced, collect more lines
current_index = start_index + 1
while (open_brackets > 0 or open_parentheses > 0) and c... | value = parts[1].strip() |
_default_value(lines: list[str], start_index: int) -> str:
"""Process lines of code to get the value of a prop, handling multi-line values.
Args:
lines: The lines of code to process.
start_index: The index of the line where the prop is defined.
Returns:
The default value of the pro... |
open_parentheses = value.count("(") - value.count(")")
# If brackets or parentheses are not balanced, collect more lines
current_index = start_index + 1
while (open_brackets > 0 or open_parentheses > 0) and current_index < len(lines):
next_line = lines[current_index].strip()
value += "... | open_brackets = value.count("{") - value.count("}") |
r:
"""Process lines of code to get the value of a prop, handling multi-line values.
Args:
lines: The lines of code to process.
start_index: The index of the line where the prop is defined.
Returns:
The default value of the prop.
"""
# Check for the default value in the prop... |
# If brackets or parentheses are not balanced, collect more lines
current_index = start_index + 1
while (open_brackets > 0 or open_parentheses > 0) and current_index < len(lines):
next_line = lines[current_index].strip()
value += " " + next_line
open_brackets += next_line.count("{"... | open_parentheses = value.count("(") - value.count(")") |
e to process.
start_index: The index of the line where the prop is defined.
Returns:
The default value of the prop.
"""
# Check for the default value in the prop comment (Default: )
# Need to update the components comments in order to get the default value
if start_index > 0:
... |
while (open_brackets > 0 or open_parentheses > 0) and current_index < len(lines):
next_line = lines[current_index].strip()
value += " " + next_line
open_brackets += next_line.count("{") - next_line.count("}")
open_parentheses += next_line.count("(") - next_line.count(")")
cu... | current_index = start_index + 1 |
he index of the line where the prop is defined.
Returns:
The default value of the prop.
"""
# Check for the default value in the prop comment (Default: )
# Need to update the components comments in order to get the default value
if start_index > 0:
comment_line = lines[start_index -... |
# Remove any trailing comments
value = re.split(r"\s+#", value)[0].strip()
# Process Var.create_safe within dictionary
def process_var_create_safe(match):
content = match.group(1)
# Extract only the first argument
first_arg = re.split(r",", content)[0].strip()
return f... | while (open_brackets > 0 or open_parentheses > 0) and current_index < len(lines):
next_line = lines[current_index].strip()
value += " " + next_line
open_brackets += next_line.count("{") - next_line.count("}")
open_parentheses += next_line.count("(") - next_line.count(")")
current... |
the prop.
"""
# Check for the default value in the prop comment (Default: )
# Need to update the components comments in order to get the default value
if start_index > 0:
comment_line = lines[start_index - 1].strip()
if comment_line.startswith("#"):
default_match = re.search... |
value += " " + next_line
open_brackets += next_line.count("{") - next_line.count("}")
open_parentheses += next_line.count("(") - next_line.count(")")
current_index += 1
# Remove any trailing comments
value = re.split(r"\s+#", value)[0].strip()
# Process Var.create_safe wit... | next_line = lines[current_index].strip() |
default_match = re.search(r"Default:\s*(.+)$", comment_line)
if default_match:
default_value = default_match.group(1).strip()
return default_value
# Get the initial line
line = lines[start_index]
parts = line.split("=", 1)
if len(parts) != 2:
... |
# Process Var.create_safe within dictionary
def process_var_create_safe(match):
content = match.group(1)
# Extract only the first argument
first_arg = re.split(r",", content)[0].strip()
return first_arg
value = re.sub(r"Var\.create_safe\((.*?)\)", process_var_create_safe, ... | value = re.split(r"\s+#", value)[0].strip() |
match:
default_value = default_match.group(1).strip()
return default_value
# Get the initial line
line = lines[start_index]
parts = line.split("=", 1)
if len(parts) != 2:
return ""
value = parts[1].strip()
# Check if the value is complete
open_bracke... |
value = re.sub(r"Var\.create_safe\((.*?)\)", process_var_create_safe, value)
value = re.sub(r"\bColor\s*\(", "rx.color(", value)
return value.strip()
class Source(Base):
"""Parse the source code of a component."""
# The component to parse.
component: Type[Component]
# The source code.... | def process_var_create_safe(match):
content = match.group(1)
# Extract only the first argument
first_arg = re.split(r",", content)[0].strip()
return first_arg |
lt_match.group(1).strip()
return default_value
# Get the initial line
line = lines[start_index]
parts = line.split("=", 1)
if len(parts) != 2:
return ""
value = parts[1].strip()
# Check if the value is complete
open_brackets = value.count("{") - value.count("}")
... |
# Extract only the first argument
first_arg = re.split(r",", content)[0].strip()
return first_arg
value = re.sub(r"Var\.create_safe\((.*?)\)", process_var_create_safe, value)
value = re.sub(r"\bColor\s*\(", "rx.color(", value)
return value.strip()
class Source(Base):
"""Pars... | content = match.group(1) |
he initial line
line = lines[start_index]
parts = line.split("=", 1)
if len(parts) != 2:
return ""
value = parts[1].strip()
# Check if the value is complete
open_brackets = value.count("{") - value.count("}")
open_parentheses = value.count("(") - value.count(")")
# If brackets ... |
return first_arg
value = re.sub(r"Var\.create_safe\((.*?)\)", process_var_create_safe, value)
value = re.sub(r"\bColor\s*\(", "rx.color(", value)
return value.strip()
class Source(Base):
"""Parse the source code of a component."""
# The component to parse.
component: Type[Component... | first_arg = re.split(r",", content)[0].strip() |
if len(parts) != 2:
return ""
value = parts[1].strip()
# Check if the value is complete
open_brackets = value.count("{") - value.count("}")
open_parentheses = value.count("(") - value.count(")")
# If brackets or parentheses are not balanced, collect more lines
current_index = start... |
value = re.sub(r"\bColor\s*\(", "rx.color(", value)
return value.strip()
class Source(Base):
"""Parse the source code of a component."""
# The component to parse.
component: Type[Component]
# The source code.
code: list[str] = []
def __init__(self, *args, **kwargs):
"""Ini... | value = re.sub(r"Var\.create_safe\((.*?)\)", process_var_create_safe, value) |
ck if the value is complete
open_brackets = value.count("{") - value.count("}")
open_parentheses = value.count("(") - value.count(")")
# If brackets or parentheses are not balanced, collect more lines
current_index = start_index + 1
while (open_brackets > 0 or open_parentheses > 0) and current_inde... |
return value.strip()
class Source(Base):
"""Parse the source code of a component."""
# The component to parse.
component: Type[Component]
# The source code.
code: list[str] = []
def __init__(self, *args, **kwargs):
"""Initialize the source code parser."""
super().__ini... | value = re.sub(r"\bColor\s*\(", "rx.color(", value) |
}")
open_parentheses = value.count("(") - value.count(")")
# If brackets or parentheses are not balanced, collect more lines
current_index = start_index + 1
while (open_brackets > 0 or open_parentheses > 0) and current_index < len(lines):
next_line = lines[current_index].strip()
value +... |
# Mapping from types to colors.
TYPE_COLORS = {
"int": "red",
"float": "orange",
"str": "yellow",
"bool": "teal",
"Component": "purple",
"List": "blue",
"Dict": "blue",
"Tuple": "blue",
"None": "gray",
"Figure": "green",
"Literal": "gray",
"Union": "gray",
}
count = 0... | class Source(Base):
"""Parse the source code of a component."""
# The component to parse.
component: Type[Component]
# The source code.
code: list[str] = []
def __init__(self, *args, **kwargs):
"""Initialize the source code parser."""
super().__init__(*args, **kwargs)
... |
n_brackets > 0 or open_parentheses > 0) and current_index < len(lines):
next_line = lines[current_index].strip()
value += " " + next_line
open_brackets += next_line.count("{") - next_line.count("}")
open_parentheses += next_line.count("(") - next_line.count(")")
current_index += ... |
def get_docs(self) -> str:
"""Get the docstring of the component.
Returns:
The docstring of the component.
"""
return self.component.__doc__
def get_props(self) -> list[Prop]:
"""Get a dictionary of the props and their descriptions.
Returns:
... | def __init__(self, *args, **kwargs):
"""Initialize the source code parser."""
super().__init__(*args, **kwargs)
# Get the source code.
self.code = [
line
for line in inspect.getsource(self.component).splitlines()
if len(line) > 0
] |
rackets += next_line.count("{") - next_line.count("}")
open_parentheses += next_line.count("(") - next_line.count(")")
current_index += 1
# Remove any trailing comments
value = re.split(r"\s+#", value)[0].strip()
# Process Var.create_safe within dictionary
def process_var_create_safe(m... |
def get_docs(self) -> str:
"""Get the docstring of the component.
Returns:
The docstring of the component.
"""
return self.component.__doc__
def get_props(self) -> list[Prop]:
"""Get a dictionary of the props and their descriptions.
Returns:
... | self.code = [
line
for line in inspect.getsource(self.component).splitlines()
if len(line) > 0
] |
ex += 1
# Remove any trailing comments
value = re.split(r"\s+#", value)[0].strip()
# Process Var.create_safe within dictionary
def process_var_create_safe(match):
content = match.group(1)
# Extract only the first argument
first_arg = re.split(r",", content)[0].strip()
r... |
def get_props(self) -> list[Prop]:
"""Get a dictionary of the props and their descriptions.
Returns:
A dictionary of the props and their descriptions.
"""
props = self._get_props()
parent_cls = self.component.__bases__[0]
if parent_cls != rx.Component ... | def get_docs(self) -> str:
"""Get the docstring of the component.
Returns:
The docstring of the component.
"""
return self.component.__doc__ |
ntent = match.group(1)
# Extract only the first argument
first_arg = re.split(r",", content)[0].strip()
return first_arg
value = re.sub(r"Var\.create_safe\((.*?)\)", process_var_create_safe, value)
value = re.sub(r"\bColor\s*\(", "rx.color(", value)
return value.strip()
class Sou... |
def _get_props(self) -> list[Prop]:
"""Get a dictionary of the props and their descriptions.
Returns:
A dictionary of the props and their descriptions.
"""
out = []
props = self.component.get_props()
comments = []
for i, line in enumerate(self.... | def get_props(self) -> list[Prop]:
"""Get a dictionary of the props and their descriptions.
Returns:
A dictionary of the props and their descriptions.
"""
props = self._get_props()
parent_cls = self.component.__bases__[0]
if parent_cls != rx.Component and pa... |
ss_var_create_safe, value)
value = re.sub(r"\bColor\s*\(", "rx.color(", value)
return value.strip()
class Source(Base):
"""Parse the source code of a component."""
# The component to parse.
component: Type[Component]
# The source code.
code: list[str] = []
def __init__(self, *args,... |
parent_cls = self.component.__bases__[0]
if parent_cls != rx.Component and parent_cls != BaseHTML:
parent_props = Source(component=parent_cls).get_props()
# filter out the props that have been overridden in the parent class.
props += [
prop
... | props = self._get_props() |
e = re.sub(r"\bColor\s*\(", "rx.color(", value)
return value.strip()
class Source(Base):
"""Parse the source code of a component."""
# The component to parse.
component: Type[Component]
# The source code.
code: list[str] = []
def __init__(self, *args, **kwargs):
"""Initialize t... |
if parent_cls != rx.Component and parent_cls != BaseHTML:
parent_props = Source(component=parent_cls).get_props()
# filter out the props that have been overridden in the parent class.
props += [
prop
for prop in parent_props
if... | parent_cls = self.component.__bases__[0] |
return value.strip()
class Source(Base):
"""Parse the source code of a component."""
# The component to parse.
component: Type[Component]
# The source code.
code: list[str] = []
def __init__(self, *args, **kwargs):
"""Initialize the source code parser."""
super().__init_... |
return props
def _get_props(self) -> list[Prop]:
"""Get a dictionary of the props and their descriptions.
Returns:
A dictionary of the props and their descriptions.
"""
out = []
props = self.component.get_props()
comments = []
for i, l... | if parent_cls != rx.Component and parent_cls != BaseHTML:
parent_props = Source(component=parent_cls).get_props()
# filter out the props that have been overridden in the parent class.
props += [
prop
for prop in parent_props
if prop.nam... |
code of a component."""
# The component to parse.
component: Type[Component]
# The source code.
code: list[str] = []
def __init__(self, *args, **kwargs):
"""Initialize the source code parser."""
super().__init__(*args, **kwargs)
# Get the source code.
self.code =... |
# filter out the props that have been overridden in the parent class.
props += [
prop
for prop in parent_props
if prop.name not in {p.name for p in props}
]
return props
def _get_props(self) -> list[Prop]:
"""Get ... | parent_props = Source(component=parent_cls).get_props() |
line
for line in inspect.getsource(self.component).splitlines()
if len(line) > 0
]
def get_docs(self) -> str:
"""Get the docstring of the component.
Returns:
The docstring of the component.
"""
return self.component.__doc__
... |
@staticmethod
def get_comment(comments: list[str]):
return "".join([comment.strip().strip("#") for comment in comments])
# Mapping from types to colors.
TYPE_COLORS = {
"int": "red",
"float": "orange",
"str": "yellow",
"bool": "teal",
"Component": "purple",
"List": "blue",
... | def _get_props(self) -> list[Prop]:
"""Get a dictionary of the props and their descriptions.
Returns:
A dictionary of the props and their descriptions.
"""
out = []
props = self.component.get_props()
comments = []
for i, line in enumerate(self.code):... |
rns:
The docstring of the component.
"""
return self.component.__doc__
def get_props(self) -> list[Prop]:
"""Get a dictionary of the props and their descriptions.
Returns:
A dictionary of the props and their descriptions.
"""
props = self._ge... |
comments = []
for i, line in enumerate(self.code):
line = self.code[i]
if re.search("def ", line):
break
if line.strip().startswith("#"):
comments.append(line)
continue
match = re.search(r"\w+:", line)
... | props = self.component.get_props() |
nent.
"""
return self.component.__doc__
def get_props(self) -> list[Prop]:
"""Get a dictionary of the props and their descriptions.
Returns:
A dictionary of the props and their descriptions.
"""
props = self._get_props()
parent_cls = self.compon... |
for i, line in enumerate(self.code):
line = self.code[i]
if re.search("def ", line):
break
if line.strip().startswith("#"):
comments.append(line)
continue
match = re.search(r"\w+:", line)
if match is... | comments = [] |
return self.component.__doc__
def get_props(self) -> list[Prop]:
"""Get a dictionary of the props and their descriptions.
Returns:
A dictionary of the props and their descriptions.
"""
props = self._get_props()
parent_cls = self.component.__bases__[0]
... |
return out
@staticmethod
def get_comment(comments: list[str]):
return "".join([comment.strip().strip("#") for comment in comments])
# Mapping from types to colors.
TYPE_COLORS = {
"int": "red",
"float": "orange",
"str": "yellow",
"bool": "teal",
"Component": "purple",
... | for i, line in enumerate(self.code):
line = self.code[i]
if re.search("def ", line):
break
if line.strip().startswith("#"):
comments.append(line)
continue
match = re.search(r"\w+:", line)
if match is None:
... |
ps(self) -> list[Prop]:
"""Get a dictionary of the props and their descriptions.
Returns:
A dictionary of the props and their descriptions.
"""
props = self._get_props()
parent_cls = self.component.__bases__[0]
if parent_cls != rx.Component and parent_cls !=... |
if re.search("def ", line):
break
if line.strip().startswith("#"):
comments.append(line)
continue
match = re.search(r"\w+:", line)
if match is None:
continue
prop = match.group(0).strip(":")
... | line = self.code[i] |
""Get a dictionary of the props and their descriptions.
Returns:
A dictionary of the props and their descriptions.
"""
props = self._get_props()
parent_cls = self.component.__bases__[0]
if parent_cls != rx.Component and parent_cls != BaseHTML:
parent_pro... |
if line.strip().startswith("#"):
comments.append(line)
continue
match = re.search(r"\w+:", line)
if match is None:
continue
prop = match.group(0).strip(":")
if prop not in props:
continue
... | if re.search("def ", line):
break |
Returns:
A dictionary of the props and their descriptions.
"""
props = self._get_props()
parent_cls = self.component.__bases__[0]
if parent_cls != rx.Component and parent_cls != BaseHTML:
parent_props = Source(component=parent_cls).get_props()
# fil... |
match = re.search(r"\w+:", line)
if match is None:
continue
prop = match.group(0).strip(":")
if prop not in props:
continue
default_value = get_default_value(self.code, i)
if i > 0:
comment_above... | if line.strip().startswith("#"):
comments.append(line)
continue |
t_props()
parent_cls = self.component.__bases__[0]
if parent_cls != rx.Component and parent_cls != BaseHTML:
parent_props = Source(component=parent_cls).get_props()
# filter out the props that have been overridden in the parent class.
props += [
prop
... |
if match is None:
continue
prop = match.group(0).strip(":")
if prop not in props:
continue
default_value = get_default_value(self.code, i)
if i > 0:
comment_above = self.code[i - 1].strip()
as... | match = re.search(r"\w+:", line) |
t.__bases__[0]
if parent_cls != rx.Component and parent_cls != BaseHTML:
parent_props = Source(component=parent_cls).get_props()
# filter out the props that have been overridden in the parent class.
props += [
prop
for prop in parent_props
... |
prop = match.group(0).strip(":")
if prop not in props:
continue
default_value = get_default_value(self.code, i)
if i > 0:
comment_above = self.code[i - 1].strip()
assert comment_above.startswith("#"), (
... | if match is None:
continue |
parent_cls != BaseHTML:
parent_props = Source(component=parent_cls).get_props()
# filter out the props that have been overridden in the parent class.
props += [
prop
for prop in parent_props
if prop.name not in {p.name for p in props}
... |
if prop not in props:
continue
default_value = get_default_value(self.code, i)
if i > 0:
comment_above = self.code[i - 1].strip()
assert comment_above.startswith("#"), (
f"Expected comment, got {comment_above}"
... | prop = match.group(0).strip(":") |
rops = Source(component=parent_cls).get_props()
# filter out the props that have been overridden in the parent class.
props += [
prop
for prop in parent_props
if prop.name not in {p.name for p in props}
]
return props
def ... |
default_value = get_default_value(self.code, i)
if i > 0:
comment_above = self.code[i - 1].strip()
assert comment_above.startswith("#"), (
f"Expected comment, got {comment_above}"
)
comment = Source.get_comment(c... | if prop not in props:
continue |
# filter out the props that have been overridden in the parent class.
props += [
prop
for prop in parent_props
if prop.name not in {p.name for p in props}
]
return props
def _get_props(self) -> list[Prop]:
"""Get a dictionary ... |
if i > 0:
comment_above = self.code[i - 1].strip()
assert comment_above.startswith("#"), (
f"Expected comment, got {comment_above}"
)
comment = Source.get_comment(comments)
comments.clear()
type_ = se... | default_value = get_default_value(self.code, i) |
t class.
props += [
prop
for prop in parent_props
if prop.name not in {p.name for p in props}
]
return props
def _get_props(self) -> list[Prop]:
"""Get a dictionary of the props and their descriptions.
Returns:
... |
comment = Source.get_comment(comments)
comments.clear()
type_ = self.component.get_fields()[prop].outer_type_
out.append(
Prop(
name=prop,
type_=type_,
default_value=default_value,
... | if i > 0:
comment_above = self.code[i - 1].strip()
assert comment_above.startswith("#"), (
f"Expected comment, got {comment_above}"
) |
+= [
prop
for prop in parent_props
if prop.name not in {p.name for p in props}
]
return props
def _get_props(self) -> list[Prop]:
"""Get a dictionary of the props and their descriptions.
Returns:
A dictionary of the ... |
assert comment_above.startswith("#"), (
f"Expected comment, got {comment_above}"
)
comment = Source.get_comment(comments)
comments.clear()
type_ = self.component.get_fields()[prop].outer_type_
out.append(
... | comment_above = self.code[i - 1].strip() |
-> list[Prop]:
"""Get a dictionary of the props and their descriptions.
Returns:
A dictionary of the props and their descriptions.
"""
out = []
props = self.component.get_props()
comments = []
for i, line in enumerate(self.code):
line = ... |
comments.clear()
type_ = self.component.get_fields()[prop].outer_type_
out.append(
Prop(
name=prop,
type_=type_,
default_value=default_value,
description=comment,
)
... | comment = Source.get_comment(comments) |
Returns:
A dictionary of the props and their descriptions.
"""
out = []
props = self.component.get_props()
comments = []
for i, line in enumerate(self.code):
line = self.code[i]
if re.search("def ", line):
break
... |
out.append(
Prop(
name=prop,
type_=type_,
default_value=default_value,
description=comment,
)
)
return out
@staticmethod
def get_comment(comments: list[str]):
... | type_ = self.component.get_fields()[prop].outer_type_ |
line.strip().startswith("#"):
comments.append(line)
continue
match = re.search(r"\w+:", line)
if match is None:
continue
prop = match.group(0).strip(":")
if prop not in props:
continue
default... |
# Mapping from types to colors.
TYPE_COLORS = {
"int": "red",
"float": "orange",
"str": "yellow",
"bool": "teal",
"Component": "purple",
"List": "blue",
"Dict": "blue",
"Tuple": "blue",
"None": "gray",
"Figure": "green",
"Literal": "gray",
"Union": "gray",
}
count = 0... | def get_comment(comments: list[str]):
return "".join([comment.strip().strip("#") for comment in comments]) |
if match is None:
continue
prop = match.group(0).strip(":")
if prop not in props:
continue
default_value = get_default_value(self.code, i)
if i > 0:
comment_above = self.code[i - 1].strip()
assert comme... |
count = 0
def get_id(s):
global count
count += 1
s = str(count)
hash_object = hashlib.sha256(s.encode())
hex_dig = hash_object.hexdigest()
return "a_" + hex_dig[:8]
class PropDocsState(rx.State):
"""Container for dynamic vars used by the prop docs."""
EXCLUDED_COMPONENTS = [
"The... | TYPE_COLORS = {
"int": "red",
"float": "orange",
"str": "yellow",
"bool": "teal",
"Component": "purple",
"List": "blue",
"Dict": "blue",
"Tuple": "blue",
"None": "gray",
"Figure": "green",
"Literal": "gray",
"Union": "gray",
} |
p()
assert comment_above.startswith("#"), (
f"Expected comment, got {comment_above}"
)
comment = Source.get_comment(comments)
comments.clear()
type_ = self.component.get_fields()[prop].outer_type_
out.append(
... |
class PropDocsState(rx.State):
"""Container for dynamic vars used by the prop docs."""
EXCLUDED_COMPONENTS = [
"Theme",
"ThemePanel",
"DrawerRoot",
"DrawerTrigger",
"DrawerOverlay",
"DrawerPortal",
"DrawerContent",
"DrawerClose",
]
def render_select(prop, component, prop_dict)... | def get_id(s):
global count
count += 1
s = str(count)
hash_object = hashlib.sha256(s.encode())
hex_dig = hash_object.hexdigest()
return "a_" + hex_dig[:8] |
("#"), (
f"Expected comment, got {comment_above}"
)
comment = Source.get_comment(comments)
comments.clear()
type_ = self.component.get_fields()[prop].outer_type_
out.append(
Prop(
name=prop,
... |
hash_object = hashlib.sha256(s.encode())
hex_dig = hash_object.hexdigest()
return "a_" + hex_dig[:8]
class PropDocsState(rx.State):
"""Container for dynamic vars used by the prop docs."""
EXCLUDED_COMPONENTS = [
"Theme",
"ThemePanel",
"DrawerRoot",
"DrawerTrigger",
"DrawerOverla... | s = str(count) |
f"Expected comment, got {comment_above}"
)
comment = Source.get_comment(comments)
comments.clear()
type_ = self.component.get_fields()[prop].outer_type_
out.append(
Prop(
name=prop,
type_... |
hex_dig = hash_object.hexdigest()
return "a_" + hex_dig[:8]
class PropDocsState(rx.State):
"""Container for dynamic vars used by the prop docs."""
EXCLUDED_COMPONENTS = [
"Theme",
"ThemePanel",
"DrawerRoot",
"DrawerTrigger",
"DrawerOverlay",
"DrawerPortal",
"DrawerContent",
... | hash_object = hashlib.sha256(s.encode()) |
ove}"
)
comment = Source.get_comment(comments)
comments.clear()
type_ = self.component.get_fields()[prop].outer_type_
out.append(
Prop(
name=prop,
type_=type_,
default_value=def... |
return "a_" + hex_dig[:8]
class PropDocsState(rx.State):
"""Container for dynamic vars used by the prop docs."""
EXCLUDED_COMPONENTS = [
"Theme",
"ThemePanel",
"DrawerRoot",
"DrawerTrigger",
"DrawerOverlay",
"DrawerPortal",
"DrawerContent",
"DrawerClose",
]
def render_sele... | hex_dig = hash_object.hexdigest() |
comments)
comments.clear()
type_ = self.component.get_fields()[prop].outer_type_
out.append(
Prop(
name=prop,
type_=type_,
default_value=default_value,
description=comment,
... |
EXCLUDED_COMPONENTS = [
"Theme",
"ThemePanel",
"DrawerRoot",
"DrawerTrigger",
"DrawerOverlay",
"DrawerPortal",
"DrawerContent",
"DrawerClose",
]
def render_select(prop, component, prop_dict):
if (
not rx.utils.types._issubclass(
component, (RadixThemesCompone... | class PropDocsState(rx.State):
"""Container for dynamic vars used by the prop docs.""" |
.outer_type_
out.append(
Prop(
name=prop,
type_=type_,
default_value=default_value,
description=comment,
)
)
return out
@staticmethod
def get_comment(comments: list[... |
def render_select(prop, component, prop_dict):
if (
not rx.utils.types._issubclass(
component, (RadixThemesComponent, RadixPrimitiveComponent)
)
or component.__name__ in EXCLUDED_COMPONENTS
):
return rx.fragment()
try:
type_ = rx.utils.types.get_args(pr... | EXCLUDED_COMPONENTS = [
"Theme",
"ThemePanel",
"DrawerRoot",
"DrawerTrigger",
"DrawerOverlay",
"DrawerPortal",
"DrawerContent",
"DrawerClose",
] |
)
)
return out
@staticmethod
def get_comment(comments: list[str]):
return "".join([comment.strip().strip("#") for comment in comments])
# Mapping from types to colors.
TYPE_COLORS = {
"int": "red",
"float": "orange",
"str": "yellow",
"bool": "teal",
"Component... |
try:
type_ = rx.utils.types.get_args(prop.type_)[0]
except Exception:
return rx.fragment()
try:
if issubclass(type_, bool) and prop.name not in [
"open",
"checked",
"as_child",
"default_open",
"default_checked",
]:... | if (
not rx.utils.types._issubclass(
component, (RadixThemesComponent, RadixPrimitiveComponent)
)
or component.__name__ in EXCLUDED_COMPONENTS
):
return rx.fragment() |
": "red",
"float": "orange",
"str": "yellow",
"bool": "teal",
"Component": "purple",
"List": "blue",
"Dict": "blue",
"Tuple": "blue",
"None": "gray",
"Figure": "green",
"Literal": "gray",
"Union": "gray",
}
count = 0
def get_id(s):
global count
count += 1
s = s... |
except Exception:
return rx.fragment()
try:
if issubclass(type_, bool) and prop.name not in [
"open",
"checked",
"as_child",
"default_open",
"default_checked",
]:
name = get_id(f"{component.__qualname__}_{prop.name... | type_ = rx.utils.types.get_args(prop.type_)[0] |
ue",
"Dict": "blue",
"Tuple": "blue",
"None": "gray",
"Figure": "green",
"Literal": "gray",
"Union": "gray",
}
count = 0
def get_id(s):
global count
count += 1
s = str(count)
hash_object = hashlib.sha256(s.encode())
hex_dig = hash_object.hexdigest()
return "a_" + hex_d... |
except TypeError:
pass
if not isinstance(type_, _GenericAlias) or (
type_.__origin__ not in (Literal, Union)
):
return rx.fragment()
# For the Union[Literal, Breakpoints] type
if type_.__origin__ is Union:
if not all(
arg.__name__ in ["Literal", "Breakpo... | if issubclass(type_, bool) and prop.name not in [
"open",
"checked",
"as_child",
"default_open",
"default_checked",
]:
name = get_id(f"{component.__qualname__}_{prop.name}")
PropDocsState.add_var(name, bool, False)
v... |
s = str(count)
hash_object = hashlib.sha256(s.encode())
hex_dig = hash_object.hexdigest()
return "a_" + hex_dig[:8]
class PropDocsState(rx.State):
"""Container for dynamic vars used by the prop docs."""
EXCLUDED_COMPONENTS = [
"Theme",
"ThemePanel",
"DrawerRoot",
"DrawerTrigger",
... |
PropDocsState.add_var(name, bool, False)
var = getattr(PropDocsState, name)
setter = getattr(PropDocsState, f"set_{name}")
prop_dict[prop.name] = var
return rx.checkbox(
var,
on_change=setter,
)
except TypeError... | name = get_id(f"{component.__qualname__}_{prop.name}") |
"Container for dynamic vars used by the prop docs."""
EXCLUDED_COMPONENTS = [
"Theme",
"ThemePanel",
"DrawerRoot",
"DrawerTrigger",
"DrawerOverlay",
"DrawerPortal",
"DrawerContent",
"DrawerClose",
]
def render_select(prop, component, prop_dict):
if (
not rx.utils.types._i... |
prop_dict[prop.name] = var
return rx.checkbox(
var,
on_change=setter,
)
except TypeError:
pass
if not isinstance(type_, _GenericAlias) or (
type_.__origin__ not in (Literal, Union)
):
return rx.fragment()
# For... | setter = getattr(PropDocsState, f"set_{name}") |
LUDED_COMPONENTS = [
"Theme",
"ThemePanel",
"DrawerRoot",
"DrawerTrigger",
"DrawerOverlay",
"DrawerPortal",
"DrawerContent",
"DrawerClose",
]
def render_select(prop, component, prop_dict):
if (
not rx.utils.types._issubclass(
component, (RadixThemesComponent, Ra... |
return rx.checkbox(
var,
on_change=setter,
)
except TypeError:
pass
if not isinstance(type_, _GenericAlias) or (
type_.__origin__ not in (Literal, Union)
):
return rx.fragment()
# For the Union[Literal, Breakpoints] type
... | prop_dict[prop.name] = var |
e",
]
def render_select(prop, component, prop_dict):
if (
not rx.utils.types._issubclass(
component, (RadixThemesComponent, RadixPrimitiveComponent)
)
or component.__name__ in EXCLUDED_COMPONENTS
):
return rx.fragment()
try:
type_ = rx.utils.types.get_ar... |
# For the Union[Literal, Breakpoints] type
if type_.__origin__ is Union:
if not all(
arg.__name__ in ["Literal", "Breakpoints"] for arg in type_.__args__
):
return rx.fragment()
else:
# Get the literal values
literal_values = [
... | if not isinstance(type_, _GenericAlias) or (
type_.__origin__ not in (Literal, Union)
):
return rx.fragment() |
)
or component.__name__ in EXCLUDED_COMPONENTS
):
return rx.fragment()
try:
type_ = rx.utils.types.get_args(prop.type_)[0]
except Exception:
return rx.fragment()
try:
if issubclass(type_, bool) and prop.name not in [
"open",
"checked",
... |
# Get the first option.
option = type_.__args__[0]
name = get_id(f"{component.__qualname__}_{prop.name}")
PropDocsState.add_var(name, str, option)
var = getattr(PropDocsState, name)
setter = getattr(PropDocsState, f"set_{name}")
prop_dict[prop.name] = var
if prop.name == "color_scheme"... | if type_.__origin__ is Union:
if not all(
arg.__name__ in ["Literal", "Breakpoints"] for arg in type_.__args__
):
return rx.fragment()
else:
# Get the literal values
literal_values = [
str(lit_arg)
for arg in type_._... |
XCLUDED_COMPONENTS
):
return rx.fragment()
try:
type_ = rx.utils.types.get_args(prop.type_)[0]
except Exception:
return rx.fragment()
try:
if issubclass(type_, bool) and prop.name not in [
"open",
"checked",
"as_child",
"de... |
# Get the first option.
option = type_.__args__[0]
name = get_id(f"{component.__qualname__}_{prop.name}")
PropDocsState.add_var(name, str, option)
var = getattr(PropDocsState, name)
setter = getattr(PropDocsState, f"set_{name}")
prop_dict[prop.name] = var
if prop.name == "color_scheme"... | if not all(
arg.__name__ in ["Literal", "Breakpoints"] for arg in type_.__args__
):
return rx.fragment()
else:
# Get the literal values
literal_values = [
str(lit_arg)
for arg in type_.__args__
if get_origin(... |
s(type_, bool) and prop.name not in [
"open",
"checked",
"as_child",
"default_open",
"default_checked",
]:
name = get_id(f"{component.__qualname__}_{prop.name}")
PropDocsState.add_var(name, bool, False)
var = getattr... |
option = literal_values[0]
name = get_id(f"{component.__qualname__}_{prop.name}")
PropDocsState.add_var(name, str, option)
var = getattr(PropDocsState, name)
setter = getattr(PropDocsState, f"set_{name}")
prop_dict[prop.name] = var
ret... | literal_values = [
str(lit_arg)
for arg in type_.__args__
if get_origin(arg) is Literal
for lit_arg in arg.__args__
] |
mponent.__qualname__}_{prop.name}")
PropDocsState.add_var(name, bool, False)
var = getattr(PropDocsState, name)
setter = getattr(PropDocsState, f"set_{name}")
prop_dict[prop.name] = var
return rx.checkbox(
var,
on_change=setter,... |
name = get_id(f"{component.__qualname__}_{prop.name}")
PropDocsState.add_var(name, str, option)
var = getattr(PropDocsState, name)
setter = getattr(PropDocsState, f"set_{name}")
prop_dict[prop.name] = var
return rx.select.root(
rx.... | option = literal_values[0] |
PropDocsState.add_var(name, bool, False)
var = getattr(PropDocsState, name)
setter = getattr(PropDocsState, f"set_{name}")
prop_dict[prop.name] = var
return rx.checkbox(
var,
on_change=setter,
)
except TypeError:
... |
PropDocsState.add_var(name, str, option)
var = getattr(PropDocsState, name)
setter = getattr(PropDocsState, f"set_{name}")
prop_dict[prop.name] = var
return rx.select.root(
rx.select.trigger(class_name="w-32 font-small text-slate-11"),
... | name = get_id(f"{component.__qualname__}_{prop.name}") |
tattr(PropDocsState, f"set_{name}")
prop_dict[prop.name] = var
return rx.checkbox(
var,
on_change=setter,
)
except TypeError:
pass
if not isinstance(type_, _GenericAlias) or (
type_.__origin__ not in (Literal, Union)
):
... |
setter = getattr(PropDocsState, f"set_{name}")
prop_dict[prop.name] = var
return rx.select.root(
rx.select.trigger(class_name="w-32 font-small text-slate-11"),
rx.select.content(
rx.select.group(
*[
... | var = getattr(PropDocsState, name) |
prop_dict[prop.name] = var
return rx.checkbox(
var,
on_change=setter,
)
except TypeError:
pass
if not isinstance(type_, _GenericAlias) or (
type_.__origin__ not in (Literal, Union)
):
return rx.fragment()
# For the Union[L... |
prop_dict[prop.name] = var
return rx.select.root(
rx.select.trigger(class_name="w-32 font-small text-slate-11"),
rx.select.content(
rx.select.group(
*[
rx.select.item(item, value=item, class_... | setter = getattr(PropDocsState, f"set_{name}") |
var,
on_change=setter,
)
except TypeError:
pass
if not isinstance(type_, _GenericAlias) or (
type_.__origin__ not in (Literal, Union)
):
return rx.fragment()
# For the Union[Literal, Breakpoints] type
if type_.__origin__ is Union:... |
return rx.select.root(
rx.select.trigger(class_name="w-32 font-small text-slate-11"),
rx.select.content(
rx.select.group(
*[
rx.select.item(item, value=item, class_name="font-small")
... | prop_dict[prop.name] = var |
str(lit_arg)
for arg in type_.__args__
if get_origin(arg) is Literal
for lit_arg in arg.__args__
]
option = literal_values[0]
name = get_id(f"{component.__qualname__}_{prop.name}")
PropDocsState.add_var(name, str, o... |
name = get_id(f"{component.__qualname__}_{prop.name}")
PropDocsState.add_var(name, str, option)
var = getattr(PropDocsState, name)
setter = getattr(PropDocsState, f"set_{name}")
prop_dict[prop.name] = var
if prop.name == "color_scheme":
return rx.popover.root(
rx.popover.tr... | option = type_.__args__[0] |
for arg in type_.__args__
if get_origin(arg) is Literal
for lit_arg in arg.__args__
]
option = literal_values[0]
name = get_id(f"{component.__qualname__}_{prop.name}")
PropDocsState.add_var(name, str, option)
var = getatt... |
PropDocsState.add_var(name, str, option)
var = getattr(PropDocsState, name)
setter = getattr(PropDocsState, f"set_{name}")
prop_dict[prop.name] = var
if prop.name == "color_scheme":
return rx.popover.root(
rx.popover.trigger(
rx.box(
rx.butto... | name = get_id(f"{component.__qualname__}_{prop.name}") |
rg in arg.__args__
]
option = literal_values[0]
name = get_id(f"{component.__qualname__}_{prop.name}")
PropDocsState.add_var(name, str, option)
var = getattr(PropDocsState, name)
setter = getattr(PropDocsState, f"set_{name}")
prop_dict[... |
setter = getattr(PropDocsState, f"set_{name}")
prop_dict[prop.name] = var
if prop.name == "color_scheme":
return rx.popover.root(
rx.popover.trigger(
rx.box(
rx.button(
rx.text(var, class_name="font-small"),
... | var = getattr(PropDocsState, name) |
option = literal_values[0]
name = get_id(f"{component.__qualname__}_{prop.name}")
PropDocsState.add_var(name, str, option)
var = getattr(PropDocsState, name)
setter = getattr(PropDocsState, f"set_{name}")
prop_dict[prop.name] = var
return rx.... |
prop_dict[prop.name] = var
if prop.name == "color_scheme":
return rx.popover.root(
rx.popover.trigger(
rx.box(
rx.button(
rx.text(var, class_name="font-small"),
# Match the select.trigger svg icon
... | setter = getattr(PropDocsState, f"set_{name}") |
get_id(f"{component.__qualname__}_{prop.name}")
PropDocsState.add_var(name, str, option)
var = getattr(PropDocsState, name)
setter = getattr(PropDocsState, f"set_{name}")
prop_dict[prop.name] = var
return rx.select.root(
rx.select.trigger(clas... |
if prop.name == "color_scheme":
return rx.popover.root(
rx.popover.trigger(
rx.box(
rx.button(
rx.text(var, class_name="font-small"),
# Match the select.trigger svg icon
rx.html(
... | prop_dict[prop.name] = var |
_}_{prop.name}")
PropDocsState.add_var(name, str, option)
var = getattr(PropDocsState, name)
setter = getattr(PropDocsState, f"set_{name}")
prop_dict[prop.name] = var
return rx.select.root(
rx.select.trigger(class_name="w-32 font-small text-sla... |
return rx.select.root(
rx.select.trigger(class_name="font-small w-32 text-slate-11"),
rx.select.content(
rx.select.group(
*[
rx.select.item(
item,
value=item,
class_name="font-sma... | if prop.name == "color_scheme":
return rx.popover.root(
rx.popover.trigger(
rx.box(
rx.button(
rx.text(var, class_name="font-small"),
# Match the select.trigger svg icon
rx.html(
... |
ve shrink-0 rounded-md size-8 cursor-pointer",
)
for color in list(map(str, type_.__args__))
],
columns="6",
spacing="3",
),
),
)
return rx.select.root(
rx.select.t... |
def color_scheme_hovercard(literal_values: list[str]) -> rx.Component:
return hovercard(
rx.icon(tag="palette", size=15, class_name="!text-slate-9 shrink-0"),
rx.grid(
*[
rx.tooltip(
rx.box(
bg=f"var(--{color}-9)", class_name... | def hovercard(trigger: rx.Component, content: rx.Component) -> rx.Component:
return rx.hover_card.root(
rx.hover_card.trigger(
trigger,
),
rx.hover_card.content(
content, side="top", align="center", class_name="font-small text-slate-11"
),
) |
rx.select.trigger(class_name="font-small w-32 text-slate-11"),
rx.select.content(
rx.select.group(
*[
rx.select.item(
item,
value=item,
class_name="font-small",
_hover... |
def prop_docs(
prop: Prop, prop_dict, component, is_interactive: bool
) -> list[rx.Component]:
"""Generate the docs for a prop."""
# Get the type of the prop.
type_ = prop.type_
if rx.utils.types._issubclass(prop.type_, rx.Var):
# For vars, get the type of the var.
type_ = rx.util... | def color_scheme_hovercard(literal_values: list[str]) -> rx.Component:
return hovercard(
rx.icon(tag="palette", size=15, class_name="!text-slate-9 shrink-0"),
rx.grid(
*[
rx.tooltip(
rx.box(
bg=f"var(--{color}-9)", class_name="r... |
ent:
return rx.hover_card.root(
rx.hover_card.trigger(
trigger,
),
rx.hover_card.content(
content, side="top", align="center", class_name="font-small text-slate-11"
),
)
def color_scheme_hovercard(literal_values: list[str]) -> rx.Component:
return ho... |
if rx.utils.types._issubclass(prop.type_, rx.Var):
# For vars, get the type of the var.
type_ = rx.utils.types.get_args(type_)[0]
origin = get_origin(type_)
args = get_args(type_)
literal_values = [] # Literal values of the prop
all_types = [] # List for all the prop types
m... | type_ = prop.type_ |
r_card.root(
rx.hover_card.trigger(
trigger,
),
rx.hover_card.content(
content, side="top", align="center", class_name="font-small text-slate-11"
),
)
def color_scheme_hovercard(literal_values: list[str]) -> rx.Component:
return hovercard(
rx.ico... |
origin = get_origin(type_)
args = get_args(type_)
literal_values = [] # Literal values of the prop
all_types = [] # List for all the prop types
max_prop_values = 2
short_type_name = None
common_types = {} # Used to exclude common types from the max_prop_values
if origin in (Union... | if rx.utils.types._issubclass(prop.type_, rx.Var):
# For vars, get the type of the var.
type_ = rx.utils.types.get_args(type_)[0] |
t(
content, side="top", align="center", class_name="font-small text-slate-11"
),
)
def color_scheme_hovercard(literal_values: list[str]) -> rx.Component:
return hovercard(
rx.icon(tag="palette", size=15, class_name="!text-slate-9 shrink-0"),
rx.grid(
*[
... |
origin = get_origin(type_)
args = get_args(type_)
literal_values = [] # Literal values of the prop
all_types = [] # List for all the prop types
max_prop_values = 2
short_type_name = None
common_types = {} # Used to exclude common types from the max_prop_values
if origin in (Union... | type_ = rx.utils.types.get_args(type_)[0] |
er", class_name="font-small text-slate-11"
),
)
def color_scheme_hovercard(literal_values: list[str]) -> rx.Component:
return hovercard(
rx.icon(tag="palette", size=15, class_name="!text-slate-9 shrink-0"),
rx.grid(
*[
rx.tooltip(
rx.box(... |
args = get_args(type_)
literal_values = [] # Literal values of the prop
all_types = [] # List for all the prop types
max_prop_values = 2
short_type_name = None
common_types = {} # Used to exclude common types from the max_prop_values
if origin in (Union, UnionType):
non_litera... | origin = get_origin(type_) |
t-slate-11"
),
)
def color_scheme_hovercard(literal_values: list[str]) -> rx.Component:
return hovercard(
rx.icon(tag="palette", size=15, class_name="!text-slate-9 shrink-0"),
rx.grid(
*[
rx.tooltip(
rx.box(
bg=f"v... |
literal_values = [] # Literal values of the prop
all_types = [] # List for all the prop types
max_prop_values = 2
short_type_name = None
common_types = {} # Used to exclude common types from the max_prop_values
if origin in (Union, UnionType):
non_literal_types = [] # List for al... | args = get_args(type_) |
def color_scheme_hovercard(literal_values: list[str]) -> rx.Component:
return hovercard(
rx.icon(tag="palette", size=15, class_name="!text-slate-9 shrink-0"),
rx.grid(
*[
rx.tooltip(
rx.box(
bg=f"var(--{color}-9)", class_name... | # Literal values of the prop
all_types = [] # List for all the prop types
max_prop_values = 2
short_type_name = None
common_types = {} # Used to exclude common types from the max_prop_values
if origin in (Union, UnionType):
non_literal_types = [] # List for all the non-literal types
... | literal_values = [] |
]) -> rx.Component:
return hovercard(
rx.icon(tag="palette", size=15, class_name="!text-slate-9 shrink-0"),
rx.grid(
*[
rx.tooltip(
rx.box(
bg=f"var(--{color}-9)", class_name="rounded-md size-8 shrink-0"
),
... | # List for all the prop types
max_prop_values = 2
short_type_name = None
common_types = {} # Used to exclude common types from the max_prop_values
if origin in (Union, UnionType):
non_literal_types = [] # List for all the non-literal types
for arg in args:
all_types.ap... | all_types = [] |
rx.icon(tag="palette", size=15, class_name="!text-slate-9 shrink-0"),
rx.grid(
*[
rx.tooltip(
rx.box(
bg=f"var(--{color}-9)", class_name="rounded-md size-8 shrink-0"
),
content=color,
... |
short_type_name = None
common_types = {} # Used to exclude common types from the max_prop_values
if origin in (Union, UnionType):
non_literal_types = [] # List for all the non-literal types
for arg in args:
all_types.append(arg.__name__)
if get_origin(arg) is Li... | max_prop_values = 2 |
ze=15, class_name="!text-slate-9 shrink-0"),
rx.grid(
*[
rx.tooltip(
rx.box(
bg=f"var(--{color}-9)", class_name="rounded-md size-8 shrink-0"
),
content=color,
delay_duration=0,
... |
common_types = {} # Used to exclude common types from the max_prop_values
if origin in (Union, UnionType):
non_literal_types = [] # List for all the non-literal types
for arg in args:
all_types.append(arg.__name__)
if get_origin(arg) is Literal:
liter... | short_type_name = None |
te-9 shrink-0"),
rx.grid(
*[
rx.tooltip(
rx.box(
bg=f"var(--{color}-9)", class_name="rounded-md size-8 shrink-0"
),
content=color,
delay_duration=0,
)
... | # Used to exclude common types from the max_prop_values
if origin in (Union, UnionType):
non_literal_types = [] # List for all the non-literal types
for arg in args:
all_types.append(arg.__name__)
if get_origin(arg) is Literal:
literal_values.extend(str(li... | common_types = {} |
rx.box(
bg=f"var(--{color}-9)", class_name="rounded-md size-8 shrink-0"
),
content=color,
delay_duration=0,
)
for color in literal_values
],
columns="6",
... |
# Get the default value.
default_value = prop.default_value if prop.default_value is not None else "-"
# Get the color of the prop.
color = TYPE_COLORS.get(short_type_name, "gray")
# Return the docs for the prop.
return [
rx.table.cell(
rx.box(
rx.code(prop.... | if origin in (Union, UnionType):
non_literal_types = [] # List for all the non-literal types
for arg in args:
all_types.append(arg.__name__)
if get_origin(arg) is Literal:
literal_values.extend(str(lit_arg) for lit_arg in arg.__args__)
elif arg.__nam... |
bg=f"var(--{color}-9)", class_name="rounded-md size-8 shrink-0"
),
content=color,
delay_duration=0,
)
for color in literal_values
],
columns="6",
spacing="3",
),
)
def p... | # List for all the non-literal types
for arg in args:
all_types.append(arg.__name__)
if get_origin(arg) is Literal:
literal_values.extend(str(lit_arg) for lit_arg in arg.__args__)
elif arg.__name__ != "Breakpoints": # Don't include Breakpoints
... | non_literal_types = [] |
0"
),
content=color,
delay_duration=0,
)
for color in literal_values
],
columns="6",
spacing="3",
),
)
def prop_docs(
prop: Prop, prop_dict, component, is_interactive: bool
)... |
if len(literal_values) < 10:
literal_str = " | ".join(f'"{value}"' for value in literal_values)
type_components = ([literal_str] if literal_str else []) + non_literal_types
type_name = (
" | ".join(type_components)
if len(type_components) == ... | for arg in args:
all_types.append(arg.__name__)
if get_origin(arg) is Literal:
literal_values.extend(str(lit_arg) for lit_arg in arg.__args__)
elif arg.__name__ != "Breakpoints": # Don't include Breakpoints
non_literal_types.append(arg.__name__) |
delay_duration=0,
)
for color in literal_values
],
columns="6",
spacing="3",
),
)
def prop_docs(
prop: Prop, prop_dict, component, is_interactive: bool
) -> list[rx.Component]:
"""Generate the docs for a prop."""
# Ge... |
if len(literal_values) < 10:
literal_str = " | ".join(f'"{value}"' for value in literal_values)
type_components = ([literal_str] if literal_str else []) + non_literal_types
type_name = (
" | ".join(type_components)
if len(type_components) == ... | if get_origin(arg) is Literal:
literal_values.extend(str(lit_arg) for lit_arg in arg.__args__)
elif arg.__name__ != "Breakpoints": # Don't include Breakpoints
non_literal_types.append(arg.__name__) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.