reflex 0.7.14a5__py3-none-any.whl → 0.8.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of reflex might be problematic. Click here for more details.

Files changed (236) hide show
  1. reflex/.templates/jinja/app/rxconfig.py.jinja2 +4 -1
  2. reflex/.templates/jinja/web/package.json.jinja2 +1 -1
  3. reflex/.templates/jinja/web/pages/_app.js.jinja2 +21 -11
  4. reflex/.templates/jinja/web/pages/_document.js.jinja2 +1 -1
  5. reflex/.templates/jinja/web/pages/base_page.js.jinja2 +0 -1
  6. reflex/.templates/jinja/web/pages/stateful_component.js.jinja2 +4 -0
  7. reflex/.templates/jinja/web/styles/styles.css.jinja2 +1 -0
  8. reflex/.templates/jinja/web/utils/context.js.jinja2 +25 -8
  9. reflex/.templates/web/app/entry.client.js +8 -0
  10. reflex/.templates/web/app/routes.js +10 -0
  11. reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js +12 -37
  12. reflex/.templates/web/postcss.config.js +1 -1
  13. reflex/.templates/web/react-router.config.js +6 -0
  14. reflex/.templates/web/styles/__reflex_style_reset.css +399 -0
  15. reflex/.templates/web/utils/client_side_routing.js +21 -19
  16. reflex/.templates/web/utils/react-theme.js +92 -0
  17. reflex/.templates/web/utils/state.js +251 -100
  18. reflex/.templates/web/vite-plugin-safari-cachebust.js +160 -0
  19. reflex/.templates/web/vite.config.js +39 -0
  20. reflex/__init__.py +1 -6
  21. reflex/__init__.pyi +327 -192
  22. reflex/app.py +103 -152
  23. reflex/base.py +1 -87
  24. reflex/compiler/compiler.py +70 -19
  25. reflex/compiler/templates.py +3 -3
  26. reflex/compiler/utils.py +91 -33
  27. reflex/components/__init__.py +0 -2
  28. reflex/components/__init__.pyi +34 -18
  29. reflex/components/base/__init__.py +1 -5
  30. reflex/components/base/__init__.pyi +30 -21
  31. reflex/components/base/app_wrap.pyi +7 -7
  32. reflex/components/base/body.pyi +7 -7
  33. reflex/components/base/document.py +18 -14
  34. reflex/components/base/document.pyi +88 -38
  35. reflex/components/base/error_boundary.pyi +7 -7
  36. reflex/components/base/fragment.pyi +7 -7
  37. reflex/components/base/link.pyi +12 -12
  38. reflex/components/base/meta.py +4 -15
  39. reflex/components/base/meta.pyi +31 -31
  40. reflex/components/base/script.py +60 -58
  41. reflex/components/base/script.pyi +248 -34
  42. reflex/components/base/strict_mode.pyi +7 -7
  43. reflex/components/component.py +146 -217
  44. reflex/components/core/__init__.py +1 -0
  45. reflex/components/core/__init__.pyi +77 -37
  46. reflex/components/core/auto_scroll.pyi +7 -7
  47. reflex/components/core/banner.pyi +33 -33
  48. reflex/components/core/client_side_routing.py +7 -6
  49. reflex/components/core/client_side_routing.pyi +8 -59
  50. reflex/components/core/clipboard.pyi +7 -7
  51. reflex/components/core/debounce.py +1 -0
  52. reflex/components/core/debounce.pyi +7 -7
  53. reflex/components/core/foreach.py +5 -4
  54. reflex/components/core/helmet.py +14 -0
  55. reflex/components/{next/base.pyi → core/helmet.pyi} +12 -10
  56. reflex/components/core/html.pyi +7 -7
  57. reflex/components/core/match.py +3 -3
  58. reflex/components/core/sticky.pyi +21 -20
  59. reflex/components/core/upload.py +4 -2
  60. reflex/components/core/upload.pyi +26 -25
  61. reflex/components/datadisplay/__init__.pyi +13 -7
  62. reflex/components/datadisplay/code.py +14 -79
  63. reflex/components/datadisplay/code.pyi +11 -13
  64. reflex/components/datadisplay/dataeditor.pyi +38 -15
  65. reflex/components/datadisplay/shiki_code_block.py +5 -3
  66. reflex/components/datadisplay/shiki_code_block.pyi +16 -15
  67. reflex/components/dynamic.py +5 -5
  68. reflex/components/el/__init__.pyi +506 -246
  69. reflex/components/el/element.pyi +7 -7
  70. reflex/components/el/elements/__init__.pyi +504 -245
  71. reflex/components/el/elements/base.pyi +7 -7
  72. reflex/components/el/elements/forms.pyi +146 -101
  73. reflex/components/el/elements/inline.pyi +142 -142
  74. reflex/components/el/elements/media.pyi +131 -130
  75. reflex/components/el/elements/metadata.pyi +32 -32
  76. reflex/components/el/elements/other.pyi +37 -37
  77. reflex/components/el/elements/scripts.pyi +17 -17
  78. reflex/components/el/elements/sectioning.pyi +77 -77
  79. reflex/components/el/elements/tables.pyi +52 -52
  80. reflex/components/el/elements/typography.pyi +77 -77
  81. reflex/components/field.py +175 -0
  82. reflex/components/gridjs/datatable.py +2 -2
  83. reflex/components/gridjs/datatable.pyi +14 -14
  84. reflex/components/lucide/icon.py +6 -2
  85. reflex/components/lucide/icon.pyi +19 -17
  86. reflex/components/markdown/markdown.py +5 -3
  87. reflex/components/markdown/markdown.pyi +7 -7
  88. reflex/components/moment/moment.py +1 -1
  89. reflex/components/moment/moment.pyi +7 -7
  90. reflex/components/plotly/plotly.py +12 -6
  91. reflex/components/plotly/plotly.pyi +50 -49
  92. reflex/components/props.py +376 -27
  93. reflex/components/radix/__init__.pyi +123 -65
  94. reflex/components/radix/primitives/__init__.pyi +6 -4
  95. reflex/components/radix/primitives/accordion.py +8 -1
  96. reflex/components/radix/primitives/accordion.pyi +37 -37
  97. reflex/components/radix/primitives/base.pyi +12 -12
  98. reflex/components/radix/primitives/drawer.pyi +56 -55
  99. reflex/components/radix/primitives/form.pyi +63 -53
  100. reflex/components/radix/primitives/progress.pyi +26 -25
  101. reflex/components/radix/primitives/slider.pyi +27 -27
  102. reflex/components/radix/themes/__init__.pyi +5 -6
  103. reflex/components/radix/themes/base.py +3 -3
  104. reflex/components/radix/themes/base.pyi +42 -42
  105. reflex/components/radix/themes/color_mode.py +5 -6
  106. reflex/components/radix/themes/color_mode.pyi +17 -17
  107. reflex/components/radix/themes/components/__init__.pyi +75 -38
  108. reflex/components/radix/themes/components/alert_dialog.pyi +37 -37
  109. reflex/components/radix/themes/components/aspect_ratio.pyi +7 -7
  110. reflex/components/radix/themes/components/avatar.pyi +7 -7
  111. reflex/components/radix/themes/components/badge.pyi +7 -7
  112. reflex/components/radix/themes/components/button.pyi +7 -7
  113. reflex/components/radix/themes/components/callout.pyi +26 -25
  114. reflex/components/radix/themes/components/card.pyi +7 -7
  115. reflex/components/radix/themes/components/checkbox.pyi +16 -15
  116. reflex/components/radix/themes/components/checkbox_cards.pyi +12 -12
  117. reflex/components/radix/themes/components/checkbox_group.pyi +12 -12
  118. reflex/components/radix/themes/components/context_menu.pyi +67 -67
  119. reflex/components/radix/themes/components/data_list.pyi +22 -22
  120. reflex/components/radix/themes/components/dialog.pyi +36 -35
  121. reflex/components/radix/themes/components/dropdown_menu.pyi +42 -42
  122. reflex/components/radix/themes/components/hover_card.pyi +21 -20
  123. reflex/components/radix/themes/components/icon_button.pyi +7 -7
  124. reflex/components/radix/themes/components/inset.pyi +7 -7
  125. reflex/components/radix/themes/components/popover.pyi +22 -22
  126. reflex/components/radix/themes/components/progress.pyi +7 -7
  127. reflex/components/radix/themes/components/radio.pyi +7 -7
  128. reflex/components/radix/themes/components/radio_cards.pyi +12 -12
  129. reflex/components/radix/themes/components/radio_group.pyi +21 -20
  130. reflex/components/radix/themes/components/scroll_area.pyi +7 -7
  131. reflex/components/radix/themes/components/segmented_control.pyi +12 -12
  132. reflex/components/radix/themes/components/select.pyi +46 -45
  133. reflex/components/radix/themes/components/separator.pyi +7 -7
  134. reflex/components/radix/themes/components/skeleton.pyi +7 -7
  135. reflex/components/radix/themes/components/slider.pyi +17 -9
  136. reflex/components/radix/themes/components/spinner.pyi +7 -7
  137. reflex/components/radix/themes/components/switch.pyi +7 -7
  138. reflex/components/radix/themes/components/table.pyi +37 -37
  139. reflex/components/radix/themes/components/tabs.pyi +26 -25
  140. reflex/components/radix/themes/components/text_area.pyi +15 -9
  141. reflex/components/radix/themes/components/text_field.pyi +32 -19
  142. reflex/components/radix/themes/components/tooltip.pyi +7 -7
  143. reflex/components/radix/themes/layout/__init__.pyi +27 -14
  144. reflex/components/radix/themes/layout/base.pyi +7 -7
  145. reflex/components/radix/themes/layout/box.pyi +7 -7
  146. reflex/components/radix/themes/layout/center.pyi +7 -7
  147. reflex/components/radix/themes/layout/container.pyi +7 -7
  148. reflex/components/radix/themes/layout/flex.pyi +7 -7
  149. reflex/components/radix/themes/layout/grid.pyi +7 -7
  150. reflex/components/radix/themes/layout/list.pyi +26 -25
  151. reflex/components/radix/themes/layout/section.pyi +7 -7
  152. reflex/components/radix/themes/layout/spacer.pyi +7 -7
  153. reflex/components/radix/themes/layout/stack.pyi +17 -17
  154. reflex/components/radix/themes/typography/__init__.pyi +7 -5
  155. reflex/components/radix/themes/typography/blockquote.pyi +7 -7
  156. reflex/components/radix/themes/typography/code.pyi +7 -7
  157. reflex/components/radix/themes/typography/heading.pyi +7 -7
  158. reflex/components/radix/themes/typography/link.py +46 -11
  159. reflex/components/radix/themes/typography/link.pyi +312 -9
  160. reflex/components/radix/themes/typography/text.pyi +36 -35
  161. reflex/components/react_player/audio.pyi +10 -8
  162. reflex/components/react_player/react_player.pyi +7 -7
  163. reflex/components/react_player/video.pyi +10 -8
  164. reflex/components/recharts/__init__.pyi +208 -100
  165. reflex/components/recharts/cartesian.py +10 -8
  166. reflex/components/recharts/cartesian.pyi +90 -94
  167. reflex/components/recharts/charts.py +4 -2
  168. reflex/components/recharts/charts.pyi +49 -49
  169. reflex/components/recharts/general.pyi +31 -31
  170. reflex/components/recharts/polar.py +8 -4
  171. reflex/components/recharts/polar.pyi +23 -23
  172. reflex/components/recharts/recharts.py +2 -2
  173. reflex/components/recharts/recharts.pyi +12 -12
  174. reflex/components/sonner/toast.py +3 -3
  175. reflex/components/sonner/toast.pyi +9 -9
  176. reflex/config.py +10 -113
  177. reflex/constants/__init__.py +2 -2
  178. reflex/constants/base.py +28 -11
  179. reflex/constants/compiler.py +12 -3
  180. reflex/constants/event.py +1 -0
  181. reflex/constants/installer.py +26 -20
  182. reflex/constants/route.py +27 -8
  183. reflex/constants/state.py +2 -0
  184. reflex/custom_components/custom_components.py +0 -14
  185. reflex/environment.py +77 -5
  186. reflex/event.py +178 -81
  187. reflex/experimental/__init__.py +0 -30
  188. reflex/istate/__init__.py +69 -0
  189. reflex/istate/manager.py +1 -0
  190. reflex/istate/proxy.py +5 -3
  191. reflex/page.py +0 -27
  192. reflex/plugins/__init__.py +3 -2
  193. reflex/plugins/base.py +5 -1
  194. reflex/plugins/shared_tailwind.py +215 -0
  195. reflex/plugins/sitemap.py +206 -0
  196. reflex/plugins/tailwind_v3.py +15 -108
  197. reflex/plugins/tailwind_v4.py +18 -110
  198. reflex/reflex.py +1 -0
  199. reflex/route.py +157 -75
  200. reflex/state.py +171 -155
  201. reflex/testing.py +86 -16
  202. reflex/utils/build.py +38 -82
  203. reflex/utils/exec.py +83 -175
  204. reflex/utils/export.py +2 -2
  205. reflex/utils/format.py +1 -5
  206. reflex/utils/imports.py +5 -16
  207. reflex/utils/misc.py +67 -0
  208. reflex/utils/prerequisites.py +66 -68
  209. reflex/utils/processes.py +24 -47
  210. reflex/utils/pyi_generator.py +44 -49
  211. reflex/utils/serializers.py +14 -1
  212. reflex/utils/telemetry.py +0 -15
  213. reflex/utils/types.py +197 -62
  214. reflex/vars/__init__.py +2 -0
  215. reflex/vars/base.py +367 -134
  216. {reflex-0.7.14a5.dist-info → reflex-0.8.0.dist-info}/METADATA +15 -8
  217. reflex-0.8.0.dist-info/RECORD +403 -0
  218. reflex/.templates/web/next.config.js +0 -7
  219. reflex/components/base/head.py +0 -20
  220. reflex/components/base/head.pyi +0 -116
  221. reflex/components/next/__init__.py +0 -10
  222. reflex/components/next/base.py +0 -7
  223. reflex/components/next/image.py +0 -117
  224. reflex/components/next/image.pyi +0 -94
  225. reflex/components/next/link.py +0 -20
  226. reflex/components/next/link.pyi +0 -67
  227. reflex/components/next/video.py +0 -38
  228. reflex/components/next/video.pyi +0 -68
  229. reflex/components/suneditor/__init__.py +0 -5
  230. reflex/components/suneditor/editor.py +0 -269
  231. reflex/components/suneditor/editor.pyi +0 -199
  232. reflex/experimental/layout.py +0 -254
  233. reflex-0.7.14a5.dist-info/RECORD +0 -407
  234. {reflex-0.7.14a5.dist-info → reflex-0.8.0.dist-info}/WHEEL +0 -0
  235. {reflex-0.7.14a5.dist-info → reflex-0.8.0.dist-info}/entry_points.txt +0 -0
  236. {reflex-0.7.14a5.dist-info → reflex-0.8.0.dist-info}/licenses/LICENSE +0 -0
