ex4nicegui 0.6.9__py3-none-any.whl → 0.7.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.
Files changed (47) hide show
  1. ex4nicegui/bi/dataSourceFacade.py +20 -20
  2. ex4nicegui/bi/index.py +20 -23
  3. ex4nicegui/reactive/EChartsComponent/ECharts.py +9 -8
  4. ex4nicegui/reactive/__init__.py +8 -0
  5. ex4nicegui/reactive/base.py +61 -54
  6. ex4nicegui/reactive/mixins/backgroundColor.py +5 -5
  7. ex4nicegui/reactive/mixins/disableable.py +8 -8
  8. ex4nicegui/reactive/mixins/textColor.py +10 -10
  9. ex4nicegui/reactive/officials/aggrid.py +5 -5
  10. ex4nicegui/reactive/officials/button.py +15 -15
  11. ex4nicegui/reactive/officials/checkbox.py +5 -5
  12. ex4nicegui/reactive/officials/chip.py +5 -5
  13. ex4nicegui/reactive/officials/circular_progress.py +6 -6
  14. ex4nicegui/reactive/officials/color_picker.py +7 -7
  15. ex4nicegui/reactive/officials/column.py +5 -5
  16. ex4nicegui/reactive/officials/date.py +5 -5
  17. ex4nicegui/reactive/officials/dialog.py +49 -0
  18. ex4nicegui/reactive/officials/echarts.py +49 -51
  19. ex4nicegui/reactive/officials/expansion.py +5 -5
  20. ex4nicegui/reactive/officials/icon.py +6 -6
  21. ex4nicegui/reactive/officials/image.py +5 -5
  22. ex4nicegui/reactive/officials/input.py +8 -8
  23. ex4nicegui/reactive/officials/knob.py +6 -6
  24. ex4nicegui/reactive/officials/label.py +6 -6
  25. ex4nicegui/reactive/officials/linear_progress.py +6 -6
  26. ex4nicegui/reactive/officials/number.py +9 -9
  27. ex4nicegui/reactive/officials/radio.py +8 -8
  28. ex4nicegui/reactive/officials/row.py +5 -5
  29. ex4nicegui/reactive/officials/select.py +9 -8
  30. ex4nicegui/reactive/officials/slider.py +5 -5
  31. ex4nicegui/reactive/officials/switch.py +5 -5
  32. ex4nicegui/reactive/officials/tab.py +0 -12
  33. ex4nicegui/reactive/officials/tab_panels.py +5 -5
  34. ex4nicegui/reactive/officials/table.py +13 -13
  35. ex4nicegui/reactive/officials/tabs.py +5 -5
  36. ex4nicegui/reactive/officials/textarea.py +5 -5
  37. ex4nicegui/reactive/officials/tooltip.py +40 -0
  38. ex4nicegui/reactive/q_pagination.py +5 -5
  39. ex4nicegui/reactive/vfor.js +14 -4
  40. ex4nicegui/reactive/vfor.py +128 -58
  41. ex4nicegui/reactive/view_model.py +160 -0
  42. ex4nicegui/reactive/vmodel.py +42 -12
  43. ex4nicegui/utils/signals.py +23 -21
  44. {ex4nicegui-0.6.9.dist-info → ex4nicegui-0.7.0.dist-info}/METADATA +219 -48
  45. {ex4nicegui-0.6.9.dist-info → ex4nicegui-0.7.0.dist-info}/RECORD +47 -44
  46. {ex4nicegui-0.6.9.dist-info → ex4nicegui-0.7.0.dist-info}/LICENSE +0 -0
  47. {ex4nicegui-0.6.9.dist-info → ex4nicegui-0.7.0.dist-info}/WHEEL +0 -0
@@ -228,26 +228,26 @@ class DataSourceFacade(Generic[_TData]):
228
228
 
229
229
  Support pyecharts
230
230
 
