instaui 0.1.4__py3-none-any.whl → 0.1.6__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/arco/__init__.py +191 -0
- instaui/arco/_settings.py +25 -0
- instaui/arco/_use_tools/locale.py +50 -0
- instaui/arco/component_types.py +1019 -0
- instaui/arco/components/_utils.py +22 -0
- instaui/arco/components/affix.py +29 -0
- instaui/arco/components/alert.py +42 -0
- instaui/arco/components/anchor.py +42 -0
- instaui/arco/components/auto_complete.py +96 -0
- instaui/arco/components/avatar.py +55 -0
- instaui/arco/components/back_top.py +14 -0
- instaui/arco/components/badge.py +14 -0
- instaui/arco/components/breadcrumb.py +14 -0
- instaui/arco/components/button.py +43 -0
- instaui/arco/components/calendar.py +47 -0
- instaui/arco/components/card.py +14 -0
- instaui/arco/components/carousel.py +33 -0
- instaui/arco/components/cascader.py +111 -0
- instaui/arco/components/checkbox.py +32 -0
- instaui/arco/components/collapse.py +31 -0
- instaui/arco/components/color_picker.py +45 -0
- instaui/arco/components/comment.py +14 -0
- instaui/arco/components/config_provider.py +13 -0
- instaui/arco/components/date_picker.py +111 -0
- instaui/arco/components/descriptions.py +14 -0
- instaui/arco/components/divider.py +13 -0
- instaui/arco/components/drawer.py +98 -0
- instaui/arco/components/dropdown.py +45 -0
- instaui/arco/components/empty.py +14 -0
- instaui/arco/components/form.py +55 -0
- instaui/arco/components/icon.py +17 -0
- instaui/arco/components/image.py +33 -0
- instaui/arco/components/input.py +102 -0
- instaui/arco/components/input_number.py +97 -0
- instaui/arco/components/input_password.py +38 -0
- instaui/arco/components/input_search.py +37 -0
- instaui/arco/components/input_tag.py +110 -0
- instaui/arco/components/layout.py +13 -0
- instaui/arco/components/layout_content.py +6 -0
- instaui/arco/components/layout_footer.py +6 -0
- instaui/arco/components/layout_header.py +6 -0
- instaui/arco/components/layout_sider.py +53 -0
- instaui/arco/components/link.py +36 -0
- instaui/arco/components/list.py +68 -0
- instaui/arco/components/mention.py +97 -0
- instaui/arco/components/menu.py +88 -0
- instaui/arco/components/modal.py +97 -0
- instaui/arco/components/overflow_list.py +29 -0
- instaui/arco/components/page_header.py +29 -0
- instaui/arco/components/pagination.py +45 -0
- instaui/arco/components/pop_confirm.py +58 -0
- instaui/arco/components/popover.py +32 -0
- instaui/arco/components/progress.py +14 -0
- instaui/arco/components/radio.py +40 -0
- instaui/arco/components/radio_group.py +42 -0
- instaui/arco/components/rate.py +45 -0
- instaui/arco/components/resize_box.py +62 -0
- instaui/arco/components/result.py +14 -0
- instaui/arco/components/select.py +179 -0
- instaui/arco/components/skeleton.py +14 -0
- instaui/arco/components/slider.py +38 -0
- instaui/arco/components/space.py +14 -0
- instaui/arco/components/spin.py +14 -0
- instaui/arco/components/split.py +76 -0
- instaui/arco/components/statistic.py +14 -0
- instaui/arco/components/steps.py +32 -0
- instaui/arco/components/switch.py +57 -0
- instaui/arco/components/tab_pane.py +12 -0
- instaui/arco/components/table.py +276 -0
- instaui/arco/components/tabs.py +101 -0
- instaui/arco/components/tag.py +42 -0
- instaui/arco/components/textarea.py +84 -0
- instaui/arco/components/time_picker.py +76 -0
- instaui/arco/components/timeline.py +14 -0
- instaui/arco/components/tooltip.py +29 -0
- instaui/arco/components/transfer.py +58 -0
- instaui/arco/components/tree.py +120 -0
- instaui/arco/components/tree_select.py +86 -0
- instaui/arco/components/trigger.py +58 -0
- instaui/arco/components/typography.py +142 -0
- instaui/arco/components/upload.py +71 -0
- instaui/arco/components/verification_code.py +58 -0
- instaui/arco/components/watermark.py +14 -0
- instaui/arco/locales/__init__.py +4 -0
- instaui/arco/locales/_index.py +31 -0
- instaui/arco/locales/en_us.py +227 -0
- instaui/arco/locales/zh_cn.py +224 -0
- instaui/arco/setup.py +36 -0
- instaui/arco/static/instaui-arco.css +1 -0
- instaui/arco/static/instaui-arco.js +55771 -0
- instaui/arco/types.py +24 -0
- instaui/components/column.py +10 -2
- instaui/components/echarts/echarts.js +128 -0
- instaui/components/echarts/echarts.py +194 -0
- instaui/components/echarts/static/echarts.esm.min.js +45 -0
- instaui/components/element.py +50 -6
- instaui/components/grid.py +81 -0
- instaui/components/html/__init__.py +30 -19
- instaui/components/html/_preset.py +4 -0
- instaui/components/html/heading.py +51 -0
- instaui/components/html/range.py +3 -0
- instaui/components/html/select.py +13 -31
- instaui/components/html/table.py +36 -0
- instaui/components/markdown/static/github-markdown.css +1 -1
- instaui/components/markdown/static/marked.esm.js +0 -1
- instaui/components/row.py +8 -7
- instaui/components/shiki_code/shiki_code.js +126 -0
- instaui/components/shiki_code/shiki_code.py +99 -0
- instaui/components/shiki_code/static/langs/css.mjs +5 -0
- instaui/components/shiki_code/static/langs/markdown.mjs +5 -0
- instaui/components/shiki_code/static/langs/python.mjs +5 -0
- instaui/components/shiki_code/static/langs/shell.mjs +2 -0
- instaui/components/shiki_code/static/langs/shellscript.mjs +5 -0
- instaui/components/shiki_code/static/shiki-core.js +5784 -0
- instaui/components/shiki_code/static/shiki-style.css +179 -0
- instaui/components/shiki_code/static/shiki-transformers.js +461 -0
- instaui/components/shiki_code/static/themes/vitesse-dark.mjs +2 -0
- instaui/components/shiki_code/static/themes/vitesse-light.mjs +2 -0
- instaui/components/value_element.py +7 -3
- instaui/consts.py +2 -1
- instaui/event/js_event.py +1 -0
- instaui/event/web_event.py +6 -7
- instaui/experimental/link_sql/__init__.py +3 -0
- instaui/experimental/link_sql/_base.py +23 -0
- instaui/experimental/link_sql/_duckdb.py +221 -0
- instaui/experimental/link_sql/_types.py +15 -0
- instaui/experimental/link_sql/data_source.js +50 -0
- instaui/fastapi_server/debug_mode_router.py +1 -1
- instaui/fastapi_server/server.py +4 -12
- instaui/handlers/event_handler.py +3 -1
- instaui/handlers/watch_handler.py +4 -0
- instaui/html_tools.py +41 -4
- instaui/runtime/_app.py +37 -3
- instaui/runtime/_link_manager.py +89 -0
- instaui/runtime/resource.py +19 -9
- instaui/runtime/scope.py +28 -7
- instaui/shadcn_classless/_index.py +42 -0
- instaui/shadcn_classless/static/shadcn-classless.css +403 -0
- instaui/static/insta-ui.css +1 -1
- instaui/static/insta-ui.esm-browser.prod.js +3663 -3658
- instaui/static/insta-ui.js.map +1 -1
- instaui/static/instaui-tools-browser.js +511 -0
- instaui/static/templates/debug/sse.html +1 -1
- instaui/static/templates/webview.html +78 -0
- instaui/tailwind/__init__.py +6 -0
- instaui/tailwind/_index.py +24 -0
- instaui/{static/tailwindcss.min.js → tailwind/static/tailwindcss-v3.min.js} +62 -62
- instaui/tailwind/static/tailwindcss-v4.min.js +8 -0
- instaui/template/_utils.py +23 -0
- instaui/template/webview_template.py +50 -0
- instaui/ui/__init__.py +8 -2
- instaui/ui/__init__.pyi +7 -1
- instaui/ui_functions/ui_page.py +1 -1
- instaui/vars/data.py +7 -7
- instaui/vars/element_ref.py +2 -4
- instaui/vars/event_context.py +4 -0
- instaui/vars/js_computed.py +6 -8
- instaui/vars/ref.py +6 -6
- instaui/vars/vue_computed.py +6 -7
- instaui/vars/web_computed.py +31 -32
- instaui/watch/vue_watch.py +23 -7
- instaui/watch/web_watch.py +5 -6
- instaui/webview/__init__.py +1 -0
- instaui/webview/_utils.py +8 -0
- instaui/webview/api.py +72 -0
- instaui/webview/func.py +114 -0
- instaui/webview/index.py +162 -0
- instaui/webview/resource.py +172 -0
- instaui/zero/func.py +19 -12
- instaui/zero/scope.py +29 -28
- {instaui-0.1.4.dist-info → instaui-0.1.6.dist-info}/METADATA +6 -2
- instaui-0.1.6.dist-info/RECORD +286 -0
- instaui/components/highlight_code/code.js +0 -63
- instaui/components/highlight_code/code.py +0 -117
- instaui/components/highlight_code/static/core.min.js +0 -307
- instaui/components/highlight_code/static/languages/css.min.js +0 -31
- instaui/components/highlight_code/static/languages/javascript.min.js +0 -81
- instaui/components/highlight_code/static/languages/json.min.js +0 -8
- instaui/components/highlight_code/static/languages/python-repl.min.js +0 -5
- instaui/components/highlight_code/static/languages/python.min.js +0 -42
- instaui/components/highlight_code/static/languages/shell.min.js +0 -5
- instaui/components/highlight_code/static/styles/default.min.css +0 -9
- instaui/components/highlight_code/static/styles/github-dark-dimmed.min.css +0 -9
- instaui/components/highlight_code/static/styles/github-dark.min.css +0 -10
- instaui/components/highlight_code/static/styles/github.min.css +0 -10
- instaui/daisyui/__init__.py +0 -20
- instaui/daisyui/_index.py +0 -15
- instaui/daisyui/button.py +0 -38
- instaui/daisyui/checkbox.py +0 -17
- instaui/daisyui/static/daisyui.css +0 -1
- instaui/daisyui/static/themes.css +0 -1
- instaui/handlers/computed_handler.py +0 -42
- instaui/handlers/config_handler.py +0 -13
- instaui/ui/__build_init.py +0 -73
- instaui/vars/_utils.py +0 -12
- instaui-0.1.4.dist-info/RECORD +0 -179
- {instaui-0.1.4.dist-info → instaui-0.1.6.dist-info}/LICENSE +0 -0
- {instaui-0.1.4.dist-info → instaui-0.1.6.dist-info}/WHEEL +0 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
import typing
|
2
|
+
from typing_extensions import Unpack
|
3
|
+
from instaui.components.element import Element
|
4
|
+
from instaui.arco import component_types
|
5
|
+
from instaui.event.event_mixin import EventMixin
|
6
|
+
from ._utils import handle_props
|
7
|
+
|
8
|
+
|
9
|
+
class Tooltip(Element):
|
10
|
+
def __init__(
|
11
|
+
self,
|
12
|
+
**kwargs: Unpack[component_types.TTooltip],
|
13
|
+
):
|
14
|
+
super().__init__("a-tooltip")
|
15
|
+
|
16
|
+
self.props(handle_props(kwargs)) # type: ignore
|
17
|
+
|
18
|
+
def on_popup_visible_change(
|
19
|
+
self,
|
20
|
+
handler: EventMixin,
|
21
|
+
*,
|
22
|
+
extends: typing.Optional[typing.List] = None,
|
23
|
+
):
|
24
|
+
self.on(
|
25
|
+
"popup-visible-change",
|
26
|
+
handler,
|
27
|
+
extends=extends,
|
28
|
+
)
|
29
|
+
return self
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import typing
|
2
|
+
from typing_extensions import Unpack
|
3
|
+
from instaui.components.element import Element
|
4
|
+
from instaui.vars.types import TMaybeRef
|
5
|
+
from instaui.arco import component_types
|
6
|
+
from instaui.event.event_mixin import EventMixin
|
7
|
+
from ._utils import handle_props, try_setup_vmodel
|
8
|
+
|
9
|
+
|
10
|
+
class Transfer(Element):
|
11
|
+
def __init__(
|
12
|
+
self,
|
13
|
+
value: typing.Optional[TMaybeRef[typing.List[str]]] = None,
|
14
|
+
**kwargs: Unpack[component_types.TTransfer],
|
15
|
+
):
|
16
|
+
super().__init__("a-transfer")
|
17
|
+
|
18
|
+
try_setup_vmodel(self, value)
|
19
|
+
self.props(handle_props(kwargs)) # type: ignore
|
20
|
+
|
21
|
+
def on_change(
|
22
|
+
self,
|
23
|
+
handler: EventMixin,
|
24
|
+
*,
|
25
|
+
extends: typing.Optional[typing.List] = None,
|
26
|
+
):
|
27
|
+
self.on(
|
28
|
+
"change",
|
29
|
+
handler,
|
30
|
+
extends=extends,
|
31
|
+
)
|
32
|
+
return self
|
33
|
+
|
34
|
+
def on_select(
|
35
|
+
self,
|
36
|
+
handler: EventMixin,
|
37
|
+
*,
|
38
|
+
extends: typing.Optional[typing.List] = None,
|
39
|
+
):
|
40
|
+
self.on(
|
41
|
+
"select",
|
42
|
+
handler,
|
43
|
+
extends=extends,
|
44
|
+
)
|
45
|
+
return self
|
46
|
+
|
47
|
+
def on_search(
|
48
|
+
self,
|
49
|
+
handler: EventMixin,
|
50
|
+
*,
|
51
|
+
extends: typing.Optional[typing.List] = None,
|
52
|
+
):
|
53
|
+
self.on(
|
54
|
+
"search",
|
55
|
+
handler,
|
56
|
+
extends=extends,
|
57
|
+
)
|
58
|
+
return self
|
@@ -0,0 +1,120 @@
|
|
1
|
+
import typing
|
2
|
+
from typing_extensions import Unpack
|
3
|
+
from instaui.components.element import Element
|
4
|
+
from instaui.arco import component_types
|
5
|
+
from instaui.event.event_mixin import EventMixin
|
6
|
+
from ._utils import handle_props
|
7
|
+
|
8
|
+
|
9
|
+
class Tree(Element):
|
10
|
+
def __init__(
|
11
|
+
self,
|
12
|
+
**kwargs: Unpack[component_types.TTree],
|
13
|
+
):
|
14
|
+
super().__init__("a-tree")
|
15
|
+
|
16
|
+
self.props(handle_props(kwargs)) # type: ignore
|
17
|
+
|
18
|
+
def on_select(
|
19
|
+
self,
|
20
|
+
handler: EventMixin,
|
21
|
+
*,
|
22
|
+
extends: typing.Optional[typing.List] = None,
|
23
|
+
):
|
24
|
+
self.on(
|
25
|
+
"select",
|
26
|
+
handler,
|
27
|
+
extends=extends,
|
28
|
+
)
|
29
|
+
return self
|
30
|
+
|
31
|
+
def on_check(
|
32
|
+
self,
|
33
|
+
handler: EventMixin,
|
34
|
+
*,
|
35
|
+
extends: typing.Optional[typing.List] = None,
|
36
|
+
):
|
37
|
+
self.on(
|
38
|
+
"check",
|
39
|
+
handler,
|
40
|
+
extends=extends,
|
41
|
+
)
|
42
|
+
return self
|
43
|
+
|
44
|
+
def on_expand(
|
45
|
+
self,
|
46
|
+
handler: EventMixin,
|
47
|
+
*,
|
48
|
+
extends: typing.Optional[typing.List] = None,
|
49
|
+
):
|
50
|
+
self.on(
|
51
|
+
"expand",
|
52
|
+
handler,
|
53
|
+
extends=extends,
|
54
|
+
)
|
55
|
+
return self
|
56
|
+
|
57
|
+
def on_drag_start(
|
58
|
+
self,
|
59
|
+
handler: EventMixin,
|
60
|
+
*,
|
61
|
+
extends: typing.Optional[typing.List] = None,
|
62
|
+
):
|
63
|
+
self.on(
|
64
|
+
"drag-start",
|
65
|
+
handler,
|
66
|
+
extends=extends,
|
67
|
+
)
|
68
|
+
return self
|
69
|
+
|
70
|
+
def on_drag_end(
|
71
|
+
self,
|
72
|
+
handler: EventMixin,
|
73
|
+
*,
|
74
|
+
extends: typing.Optional[typing.List] = None,
|
75
|
+
):
|
76
|
+
self.on(
|
77
|
+
"drag-end",
|
78
|
+
handler,
|
79
|
+
extends=extends,
|
80
|
+
)
|
81
|
+
return self
|
82
|
+
|
83
|
+
def on_drag_over(
|
84
|
+
self,
|
85
|
+
handler: EventMixin,
|
86
|
+
*,
|
87
|
+
extends: typing.Optional[typing.List] = None,
|
88
|
+
):
|
89
|
+
self.on(
|
90
|
+
"drag-over",
|
91
|
+
handler,
|
92
|
+
extends=extends,
|
93
|
+
)
|
94
|
+
return self
|
95
|
+
|
96
|
+
def on_drag_leave(
|
97
|
+
self,
|
98
|
+
handler: EventMixin,
|
99
|
+
*,
|
100
|
+
extends: typing.Optional[typing.List] = None,
|
101
|
+
):
|
102
|
+
self.on(
|
103
|
+
"drag-leave",
|
104
|
+
handler,
|
105
|
+
extends=extends,
|
106
|
+
)
|
107
|
+
return self
|
108
|
+
|
109
|
+
def on_drop(
|
110
|
+
self,
|
111
|
+
handler: EventMixin,
|
112
|
+
*,
|
113
|
+
extends: typing.Optional[typing.List] = None,
|
114
|
+
):
|
115
|
+
self.on(
|
116
|
+
"drop",
|
117
|
+
handler,
|
118
|
+
extends=extends,
|
119
|
+
)
|
120
|
+
return self
|
@@ -0,0 +1,86 @@
|
|
1
|
+
import typing
|
2
|
+
from typing_extensions import Unpack
|
3
|
+
from instaui.components.element import Element
|
4
|
+
from instaui.vars.types import TMaybeRef
|
5
|
+
from instaui.arco import component_types
|
6
|
+
from instaui.event.event_mixin import EventMixin
|
7
|
+
from ._utils import handle_props, try_setup_vmodel
|
8
|
+
|
9
|
+
_TTreeSelectValue = typing.Union[str, int, typing.List[typing.Union[str, int]]]
|
10
|
+
|
11
|
+
|
12
|
+
class TreeSelect(Element):
|
13
|
+
def __init__(
|
14
|
+
self,
|
15
|
+
value: typing.Optional[TMaybeRef[_TTreeSelectValue]] = None,
|
16
|
+
**kwargs: Unpack[component_types.TTreeselect],
|
17
|
+
):
|
18
|
+
super().__init__("a-tree-select")
|
19
|
+
|
20
|
+
try_setup_vmodel(self, value)
|
21
|
+
self.props(handle_props(kwargs)) # type: ignore
|
22
|
+
|
23
|
+
def on_change(
|
24
|
+
self,
|
25
|
+
handler: EventMixin,
|
26
|
+
*,
|
27
|
+
extends: typing.Optional[typing.List] = None,
|
28
|
+
):
|
29
|
+
self.on(
|
30
|
+
"change",
|
31
|
+
handler,
|
32
|
+
extends=extends,
|
33
|
+
)
|
34
|
+
return self
|
35
|
+
|
36
|
+
def on_popup_visible_change(
|
37
|
+
self,
|
38
|
+
handler: EventMixin,
|
39
|
+
*,
|
40
|
+
extends: typing.Optional[typing.List] = None,
|
41
|
+
):
|
42
|
+
self.on(
|
43
|
+
"popup-visible-change",
|
44
|
+
handler,
|
45
|
+
extends=extends,
|
46
|
+
)
|
47
|
+
return self
|
48
|
+
|
49
|
+
def on_search(
|
50
|
+
self,
|
51
|
+
handler: EventMixin,
|
52
|
+
*,
|
53
|
+
extends: typing.Optional[typing.List] = None,
|
54
|
+
):
|
55
|
+
self.on(
|
56
|
+
"search",
|
57
|
+
handler,
|
58
|
+
extends=extends,
|
59
|
+
)
|
60
|
+
return self
|
61
|
+
|
62
|
+
def on_clear(
|
63
|
+
self,
|
64
|
+
handler: EventMixin,
|
65
|
+
*,
|
66
|
+
extends: typing.Optional[typing.List] = None,
|
67
|
+
):
|
68
|
+
self.on(
|
69
|
+
"clear",
|
70
|
+
handler,
|
71
|
+
extends=extends,
|
72
|
+
)
|
73
|
+
return self
|
74
|
+
|
75
|
+
def on_input_value_change(
|
76
|
+
self,
|
77
|
+
handler: EventMixin,
|
78
|
+
*,
|
79
|
+
extends: typing.Optional[typing.List] = None,
|
80
|
+
):
|
81
|
+
self.on(
|
82
|
+
"input-value-change",
|
83
|
+
handler,
|
84
|
+
extends=extends,
|
85
|
+
)
|
86
|
+
return self
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import typing
|
2
|
+
from typing_extensions import Unpack
|
3
|
+
from instaui.components.element import Element
|
4
|
+
from instaui.vars.types import TMaybeRef
|
5
|
+
from instaui.arco import component_types
|
6
|
+
from instaui.event.event_mixin import EventMixin
|
7
|
+
from ._utils import handle_props, try_setup_vmodel
|
8
|
+
|
9
|
+
|
10
|
+
class Trigger(Element):
|
11
|
+
def __init__(
|
12
|
+
self,
|
13
|
+
popup_visible_value: typing.Optional[TMaybeRef[bool]] = None,
|
14
|
+
**kwargs: Unpack[component_types.TTrigger],
|
15
|
+
):
|
16
|
+
super().__init__("a-trigger")
|
17
|
+
|
18
|
+
try_setup_vmodel(self, popup_visible_value, prop_name="popup-visible")
|
19
|
+
self.props(handle_props(kwargs)) # type: ignore
|
20
|
+
|
21
|
+
def on_popup_visible_change(
|
22
|
+
self,
|
23
|
+
handler: EventMixin,
|
24
|
+
*,
|
25
|
+
extends: typing.Optional[typing.List] = None,
|
26
|
+
):
|
27
|
+
self.on(
|
28
|
+
"popup-visible-change",
|
29
|
+
handler,
|
30
|
+
extends=extends,
|
31
|
+
)
|
32
|
+
return self
|
33
|
+
|
34
|
+
def on_show(
|
35
|
+
self,
|
36
|
+
handler: EventMixin,
|
37
|
+
*,
|
38
|
+
extends: typing.Optional[typing.List] = None,
|
39
|
+
):
|
40
|
+
self.on(
|
41
|
+
"show",
|
42
|
+
handler,
|
43
|
+
extends=extends,
|
44
|
+
)
|
45
|
+
return self
|
46
|
+
|
47
|
+
def on_hide(
|
48
|
+
self,
|
49
|
+
handler: EventMixin,
|
50
|
+
*,
|
51
|
+
extends: typing.Optional[typing.List] = None,
|
52
|
+
):
|
53
|
+
self.on(
|
54
|
+
"hide",
|
55
|
+
handler,
|
56
|
+
extends=extends,
|
57
|
+
)
|
58
|
+
return self
|
@@ -0,0 +1,142 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
import typing
|
3
|
+
from typing_extensions import Unpack
|
4
|
+
from instaui.vars.types import TMaybeRef
|
5
|
+
from instaui.components.element import Element
|
6
|
+
from instaui.components.content import Content
|
7
|
+
from instaui.arco import component_types
|
8
|
+
from instaui.event.event_mixin import EventMixin
|
9
|
+
from ._utils import handle_props
|
10
|
+
|
11
|
+
|
12
|
+
class Typography(Element):
|
13
|
+
_exten_name: typing.ClassVar[typing.Optional[str]] = None
|
14
|
+
|
15
|
+
def __init__(
|
16
|
+
self,
|
17
|
+
text: typing.Optional[TMaybeRef[str]] = None,
|
18
|
+
**kwargs: Unpack[component_types.TTypography],
|
19
|
+
):
|
20
|
+
tag = f"a-typography{'-'+ self._exten_name if self._exten_name else ''}"
|
21
|
+
super().__init__(tag)
|
22
|
+
|
23
|
+
if text is not None:
|
24
|
+
with self:
|
25
|
+
Content(text)
|
26
|
+
|
27
|
+
self.props(handle_props(kwargs)) # type: ignore
|
28
|
+
|
29
|
+
def __init_subclass__(cls, *, exten_name: str = "") -> None:
|
30
|
+
cls._exten_name = exten_name
|
31
|
+
|
32
|
+
def on_edit_start(
|
33
|
+
self,
|
34
|
+
handler: EventMixin,
|
35
|
+
*,
|
36
|
+
extends: typing.Optional[typing.List] = None,
|
37
|
+
):
|
38
|
+
self.on(
|
39
|
+
"edit-start",
|
40
|
+
handler,
|
41
|
+
extends=extends,
|
42
|
+
)
|
43
|
+
return self
|
44
|
+
|
45
|
+
def on_change(
|
46
|
+
self,
|
47
|
+
handler: EventMixin,
|
48
|
+
*,
|
49
|
+
extends: typing.Optional[typing.List] = None,
|
50
|
+
):
|
51
|
+
self.on(
|
52
|
+
"change",
|
53
|
+
handler,
|
54
|
+
extends=extends,
|
55
|
+
)
|
56
|
+
return self
|
57
|
+
|
58
|
+
def on_edit_end(
|
59
|
+
self,
|
60
|
+
handler: EventMixin,
|
61
|
+
*,
|
62
|
+
extends: typing.Optional[typing.List] = None,
|
63
|
+
):
|
64
|
+
self.on(
|
65
|
+
"edit-end",
|
66
|
+
handler,
|
67
|
+
extends=extends,
|
68
|
+
)
|
69
|
+
return self
|
70
|
+
|
71
|
+
def on_copy(
|
72
|
+
self,
|
73
|
+
handler: EventMixin,
|
74
|
+
*,
|
75
|
+
extends: typing.Optional[typing.List] = None,
|
76
|
+
):
|
77
|
+
self.on(
|
78
|
+
"copy",
|
79
|
+
handler,
|
80
|
+
extends=extends,
|
81
|
+
)
|
82
|
+
return self
|
83
|
+
|
84
|
+
def on_ellipsis(
|
85
|
+
self,
|
86
|
+
handler: EventMixin,
|
87
|
+
*,
|
88
|
+
extends: typing.Optional[typing.List] = None,
|
89
|
+
):
|
90
|
+
self.on(
|
91
|
+
"ellipsis",
|
92
|
+
handler,
|
93
|
+
extends=extends,
|
94
|
+
)
|
95
|
+
return self
|
96
|
+
|
97
|
+
def on_expand(
|
98
|
+
self,
|
99
|
+
handler: EventMixin,
|
100
|
+
*,
|
101
|
+
extends: typing.Optional[typing.List] = None,
|
102
|
+
):
|
103
|
+
self.on(
|
104
|
+
"expand",
|
105
|
+
handler,
|
106
|
+
extends=extends,
|
107
|
+
)
|
108
|
+
return self
|
109
|
+
|
110
|
+
|
111
|
+
class TypographyTitle(Typography, exten_name="title"):
|
112
|
+
def __init__(
|
113
|
+
self,
|
114
|
+
text: typing.Optional[TMaybeRef[str]] = None,
|
115
|
+
*,
|
116
|
+
heading: typing.Optional[
|
117
|
+
TMaybeRef[typing.Literal["1", "2", "3", "4", "5", "6"]]
|
118
|
+
] = None,
|
119
|
+
**kwargs: Unpack[component_types.TTypography],
|
120
|
+
):
|
121
|
+
super().__init__(text=text, **kwargs)
|
122
|
+
|
123
|
+
if heading is not None:
|
124
|
+
self.props({"heading": heading})
|
125
|
+
|
126
|
+
|
127
|
+
class TypographyParagraph(Typography, exten_name="paragraph"):
|
128
|
+
def __init__(
|
129
|
+
self,
|
130
|
+
text: typing.Optional[TMaybeRef[str]] = None,
|
131
|
+
*,
|
132
|
+
blockquote: typing.Optional[TMaybeRef[bool]] = None,
|
133
|
+
spacing: typing.Optional[TMaybeRef[typing.Literal["default", "close"]]] = None,
|
134
|
+
**kwargs: Unpack[component_types.TTypography],
|
135
|
+
):
|
136
|
+
super().__init__(text=text, **kwargs)
|
137
|
+
|
138
|
+
if blockquote is not None:
|
139
|
+
self.props({"blockquote": blockquote})
|
140
|
+
|
141
|
+
if spacing is not None:
|
142
|
+
self.props({"spacing": spacing})
|
@@ -0,0 +1,71 @@
|
|
1
|
+
import typing
|
2
|
+
from typing_extensions import Unpack
|
3
|
+
from instaui.components.element import Element
|
4
|
+
from instaui.vars.types import TMaybeRef
|
5
|
+
from instaui.arco import component_types
|
6
|
+
from instaui.event.event_mixin import EventMixin
|
7
|
+
from ._utils import handle_props, try_setup_vmodel
|
8
|
+
|
9
|
+
|
10
|
+
class Upload(Element):
|
11
|
+
def __init__(
|
12
|
+
self,
|
13
|
+
value: typing.Optional[TMaybeRef[typing.Any]] = None,
|
14
|
+
**kwargs: Unpack[component_types.TUpload],
|
15
|
+
):
|
16
|
+
super().__init__("a-upload")
|
17
|
+
|
18
|
+
try_setup_vmodel(self, value)
|
19
|
+
self.props(handle_props(kwargs)) # type: ignore
|
20
|
+
|
21
|
+
def on_submit(
|
22
|
+
self,
|
23
|
+
handler: EventMixin,
|
24
|
+
*,
|
25
|
+
extends: typing.Optional[typing.List] = None,
|
26
|
+
):
|
27
|
+
self.on(
|
28
|
+
"submit",
|
29
|
+
handler,
|
30
|
+
extends=extends,
|
31
|
+
)
|
32
|
+
return self
|
33
|
+
|
34
|
+
def on_abort(
|
35
|
+
self,
|
36
|
+
handler: EventMixin,
|
37
|
+
*,
|
38
|
+
extends: typing.Optional[typing.List] = None,
|
39
|
+
):
|
40
|
+
self.on(
|
41
|
+
"abort",
|
42
|
+
handler,
|
43
|
+
extends=extends,
|
44
|
+
)
|
45
|
+
return self
|
46
|
+
|
47
|
+
def on_update_file(
|
48
|
+
self,
|
49
|
+
handler: EventMixin,
|
50
|
+
*,
|
51
|
+
extends: typing.Optional[typing.List] = None,
|
52
|
+
):
|
53
|
+
self.on(
|
54
|
+
"updateFile",
|
55
|
+
handler,
|
56
|
+
extends=extends,
|
57
|
+
)
|
58
|
+
return self
|
59
|
+
|
60
|
+
def on_upload(
|
61
|
+
self,
|
62
|
+
handler: EventMixin,
|
63
|
+
*,
|
64
|
+
extends: typing.Optional[typing.List] = None,
|
65
|
+
):
|
66
|
+
self.on(
|
67
|
+
"upload",
|
68
|
+
handler,
|
69
|
+
extends=extends,
|
70
|
+
)
|
71
|
+
return self
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import typing
|
2
|
+
from typing_extensions import Unpack
|
3
|
+
from instaui.vars.types import TMaybeRef
|
4
|
+
from instaui.components.element import Element
|
5
|
+
from instaui.arco import component_types
|
6
|
+
from instaui.event.event_mixin import EventMixin
|
7
|
+
from ._utils import handle_props, try_setup_vmodel
|
8
|
+
|
9
|
+
|
10
|
+
class VerificationCode(Element):
|
11
|
+
def __init__(
|
12
|
+
self,
|
13
|
+
value: typing.Optional[TMaybeRef[str]] = None,
|
14
|
+
**kwargs: Unpack[component_types.TVerificationcode],
|
15
|
+
):
|
16
|
+
super().__init__("a-verification-code")
|
17
|
+
|
18
|
+
try_setup_vmodel(self, value)
|
19
|
+
self.props(handle_props(kwargs)) # type: ignore
|
20
|
+
|
21
|
+
def on_change(
|
22
|
+
self,
|
23
|
+
handler: EventMixin,
|
24
|
+
*,
|
25
|
+
extends: typing.Optional[typing.List] = None,
|
26
|
+
):
|
27
|
+
self.on(
|
28
|
+
"change",
|
29
|
+
handler,
|
30
|
+
extends=extends,
|
31
|
+
)
|
32
|
+
return self
|
33
|
+
|
34
|
+
def on_finish(
|
35
|
+
self,
|
36
|
+
handler: EventMixin,
|
37
|
+
*,
|
38
|
+
extends: typing.Optional[typing.List] = None,
|
39
|
+
):
|
40
|
+
self.on(
|
41
|
+
"finish",
|
42
|
+
handler,
|
43
|
+
extends=extends,
|
44
|
+
)
|
45
|
+
return self
|
46
|
+
|
47
|
+
def on_input(
|
48
|
+
self,
|
49
|
+
handler: EventMixin,
|
50
|
+
*,
|
51
|
+
extends: typing.Optional[typing.List] = None,
|
52
|
+
):
|
53
|
+
self.on(
|
54
|
+
"input",
|
55
|
+
handler,
|
56
|
+
extends=extends,
|
57
|
+
)
|
58
|
+
return self
|
@@ -0,0 +1,14 @@
|
|
1
|
+
from typing_extensions import Unpack
|
2
|
+
from instaui.components.element import Element
|
3
|
+
from instaui.arco import component_types
|
4
|
+
from ._utils import handle_props
|
5
|
+
|
6
|
+
|
7
|
+
class Watermark(Element):
|
8
|
+
def __init__(
|
9
|
+
self,
|
10
|
+
**kwargs: Unpack[component_types.TWatermark],
|
11
|
+
):
|
12
|
+
super().__init__("a-watermark")
|
13
|
+
|
14
|
+
self.props(handle_props(kwargs)) # type: ignore
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import importlib
|
2
|
+
from typing import Dict
|
3
|
+
from instaui.arco.types import TLocale
|
4
|
+
|
5
|
+
|
6
|
+
class LazyLocaleDict:
|
7
|
+
def __init__(self):
|
8
|
+
self._locale_map = {}
|
9
|
+
|
10
|
+
def get(self, key: str):
|
11
|
+
key = key.lower().replace("-", "_")
|
12
|
+
|
13
|
+
if key not in self._locale_map:
|
14
|
+
self._locale_map[key] = self._load_locale(key)
|
15
|
+
return self._locale_map[key]
|
16
|
+
|
17
|
+
def _load_locale(self, key: str):
|
18
|
+
module_name = key
|
19
|
+
try:
|
20
|
+
module = importlib.import_module(f"instaui.arco.locales.{module_name}")
|
21
|
+
return module.locale
|
22
|
+
|
23
|
+
except ImportError:
|
24
|
+
raise ImportError(f"Cannot import module {module_name}")
|
25
|
+
|
26
|
+
|
27
|
+
_locale_dict = LazyLocaleDict()
|
28
|
+
|
29
|
+
|
30
|
+
def get_locale(locale: TLocale) -> Dict:
|
31
|
+
return _locale_dict.get(locale)
|