@@ -4,18 +4,17 @@
4
4
  # This file was generated by `reflex/utils/pyi_generator.py`!
5
5
  # ------------------------------------------------------
6
6
  from collections.abc import Mapping, Sequence
7
- from typing import Any, Literal, overload
7
+ from typing import Any, Literal
8
8
 
9
9
  from reflex.components.core.breakpoints import Breakpoints
10
10
  from reflex.components.el import elements
11
- from reflex.event import EventType
11
+ from reflex.event import EventType, PointerEventInfo
12
12
  from reflex.vars.base import Var
13
13
 
14
14
  class Title(elements.Title):
15
15
  def render(self) -> dict: ...
16
- @overload
17
16
  @classmethod
18
- def create( # type: ignore
17
+ def create(
19
18
  cls,
20
19
  *children,
21
20
  style: Sequence[Mapping[str, Any]]
@@ -30,9 +29,9 @@ class Title(elements.Title):
30
29
  autofocus: bool | None = None,
31
30
  custom_attrs: dict[str, Var | Any] | None = None,
32
31
  on_blur: EventType[()] | None = None,
33
- on_click: EventType[()] | None = None,
34
- on_context_menu: EventType[()] | None = None,
35
- on_double_click: EventType[()] | None = None,
32
+ on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
33
+ on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
34
+ on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
36
35
  on_focus: EventType[()] | None = None,
37
36
  on_mount: EventType[()] | None = None,
38
37
  on_mouse_down: EventType[()] | None = None,
@@ -43,6 +42,7 @@ class Title(elements.Title):
43
42
  on_mouse_over: EventType[()] | None = None,
44
43
  on_mouse_up: EventType[()] | None = None,
45
44
  on_scroll: EventType[()] | None = None,
45
+ on_scroll_end: EventType[()] | None = None,
46
46
  on_unmount: EventType[()] | None = None,
47
47
  **props,
48
48
  ) -> Title:
@@ -64,16 +64,15 @@ class Title(elements.Title):
64
64
  """
65
65
 
66
66
  class Meta(elements.Meta):
67
- @overload
68
67
  @classmethod
69
- def create( # type: ignore
68
+ def create(
70
69
  cls,
71
70
  *children,
72
- char_set: str | None = None,
73
- content: str | None = None,
74
- name: str | None = None,
75
- property: str | None = None,
76
- http_equiv: str | None = None,
71
+ property: Var[str] | str | None = None,
72
+ char_set: Var[str] | str | None = None,
73
+ content: Var[str] | str | None = None,
74
+ http_equiv: Var[str] | str | None = None,
75
+ name: Var[str] | str | None = None,
77
76
  access_key: Var[str] | str | None = None,
78
77
  auto_capitalize: Literal[
79
78
  "characters", "none", "off", "on", "sentences", "words"
@@ -264,9 +263,9 @@ class Meta(elements.Meta):
264
263
  autofocus: bool | None = None,
265
264
  custom_attrs: dict[str, Var | Any] | None = None,
266
265
  on_blur: EventType[()] | None = None,
267
- on_click: EventType[()] | None = None,
268
- on_context_menu: EventType[()] | None = None,
269
- on_double_click: EventType[()] | None = None,
266
+ on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
267
+ on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
268
+ on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
270
269
  on_focus: EventType[()] | None = None,
271
270
  on_mount: EventType[()] | None = None,
272
271
  on_mouse_down: EventType[()] | None = None,
@@ -277,6 +276,7 @@ class Meta(elements.Meta):
277
276
  on_mouse_over: EventType[()] | None = None,
278
277
  on_mouse_up: EventType[()] | None = None,
279
278
  on_scroll: EventType[()] | None = None,
279
+ on_scroll_end: EventType[()] | None = None,
280
280
  on_unmount: EventType[()] | None = None,
281
281
  **props,
282
282
  ) -> Meta:
@@ -284,11 +284,11 @@ class Meta(elements.Meta):
284
284
 
285
285
  Args:
286
286
  *children: The children of the component.
287
+ property: The type of metadata value.
287
288
  char_set: Specifies the character encoding for the HTML document
288
289
  content: Defines the content of the metadata
289
- name: Specifies a name for the metadata
290
- property: The type of metadata value.
291
290
  http_equiv: Provides an HTTP header for the information/value of the content attribute
291
+ name: Specifies a name for the metadata
292
292
  access_key: Provides a hint for generating a keyboard shortcut for the current element.
293
293
  auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
294
294
  content_editable: Indicates whether the element's content is editable.
@@ -319,12 +319,11 @@ class Meta(elements.Meta):
319
319
  """
320
320
 
321
321
  class Description(elements.Meta):
322
- @overload
323
322
  @classmethod
324
- def create( # type: ignore
323
+ def create(
325
324
  cls,
326
325
  *children,
327
- name: str | None = None,
326
+ name: Var[str] | str | None = None,
328
327
  char_set: Var[str] | str | None = None,
329
328
  content: Var[str] | str | None = None,
330
329
  http_equiv: Var[str] | str | None = None,
@@ -518,9 +517,9 @@ class Description(elements.Meta):
518
517
  autofocus: bool | None = None,
519
518
  custom_attrs: dict[str, Var | Any] | None = None,
520
519
  on_blur: EventType[()] | None = None,
521
- on_click: EventType[()] | None = None,
522
- on_context_menu: EventType[()] | None = None,
523
- on_double_click: EventType[()] | None = None,
520
+ on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
521
+ on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
522
+ on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
524
523
  on_focus: EventType[()] | None = None,
525
524
  on_mount: EventType[()] | None = None,
526
525
  on_mouse_down: EventType[()] | None = None,
@@ -531,6 +530,7 @@ class Description(elements.Meta):
531
530
  on_mouse_over: EventType[()] | None = None,
532
531
  on_mouse_up: EventType[()] | None = None,
533
532
  on_scroll: EventType[()] | None = None,
533
+ on_scroll_end: EventType[()] | None = None,
534
534
  on_unmount: EventType[()] | None = None,
535
535
  **props,
536
536
  ) -> Description:
@@ -572,12 +572,11 @@ class Description(elements.Meta):
572
572
  """
573
573
 
574
574
  class Image(elements.Meta):
575
- @overload
576
575
  @classmethod
577
- def create( # type: ignore
576
+ def create(
578
577
  cls,
579
578
  *children,
580
- property: str | None = None,
579
+ property: Var[str] | str | None = None,
581
580
  char_set: Var[str] | str | None = None,
582
581
  content: Var[str] | str | None = None,
583
582
  http_equiv: Var[str] | str | None = None,
@@ -772,9 +771,9 @@ class Image(elements.Meta):
772
771
  autofocus: bool | None = None,
773
772
  custom_attrs: dict[str, Var | Any] | None = None,
774
773
  on_blur: EventType[()] | None = None,
775
- on_click: EventType[()] | None = None,
776
- on_context_menu: EventType[()] | None = None,
777
- on_double_click: EventType[()] | None = None,
774
+ on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
775
+ on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
776
+ on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
778
777
  on_focus: EventType[()] | None = None,
779
778
  on_mount: EventType[()] | None = None,
780
779
  on_mouse_down: EventType[()] | None = None,
@@ -785,6 +784,7 @@ class Image(elements.Meta):
785
784
  on_mouse_over: EventType[()] | None = None,
786
785
  on_mouse_up: EventType[()] | None = None,
787
786
  on_scroll: EventType[()] | None = None,
787
+ on_scroll_end: EventType[()] | None = None,
788
788
  on_unmount: EventType[()] | None = None,
789
789
  **props,
790
790
  ) -> Image:
@@ -1,76 +1,78 @@
1
- """Next.js script wrappers and inline script functionality.
2
-
3
- https://nextjs.org/docs/app/api-reference/components/script
4
- """
1
+ """Wrapper for the script element. Uses the Helmet component to manage the head."""
5
2
 
6
3
  from __future__ import annotations
7
4
 
8
- from typing import Literal
9
-
10
- from reflex.components.component import Component
11
- from reflex.event import EventHandler, no_args_event_spec
12
- from reflex.vars.base import LiteralVar, Var
13
-
14
-
15
- class Script(Component):
16
- """Next.js script component.
17
-
18
- Note that this component differs from reflex.components.base.document.NextScript
19
- in that it is intended for use with custom and user-defined scripts.
20
-
21
- It also differs from reflex.components.base.link.ScriptTag, which is the plain
22
- HTML <script> tag which does not work when rendering a component.
23
- """
24
-
25
- library = "next/script"
26
- tag = "Script"
27
- is_default = True
5
+ from reflex.components import el as elements
6
+ from reflex.components.core.helmet import helmet
7
+ from reflex.utils import console
28
8
 
29
- # Required unless inline script is used
30
- src: Var[str]
31
9
 
32
- # When the script will execute: afterInteractive (defer-like behavior) | beforeInteractive | lazyOnload (async-like behavior)
33
- strategy: Var[Literal["afterInteractive", "beforeInteractive", "lazyOnload"]] = (
34
- LiteralVar.create("afterInteractive")
35
- )
36
-
37
- # Triggered when the script is loading
38
- on_load: EventHandler[no_args_event_spec]
39
-
40
- # Triggered when the script has loaded
41
- on_ready: EventHandler[no_args_event_spec]
42
-
43
- # Triggered when the script has errored
44
- on_error: EventHandler[no_args_event_spec]
10
+ class Script(elements.Script):
11
+ """Wrapper for the script element."""
45
12
 
46
13
  @classmethod
47
- def create(cls, *children, **props) -> Component:
48
- """Create an inline or user-defined script.
49
-
50
- If a string is provided as the first child, it will be rendered as an inline script
51
- otherwise the `src` prop must be provided.
52
-
53
- The following event triggers are provided:
54
-
55
- on_load: Execute code after the script has finished loading.
56
- on_ready: Execute code after the script has finished loading and every
57
- time the component is mounted.
58
- on_error: Execute code if the script fails to load.
14
+ def create(
15
+ cls,
16
+ *children,
17
+ **props,
18
+ ):
19
+ """Display the script element.
59
20
 
60
21
  Args:
61
- *children: The children of the component.
62
- **props: The props of the component.
22
+ *children: The children of the element.
23
+ **props: The properties of the element.
63
24
 
64
25
  Returns:
65
- The component.
26
+ The script element.
66
27
 
67
28
  Raises:
68
- ValueError: when neither children nor `src` are specified.
29
+ ValueError: If neither children nor src is specified.
69
30
  """
70
- if not children and not props.get("src"):
71
- msg = "Must provide inline script or `src` prop."
31
+ async_ = props.pop("async_", None)
32
+ char_set = props.pop("char_set", None)
33
+ cross_origin = props.pop("cross_origin", None)
34
+ defer = props.pop("defer", None)
35
+ integrity = props.pop("integrity", None)
36
+ referrer_policy = props.pop("referrer_policy", None)
37
+ src = props.pop("src", None)
38
+ type = props.pop("type", None)
39
+ key = props.pop("key", None)
40
+ id = props.pop("id", None)
41
+ class_name = props.pop("class_name", None)
42
+ autofocus = props.pop("autofocus", None)
43
+ custom_attrs = props.pop("custom_attrs", None)
44
+ on_mount = props.pop("on_mount", None)
45
+ on_unmount = props.pop("on_unmount", None)
46
+
47
+ if props:
48
+ console.warn(
49
+ f"rx.script does not support the following properties: {list(props.keys())}"
50
+ )
51
+
52
+ if not children and not src:
53
+ msg = "You must specify either children or src for the script element."
72
54
  raise ValueError(msg)
73
- return super().create(*children, **props)
55
+
56
+ return helmet(
57
+ elements.Script.create(
58
+ *children,
59
+ async_=async_,
60
+ char_set=char_set,
61
+ cross_origin=cross_origin,
62
+ defer=defer,
63
+ integrity=integrity,
64
+ referrer_policy=referrer_policy,
65
+ src=src,
66
+ type=type,
67
+ key=key,
68
+ id=id,
69
+ class_name=class_name,
70
+ autofocus=autofocus,
71
+ custom_attrs=custom_attrs,
72
+ on_mount=on_mount,
73
+ on_unmount=on_unmount,
74
+ )
75
+ )
74
76
 
75
77
 
76
78
  script = Script.create
@@ -4,23 +4,230 @@
4
4
  # This file was generated by `reflex/utils/pyi_generator.py`!
5
5
  # ------------------------------------------------------
6
6
  from collections.abc import Mapping, Sequence
7
- from typing import Any, Literal, overload
7
+ from typing import Any, Literal
8
8
 
9
- from reflex.components.component import Component
9
+ from reflex.components import el as elements
10
10
  from reflex.components.core.breakpoints import Breakpoints
11
- from reflex.event import EventType
11
+ from reflex.event import EventType, PointerEventInfo
12
12
  from reflex.vars.base import Var
13
13
 
14
- class Script(Component):
15
- @overload
14
+ class Script(elements.Script):
16
15
  @classmethod
17
- def create( # type: ignore
16
+ def create(
18
17
  cls,
19
18
  *children,
19
+ async_: Var[bool] | bool | None = None,
20
+ char_set: Var[str] | str | None = None,
21
+ cross_origin: Literal["", "anonymous", "use-credentials"]
22
+ | Var[Literal["", "anonymous", "use-credentials"]]
23
+ | None = None,
24
+ defer: Var[bool] | bool | None = None,
25
+ integrity: Var[str] | str | None = None,
26
+ referrer_policy: Literal[
27
+ "",
28
+ "no-referrer",
29
+ "no-referrer-when-downgrade",
30
+ "origin",
31
+ "origin-when-cross-origin",
32
+ "same-origin",
33
+ "strict-origin",
34
+ "strict-origin-when-cross-origin",
35
+ "unsafe-url",
36
+ ]
37
+ | Var[
38
+ Literal[
39
+ "",
40
+ "no-referrer",
41
+ "no-referrer-when-downgrade",
42
+ "origin",
43
+ "origin-when-cross-origin",
44
+ "same-origin",
45
+ "strict-origin",
46
+ "strict-origin-when-cross-origin",
47
+ "unsafe-url",
48
+ ]
49
+ ]
50
+ | None = None,
20
51
  src: Var[str] | str | None = None,
21
- strategy: Literal["afterInteractive", "beforeInteractive", "lazyOnload"]
22
- | Var[Literal["afterInteractive", "beforeInteractive", "lazyOnload"]]
52
+ type: Var[str] | str | None = None,
53
+ access_key: Var[str] | str | None = None,
54
+ auto_capitalize: Literal[
55
+ "characters", "none", "off", "on", "sentences", "words"
56
+ ]
57
+ | Var[Literal["characters", "none", "off", "on", "sentences", "words"]]
58
+ | None = None,
59
+ content_editable: Literal["inherit", "plaintext-only", False, True]
60
+ | Var[Literal["inherit", "plaintext-only", False, True]]
61
+ | None = None,
62
+ context_menu: Var[str] | str | None = None,
63
+ dir: Var[str] | str | None = None,
64
+ draggable: Var[bool] | bool | None = None,
65
+ enter_key_hint: Literal[
66
+ "done", "enter", "go", "next", "previous", "search", "send"
67
+ ]
68
+ | Var[Literal["done", "enter", "go", "next", "previous", "search", "send"]]
69
+ | None = None,
70
+ hidden: Var[bool] | bool | None = None,
71
+ input_mode: Literal[
72
+ "decimal", "email", "none", "numeric", "search", "tel", "text", "url"
73
+ ]
74
+ | Var[
75
+ Literal[
76
+ "decimal", "email", "none", "numeric", "search", "tel", "text", "url"
77
+ ]
78
+ ]
23
79
  | None = None,
80
+ item_prop: Var[str] | str | None = None,
81
+ lang: Var[str] | str | None = None,
82
+ role: Literal[
83
+ "alert",
84
+ "alertdialog",
85
+ "application",
86
+ "article",
87
+ "banner",
88
+ "button",
89
+ "cell",
90
+ "checkbox",
91
+ "columnheader",
92
+ "combobox",
93
+ "complementary",
94
+ "contentinfo",
95
+ "definition",
96
+ "dialog",
97
+ "directory",
98
+ "document",
99
+ "feed",
100
+ "figure",
101
+ "form",
102
+ "grid",
103
+ "gridcell",
104
+ "group",
105
+ "heading",
106
+ "img",
107
+ "link",
108
+ "list",
109
+ "listbox",
110
+ "listitem",
111
+ "log",
112
+ "main",
113
+ "marquee",
114
+ "math",
115
+ "menu",
116
+ "menubar",
117
+ "menuitem",
118
+ "menuitemcheckbox",
119
+ "menuitemradio",
120
+ "navigation",
121
+ "none",
122
+ "note",
123
+ "option",
124
+ "presentation",
125
+ "progressbar",
126
+ "radio",
127
+ "radiogroup",
128
+ "region",
129
+ "row",
130
+ "rowgroup",
131
+ "rowheader",
132
+ "scrollbar",
133
+ "search",
134
+ "searchbox",
135
+ "separator",
136
+ "slider",
137
+ "spinbutton",
138
+ "status",
139
+ "switch",
140
+ "tab",
141
+ "table",
142
+ "tablist",
143
+ "tabpanel",
144
+ "term",
145
+ "textbox",
146
+ "timer",
147
+ "toolbar",
148
+ "tooltip",
149
+ "tree",
150
+ "treegrid",
151
+ "treeitem",
152
+ ]
153
+ | Var[
154
+ Literal[
155
+ "alert",
156
+ "alertdialog",
157
+ "application",
158
+ "article",
159
+ "banner",
160
+ "button",
161
+ "cell",
162
+ "checkbox",
163
+ "columnheader",
164
+ "combobox",
165
+ "complementary",
166
+ "contentinfo",
167
+ "definition",
168
+ "dialog",
169
+ "directory",
170
+ "document",
171
+ "feed",
172
+ "figure",
173
+ "form",
174
+ "grid",
175
+ "gridcell",
176
+ "group",
177
+ "heading",
178
+ "img",
179
+ "link",
180
+ "list",
181
+ "listbox",
182
+ "listitem",
183
+ "log",
184
+ "main",
185
+ "marquee",
186
+ "math",
187
+ "menu",
188
+ "menubar",
189
+ "menuitem",
190
+ "menuitemcheckbox",
191
+ "menuitemradio",
192
+ "navigation",
193
+ "none",
194
+ "note",
195
+ "option",
196
+ "presentation",
197
+ "progressbar",
198
+ "radio",
199
+ "radiogroup",
200
+ "region",
201
+ "row",
202
+ "rowgroup",
203
+ "rowheader",
204
+ "scrollbar",
205
+ "search",
206
+ "searchbox",
207
+ "separator",
208
+ "slider",
209
+ "spinbutton",
210
+ "status",
211
+ "switch",
212
+ "tab",
213
+ "table",
214
+ "tablist",
215
+ "tabpanel",
216
+ "term",
217
+ "textbox",
218
+ "timer",
219
+ "toolbar",
220
+ "tooltip",
221
+ "tree",
222
+ "treegrid",
223
+ "treeitem",
224
+ ]
225
+ ]
226
+ | None = None,
227
+ slot: Var[str] | str | None = None,
228
+ spell_check: Var[bool] | bool | None = None,
229
+ tab_index: Var[int] | int | None = None,
230
+ title: Var[str] | str | None = None,
24
231
  style: Sequence[Mapping[str, Any]]
25
232
  | Mapping[str, Any]
26
233
  | Var[Mapping[str, Any]]
@@ -33,12 +240,10 @@ class Script(Component):
33
240
  autofocus: bool | None = None,
34
241
  custom_attrs: dict[str, Var | Any] | None = None,
35
242
  on_blur: EventType[()] | None = None,
36
- on_click: EventType[()] | None = None,
37
- on_context_menu: EventType[()] | None = None,
38
- on_double_click: EventType[()] | None = None,
39
- on_error: EventType[()] | None = None,
243
+ on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
244
+ on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
245
+ on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
40
246
  on_focus: EventType[()] | None = None,
41
- on_load: EventType[()] | None = None,
42
247
  on_mount: EventType[()] | None = None,
43
248
  on_mouse_down: EventType[()] | None = None,
44
249
  on_mouse_enter: EventType[()] | None = None,
@@ -47,30 +252,39 @@ class Script(Component):
47
252
  on_mouse_out: EventType[()] | None = None,
48
253
  on_mouse_over: EventType[()] | None = None,
49
254
  on_mouse_up: EventType[()] | None = None,
50
- on_ready: EventType[()] | None = None,
51
255
  on_scroll: EventType[()] | None = None,
256
+ on_scroll_end: EventType[()] | None = None,
52
257
  on_unmount: EventType[()] | None = None,
53
258
  **props,
54
259
  ) -> Script:
55
- """Create an inline or user-defined script.
56
-
57
- If a string is provided as the first child, it will be rendered as an inline script
58
- otherwise the `src` prop must be provided.
59
-
60
- The following event triggers are provided:
61
-
62
- on_load: Execute code after the script has finished loading.
63
- on_ready: Execute code after the script has finished loading and every
64
- time the component is mounted.
65
- on_error: Execute code if the script fails to load.
260
+ """Display the script element.
66
261
 
67
262
  Args:
68
- *children: The children of the component.
69
- src: Required unless inline script is used
70
- strategy: When the script will execute: afterInteractive (defer-like behavior) | beforeInteractive | lazyOnload (async-like behavior)
71
- on_load: Triggered when the script is loading
72
- on_ready: Triggered when the script has loaded
73
- on_error: Triggered when the script has errored
263
+ *children: The children of the element.
264
+ async_: Indicates that the script should be executed asynchronously
265
+ char_set: Character encoding of the external script
266
+ cross_origin: Configures the CORS requests for the script
267
+ defer: Indicates that the script should be executed after the page has finished parsing
268
+ integrity: Security feature allowing browsers to verify what they fetch
269
+ referrer_policy: Specifies which referrer information to send when fetching the script
270
+ src: URL of an external script
271
+ type: Specifies the MIME type of the script
272
+ access_key: Provides a hint for generating a keyboard shortcut for the current element.
273
+ auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
274
+ content_editable: Indicates whether the element's content is editable.
275
+ context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
276
+ dir: Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)
277
+ draggable: Defines whether the element can be dragged.
278
+ enter_key_hint: Hints what media types the media element is able to play.
279
+ hidden: Defines whether the element is hidden.
280
+ input_mode: Defines the type of the element.
281
+ item_prop: Defines the name of the element for metadata purposes.
282
+ lang: Defines the language used in the element.
283
+ role: Defines the role of the element.
284
+ slot: Assigns a slot in a shadow DOM shadow tree to an element.
285
+ spell_check: Defines whether the element may be checked for spelling errors.
286
+ tab_index: Defines the position of the current element in the tabbing order.
287
+ title: Defines a tooltip for the element.
74
288
  style: The style of the component.
75
289
  key: A unique key for the component.
76
290
  id: The id for the component.
@@ -78,13 +292,13 @@ class Script(Component):
78
292
  class_name: The class name for the component.
79
293
  autofocus: Whether the component should take the focus once the page is loaded
80
294
  custom_attrs: custom attribute
81
- **props: The props of the component.
295
+ **props: The properties of the element.
82
296
 
83
297
  Returns:
84
- The component.
298
+ The script element.
85
299
 
86
300
  Raises:
87
- ValueError: when neither children nor `src` are specified.
301
+ ValueError: If neither children nor src is specified.
88
302
  """
89
303
 
90
304
  script = Script.create
@@ -4,17 +4,16 @@
4
4
  # This file was generated by `reflex/utils/pyi_generator.py`!
5
5
  # ------------------------------------------------------
6
6
  from collections.abc import Mapping, Sequence
7
- from typing import Any, overload
7
+ from typing import Any
8
8
 
9
9
  from reflex.components.component import Component
10
10
  from reflex.components.core.breakpoints import Breakpoints
11
- from reflex.event import EventType
11
+ from reflex.event import EventType, PointerEventInfo
12
12
  from reflex.vars.base import Var
13
13
 
14
14
  class StrictMode(Component):
15
- @overload
16
15
  @classmethod
17
- def create( # type: ignore
16
+ def create(
18
17
  cls,
19
18
  *children,
20
19
  style: Sequence[Mapping[str, Any]]
@@ -29,9 +28,9 @@ class StrictMode(Component):
29
28
  autofocus: bool | None = None,
30
29
  custom_attrs: dict[str, Var | Any] | None = None,
31
30
  on_blur: EventType[()] | None = None,
32
- on_click: EventType[()] | None = None,
33
- on_context_menu: EventType[()] | None = None,
34
- on_double_click: EventType[()] | None = None,
31
+ on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
32
+ on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
33
+ on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
35
34
  on_focus: EventType[()] | None = None,
36
35
  on_mount: EventType[()] | None = None,
37
36
  on_mouse_down: EventType[()] | None = None,
@@ -42,6 +41,7 @@ class StrictMode(Component):
42
41
  on_mouse_over: EventType[()] | None = None,
43
42
  on_mouse_up: EventType[()] | None = None,
44
43
  on_scroll: EventType[()] | None = None,
44
+ on_scroll_end: EventType[()] | None = None,
45
45
  on_unmount: EventType[()] | None = None,
46
46
  **props,
47
47
  ) -> StrictMode: