instaui 0.1.18__tar.gz → 0.2.0__tar.gz
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-0.1.18 → instaui-0.2.0}/PKG-INFO +4 -3
- {instaui-0.1.18 → instaui-0.2.0}/README.md +3 -2
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/component.py +4 -7
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/element.py +0 -16
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/html/button.py +2 -2
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/html/input.py +2 -2
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/html/select.py +3 -2
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/html/textarea.py +2 -2
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/match.py +4 -6
- instaui-0.2.0/instaui/components/mixins.py +12 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/vfor.py +2 -4
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/vif.py +2 -4
- {instaui-0.1.18 → instaui-0.2.0}/instaui/event/js_event.py +0 -2
- {instaui-0.1.18 → instaui-0.2.0}/instaui/event/vue_event.py +0 -3
- {instaui-0.1.18 → instaui-0.2.0}/instaui/event/web_event.py +25 -5
- {instaui-0.1.18 → instaui-0.2.0}/instaui/fastapi_server/middlewares.py +12 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/fastapi_server/server.py +5 -1
- {instaui-0.1.18 → instaui-0.2.0}/instaui/js/fn.py +5 -1
- instaui-0.2.0/instaui/pre_setup.py +45 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/runtime/_app.py +7 -3
- {instaui-0.1.18 → instaui-0.2.0}/instaui/runtime/scope.py +74 -33
- {instaui-0.1.18 → instaui-0.2.0}/instaui/spa_router/_route_model.py +5 -6
- instaui-0.2.0/instaui/static/insta-ui.esm-browser.prod.js +3733 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/static/insta-ui.js.map +1 -1
- {instaui-0.1.18 → instaui-0.2.0}/instaui/static/templates/web.html +5 -3
- {instaui-0.1.18 → instaui-0.2.0}/instaui/static/templates/webview.html +4 -2
- {instaui-0.1.18 → instaui-0.2.0}/instaui/static/templates/zero.html +4 -2
- {instaui-0.1.18 → instaui-0.2.0}/instaui/template/web_template.py +1 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/template/webview_template.py +1 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/template/zero_template.py +1 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/ui/__init__.py +2 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/ui/__init__.pyi +2 -0
- instaui-0.2.0/instaui/ui_functions/server.py +24 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/vars/data.py +5 -7
- {instaui-0.1.18 → instaui-0.2.0}/instaui/vars/js_computed.py +6 -22
- instaui-0.2.0/instaui/vars/mixin_types/element_binding.py +10 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/vars/ref.py +5 -7
- {instaui-0.1.18 → instaui-0.2.0}/instaui/vars/vue_computed.py +6 -21
- {instaui-0.1.18 → instaui-0.2.0}/instaui/vars/web_computed.py +6 -23
- {instaui-0.1.18 → instaui-0.2.0}/instaui/watch/js_watch.py +0 -2
- {instaui-0.1.18 → instaui-0.2.0}/instaui/watch/web_watch.py +11 -2
- {instaui-0.1.18 → instaui-0.2.0}/instaui/webview/resource.py +2 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/zero/func.py +2 -0
- {instaui-0.1.18 → instaui-0.2.0}/pyproject.toml +1 -1
- instaui-0.1.18/instaui/static/insta-ui.esm-browser.prod.js +0 -3714
- instaui-0.1.18/instaui/ui_functions/server.py +0 -15
- instaui-0.1.18/instaui/vars/mixin_types/element_binding.py +0 -22
- instaui-0.1.18/instaui/webview/func.py +0 -114
- {instaui-0.1.18 → instaui-0.2.0}/.gitignore +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/LICENSE +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/__init__.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/_helper/observable_helper.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/action/__init__.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/action/cookie.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/action/url_location.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/__init__.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/_settings.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/_use_tools/locale.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/component_types.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/_utils.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/affix.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/alert.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/anchor.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/auto_complete.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/avatar.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/back_top.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/badge.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/breadcrumb.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/button.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/calendar.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/card.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/carousel.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/cascader.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/checkbox.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/collapse.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/color_picker.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/comment.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/config_provider.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/date_picker.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/descriptions.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/divider.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/drawer.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/dropdown.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/empty.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/form.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/icon.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/image.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/input.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/input_number.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/input_password.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/input_search.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/input_tag.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/layout.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/layout_content.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/layout_footer.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/layout_header.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/layout_sider.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/link.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/list.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/mention.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/menu.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/modal.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/overflow_list.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/page_header.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/pagination.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/pop_confirm.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/popover.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/progress.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/radio.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/radio_group.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/rate.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/resize_box.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/result.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/select.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/skeleton.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/slider.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/space.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/spin.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/split.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/statistic.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/steps.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/switch.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/tab_pane.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/table.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/tabs.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/tag.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/textarea.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/time_picker.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/timeline.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/tooltip.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/transfer.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/tree.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/tree_select.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/trigger.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/typography.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/upload.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/verification_code.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/components/watermark.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/locales/__init__.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/locales/_index.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/locales/en_us.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/locales/zh_cn.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/setup.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/static/instaui-arco.css +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/static/instaui-arco.js +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/arco/types.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/boot_info.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/common/jsonable.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/__init__.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/column.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/content.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/directive.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/grid.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/html/__init__.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/html/_mixins.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/html/_preset.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/html/checkbox.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/html/date.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/html/div.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/html/form.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/html/heading.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/html/label.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/html/li.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/html/link.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/html/number.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/html/paragraph.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/html/radio.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/html/range.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/html/span.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/html/table.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/html/ul.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/label.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/markdown/markdown.js +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/markdown/markdown.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/markdown/static/github-markdown.css +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/markdown/static/marked.esm.js +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/row.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/shiki_code/shiki_code.js +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/shiki_code/shiki_code.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/shiki_code/static/langs/css.mjs +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/shiki_code/static/langs/markdown.mjs +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/shiki_code/static/langs/python.mjs +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/shiki_code/static/langs/shell.mjs +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/shiki_code/static/langs/shellscript.mjs +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/shiki_code/static/shiki-core.js +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/shiki_code/static/shiki-style.css +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/shiki_code/static/shiki-transformers.js +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/shiki_code/static/themes/vitesse-dark.mjs +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/shiki_code/static/themes/vitesse-light.mjs +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/slot.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/timer/timer.js +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/timer/timer.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/transition_group.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/components/value_element.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/consts.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/dependencies/component_dependency.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/dependencies/plugin_dependency.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/event/event_mixin.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/experimental/__init__.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/experimental/debug.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/extra_libs/_echarts.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/extra_libs/_import_error.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/extra_libs/_mermaid.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/extra_libs/_shiki_code.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/fastapi_server/_utils.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/fastapi_server/_uvicorn.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/fastapi_server/debug_mode_router.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/fastapi_server/dependency_router.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/fastapi_server/event_router.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/fastapi_server/request_context.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/fastapi_server/resource.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/fastapi_server/watch_router.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/handlers/_utils.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/handlers/event_handler.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/handlers/watch_handler.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/html_tools.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/inject.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/launch_collector.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/page_info.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/runtime/__init__.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/runtime/_inner_helper.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/runtime/_link_manager.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/runtime/context.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/runtime/dataclass.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/runtime/resource.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/runtime/ui_state_scope.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/settings/__init__.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/settings/__settings.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/shadcn_classless/_index.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/shadcn_classless/static/shadcn-classless.css +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/skip.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/spa_router/__init__.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/spa_router/_components.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/spa_router/_file_base_utils.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/spa_router/_functions.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/spa_router/_install.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/spa_router/_router_box.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/spa_router/_router_output.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/spa_router/_router_param_var.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/spa_router/_types.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/spa_router/templates/page_routes +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/static/insta-ui.css +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/static/insta-ui.ico +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/static/instaui-tools-browser.js +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/static/templates/debug/sse.html +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/static/vue.esm-browser.prod.js +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/static/vue.global.prod.js +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/static/vue.runtime.esm-browser.prod.js +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/systems/file_system.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/systems/func_system.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/systems/js_system.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/systems/module_system.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/systems/pydantic_system.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/systems/string_system.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/tailwind/__init__.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/tailwind/_index.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/tailwind/static/tailwindcss-v3.min.js +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/tailwind/static/tailwindcss-v4.min.js +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/template/__init__.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/template/_utils.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/template/env.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/ui/events.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/ui_functions/input_slient_data.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/ui_functions/str_format.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/ui_functions/ui_page.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/ui_functions/ui_types.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/vars/_types.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/vars/element_ref.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/vars/event_context.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/vars/event_extend.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/vars/mixin_types/common_type.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/vars/mixin_types/observable.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/vars/mixin_types/pathable.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/vars/mixin_types/py_binding.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/vars/mixin_types/str_format_binding.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/vars/mixin_types/var_type.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/vars/path_var.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/vars/slot_prop.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/vars/state.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/vars/types.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/vars/vfor_item.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/vars/web_view_computed.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/version.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/watch/_types.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/watch/_utils.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/watch/vue_watch.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/webview/__init__.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/webview/_utils.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/webview/api.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/webview/index.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/zero/__init__.py +0 -0
- {instaui-0.1.18 → instaui-0.2.0}/instaui/zero/scope.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: instaui
|
3
|
-
Version: 0.
|
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
|
-
|
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
|
|
@@ -66,7 +66,8 @@ def home():
|
|
66
66
|
ui.label("=")
|
67
67
|
ui.label(result).style({"color": text_color})
|
68
68
|
|
69
|
-
|
69
|
+
# when you deploy your web application, you need to set debug=False.
|
70
|
+
ui.server(debug=True).run()
|
70
71
|
```
|
71
72
|
|
72
73
|
Replace `ui.server().run()` with `ui.webview().run()` to switch to Web View mode:
|
@@ -74,7 +75,7 @@ Replace `ui.server().run()` with `ui.webview().run()` to switch to Web View mode
|
|
74
75
|
```python
|
75
76
|
...
|
76
77
|
|
77
|
-
# ui.server().run()
|
78
|
+
# ui.server(debug=True).run()
|
78
79
|
ui.webview().run()
|
79
80
|
```
|
80
81
|
|
@@ -20,7 +20,7 @@ class Component(Jsonable):
|
|
20
20
|
"Not allowed to create element outside of ui.page"
|
21
21
|
)
|
22
22
|
|
23
|
-
self.
|
23
|
+
self._tag = (
|
24
24
|
"div"
|
25
25
|
if tag is None or tag == ""
|
26
26
|
else (
|
@@ -29,8 +29,6 @@ class Component(Jsonable):
|
|
29
29
|
else str(tag)
|
30
30
|
)
|
31
31
|
)
|
32
|
-
if isinstance(tag, ElementBindingMixin):
|
33
|
-
tag._mark_used()
|
34
32
|
self._slot_manager = SlotManager()
|
35
33
|
|
36
34
|
get_app_slot().append_component_to_container(self)
|
@@ -43,7 +41,6 @@ class Component(Jsonable):
|
|
43
41
|
self._slot_manager.default.__exit__(*_)
|
44
42
|
|
45
43
|
def _to_json_dict(self) -> Dict:
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
return data
|
44
|
+
return {
|
45
|
+
"tag": self._tag,
|
46
|
+
}
|
@@ -271,28 +271,18 @@ class Element(Component):
|
|
271
271
|
|
272
272
|
if isinstance(add, dict):
|
273
273
|
self._dict_classes.update(**add) # type: ignore
|
274
|
-
for value in (
|
275
|
-
v for v in add.values() if isinstance(v, ElementBindingMixin)
|
276
|
-
):
|
277
|
-
value._mark_used()
|
278
274
|
|
279
275
|
if isinstance(add, ElementBindingMixin):
|
280
276
|
self._bind_str_classes.append(add) # type: ignore
|
281
|
-
add._mark_used()
|
282
277
|
|
283
278
|
return self
|
284
279
|
|
285
280
|
def style(self, add: Union[str, Dict[str, Any], TMaybeRef[str]]) -> Self:
|
286
281
|
if isinstance(add, dict):
|
287
282
|
add = {key: value for key, value in add.items()}
|
288
|
-
for value in (
|
289
|
-
v for v in add.values() if isinstance(v, ElementBindingMixin)
|
290
|
-
):
|
291
|
-
value._mark_used()
|
292
283
|
|
293
284
|
if isinstance(add, ElementBindingMixin):
|
294
285
|
self._style_str_binds.append(add)
|
295
|
-
add._mark_used()
|
296
286
|
return self
|
297
287
|
|
298
288
|
new_style = self._parse_style(add)
|
@@ -302,17 +292,11 @@ class Element(Component):
|
|
302
292
|
def props(self, add: Union[str, Dict[str, Any], TMaybeRef]) -> Self:
|
303
293
|
if isinstance(add, ElementBindingMixin):
|
304
294
|
self._proxy_props.append(add)
|
305
|
-
add._mark_used()
|
306
295
|
return self
|
307
296
|
|
308
297
|
if isinstance(add, dict):
|
309
298
|
add = {key: value for key, value in add.items() if value is not None}
|
310
299
|
|
311
|
-
for value in (
|
312
|
-
v for v in add.values() if isinstance(v, ElementBindingMixin)
|
313
|
-
):
|
314
|
-
value._mark_used()
|
315
|
-
|
316
300
|
new_props = self._parse_props(add)
|
317
301
|
self._props.update(new_props)
|
318
302
|
return self
|
@@ -5,15 +5,15 @@ from typing import (
|
|
5
5
|
Optional,
|
6
6
|
)
|
7
7
|
from instaui.components.element import Element
|
8
|
-
|
9
8
|
from instaui.event.event_mixin import EventMixin
|
10
9
|
from instaui.vars.types import TMaybeRef
|
10
|
+
from instaui.components.mixins import CanDisabledMixin
|
11
11
|
|
12
12
|
if TYPE_CHECKING:
|
13
13
|
pass
|
14
14
|
|
15
15
|
|
16
|
-
class Button(Element):
|
16
|
+
class Button(Element, CanDisabledMixin):
|
17
17
|
def __init__(
|
18
18
|
self,
|
19
19
|
text: Optional[TMaybeRef[str]] = None,
|
@@ -2,14 +2,14 @@ from __future__ import annotations
|
|
2
2
|
from typing import TYPE_CHECKING, Optional, Union
|
3
3
|
from instaui.components.element import Element
|
4
4
|
from instaui.components.value_element import ValueElement
|
5
|
-
|
5
|
+
from instaui.components.mixins import CanDisabledMixin
|
6
6
|
from ._mixins import InputEventMixin
|
7
7
|
|
8
8
|
if TYPE_CHECKING:
|
9
9
|
from instaui.vars.types import TMaybeRef
|
10
10
|
|
11
11
|
|
12
|
-
class Input(InputEventMixin, ValueElement[str]):
|
12
|
+
class Input(InputEventMixin, CanDisabledMixin, ValueElement[str]):
|
13
13
|
def __init__(
|
14
14
|
self,
|
15
15
|
value: Union[str, TMaybeRef[str], None] = None,
|
@@ -9,11 +9,12 @@ from instaui.components.element import Element
|
|
9
9
|
from instaui.event.event_mixin import EventMixin
|
10
10
|
from instaui.vars.types import TMaybeRef
|
11
11
|
from instaui.components.vfor import VFor
|
12
|
+
from instaui.components.mixins import CanDisabledMixin
|
12
13
|
|
13
14
|
_T_Select_Value = Union[List[str], str]
|
14
15
|
|
15
16
|
|
16
|
-
class Select(ValueElement[Union[List[str], str]]):
|
17
|
+
class Select(CanDisabledMixin, ValueElement[Union[List[str], str]]):
|
17
18
|
def __init__(
|
18
19
|
self,
|
19
20
|
value: Union[_T_Select_Value, TMaybeRef[_T_Select_Value], None] = None,
|
@@ -48,7 +49,7 @@ class Select(ValueElement[Union[List[str], str]]):
|
|
48
49
|
|
49
50
|
return select
|
50
51
|
|
51
|
-
class Option(Element):
|
52
|
+
class Option(Element, CanDisabledMixin):
|
52
53
|
def __init__(
|
53
54
|
self,
|
54
55
|
text: Optional[TMaybeRef[str]] = None,
|
@@ -2,14 +2,14 @@ from __future__ import annotations
|
|
2
2
|
from typing import TYPE_CHECKING, Optional, Union
|
3
3
|
from instaui.components.element import Element
|
4
4
|
from instaui.components.value_element import ValueElement
|
5
|
-
|
5
|
+
from instaui.components.mixins import CanDisabledMixin
|
6
6
|
from ._mixins import InputEventMixin
|
7
7
|
|
8
8
|
if TYPE_CHECKING:
|
9
9
|
from instaui.vars.types import TMaybeRef
|
10
10
|
|
11
11
|
|
12
|
-
class Textarea(InputEventMixin, ValueElement[str]):
|
12
|
+
class Textarea(InputEventMixin, CanDisabledMixin, ValueElement[str]):
|
13
13
|
def __init__(
|
14
14
|
self,
|
15
15
|
value: Union[str, TMaybeRef[str], None] = None,
|
@@ -11,8 +11,6 @@ class Match(Component):
|
|
11
11
|
def __init__(self, on: ElementBindingMixin):
|
12
12
|
super().__init__("match")
|
13
13
|
self._on = on
|
14
|
-
if isinstance(on, ElementBindingMixin):
|
15
|
-
on._mark_used()
|
16
14
|
self._default_case = None
|
17
15
|
|
18
16
|
def _to_json_dict(self):
|
@@ -52,7 +50,7 @@ class Case(Component):
|
|
52
50
|
def __init__(self, value: typing.Any):
|
53
51
|
super().__init__("case")
|
54
52
|
self._value = value
|
55
|
-
self.__scope_manager = new_scope(
|
53
|
+
self.__scope_manager = new_scope()
|
56
54
|
self.__scope = None
|
57
55
|
|
58
56
|
def __enter__(self):
|
@@ -70,7 +68,7 @@ class Case(Component):
|
|
70
68
|
}
|
71
69
|
props = data["props"]
|
72
70
|
|
73
|
-
props["
|
71
|
+
props["scopeId"] = self.__scope.id # type: ignore
|
74
72
|
|
75
73
|
if self._slot_manager.has_slot():
|
76
74
|
props["items"] = self._slot_manager
|
@@ -83,7 +81,7 @@ class DefaultCase(Component):
|
|
83
81
|
def __init__(self):
|
84
82
|
super().__init__("default-case")
|
85
83
|
|
86
|
-
self.__scope_manager = new_scope(
|
84
|
+
self.__scope_manager = new_scope()
|
87
85
|
self.__scope = None
|
88
86
|
|
89
87
|
def __enter__(self):
|
@@ -99,7 +97,7 @@ class DefaultCase(Component):
|
|
99
97
|
data["props"] = {}
|
100
98
|
props = data["props"]
|
101
99
|
|
102
|
-
props["
|
100
|
+
props["scopeId"] = self.__scope.id # type: ignore
|
103
101
|
|
104
102
|
if self._slot_manager.has_slot():
|
105
103
|
props["items"] = self._slot_manager
|
@@ -0,0 +1,12 @@
|
|
1
|
+
from typing import Dict, Protocol
|
2
|
+
from typing_extensions import Self
|
3
|
+
from instaui.vars.types import TMaybeRef
|
4
|
+
|
5
|
+
|
6
|
+
class PropsProtocol(Protocol):
|
7
|
+
def props(self, props: Dict) -> Self: ...
|
8
|
+
|
9
|
+
|
10
|
+
class CanDisabledMixin:
|
11
|
+
def disabled(self: PropsProtocol, disabled: TMaybeRef[bool] = True):
|
12
|
+
return self.props({"disabled": disabled})
|
@@ -50,11 +50,9 @@ class VFor(Component, Generic[_T]):
|
|
50
50
|
|
51
51
|
super().__init__("vfor")
|
52
52
|
self._data = data
|
53
|
-
if isinstance(self._data, ElementBindingMixin):
|
54
|
-
self._data._mark_used()
|
55
53
|
self._key = key
|
56
54
|
self._fid = get_app_slot().generate_vfor_id()
|
57
|
-
self.__scope_manager = new_scope(
|
55
|
+
self.__scope_manager = new_scope()
|
58
56
|
self.__scope = None
|
59
57
|
self._num = None
|
60
58
|
self._transition_group_setting = None
|
@@ -104,7 +102,7 @@ class VFor(Component, Generic[_T]):
|
|
104
102
|
k: v for k, v in self._transition_group_setting.items() if v is not None
|
105
103
|
}
|
106
104
|
|
107
|
-
props["
|
105
|
+
props["scopeId"] = self.__scope.id # type: ignore
|
108
106
|
|
109
107
|
if self._slot_manager.has_slot():
|
110
108
|
props["items"] = self._slot_manager
|
@@ -10,9 +10,7 @@ class VIf(Component):
|
|
10
10
|
def __init__(self, on: TMaybeRef[bool]):
|
11
11
|
super().__init__("vif")
|
12
12
|
self._on = cast(ElementBindingMixin, on)
|
13
|
-
|
14
|
-
on._mark_used()
|
15
|
-
self.__scope_manager = new_scope(append_to_app=False)
|
13
|
+
self.__scope_manager = new_scope()
|
16
14
|
self.__scope = None
|
17
15
|
|
18
16
|
def __enter__(self):
|
@@ -32,7 +30,7 @@ class VIf(Component):
|
|
32
30
|
}
|
33
31
|
props: Dict = data["props"]
|
34
32
|
|
35
|
-
props["
|
33
|
+
props["scopeId"] = self.__scope.id # type: ignore
|
36
34
|
|
37
35
|
if self._slot_manager.has_slot():
|
38
36
|
props["items"] = self._slot_manager
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import typing
|
2
2
|
from instaui.vars.mixin_types.py_binding import CanInputMixin, CanOutputMixin
|
3
|
-
from instaui.vars.mixin_types.element_binding import _try_mark_inputs_used
|
4
3
|
from instaui.common.jsonable import Jsonable
|
5
4
|
from .event_mixin import EventMixin
|
6
5
|
|
@@ -27,7 +26,6 @@ class JsEvent(Jsonable, EventMixin):
|
|
27
26
|
def _to_json_dict(self):
|
28
27
|
data = super()._to_json_dict()
|
29
28
|
data["type"] = self.event_type()
|
30
|
-
_try_mark_inputs_used(self._org_inputs)
|
31
29
|
|
32
30
|
if self._inputs:
|
33
31
|
data["inputs"] = self._inputs
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import typing
|
2
2
|
from instaui.common.jsonable import Jsonable
|
3
3
|
from instaui.vars.mixin_types.observable import ObservableMixin
|
4
|
-
from instaui.vars.mixin_types.element_binding import _try_mark_inputs_used
|
5
4
|
from .event_mixin import EventMixin
|
6
5
|
|
7
6
|
|
@@ -60,8 +59,6 @@ class VueEvent(Jsonable, EventMixin):
|
|
60
59
|
|
61
60
|
def _to_json_dict(self):
|
62
61
|
data = super()._to_json_dict()
|
63
|
-
|
64
|
-
_try_mark_inputs_used((self._bindings or {}).values())
|
65
62
|
data["type"] = self.event_type()
|
66
63
|
return data
|
67
64
|
|
@@ -4,17 +4,16 @@ from typing_extensions import ParamSpec
|
|
4
4
|
from instaui.common.jsonable import Jsonable
|
5
5
|
from instaui.runtime._app import get_current_scope, get_app_slot
|
6
6
|
from instaui.vars.mixin_types.py_binding import CanInputMixin, CanOutputMixin
|
7
|
-
from instaui.vars.mixin_types.element_binding import _try_mark_inputs_used
|
8
7
|
from instaui.handlers import event_handler
|
8
|
+
from instaui import pre_setup as _pre_setup
|
9
9
|
from .event_mixin import EventMixin
|
10
10
|
|
11
|
+
|
11
12
|
_SYNC_TYPE = "sync"
|
12
13
|
_ASYNC_TYPE = "async"
|
13
14
|
|
14
15
|
P = ParamSpec("P")
|
15
16
|
R = typing.TypeVar("R")
|
16
|
-
_T_input = typing.TypeVar("_T_input")
|
17
|
-
_T_output = typing.TypeVar("_T_output")
|
18
17
|
|
19
18
|
|
20
19
|
class WebEvent(Jsonable, EventMixin, typing.Generic[P, R]):
|
@@ -23,10 +22,15 @@ class WebEvent(Jsonable, EventMixin, typing.Generic[P, R]):
|
|
23
22
|
fn: typing.Callable[P, R],
|
24
23
|
inputs: typing.Sequence[CanInputMixin],
|
25
24
|
outputs: typing.Sequence[CanOutputMixin],
|
25
|
+
pre_setup: typing.Optional[typing.Dict] = None,
|
26
26
|
):
|
27
|
+
if pre_setup:
|
28
|
+
_pre_setup._check_args(pre_setup)
|
29
|
+
|
27
30
|
self._inputs = inputs
|
28
31
|
self._outputs = outputs
|
29
32
|
self._fn = fn
|
33
|
+
self._pre_setup = pre_setup
|
30
34
|
|
31
35
|
scope = get_current_scope()
|
32
36
|
self._sid = scope.id
|
@@ -47,8 +51,6 @@ class WebEvent(Jsonable, EventMixin, typing.Generic[P, R]):
|
|
47
51
|
def _to_json_dict(self):
|
48
52
|
app = get_app_slot()
|
49
53
|
|
50
|
-
_try_mark_inputs_used(self._inputs)
|
51
|
-
|
52
54
|
hkey = event_handler.create_handler_key(
|
53
55
|
page_path=app.page_path, handler=self._fn
|
54
56
|
)
|
@@ -76,6 +78,9 @@ class WebEvent(Jsonable, EventMixin, typing.Generic[P, R]):
|
|
76
78
|
if self._outputs:
|
77
79
|
data["set"] = [ref._to_output_config() for ref in self._outputs]
|
78
80
|
|
81
|
+
if self._pre_setup:
|
82
|
+
data["preSetup"] = _pre_setup.convert_config(self._pre_setup)
|
83
|
+
|
79
84
|
return data
|
80
85
|
|
81
86
|
|
@@ -83,6 +88,7 @@ def event(
|
|
83
88
|
*,
|
84
89
|
inputs: typing.Optional[typing.Sequence] = None,
|
85
90
|
outputs: typing.Optional[typing.Sequence] = None,
|
91
|
+
pre_setup: typing.Optional[typing.Dict] = None,
|
86
92
|
):
|
87
93
|
"""
|
88
94
|
Creates an event handler decorator for binding reactive logic to component events.
|
@@ -95,6 +101,8 @@ def event(
|
|
95
101
|
outputs (typing.Optional[typing.Sequence], optional): Targets (state variables, UI elements) that should
|
96
102
|
update when this handler executes. Used for coordinating
|
97
103
|
interface updates after the event is processed.
|
104
|
+
pre_setup (typing.Optional[typing.Dict], optional): A dictionary of pre-setup actions to be executed before the event executes.
|
105
|
+
|
98
106
|
|
99
107
|
# Example:
|
100
108
|
.. code-block:: python
|
@@ -109,6 +117,17 @@ def event(
|
|
109
117
|
html.button("click me").on_click(plus_one)
|
110
118
|
html.paragraph(a)
|
111
119
|
|
120
|
+
use pre_setup:
|
121
|
+
.. code-block:: python
|
122
|
+
a = ui.state(0)
|
123
|
+
task_running = ui.state(False)
|
124
|
+
|
125
|
+
@ui.event(inputs=[a], outputs=[a], pre_setup={task_running: True})
|
126
|
+
async def long_running_task(a):
|
127
|
+
await asyncio.sleep(3)
|
128
|
+
return a + 1
|
129
|
+
|
130
|
+
html.button("click me").on_click(long_running_task).disabled(task_running)
|
112
131
|
"""
|
113
132
|
|
114
133
|
def wrapper(func: typing.Callable[P, R]):
|
@@ -116,6 +135,7 @@ def event(
|
|
116
135
|
func,
|
117
136
|
inputs or [],
|
118
137
|
outputs=outputs or [],
|
138
|
+
pre_setup=pre_setup,
|
119
139
|
)
|
120
140
|
|
121
141
|
return wrapper
|
@@ -17,3 +17,15 @@ class RequestContextMiddleware(BaseHTTPMiddleware):
|
|
17
17
|
reset_app_slot(system_slot_token)
|
18
18
|
|
19
19
|
return response
|
20
|
+
|
21
|
+
|
22
|
+
class NoCacheDebugModeMiddleware(BaseHTTPMiddleware):
|
23
|
+
async def dispatch(self, request: Request, call_next: Callable) -> Any:
|
24
|
+
response = await call_next(request)
|
25
|
+
|
26
|
+
if request.url.path.endswith((".js", ".css")):
|
27
|
+
response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
|
28
|
+
response.headers["Pragma"] = "no-cache"
|
29
|
+
response.headers["Expires"] = "0"
|
30
|
+
|
31
|
+
return response
|
@@ -22,6 +22,7 @@ from instaui.page_info import PageInfo
|
|
22
22
|
|
23
23
|
from instaui import consts
|
24
24
|
from instaui.runtime._app import get_app_slot, get_default_app_slot
|
25
|
+
from instaui.runtime.context import get_context
|
25
26
|
from instaui.runtime.dataclass import JsLink, VueAppComponent
|
26
27
|
from instaui.template import web_template
|
27
28
|
|
@@ -30,7 +31,7 @@ from . import dependency_router
|
|
30
31
|
from . import event_router
|
31
32
|
from . import watch_router
|
32
33
|
from . import debug_mode_router
|
33
|
-
from .middlewares import RequestContextMiddleware
|
34
|
+
from .middlewares import RequestContextMiddleware, NoCacheDebugModeMiddleware
|
34
35
|
from ._uvicorn import UvicornServer
|
35
36
|
from . import resource
|
36
37
|
from instaui.version import __version__ as _INSTA_VERSION
|
@@ -55,6 +56,8 @@ class Server:
|
|
55
56
|
):
|
56
57
|
self.app = FastAPI()
|
57
58
|
self.app.add_middleware(RequestContextMiddleware)
|
59
|
+
if get_context().debug_mode:
|
60
|
+
self.app.add_middleware(NoCacheDebugModeMiddleware)
|
58
61
|
|
59
62
|
if use_gzip:
|
60
63
|
self.app.add_middleware(
|
@@ -130,6 +133,7 @@ class Server:
|
|
130
133
|
favicon_url = resource.record_resource(default_html_resource.favicon)
|
131
134
|
|
132
135
|
model = web_template.WebTemplateModel(
|
136
|
+
version=_INSTA_VERSION,
|
133
137
|
vue_js_link=VUE_JS_HASH_LINK,
|
134
138
|
instaui_js_link=INSTAUI_JS_HASH_LINK,
|
135
139
|
css_links=[
|
@@ -21,12 +21,13 @@ class JsFn(Jsonable, CanInputMixin):
|
|
21
21
|
ui.label(result)
|
22
22
|
"""
|
23
23
|
|
24
|
-
def __init__(self, code: str):
|
24
|
+
def __init__(self, code: str, *, execute_immediately=False):
|
25
25
|
self.code = code
|
26
26
|
self.__type = "jsFn"
|
27
27
|
app = get_app_slot()
|
28
28
|
app.register_js_fn(self)
|
29
29
|
self.__id = app.generate_js_fn_id()
|
30
|
+
self._execute_immediately = execute_immediately
|
30
31
|
|
31
32
|
def _to_input_config(self):
|
32
33
|
return {
|
@@ -39,4 +40,7 @@ class JsFn(Jsonable, CanInputMixin):
|
|
39
40
|
data["type"] = self.__type
|
40
41
|
data["id"] = self.__id
|
41
42
|
|
43
|
+
if self._execute_immediately is True:
|
44
|
+
data["immediately"] = 1
|
45
|
+
|
42
46
|
return data
|
@@ -0,0 +1,45 @@
|
|
1
|
+
from typing import Dict, Sequence, cast
|
2
|
+
from instaui.common.jsonable import Jsonable
|
3
|
+
from instaui.vars.mixin_types.py_binding import CanOutputMixin, CanInputMixin
|
4
|
+
|
5
|
+
|
6
|
+
def _check_args(config: Dict):
|
7
|
+
for key in config.keys():
|
8
|
+
if not isinstance(key, CanOutputMixin):
|
9
|
+
raise TypeError(f"key {key} is not a CanOutputMixin")
|
10
|
+
|
11
|
+
|
12
|
+
def convert_config(config: Dict):
|
13
|
+
return [
|
14
|
+
{
|
15
|
+
"target": cast(CanInputMixin, key)._to_input_config(),
|
16
|
+
**value._to_json_dict(),
|
17
|
+
}
|
18
|
+
if isinstance(value, PreSetupAction)
|
19
|
+
else {
|
20
|
+
"type": "const",
|
21
|
+
"target": cast(CanInputMixin, key)._to_input_config(),
|
22
|
+
"value": value,
|
23
|
+
}
|
24
|
+
for key, value in config.items()
|
25
|
+
]
|
26
|
+
|
27
|
+
|
28
|
+
class PreSetupAction(Jsonable):
|
29
|
+
def __init__(self, *, inputs: Sequence, code: str, reset: bool = True):
|
30
|
+
self.type = "action"
|
31
|
+
self._inputs = inputs
|
32
|
+
self.code = code
|
33
|
+
self.reset = reset
|
34
|
+
|
35
|
+
def _to_json_dict(self):
|
36
|
+
data = super()._to_json_dict()
|
37
|
+
if self._inputs:
|
38
|
+
data["inputs"] = [
|
39
|
+
binding._to_input_config()
|
40
|
+
if isinstance(binding, CanInputMixin)
|
41
|
+
else binding
|
42
|
+
for binding in self._inputs
|
43
|
+
]
|
44
|
+
|
45
|
+
return data
|
@@ -30,7 +30,7 @@ class App(Jsonable):
|
|
30
30
|
self._vfor_id_counter = 0
|
31
31
|
self._slot_id_counter = 0
|
32
32
|
self._js_fn_id_counter = 0
|
33
|
-
self.
|
33
|
+
self._mode: _T_App_Mode = mode
|
34
34
|
self.items: List[Component] = []
|
35
35
|
self.meta = meta
|
36
36
|
self._slots_stacks: List[Slot] = []
|
@@ -49,6 +49,10 @@ class App(Jsonable):
|
|
49
49
|
self._route_collector: Optional[RouteCollector] = None
|
50
50
|
self._js_fns: List[JsFn] = []
|
51
51
|
|
52
|
+
@property
|
53
|
+
def mode(self) -> _T_App_Mode:
|
54
|
+
return self._mode
|
55
|
+
|
52
56
|
@property
|
53
57
|
def page_path(self) -> str:
|
54
58
|
assert self._page_path is not None, "Page path is not set"
|
@@ -126,8 +130,8 @@ class App(Jsonable):
|
|
126
130
|
|
127
131
|
data["url"] = url_info
|
128
132
|
|
129
|
-
|
130
|
-
data["
|
133
|
+
data["scopeId"] = self._scopes[0].id
|
134
|
+
data["scopes"] = self._scopes
|
131
135
|
|
132
136
|
if self._route_collector is not None:
|
133
137
|
data["router"] = self._route_collector.model_dump(
|