reflex 0.6.5a1__py3-none-any.whl → 0.6.5a3__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.

@@ -5,6 +5,7 @@ from __future__ import annotations
5
5
  from pathlib import Path
6
6
  from typing import Any, Callable, ClassVar, Dict, List, Optional, Tuple
7
7
 
8
+ from reflex.components.base.fragment import Fragment
8
9
  from reflex.components.component import (
9
10
  Component,
10
11
  ComponentNamespace,
@@ -181,6 +182,13 @@ class UploadFilesProvider(Component):
181
182
  tag = "UploadFilesProvider"
182
183
 
183
184
 
185
+ class GhostUpload(Fragment):
186
+ """A ghost upload component."""
187
+
188
+ # Fired when files are dropped.
189
+ on_drop: EventHandler[_on_drop_spec]
190
+
191
+
184
192
  class Upload(MemoizationLeaf):
185
193
  """A file upload component."""
186
194
 
@@ -276,8 +284,8 @@ class Upload(MemoizationLeaf):
276
284
  root_props_unique_name = get_unique_variable_name()
277
285
 
278
286
  event_var, callback_str = StatefulComponent._get_memoized_event_triggers(
279
- Box.create(on_click=upload_props["on_drop"]) # type: ignore
280
- )["on_click"]
287
+ GhostUpload.create(on_drop=upload_props["on_drop"])
288
+ )["on_drop"]
281
289
 
282
290
  upload_props["on_drop"] = event_var
283
291
 
@@ -6,6 +6,7 @@
6
6
  from pathlib import Path
7
7
  from typing import Any, ClassVar, Dict, List, Optional, Union, overload
8
8
 
9
+ from reflex.components.base.fragment import Fragment
9
10
  from reflex.components.component import Component, ComponentNamespace, MemoizationLeaf
10
11
  from reflex.constants import Dirs
11
12
  from reflex.event import BASE_STATE, CallableEventSpec, EventSpec, EventType
