flet 0.70.0.dev5774__py3-none-any.whl → 0.70.0.dev5835__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 flet might be problematic. Click here for more details.

Files changed (96) hide show
  1. flet/__init__.py +32 -4
  2. flet/components/__init__.py +0 -0
  3. flet/components/component.py +346 -0
  4. flet/components/component_decorator.py +24 -0
  5. flet/components/component_owned.py +22 -0
  6. flet/components/hooks/__init__.py +0 -0
  7. flet/components/hooks/hook.py +12 -0
  8. flet/components/hooks/use_callback.py +28 -0
  9. flet/components/hooks/use_context.py +91 -0
  10. flet/components/hooks/use_effect.py +104 -0
  11. flet/components/hooks/use_memo.py +52 -0
  12. flet/components/hooks/use_state.py +58 -0
  13. flet/components/memo.py +34 -0
  14. flet/components/observable.py +269 -0
  15. flet/components/public_utils.py +10 -0
  16. flet/components/utils.py +85 -0
  17. flet/controls/base_control.py +34 -10
  18. flet/controls/base_page.py +44 -40
  19. flet/controls/context.py +22 -1
  20. flet/controls/control.py +12 -6
  21. flet/controls/control_event.py +19 -2
  22. flet/controls/core/animated_switcher.py +3 -2
  23. flet/controls/core/autofill_group.py +6 -2
  24. flet/controls/core/column.py +5 -0
  25. flet/controls/core/dismissible.py +12 -10
  26. flet/controls/core/drag_target.py +20 -10
  27. flet/controls/core/draggable.py +9 -9
  28. flet/controls/core/icon.py +16 -12
  29. flet/controls/core/interactive_viewer.py +24 -23
  30. flet/controls/core/pagelet.py +3 -2
  31. flet/controls/core/reorderable_draggable.py +3 -2
  32. flet/controls/core/row.py +5 -0
  33. flet/controls/core/safe_area.py +3 -2
  34. flet/controls/core/text_span.py +5 -3
  35. flet/controls/core/view.py +6 -6
  36. flet/controls/core/window_drag_area.py +3 -2
  37. flet/controls/cupertino/cupertino_action_sheet.py +10 -5
  38. flet/controls/cupertino/cupertino_action_sheet_action.py +3 -4
  39. flet/controls/cupertino/cupertino_activity_indicator.py +4 -3
  40. flet/controls/cupertino/cupertino_alert_dialog.py +6 -3
  41. flet/controls/cupertino/cupertino_button.py +6 -5
  42. flet/controls/cupertino/cupertino_context_menu.py +8 -4
  43. flet/controls/cupertino/cupertino_context_menu_action.py +3 -4
  44. flet/controls/cupertino/cupertino_date_picker.py +44 -28
  45. flet/controls/cupertino/cupertino_dialog_action.py +3 -4
  46. flet/controls/cupertino/cupertino_list_tile.py +3 -4
  47. flet/controls/cupertino/cupertino_navigation_bar.py +6 -5
  48. flet/controls/cupertino/cupertino_picker.py +14 -10
  49. flet/controls/cupertino/cupertino_segmented_button.py +6 -5
  50. flet/controls/cupertino/cupertino_slider.py +16 -12
  51. flet/controls/cupertino/cupertino_sliding_segmented_button.py +6 -5
  52. flet/controls/cupertino/cupertino_timer_picker.py +38 -31
  53. flet/controls/id_counter.py +24 -0
  54. flet/controls/material/alert_dialog.py +6 -5
  55. flet/controls/material/app_bar.py +17 -14
  56. flet/controls/material/banner.py +13 -11
  57. flet/controls/material/bottom_app_bar.py +5 -4
  58. flet/controls/material/bottom_sheet.py +5 -4
  59. flet/controls/material/button.py +12 -4
  60. flet/controls/material/chip.py +13 -12
  61. flet/controls/material/circle_avatar.py +17 -13
  62. flet/controls/material/datatable.py +48 -41
  63. flet/controls/material/divider.py +30 -14
  64. flet/controls/material/dropdown.py +5 -3
  65. flet/controls/material/expansion_tile.py +11 -22
  66. flet/controls/material/floating_action_button.py +32 -23
  67. flet/controls/material/icon_button.py +7 -3
  68. flet/controls/material/navigation_rail.py +14 -11
  69. flet/controls/material/outlined_button.py +7 -3
  70. flet/controls/material/progress_bar.py +18 -10
  71. flet/controls/material/radio_group.py +5 -1
  72. flet/controls/material/range_slider.py +13 -13
  73. flet/controls/material/segmented_button.py +21 -17
  74. flet/controls/material/selection_area.py +3 -2
  75. flet/controls/material/slider.py +16 -12
  76. flet/controls/material/snack_bar.py +18 -10
  77. flet/controls/material/switch.py +6 -5
  78. flet/controls/material/tabs.py +18 -14
  79. flet/controls/material/textfield.py +32 -15
  80. flet/controls/material/vertical_divider.py +20 -12
  81. flet/controls/object_patch.py +434 -197
  82. flet/controls/page.py +205 -85
  83. flet/controls/services/haptic_feedback.py +0 -3
  84. flet/controls/services/shake_detector.py +0 -3
  85. flet/messaging/flet_socket_server.py +13 -6
  86. flet/messaging/session.py +103 -10
  87. flet/{controls/session_storage.py → messaging/session_store.py} +2 -2
  88. flet/version.py +1 -1
  89. {flet-0.70.0.dev5774.dist-info → flet-0.70.0.dev5835.dist-info}/METADATA +5 -5
  90. {flet-0.70.0.dev5774.dist-info → flet-0.70.0.dev5835.dist-info}/RECORD +93 -80
  91. flet/controls/cache.py +0 -87
  92. flet/controls/control_id.py +0 -22
  93. flet/controls/core/state_view.py +0 -60
  94. {flet-0.70.0.dev5774.dist-info → flet-0.70.0.dev5835.dist-info}/WHEEL +0 -0
  95. {flet-0.70.0.dev5774.dist-info → flet-0.70.0.dev5835.dist-info}/entry_points.txt +0 -0
  96. {flet-0.70.0.dev5774.dist-info → flet-0.70.0.dev5835.dist-info}/top_level.txt +0 -0