231
- ```py
232
- import pandas as pd
233
- from ex4nicegui import bi
234
- from pyecharts.charts import Bar
235
-
236
- df = pd.DataFrame({"name": list("abcdc"), "value": range(5)})
237
- ds = bi.data_source(df)
238
-
239
- @ds.ui_echarts
240
- def bar(data: pd.DataFrame):
241
- c = (
242
- Bar()
243
- .add_xaxis(data["name"].tolist())
244
- .add_yaxis("value", data["value"].tolist())
245
- )
246
-
247
- return c
248
-
249
- bar.classes("h-[20rem]")
250
- ```
231
+ .. code-block:: python
232
+ import pandas as pd
233
+ from ex4nicegui import bi
234
+ from pyecharts.charts import Bar
235
+
236
+ df = pd.DataFrame({"name": list("abcdc"), "value": range(5)})
237
+ ds = bi.data_source(df)
238
+
239
+ @ds.ui_echarts
240
+ def bar(data: pd.DataFrame):
241
+ c = (
242
+ Bar()
243
+ .add_xaxis(data["name"].tolist())
244
+ .add_yaxis("value", data["value"].tolist())
245
+ )
246
+
247
+ return c
248
+
249
+ bar.classes("h-[20rem]")
250
+
251
251
 
252
252
  """
253
253
  return ui_echarts(self, fn)
ex4nicegui/bi/index.py CHANGED
@@ -24,43 +24,40 @@ def data_source(data: Union[Callable[..., _TData], _TData]) -> DataSourceFacade[
24
24
 
25
25
  ## Examples
26
26
 
27
- ---
28
-
29
27
  pandas dataframe source:
30
- ```python
31
- df = pd.DataFrame({"name": list("abcdc"), "value": range(5)})
32
- ds = bi.data_source(df)
33
- ```
28
+
29
+ .. code-block:: python
30
+ df = pd.DataFrame({"name": list("abcdc"), "value": range(5)})
31
+ ds = bi.data_source(df)
32
+
34
33
 
35
34
  ---
36
35
 
37
36
  Link multiple data sources
38
37
 
39
- ---
40
- ```python
41
- df = pd.DataFrame({"name": list("abcdc"), "value": range(5)})
42
- ds = bi.data_source(df)
38
+ .. code-block:: python
39
+ df = pd.DataFrame({"name": list("abcdc"), "value": range(5)})
40
+ ds = bi.data_source(df)
43
41
 
44
- @bi.data_source
45
- def ds_other():
46
- # ds.filtered_data is DataFrame after filtering
47
- where = ds.filtered_data[''].isin(['b','c','d'])
48
- return ds.filtered_data[where]
42
+ @bi.data_source
43
+ def ds_other():
44
+ # ds.filtered_data is DataFrame after filtering
45
+ where = ds.filtered_data[''].isin(['b','c','d'])
46
+ return ds.filtered_data[where]
49
47
 
50
- ```
51
48
 
52
49
  ---
53
50
 
54
51
  Now, when `ds` changes, it will trigger changes to `ds_other` and thus drive the related interface components to change.
55
52
 
56
- ```python
57
- # select box of data source 'ds'
58
- # it change will trigger changes to table
59
- ds.ui_select('name')
53
+ .. code-block:: python
54
+ # select box of data source 'ds'
55
+ # it change will trigger changes to table
56
+ ds.ui_select('name')
57
+
58
+ # table of data 'ds_other'
59
+ ds_other.ui_aggrid()
60
60
 
61
- # table of data 'ds_other'
62
- ds_other.ui_aggrid()
63
- ```
64
61
 
65
62
 
66
63
  """
@@ -64,14 +64,15 @@ class echarts(Element, component="ECharts.js", libraries=libraries): # type: ig
64
64
  Args:
65
65
  options (dict): chart setting options dict
66
66
  opts (Optional[dict], optional): update options. Defaults to None.
