script.pyi 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. """Stub file for reflex/components/base/script.py"""
  2. # ------------------- DO NOT EDIT ----------------------
  3. # This file was generated by `reflex/utils/pyi_generator.py`!
  4. # ------------------------------------------------------
  5. from typing import Any, Callable, Dict, Literal, Optional, Union, overload
  6. from reflex.components.component import Component
  7. from reflex.event import EventHandler, EventSpec
  8. from reflex.style import Style
  9. from reflex.vars import Var
  10. class Script(Component):
  11. @overload
  12. @classmethod
  13. def create( # type: ignore
  14. cls,
  15. *children,
  16. src: Optional[Union[Var[str], str]] = None,
  17. strategy: Optional[
  18. Union[
  19. Var[Literal["afterInteractive", "beforeInteractive", "lazyOnload"]],
  20. Literal["afterInteractive", "beforeInteractive", "lazyOnload"],
  21. ]
  22. ] = None,
  23. style: Optional[Style] = None,
  24. key: Optional[Any] = None,
  25. id: Optional[Any] = None,
  26. class_name: Optional[Any] = None,
  27. autofocus: Optional[bool] = None,
  28. custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
  29. on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  30. on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  31. on_context_menu: Optional[
  32. Union[EventHandler, EventSpec, list, Callable, Var]
  33. ] = None,
  34. on_double_click: Optional[
  35. Union[EventHandler, EventSpec, list, Callable, Var]
  36. ] = None,
  37. on_error: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  38. on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  39. on_load: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  40. on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  41. on_mouse_down: Optional[
  42. Union[EventHandler, EventSpec, list, Callable, Var]
  43. ] = None,
  44. on_mouse_enter: Optional[
  45. Union[EventHandler, EventSpec, list, Callable, Var]
  46. ] = None,
  47. on_mouse_leave: Optional[
  48. Union[EventHandler, EventSpec, list, Callable, Var]
  49. ] = None,
  50. on_mouse_move: Optional[
  51. Union[EventHandler, EventSpec, list, Callable, Var]
  52. ] = None,
  53. on_mouse_out: Optional[
  54. Union[EventHandler, EventSpec, list, Callable, Var]
  55. ] = None,
  56. on_mouse_over: Optional[
  57. Union[EventHandler, EventSpec, list, Callable, Var]
  58. ] = None,
  59. on_mouse_up: Optional[
  60. Union[EventHandler, EventSpec, list, Callable, Var]
  61. ] = None,
  62. on_ready: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  63. on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  64. on_unmount: Optional[
  65. Union[EventHandler, EventSpec, list, Callable, Var]
  66. ] = None,
  67. **props,
  68. ) -> "Script":
  69. """Create an inline or user-defined script.
  70. If a string is provided as the first child, it will be rendered as an inline script
  71. otherwise the `src` prop must be provided.
  72. The following event triggers are provided:
  73. on_load: Execute code after the script has finished loading.
  74. on_ready: Execute code after the script has finished loading and every
  75. time the component is mounted.
  76. on_error: Execute code if the script fails to load.
  77. Args:
  78. *children: The children of the component.
  79. src: Required unless inline script is used
  80. strategy: When the script will execute: afterInteractive (defer-like behavior) | beforeInteractive | lazyOnload (async-like behavior)
  81. style: The style of the component.
  82. key: A unique key for the component.
  83. id: The id for the component.
  84. class_name: The class name for the component.
  85. autofocus: Whether the component should take the focus once the page is loaded
  86. custom_attrs: custom attribute
  87. **props: The props of the component.
  88. Returns:
  89. The component.
  90. Raises:
  91. ValueError: when neither children nor `src` are specified.
  92. """
  93. ...
  94. script = Script.create