instaui 0.1.2__py3-none-any.whl → 0.1.4__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/components/content.py +4 -4
- instaui/components/element.py +56 -12
- instaui/components/highlight_code/code.js +63 -0
- instaui/components/highlight_code/code.py +117 -0
- instaui/components/highlight_code/static/core.min.js +307 -0
- instaui/components/highlight_code/static/languages/css.min.js +31 -0
- instaui/components/highlight_code/static/languages/javascript.min.js +81 -0
- instaui/components/highlight_code/static/languages/json.min.js +8 -0
- instaui/components/highlight_code/static/languages/python-repl.min.js +5 -0
- instaui/components/highlight_code/static/languages/python.min.js +42 -0
- instaui/components/highlight_code/static/languages/shell.min.js +5 -0
- instaui/components/highlight_code/static/styles/default.min.css +9 -0
- instaui/components/highlight_code/static/styles/github-dark-dimmed.min.css +9 -0
- instaui/components/highlight_code/static/styles/github-dark.min.css +10 -0
- instaui/components/highlight_code/static/styles/github.min.css +10 -0
- instaui/components/html/__init__.py +2 -0
- instaui/components/html/select.py +7 -8
- instaui/components/html/textarea.py +28 -0
- instaui/components/markdown/markdown.js +33 -0
- instaui/components/markdown/markdown.py +41 -0
- instaui/components/markdown/static/github-markdown.css +12 -0
- instaui/components/markdown/static/marked.esm.js +2580 -0
- instaui/components/vfor.py +1 -1
- instaui/consts.py +4 -0
- instaui/daisyui/__init__.py +20 -0
- instaui/daisyui/_index.py +15 -0
- instaui/daisyui/button.py +38 -0
- instaui/daisyui/checkbox.py +17 -0
- instaui/daisyui/static/daisyui.css +1 -0
- instaui/daisyui/static/themes.css +1 -0
- instaui/dependencies/component_dependency.py +11 -5
- instaui/fastapi_server/dependency_router.py +4 -3
- instaui/fastapi_server/resource.py +12 -17
- instaui/fastapi_server/server.py +66 -20
- instaui/html_tools.py +12 -0
- instaui/inject.py +3 -3
- instaui/runtime/_app.py +6 -1
- instaui/runtime/resource.py +5 -2
- instaui/spa_router/_functions.py +1 -1
- instaui/spa_router/_route_model.py +1 -1
- instaui/static/insta-ui.css +1 -1
- instaui/static/insta-ui.esm-browser.prod.js +106 -111
- instaui/static/insta-ui.ico +0 -0
- instaui/static/insta-ui.js.map +1 -1
- instaui/static/templates/debug/sse.html +2 -2
- instaui/systems/file_system.py +3 -5
- instaui/systems/module_system.py +30 -0
- instaui/template/web_template.py +1 -1
- instaui/template/zero_template.py +19 -23
- instaui/ui/__build_init.py +73 -0
- instaui/ui/__init__.py +69 -57
- instaui/ui/__init__.pyi +129 -0
- instaui/ui/events.py +1 -1
- instaui/ui_functions/server.py +3 -1
- instaui/zero/func.py +16 -11
- instaui/zero/scope.py +89 -1
- {instaui-0.1.2.dist-info → instaui-0.1.4.dist-info}/METADATA +1 -1
- {instaui-0.1.2.dist-info → instaui-0.1.4.dist-info}/RECORD +60 -34
- instaui/static/insta-ui.iife.js +0 -29
- instaui/static/insta-ui.iife.js.map +0 -1
- {instaui-0.1.2.dist-info → instaui-0.1.4.dist-info}/LICENSE +0 -0
- {instaui-0.1.2.dist-info → instaui-0.1.4.dist-info}/WHEEL +0 -0
instaui/components/vfor.py
CHANGED
@@ -60,7 +60,7 @@ class VFor(Component, Generic[_T]):
|
|
60
60
|
def __enter__(self) -> _T:
|
61
61
|
self.__scope = self.__scope_manager.__enter__()
|
62
62
|
super().__enter__()
|
63
|
-
return VForItem(self).proxy
|
63
|
+
return VForItem(self).proxy # type: ignore
|
64
64
|
|
65
65
|
def __exit__(self, *_) -> None:
|
66
66
|
self.__scope_manager.__exit__(*_)
|
instaui/consts.py
CHANGED
@@ -8,11 +8,15 @@ _STATIC_DIR = _THIS_DIR.joinpath("static")
|
|
8
8
|
INDEX_TEMPLATE_PATH = _TEMPLATES_DIR.joinpath("index.html")
|
9
9
|
APP_IIFE_JS_PATH = _STATIC_DIR.joinpath("insta-ui.iife.js")
|
10
10
|
APP_ES_JS_PATH = _STATIC_DIR.joinpath("insta-ui.esm-browser.prod.js")
|
11
|
+
APP_ES_JS_MAP_PATH = _STATIC_DIR.joinpath("insta-ui.js.map")
|
11
12
|
APP_CSS_PATH = _STATIC_DIR.joinpath("insta-ui.css")
|
12
13
|
VUE_IIFE_JS_PATH = _STATIC_DIR.joinpath("vue.global.prod.js")
|
13
14
|
VUE_ES_JS_PATH = _STATIC_DIR.joinpath("vue.esm-browser.prod.js")
|
14
15
|
VUE_ES_RUNTIME_JS_PATH = _STATIC_DIR.joinpath("vue.runtime.esm-browser.prod.js")
|
15
16
|
TAILWIND_JS_PATH = _STATIC_DIR.joinpath("tailwindcss.min.js")
|
17
|
+
FAVICON_PATH = _STATIC_DIR.joinpath("insta-ui.ico")
|
18
|
+
|
19
|
+
PAGE_TITLE = "insta-ui"
|
16
20
|
|
17
21
|
_T_App_Mode = Literal["zero", "web", "webview"]
|
18
22
|
TModifier = Literal["trim", "number", "lazy"]
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"""
|
2
|
+
Easy to use DaisyUI components for InstaUI.
|
3
|
+
|
4
|
+
Example usage:
|
5
|
+
.. code-block:: python
|
6
|
+
from instaui import ui, daisyui as dsui
|
7
|
+
|
8
|
+
dsui.use()
|
9
|
+
|
10
|
+
@ui.page("/")
|
11
|
+
def index_page():
|
12
|
+
dsui.checkbox(checked=True)
|
13
|
+
"""
|
14
|
+
|
15
|
+
__all__ = ["use", "checkbox", "button"]
|
16
|
+
|
17
|
+
|
18
|
+
from .checkbox import Checkbox as checkbox
|
19
|
+
from .button import Button as button
|
20
|
+
from ._index import use_daisyui as use
|
@@ -0,0 +1,15 @@
|
|
1
|
+
from pathlib import Path
|
2
|
+
from instaui import ui
|
3
|
+
|
4
|
+
_STATIC_DIR = Path(__file__).parent / "static"
|
5
|
+
_DAISYUI_CSS = _STATIC_DIR / "daisyui.css"
|
6
|
+
_THEME_CSS = _STATIC_DIR / "themes.css"
|
7
|
+
|
8
|
+
|
9
|
+
def use_daisyui(value=True):
|
10
|
+
if value:
|
11
|
+
ui.add_css_link(_DAISYUI_CSS)
|
12
|
+
ui.add_css_link(_THEME_CSS)
|
13
|
+
else:
|
14
|
+
ui.remove_css_link(_DAISYUI_CSS)
|
15
|
+
ui.remove_css_link(_THEME_CSS)
|
@@ -0,0 +1,38 @@
|
|
1
|
+
from typing import Optional
|
2
|
+
from instaui.components.element import Element
|
3
|
+
from instaui.components.content import Content
|
4
|
+
from instaui.vars.types import TMaybeRef
|
5
|
+
|
6
|
+
|
7
|
+
class Button(Element):
|
8
|
+
def __init__(
|
9
|
+
self,
|
10
|
+
label: Optional[TMaybeRef[str]] = None,
|
11
|
+
*,
|
12
|
+
soft: Optional[TMaybeRef[bool]] = None,
|
13
|
+
outline: Optional[TMaybeRef[bool]] = None,
|
14
|
+
dash: Optional[TMaybeRef[bool]] = None,
|
15
|
+
active: Optional[TMaybeRef[bool]] = None,
|
16
|
+
wide: Optional[TMaybeRef[bool]] = None,
|
17
|
+
):
|
18
|
+
super().__init__("button")
|
19
|
+
self.classes("btn")
|
20
|
+
|
21
|
+
if label is not None:
|
22
|
+
with self:
|
23
|
+
Content(label)
|
24
|
+
|
25
|
+
if soft is not None:
|
26
|
+
self.props({"btn-soft": soft})
|
27
|
+
|
28
|
+
if outline is not None:
|
29
|
+
self.props({"btn-outline": outline})
|
30
|
+
|
31
|
+
if dash is not None:
|
32
|
+
self.props({"btn-dash": dash})
|
33
|
+
|
34
|
+
if active is not None:
|
35
|
+
self.props({"btn-active": active})
|
36
|
+
|
37
|
+
if wide is not None:
|
38
|
+
self.props({"btn-wide": wide})
|
@@ -0,0 +1,17 @@
|
|
1
|
+
from typing import Optional
|
2
|
+
from instaui.components.element import Element
|
3
|
+
from instaui.vars.types import TMaybeRef
|
4
|
+
from instaui.vars.web_computed import WebComputed
|
5
|
+
|
6
|
+
|
7
|
+
class Checkbox(Element):
|
8
|
+
def __init__(self, checked: TMaybeRef[bool] = False):
|
9
|
+
super().__init__("input")
|
10
|
+
self.classes("checkbox")
|
11
|
+
self.props({"type": "checkbox"})
|
12
|
+
|
13
|
+
if checked is not None:
|
14
|
+
if isinstance(checked, WebComputed):
|
15
|
+
self.props({"value": checked})
|
16
|
+
else:
|
17
|
+
self.vmodel(checked, prop_name="value", is_html_component=True)
|