markdown.pyi 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 BASE_STATE, EventType
  10. from reflex.style import Style
  11. from reflex.utils.imports import ImportDict
  12. from reflex.vars.base import LiteralVar, Var
  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) -> str: ...
  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: ...
  39. @classmethod
  40. def get_fn_args(cls) -> Sequence[str]: ...
  41. @classmethod
  42. def get_fn_body(cls) -> Var: ...
  43. class Markdown(Component):
  44. @overload
  45. @classmethod
  46. def create( # type: ignore
  47. cls,
  48. *children,
  49. component_map: Optional[Dict[str, Any]] = None,
  50. component_map_hash: Optional[str] = None,
  51. style: Optional[Style] = None,
  52. key: Optional[Any] = None,
  53. id: Optional[Any] = None,
  54. class_name: Optional[Any] = None,
  55. autofocus: Optional[bool] = None,
  56. custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
  57. on_blur: Optional[EventType[[], BASE_STATE]] = None,
  58. on_click: Optional[EventType[[], BASE_STATE]] = None,
  59. on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
  60. on_double_click: Optional[EventType[[], BASE_STATE]] = None,
  61. on_focus: Optional[EventType[[], BASE_STATE]] = None,
  62. on_mount: Optional[EventType[[], BASE_STATE]] = None,
  63. on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
  64. on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
  65. on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
  66. on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
  67. on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
  68. on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
  69. on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
  70. on_scroll: Optional[EventType[[], BASE_STATE]] = None,
  71. on_unmount: Optional[EventType[[], BASE_STATE]] = None,
  72. **props,
  73. ) -> "Markdown":
  74. """Create a markdown component.
  75. Args:
  76. *children: The children of the component.
  77. component_map: The component map from a tag to a lambda that creates a component.
  78. component_map_hash: The hash of the component map, generated at create() time.
  79. style: The style of the component.
  80. key: A unique key for the component.
  81. id: The id for the component.
  82. class_name: The class name for the component.
  83. autofocus: Whether the component should take the focus once the page is loaded
  84. custom_attrs: custom attribute
  85. **props: The properties of the component.
  86. Raises:
  87. ValueError: If the children are not valid.
  88. Returns:
  89. The markdown component.
  90. """
  91. ...
  92. def add_imports(self) -> ImportDict | list[ImportDict]: ...
  93. def format_component_map(self) -> dict[str, Var]: ...
  94. def get_component(self, tag: str, **props) -> Component: ...
  95. def format_component(self, tag: str, **props) -> str: ...