instaui 0.1.16__py2.py3-none-any.whl → 0.1.17__py2.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.
instaui/vars/ref.py CHANGED
@@ -37,13 +37,16 @@ class Ref(
37
37
  ):
38
38
  VAR_TYPE = "var"
39
39
 
40
- def __init__(self, value: Optional[_T_Value] = None) -> None:
40
+ def __init__(
41
+ self, value: Optional[_T_Value] = None, *, deep_compare: bool = False
42
+ ) -> None:
41
43
  self.value = value # type: ignore
42
44
  scope = get_current_scope()
43
45
  scope.register_ref(self)
44
46
 
45
47
  self._sid = scope.id
46
48
  self._id = scope.generate_vars_id()
49
+ self._deep_compare = deep_compare
47
50
  self._debounced = None
48
51
 
49
52
  def debounced(self, secounds: float):
@@ -83,6 +86,9 @@ class Ref(
83
86
  if self._debounced is not None:
84
87
  data["debounced"] = self._debounced
85
88
 
89
+ if self._deep_compare is True:
90
+ data["deepCompare"] = True
91
+
86
92
  return data
87
93
 
88
94
 
@@ -90,14 +96,18 @@ TRef = Ref
90
96
 
91
97
 
92
98
  @overload
93
- def ref(value: Ref[_T_Value]) -> Ref[_T_Value]: ...
99
+ def ref(value: Ref[_T_Value], *, deep_compare: bool = False) -> Ref[_T_Value]: ...
94
100
 
95
101
 
96
102
  @overload
97
- def ref(value: Optional[_T_Value] = None) -> Ref[_T_Value]: ...
103
+ def ref(
104
+ value: Optional[_T_Value] = None, *, deep_compare: bool = False
105
+ ) -> Ref[_T_Value]: ...
98
106
 
99
107
 
100
- def ref(value: Union[Ref[_T_Value], _T_Value, None] = None):
108
+ def ref(
109
+ value: Union[Ref[_T_Value], _T_Value, None] = None, *, deep_compare: bool = False
110
+ ):
101
111
  if isinstance(value, Ref):
102
112
  return value
103
- return Ref(value)
113
+ return Ref(value, deep_compare=deep_compare)
instaui/vars/state.py CHANGED
@@ -25,9 +25,9 @@ class RefProxy(
25
25
  ElementBindingMixin,
26
26
  Jsonable,
27
27
  ):
28
- def __init__(self, instance: BaseModel) -> None:
28
+ def __init__(self, instance: BaseModel, *, deep_compare: bool = False) -> None:
29
29
  data = instance.model_dump()
30
- self._ref_ = ui.ref(data)
30
+ self._ref_ = ui.ref(data, deep_compare=deep_compare)
31
31
  self._prop_names_ = set(data.keys()) if isinstance(data, dict) else set()
32
32
 
33
33
  def __getattribute__(self, name):
@@ -77,7 +77,7 @@ class StateModel(BaseModel, Jsonable):
77
77
  return self.model_dump()
78
78
 
79
79
 
80
- def state(value: _T) -> _T:
80
+ def state(value: _T, *, deep_compare: bool = False) -> _T:
81
81
  """
82
82
  Creates a reactive state object that tracks changes and notifies dependencies.
83
83
 
@@ -93,5 +93,5 @@ def state(value: _T) -> _T:
93
93
  html.number(count)
94
94
  ui.label(count)
95
95
  """
96
- obj = RefProxy(_ProxyModel(value)) # type: ignore
96
+ obj = RefProxy(_ProxyModel(value), deep_compare=deep_compare) # type: ignore
97
97
  return obj # type: ignore
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: instaui
3
- Version: 0.1.16
3
+ Version: 0.1.17
4
4
  Summary: insta-ui is a Python-based UI library for rapidly building user interfaces.
5
5
  Author-email: CrystalWindSnake <568166495@qq.com>
6
6
  License-Expression: MIT
@@ -133,7 +133,7 @@ instaui/components/html/li.py,sha256=2IS8eudUX4McHjyxT1SOu91xviC2D1NNdYKLjznZ-IA
133
133
  instaui/components/html/link.py,sha256=eNC2f-twFZUhw_rL-Ggff2Lo8NRU33oF8CfWW_9-ktI,670
134
134
  instaui/components/html/number.py,sha256=Y2oIzTMHKWMWpufG55tFz0npEoEFvLhTWpZbMJ8J07s,1069
135
135
  instaui/components/html/paragraph.py,sha256=TNMtI9dyQb6hYKE5vGAsSXiOiEqkx7BM6CEoJrg6nz8,914
136
- instaui/components/html/radio.py,sha256=4-u-9tCe5372zDJWPs3-BDC-xpaKUDbdPQmcbThMyeI,1020
136
+ instaui/components/html/radio.py,sha256=yZxwLnzWhDMn8D_z98aVuXpQR-FO6q8zeUa80Ut8wig,1013
137
137
  instaui/components/html/range.py,sha256=cLGoo3QaARG9YDnh6g3UYtc1yueI5dfMa9-4e-feSn4,1644
138
138
  instaui/components/html/select.py,sha256=Bq6mwyKa1qAk7bZiHK0uOg65W2twz4QkcJQTjvFNDP4,2029
139
139
  instaui/components/html/span.py,sha256=RJnccwnYEh8PUZ36VTBCKzBNV74M3SMohAejb0ck0UI,440
@@ -211,9 +211,9 @@ instaui/spa_router/_router_param_var.py,sha256=KCy54xBZxGMqLO3Zlbzr6XV8ts-M6jCOK
211
211
  instaui/spa_router/_types.py,sha256=KuGuv5C6qivwllfdmV5qrvM0S_GWJ6u8OOTkCNmJImU,81
212
212
  instaui/spa_router/templates/page_routes,sha256=8VjM_8f6pjFb01QbU9z5HNqpcNRdCiX3X0OqNHLq8fo,1355
213
213
  instaui/static/insta-ui.css,sha256=EFA-_5bytZzwbe9w_kaAskE-bpdtwKbBRAyS4iw7NvU,292
214
- instaui/static/insta-ui.esm-browser.prod.js,sha256=vOYJmB8XMhjNCilar1qXOsjkwoCOVrSw5fsjbQsjYGY,109896
214
+ instaui/static/insta-ui.esm-browser.prod.js,sha256=03mpt5Q9ltVW5AHGgXjJpsE83-xXj-ZZYwINcF0gpzk,109952
215
215
  instaui/static/insta-ui.ico,sha256=08FJg4qWolvOjfodoh8IJLStslrvd8sDyuRcTUDq5ak,1150
216
- instaui/static/insta-ui.js.map,sha256=cuplnJd5ozaVPCO2Flbf30hmuUJLIk0mo4cu2mMb7Lg,664019
216
+ instaui/static/insta-ui.js.map,sha256=c9H_5BPV7SSjK1RHxWAc2TKYx0pFFbLcw08VRrCqu-U,664247
217
217
  instaui/static/instaui-tools-browser.js,sha256=cLHKNXYaYMZriMxV-yKGAHTrHSdNRUlDVZmv6uc6mMw,14455
218
218
  instaui/static/vue.esm-browser.prod.js,sha256=vwQkXANuVYQuEFc0VgiokJdhNyMmvxMKyb1FmrYrNb4,162662
219
219
  instaui/static/vue.global.prod.js,sha256=YO-UVLcXWjFOKfGU2uRrIMYpliGY2y48OmEjV464Z7M,157933
@@ -253,9 +253,9 @@ instaui/vars/event_context.py,sha256=3ML6nyF6Q1hbFvdeu6E2QVOIVcWe1P9FtlCR0dgBGjo
253
253
  instaui/vars/event_extend.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
254
254
  instaui/vars/js_computed.py,sha256=HjBbSeKCOYExJ2xwhklouG8bawlXW4JNvJZjDaE4CWg,3972
255
255
  instaui/vars/path_var.py,sha256=znIvxaNHwQzXflEqwB2xjrI7Bk5_QjwYlhdl4qvtyws,2811
256
- instaui/vars/ref.py,sha256=iMwKRYI8ygy2cOpXJgqUYJCpzJCQskDl4lRYTACZWnA,2567
256
+ instaui/vars/ref.py,sha256=01MwULr6LYgVaOulLOBaGaN9XbSg5b0DO0p_R3rLhCQ,2875
257
257
  instaui/vars/slot_prop.py,sha256=qBVQ0Ze0T8-Wsy__8qEuqVESIrLX69Bmy21Kuxrg_GQ,1198
258
- instaui/vars/state.py,sha256=MuiCzR9n348P1J7qdCfFXXratwuOOGELLzg8pu9G6kE,3074
258
+ instaui/vars/state.py,sha256=x6qeTliE1J7qoFmAG7huJ-sNQ4VcFgy0IlJoNodqRe0,3190
259
259
  instaui/vars/types.py,sha256=K0QTajlzHaDvFoVMCHAhY_rVvrBm3FsC92BFPOgdBog,511
260
260
  instaui/vars/vfor_item.py,sha256=cVrpErh8OrycYjDLm7PTuE2kIcC2M6ThAQlwvTXG8x0,5490
261
261
  instaui/vars/vue_computed.py,sha256=bWMlnjKf9pFYX9IrXtSzUZy4A7P4zABeDXUi4fvqnnI,2818
@@ -282,7 +282,7 @@ instaui/webview/resource.py,sha256=kFT6N5UZK5GLE0KmW3TrEYDNlViw9DL2OshRh41wBXs,5
282
282
  instaui/zero/__init__.py,sha256=N0LuRUAcaurxHSspcEDuwZg62W2S3qL4VtrMKxOivBE,49
283
283
  instaui/zero/func.py,sha256=8cA_wJMtRmoAARjWY8yY5MmLXDAQ7hyVW6f1Vbejtoc,3576
284
284
  instaui/zero/scope.py,sha256=HGohYOqnpRGVkkoz_gvR6-DgCc48AtJAcDwbOnnGHLM,3753
285
- instaui-0.1.16.dist-info/METADATA,sha256=r5ViXqPm5_kLMHKBc6N2MhiwZlODJhOBRtSTVgDWSJ0,3562
286
- instaui-0.1.16.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
287
- instaui-0.1.16.dist-info/licenses/LICENSE,sha256=_JjnAWrikJ6qkwT7PazeFNRlcIu8q_RH3mYcHTxEF5c,1094
288
- instaui-0.1.16.dist-info/RECORD,,
285
+ instaui-0.1.17.dist-info/METADATA,sha256=rCiN5ssW1cIw_eNgbt6JzB1cKlI1qcFE_8aR2I5YmO8,3562
286
+ instaui-0.1.17.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
287
+ instaui-0.1.17.dist-info/licenses/LICENSE,sha256=_JjnAWrikJ6qkwT7PazeFNRlcIu8q_RH3mYcHTxEF5c,1094
288
+ instaui-0.1.17.dist-info/RECORD,,