67
- ```python
68
- {
69
- 'notMerge':False,
70
- 'lazyUpdate':False,
71
- 'silent':False,
72
- 'replaceMerge': None,
73
- }
74
- ```
67
+
68
+ .. code-block:: python
69
+ {
70
+ 'notMerge':False,
71
+ 'lazyUpdate':False,
72
+ 'silent':False,
73
+ 'replaceMerge': None,
74
+ }
75
+
75
76
  [open echarts setOption docs](https://echarts.apache.org/zh/api.html#echartsInstance.setOption)
76
77
 
77
78
  """
@@ -54,6 +54,7 @@ from .officials.element import ElementBindableUi as element
54
54
  from .officials.tab_panels import LazyTabPanelsBindableUi as lazy_tab_panels
55
55
  from .q_pagination import PaginationBindableUi as q_pagination
56
56
  from .officials.chip import ChipBindableUi as chip
57
+ from .officials.tooltip import TooltipBindableUi as tooltip
57
58
 
58
59
  from .local_file_picker import local_file_picker
59
60
  from .UseDraggable.UseDraggable import use_draggable
@@ -63,8 +64,10 @@ from .usePagination import PaginationRef as use_pagination
63
64
  from .dropZone.dropZone import use_drag_zone
64
65
  from .fileWatcher import FilesWatcher
65
66
  from .mermaid.mermaid import Mermaid as mermaid
67
+ from .officials.dialog import DialogBindableUi as dialog
66
68
  from .vfor import vfor, VforStore
67
69
  from .vmodel import vmodel
70
+ from .view_model import ViewModel, var, cached_var
68
71
 
69
72
  pagination = q_pagination
70
73
 
@@ -88,6 +91,9 @@ __all__ = [
88
91
  "vfor",
89
92
  "VforStore",
90
93
  "vmodel",
94
+ "ViewModel",
95
+ "var",
96
+ "cached_var",
91
97
  "html",
92
98
  "aggrid",
93
99
  "button",
@@ -124,4 +130,6 @@ __all__ = [
124
130
  "pagination",
125
131
  "mermaid",
126
132
  "chip",
133
+ "dialog",
134
+ "tooltip",
127
135
  ]
@@ -24,6 +24,7 @@ from ex4nicegui.utils.signals import (
24
24
  on,
25
25
  )
26
26
  from ex4nicegui.utils.clientScope import new_scope
27
+ from ex4nicegui.utils.types import _TMaybeRef as TMaybeRef
27
28
  from nicegui import Tailwind, ui
28
29
  from nicegui.elements.mixins.text_element import TextElement
29
30
  from ex4nicegui.reactive.services.reactive_service import inject_handle_delete
@@ -105,8 +106,12 @@ class BindableUi(Generic[TWidget]):
105
106
  def __exit__(self, *_):
106
107
  self.element.default_slot.__exit__(*_)
107
108
 
108
- def tooltip(self, text: str) -> Self:
109
- cast(ui.element, self.element).tooltip(text)
109
+ def tooltip(self, text: TMaybeRef[str]) -> Self:
110
+ from ex4nicegui.reactive.officials.tooltip import TooltipBindableUi
111
+
112
+ with self:
113
+ TooltipBindableUi(text)
114
+
110
115
  return self
111
116
 
112
117
  def add_slot(self, name: str, template: Optional[str] = None):
@@ -143,7 +148,7 @@ class BindableUi(Generic[TWidget]):
143
148
  """
144
149
  return self.element.remove(element)
145
150
 
146
- def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef[Any]):
151
+ def bind_prop(self, prop: str, value: TGetterOrReadonlyRef[Any]):
147
152
  """data binding is manipulating an element's property
148
153
 
149
154
  @see - https://github.com/CrystalWindSnake/ex4nicegui/blob/main/README.en.md#bind_prop
@@ -151,37 +156,37 @@ class BindableUi(Generic[TWidget]):
151
156
 
152
157
  Args:
153
158
  prop (str): property name
154
- ref_ui (TGetterOrReadonlyRef[Any]): a reference to the value to bind to
159
+ value (TGetterOrReadonlyRef[Any]): a reference to the value to bind to
155
160
 
156
161
  """
