ex4nicegui 0.6.8__py3-none-any.whl → 0.6.9__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.
@@ -7,9 +7,10 @@ from ex4nicegui.utils.signals import (
7
7
  )
8
8
  from nicegui import ui
9
9
  from .base import BindableUi
10
+ from ex4nicegui.reactive.mixins.textColor import HtmlTextColorableMixin
10
11
 
11
12
 
12
- class LabelBindableUi(BindableUi[ui.label]):
13
+ class LabelBindableUi(BindableUi[ui.label], HtmlTextColorableMixin):
13
14
  def __init__(
14
15
  self,
15
16
  text: TMaybeRef[Any] = "",
@@ -35,14 +36,6 @@ class LabelBindableUi(BindableUi[ui.label]):
35
36
 
36
37
  return super().bind_prop(prop, ref_ui)
37
38
 
38
- def bind_color(self, ref_ui: TGetterOrReadonlyRef):
39
- @self._ui_effect
40
- def _():
41
- ele = self.element
42
- color = to_value(ref_ui)
43
- ele._style["color"] = color
44
- ele.update()
45
-
46
39
  def bind_text(self, ref_ui: TGetterOrReadonlyRef):
47
40
  @self._ui_effect
48
41
  def _():
@@ -10,10 +10,10 @@ from ex4nicegui.utils.signals import (
10
10
  from nicegui import ui
11
11
 
12
12
  from .base import BindableUi
13
- from ex4nicegui.reactive.services import color_service
13
+ from ex4nicegui.reactive.mixins.textColor import TextColorableMixin
14
14
 
15
15
 
16
- class LinearProgressBindableUi(BindableUi[ui.linear_progress]):
16
+ class LinearProgressBindableUi(BindableUi[ui.linear_progress], TextColorableMixin):
17
17
  def __init__(
18
18
  self,
19
19
  value: TMaybeRef[float] = 0.0,
@@ -55,9 +55,6 @@ class LinearProgressBindableUi(BindableUi[ui.linear_progress]):
55
55
 
56
56
  return super().bind_prop(prop, ref_ui)
57
57
 
58
- def bind_color(self, ref_ui: TGetterOrReadonlyRef):
59
- return color_service.bind_color(self, ref_ui)
60
-
61
58
  def bind_value(self, ref_ui: TGetterOrReadonlyRef):
62
59
  @self._ui_effect
63
60
  def _():
@@ -30,7 +30,7 @@ class SliderBindableUi(
30
30
  min: TMaybeRef[_TSliderValue],
31
31
  max: TMaybeRef[_TSliderValue],
32
32
  step: TMaybeRef[_TSliderValue] = 1.0,
33
- value: TMaybeRef[_TSliderValue] = None,
33
+ value: Optional[TMaybeRef[_TSliderValue]] = None,
34
34
  on_change: Optional[Callable[..., Any]] = None,
35
35
  ) -> None:
36
36
  pc = ParameterClassifier(
@@ -1,11 +1,14 @@
1
- from typing import Any, Callable, Optional
1
+ import inspect
2
+ from typing import Any, Awaitable, Callable, Optional, Union
3
+ from weakref import WeakValueDictionary
2
4
  from ex4nicegui.reactive.services.reactive_service import ParameterClassifier
3
5
  from ex4nicegui.utils.signals import (
4
6
  TGetterOrReadonlyRef,
5
7
  to_value,
6
8
  _TMaybeRef as TMaybeRef,
7
9
  )
8
- from nicegui import ui
10
+ from ex4nicegui.utils.scheduler import next_tick
11
+ from nicegui import ui, background_tasks, core
9
12
  from .base import BindableUi
10
13
 
11
14
 
@@ -56,3 +59,106 @@ class TabPanelsBindableUi(BindableUi[ui.tab_panels]):
56
59
  @self._ui_effect
57
60
  def _():
58
61
  self.element.set_value(to_value(ref_ui))
62
+
63
+
64
+ class lazy_tab_panel(ui.tab_panel):
65
+ def __init__(self, name: str) -> None:
66
+ super().__init__(name)
67
+ self._build_fn = None
68
+
69
+ def try_run_build_fn(self):
70
+ if self._build_fn:
71
+ _helper.run_build_fn(self, self._props["name"])
72
+ self._build_fn = None
73
+
74
+ def build_fn(self, fn: Callable[..., Union[None, Awaitable]]):
75
+ self._build_fn = fn
76
+ return fn
77
+
78
+
79
+ class LazyTabPanelsBindableUi(TabPanelsBindableUi):
80
+ def __init__(
81
+ self,
82
+ value: Optional[TMaybeRef[str]] = None,
83
+ *,
84
+ on_change: Optional[Callable[..., Any]] = None,
85
+ animated: TMaybeRef[bool] = True,
86
+ keep_alive: TMaybeRef[bool] = True,
87
+ ) -> None:
88
+ """Lazy Tab Panels
89
+
90
+ @see - https://github.com/CrystalWindSnake/ex4nicegui/blob/main/README.en.md#lazy_tab_panels
91
+ @中文文档 - https://gitee.com/carson_add/ex4nicegui/tree/main/#lazy_tab_panels
92
+
93
+ Args:
94
+ value (Optional[TMaybeRef[str]], optional): The value of the tab panel. Defaults to None.
95
+ on_change (Optional[Callable[..., Any]], optional): The callback function when the value of the tab panel changes. Defaults to None.
96
+ animated (TMaybeRef[bool], optional): Whether to animate the tab panel. Defaults to True.
97
+ keep_alive (TMaybeRef[bool], optional): Whether to keep the tab panel alive. Defaults to True.
98
+ """
99
+ super().__init__(
100
+ value, on_change=on_change, animated=animated, keep_alive=keep_alive
101
+ )
102
+
103
+ self.__panels: WeakValueDictionary[str, lazy_tab_panel] = WeakValueDictionary()
104
+
105
+ if value:
106
+
107
+ @self._ui_effect
108
+ def _():
109
+ current_value = to_value(value)
110
+ if current_value in self.__panels:
111
+ panel = self.__panels[current_value]
112
+
113
+ @next_tick
114
+ def _():
115
+ panel.try_run_build_fn()
116
+
117
+ def add_tab_panel(self, name: str):
118
+ def decorator(fn: Callable[..., Union[None, Awaitable]]):
119
+ with self:
120
+ panel = lazy_tab_panel(name)
121
+ str_name = panel._props["name"]
122
+ self.__panels[str_name] = panel
123
+ panel.build_fn(fn)
124
+
125
+ if self.value == name:
126
+ panel.try_run_build_fn()
127
+
128
+ return panel
129
+
130
+ return decorator
131
+
132
+
133
+ class _helper:
134
+ @staticmethod
135
+ def run_build_fn(panel: lazy_tab_panel, name: str) -> None:
136
+ """ """
137
+ fn = panel._build_fn
138
+ if fn is None:
139
+ return
140
+ try:
141
+ expects_arguments = any(
142
+ p.default is inspect.Parameter.empty
143
+ and p.kind is not inspect.Parameter.VAR_POSITIONAL
144
+ and p.kind is not inspect.Parameter.VAR_KEYWORD
145
+ for p in inspect.signature(fn).parameters.values()
146
+ )
147
+
148
+ with panel:
149
+ result = fn(name) if expects_arguments else fn()
150
+ if isinstance(result, Awaitable):
151
+ # NOTE: await an awaitable result even if the handler is not a coroutine (like a lambda statement)
152
+ async def wait_for_result():
153
+ with panel:
154
+ try:
155
+ await result
156
+ except Exception as e:
157
+ core.app.handle_exception(e)
158
+
159
+ if core.loop and core.loop.is_running():
160
+ background_tasks.create(wait_for_result(), name=str(fn))
161
+ else:
162
+ core.app.on_startup(wait_for_result())
163
+ except Exception as e:
164
+ core.app.handle_exception(e)
@@ -1,5 +1,6 @@
1
1
  from nicegui.element import Element
2
2
  from ex4nicegui.helper import client_instance_locker
3
+ from nicegui import ui
3
4
 
4
5
 
5
6
  class ScopedStyle(Element, component="scopedStyle.js"):
@@ -7,7 +8,9 @@ class ScopedStyle(Element, component="scopedStyle.js"):
7
8
 
8
9
  @staticmethod
9
10
  def get():
10
- return _scoped_style_factory.get_object()
11
+ if not ui.context.slot_stack:
12
+ return None
13
+ return _scoped_style_factory.get_object(ui.context.client)
11
14
 
12
15
  def create_style(self, element: Element, css: str):
13
16
  element_id = f"c{element.id}"
@@ -2,11 +2,14 @@ from __future__ import annotations
2
2
 
3
3
  from typing import Literal
4
4
 
5
+ from nicegui import ui
5
6
  from nicegui.elements.mixins.color_elements import (
6
7
  QUASAR_COLORS,
7
8
  TAILWIND_COLORS,
8
9
  )
9
10
 
11
+ from functools import lru_cache
12
+
10
13
 
11
14
  _color_system_type = Literal["QUASAR", "TAILWIND", "STYLE"]
12
15
 
@@ -23,3 +26,132 @@ def get_text_color_info(name: str):
23
26
  pass
24
27
 
25
28
  return system_type, name
29
+
30
+
31
+ def get_bg_color_info(color: str):
32
+ system_type: _color_system_type = "STYLE"
33
+
34
+ if color in QUASAR_COLORS:
35
+ system_type = "QUASAR"
36
+ elif color in TAILWIND_COLORS:
37
+ system_type = "TAILWIND"
38
+ color = f"bg-{color}"
39
+ else:
40
+ pass
41
+
42
+ return system_type, color
43
+
44
+
45
+ def _remove_text_color_from_quasar(element: ui.element, color: str):
46
+ color_prop = getattr(element, "TEXT_COLOR_PROP", None)
47
+ if color_prop:
48
+ element._props.pop(color_prop, None)
49
+
50
+
51
+ def _remove_text_color_from_tailwind(element: ui.element, color: str):
52
+ color = f"text-{color}"
53
+ element._classes.remove(color)
54
+
55
+
56
+ def _remove_text_color(element: ui.element, color: str):
57
+ element._style.pop("color", None)
58
+
59
+
60
+ def _add_text_color_from_quasar(element: ui.element, color: str):
61
+ color_prop = getattr(element, "TEXT_COLOR_PROP", None)
62
+ if color_prop:
63
+ element._props[color_prop] = color
64
+
65
+
66
+ def _add_text_color_from_tailwind(element: ui.element, color: str):
67
+ color = f"text-{color}"
68
+ element.classes(color)
69
+
70
+
71
+ def _add_text_color(element: ui.element, color: str):
72
+ element._style["color"] = f"{color} !important"
73
+
74
+
75
+ @lru_cache(maxsize=10)
76
+ def _query_text_color(color: str, add_handler=True):
77
+ if color in QUASAR_COLORS:
78
+ return (
79
+ _add_text_color_from_quasar
80
+ if add_handler
81
+ else _remove_text_color_from_quasar
82
+ )
83
+ elif color in TAILWIND_COLORS:
84
+ return (
85
+ _add_text_color_from_tailwind
86
+ if add_handler
87
+ else _remove_text_color_from_tailwind
88
+ )
89
+ elif color is not None:
90
+ return _add_text_color if add_handler else _remove_text_color
91
+
92
+
93
+ def remove_text_color(element: ui.element, color: str):
94
+ handler = _query_text_color(color, add_handler=False)
95
+ if handler:
96
+ handler(element, color)
97
+
98
+
99
+ def add_text_color(element: ui.element, color: str):
100
+ handler = _query_text_color(color)
101
+ if handler:
102
+ handler(element, color)
103
+
104
+
105
+ # background color handlers
106
+
107
+
108
+ def _remove_bg_from_quasar(element: ui.element, color: str):
109
+ color_prop = getattr(element, "BACKGROUND_COLOR_PROP", None)
110
+ if color_prop:
111
+ element._props.pop(color_prop, None)
112
+
113
+
114
+ def _remove_bg_from_tailwind(element: ui.element, color: str):
115
+ color = f"bg-{color}"
116
+ element._classes.remove(color)
117
+
118
+
119
+ def _remove_background_color(element: ui.element, color: str):
120
+ element._style.pop("background-color", None)
121
+
122
+
123
+ def _add_bg_from_quasar(element: ui.element, color: str):
124
+ color_prop = getattr(element, "BACKGROUND_COLOR_PROP", None)
125
+ if color_prop:
126
+ element._props[color_prop] = color
127
+
128
+
129
+ def _add_bg_from_tailwind(element: ui.element, color: str):
130
+ color = f"bg-{color}"
131
+ element.classes(color)
132
+
133
+
134
+ def _add_background_color(element: ui.element, color: str):
135
+ element._style["background-color"] = f"{color} !important"
136
+
137
+
138
+ @lru_cache(maxsize=10)
139
+ def _query_background_color(color: str, add_handler=True):
140
+ if color in QUASAR_COLORS:
141
+ return _add_bg_from_quasar if add_handler else _remove_bg_from_quasar
142
+ elif color in TAILWIND_COLORS:
143
+ return _add_bg_from_tailwind if add_handler else _remove_bg_from_tailwind
144
+ elif color is not None:
145
+ return _add_background_color if add_handler else _remove_background_color
146
+
147
+
148
+ def remove_background_color(element: ui.element, color: str):
149
+ handler = _query_background_color(color, add_handler=False)
150
+ if handler:
151
+ handler(element, color)
152
+
153
+
154
+ def add_background_color(element: ui.element, color: str):
155
+ handler = _query_background_color(color)
156
+ if handler:
157
+ handler(element, color)
@@ -1,5 +1,6 @@
1
1
  import signe
2
2
  from signe.core.scope import Scope
3
+ from signe.core.consts import EffectState
3
4
  from typing import (
4
5
  TypeVar,
5
6
  overload,
@@ -88,7 +89,10 @@ def ui_effect(
88
89
  **kws,
89
90
  scope=scope or _CLIENT_SCOPE_MANAGER.get_current_scope(),
90
91
  )
91
- res.update()
92
+
93
+ res.trigger(EffectState.NEED_UPDATE)
94
+ scheduler.run()
95
+ # res.update()
92
96
 
93
97
  return res
94
98
 
@@ -1,4 +1,5 @@
1
1
  import signe
2
+ from signe.core.consts import EffectState
2
3
  from typing import (
3
4
  TypeVar,
4
5
  overload,
@@ -6,7 +7,6 @@ from typing import (
6
7
  Callable,
7
8
  Union,
8
9
  )
9
-
10
10
  from .scheduler import get_uiScheduler
11
11
  from .clientScope import _CLIENT_SCOPE_MANAGER
12
12
 
@@ -81,7 +81,8 @@ def effect(
81
81
  scope=_CLIENT_SCOPE_MANAGER.get_current_scope(),
82
82
  )
83
83
 
84
- res.update()
84
+ res.trigger(EffectState.NEED_UPDATE)
85
+ scheduler.run()
85
86
 
86
87
  return res
87
88
 
@@ -1,15 +1,13 @@
1
1
  from collections import deque
2
2
  import signe
3
- from typing import (
4
- TypeVar,
5
- Callable,
6
- )
3
+ from typing import TypeVar, Callable, Literal
7
4
  from functools import lru_cache
8
5
 
9
6
 
10
7
  T = TypeVar("T")
11
8
 
12
9
  T_JOB_FN = Callable[[], None]
10
+ T_JOB_TYPE = Literal["pre", "post"]
13
11
 
14
12
 
15
13
  class UiScheduler(signe.ExecutionScheduler):
@@ -18,6 +16,7 @@ class UiScheduler(signe.ExecutionScheduler):
18
16
 
19
17
  self._pre_deque: deque[T_JOB_FN] = deque()
20
18
  self._post_deque: deque[T_JOB_FN] = deque()
19
+ self._next_tick_deque: deque[T_JOB_FN] = deque()
21
20
 
22
21
  def pre_job(self, job: T_JOB_FN):
23
22
  self._pre_deque.appendleft(job)
@@ -25,6 +24,9 @@ class UiScheduler(signe.ExecutionScheduler):
25
24
  def post_job(self, job: T_JOB_FN):
26
25
  self._post_deque.appendleft(job)
27
26
 
27
+ def next_tick_job(self, job: T_JOB_FN):
28
+ self._next_tick_deque.appendleft(job)
29
+
28
30
  def run(self):
29
31
  while self._scheduler_fns:
30
32
  super().run()
@@ -33,6 +35,7 @@ class UiScheduler(signe.ExecutionScheduler):
33
35
  try:
34
36
  self.run_pre_deque()
35
37
  self.run_post_deque()
38
+ self.run_next_tick_deque()
36
39
  pass
37
40
  except Exception as e:
38
41
  raise e
@@ -47,7 +50,20 @@ class UiScheduler(signe.ExecutionScheduler):
47
50
  while self._post_deque:
48
51
  self._post_deque.pop()()
49
52
 
53
+ def run_next_tick_deque(self):
54
+ while self._next_tick_deque:
55
+ self._next_tick_deque.pop()()
56
+
50
57
 
51
58
  @lru_cache(maxsize=1)
52
59
  def get_uiScheduler():
53
60
  return UiScheduler()
61
+
62
+
63
+ def next_tick(job: T_JOB_FN):
64
+ """Schedule a job to run on the next tick of the event loop.
65
+
66
+ Args:
67
+ job (T_JOB_FN): The job to run on the next tick.
68
+ """
69
+ get_uiScheduler().next_tick_job(job)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ex4nicegui
3
- Version: 0.6.8
3
+ Version: 0.6.9
4
4
  Summary: Extension library based on nicegui, providing data responsive,BI functionality modules
5
5
  Home-page: https://github.com/CrystalWindSnake/ex4nicegui
6
6
  License: MIT
@@ -890,6 +890,34 @@ rxui.label(lambda: f"当前 tab 为:{current_tab.value}")
890
890
  ```
891
891
  ---
892
892
 
893
+ ### lazy_tab_panels
894
+
895
+ 懒加载模式下,只有当前激活的 tab 才会渲染。
896
+ ```python
897
+ from ex4nicegui import to_ref, rxui, on, deep_ref
898
+
899
+ current_tab = to_ref("t1")
900
+
901
+ with rxui.tabs(current_tab):
902
+ ui.tab("t1")
903
+ ui.tab("t2")
904
+
905
+ with rxui.lazy_tab_panels(current_tab) as panels:
906
+
907
+ @panels.add_tab_panel("t1")
908
+ def _():
909
+ ui.notify("Hello from t1")
910
+
911
+ @panels.add_tab_panel("t2")
912
+ def _():
913
+ ui.notify("Hello from t2")
914
+
915
+ ```
916
+
917
+ 页面加载后,立刻显示 "Hello from t1"。当切换到 "t2" 页签,才会显示 "Hello from t2"。
918
+
919
+ ---
920
+
893
921
  ### scoped_style
894
922
 
895
923
  `scoped_style` 方法允许你创建限定在组件内部的样式。
@@ -1,4 +1,4 @@
1
- ex4nicegui/__init__.py,sha256=waq1asZd0w4BKeBozgDVKSFJTCgyK55ojdtRr-QFs1U,1048
1
+ ex4nicegui/__init__.py,sha256=olowSWbRsHGj1uoL28cZ5697vwXUzgJzusMVFe7adfg,1116
2
2
  ex4nicegui/bi/__init__.py,sha256=eu-2CuzzrcHCyKQOfoo87v6C9nSwFDdeLhjY0cRV13M,315
3
3
  ex4nicegui/bi/dataSource.py,sha256=hOOUN4PpSfPx4Vp1sg9Sfxi5K-wROw9C22Z-mmNXs6w,7644
4
4
  ex4nicegui/bi/dataSourceFacade.py,sha256=6NuAyrTIk_L2Tz9IRFpuHKRQY_OwJINDzxoM6JYOc14,8186
@@ -28,7 +28,7 @@ ex4nicegui/gsap/timeline.js,sha256=CB300drH7UUSfy_WDeuWHSNh3WX-vwbRtKBLL1Ak43o,1
28
28
  ex4nicegui/gsap/timeline.py,sha256=EfJ3Iom3EbJMML8PnRDAO_nn58j2bone3uWrd3UubeU,2390
29
29
  ex4nicegui/gsap/wrapGsap.js,sha256=0Iz7qh8aA-h3svV7fW4U5k_pX7zXCcIdHDaG7NNvgLU,1045
30
30
  ex4nicegui/helper/__init__.py,sha256=a-9skUII1iofsWU8xlieQrmeKYb9PjVsqF5TTO34wn8,98
31
- ex4nicegui/helper/client_instance_locker.py,sha256=mrgwYjb_OricG5kDscBI4UvItLu0N_HmOwIiAaH2dWE,968
31
+ ex4nicegui/helper/client_instance_locker.py,sha256=d-T5M0SFM8zOcr1paTn6gN5MVciGToL-fri4vJ7iY08,1027
32
32
  ex4nicegui/layout/__init__.py,sha256=YT76Ec7p4aFOGms6wc19207flBeyI6jrq7Kg_FQ2wnQ,278
33
33
  ex4nicegui/layout/gridFlex/__init__.py,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
34
34
  ex4nicegui/layout/gridFlex/GridFlex.js,sha256=ljkxGFucBUIPksMAT5w_35sxGogC7OzxzXnOw21Z3_k,4468
@@ -70,8 +70,9 @@ ex4nicegui/libs/gsap/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
70
70
  ex4nicegui/libs/gsap/utils/matrix.js,sha256=77scrxbQZXx4ex5HkvnT9IkhMG1rQoDNp4TSYgUeYVk,15235
71
71
  ex4nicegui/libs/gsap/utils/paths.js,sha256=2SPaRHQ7zgba9cH8hGhkTYPCZdrrEhE2qhh6ECAEvSA,49314
72
72
  ex4nicegui/libs/gsap/utils/strings.js,sha256=47G9slz5ltG9mDSwrfQDtWzzdV5QJ-AIMLRMNK0VSiM,10472
73
- ex4nicegui/reactive/__init__.py,sha256=-FC9JUa7bMqozkbbKlpWJB7WY8HuojAINgAD8ZcxHdY,3714
74
- ex4nicegui/reactive/deferredTask.py,sha256=l__Qdis24jAO97_DSHW1yBns0f13-OK02O2SSkyvoZQ,824
73
+ ex4nicegui/reactive/__init__.py,sha256=mutWUjTNYefm_FC7yrjg5beceQCWFX0YGGFoRP01he0,3881
74
+ ex4nicegui/reactive/base.py,sha256=_1n78kAC65jLyHm91HkeuCq4MuvISY_gc3J6xXipLec,13635
75
+ ex4nicegui/reactive/deferredTask.py,sha256=g78TTG1EIkBxjPih01xmrCZw9OxQG93veSVSELWKfcU,987
75
76
  ex4nicegui/reactive/dropZone/dropZone.js,sha256=7rSpFJX-Fk_W_NGZhOTyuEw0bzR-YUc8ZYPzQG9KzE0,2713
76
77
  ex4nicegui/reactive/dropZone/dropZone.py,sha256=hg9UKTayff8v8Ek-n38h_3wX1Qmiotvdyv1Hsqilh5Y,2590
77
78
  ex4nicegui/reactive/EChartsComponent/ECharts.js,sha256=ye2FZNLfY4T41YAGQQYqn3LThSlnbY0pqnGtpyEg9bE,3548
@@ -85,12 +86,16 @@ ex4nicegui/reactive/fileWatcher.py,sha256=gjeZhgar02f-qGQa47Tj5SMaCP_ftRtSU898XU
85
86
  ex4nicegui/reactive/local_file_picker.py,sha256=MoInXSauFdCuhYi_CmNKZwxAtsOqXh8roWWdqNwjPBY,6199
86
87
  ex4nicegui/reactive/mermaid/mermaid.js,sha256=Ds5VevGWZE1_N0WKf-uITd8xSCO9gQzVUsmb80EajNY,2308
87
88
  ex4nicegui/reactive/mermaid/mermaid.py,sha256=uP321QiNj_S5E5I2KF9h03WlSFdRITE8tvObGdk6m7M,2144
89
+ ex4nicegui/reactive/mixins/backgroundColor.py,sha256=R2ES4CcYm26O15No9r6Xr-vxCJg3fH6C0Y4ZxQv0NC8,1123
90
+ ex4nicegui/reactive/mixins/disableable.py,sha256=hprIcmcq9k2xUy0hJDbhzX4EvkALOmOnWHg9UNLXYZw,1113
91
+ ex4nicegui/reactive/mixins/textColor.py,sha256=oY3hhnj1Mb6G2Io9h1dPycIidgerxuPBWq9z5874LW8,1816
88
92
  ex4nicegui/reactive/officials/aggrid.py,sha256=AhDmbCUk8PU97eP25HCTYfGhdtKCZ6noLE3Snb2O6pU,2974
89
- ex4nicegui/reactive/officials/base.py,sha256=4UWSB0q7nE-Z4bzAka5VyfNkO0CGF914-fiXihipAqA,14360
90
- ex4nicegui/reactive/officials/button.py,sha256=TSq8PcebIbW_rjHNhzLiYbl9NhJDaNMz31-QTcL6hM8,1721
93
+ ex4nicegui/reactive/officials/base.py,sha256=SVJz0UYPvlpSHN193X-EFCNT-lAP2LYEo8HJBQ0i8Tg,153
94
+ ex4nicegui/reactive/officials/button.py,sha256=zbV8AFaAZ23dDxhssAHB5RCyqt6-LVmkfmAoba5obRU,2670
91
95
  ex4nicegui/reactive/officials/card.py,sha256=8-tBwm3xfVybolQ87i8lAYUpBV6FdaVdeSH6xu0736U,1275
92
96
  ex4nicegui/reactive/officials/checkbox.py,sha256=c_CDUlPx7izgaZY3Y4CaCIyxM3moQ0x_lLEs4MylSOc,1565
93
- ex4nicegui/reactive/officials/circular_progress.py,sha256=B24s7zwLQB8C7ScHxjlLA0rrHCYXiWgk3-8WvuZrZpE,1790
97
+ ex4nicegui/reactive/officials/chip.py,sha256=M_4zODM-oIrnLor6qjqbvj4D67sLDqXIRDsYe4Wn8Y8,3185
98
+ ex4nicegui/reactive/officials/circular_progress.py,sha256=DXTGC18BD2kcbAfLX6sdPFxSaQX6LkU7pUfooV3-VKE,1964
94
99
  ex4nicegui/reactive/officials/color_picker.py,sha256=FUuHhSQ96bCaVua5Cq28_V08PYIVOHFxygVawJkqo1I,3420
95
100
  ex4nicegui/reactive/officials/column.py,sha256=Ox2OZRmKjAR8pRTWNXej8I-AYI8FGujIAhZyAoi9cNY,1109
96
101
  ex4nicegui/reactive/officials/date.py,sha256=E5Xs4mJgknQzpBqW_lwJ8c3GZf8wlyi7xCPQrJ70MWE,2515
@@ -98,24 +103,24 @@ ex4nicegui/reactive/officials/drawer.py,sha256=_Ro6stOh8U3igYMeDwI4omBgi1nld5ber
98
103
  ex4nicegui/reactive/officials/echarts.py,sha256=YvoVfxRl2V93e6pC5l5O6-VJqMxvfwqEf0JLXv639UY,10072
99
104
  ex4nicegui/reactive/officials/element.py,sha256=-qsHcxfF3fMfU0sJlKtTksX_wYPMIPJ_AgFcZbbI754,412
100
105
  ex4nicegui/reactive/officials/expansion.py,sha256=N0mp7_ZO0gHjGTAA69-mAdDCNZWr3FP_sqFL4-Rvhes,1898
101
- ex4nicegui/reactive/officials/grid.py,sha256=ih2Ew4AMx6U6k3ZXwLstn9XH0OjNiWrK6lwdp1f3e6s,885
106
+ ex4nicegui/reactive/officials/grid.py,sha256=Bq83jejsxQSYVc9O1IE6JUgUndUm1uexb4fq9EZWjHQ,921
102
107
  ex4nicegui/reactive/officials/html.js,sha256=lyvRAdMKZGOc7MPEapeU6WbOzq_MVzqzUJEhKuC8zWc,119
103
108
  ex4nicegui/reactive/officials/html.py,sha256=XrOpGoAJDo8dtTnZVLSmi7H5iHffmYpeZ94lXxHjBwI,629
104
- ex4nicegui/reactive/officials/icon.py,sha256=cFrnWAuO-i5Aj_aHZ4yJrlaR0j4KitcL_EJ2cbduoQ8,1625
109
+ ex4nicegui/reactive/officials/icon.py,sha256=qCfdxTGrwtIYEgEYkxnxTGj1C0yEfFa6EfdLzSkjmXs,1544
105
110
  ex4nicegui/reactive/officials/image.py,sha256=ifuBU_RORV8FTG_3xKQtj6d5F5exz-nxqD70HKo0S7g,1121
106
111
  ex4nicegui/reactive/officials/input.py,sha256=osu9HfT6W3zXhFkCLNIaN-q3LjlFvz6GknksO6h7r7Y,4044
107
- ex4nicegui/reactive/officials/knob.py,sha256=5wQJxCWx45pi09c0jP-szbcch3YX_7He-3iL0bV7rCw,2154
108
- ex4nicegui/reactive/officials/label.py,sha256=_t0SGYbaKlSiR4phfgoZlWUcvyZPH5yvWsKVsQraHLw,1478
109
- ex4nicegui/reactive/officials/linear_progress.py,sha256=TAcy9iYnGmRldNyWvdzmL0VpVu6IFtkcF4nHsWoPBls,2194
112
+ ex4nicegui/reactive/officials/knob.py,sha256=GRtrgnne7TdCtx_BjLeCuN8YlNsyn1Rf55Bj3e5QCzU,2321
113
+ ex4nicegui/reactive/officials/label.py,sha256=_4a9MQJCohWQumdyUoi7dHmeuVOUpmrI5U7HOzkUhJM,1335
114
+ ex4nicegui/reactive/officials/linear_progress.py,sha256=VhqiW64wO6QxFbv0TAVVlwtpVgysWVmUSsLe2Vd9aKY,2113
110
115
  ex4nicegui/reactive/officials/number.py,sha256=H5_6_NfcC4tosomHJXht9DHAF3q87zQKBIkPoKmHgZk,2786
111
116
  ex4nicegui/reactive/officials/radio.py,sha256=N13zS2FVzA3gew77_OjRCyzdcnheGLAeGYlWK3CxGTc,1945
112
117
  ex4nicegui/reactive/officials/row.py,sha256=fGNcEHS2sMT1GY33jpLTvUh-MjqdNSuyCrjgBXM-p2Q,1049
113
118
  ex4nicegui/reactive/officials/select.py,sha256=japHOAIeFM860W9RCOXAQtMdslN9tLjxdYuzNZ3p4rM,2996
114
- ex4nicegui/reactive/officials/slider.py,sha256=6dXVNsW1l0DN9ljC610FlR6wfVHfpv5xSQdkN7VaiAM,2961
119
+ ex4nicegui/reactive/officials/slider.py,sha256=eF3W7hwxmTXmRfP_aZGM8z_zXi3Z7-mGjAZr7Sjc6vA,2971
115
120
  ex4nicegui/reactive/officials/switch.py,sha256=9OtkOB1QD3wCEyPBwPvzAPyYJku5v5MvuTciNE9EQvo,1606
116
121
  ex4nicegui/reactive/officials/tab.py,sha256=A83oxhlr8-YBeuUJTfPk05Kt9DeA5knNwbpwE5-i7Lk,1816
117
122
  ex4nicegui/reactive/officials/tab_panel.py,sha256=Y05XTIOE6qXYZjcCoVIPm9lruyR7av58McRLmPc2yxg,650
118
- ex4nicegui/reactive/officials/tab_panels.py,sha256=VND49QlINVBjMdaNiqI1UaDR2Rhk6tqt79ePl-jh1oA,2123
123
+ ex4nicegui/reactive/officials/tab_panels.py,sha256=hjNDSTslwnzSPIf-mEVlhOE8AfoN5z-DDP_fUk0D5PU,6049
119
124
  ex4nicegui/reactive/officials/table.py,sha256=oNOuG8rT0oKbnn-MpO2sRisdJwpGILDZkxk96g7GYtQ,6208
120
125
  ex4nicegui/reactive/officials/tabs.py,sha256=w-wXIRUnYBgBDZDTNLhcUrIvP6rpiZRs0kd2GvJ7zPw,1301
121
126
  ex4nicegui/reactive/officials/textarea.py,sha256=dCF_uNUIveK6Nuy-OxJDSb7jzPyw-rIsNw51uwsg090,3043
@@ -123,11 +128,10 @@ ex4nicegui/reactive/officials/upload.py,sha256=5SX2CFkf3s_4bPcnx0bmKRA4eYVlm0S8R
123
128
  ex4nicegui/reactive/q_pagination.py,sha256=hvX8abzp7nmeOy2gKwtNM6Dhpt7fYqw7d8YNHYAltx8,1560
124
129
  ex4nicegui/reactive/rxui.py,sha256=gZ8ZEjGuJFKcedEZhcm4PIZguNkY-Wv5yQx80QnsBKI,31
125
130
  ex4nicegui/reactive/scopedStyle.js,sha256=RtpfUwkpjMv_cbplkr2UtydKAxB5Dz7Sm6jRgPHRhow,1569
126
- ex4nicegui/reactive/scopedStyle.py,sha256=lwykOybREj2mjjiN_oQ7S-TRda40kO-TxVlHtXF0M3c,633
127
- ex4nicegui/reactive/services/color_service.py,sha256=UIQXP4PQ_l5601Opqw5T6E_wOyd3yt1dtMLmHdRP5L4,1746
131
+ ex4nicegui/reactive/scopedStyle.py,sha256=aYP4sIFzAmPaLyZV8m9jqyuGmOcJnC-5s07UQnoNSag,738
128
132
  ex4nicegui/reactive/services/pandas_service.py,sha256=XOoy6tZr4TpTyhewAH59eiSwVFxqwOipdM_j-mkGpdM,1043
129
133
  ex4nicegui/reactive/services/reactive_service.py,sha256=cgw7Qirc70avsgvGuMT4RCT_mFouJb1-KR3dWOgucX8,2742
130
- ex4nicegui/reactive/systems/color_system.py,sha256=zJvFd2UobkAtMN3yb6amGgHoR9BLyEiTSfLY-107r4w,542
134
+ ex4nicegui/reactive/systems/color_system.py,sha256=qXRTczxfILduHAVlNJqLSed-0x-LN6TyBSegYwW9vfk,4352
131
135
  ex4nicegui/reactive/systems/object_system.py,sha256=bja9YNb4v5fVZl5gJvVA4HbwRssRp-2yFy3JBzNeKxA,752
132
136
  ex4nicegui/reactive/systems/reactive_system.py,sha256=EYDshl4UR9VheNcxcNHc231Dwko9VudilfMIxCD_uOk,685
133
137
  ex4nicegui/reactive/transitionGroup.js,sha256=rbfNU3Jrz9WFDQih3BgZOgC1MBr6j9cODZ9XggMAaTs,898
@@ -143,18 +147,18 @@ ex4nicegui/reactive/vmodel.py,sha256=cKfclpvUvQf_UYGLSYWOJVOJP2iPu8KvE7p6D-ZAHOg
143
147
  ex4nicegui/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
144
148
  ex4nicegui/tools/debug.py,sha256=h9iYHxw7jWWvmiExSpGi2hQl1PfhPZgC2KNS_GTuHSw,4868
145
149
  ex4nicegui/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
146
- ex4nicegui/utils/apiEffect.py,sha256=tAvQ-6sbSbZBZ1bibdAdQNb_BjrUF1uALwOkAdV_Y8M,2527
150
+ ex4nicegui/utils/apiEffect.py,sha256=uwIi-R4Q0MaGSVmvhEFIL0O8pjBWobB_8brGAe19Qm4,2645
147
151
  ex4nicegui/utils/asyncComputed.py,sha256=-v19ic20URewLkjbms5Teco1k8LPRnpP7usjrgo1pRU,1505
148
152
  ex4nicegui/utils/clientScope.py,sha256=AM5GQLXSIrLALnzz72ZmplykhKVhRjRxQdHdAeR7g7k,1719
149
153
  ex4nicegui/utils/common.py,sha256=7P0vboDadLun6EMxNi3br9rKJgKt0QT4sy_66cHEwb4,994
150
- ex4nicegui/utils/effect.py,sha256=MgvWuAP3OFs2bR4ef6uXPwGCkKORUK-4hmx1oSwl04Y,2310
154
+ ex4nicegui/utils/effect.py,sha256=LTtPTxx8-sP4VtZaFQjERB-ef3L2y5hu95GvTdj-nLo,2400
151
155
  ex4nicegui/utils/refComputed.py,sha256=Vb7fyi0wNieFeLfCjXl6wSzpws3i6_aeCka1s9dsc8E,4232
152
156
  ex4nicegui/utils/refWrapper.py,sha256=gX5sdfC1P4UXmMYM6FwdImfLD39y02kq7Af6dIMDrZ8,1472
153
- ex4nicegui/utils/scheduler.py,sha256=Wa963Df3UDvWHjXXoVYGIBevIILzCFoz-yAWjvxeyfQ,1218
157
+ ex4nicegui/utils/scheduler.py,sha256=1gyq7Y2BkbwmPK_Q9kpRpc1MOC9H7xcpxuix-RZhN9k,1787
154
158
  ex4nicegui/utils/signals.py,sha256=t21k-XUjQpX0UlW_diyzx_OxNN1Al-kNqk4u8Wx0L14,7024
155
159
  ex4nicegui/utils/types.py,sha256=pE5WOSbcTHxaAhnT24FaZEd1B2Z_lTcsd46w0OKiMyc,359
156
160
  ex4nicegui/version.py,sha256=NE7u1piESstg3xCtf5hhV4iedGs2qJQw9SiC3ZSpiio,90
157
- ex4nicegui-0.6.8.dist-info/LICENSE,sha256=0KDDElS2dl-HIsWvbpy8ywbLzJMBFzXLev57LnMIZXs,1094
158
- ex4nicegui-0.6.8.dist-info/METADATA,sha256=NK_zTEIdCukO1X2BGBtmWUEb-DBzsnkU2roJLU7P73Q,29500
159
- ex4nicegui-0.6.8.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
160
- ex4nicegui-0.6.8.dist-info/RECORD,,
161
+ ex4nicegui-0.6.9.dist-info/LICENSE,sha256=0KDDElS2dl-HIsWvbpy8ywbLzJMBFzXLev57LnMIZXs,1094
162
+ ex4nicegui-0.6.9.dist-info/METADATA,sha256=7ZTJqu2FUrvBpqWBn1GdkKkuuOKCsTg3xsAlPo6mBA0,30069
163
+ ex4nicegui-0.6.9.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
164
+ ex4nicegui-0.6.9.dist-info/RECORD,,
@@ -1,56 +0,0 @@
1
- from __future__ import annotations
2
- from typing import TYPE_CHECKING, Literal, cast
3
- from ex4nicegui.utils.signals import to_value
4
- from nicegui.elements.mixins.color_elements import (
5
- TextColorElement,
6
- QUASAR_COLORS,
7
- TAILWIND_COLORS,
8
- )
9
-
10
- if TYPE_CHECKING:
11
- from ex4nicegui.reactive.officials.base import BindableUi
12
- from ex4nicegui import TGetterOrReadonlyRef
13
-
14
-
15
- _color_sys_type = Literal["QUASAR", "TAILWIND", "STYLE"]
16
- _color_attr_name = "data-ex4ng-color"
17
-
18
-
19
- def bind_color(bindable_ui: BindableUi, ref_ui: TGetterOrReadonlyRef):
20
- @bindable_ui._ui_effect
21
- def _():
22
- ele = cast(TextColorElement, bindable_ui.element)
23
- color = to_value(ref_ui)
24
-
25
- # get exists color
26
- # e.g 'QUASAR:red'
27
- pre_color = ele._props.get(_color_attr_name) # type: str | None
28
- if pre_color:
29
- color_sys, value = pre_color.split(":") # type: ignore
30
- color_sys: _color_sys_type
31
-
32
- if color_sys == "QUASAR":
33
- del ele._props[ele.TEXT_COLOR_PROP]
34
- elif color_sys == "TAILWIND":
35
- ele.classes(remove=value)
36
- else:
37
- del ele._style["color"]
38
-
39
- cur_sys: _color_sys_type = "STYLE"
40
- cur_color = color
41
-
42
- if color in QUASAR_COLORS:
43
- ele._props[ele.TEXT_COLOR_PROP] = color
44
- cur_sys = "QUASAR"
45
- elif color in TAILWIND_COLORS:
46
- cur_color = f"text-{color}"
47
- ele.classes(replace=cur_color)
48
- cur_sys = "TAILWIND"
49
- elif color is not None:
50
- ele._style["color"] = color
51
-
52
- ele._props[_color_attr_name] = f"{cur_sys}:{color}"
53
-
54
- ele.update()
55
-
56
- return bindable_ui