script.pyi 4.7 KB

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