157
162
  if prop == "visible":
158
- return self.bind_visible(ref_ui)
163
+ return self.bind_visible(value)
159
164
 
160
165
  if prop == "text" and isinstance(self.element, TextElement):
161
166
 
162
167
  @self._ui_effect
163
168
  def _():
164
- cast(TextElement, self.element).set_text(to_value(ref_ui))
169
+ cast(TextElement, self.element).set_text(to_value(value))
165
170
  self.element.update()
166
171
 
167
172
  @self._ui_effect
168
173
  def _():
169
174
  element = cast(ui.element, self.element)
170
- element._props[prop] = to_value(ref_ui)
175
+ element._props[prop] = to_value(value)
171
176
  element.update()
172
177
 
173
178
  return self
174
179
 
175
- def bind_visible(self, ref_ui: TGetterOrReadonlyRef[bool]):
180
+ def bind_visible(self, value: TGetterOrReadonlyRef[bool]):
176
181
  @self._ui_effect
177
182
  def _():
178
183
  element = cast(ui.element, self.element)
179
- element.set_visibility(to_value(ref_ui))
184
+ element.set_visibility(to_value(value))
180
185
 
181
186
  return self
182
187
 
183
- def bind_not_visible(self, ref_ui: TGetterOrReadonlyRef[bool]):
184
- return self.bind_visible(lambda: not to_value(ref_ui))
188
+ def bind_not_visible(self, value: TGetterOrReadonlyRef[bool]):
189
+ return self.bind_visible(lambda: not to_value(value))
185
190
 
