script.pyi 4.6 KB

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