instaui 0.1.19__py2.py3-none-any.whl → 0.2.0__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.
@@ -24,8 +24,8 @@
24
24
  <body>
25
25
  {{ sse_html(model.is_debug) }}
26
26
 
27
- <div id="app">
28
- <insta-ui :config="config"></insta-ui>
27
+ <div id="app">
28
+ <insta-ui :config="config" :meta="meta"></insta-ui>
29
29
  </div>
30
30
 
31
31
  <script type="importmap">
@@ -52,11 +52,13 @@
52
52
  const None = undefined;
53
53
 
54
54
  const appConfig = {{model.config_dict | safe}};
55
+ const meta = {mode: 'web',version:'{{model.version | safe}}',debug:{{model.is_debug}}}
55
56
 
56
57
  const app = createApp({
57
58
  setup() {
58
59
  return {
59
- config:appConfig
60
+ config:appConfig,
61
+ meta,
60
62
  }
61
63
  }
62
64
  })
@@ -23,7 +23,7 @@
23
23
  <body>
24
24
 
25
25
  <div id="app">
26
- <insta-ui :config="config"></insta-ui>
26
+ <insta-ui :config="config" :meta="meta"></insta-ui>
27
27
  </div>
28
28
 
29
29
  <script type="importmap">
@@ -49,6 +49,7 @@
49
49
  const None = undefined;
50
50
 
51
51
  const appConfig = {{model.config_dict | safe}};
52
+ const meta = {mode: 'webview',version:'{{model.version | safe}}'}
52
53
 
