markdown.pyi 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. """Stub file for reflex/components/markdown/markdown.py"""
  2. # ------------------- DO NOT EDIT ----------------------
  3. # This file was generated by `reflex/utils/pyi_generator.py`!
  4. # ------------------------------------------------------
  5. import dataclasses
  6. from functools import lru_cache
  7. from typing import Any, Callable, Dict, Optional, Sequence, Union, overload
  8. from reflex.components.component import Component
  9. from reflex.event import EventType
  10. from reflex.style import Style
  11. from reflex.utils.imports import ImportDict
  12. from reflex.vars.base import LiteralVar, Var, VarData
  13. _CHILDREN = Var(_js_expr="children", _var_type=str)
  14. _PROPS = Var(_js_expr="...props")
  15. _PROPS_IN_TAG = Var(_js_expr="{...props}")
  16. _MOCK_ARG = Var(_js_expr="", _var_type=str)
  17. _LANGUAGE = Var(_js_expr="_language", _var_type=str)
  18. _REMARK_MATH = Var(_js_expr="remarkMath")
  19. _REMARK_GFM = Var(_js_expr="remarkGfm")
  20. _REMARK_UNWRAP_IMAGES = Var(_js_expr="remarkUnwrapImages")
  21. _REMARK_PLUGINS = LiteralVar.create([_REMARK_MATH, _REMARK_GFM, _REMARK_UNWRAP_IMAGES])
  22. _REHYPE_KATEX = Var(_js_expr="rehypeKatex")
  23. _REHYPE_RAW = Var(_js_expr="rehypeRaw")
  24. _REHYPE_PLUGINS = LiteralVar.create([_REHYPE_KATEX, _REHYPE_RAW])
  25. NO_PROPS_TAGS = ("ul", "ol", "li")
  26. @lru_cache
  27. def get_base_component_map() -> dict[str, Callable]: ...
  28. @dataclasses.dataclass()
  29. class MarkdownComponentMap:
  30. @classmethod
  31. def get_component_map_custom_code(cls) -> Var: ...
  32. @classmethod
  33. def create_map_fn_var(
  34. cls,
  35. fn_body: Var | None = None,
  36. fn_args: Sequence[str] | None = None,
  37. explicit_return: bool | None = None,
  38. var_data: VarData | None = None,
  39. ) -> Var: ...
  40. @classmethod
  41. def get_fn_args(cls) -> Sequence[str]: ...
  42. @classmethod
  43. def get_fn_body(cls) -> Var: ...
  44. class Markdown(Component):
  45. @overload
  46. @classmethod
  47. def create( # type: ignore
  48. cls,
  49. *children,
  50. component_map: Optional[Dict[str, Any]] = None,
  51. component_map_hash: Optional[str] = None,
  52. style: Optional[Style] = None,
  53. key: Optional[Any] = None,
  54. id: Optional[Any] = None,
  55. class_name: Optional[Any] = None,
  56. autofocus: Optional[bool] = None,
  57. custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
  58. on_blur: Optional[EventType[()]] = None,
  59. on_click: Optional[EventType[()]] = None,
  60. on_context_menu: Optional[EventType[()]] = None,
  61. on_double_click: Optional[EventType[()]] = None,
  62. on_focus: Optional[EventType[()]] = None,
  63. on_mount: Optional[EventType[()]] = None,
  64. on_mouse_down: Optional[EventType[()]] = None,
  65. on_mouse_enter: Optional[EventType[()]] = None,
  66. on_mouse_leave: Optional[EventType[()]] = None,
  67. on_mouse_move: Optional[EventType[()]] = None,
  68. on_mouse_out: Optional[EventType[()]] = None,
  69. on_mouse_over: Optional[EventType[()]] = None,
  70. on_mouse_up: Optional[EventType[()]] = None,
  71. on_scroll: Optional[EventType[()]] = None,
  72. on_unmount: Optional[EventType[()]] = None,
  73. **props,
  74. ) -> "Markdown":
  75. """Create a markdown component.
  76. Args:
  77. *children: The children of the component.
  78. component_map: The component map from a tag to a lambda that creates a component.
  79. component_map_hash: The hash of the component map, generated at create() time.
  80. style: The style of the component.
  81. key: A unique key for the component.
  82. id: The id for the component.
  83. class_name: The class name for the component.
  84. autofocus: Whether the component should take the focus once the page is loaded
  85. custom_attrs: custom attribute
  86. **props: The properties of the component.
  87. Raises:
  88. ValueError: If the children are not valid.
  89. Returns:
  90. The markdown component.
  91. """
  92. ...
  93. def add_imports(self) -> ImportDict | list[ImportDict]: ...
  94. def format_component_map(self) -> dict[str, Var]: ...
  95. def get_component(self, tag: str, **props) -> Component: ...
  96. def format_component(self, tag: str, **props) -> str: ...