reflex 0.7.14a6__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 (237) 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 +86 -135
  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.14a6.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/experimental/layout.pyi +0 -814
  234. reflex-0.7.14a6.dist-info/RECORD +0 -408
  235. {reflex-0.7.14a6.dist-info → reflex-0.8.0.dist-info}/WHEEL +0 -0
  236. {reflex-0.7.14a6.dist-info → reflex-0.8.0.dist-info}/entry_points.txt +0 -0
  237. {reflex-0.7.14a6.dist-info → reflex-0.8.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,269 +0,0 @@
1
- """A Rich Text Editor based on SunEditor."""
2
-
3
- from __future__ import annotations
4
-
5
- import enum
6
- from typing import Any, Literal
7
-
8
- from reflex.base import Base
9
- from reflex.components.component import Component, NoSSRComponent
10
- from reflex.event import EventHandler, no_args_event_spec, passthrough_event_spec
11
- from reflex.utils.format import to_camel_case
12
- from reflex.utils.imports import ImportDict, ImportVar
13
- from reflex.vars.base import Var
14
-
15
-
16
- class EditorButtonList(list, enum.Enum):
17
- """List enum that provides three predefined button lists."""
18
-
19
- BASIC = [
20
- ["font", "fontSize"],
21
- ["fontColor"],
22
- ["horizontalRule"],
23
- ["link", "image"],
24
- ]
25
- FORMATTING = [
26
- ["undo", "redo"],
27
- ["bold", "underline", "italic", "strike", "subscript", "superscript"],
28
- ["removeFormat"],
29
- ["outdent", "indent"],
30
- ["fullScreen", "showBlocks", "codeView"],
31
- ["preview", "print"],
32
- ]
33
- COMPLEX = [
34
- ["undo", "redo"],
35
- ["font", "fontSize", "formatBlock"],
36
- ["bold", "underline", "italic", "strike", "subscript", "superscript"],
37
- ["removeFormat"],
38
- "/",
39
- ["fontColor", "hiliteColor"],
40
- ["outdent", "indent"],
41
- ["align", "horizontalRule", "list", "table"],
42
- ["link", "image", "video"],
43
- ["fullScreen", "showBlocks", "codeView"],
44
- ["preview", "print"],
45
- ["save", "template"],
46
- ]
47
-
48
-
49
- class EditorOptions(Base):
50
- """Some of the additional options to configure the Editor.
51
- Complete list of options found here:
52
- https://github.com/JiHong88/SunEditor/blob/master/README.md#options.
53
- """
54
-
55
- # Specifies default tag name of the editor.
56
- # default: 'p' {String}
57
- default_tag: str | None = None
58
-
59
- # The mode of the editor ('classic', 'inline', 'balloon', 'balloon-always').
60
- # default: 'classic' {String}
61
- mode: str | None = None
62
-
63
- # If true, the editor is set to RTL(Right To Left) mode.
64
- # default: false {Boolean}
65
- rtl: bool | None = None
66
-
67
- # List of buttons to use in the toolbar.
68
- button_list: list[list[str] | str] | None
69
-
70
-
71
- def on_blur_spec(e: Var, content: Var[str]) -> tuple[Var[str]]:
72
- """A helper function to specify the on_blur event handler.
73
-
74
- Args:
75
- e: The event.
76
- content: The content of the editor.
77
-
78
- Returns:
79
- A tuple containing the content of the editor.
80
- """
81
- return (content,)
82
-
83
-
84
- def on_paste_spec(
85
- e: Var, clean_data: Var[str], max_char_count: Var[bool]
86
- ) -> tuple[Var[str], Var[bool]]:
87
- """A helper function to specify the on_paste event handler.
88
-
89
- Args:
90
- e: The event.
91
- clean_data: The clean data.
92
- max_char_count: The maximum character count.
93
-
94
- Returns:
95
- A tuple containing the clean data and the maximum character count.
96
- """
97
- return (clean_data, max_char_count)
98
-
99
-
100
- class Editor(NoSSRComponent):
101
- """A Rich Text Editor component based on SunEditor.
102
- Not every JS prop is listed here (some are not easily usable from python),
103
- refer to the library docs for a complete list.
104
- """
105
-
106
- library = "suneditor-react@3.6.1"
107
-
108
- tag = "SunEditor"
109
-
110
- is_default = True
111
-
112
- lib_dependencies: list[str] = ["suneditor"]
113
-
114
- # Language of the editor.
115
- # Alternatively to a string, a dict of your language can be passed to this prop.
116
- # Please refer to the library docs for this.
117
- # options: "en" | "da" | "de" | "es" | "fr" | "ja" | "ko" | "pt_br" |
118
- # "ru" | "zh_cn" | "ro" | "pl" | "ckb" | "lv" | "se" | "ua" | "he" | "it"
119
- # default: "en".
120
- lang: Var[
121
- Literal[
122
- "en",
123
- "da",
124
- "de",
125
- "es",
126
- "fr",
127
- "ja",
128
- "ko",
129
- "pt_br",
130
- "ru",
131
- "zh_cn",
132
- "ro",
133
- "pl",
134
- "ckb",
135
- "lv",
136
- "se",
137
- "ua",
138
- "he",
139
- "it",
140
- ]
141
- | dict
142
- ]
143
-
144
- # This is used to set the HTML form name of the editor.
145
- # This means on HTML form submission,
146
- # it will be submitted together with contents of the editor by the name provided.
147
- name: Var[str]
148
-
149
- # Sets the default value of the editor.
150
- # This is useful if you don't want the on_change method to be called on render.
151
- # If you want the on_change method to be called on render please use the set_contents prop
152
- default_value: Var[str]
153
-
154
- # Sets the width of the editor.
155
- # px and percentage values are accepted, eg width="100%" or width="500px"
156
- # default: 100%
157
- width: Var[str]
158
-
159
- # Sets the height of the editor.
160
- # px and percentage values are accepted, eg height="100%" or height="100px"
161
- height: Var[str]
162
-
163
- # Sets the placeholder of the editor.
164
- placeholder: Var[str]
165
-
166
- # Should the editor receive focus when initialized?
167
- auto_focus: Var[bool]
168
-
169
- # Pass an EditorOptions instance to modify the behaviour of Editor even more.
170
- set_options: Var[dict]
171
-
172
- # Whether all SunEditor plugins should be loaded.
173
- # default: True.
174
- set_all_plugins: Var[bool]
175
-
176
- # Set the content of the editor.
177
- # Note: To set the initial contents of the editor
178
- # without calling the on_change event,
179
- # please use the default_value prop.
180
- # set_contents is used to set the contents of the editor programmatically.
181
- # You must be aware that, when the set_contents's prop changes,
182
- # the on_change event is triggered.
183
- set_contents: Var[str]
184
-
185
- # Append editor content
186
- append_contents: Var[str]
187
-
188
- # Sets the default style of the editor's edit area
189
- set_default_style: Var[str]
190
-
191
- # Disable the editor
192
- # default: False.
193
- disable: Var[bool]
194
-
195
- # Hide the editor
196
- # default: False.
197
- hide: Var[bool]
198
-
199
- # Hide the editor toolbar
200
- # default: False.
201
- hide_toolbar: Var[bool]
202
-
203
- # Disable the editor toolbar
204
- # default: False.
205
- disable_toolbar: Var[bool]
206
-
207
- # Fired when the editor content changes.
208
- on_change: EventHandler[passthrough_event_spec(str)]
209
-
210
- # Fired when the something is inputted in the editor.
211
- on_input: EventHandler[no_args_event_spec]
212
-
213
- # Fired when the editor loses focus.
214
- on_blur: EventHandler[on_blur_spec]
215
-
216
- # Fired when the editor is loaded.
217
- on_load: EventHandler[passthrough_event_spec(bool)]
218
-
219
- # Fired when the editor content is copied.
220
- on_copy: EventHandler[no_args_event_spec]
221
-
222
- # Fired when the editor content is cut.
223
- on_cut: EventHandler[no_args_event_spec]
224
-
225
- # Fired when the editor content is pasted.
226
- on_paste: EventHandler[on_paste_spec]
227
-
228
- # Fired when the code view is toggled.
229
- toggle_code_view: EventHandler[passthrough_event_spec(bool)]
230
-
231
- # Fired when the full screen mode is toggled.
232
- toggle_full_screen: EventHandler[passthrough_event_spec(bool)]
233
-
234
- def add_imports(self) -> ImportDict:
235
- """Add imports for the Editor component.
236
-
237
- Returns:
238
- The import dict.
239
- """
240
- return {
241
- "": ImportVar(tag="suneditor/dist/css/suneditor.min.css", install=False)
242
- }
243
-
244
- @classmethod
245
- def create(
246
- cls, set_options: EditorOptions | None = None, **props: Any
247
- ) -> Component:
248
- """Create an instance of Editor. No children allowed.
249
-
250
- Args:
251
- set_options: Configuration object to further configure the instance.
252
- **props: Any properties to be passed to the Editor
253
-
254
- Returns:
255
- An Editor instance.
256
-
257
- Raises:
258
- ValueError: If set_options is a state Var.
259
- """
260
- if set_options is not None:
261
- if isinstance(set_options, Var):
262
- msg = "EditorOptions cannot be a state Var"
263
- raise ValueError(msg)
264
- props["set_options"] = {
265
- to_camel_case(k): v
266
- for k, v in set_options.dict().items()
267
- if v is not None
268
- }
269
- return super().create(*[], **props)
@@ -1,199 +0,0 @@
1
- """Stub file for reflex/components/suneditor/editor.py"""
2
-
3
- # ------------------- DO NOT EDIT ----------------------
4
- # This file was generated by `reflex/utils/pyi_generator.py`!
5
- # ------------------------------------------------------
6
- import enum
7
- from collections.abc import Mapping, Sequence
8
- from typing import Any, Literal, overload
9
-
10
- from reflex.base import Base
11
- from reflex.components.component import NoSSRComponent
12
- from reflex.components.core.breakpoints import Breakpoints
13
- from reflex.event import EventType
14
- from reflex.utils.imports import ImportDict
15
- from reflex.vars.base import Var
16
-
17
- class EditorButtonList(list, enum.Enum):
18
- BASIC = [["font", "fontSize"], ["fontColor"], ["horizontalRule"], ["link", "image"]]
19
- FORMATTING = [
20
- ["undo", "redo"],
21
- ["bold", "underline", "italic", "strike", "subscript", "superscript"],
22
- ["removeFormat"],
23
- ["outdent", "indent"],
24
- ["fullScreen", "showBlocks", "codeView"],
25
- ["preview", "print"],
26
- ]
27
- COMPLEX = [
28
- ["undo", "redo"],
29
- ["font", "fontSize", "formatBlock"],
30
- ["bold", "underline", "italic", "strike", "subscript", "superscript"],
31
- ["removeFormat"],
32
- "/",
33
- ["fontColor", "hiliteColor"],
34
- ["outdent", "indent"],
35
- ["align", "horizontalRule", "list", "table"],
36
- ["link", "image", "video"],
37
- ["fullScreen", "showBlocks", "codeView"],
38
- ["preview", "print"],
39
- ["save", "template"],
40
- ]
41
-
42
- class EditorOptions(Base):
43
- default_tag: str | None
44
- mode: str | None
45
- rtl: bool | None
46
- button_list: list[list[str] | str] | None
47
-
48
- def on_blur_spec(e: Var, content: Var[str]) -> tuple[Var[str]]: ...
49
- def on_paste_spec(
50
- e: Var, clean_data: Var[str], max_char_count: Var[bool]
51
- ) -> tuple[Var[str], Var[bool]]: ...
52
-
53
- class Editor(NoSSRComponent):
54
- def add_imports(self) -> ImportDict: ...
55
- @overload
56
- @classmethod
57
- def create( # type: ignore
58
- cls,
59
- *children,
60
- lang: Literal[
61
- "ckb",
62
- "da",
63
- "de",
64
- "en",
65
- "es",
66
- "fr",
67
- "he",
68
- "it",
69
- "ja",
70
- "ko",
71
- "lv",
72
- "pl",
73
- "pt_br",
74
- "ro",
75
- "ru",
76
- "se",
77
- "ua",
78
- "zh_cn",
79
- ]
80
- | Var[
81
- Literal[
82
- "ckb",
83
- "da",
84
- "de",
85
- "en",
86
- "es",
87
- "fr",
88
- "he",
89
- "it",
90
- "ja",
91
- "ko",
92
- "lv",
93
- "pl",
94
- "pt_br",
95
- "ro",
96
- "ru",
97
- "se",
98
- "ua",
99
- "zh_cn",
100
- ]
101
- | dict
102
- ]
103
- | dict
104
- | None = None,
105
- name: Var[str] | str | None = None,
106
- default_value: Var[str] | str | None = None,
107
- width: Var[str] | str | None = None,
108
- height: Var[str] | str | None = None,
109
- placeholder: Var[str] | str | None = None,
110
- auto_focus: Var[bool] | bool | None = None,
111
- set_options: Var[dict] | dict | None = None,
112
- set_all_plugins: Var[bool] | bool | None = None,
113
- set_contents: Var[str] | str | None = None,
114
- append_contents: Var[str] | str | None = None,
115
- set_default_style: Var[str] | str | None = None,
116
- disable: Var[bool] | bool | None = None,
117
- hide: Var[bool] | bool | None = None,
118
- hide_toolbar: Var[bool] | bool | None = None,
119
- disable_toolbar: Var[bool] | bool | None = None,
120
- style: Sequence[Mapping[str, Any]]
121
- | Mapping[str, Any]
122
- | Var[Mapping[str, Any]]
123
- | Breakpoints
124
- | None = None,
125
- key: Any | None = None,
126
- id: Any | None = None,
127
- ref: Var | None = None,
128
- class_name: Any | None = None,
129
- autofocus: bool | None = None,
130
- custom_attrs: dict[str, Var | Any] | None = None,
131
- on_blur: EventType[()] | EventType[str] | None = None,
132
- on_change: EventType[()] | EventType[str] | None = None,
133
- on_click: EventType[()] | None = None,
134
- on_context_menu: EventType[()] | None = None,
135
- on_copy: EventType[()] | None = None,
136
- on_cut: EventType[()] | None = None,
137
- on_double_click: EventType[()] | None = None,
138
- on_focus: EventType[()] | None = None,
139
- on_input: EventType[()] | None = None,
140
- on_load: EventType[()] | EventType[bool] | None = None,
141
- on_mount: EventType[()] | None = None,
142
- on_mouse_down: EventType[()] | None = None,
143
- on_mouse_enter: EventType[()] | None = None,
144
- on_mouse_leave: EventType[()] | None = None,
145
- on_mouse_move: EventType[()] | None = None,
146
- on_mouse_out: EventType[()] | None = None,
147
- on_mouse_over: EventType[()] | None = None,
148
- on_mouse_up: EventType[()] | None = None,
149
- on_paste: EventType[()] | EventType[str] | EventType[str, bool] | None = None,
150
- on_scroll: EventType[()] | None = None,
151
- on_unmount: EventType[()] | None = None,
152
- toggle_code_view: EventType[()] | EventType[bool] | None = None,
153
- toggle_full_screen: EventType[()] | EventType[bool] | None = None,
154
- **props,
155
- ) -> Editor:
156
- """Create an instance of Editor. No children allowed.
157
-
158
- Args:
159
- set_options: Configuration object to further configure the instance.
160
- lang: Language of the editor. Alternatively to a string, a dict of your language can be passed to this prop. Please refer to the library docs for this. options: "en" | "da" | "de" | "es" | "fr" | "ja" | "ko" | "pt_br" | "ru" | "zh_cn" | "ro" | "pl" | "ckb" | "lv" | "se" | "ua" | "he" | "it" default: "en".
161
- name: This is used to set the HTML form name of the editor. This means on HTML form submission, it will be submitted together with contents of the editor by the name provided.
162
- default_value: Sets the default value of the editor. This is useful if you don't want the on_change method to be called on render. If you want the on_change method to be called on render please use the set_contents prop
163
- width: Sets the width of the editor. px and percentage values are accepted, eg width="100%" or width="500px" default: 100%
164
- height: Sets the height of the editor. px and percentage values are accepted, eg height="100%" or height="100px"
165
- placeholder: Sets the placeholder of the editor.
166
- auto_focus: Should the editor receive focus when initialized?
167
- set_options: Pass an EditorOptions instance to modify the behaviour of Editor even more.
168
- set_all_plugins: Whether all SunEditor plugins should be loaded. default: True.
169
- set_contents: Set the content of the editor. Note: To set the initial contents of the editor without calling the on_change event, please use the default_value prop. set_contents is used to set the contents of the editor programmatically. You must be aware that, when the set_contents's prop changes, the on_change event is triggered.
170
- append_contents: Append editor content
171
- set_default_style: Sets the default style of the editor's edit area
172
- disable: Disable the editor default: False.
173
- hide: Hide the editor default: False.
174
- hide_toolbar: Hide the editor toolbar default: False.
175
- disable_toolbar: Disable the editor toolbar default: False.
176
- on_change: Fired when the editor content changes.
177
- on_input: Fired when the something is inputted in the editor.
178
- on_blur: Fired when the editor loses focus.
179
- on_load: Fired when the editor is loaded.
180
- on_copy: Fired when the editor content is copied.
181
- on_cut: Fired when the editor content is cut.
182
- on_paste: Fired when the editor content is pasted.
183
- toggle_code_view: Fired when the code view is toggled.
184
- toggle_full_screen: Fired when the full screen mode is toggled.
185
- style: The style of the component.
186
- key: A unique key for the component.
187
- id: The id for the component.
188
- ref: The Var to pass as the ref to the component.
189
- class_name: The class name for the component.
190
- autofocus: Whether the component should take the focus once the page is loaded
191
- custom_attrs: custom attribute
192
- **props: Any properties to be passed to the Editor
193
-
194
- Returns:
195
- An Editor instance.
196
-
197
- Raises:
198
- ValueError: If set_options is a state Var.
199
- """