186
191
  def on(
187
192
  self,
@@ -209,22 +214,22 @@ class BindableUi(Generic[TWidget]):
209
214
  cast(ui.element, self.element).clear()
210
215
 
211
216
  @overload
212
- def bind_classes(self, classes: Dict[str, TGetterOrReadonlyRef[bool]]):
217
+ def bind_classes(self, classes: Dict[str, TGetterOrReadonlyRef[bool]]) -> Self:
213
218
  ...
214
219
 
215
220
  @overload
216
- def bind_classes(self, classes: TGetterOrReadonlyRef[Dict[str, bool]]):
221
+ def bind_classes(self, classes: TGetterOrReadonlyRef[Dict[str, bool]]) -> Self:
217
222
  ...
218
223
 
219
224
  @overload
220
- def bind_classes(self, classes: List[TGetterOrReadonlyRef[str]]):
225
+ def bind_classes(self, classes: List[TGetterOrReadonlyRef[str]]) -> Self:
221
226
  ...
222
227
 
223
228
  @overload
224
- def bind_classes(self, classes: TGetterOrReadonlyRef[str]):
229
+ def bind_classes(self, classes: TGetterOrReadonlyRef[str]) -> Self:
225
230
  ...
226
231
 
227
- def bind_classes(self, classes: _T_bind_classes_type):
232
+ def bind_classes(self, classes: _T_bind_classes_type) -> Self:
228
233
  """data binding is manipulating an element's class list
229
234
 
230
235
  @see - https://github.com/CrystalWindSnake/ex4nicegui/blob/main/README.en.md#bind-class-names
@@ -237,30 +242,30 @@ class BindableUi(Generic[TWidget]):
237
242
 
238
243
  bind class names with dict,value is bool ref, for example:
239
244
 
240
- ```python
245
+ .. code-block:: python
241
246
  bg_color = to_ref(True)
242
247
  has_error = to_ref(False)
243
248
 
244
249
  rxui.label('Hello').bind_classes({'bg-blue':bg_color, 'text-red':has_error})
245
- ```
250
+
246
251
 
247
252
  bind list of class names with ref
248
253
 
249
- ```python
254
+ .. code-block:: python
250
255
  color = to_ref('red')
251
256
  bg_color = lambda: f"bg-{color.value}"
252
257
 
253
258
  rxui.label('Hello').bind_classes([bg_color])
254
- ```
259
+
255
260
 
256
261
  bind single class name with ref
257
262
 
258
- ```python
263
+ .. code-block:: python
259
264
  color = to_ref('red')
260
265
  bg_color = lambda: f"bg-{color.value}"
261
266
 
262
267
  rxui.label('Hello').bind_classes(bg_color)
263
- ```
268
+
264
269
 
265
270
  """
266
271
  if isinstance(classes, dict):
@@ -316,17 +321,18 @@ class BindableUi(Generic[TWidget]):
316
321
 
317
322
 
318
323
  ## usage
319
- ```python
320
- bg_color = to_ref("blue")
321
- text_color = to_ref("red")
322
-
323
- rxui.label("test").bind_style(
324
- {
325
- "background-color": bg_color,
326
- "color": text_color,
327
- }
328
- )
329
- ```
324
+
325
+ .. code-block:: python
326
+ bg_color = to_ref("blue")
327
+ text_color = to_ref("red")
328
+
329
+ rxui.label("test").bind_style(
330
+ {
331
+ "background-color": bg_color,
332
+ "color": text_color,
333
+ }
334
+ )
335
+
330
336
  """
331
337
  if isinstance(style, dict):
332
338
  for name, ref_obj in style.items():
@@ -350,27 +356,28 @@ class BindableUi(Generic[TWidget]):
350
356
  style (Union[str, Path]): path to css file or inline style string
351
357
 
352
358
  ## usage
353
- ```python
354
- # all children of the element will have red outline, excluding itself
355
- with rxui.row().scoped_style("*", "outline: 1px solid red;") as row:
356
- ui.label("Hello")
357
- ui.label("World")
358
-
359
- # all children of the element will have red outline, including the element itself
360
- with rxui.row().scoped_style(":self *", "outline: 1px solid red;") as row:
361
- ui.label("Hello")
362
- ui.label("World")
363
-
364
- # all children of the element will have red outline when element is hovered
365
- with rxui.row().scoped_style(":hover *", "outline: 1px solid red;") as row:
366
- ui.label("Hello")
367
- ui.label("World")
368
-
369
- # all children of the element and itself will have red outline when element is hovered
370
- with rxui.row().scoped_style(":self:hover *", "outline: 1px solid red;") as row:
371
- ui.label("Hello")
372
- ui.label("World")
373
- ```
359
+
360
+ .. code-block:: python
361
+ # all children of the element will have red outline, excluding itself
362
+ with rxui.row().scoped_style("*", "outline: 1px solid red;") as row:
363
+ ui.label("Hello")
364
+ ui.label("World")
365
+
366
+ # all children of the element will have red outline, including the element itself
367
+ with rxui.row().scoped_style(":self *", "outline: 1px solid red;") as row:
368
+ ui.label("Hello")
369
+ ui.label("World")
370
+
371
+ # all children of the element will have red outline when element is hovered
372
+ with rxui.row().scoped_style(":hover *", "outline: 1px solid red;") as row:
373
+ ui.label("Hello")
374
+ ui.label("World")
375
+
376
+ # all children of the element and itself will have red outline when element is hovered
377
+ with rxui.row().scoped_style(":self:hover *", "outline: 1px solid red;") as row:
378
+ ui.label("Hello")
379
+ ui.label("World")
380
+
374
381
  """
375
382
 
376
383
  is_css_file = isinstance(style, Path)
@@ -20,8 +20,8 @@ class BackgroundColorableMixin(Protocol):
20
20
  def element(self) -> ui.element:
21
21
  ...
22
22
 
23
- def _bind_background_color(self, ref_ui: TGetterOrReadonlyRef[str]):
24
- @self._ui_signal_on(ref_ui) # type: ignore
23
+ def _bind_background_color(self, value: TGetterOrReadonlyRef[str]):
24
+ @self._ui_signal_on(value) # type: ignore
25
25
  def _(state: WatchedState):
26
26
  if state.previous is not None:
27
27
  color_system.remove_background_color(self.element, state.previous)
@@ -30,12 +30,12 @@ class BackgroundColorableMixin(Protocol):
30
30
 
31
31
  self.element.update()
32
32
 
33
- def bind_color(self, ref_ui: TGetterOrReadonlyRef[str]):
33
+ def bind_color(self, color: TGetterOrReadonlyRef[str]):
34
34
  """bind color to the element
35
35
 
36
36
  Args:
37
- ref_ui (TGetterOrReadonlyRef[str]): a reference to the color value
37
+ color (TGetterOrReadonlyRef[str]): a reference to the color value
38
38
 
39
39
  """
40
- self._bind_background_color(ref_ui)
40
+ self._bind_background_color(color)
41
41
  return self
@@ -25,20 +25,20 @@ class DisableableMixin(Protocol):
25
25
  def element(self) -> DisableableElement:
26
26
  ...
27
27
 
28
- def bind_enabled(self, ref_ui: TGetterOrReadonlyRef[bool]):
28
+ def bind_enabled(self, value: TGetterOrReadonlyRef[bool]):
29
29
  @self._ui_effect
30
30
  def _():
31
- value = to_value(ref_ui)
32
- self.element.set_enabled(value)
33
- self.element._handle_enabled_change(value)
31
+ raw_value = to_value(value)
32
+ self.element.set_enabled(raw_value)
33
+ self.element._handle_enabled_change(raw_value)
34
34
 
35
35
  return self
36
36
 
37
- def bind_disable(self, ref_ui: TGetterOrReadonlyRef[bool]):
37
+ def bind_disable(self, value: TGetterOrReadonlyRef[bool]):
38
38
  @self._ui_effect
39
39
  def _():
40
- value = not to_value(ref_ui)
41
- self.element.set_enabled(value)
42
- self.element._handle_enabled_change(value)
40
+ raw_value = not to_value(value)
41
+ self.element.set_enabled(raw_value)
42
+ self.element._handle_enabled_change(raw_value)
43
43
 
44
44
  return self
@@ -21,8 +21,8 @@ class TextColorableMixin(Protocol):
21
21
  def element(self) -> ui.element:
22
22
  ...
23
23
 
24
- def _bind_text_color(self, ref_ui: TGetterOrReadonlyRef[str]):
25
- @self._ui_signal_on(ref_ui) # type: ignore
24
+ def _bind_text_color(self, color: TGetterOrReadonlyRef[str]):
25
+ @self._ui_signal_on(color) # type: ignore
26
26
  def _(state: WatchedState):
27
27
  if state.previous is not None:
28
28
  color_system.remove_text_color(self.element, state.previous)
@@ -31,14 +31,14 @@ class TextColorableMixin(Protocol):
31
31
 
32
32
  self.element.update()
33
33
 
34
- def bind_color(self, ref_ui: TGetterOrReadonlyRef[str]):
34
+ def bind_color(self, color: TGetterOrReadonlyRef[str]):
35
35
  """bind text color to the element
36
36
 
37
37
  Args:
38
- ref_ui (TGetterOrReadonlyRef[str]): a reference to the color value
38
+ color (TGetterOrReadonlyRef[str]): a reference to the color value
39
39
 
40
40
  """
41
- self._bind_text_color(ref_ui)
41
+ self._bind_text_color(color)
42
42
  return self
43
43
 
44
44
 
@@ -52,15 +52,15 @@ class HtmlTextColorableMixin(Protocol):
52
52
  def bind_style(self, style: Dict[str, TGetterOrReadonlyRef[Any]]):
53
53
  ...
54
54
 
55
- def _bind_text_color(self, ref_ui: TGetterOrReadonlyRef[str]):
56
- return self.bind_style({"color": ref_ui})
55
+ def _bind_text_color(self, value: TGetterOrReadonlyRef[str]):
56
+ return self.bind_style({"color": value})
57
57
 
58
- def bind_color(self, ref_ui: TGetterOrReadonlyRef[str]):
58
+ def bind_color(self, color: TGetterOrReadonlyRef[str]):
59
59
  """bind text color to the element
60
60
 
61
61
  Args:
62
- ref_ui (TGetterOrReadonlyRef[str]): a reference to the color value
62
+ color (TGetterOrReadonlyRef[str]): a reference to the color value
63
63
 
64
64
  """
65
- self._bind_text_color(ref_ui)
65
+ self._bind_text_color(color)
66
66
  return self
@@ -78,17 +78,17 @@ class AggridBindableUi(BindableUi[ui.aggrid]):
78
78
  options = {"columnDefs": columnDefs, "rowData": rowData}
79
79
  return cls(options, **org_kws)
80
80
 
81
- def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef[Any]):
81
+ def bind_prop(self, prop: str, value: TGetterOrReadonlyRef[Any]):
82
82
  if prop == "options":
