scripts.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. """Scripts classes."""
  2. from typing import Union
  3. from reflex.vars.base import Var
  4. from .base import BaseHTML
  5. class Canvas(BaseHTML):
  6. """Display the canvas element."""
  7. tag = "canvas"
  8. class Noscript(BaseHTML):
  9. """Display the noscript element."""
  10. tag = "noscript"
  11. class Script(BaseHTML):
  12. """Display the script element."""
  13. tag = "script"
  14. # Indicates that the script should be executed asynchronously
  15. async_: Var[Union[str, int, bool]]
  16. # Character encoding of the external script
  17. char_set: Var[Union[str, int, bool]]
  18. # Configures the CORS requests for the script
  19. cross_origin: Var[Union[str, int, bool]]
  20. # Indicates that the script should be executed after the page has finished parsing
  21. defer: Var[Union[str, int, bool]]
  22. # Security feature allowing browsers to verify what they fetch
  23. integrity: Var[Union[str, int, bool]]
  24. # Specifies the scripting language used in the type attribute
  25. language: Var[Union[str, int, bool]]
  26. # Specifies which referrer information to send when fetching the script
  27. referrer_policy: Var[Union[str, int, bool]]
  28. # URL of an external script
  29. src: Var[Union[str, int, bool]]
  30. # Specifies the MIME type of the script
  31. type: Var[Union[str, int, bool]]
  32. canvas = Canvas.create
  33. noscript = Noscript.create
  34. script = Script.create