@@ -1,22 +0,0 @@
1
- import itertools
2
- import threading
3
-
4
- from flet.utils.locks import NopeLock
5
- from flet.utils.platform_utils import is_pyodide
6
-
7
-
8
- class ControlId:
9
- """
10
- Generates unique, auto-incrementing integers safely across
11
- multiple threads and asyncio tasks using itertools.count.
12
- """
13
-
14
- _counter_iterator = itertools.count(3) # Creates an iterator starting at 3
15
- _lock = threading.Lock() if not is_pyodide() else NopeLock()
16
-
17
- @classmethod
18
- def next(cls) -> int:
19
- """Returns the next unique integer identifier."""
20
- with cls._lock:
21
- # next() on the iterator is atomic *relative to the lock*
22
- return next(cls._counter_iterator)
@@ -1,60 +0,0 @@
1
- import weakref
2
- from dataclasses import InitVar
3
- from typing import Any, Callable, ClassVar, Generic, Optional, TypeVar
4
-
5
- from flet.controls.base_control import control
6
- from flet.controls.control import Control
7
- from flet.controls.ref import Ref
8
-
9
- __all__ = ["StateView"]
10
-
11
- T = TypeVar("T")
12
-
13
-
14
- @control("StateView", post_init_args=4)
15
- class StateView(Control, Generic[T]):
16
- """
17
- Builds control tree on every update based on data.
18
- """
19
-
20
- state: InitVar[T]
21
- builder: InitVar[Callable[[T], Control]]
22
- state_key: InitVar[Optional[Callable[[T], Any]]] = None
23
- content: Optional[Control] = None
24
-
25
- # Cache: (control_id, state_id) -> control
26
- _builder_cache: ClassVar[weakref.WeakValueDictionary[tuple[int, Any], Control]] = (
27
- weakref.WeakValueDictionary()
28
- )
29
-
30
- def __post_init__(
31
- self,
32
- ref: Optional[Ref[Any]],
33
- state: T,
34
- builder: Callable[[T], Control],
35
- state_key: Optional[Callable[[T], Any]] = None,
36
- ):
37
- Control.__post_init__(self, ref)
38
- self._state: T = state
39
- self._builder = builder
40
- self._state_key = state_key
41
-
42
- def before_update(self):
43
- # print(f"StateView({self._i}).before_update")
44
- frozen = getattr(self, "_frozen", None)
45
- if frozen:
46
- del self._frozen
47
-
48
- cache_key = (self._i, self._state_key(self._state)) if self._state_key else None
49
-
50
- if cache_key is not None and cache_key in self._builder_cache:
51
- self.content = self._builder_cache[cache_key]
52
- else:
53
- self.content = self._builder(self._state)
54
- if cache_key is not None and self.content:
55
- self._builder_cache[cache_key] = self.content
56
-
57
- if self.content:
58
- object.__setattr__(self.content, "_frozen", True)
59
- if frozen:
60
- self._frozen = frozen