inline.py 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. """Inline classes."""
  2. from typing import ClassVar, Literal
  3. from reflex.vars.base import Var
  4. from .base import BaseHTML
  5. ReferrerPolicy = Literal[
  6. "",
  7. "no-referrer",
  8. "no-referrer-when-downgrade",
  9. "origin",
  10. "origin-when-cross-origin",
  11. "same-origin",
  12. "strict-origin",
  13. "strict-origin-when-cross-origin",
  14. "unsafe-url",
  15. ]
  16. class A(BaseHTML): # Inherits common attributes from BaseMeta
  17. """Display the 'a' element."""
  18. tag = "a"
  19. # Specifies that the target (the file specified in the href attribute) will be downloaded when a user clicks on the hyperlink.
  20. download: Var[str | bool]
  21. # Specifies the URL of the page the link goes to
  22. href: Var[str]
  23. # Specifies the language of the linked document
  24. href_lang: Var[str]
  25. # Specifies what media/device the linked document is optimized for
  26. media: Var[str]
  27. # Specifies which referrer is sent when fetching the resource
  28. ping: Var[str]
  29. # Specifies the relationship between the current document and the linked document
  30. referrer_policy: Var[ReferrerPolicy]
  31. # Specifies the relationship between the linked document and the current document
  32. rel: Var[str]
  33. # Specifies where to open the linked document
  34. target: Var[str | Literal["_self", "_blank", "_parent", "_top"]]
  35. _invalid_children: ClassVar[list[str]] = ["A"]
  36. class Abbr(BaseHTML):
  37. """Display the abbr element."""
  38. tag = "abbr"
  39. class B(BaseHTML):
  40. """Display the b element."""
  41. tag = "b"
  42. class Bdi(BaseHTML):
  43. """Display the bdi element."""
  44. tag = "bdi"
  45. class Bdo(BaseHTML):
  46. """Display the bdo element."""
  47. tag = "bdo"
  48. class Br(BaseHTML):
  49. """Display the br element."""
  50. tag = "br"
  51. class Cite(BaseHTML):
  52. """Display the cite element."""
  53. tag = "cite"
  54. class Code(BaseHTML):
  55. """Display the code element."""
  56. tag = "code"
  57. class Data(BaseHTML):
  58. """Display the data element."""
  59. tag = "data"
  60. # Specifies the machine-readable translation of the data element.
  61. value: Var[str | int | float]
  62. class Dfn(BaseHTML):
  63. """Display the dfn element."""
  64. tag = "dfn"
  65. class Em(BaseHTML):
  66. """Display the em element."""
  67. tag = "em"
  68. class I(BaseHTML): # noqa: E742
  69. """Display the i element."""
  70. tag = "i"
  71. class Kbd(BaseHTML):
  72. """Display the kbd element."""
  73. tag = "kbd"
  74. class Mark(BaseHTML):
  75. """Display the mark element."""
  76. tag = "mark"
  77. class Q(BaseHTML):
  78. """Display the q element."""
  79. tag = "q"
  80. # Specifies the source URL of the quote.
  81. cite: Var[str]
  82. class Rp(BaseHTML):
  83. """Display the rp element."""
  84. tag = "rp"
  85. class Rt(BaseHTML):
  86. """Display the rt element."""
  87. tag = "rt"
  88. class Ruby(BaseHTML):
  89. """Display the ruby element."""
  90. tag = "ruby"
  91. class S(BaseHTML):
  92. """Display the s element."""
  93. tag = "s"
  94. class Samp(BaseHTML):
  95. """Display the samp element."""
  96. tag = "samp"
  97. class Small(BaseHTML):
  98. """Display the small element."""
  99. tag = "small"
  100. class Span(BaseHTML):
  101. """Display the span element."""
  102. tag = "span"
  103. class Strong(BaseHTML):
  104. """Display the strong element."""
  105. tag = "strong"
  106. class Sub(BaseHTML):
  107. """Display the sub element."""
  108. tag = "sub"
  109. class Sup(BaseHTML):
  110. """Display the sup element."""
  111. tag = "sup"
  112. class Time(BaseHTML):
  113. """Display the time element."""
  114. tag = "time"
  115. # Specifies the date and/or time of the element.
  116. date_time: Var[str]
  117. class U(BaseHTML):
  118. """Display the u element."""
  119. tag = "u"
  120. class Wbr(BaseHTML):
  121. """Display the wbr element."""
  122. tag = "wbr"
  123. a = A.create
  124. abbr = Abbr.create
  125. b = B.create
  126. bdi = Bdi.create
  127. bdo = Bdo.create
  128. br = Br.create
  129. cite = Cite.create
  130. code = Code.create
  131. data = Data.create
  132. dfn = Dfn.create
  133. em = Em.create
  134. i = I.create
  135. kbd = Kbd.create
  136. mark = Mark.create
  137. q = Q.create
  138. rp = Rp.create
  139. rt = Rt.create
  140. ruby = Ruby.create
  141. s = S.create
  142. samp = Samp.create
  143. small = Small.create
  144. span = Span.create
  145. strong = Strong.create
  146. sub = Sub.create
  147. sup = Sup.create
  148. time = Time.create
  149. u = U.create
  150. wbr = Wbr.create