@@ -84,6 +85,56 @@ class UploadFilesProvider(Component):
84
85
  """
85
86
  ...
86
87
 
88
+ class GhostUpload(Fragment):
89
+ @overload
90
+ @classmethod
91
+ def create( # type: ignore
92
+ cls,
93
+ *children,
94
+ style: Optional[Style] = None,
95
+ key: Optional[Any] = None,
96
+ id: Optional[Any] = None,
97
+ class_name: Optional[Any] = None,
98
+ autofocus: Optional[bool] = None,
99
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
100
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
101
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
102
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
103
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
104
+ on_drop: Optional[
105
+ Union[EventType[[], BASE_STATE], EventType[[Any], BASE_STATE]]
106
+ ] = None,
107
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
108
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
109
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
110
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
111
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
112
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
113
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
114
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
115
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
116
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
117
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
118
+ **props,
119
+ ) -> "GhostUpload":
120
+ """Create the component.
121
+
122
+ Args:
123
+ *children: The children of the component.
124
+ on_drop: Fired when files are dropped.
125
+ style: The style of the component.
126
+ key: A unique key for the component.
127
+ id: The id for the component.
128
+ class_name: The class name for the component.
129
+ autofocus: Whether the component should take the focus once the page is loaded
130
+ custom_attrs: custom attribute
131
+ **props: The props of the component.
132
+
133
+ Returns:
134
+ The component.
135
+ """
136
+ ...
137
+
87
138
  class Upload(MemoizationLeaf):
88
139
  is_used: ClassVar[bool] = False
89
140
 
reflex/state.py CHANGED
@@ -46,6 +46,7 @@ from reflex import event
46
46
  from reflex.config import get_config
47
47
  from reflex.istate.data import RouterData
48
48
  from reflex.istate.storage import ClientStorageBase
49
+ from reflex.model import Model
49
50
  from reflex.vars.base import (
50
51
  ComputedVar,
51
52
  DynamicRouteVar,
@@ -1733,15 +1734,20 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
1733
1734
  if value is None:
1734
1735
  continue
1735
1736
  hinted_args = value_inside_optional(hinted_args)
1736
- if (
1737
- isinstance(value, dict)
1738
- and inspect.isclass(hinted_args)
1739
- and (
1740
- dataclasses.is_dataclass(hinted_args)
1741
- or issubclass(hinted_args, Base)
1742
- )
1743
- ):
1744
- payload[arg] = hinted_args(**value)
1737
+ if isinstance(value, dict) and inspect.isclass(hinted_args):
1738
+ if issubclass(hinted_args, Model):
1739
+ # Remove non-fields from the payload
1740
+ payload[arg] = hinted_args(
1741
+ **{
1742
+ key: value
1743
+ for key, value in value.items()
1744
+ if key in hinted_args.__fields__
1745
+ }
1746
+ )
1747
+ elif dataclasses.is_dataclass(hinted_args) or issubclass(
1748
+ hinted_args, Base
1749
+ ):
1750
+ payload[arg] = hinted_args(**value)
1745
1751
  if isinstance(value, list) and (hinted_args is set or hinted_args is Set):
1746
1752
  payload[arg] = set(value)
1747
1753
  if isinstance(value, list) and (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: reflex
3
- Version: 0.6.5a1
3
+ Version: 0.6.5a3
4
4
  Summary: Web apps in pure Python.
5
5
  Home-page: https://reflex.dev
6
6
  License: Apache-2.0
@@ -33,7 +33,7 @@ Requires-Dist: python-multipart (>=0.0.5,<0.1)
33
33
  Requires-Dist: python-socketio (>=5.7.0,<6.0)
34
34
  Requires-Dist: redis (>=4.3.5,<6.0)
35
35
  Requires-Dist: reflex-chakra (>=0.6.0)
36
- Requires-Dist: reflex-hosting-cli (>=0.1.5,<2.0)
36
+ Requires-Dist: reflex-hosting-cli (>=0.1.15,<2.0)
37
37
  Requires-Dist: rich (>=13.0.0,<14.0)
38
38
  Requires-Dist: setuptools (>=75.0)
39
39
  Requires-Dist: sqlmodel (>=0.0.14,<0.1)
@@ -93,8 +93,8 @@ reflex/components/core/html.pyi,sha256=VPpzNa7VORqu1IDQae4NbHXsCFzo2mELV8kIdCveN
93
93
  reflex/components/core/layout/__init__.py,sha256=znldZaj_NGt8qCZDG70GMwjMTskcvCf_2N_EjCAHwdc,30
94
94
  reflex/components/core/match.py,sha256=xhzO8LHl99Gd6yoPJ-UFZsPqilHwZJ7SWJmhly5_exE,9102
95
95
  reflex/components/core/responsive.py,sha256=ACZdtJ4a4F8B3dm1k8h6J2_UJx0Z5LDB7XHQ2ty4wAc,1911
96
- reflex/components/core/upload.py,sha256=NQg4bAD7eEMEjBQdA8cowYavExSfF7gY4vCuaN3shS8,11673
97
- reflex/components/core/upload.pyi,sha256=a1gu_G01irhgaPsBMY4Z8putbH7_zqDUOz3yw3nKaWc,13936
96
+ reflex/components/core/upload.py,sha256=0tjo86GXSLdJlwyEc0LcstIlHg99k9OG_o4dQjsEhcU,11861
97
+ reflex/components/core/upload.pyi,sha256=nzfugMkqXgOhlvTMhCCQl6t36oJ-NOUuS0Xz6G6xNqo,16115
98
98
  reflex/components/datadisplay/__init__.py,sha256=L8pWWKNHWdUD2fbZRoEKjd_8c_hpDdGYO463hwkoIi4,438
99
99
  reflex/components/datadisplay/__init__.pyi,sha256=rYMwO_X4NvUex6IL2MMTnhdFRp8Lz5zweMwXaW_l7nc,588
100
100
  reflex/components/datadisplay/code.py,sha256=apunYV9nuExEzSq2yhF6D26_6lwplqrUQXOBSZ1ic1I,14117
@@ -357,7 +357,7 @@ reflex/model.py,sha256=AaCs6V9iWFj-EZI7zfXL1LTy-TrnNfJKVit2MPqLM8M,14139
357
357
  reflex/page.py,sha256=N85R5tTI-NoFd9ArwYCN8OcV9aSPZIPrJI2ZFbH8ytk,2389
358
358
  reflex/reflex.py,sha256=R8_NLSfX2IhlZlZkXvlIWMS9FUGNqzOHB2NcP-GYSMY,22705
359
359
  reflex/route.py,sha256=WZS7stKgO94nekFFYHaOqNgN3zZGpJb3YpGF4ViTHmw,4198
360
- reflex/state.py,sha256=SkLd68t6lH64-gkekc4Jl7bw9kdUpK6rKB9_23M_ZEY,131617
360
+ reflex/state.py,sha256=qangQJoffJ_EZWjKOoMkmyklzh9vC9u7P9NxnW5poxo,131976
361
361
  reflex/style.py,sha256=-mBrpaq23jiNJIwgCir6Fzj182u9rGpp3qZ2cUt5aZs,12695
362
362
  reflex/testing.py,sha256=qkLVNeLcD3uxTg95WuV1IYoEhkmEdJ7o8Fbc8NaeoRQ,34792
363
363
  reflex/utils/__init__.py,sha256=y-AHKiRQAhk2oAkvn7W8cRVTZVK625ff8tTwvZtO7S4,24
@@ -387,8 +387,8 @@ reflex/vars/function.py,sha256=1E-yBhP3sOTVmVotSA6S8PY2c63yl0DJvr0oZh7j2bg,6854
387
387
  reflex/vars/number.py,sha256=BeHQr4Cj2gdXekEWcxSzLTIuRAC3sf6YvsdHlADETpQ,27499
388
388
  reflex/vars/object.py,sha256=dTfkkUGDmoxu7iPcKSnNJ-lTI48yoXbagUyA-lKwDDo,14335
389
389
  reflex/vars/sequence.py,sha256=mlmOkSV8FIxwdJHzQdu3NzHAoNB4KcGc93dcmdviIoo,49916
390
- reflex-0.6.5a1.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
391
- reflex-0.6.5a1.dist-info/METADATA,sha256=gccguwJAix5W7cgsUi8HVPL0oSoFcX7FOM5fal6ptwE,12057
392
- reflex-0.6.5a1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
393
- reflex-0.6.5a1.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
394
- reflex-0.6.5a1.dist-info/RECORD,,
390
+ reflex-0.6.5a3.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
391
+ reflex-0.6.5a3.dist-info/METADATA,sha256=3MZwzF3zH_gEsLGZ9pQxPaZv9wQaxVMO367XA_5XLLs,12058
392
+ reflex-0.6.5a3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
393
+ reflex-0.6.5a3.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
394
+ reflex-0.6.5a3.dist-info/RECORD,,