83
- return self.bind_options(ref_ui)
83
+ return self.bind_options(value)
84
84
 
85
- return super().bind_prop(prop, ref_ui)
85
+ return super().bind_prop(prop, value)
86
86
 
87
- def bind_options(self, ref_ui: TGetterOrReadonlyRef[List[Dict]]):
87
+ def bind_options(self, options: TGetterOrReadonlyRef[List[Dict]]):
88
88
  @self._ui_effect
89
89
  def _():
90
90
  ele = self.element
91
- data = to_value(ref_ui)
91
+ data = to_value(options)
92
92
  ele._props["options"].update(data)
93
93
  ele.update()
94
94
 
@@ -44,50 +44,50 @@ class ButtonBindableUi(
44
44
  for key, value in pc.get_bindings().items():
45
45
  self.bind_prop(key, value) # type: ignore
46
46
 
47
- def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
47
+ def bind_prop(self, prop: str, value: TGetterOrReadonlyRef):
48
48
  if prop == "text":
49
- return self.bind_text(ref_ui)
49
+ return self.bind_text(value)
50
50
  if prop == "icon":
51
- return self.bind_icon(ref_ui)
51
+ return self.bind_icon(value)
52
52
  if prop == "color":
53
- return self.bind_color(ref_ui)
53
+ return self.bind_color(value)
54
54
 
55
- return super().bind_prop(prop, ref_ui)
55
+ return super().bind_prop(prop, value)
56
56
 
57
- def bind_color(self, ref_ui: TGetterOrReadonlyRef[str]):
57
+ def bind_color(self, color: TGetterOrReadonlyRef[str]):
58
58
  """Binds the background color of the button.
59
59
 
60
60
  Args:
61
- ref_ui (TGetterOrReadonlyRef[str]): Getter or readonly reference to the color.
61
+ color (TGetterOrReadonlyRef[str]): Getter or readonly reference to the color.
62
62
 
63
63
  """
64
- BackgroundColorableMixin.bind_color(self, ref_ui)
64
+ BackgroundColorableMixin.bind_color(self, color)
65
65
  return self
66
66
 
67
- def bind_text_color(self, ref_ui: TGetterOrReadonlyRef[str]):
67
+ def bind_text_color(self, text_color: TGetterOrReadonlyRef[str]):
68
68
  """Binds the text color of the button.
69
69
 
70
70
  Args:
71
- ref_ui (TGetterOrReadonlyRef[str]): Getter or readonly reference to the color.
71
+ text_color (TGetterOrReadonlyRef[str]): Getter or readonly reference to the color.
72
72
 
73
73
  """
74
- TextColorableMixin.bind_color(self, ref_ui)
74
+ TextColorableMixin.bind_color(self, text_color)
75
75
  return self
76
76
 
77
- def bind_text(self, ref_ui: TGetterOrReadonlyRef):
77
+ def bind_text(self, text: TGetterOrReadonlyRef):
78
78
  @self._ui_effect
79
79
  def _():
80
80
  ele = self.element
81
- ele._props["label"] = to_value(ref_ui)
81
+ ele._props["label"] = to_value(text)
82
82
  ele.update()
83
83
 
84
84
  return self
85
85
 
86
- def bind_icon(self, ref_ui: TGetterOrReadonlyRef[str]):
86
+ def bind_icon(self, icon: TGetterOrReadonlyRef[str]):
87
87
  @self._ui_effect
88
88
  def _():
89
89
  ele = self.element
90
- ele._props["icon"] = to_value(ref_ui)
90
+ ele._props["icon"] = to_value(icon)
91
91
  ele.update()
92
92
 
93
93
  return self
@@ -43,16 +43,16 @@ class CheckboxBindableUi(BindableUi[ui.checkbox], DisableableMixin):
43
43
  def value(self):
44
44
  return self.element.value
45
45
 
46
- def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
46
+ def bind_prop(self, prop: str, value: TGetterOrReadonlyRef):
47
47
  if prop == "value":
48
- return self.bind_value(ref_ui)
48
+ return self.bind_value(value)
49
49
 
50
- return super().bind_prop(prop, ref_ui)
50
+ return super().bind_prop(prop, value)
51
51
 
52
- def bind_value(self, ref_ui: TGetterOrReadonlyRef[bool]):
52
+ def bind_value(self, value: TGetterOrReadonlyRef[bool]):
53
53
  @self._ui_effect
54
54
  def _():
55
- self.element.set_value(to_value(ref_ui))
55
+ self.element.set_value(to_value(value))
56
56
  self.element.update()
57
57
 
58
58
  return self
@@ -54,16 +54,16 @@ class ChipBindableUi(
54
54
  def text(self):
55
55
  return self.element.text
56
56
 
57
- def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
57
+ def bind_prop(self, prop: str, value: TGetterOrReadonlyRef):
58
58
  if prop == "text":
59
- return self.bind_text(ref_ui)
59
+ return self.bind_text(value)
60
60
 
61
61
  if prop == "color":
62
- return self.bind_color(ref_ui)
62
+ return self.bind_color(value)
63
63
  if prop == "text-color":
64
- return self.bind_text_color(ref_ui)
64
+ return self.bind_text_color(value)
65
65
 
66
- return super().bind_prop(prop, ref_ui)
66
+ return super().bind_prop(prop, value)
67
67
 
68
68
  def bind_color(self, color: TGetterOrReadonlyRef):
69
69
  """Binds the background color property of the chip to a ui element.
@@ -49,17 +49,17 @@ class CircularProgressBindableUi(
49
49
  def value(self):
50
50
  return self.element.value
51
51
 
52
- def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
52
+ def bind_prop(self, prop: str, value: TGetterOrReadonlyRef):
53
53
  if prop == "value":
54
- return self.bind_value(ref_ui)
54
+ return self.bind_value(value)
55
55
  if prop == "color":
56
- return self.bind_color(ref_ui)
56
+ return self.bind_color(value)
57
57
 
58
- return super().bind_prop(prop, ref_ui)
58
+ return super().bind_prop(prop, value)
59
59
 
60
- def bind_value(self, ref_ui: TGetterOrReadonlyRef[float]):
60
+ def bind_value(self, value: TGetterOrReadonlyRef[float]):
61
61
  @self._ui_effect
62
62
  def _():
63
- self.element.set_value(to_value(ref_ui))
63
+ self.element.set_value(to_value(value))
64
64
 
65
65
  return self