script.pyi 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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, Literal, Optional, overload
  6. from reflex.components.component import Component
  7. from reflex.event import EventType
  8. from reflex.style import Style
  9. from reflex.vars.base import Var
  10. class Script(Component):
  11. @overload
  12. @classmethod
  13. def create( # type: ignore
  14. cls,
  15. *children,
  16. src: Var[str] | str | None = None,
  17. strategy: Literal["afterInteractive", "beforeInteractive", "lazyOnload"]
  18. | Var[Literal["afterInteractive", "beforeInteractive", "lazyOnload"]]
  19. | None = None,
  20. style: Style | None = None,
  21. key: Any | None = None,
  22. id: Any | None = None,
  23. class_name: Any | None = None,
  24. autofocus: bool | None = None,
  25. custom_attrs: dict[str, Var | Any] | None = None,
  26. on_blur: Optional[EventType[()]] = None,
  27. on_click: Optional[EventType[()]] = None,
  28. on_context_menu: Optional[EventType[()]] = None,
  29. on_double_click: Optional[EventType[()]] = None,
  30. on_error: Optional[EventType[()]] = None,
  31. on_focus: Optional[EventType[()]] = None,
  32. on_load: Optional[EventType[()]] = None,
  33. on_mount: Optional[EventType[()]] = None,
  34. on_mouse_down: Optional[EventType[()]] = None,
  35. on_mouse_enter: Optional[EventType[()]] = None,
  36. on_mouse_leave: Optional[EventType[()]] = None,
  37. on_mouse_move: Optional[EventType[()]] = None,
  38. on_mouse_out: Optional[EventType[()]] = None,
  39. on_mouse_over: Optional[EventType[()]] = None,
  40. on_mouse_up: Optional[EventType[()]] = None,
  41. on_ready: Optional[EventType[()]] = None,
  42. on_scroll: Optional[EventType[()]] = None,
  43. on_unmount: Optional[EventType[()]] = None,
  44. **props,
  45. ) -> "Script":
  46. """Create an inline or user-defined script.
  47. If a string is provided as the first child, it will be rendered as an inline script
  48. otherwise the `src` prop must be provided.
  49. The following event triggers are provided:
  50. on_load: Execute code after the script has finished loading.
  51. on_ready: Execute code after the script has finished loading and every
  52. time the component is mounted.
  53. on_error: Execute code if the script fails to load.
  54. Args:
  55. *children: The children of the component.
  56. src: Required unless inline script is used
  57. strategy: When the script will execute: afterInteractive (defer-like behavior) | beforeInteractive | lazyOnload (async-like behavior)
  58. on_load: Triggered when the script is loading
  59. on_ready: Triggered when the script has loaded
  60. on_error: Triggered when the script has errored
  61. style: The style of the component.
  62. key: A unique key for the component.
  63. id: The id for the component.
  64. class_name: The class name for the component.
  65. autofocus: Whether the component should take the focus once the page is loaded
  66. custom_attrs: custom attribute
  67. **props: The props of the component.
  68. Returns:
  69. The component.
  70. Raises:
  71. ValueError: when neither children nor `src` are specified.
  72. """
  73. ...
  74. script = Script.create