script.pyi 4.4 KB

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