53
54
  window.addEventListener('pywebviewready',async () => {
54
55
  const app = createApp({
@@ -59,7 +60,8 @@
59
60
  {% endif %}
60
61
  setup() {
61
62
  return {
62
- config:appConfig
63
+ config:appConfig,
64
+ meta,
63
65
  }
64
66
  }
65
67
  })
@@ -23,7 +23,7 @@
23
23
  <body>
24
24
 
25
25
  <div id="app">
26
- <insta-ui :config="config"></insta-ui>
26
+ <insta-ui :config="config" :meta="meta"></insta-ui>
27
27
  </div>
28
28
 
29
29
  <script type="importmap">
@@ -49,11 +49,13 @@
49
49
  const None = undefined;
50
50
 
51
51
  const appConfig = {{model.config_dict | safe}};
52
+ const meta = {mode: 'zero',version:'{{model.version | safe}}',debug:true}
52
53
 
53
54
  const app = createApp({
54
55
  setup() {
55
56
  return {
56
- config:appConfig
57
+ config:appConfig,
58
+ meta,
57
59
  }
58
60
  }
59
61
  })
@@ -12,6 +12,7 @@ _html_template = env.get_template("web.html")
12
12
 
13
13
  @dataclass
14
14
  class WebTemplateModel:
15
+ version: str
15
16
  vue_js_link: str
16
17
  instaui_js_link: str
17
18
  config_dict: typing.Dict[str, typing.Any] = field(default_factory=dict)
@@ -16,6 +16,7 @@ class WebViewVueAppComponent:
16
16
 
17
17
  @dataclass
18
18
  class WebViewTemplateModel:
19
+ version: str
19
20
  vue_js_code: str
20
21
  instaui_js_code: str
21
22
  config_dict: typing.Dict[str, typing.Any] = field(default_factory=dict)
@@ -24,6 +24,7 @@ class ZeroVueAppComponent:
24
24
 
25
25
  @dataclass
26
26
  class ZeroTemplateModel:
27
+ version: str
27
28
  vue_js_code: _TCodeOrPath
28
29
  instaui_js_code: _TCodeOrPath
29
30
  config_dict: typing.Dict[str, typing.Any] = field(default_factory=dict)
instaui/ui/__init__.py CHANGED
@@ -61,6 +61,7 @@ __all__ = [
61
61
  "experimental",
62
62
  "skip_output",
63
63
  "str_format",
64
+ "pre_setup_action",
64
65
  "on_page_request_lifespan",
65
66
  "webview",
66
67
  "code",
@@ -132,6 +133,7 @@ from instaui.ui_functions.ui_types import TBindable, is_bindable
132
133
  from .events import on_page_request_lifespan
133
134
  from instaui.extra_libs._import_error import show_error # noqa: E402, F401
134
135
  from instaui.js.fn import JsFn as js_fn
136
+ from instaui.pre_setup import PreSetupAction as pre_setup_action
135
137
 
136
138
  # -- dynamic imports
137
139
  from instaui.systems.module_system import LazyModule as _LazyModule
instaui/ui/__init__.pyi CHANGED
@@ -61,6 +61,7 @@ __all__ = [
61
61
  "experimental",
62
62
  "skip_output",
63
63
  "str_format",
64
+ "pre_setup_action",
64
65
  "on_page_request_lifespan",
65
66
  "webview",
66
67
  "code",
@@ -132,6 +133,7 @@ from instaui.ui_functions.ui_types import TBindable, is_bindable
132
133
  from .events import on_page_request_lifespan
133
134
  from instaui.extra_libs._import_error import show_error # noqa: E402, F401
134
135
  from instaui.js.fn import JsFn as js_fn
136
+ from instaui.pre_setup import PreSetupAction as pre_setup_action
135
137
 
136
138
  # -- dynamic imports
137
139
  from instaui.components.markdown.markdown import Markdown as markdown
@@ -3,9 +3,18 @@ from instaui.runtime.context import get_context
3
3
 
4
4
 
5
5
  def create_server(
6
- debug: bool = True,
6
+ debug: bool = False,
7
7
  use_gzip: Union[int, bool] = True,
8
8
  ):
9
+ """
10
+ Create a new server instance.
11
+
12
+ Note: When deploy to production, you need to set `debug=False`
13
+
14
+ Args:
15
+ debug (bool): Whether to run in debug mode. In debug mode, it has the development hot-reload feature. Defaults to False.
16
+ use_gzip (Union[int, bool], optional): Whether to use gzip compression. If an integer is provided, it will be used as the minimum response size for compression. If True, the default minimum size of 500 bytes will be used. If False, compression will not be used. Defaults to True.
17
+ """
9
18
  from instaui.fastapi_server.server import Server
10
19
 
11
20
  context = get_context()
@@ -12,6 +12,7 @@ from instaui.handlers import watch_handler
12
12
  from instaui.vars.mixin_types.py_binding import CanOutputMixin
13
13
  from instaui.vars.mixin_types.common_type import TObservableInput
14
14
  from instaui._helper import observable_helper
15
+ from instaui import pre_setup as _pre_setup
15
16
 
16
17
  _SYNC_TYPE = "sync"
17
18
  _ASYNC_TYPE = "async"
@@ -30,8 +31,11 @@ class WebWatch(Jsonable, typing.Generic[P, R]):
30
31
  deep: typing.Union[bool, int] = True,
31
32
  once: bool = False,
32
33
  flush: typing.Optional[_types.TFlush] = None,
34
+ pre_setup: typing.Optional[typing.Dict] = None,
33
35
  _debug: typing.Optional[typing.Any] = None,
34
36
  ) -> None:
37
+ if pre_setup:
38
+ _pre_setup._check_args(pre_setup)
35
39
  inputs = observable_helper.auto_made_inputs_to_slient(inputs, outputs)
36
40
 
37
41
  get_current_scope().register_web_watch(self)
@@ -47,6 +51,7 @@ class WebWatch(Jsonable, typing.Generic[P, R]):
47
51
  self._once = once
48
52
  self._flush = flush
49
53
  self._debug = _debug
54
+ self._pre_setup = pre_setup
50
55
 
51
56
  def __call__(self, *args: P.args, **kwargs: P.kwargs) -> R:
52
57
  return self._fn(*args, **kwargs)
@@ -93,6 +98,8 @@ class WebWatch(Jsonable, typing.Generic[P, R]):
93
98
  data["once"] = self._once
94
99
  if self._flush is not None:
95
100
  data["flush"] = self._flush
101
+ if self._pre_setup:
102
+ data["preSetup"] = _pre_setup.convert_config(self._pre_setup)
96
103
 
97
104
  return data
98
105
 
@@ -107,6 +114,7 @@ def watch(
107
114
  deep: typing.Union[bool, int] = True,
108
115
  once: bool = False,
109
116
  flush: typing.Optional[_types.TFlush] = None,
117
+ pre_setup: typing.Optional[typing.Dict] = None,
110
118
  _debug: typing.Optional[typing.Any] = None,
111
119
  ):
112
120
  """
@@ -128,6 +136,8 @@ def watch(
128
136
  - 'sync': Execute immediately on change
129
137
  - 'post': Batch updates and execute after current tick
130
138
  - 'pre': Execute before render phase (if applicable)
139
+ pre_setup (typing.Optional[typing.Dict], optional): A dictionary of pre-setup actions to be executed before the event executes.
140
+
131
141
 
132
142
  # Example:
133
143
  .. code-block:: python
@@ -169,6 +179,7 @@ def watch(
169
179
  deep=deep,
170
180
  once=once,
171
181
  flush=flush,
182
+ pre_setup=pre_setup,
172
183
  _debug=_debug,
173
184
  )
174
185
 
@@ -5,6 +5,7 @@ import shutil
5
5
  from typing import Callable, Optional
6
6
  from urllib.parse import quote
7
7
 
8
+ from instaui.version import __version__ as _INSTAUI_VERSION
8
9
  from instaui.html_tools import to_config_data
9
10
  from instaui.runtime._app import get_app_slot, get_default_app_slot
10
11
  from instaui.systems import file_system
@@ -48,6 +49,7 @@ def resource_to_assets(
48
49
  favicon_url = file_to_assets(consts.FAVICON_PATH)
49
50
 
50
51
  model = webview_template.WebViewTemplateModel(
52
+ version=_INSTAUI_VERSION,
51
53
  vue_js_code=file_to_assets(consts.VUE_ES_JS_PATH),
52
54
  instaui_js_code=file_to_assets(consts.APP_ES_JS_PATH),
53
55
  css_links=[
instaui/zero/func.py CHANGED
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
  import itertools
3
3
  from pathlib import Path
4
+ from instaui.version import __version__ as _INSTA_VERSION
4
5
  import instaui.consts as consts
5
6
  from instaui.runtime._app import get_app_slot, get_default_app_slot
6
7
  from instaui.template import render_zero_html
@@ -37,6 +38,7 @@ def get_template_model():
37
38
  config_data = to_config_data()
38
39
 
39
40
  model = zero_template.ZeroTemplateModel(
41
+ version=_INSTA_VERSION,
40
42
  vue_js_code=consts.VUE_ES_JS_PATH,
41
43
  instaui_js_code=consts.APP_ES_JS_PATH,
42
44
  css_links=[
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: instaui
3
- Version: 0.1.19
3
+ Version: 0.2.0
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
@@ -91,7 +91,8 @@ def home():
91
91
  ui.label("=")
92
92
  ui.label(result).style({"color": text_color})
93
93
 
94
- ui.server().run()
94
+ # when you deploy your web application, you need to set debug=False.
95
+ ui.server(debug=True).run()
95
96
  ```
96
97
 
97
98
  Replace `ui.server().run()` with `ui.webview().run()` to switch to Web View mode:
@@ -99,7 +100,7 @@ Replace `ui.server().run()` with `ui.webview().run()` to switch to Web View mode
99
100
  ```python
100
101
  ...
101
102
 
102
- # ui.server().run()
103
+ # ui.server(debug=True).run()
103
104
  ui.webview().run()
104
105
  ```
105
106
 
@@ -5,6 +5,7 @@ instaui/html_tools.py,sha256=VJDnOdPPDzXi_u6bMj5_fqdFjGXG3-HgXQsvD0gfauc,2577
5
5
  instaui/inject.py,sha256=NeTcsxoPdo12kZCvGjFU9NNHsVWnsPJfIcNY5_sPGYc,727
6
6
  instaui/launch_collector.py,sha256=_YmF3hsNWe-ZxMp_amqUBHkhB6fOuTPfX16BVwn25xg,1731
7
7
  instaui/page_info.py,sha256=aJtfLp2h05tCuLzxk2pZ6a9ztyxSdI-g3NBRxbqpS6E,269
8
+ instaui/pre_setup.py,sha256=oSwbkOkxkjLS1qP7mU4nY4S7UPXPk0Tdik2tY6WGnZY,1350
8
9
  instaui/skip.py,sha256=uqhqusgeChVoivKFMoZd-XePYrlSoLvUzRZDBcUgFmA,149
9
10
  instaui/version.py,sha256=to8l16EjNe4jmzK316s5ZIotjv554tqF0VfwA1tBhQk,87
10
11
  instaui/_helper/observable_helper.py,sha256=U30PmA8jZ9q48GI_FMNPRYUTKNdl4SsMTAFoq94eRFs,1447
@@ -105,13 +106,14 @@ instaui/arco/static/instaui-arco.js,sha256=PktbvZE6yids2NyfSKo81g--fCo-AiNEdOgvv
105
106
  instaui/common/jsonable.py,sha256=efzn_IvfrsaNKjc3B3UzshoMvsqSsB-jnD2Aia8YMYM,902
106
107
  instaui/components/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
107
108
  instaui/components/column.py,sha256=t_kDAelb-5_aqx4hv19sOm8zcQpRmn-slTMcwZfMOLk,848
108
- instaui/components/component.py,sha256=cfKWlhxATdvERSzsVzvLtm61f72_gblhLJXIrXLGQrk,1284
109
+ instaui/components/component.py,sha256=-wRHA159i6LYC3Lw3wOZRUpaqbKn9WPw0r8wljyaZgI,1250
109
110
  instaui/components/content.py,sha256=f6dm0GukYJk4RRNJzuvOGqBrStLWkJQbLkV7M5fJ63k,1094
110
111
  instaui/components/directive.py,sha256=bHSOWXNhzWRVNqLXwhc_hY3R3g-JAQ5DWIqpZkI6_wI,1411
111
112
  instaui/components/element.py,sha256=XS87h5oWYcye1S2omEDw6uPj4i-RREEI7gIJNDgUbOg,17122
112
113
  instaui/components/grid.py,sha256=h9Lzxqiw4HB-8VG2JGHVz-KGn4bHTtsibtUb8UCgHO4,7529
113
114
  instaui/components/label.py,sha256=Fp7malMB2i6MjJjZnxdIl2tg6rb33-1PdgxEhGecoTM,118
114
115
  instaui/components/match.py,sha256=rQ74OV9V5rJvK8taHfpD-VDPXF0raxvNKjD_5nWnjXM,2778
116
+ instaui/components/mixins.py,sha256=4AMZU_9uf9daV0bKS28opZRRM5_Bp89yNLQ_dhpDCTo,350
115
117
  instaui/components/row.py,sha256=c0dxJwt955EF7PXlrFpqIoQNZ59tJm-UvZlx_zjeuBg,570
116
118
  instaui/components/slot.py,sha256=RT0eU7wH7ffFDkl5ucfrNXB1nbsKDq688Hp920TZaoo,2287
117
119
  instaui/components/transition_group.py,sha256=H9zx9NTlCoQnBArWfmxmh7CMKb5hZn8vKrFe4OFxPrE,201
@@ -121,13 +123,13 @@ instaui/components/vif.py,sha256=vn-tZ_ejVm5S5NjR1s9HPVCRXKPbi-tAzUBkz4PTdxs,123
121
123
  instaui/components/html/__init__.py,sha256=B1BDIbeHexH3dEg1Gwx3HwZgR0JnxWhNcNlVUp5VeE4,1137
122
124
  instaui/components/html/_mixins.py,sha256=5dcSM9h1PswIKL6_eiqUxqW4H2OCuyNeCuRZq3gDGOc,876
123
125
  instaui/components/html/_preset.py,sha256=c5rTj3r8W7UP0UHFLUW-ZSPedIa-gzrsU1goi60l20Q,94
124
- instaui/components/html/button.py,sha256=lB5SYC2Q8b3dOHLBclJW8yaWBuhoe0qNhpKeEifRDJc,820
126
+ instaui/components/html/button.py,sha256=fNxAAjn5Wyf9PWYs7imFO7YekdTAyl7Fq5ct9tTchy4,892
125
127
  instaui/components/html/checkbox.py,sha256=29BTpovcJvrN2uQY280dn8KTyspwBBvLeKSxUv3CxjU,1066
126
128
  instaui/components/html/date.py,sha256=MOodsG83JDtb_8l26QWRb7taiPHUAJI6wjt_AjSAJT0,833
127
129
  instaui/components/html/div.py,sha256=fF9rBlOBIl-tDvml1DtJK9lFfFY0SBcP5bn36pluis4,167
128
130
  instaui/components/html/form.py,sha256=C-QVtwX18zH8ZuVK93weGwlRWfSyTGWY_CYIdGcaslU,169
129
131
  instaui/components/html/heading.py,sha256=nYGfUIJFNjeVV_RRwCRuEMblWAEZT-CjNX8eAmtbaaU,1260
130
- instaui/components/html/input.py,sha256=I9Sbl4THBQuCcaE2HulwD-Hz8Kh2v-rp-HEactlZZBs,894
132
+ instaui/components/html/input.py,sha256=2rQtXptHL2X7i4Ppyi-OnSs7NLiLOKY96xSQd8SEBAQ,966
131
133
  instaui/components/html/label.py,sha256=iJPI5HzTulEs-38hpNiSi_D4klpVx0WexsBtKGUcSC0,557
132
134
  instaui/components/html/li.py,sha256=2IS8eudUX4McHjyxT1SOu91xviC2D1NNdYKLjznZ-IA,416
133
135
  instaui/components/html/link.py,sha256=eNC2f-twFZUhw_rL-Ggff2Lo8NRU33oF8CfWW_9-ktI,670
@@ -135,10 +137,10 @@ instaui/components/html/number.py,sha256=Y2oIzTMHKWMWpufG55tFz0npEoEFvLhTWpZbMJ8
135
137
  instaui/components/html/paragraph.py,sha256=TNMtI9dyQb6hYKE5vGAsSXiOiEqkx7BM6CEoJrg6nz8,914
136
138
  instaui/components/html/radio.py,sha256=yZxwLnzWhDMn8D_z98aVuXpQR-FO6q8zeUa80Ut8wig,1013
137
139
  instaui/components/html/range.py,sha256=cLGoo3QaARG9YDnh6g3UYtc1yueI5dfMa9-4e-feSn4,1644
138
- instaui/components/html/select.py,sha256=Bq6mwyKa1qAk7bZiHK0uOg65W2twz4QkcJQTjvFNDP4,2029
140
+ instaui/components/html/select.py,sha256=C6LK6vZZsMgy5GZk2HvqG7XwfdXcycQLn043eUwogA4,2121
139
141
  instaui/components/html/span.py,sha256=RJnccwnYEh8PUZ36VTBCKzBNV74M3SMohAejb0ck0UI,440
140
142
  instaui/components/html/table.py,sha256=1n46pPOMKkFfEsHB0Qwep-ELShm-jeeCSOfznfY1mSc,1492
141
- instaui/components/html/textarea.py,sha256=EsVir5nOQDlf5hlmfdWfdfGv-owk-ajPJYOGCbzWVu4,900
143
+ instaui/components/html/textarea.py,sha256=Zx8r9fBz74_73-RGW5lWHXQvWkIjWiNAwXrcZtLs3Vw,972
142
144
  instaui/components/html/ul.py,sha256=YbP2kH0Utlwr194uvVlCNQk1Xfl-5O24nVsDHSM0dqg,545
143
145
  instaui/components/markdown/markdown.js,sha256=ZlwxvQJ_0Fq1R-j-unfQTWMRswJ8GsYgLvd-wxVISGc,682
144
146
  instaui/components/markdown/markdown.py,sha256=2_ECsZPJ2P5hdP5-Kna0KwoFtHEzk8hgtTZ9rPX5Mds,978
@@ -163,7 +165,7 @@ instaui/dependencies/plugin_dependency.py,sha256=6u562ihKbiL3DE4hBrGjauS2nzYEC2g
163
165
  instaui/event/event_mixin.py,sha256=cN0Wh95e1wX183mGnGFm8BK_aEHWJ8WNx3Upy75mU_4,286
164
166
  instaui/event/js_event.py,sha256=CGegLXP3QldJp0jN-lNY0XSG8fLuaitFqKkgGEfI7yE,2868
165
167
  instaui/event/vue_event.py,sha256=NRwEcAromivjyPtgMq5SEqHqx8GEc1OJZsRL2Nj43RY,2187
166
- instaui/event/web_event.py,sha256=sojugqfXyF0q4gDCQsVjcfdBcuELVGeucZveFTDno10,3607
168
+ instaui/event/web_event.py,sha256=PyqOqp8DFf5qf6OJ-qPEHiwTvKQ6qDhg4WFSlM_4YGo,4452
167
169
  instaui/experimental/__init__.py,sha256=nKvudMaBaDsxflSZQ00ck8Cc4hmrF0f6Xzs4mhIYa08,75
168
170
  instaui/experimental/debug.py,sha256=UGUWgNZ3ShanpuxfuPdx52TgQrkO9hByABYMnPZEIiE,1325
169
171
  instaui/extra_libs/_echarts.py,sha256=HCF4mxmzVyKRtxHuehiqf7kmBq7G14_dc2m9XQEM-fQ,78
@@ -175,17 +177,17 @@ instaui/fastapi_server/_uvicorn.py,sha256=n-es5ajWepXb6xF9EP0ft2lrEbsyLGWMUE7uVq
175
177
  instaui/fastapi_server/debug_mode_router.py,sha256=EcYtPxI4FMnUqZcn-CZhZiMLgciHVNZpSRfiSIDRChc,1547
176
178
  instaui/fastapi_server/dependency_router.py,sha256=KZISD-0N1a40uXEsjOYlMTOJbItJ4Nyyb5W1VxXvOBA,898
177
179
  instaui/fastapi_server/event_router.py,sha256=_b0UNaPiwGwk7ElcF7XQnZfraPyWG2Miv9-wg-RI-PU,1648
178
- instaui/fastapi_server/middlewares.py,sha256=XyXjdGjH5hJ47ZK8EBeOln4Db1rfRijZpEGl3xmYQqU,643
180
+ instaui/fastapi_server/middlewares.py,sha256=IXxTG12P58FS5m5m4ocLcUFizDVs1CR61z22nwMH8AI,1096
179
181
  instaui/fastapi_server/request_context.py,sha256=EV5ZG4zgI_NPlTxinqO4AIREj6rbb1-HcjKCMa2Unfs,521
180
182
  instaui/fastapi_server/resource.py,sha256=2788yiuRjE3GRLqyukuL-x6qN0TSUNzNCm6S51ulNTk,887
181
- instaui/fastapi_server/server.py,sha256=6NvpWg6CkCjGK21-Pj1WDLI3YjA0nBBNS2v2_vPPiyc,9892
183
+ instaui/fastapi_server/server.py,sha256=ENBZeSFif4EJAeRK1WXftdW40M6YbIGYy9k3WZs1rm8,10109
182
184
  instaui/fastapi_server/watch_router.py,sha256=KC8AbGNpH2x11PHQMPgc9N5WOlqW05i6r0PTU5A35rI,1599
183
185
  instaui/handlers/_utils.py,sha256=uO7WgbNhrykJwDwSEXQxsqsuCR37nx8ehL_urXm-Tks,2830
184
186
  instaui/handlers/event_handler.py,sha256=hjxi_nDh0yjk9EmRgew1USXk-Egd4pR8YnUiOcJbbnc,1761
185
187
  instaui/handlers/watch_handler.py,sha256=Ay4lubEdRnZcWSqWLwxQyS_uWiF0gu-E9PrNGCAHvL0,1600
186
- instaui/js/fn.py,sha256=3y5nQvEjQtsaFYfTcS1-1v5b4bM20NLkk0HFl_3fewE,1186
188
+ instaui/js/fn.py,sha256=sTB1OONh1PgbkFaiuhIjBxkZy6JT0cgmXabFuOznrfM,1359
187
189
  instaui/runtime/__init__.py,sha256=4aYTDsKaloRMQns8ttdfSx5xLmcN0Ot6tMqELbjIDZg,667
188
- instaui/runtime/_app.py,sha256=xT1KirhO5NuJrv0w_voDDugNnOk1NtCSyuP86jt6ptI,7704
190
+ instaui/runtime/_app.py,sha256=8KUu0Qwp_O8tUfDtILxmXbijsllRx9snhc7hdlwkND8,7785
189
191
  instaui/runtime/_inner_helper.py,sha256=Aw7S_KtCuOlpd8NP2RuQvNTL1GJtpxQGLsKdc3VXQFY,326
190
192
  instaui/runtime/_link_manager.py,sha256=sVdqm3gdCl6i9UXa8WwckfYVf1vmESm7hvdagT_-OZI,2271
191
193
  instaui/runtime/context.py,sha256=MXwyKnX1X13peHOUbYzwAMflaA1WoQrNkGbi5C_0ErU,1086
@@ -209,16 +211,16 @@ instaui/spa_router/_router_param_var.py,sha256=KCy54xBZxGMqLO3Zlbzr6XV8ts-M6jCOK
209
211
  instaui/spa_router/_types.py,sha256=KuGuv5C6qivwllfdmV5qrvM0S_GWJ6u8OOTkCNmJImU,81
210
212
  instaui/spa_router/templates/page_routes,sha256=8VjM_8f6pjFb01QbU9z5HNqpcNRdCiX3X0OqNHLq8fo,1355
211
213
  instaui/static/insta-ui.css,sha256=EFA-_5bytZzwbe9w_kaAskE-bpdtwKbBRAyS4iw7NvU,292
212
- instaui/static/insta-ui.esm-browser.prod.js,sha256=8DFn3kGjXs3FDdrATFCUeKSOLuDcmqiJS8RAmnCIL7Q,110148
214
+ instaui/static/insta-ui.esm-browser.prod.js,sha256=h227I7Wp8LdU2N0yQ12AwpCh3baI7UvsJVg_dy6JsQc,110065
213
215
  instaui/static/insta-ui.ico,sha256=08FJg4qWolvOjfodoh8IJLStslrvd8sDyuRcTUDq5ak,1150
214
- instaui/static/insta-ui.js.map,sha256=ZopVR83bDks_gfzqGpFAzdOUsO02KV-492Nke-Iyidk,664965
216
+ instaui/static/insta-ui.js.map,sha256=uA-8ZZFO5zZxLEC4t5HeK40RnI-n-bJ7L2QBbqatZrU,663681
215
217
  instaui/static/instaui-tools-browser.js,sha256=cLHKNXYaYMZriMxV-yKGAHTrHSdNRUlDVZmv6uc6mMw,14455
216
218
  instaui/static/vue.esm-browser.prod.js,sha256=vwQkXANuVYQuEFc0VgiokJdhNyMmvxMKyb1FmrYrNb4,162662
217
219
  instaui/static/vue.global.prod.js,sha256=YO-UVLcXWjFOKfGU2uRrIMYpliGY2y48OmEjV464Z7M,157933
218
220
  instaui/static/vue.runtime.esm-browser.prod.js,sha256=74FfP_s9pycfQXWAiGWx6SbjV_oJvMwZLFBkEXeW1Ek,102024
219
- instaui/static/templates/web.html,sha256=E-CpEyAXV5E9X7CxkiJ8qy1IpudrCT8pQD4l1mFyAGU,1802
220
- instaui/static/templates/webview.html,sha256=NMISXyV5289WNdJYqL40srYUtjF1bo0jkoE-ouDyrAc,1875
221
- instaui/static/templates/zero.html,sha256=nDrQhbhZic3VTS3p961iMKHl-kwYgfUhQEq-jFXlluQ,1697
221
+ instaui/static/templates/web.html,sha256=UBsqe0qoAVxop7aVwZtVMqLmyl6ayHKFz9FDsFpjdj8,1928
222
+ instaui/static/templates/webview.html,sha256=h4f8FFpOm4ifjwoQZcQXWAMIDlCo_z3mFTfGfGFTGtw,1979
223
+ instaui/static/templates/zero.html,sha256=th7_14a5ZGmcxS5aVHlZNA4XLabyxNCdrhdmRE29B2g,1807
222
224
  instaui/static/templates/debug/sse.html,sha256=qw5pzfjbU_XM-hA_SJCt2F8Imbvp17tW5l2dwoSZYjY,3391
223
225
  instaui/systems/file_system.py,sha256=q8k_mSHhldkSRYXT73T9s8zvERZZo9HL1U2-4mwau-I,163
224
226
  instaui/systems/func_system.py,sha256=CER3Qm5luetdskMNVhJslvZK-QKbLe_n1aIGCe_i6Lc,3174
@@ -233,14 +235,14 @@ instaui/tailwind/static/tailwindcss-v4.min.js,sha256=9Ob5VKFT6th87AlCG5pJ90ICCZS
233
235
  instaui/template/__init__.py,sha256=fuua3uCOCmhWb7Q6Sc6pUxfwlxYJTXkdWB1V2fubyyc,141
234
236
  instaui/template/_utils.py,sha256=wNIGDWr3z2PpmKsgShYISbCnII4AbKfsLIX_DRWlRbU,670
235
237
  instaui/template/env.py,sha256=ZqVsqpfSY1mupbgpBSkvOJytNui8xfNR5kNNC9rv4Ps,150
236
- instaui/template/web_template.py,sha256=BmZY13q4E_ZP4YVgfBKbbXvPHcGZfOl2f54wp_0DjJA,1603
237
- instaui/template/webview_template.py,sha256=rd51iPi600QOPQ9PMjgYk61oIxn3L2p3_sJ3eBPG_24,1557
238
- instaui/template/zero_template.py,sha256=E88VGsyjb1qbHFJlMW-xmLRFkwUXZA7VDoZ_Jd8YubA,3514
239
- instaui/ui/__init__.py,sha256=LwgVJIsEY4vOkAyWq5v_CyQrJKVAP2OCcj2nUMUGsMM,4776
240
- instaui/ui/__init__.pyi,sha256=I5nfskP87QjdEwo7DF-ncXOp2pZ0TPCvWbkrirKin9U,4856
238
+ instaui/template/web_template.py,sha256=AAdxFBmJl7_ofVrDGWcRsBLB2cth3SNffL2ZNhr6fdo,1621
239
+ instaui/template/webview_template.py,sha256=8NhsfWDqtX4EjA92aTilKT-1vMrlgp95sV3svRAHzco,1575
240
+ instaui/template/zero_template.py,sha256=5WKIJ23RFXPN9rR_L6DLxZ-i2ZBBcJKmjjc1CitiRXM,3532
241
+ instaui/ui/__init__.py,sha256=2qBJh8DFwDpklvzVJ-TBBjlfzAH1RECAlTmawN2MP3s,4867
242
+ instaui/ui/__init__.pyi,sha256=nrMq_VnVwwRrBhgauvjmDJLZlfldBBXvI5BeHGAQcNc,4947
241
243
  instaui/ui/events.py,sha256=lfhiINwn-Kh0MezsSeLJPttWm6G1aWiwyk3TRo0NrlA,809
242
244
  instaui/ui_functions/input_slient_data.py,sha256=0A5DegIt_MqdZgbj1RiVFNmB_RUqgov9FYtkw6VX0DE,511
243
- instaui/ui_functions/server.py,sha256=B4w8KwBUMGStY19uUG8E4vRG7-L4cedttLkh35xr698,357
245
+ instaui/ui_functions/server.py,sha256=thMkBT2BDOd18FIz4ilfIgO6EJGD19l0sumlOnYbzIM,914
244
246
  instaui/ui_functions/str_format.py,sha256=ECWttA4LlNHlvdT_73wGF_I68soWNEXTP_Hosmxt-m4,1139
245
247
  instaui/ui_functions/ui_page.py,sha256=WVm1qoQ9IxE3kWKKnAU8WVI8drsqxxlLucYKfEZ712s,367
246
248
  instaui/ui_functions/ui_types.py,sha256=J5tqFFkoZJMuoLeTqU52KNgw3kdB_IfcrhaBmyI6NAA,505
@@ -270,17 +272,16 @@ instaui/watch/_types.py,sha256=HJ_eAID0NsEJ_S8PhcYWxpVWhYLjjqKlbNWwqdqS4IU,73
270
272
  instaui/watch/_utils.py,sha256=mTITHG8hp0pyfQXUERQKXMDna5Au02bhuASCV32eXHI,124
271
273
  instaui/watch/js_watch.py,sha256=8lVINBauHBRiDX3-F1V6V5_1CN9j1EMCROjcD9LRCD8,4230
272
274
  instaui/watch/vue_watch.py,sha256=Vd3nsRyf9ufrXLFTjaSvglwnkoWyE32fOV0qOogWPt4,2013
273
- instaui/watch/web_watch.py,sha256=Z0xevG6Zwp-9yPSGBZFlbwtd0yP4j29F0GV-yksZVV0,6031
275
+ instaui/watch/web_watch.py,sha256=CgiDoHsMmJChrYViRRuhl2zQ9Ij6Avc4ZaVzbXjWJ_c,6578
274
276
  instaui/webview/__init__.py,sha256=_L8B0Ym7i1Q8eonQ81fC54EXn7oZuc6zE1KqeAEPHEg,65
275
277
  instaui/webview/_utils.py,sha256=pqARVv37h-8p7CLOpvqLV8O_az4EV2VD9G-beUVqjD8,172
276
278
  instaui/webview/api.py,sha256=9xuG3EKpmOOy1dvIrS9C9z9ukQDRnIdZLrGFD5FLyvU,2071
277
- instaui/webview/func.py,sha256=Igrf7U5qL5jJvhwIRJ3JqRjXxX_S2O_nQ9oy1HLFtYo,3422
278
279
  instaui/webview/index.py,sha256=lPA1sVd5YzqFW62yvvRqeI0M53oNCoVwweGAakZOu1k,5820
279
- instaui/webview/resource.py,sha256=kFT6N5UZK5GLE0KmW3TrEYDNlViw9DL2OshRh41wBXs,5566
280
+ instaui/webview/resource.py,sha256=AEYoMQG-k1JX6h2SDLeVuCgyKk03iq27V-S_oO9GxDA,5662
280
281
  instaui/zero/__init__.py,sha256=N0LuRUAcaurxHSspcEDuwZg62W2S3qL4VtrMKxOivBE,49
281
- instaui/zero/func.py,sha256=8cA_wJMtRmoAARjWY8yY5MmLXDAQ7hyVW6f1Vbejtoc,3576
282
+ instaui/zero/func.py,sha256=O0tZnlahKhp8pQ9plMicQtjp3itHA6lliZwMmfDbLnc,3668
282
283
  instaui/zero/scope.py,sha256=HGohYOqnpRGVkkoz_gvR6-DgCc48AtJAcDwbOnnGHLM,3753
283
- instaui-0.1.19.dist-info/METADATA,sha256=t-xqTl3zZ7KvlW4WSMAFDNseLTmwUlvxZ7sJ1-dAjsE,3562
284
- instaui-0.1.19.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
285
- instaui-0.1.19.dist-info/licenses/LICENSE,sha256=_JjnAWrikJ6qkwT7PazeFNRlcIu8q_RH3mYcHTxEF5c,1094
286
- instaui-0.1.19.dist-info/RECORD,,
284
+ instaui-0.2.0.dist-info/METADATA,sha256=pV0-u5rup0Xj09eUkEfAD5O6hys0t_yImiF8-Y31c5M,3650
285
+ instaui-0.2.0.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
286
+ instaui-0.2.0.dist-info/licenses/LICENSE,sha256=_JjnAWrikJ6qkwT7PazeFNRlcIu8q_RH3mYcHTxEF5c,1094
287
+ instaui-0.2.0.dist-info/RECORD,,
instaui/webview/func.py DELETED
@@ -1,114 +0,0 @@
1
- from __future__ import annotations
2
- import itertools
3
- from pathlib import Path
4
- import instaui.consts as consts
5
- from instaui.runtime._app import get_app_slot, get_default_app_slot
6
- from instaui.template import render_zero_html
7
- from instaui.template import zero_template
8
- from instaui.html_tools import to_config_data
9
- from instaui.runtime.dataclass import JsLink
10
- from instaui.runtime.resource import HtmlResource
11
-
12
-
13
- def get_template_model():
14
- system_slot = get_app_slot()
15
-
16
- merge_global_resources = (system_slot.meta or {}).get(
17
- "merge_global_resources", True
18
- )
19
-
20
- default_app_slot = get_default_app_slot()
21
- html_resource = system_slot._html_resource
22
- default_html_resource = (
23
- default_app_slot._html_resource
24
- if merge_global_resources
25
- else _empty_html_resource()
26
- )
27
-
28
- config_data = to_config_data()
29
-
30
- model = zero_template.ZeroTemplateModel(
31
- vue_js_code=consts.VUE_ES_JS_PATH,
32
- instaui_js_code=consts.APP_ES_JS_PATH,
33
- css_links=[
34
- consts.APP_CSS_PATH,
35
- ],
36
- config_dict=config_data,
37
- favicon=html_resource.favicon
38
- or default_html_resource.favicon
39
- or consts.FAVICON_PATH,
40
- title=html_resource.title or default_html_resource.title or consts.PAGE_TITLE,
41
- )
42
-
43
- # register custom components
44
- for component in system_slot._component_dependencies:
45
- if not component.esm:
46
- continue
47
-
48
- model.vue_app_component.append(
49
- zero_template.ZeroVueAppComponent(
50
- name=component.tag_name,
51
- url=component.esm,
52
- )
53
- )
54
-
55
- if component.css:
56
- for css_link in component.css:
57
- model.css_links.append(css_link)
58
-
59
- if component.externals:
60
- for name, url in component.externals.items():
61
- if url.is_file():
62
- model.add_extra_import_map(name, url)
63
-
64
- # register custom plugins
65
- for plugin in set(
66
- itertools.chain(
67
- system_slot._plugin_dependencies, default_app_slot._plugin_dependencies
68
- )
69
- ):
70
- if not plugin.esm:
71
- continue
72
-
73
- model.vue_app_use.append(plugin.name)
74
-
75
- model.add_extra_import_map(plugin.name, plugin.esm)
76
-
77
- if plugin.css:
78
- for css_link in plugin.css:
79
- model.css_links.append(css_link)
80
-
81
- # css file link to web static link
82
- for link in html_resource.get_valid_css_links(
83
- default_html_resource._css_links_manager
84
- ):
85
- if isinstance(link, Path):
86
- model.css_links.append(link)
87
-
88
- # js file link to web static link
89
- for info in html_resource.get_valid_js_links(
90
- default_html_resource._js_links_manager
91
- ):
92
- if isinstance(info.link, Path):
93
- model.js_links.append(JsLink(info.link))
94
-
95
- for js_code in itertools.chain(
96
- html_resource._script_tags, default_html_resource._script_tags
97
- ):
98
- model.script_tags.append(js_code)
99
-
100
- for sylte_code in itertools.chain(
101
- html_resource._style_tags, default_html_resource._style_tags
102
- ):
103
- model.style_tags.append(sylte_code)
104
-
105
- return model
106
-
107
-
108
- def to_html_str():
109
- model = get_template_model()
110
- return render_zero_html(model)
111
-
112
-
113
- def _empty_html_resource():
114
- return HtmlResource()