instaui 0.1.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.
- instaui/__init__.py +9 -0
- instaui/_helper/observable_helper.py +35 -0
- instaui/boot_info.py +43 -0
- instaui/common/jsonable.py +37 -0
- instaui/components/__init__.py +0 -0
- instaui/components/column.py +18 -0
- instaui/components/component.py +47 -0
- instaui/components/content.py +34 -0
- instaui/components/directive.py +55 -0
- instaui/components/element.py +462 -0
- instaui/components/grid.py +80 -0
- instaui/components/html/__init__.py +36 -0
- instaui/components/html/_mixins.py +34 -0
- instaui/components/html/button.py +38 -0
- instaui/components/html/checkbox.py +42 -0
- instaui/components/html/date.py +28 -0
- instaui/components/html/div.py +7 -0
- instaui/components/html/form.py +7 -0
- instaui/components/html/input.py +28 -0
- instaui/components/html/label.py +21 -0
- instaui/components/html/li.py +17 -0
- instaui/components/html/link.py +31 -0
- instaui/components/html/number.py +34 -0
- instaui/components/html/paragraph.py +19 -0
- instaui/components/html/range.py +45 -0
- instaui/components/html/select.py +93 -0
- instaui/components/html/span.py +19 -0
- instaui/components/html/ul.py +20 -0
- instaui/components/match.py +106 -0
- instaui/components/row.py +19 -0
- instaui/components/slot.py +82 -0
- instaui/components/transition_group.py +9 -0
- instaui/components/value_element.py +48 -0
- instaui/components/vfor.py +140 -0
- instaui/components/vif.py +38 -0
- instaui/consts.py +18 -0
- instaui/dependencies/__init__.py +15 -0
- instaui/dependencies/component_registrar.py +82 -0
- instaui/dependencies/installer.py +5 -0
- instaui/event/event_mixin.py +12 -0
- instaui/event/js_event.py +57 -0
- instaui/event/web_event.py +108 -0
- instaui/experimental/__init__.py +4 -0
- instaui/experimental/debug.py +48 -0
- instaui/fastapi_server/_utils.py +42 -0
- instaui/fastapi_server/_uvicorn.py +37 -0
- instaui/fastapi_server/config_router.py +60 -0
- instaui/fastapi_server/debug_mode_router.py +61 -0
- instaui/fastapi_server/event_router.py +58 -0
- instaui/fastapi_server/middlewares.py +19 -0
- instaui/fastapi_server/request_context.py +19 -0
- instaui/fastapi_server/server.py +246 -0
- instaui/fastapi_server/watch_router.py +53 -0
- instaui/handlers/_utils.py +66 -0
- instaui/handlers/computed_handler.py +42 -0
- instaui/handlers/config_handler.py +13 -0
- instaui/handlers/event_handler.py +58 -0
- instaui/handlers/watch_handler.py +57 -0
- instaui/html_tools.py +139 -0
- instaui/inject.py +33 -0
- instaui/js/__init__.py +4 -0
- instaui/js/js_output.py +15 -0
- instaui/js/lambda_func.py +35 -0
- instaui/launch_collector.py +52 -0
- instaui/page_info.py +23 -0
- instaui/runtime/__init__.py +29 -0
- instaui/runtime/_app.py +206 -0
- instaui/runtime/_inner_helper.py +9 -0
- instaui/runtime/context.py +47 -0
- instaui/runtime/dataclass.py +30 -0
- instaui/runtime/resource.py +87 -0
- instaui/runtime/scope.py +107 -0
- instaui/runtime/ui_state_scope.py +15 -0
- instaui/settings/__init__.py +4 -0
- instaui/settings/__settings.py +13 -0
- instaui/skip.py +12 -0
- instaui/spa_router/__init__.py +26 -0
- instaui/spa_router/_components.py +35 -0
- instaui/spa_router/_file_base_utils.py +264 -0
- instaui/spa_router/_functions.py +122 -0
- instaui/spa_router/_install.py +11 -0
- instaui/spa_router/_route_model.py +139 -0
- instaui/spa_router/_router_box.py +40 -0
- instaui/spa_router/_router_output.py +22 -0
- instaui/spa_router/_router_param_var.py +51 -0
- instaui/spa_router/_types.py +4 -0
- instaui/spa_router/templates/page_routes +59 -0
- instaui/static/insta-ui.css +1 -0
- instaui/static/insta-ui.esm-browser.prod.js +3663 -0
- instaui/static/insta-ui.iife.js +29 -0
- instaui/static/insta-ui.iife.js.map +1 -0
- instaui/static/insta-ui.js.map +1 -0
- instaui/static/tailwindcss.min.js +62 -0
- instaui/static/templates/debug/sse.html +117 -0
- instaui/static/templates/web.html +118 -0
- instaui/static/templates/zero.html +55 -0
- instaui/static/vue.esm-browser.prod.js +9 -0
- instaui/static/vue.global.prod.js +9 -0
- instaui/static/vue.runtime.esm-browser.prod.js +5 -0
- instaui/systems/file_system.py +17 -0
- instaui/systems/func_system.py +104 -0
- instaui/systems/js_system.py +22 -0
- instaui/systems/pydantic_system.py +27 -0
- instaui/systems/string_system.py +10 -0
- instaui/template/__init__.py +4 -0
- instaui/template/env.py +7 -0
- instaui/template/web_template.py +55 -0
- instaui/template/zero_template.py +24 -0
- instaui/ui/__init__.py +121 -0
- instaui/ui/events.py +25 -0
- instaui/ui_functions/input_slient_data.py +16 -0
- instaui/ui_functions/server.py +13 -0
- instaui/ui_functions/str_format.py +36 -0
- instaui/ui_functions/ui_page.py +31 -0
- instaui/ui_functions/ui_types.py +13 -0
- instaui/ui_functions/url_location.py +33 -0
- instaui/vars/__init__.py +13 -0
- instaui/vars/_types.py +8 -0
- instaui/vars/_utils.py +12 -0
- instaui/vars/data.py +68 -0
- instaui/vars/element_ref.py +42 -0
- instaui/vars/event_context.py +45 -0
- instaui/vars/event_extend.py +0 -0
- instaui/vars/js_computed.py +95 -0
- instaui/vars/mixin_types/common_type.py +5 -0
- instaui/vars/mixin_types/element_binding.py +10 -0
- instaui/vars/mixin_types/observable.py +7 -0
- instaui/vars/mixin_types/pathable.py +14 -0
- instaui/vars/mixin_types/py_binding.py +13 -0
- instaui/vars/mixin_types/str_format_binding.py +8 -0
- instaui/vars/mixin_types/var_type.py +5 -0
- instaui/vars/path_var.py +89 -0
- instaui/vars/ref.py +103 -0
- instaui/vars/slot_prop.py +46 -0
- instaui/vars/state.py +82 -0
- instaui/vars/types.py +24 -0
- instaui/vars/vfor_item.py +204 -0
- instaui/vars/vue_computed.py +82 -0
- instaui/vars/web_computed.py +157 -0
- instaui/vars/web_view_computed.py +1 -0
- instaui/version.py +3 -0
- instaui/watch/_types.py +4 -0
- instaui/watch/_utils.py +3 -0
- instaui/watch/js_watch.py +74 -0
- instaui/watch/vue_watch.py +61 -0
- instaui/watch/web_watch.py +123 -0
- instaui/zero/__init__.py +3 -0
- instaui/zero/scope.py +9 -0
- instaui-0.1.0.dist-info/LICENSE +21 -0
- instaui-0.1.0.dist-info/METADATA +154 -0
- instaui-0.1.0.dist-info/RECORD +152 -0
- instaui-0.1.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,117 @@
|
|
1
|
+
{% macro sse_style(is_debug) %}
|
2
|
+
{% if is_debug %}
|
3
|
+
<style>
|
4
|
+
#debug-sse-box {
|
5
|
+
position: fixed;
|
6
|
+
display: none;
|
7
|
+
align-items: center;
|
8
|
+
justify-content: center;
|
9
|
+
top: 5px;
|
10
|
+
left: 50%;
|
11
|
+
transform: translateX(-50%);
|
12
|
+
height: 75px;
|
13
|
+
background-color: rgba(186, 230, 253, 0.8);
|
14
|
+
border: 1px solid #dee2e6;
|
15
|
+
box-shadow: 0 4px 6px rgba(186, 230, 253, 0.5);
|
16
|
+
border-radius: 4px;
|
17
|
+
color: #343a40;
|
18
|
+
font-size: 16px;
|
19
|
+
font-family: Arial, sans-serif;
|
20
|
+
text-align: center;
|
21
|
+
margin: auto;
|
22
|
+
z-index: 9999;
|
23
|
+
}
|
24
|
+
|
25
|
+
#debug-sse-box.show {
|
26
|
+
display: flex;
|
27
|
+
}
|
28
|
+
|
29
|
+
#debug-sse-box .outter-box {
|
30
|
+
display: flex;
|
31
|
+
flex-direction: row;
|
32
|
+
align-items: center;
|
33
|
+
justify-content: center;
|
34
|
+
padding: 0.75rem;
|
35
|
+
}
|
36
|
+
|
37
|
+
#debug-sse-box .outter-box .progress-icon {
|
38
|
+
color: rgb(255 255 255);
|
39
|
+
animation: spin 1s linear infinite;
|
40
|
+
width: 1.25rem;
|
41
|
+
height: 1.25rem;
|
42
|
+
margin-right: .75rem;
|
43
|
+
margin-left: -.25rem;
|
44
|
+
}
|
45
|
+
|
46
|
+
@keyframes spin {
|
47
|
+
100% {
|
48
|
+
transform: rotate(1turn);
|
49
|
+
}
|
50
|
+
}
|
51
|
+
</style>
|
52
|
+
{% endif %}
|
53
|
+
{% endmacro %}
|
54
|
+
|
55
|
+
{% macro sse_html(is_debug) %}
|
56
|
+
{% if is_debug %}
|
57
|
+
<div id="debug-sse-box">
|
58
|
+
<div class="outter-box">
|
59
|
+
<svg class="progress-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
60
|
+
<circle style="opacity: 0.25;" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
61
|
+
<path style="opacity: 0.75;" fill="currentColor"
|
62
|
+
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
|
63
|
+
</path>
|
64
|
+
</svg>
|
65
|
+
<span class="msg" style="font-size: 1.25rem;">server reloading...</span>
|
66
|
+
</div>
|
67
|
+
</div>
|
68
|
+
{% endif %}
|
69
|
+
{% endmacro %}
|
70
|
+
|
71
|
+
{% macro sse_script(is_debug) %}
|
72
|
+
{% if is_debug %}
|
73
|
+
<script type="text/javascript">
|
74
|
+
window.addEventListener('load', () => {
|
75
|
+
const dom_debug_box = document.querySelector('#debug-sse-box');
|
76
|
+
const dom_progress_icon = dom_debug_box.querySelector('#debug-sse-box .progress-icon');
|
77
|
+
const dom_msg = dom_debug_box.querySelector('#debug-sse-box .msg');
|
78
|
+
|
79
|
+
function toggleMessageBox(show) {
|
80
|
+
dom_debug_box.classList.toggle('show', show);
|
81
|
+
}
|
82
|
+
|
83
|
+
let retryCount = 0;
|
84
|
+
const maxRetries = 3;
|
85
|
+
const tryIntervalMs = 800;
|
86
|
+
|
87
|
+
function connect() {
|
88
|
+
const eventSource = new EventSource("/instaui/debug-sse");
|
89
|
+
|
90
|
+
eventSource.onopen = function () {
|
91
|
+
toggleMessageBox(false)
|
92
|
+
console.log('debug-sse connection opened');
|
93
|
+
if (retryCount > 0) {
|
94
|
+
location.reload(true);
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
eventSource.onerror = function () {
|
99
|
+
toggleMessageBox(true)
|
100
|
+
console.error("Connection to server failed.");
|
101
|
+
eventSource.close();
|
102
|
+
retryCount++;
|
103
|
+
if (retryCount >= maxRetries) {
|
104
|
+
console.log("Max retries reached. Giving up.");
|
105
|
+
dom_msg.textContent = "Server reload failed.";
|
106
|
+
dom_progress_icon.style.display = "none";
|
107
|
+
return;
|
108
|
+
}
|
109
|
+
setTimeout(connect, tryIntervalMs);
|
110
|
+
};
|
111
|
+
}
|
112
|
+
|
113
|
+
connect();
|
114
|
+
})
|
115
|
+
</script>
|
116
|
+
{% endif %}
|
117
|
+
{% endmacro %}
|
@@ -0,0 +1,118 @@
|
|
1
|
+
{% from 'debug/sse.html' import sse_style, sse_script,sse_html -%}
|
2
|
+
|
3
|
+
|
4
|
+
<!doctype html>
|
5
|
+
<html lang="en">
|
6
|
+
|
7
|
+
<head>
|
8
|
+
<meta charset="UTF-8" />
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
10
|
+
<link href="{{ favicon_url }}" rel="shortcut icon" />
|
11
|
+
<title>{{ title }}</title>
|
12
|
+
|
13
|
+
{% for link in css_links %}
|
14
|
+
<link rel="stylesheet" href="{{ prefix | safe }}{{link}}" />
|
15
|
+
{% endfor -%}
|
16
|
+
|
17
|
+
{% for content in style_tags %}
|
18
|
+
<style>{{content}}</style>
|
19
|
+
{% endfor -%}
|
20
|
+
|
21
|
+
{{ sse_style(is_debug) }}
|
22
|
+
</head>
|
23
|
+
|
24
|
+
<body>
|
25
|
+
|
26
|
+
<div id="loading"><insta-ui :config="config"></insta-ui></div>
|
27
|
+
|
28
|
+
{{ sse_html(is_debug) }}
|
29
|
+
|
30
|
+
<div id="app">
|
31
|
+
<insta-ui :config="config"></insta-ui>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<script type="importmap">
|
35
|
+
{
|
36
|
+
"imports":{{import_maps | safe}}
|
37
|
+
}
|
38
|
+
</script>
|
39
|
+
|
40
|
+
{% for info in js_links %}
|
41
|
+
<script src="{{ prefix | safe }}{{info.link}}" {{info.create_attrs_str()}}></script>
|
42
|
+
{% endfor -%}
|
43
|
+
|
44
|
+
{% for content in script_tags %}
|
45
|
+
<script>{{content}}</script>
|
46
|
+
{% endfor -%}
|
47
|
+
|
48
|
+
|
49
|
+
{% if is_remote_config %}
|
50
|
+
<script>
|
51
|
+
async function queryConfig() {
|
52
|
+
|
53
|
+
const url = `{{config_fetch_url | safe}}`;
|
54
|
+
const pageInfo = {path:'{{query_path | safe}}',params:{{query_path_params | safe}},queryParams:{{query_params | safe}}};
|
55
|
+
const response = await fetch(url,{
|
56
|
+
method: 'POST',
|
57
|
+
headers: {
|
58
|
+
'Content-Type': 'application/json'
|
59
|
+
},
|
60
|
+
body: JSON.stringify({key: '{{config_fetch_key | safe}}', page: pageInfo}),
|
61
|
+
});
|
62
|
+
|
63
|
+
if (!response.ok) {
|
64
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
65
|
+
}
|
66
|
+
|
67
|
+
const data = await response.json();
|
68
|
+
return data;
|
69
|
+
}
|
70
|
+
</script>
|
71
|
+
{% endif %}
|
72
|
+
|
73
|
+
{{ sse_script(is_debug) }}
|
74
|
+
|
75
|
+
<script type="module">
|
76
|
+
import { createApp } from 'vue'
|
77
|
+
import installInsta from 'instaui'
|
78
|
+
const True = true;
|
79
|
+
const False = false;
|
80
|
+
const None = undefined;
|
81
|
+
|
82
|
+
async function createVueApp(config, targetSelector) {
|
83
|
+
const app = createApp({
|
84
|
+
setup() {
|
85
|
+
return {
|
86
|
+
config
|
87
|
+
}
|
88
|
+
}
|
89
|
+
})
|
90
|
+
|
91
|
+
installInsta(app,config)
|
92
|
+
|
93
|
+
{% for info in vue_app_use %}
|
94
|
+
app.use(await import('{{info.name | safe }}'))
|
95
|
+
{% endfor %}
|
96
|
+
|
97
|
+
{% for info in vue_app_component %}
|
98
|
+
app.component('{{info.name | safe}}',(await import('{{info.url | safe }}')).default)
|
99
|
+
{% endfor %}
|
100
|
+
app.mount(targetSelector)
|
101
|
+
}
|
102
|
+
|
103
|
+
{% if has_preload %}
|
104
|
+
await createVueApp({{preload_json | safe}}, '#loading');
|
105
|
+
{% endif %}
|
106
|
+
|
107
|
+
{% if is_remote_config %}
|
108
|
+
const appConfig = await queryConfig();
|
109
|
+
{% else %}
|
110
|
+
const appConfig = {{config_json | safe}};
|
111
|
+
{% endif %}
|
112
|
+
|
113
|
+
await createVueApp(appConfig, '#app');
|
114
|
+
document.getElementById('loading').remove();
|
115
|
+
|
116
|
+
</script>
|
117
|
+
</body>
|
118
|
+
</html>
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html lang="en">
|
3
|
+
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8" />
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
7
|
+
<link href="{{ favicon_url }}" rel="shortcut icon" />
|
8
|
+
<title>{{ title }}</title>
|
9
|
+
|
10
|
+
{% for link in css_links %}
|
11
|
+
<link rel="stylesheet" href="{{ prefix | safe }}{{link}}" />
|
12
|
+
{% endfor -%}
|
13
|
+
|
14
|
+
{% for content in style_tags %}
|
15
|
+
<style>{{content}}</style>
|
16
|
+
{% endfor -%}
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<div id="app">
|
21
|
+
<insta-ui :config="appConfig"></insta-ui>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
{% for info in js_links %}
|
25
|
+
<script src="{{ prefix | safe }}{{info.link}}" {{info.create_attrs_str()}}></script>
|
26
|
+
{% endfor -%}
|
27
|
+
|
28
|
+
{% for content in script_tags %}
|
29
|
+
<script>{{content}}</script>
|
30
|
+
{% endfor -%}
|
31
|
+
|
32
|
+
<script>
|
33
|
+
const True = true;
|
34
|
+
const False = false;
|
35
|
+
const None = undefined;
|
36
|
+
const { createApp } = Vue
|
37
|
+
const insta = InstaUI
|
38
|
+
const appConfig = {{appConfig}}
|
39
|
+
|
40
|
+
const app = createApp({
|
41
|
+
setup() {
|
42
|
+
return {
|
43
|
+
appConfig
|
44
|
+
}
|
45
|
+
}
|
46
|
+
})
|
47
|
+
|
48
|
+
insta(app,appConfig)
|
49
|
+
{% for info in vue_app_use %}
|
50
|
+
app.use({{info.name}})
|
51
|
+
{% endfor %}
|
52
|
+
app.mount('#app')
|
53
|
+
</script>
|
54
|
+
</body>
|
55
|
+
</html>
|