instaui 0.1.15__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. instaui/__init__.py +9 -0
  2. instaui/_helper/observable_helper.py +45 -0
  3. instaui/arco/__init__.py +191 -0
  4. instaui/arco/_settings.py +25 -0
  5. instaui/arco/_use_tools/locale.py +50 -0
  6. instaui/arco/component_types.py +1019 -0
  7. instaui/arco/components/_utils.py +22 -0
  8. instaui/arco/components/affix.py +29 -0
  9. instaui/arco/components/alert.py +42 -0
  10. instaui/arco/components/anchor.py +42 -0
  11. instaui/arco/components/auto_complete.py +96 -0
  12. instaui/arco/components/avatar.py +55 -0
  13. instaui/arco/components/back_top.py +14 -0
  14. instaui/arco/components/badge.py +14 -0
  15. instaui/arco/components/breadcrumb.py +14 -0
  16. instaui/arco/components/button.py +43 -0
  17. instaui/arco/components/calendar.py +47 -0
  18. instaui/arco/components/card.py +14 -0
  19. instaui/arco/components/carousel.py +33 -0
  20. instaui/arco/components/cascader.py +111 -0
  21. instaui/arco/components/checkbox.py +32 -0
  22. instaui/arco/components/collapse.py +31 -0
  23. instaui/arco/components/color_picker.py +45 -0
  24. instaui/arco/components/comment.py +14 -0
  25. instaui/arco/components/config_provider.py +13 -0
  26. instaui/arco/components/date_picker.py +111 -0
  27. instaui/arco/components/descriptions.py +14 -0
  28. instaui/arco/components/divider.py +13 -0
  29. instaui/arco/components/drawer.py +98 -0
  30. instaui/arco/components/dropdown.py +45 -0
  31. instaui/arco/components/empty.py +14 -0
  32. instaui/arco/components/form.py +55 -0
  33. instaui/arco/components/icon.py +17 -0
  34. instaui/arco/components/image.py +33 -0
  35. instaui/arco/components/input.py +102 -0
  36. instaui/arco/components/input_number.py +97 -0
  37. instaui/arco/components/input_password.py +38 -0
  38. instaui/arco/components/input_search.py +37 -0
  39. instaui/arco/components/input_tag.py +110 -0
  40. instaui/arco/components/layout.py +13 -0
  41. instaui/arco/components/layout_content.py +6 -0
  42. instaui/arco/components/layout_footer.py +6 -0
  43. instaui/arco/components/layout_header.py +6 -0
  44. instaui/arco/components/layout_sider.py +53 -0
  45. instaui/arco/components/link.py +36 -0
  46. instaui/arco/components/list.py +68 -0
  47. instaui/arco/components/mention.py +97 -0
  48. instaui/arco/components/menu.py +88 -0
  49. instaui/arco/components/modal.py +97 -0
  50. instaui/arco/components/overflow_list.py +29 -0
  51. instaui/arco/components/page_header.py +29 -0
  52. instaui/arco/components/pagination.py +45 -0
  53. instaui/arco/components/pop_confirm.py +58 -0
  54. instaui/arco/components/popover.py +32 -0
  55. instaui/arco/components/progress.py +14 -0
  56. instaui/arco/components/radio.py +40 -0
  57. instaui/arco/components/radio_group.py +42 -0
  58. instaui/arco/components/rate.py +45 -0
  59. instaui/arco/components/resize_box.py +62 -0
  60. instaui/arco/components/result.py +14 -0
  61. instaui/arco/components/select.py +182 -0
  62. instaui/arco/components/skeleton.py +14 -0
  63. instaui/arco/components/slider.py +38 -0
  64. instaui/arco/components/space.py +14 -0
  65. instaui/arco/components/spin.py +14 -0
  66. instaui/arco/components/split.py +76 -0
  67. instaui/arco/components/statistic.py +14 -0
  68. instaui/arco/components/steps.py +32 -0
  69. instaui/arco/components/switch.py +57 -0
  70. instaui/arco/components/tab_pane.py +12 -0
  71. instaui/arco/components/table.py +276 -0
  72. instaui/arco/components/tabs.py +101 -0
  73. instaui/arco/components/tag.py +42 -0
  74. instaui/arco/components/textarea.py +84 -0
  75. instaui/arco/components/time_picker.py +76 -0
  76. instaui/arco/components/timeline.py +14 -0
  77. instaui/arco/components/tooltip.py +29 -0
  78. instaui/arco/components/transfer.py +58 -0
  79. instaui/arco/components/tree.py +120 -0
  80. instaui/arco/components/tree_select.py +86 -0
  81. instaui/arco/components/trigger.py +58 -0
  82. instaui/arco/components/typography.py +142 -0
  83. instaui/arco/components/upload.py +71 -0
  84. instaui/arco/components/verification_code.py +58 -0
  85. instaui/arco/components/watermark.py +14 -0
  86. instaui/arco/locales/__init__.py +4 -0
  87. instaui/arco/locales/_index.py +31 -0
  88. instaui/arco/locales/en_us.py +227 -0
  89. instaui/arco/locales/zh_cn.py +224 -0
  90. instaui/arco/setup.py +36 -0
  91. instaui/arco/static/instaui-arco.css +1 -0
  92. instaui/arco/static/instaui-arco.js +55771 -0
  93. instaui/arco/types.py +24 -0
  94. instaui/boot_info.py +43 -0
  95. instaui/common/jsonable.py +37 -0
  96. instaui/components/__init__.py +0 -0
  97. instaui/components/column.py +26 -0
  98. instaui/components/component.py +47 -0
  99. instaui/components/content.py +34 -0
  100. instaui/components/directive.py +55 -0
  101. instaui/components/element.py +573 -0
  102. instaui/components/grid.py +213 -0
  103. instaui/components/html/__init__.py +49 -0
  104. instaui/components/html/_mixins.py +34 -0
  105. instaui/components/html/_preset.py +4 -0
  106. instaui/components/html/button.py +38 -0
  107. instaui/components/html/checkbox.py +35 -0
  108. instaui/components/html/date.py +28 -0
  109. instaui/components/html/div.py +7 -0
  110. instaui/components/html/form.py +7 -0
  111. instaui/components/html/heading.py +51 -0
  112. instaui/components/html/input.py +28 -0
  113. instaui/components/html/label.py +21 -0
  114. instaui/components/html/li.py +17 -0
  115. instaui/components/html/link.py +31 -0
  116. instaui/components/html/number.py +34 -0
  117. instaui/components/html/paragraph.py +29 -0
  118. instaui/components/html/range.py +48 -0
  119. instaui/components/html/select.py +69 -0
  120. instaui/components/html/span.py +19 -0
  121. instaui/components/html/table.py +36 -0
  122. instaui/components/html/textarea.py +28 -0
  123. instaui/components/html/ul.py +20 -0
  124. instaui/components/label.py +5 -0
  125. instaui/components/markdown/markdown.js +33 -0
  126. instaui/components/markdown/markdown.py +41 -0
  127. instaui/components/markdown/static/github-markdown.css +12 -0
  128. instaui/components/markdown/static/marked.esm.js +2579 -0
  129. instaui/components/match.py +108 -0
  130. instaui/components/row.py +17 -0
  131. instaui/components/shiki_code/shiki_code.js +126 -0
  132. instaui/components/shiki_code/shiki_code.py +99 -0
  133. instaui/components/shiki_code/static/langs/css.mjs +5 -0
  134. instaui/components/shiki_code/static/langs/markdown.mjs +5 -0
  135. instaui/components/shiki_code/static/langs/python.mjs +5 -0
  136. instaui/components/shiki_code/static/langs/shell.mjs +2 -0
  137. instaui/components/shiki_code/static/langs/shellscript.mjs +5 -0
  138. instaui/components/shiki_code/static/shiki-core.js +5784 -0
  139. instaui/components/shiki_code/static/shiki-style.css +179 -0
  140. instaui/components/shiki_code/static/shiki-transformers.js +461 -0
  141. instaui/components/shiki_code/static/themes/vitesse-dark.mjs +2 -0
  142. instaui/components/shiki_code/static/themes/vitesse-light.mjs +2 -0
  143. instaui/components/slot.py +81 -0
  144. instaui/components/transition_group.py +9 -0
  145. instaui/components/value_element.py +52 -0
  146. instaui/components/vfor.py +142 -0
  147. instaui/components/vif.py +42 -0
  148. instaui/consts.py +23 -0
  149. instaui/dependencies/component_dependency.py +22 -0
  150. instaui/dependencies/plugin_dependency.py +28 -0
  151. instaui/event/event_mixin.py +12 -0
  152. instaui/event/js_event.py +82 -0
  153. instaui/event/vue_event.py +66 -0
  154. instaui/event/web_event.py +123 -0
  155. instaui/experimental/__init__.py +3 -0
  156. instaui/experimental/debug.py +48 -0
  157. instaui/extra_libs/_echarts.py +3 -0
  158. instaui/extra_libs/_import_error.py +9 -0
  159. instaui/extra_libs/_mermaid.py +3 -0
  160. instaui/extra_libs/_shiki_code.py +3 -0
  161. instaui/fastapi_server/_utils.py +42 -0
  162. instaui/fastapi_server/_uvicorn.py +37 -0
  163. instaui/fastapi_server/debug_mode_router.py +60 -0
  164. instaui/fastapi_server/dependency_router.py +28 -0
  165. instaui/fastapi_server/event_router.py +58 -0
  166. instaui/fastapi_server/middlewares.py +19 -0
  167. instaui/fastapi_server/request_context.py +19 -0
  168. instaui/fastapi_server/resource.py +30 -0
  169. instaui/fastapi_server/server.py +308 -0
  170. instaui/fastapi_server/watch_router.py +53 -0
  171. instaui/handlers/_utils.py +88 -0
  172. instaui/handlers/event_handler.py +60 -0
  173. instaui/handlers/watch_handler.py +61 -0
  174. instaui/html_tools.py +94 -0
  175. instaui/inject.py +33 -0
  176. instaui/js/__init__.py +4 -0
  177. instaui/js/js_output.py +15 -0
  178. instaui/js/lambda_func.py +35 -0
  179. instaui/launch_collector.py +52 -0
  180. instaui/page_info.py +13 -0
  181. instaui/runtime/__init__.py +29 -0
  182. instaui/runtime/_app.py +234 -0
  183. instaui/runtime/_inner_helper.py +9 -0
  184. instaui/runtime/_link_manager.py +89 -0
  185. instaui/runtime/context.py +47 -0
  186. instaui/runtime/dataclass.py +30 -0
  187. instaui/runtime/resource.py +65 -0
  188. instaui/runtime/scope.py +133 -0
  189. instaui/runtime/ui_state_scope.py +15 -0
  190. instaui/settings/__init__.py +4 -0
  191. instaui/settings/__settings.py +13 -0
  192. instaui/shadcn_classless/_index.py +42 -0
  193. instaui/shadcn_classless/static/shadcn-classless.css +403 -0
  194. instaui/skip.py +12 -0
  195. instaui/spa_router/__init__.py +26 -0
  196. instaui/spa_router/_components.py +35 -0
  197. instaui/spa_router/_file_base_utils.py +273 -0
  198. instaui/spa_router/_functions.py +122 -0
  199. instaui/spa_router/_install.py +11 -0
  200. instaui/spa_router/_route_model.py +117 -0
  201. instaui/spa_router/_router_box.py +40 -0
  202. instaui/spa_router/_router_output.py +22 -0
  203. instaui/spa_router/_router_param_var.py +51 -0
  204. instaui/spa_router/_types.py +4 -0
  205. instaui/spa_router/templates/page_routes +60 -0
  206. instaui/static/insta-ui.css +1 -0
  207. instaui/static/insta-ui.esm-browser.prod.js +3717 -0
  208. instaui/static/insta-ui.ico +0 -0
  209. instaui/static/insta-ui.js.map +1 -0
  210. instaui/static/instaui-tools-browser.js +511 -0
  211. instaui/static/templates/debug/sse.html +117 -0
  212. instaui/static/templates/web.html +74 -0
  213. instaui/static/templates/webview.html +78 -0
  214. instaui/static/templates/zero.html +71 -0
  215. instaui/static/vue.esm-browser.prod.js +9 -0
  216. instaui/static/vue.global.prod.js +9 -0
  217. instaui/static/vue.runtime.esm-browser.prod.js +5 -0
  218. instaui/systems/file_system.py +6 -0
  219. instaui/systems/func_system.py +119 -0
  220. instaui/systems/js_system.py +22 -0
  221. instaui/systems/module_system.py +46 -0
  222. instaui/systems/pydantic_system.py +27 -0
  223. instaui/systems/string_system.py +10 -0
  224. instaui/tailwind/__init__.py +6 -0
  225. instaui/tailwind/_index.py +24 -0
  226. instaui/tailwind/static/tailwindcss-v3.min.js +62 -0
  227. instaui/tailwind/static/tailwindcss-v4.min.js +8 -0
  228. instaui/template/__init__.py +4 -0
  229. instaui/template/_utils.py +23 -0
  230. instaui/template/env.py +7 -0
  231. instaui/template/web_template.py +49 -0
  232. instaui/template/webview_template.py +48 -0
  233. instaui/template/zero_template.py +105 -0
  234. instaui/ui/__init__.py +144 -0
  235. instaui/ui/__init__.pyi +149 -0
  236. instaui/ui/events.py +25 -0
  237. instaui/ui_functions/input_slient_data.py +16 -0
  238. instaui/ui_functions/server.py +15 -0
  239. instaui/ui_functions/str_format.py +36 -0
  240. instaui/ui_functions/ui_page.py +16 -0
  241. instaui/ui_functions/ui_types.py +13 -0
  242. instaui/ui_functions/url_location.py +33 -0
  243. instaui/vars/_types.py +8 -0
  244. instaui/vars/data.py +68 -0
  245. instaui/vars/element_ref.py +40 -0
  246. instaui/vars/event_context.py +49 -0
  247. instaui/vars/event_extend.py +0 -0
  248. instaui/vars/js_computed.py +117 -0
  249. instaui/vars/mixin_types/common_type.py +5 -0
  250. instaui/vars/mixin_types/element_binding.py +16 -0
  251. instaui/vars/mixin_types/observable.py +7 -0
  252. instaui/vars/mixin_types/pathable.py +14 -0
  253. instaui/vars/mixin_types/py_binding.py +13 -0
  254. instaui/vars/mixin_types/str_format_binding.py +8 -0
  255. instaui/vars/mixin_types/var_type.py +5 -0
  256. instaui/vars/path_var.py +90 -0
  257. instaui/vars/ref.py +103 -0
  258. instaui/vars/slot_prop.py +46 -0
  259. instaui/vars/state.py +97 -0
  260. instaui/vars/types.py +24 -0
  261. instaui/vars/vfor_item.py +204 -0
  262. instaui/vars/vue_computed.py +81 -0
  263. instaui/vars/web_computed.py +209 -0
  264. instaui/vars/web_view_computed.py +1 -0
  265. instaui/version.py +3 -0
  266. instaui/watch/_types.py +4 -0
  267. instaui/watch/_utils.py +3 -0
  268. instaui/watch/js_watch.py +110 -0
  269. instaui/watch/vue_watch.py +77 -0
  270. instaui/watch/web_watch.py +181 -0
  271. instaui/webview/__init__.py +2 -0
  272. instaui/webview/_utils.py +8 -0
  273. instaui/webview/api.py +72 -0
  274. instaui/webview/func.py +114 -0
  275. instaui/webview/index.py +161 -0
  276. instaui/webview/resource.py +172 -0
  277. instaui/zero/__init__.py +3 -0
  278. instaui/zero/func.py +123 -0
  279. instaui/zero/scope.py +109 -0
  280. instaui-0.1.15.dist-info/METADATA +152 -0
  281. instaui-0.1.15.dist-info/RECORD +283 -0
  282. instaui-0.1.15.dist-info/WHEEL +5 -0
  283. instaui-0.1.15.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,511 @@
1
+ import { shallowRef as T, shallowReadonly as re, toValue as A, getCurrentScope as ae, onScopeDispose as ie, watch as x, toRef as ue, readonly as K, ref as Q, customRef as se, onMounted as $, nextTick as q, getCurrentInstance as V, hasInjectionContext as U, inject as le, computed as M, unref as ce, watchEffect as fe, toRaw as de } from "vue";
2
+ function X(e) {
3
+ return ae() ? (ie(e), !0) : !1;
4
+ }
5
+ const z = /* @__PURE__ */ new WeakMap(), pe = (...e) => {
6
+ var t;
7
+ const n = e[0], o = (t = V()) == null ? void 0 : t.proxy;
8
+ if (o == null && !U())
9
+ throw new Error("injectLocal must be called in setup");
10
+ return o && z.has(o) && n in z.get(o) ? z.get(o)[n] : le(...e);
11
+ }, J = typeof window < "u" && typeof document < "u";
12
+ typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
13
+ const me = Object.prototype.toString, ve = (e) => me.call(e) === "[object Object]", he = () => {
14
+ };
15
+ function Y(...e) {
16
+ if (e.length !== 1)
17
+ return ue(...e);
18
+ const t = e[0];
19
+ return typeof t == "function" ? K(se(() => ({ get: t, set: he }))) : Q(t);
20
+ }
21
+ function ye(e, t) {
22
+ function n(...o) {
23
+ return new Promise((a, c) => {
24
+ Promise.resolve(e(() => t.apply(this, o), { fn: t, thisArg: this, args: o })).then(a).catch(c);
25
+ });
26
+ }
27
+ return n;
28
+ }
29
+ const Z = (e) => e();
30
+ function ge(e = Z, t = {}) {
31
+ const {
32
+ initialState: n = "active"
33
+ } = t, o = Y(n === "active");
34
+ function a() {
35
+ o.value = !1;
36
+ }
37
+ function c() {
38
+ o.value = !0;
39
+ }
40
+ const u = (...r) => {
41
+ o.value && e(...r);
42
+ };
43
+ return { isActive: K(o), pause: a, resume: c, eventFilter: u };
44
+ }
45
+ function Se(e) {
46
+ let t;
47
+ function n() {
48
+ return t || (t = e()), t;
49
+ }
50
+ return n.reset = async () => {
51
+ const o = t;
52
+ t = void 0, o && await o;
53
+ }, n;
54
+ }
55
+ function I(e) {
56
+ return e.endsWith("rem") ? Number.parseFloat(e) * 16 : Number.parseFloat(e);
57
+ }
58
+ function P(e) {
59
+ return Array.isArray(e) ? e : [e];
60
+ }
61
+ function we(e) {
62
+ return V();
63
+ }
64
+ function be(e, t, n = {}) {
65
+ const {
66
+ eventFilter: o = Z,
67
+ ...a
68
+ } = n;
69
+ return x(
70
+ e,
71
+ ye(
72
+ o,
73
+ t
74
+ ),
75
+ a
76
+ );
77
+ }
78
+ function Ce(e, t, n = {}) {
79
+ const {
80
+ eventFilter: o,
81
+ initialState: a = "active",
82
+ ...c
83
+ } = n, { eventFilter: u, pause: r, resume: s, isActive: l } = ge(o, { initialState: a });
84
+ return { stop: be(
85
+ e,
86
+ t,
87
+ {
88
+ ...c,
89
+ eventFilter: u
90
+ }
91
+ ), pause: r, resume: s, isActive: l };
92
+ }
93
+ function ee(e, t = !0, n) {
94
+ we() ? $(e, n) : t ? e() : q(e);
95
+ }
96
+ function ke(e, t, n = {}) {
97
+ const {
98
+ immediate: o = !0,
99
+ immediateCallback: a = !1
100
+ } = n, c = T(!1);
101
+ let u = null;
102
+ function r() {
103
+ u && (clearTimeout(u), u = null);
104
+ }
105
+ function s() {
106
+ c.value = !1, r();
107
+ }
108
+ function l(...f) {
109
+ a && e(), r(), c.value = !0, u = setTimeout(() => {
110
+ c.value = !1, u = null, e(...f);
111
+ }, A(t));
112
+ }
113
+ return o && (c.value = !0, J && l()), X(s), {
114
+ isPending: re(c),
115
+ start: l,
116
+ stop: s
117
+ };
118
+ }
119
+ function Te(e, t, n) {
120
+ return x(
121
+ e,
122
+ t,
123
+ {
124
+ ...n,
125
+ immediate: !0
126
+ }
127
+ );
128
+ }
129
+ const F = J ? window : void 0, te = J ? window.navigator : void 0;
130
+ function ne(e) {
131
+ var t;
132
+ const n = A(e);
133
+ return (t = n == null ? void 0 : n.$el) != null ? t : n;
134
+ }
135
+ function L(...e) {
136
+ const t = [], n = () => {
137
+ t.forEach((r) => r()), t.length = 0;
138
+ }, o = (r, s, l, f) => (r.addEventListener(s, l, f), () => r.removeEventListener(s, l, f)), a = M(() => {
139
+ const r = P(A(e[0])).filter((s) => s != null);
140
+ return r.every((s) => typeof s != "string") ? r : void 0;
141
+ }), c = Te(
142
+ () => {
143
+ var r, s;
144
+ return [
145
+ (s = (r = a.value) == null ? void 0 : r.map((l) => ne(l))) != null ? s : [F].filter((l) => l != null),
146
+ P(A(a.value ? e[1] : e[0])),
147
+ P(ce(a.value ? e[2] : e[1])),
148
+ // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
149
+ A(a.value ? e[3] : e[2])
150
+ ];
151
+ },
152
+ ([r, s, l, f]) => {
153
+ if (n(), !(r != null && r.length) || !(s != null && s.length) || !(l != null && l.length))
154
+ return;
155
+ const v = ve(f) ? { ...f } : f;
156
+ t.push(
157
+ ...r.flatMap(
158
+ (k) => s.flatMap(
159
+ (S) => l.map((h) => o(k, S, h, v))
160
+ )
161
+ )
162
+ );
163
+ },
164
+ { flush: "post" }
165
+ ), u = () => {
166
+ c(), n();
167
+ };
168
+ return X(n), u;
169
+ }
170
+ function Ae() {
171
+ const e = T(!1), t = V();
172
+ return t && $(() => {
173
+ e.value = !0;
174
+ }, t), e;
175
+ }
176
+ function B(e) {
177
+ const t = Ae();
178
+ return M(() => (t.value, !!e()));
179
+ }
180
+ const Me = Symbol("vueuse-ssr-width");
181
+ function Ee() {
182
+ const e = U() ? pe(Me, null) : null;
183
+ return typeof e == "number" ? e : void 0;
184
+ }
185
+ function Oe(e, t = {}) {
186
+ const { window: n = F, ssrWidth: o = Ee() } = t, a = B(() => n && "matchMedia" in n && typeof n.matchMedia == "function"), c = T(typeof o == "number"), u = T(), r = T(!1), s = (l) => {
187
+ r.value = l.matches;
188
+ };
189
+ return fe(() => {
190
+ if (c.value) {
191
+ c.value = !a.value;
192
+ const l = A(e).split(",");
193
+ r.value = l.some((f) => {
194
+ const v = f.includes("not all"), k = f.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/), S = f.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
195
+ let h = !!(k || S);
196
+ return k && h && (h = o >= I(k[1])), S && h && (h = o <= I(S[1])), v ? !h : h;
197
+ });
198
+ return;
199
+ }
200
+ a.value && (u.value = n.matchMedia(A(e)), r.value = u.value.matches);
201
+ }), L(u, "change", s, { passive: !0 }), M(() => r.value);
202
+ }
203
+ function H(e, t = {}) {
204
+ const {
205
+ controls: n = !1,
206
+ navigator: o = te
207
+ } = t, a = B(() => o && "permissions" in o), c = T(), u = typeof e == "string" ? { name: e } : e, r = T(), s = () => {
208
+ var f, v;
209
+ r.value = (v = (f = c.value) == null ? void 0 : f.state) != null ? v : "prompt";
210
+ };
211
+ L(c, "change", s, { passive: !0 });
212
+ const l = Se(async () => {
213
+ if (a.value) {
214
+ if (!c.value)
215
+ try {
216
+ c.value = await o.permissions.query(u);
217
+ } catch {
218
+ c.value = void 0;
219
+ } finally {
220
+ s();
221
+ }
222
+ if (n)
223
+ return de(c.value);
224
+ }
225
+ });
226
+ return l(), n ? {
227
+ state: r,
228
+ isSupported: a,
229
+ query: l
230
+ } : r;
231
+ }
232
+ function ze(e = {}) {
233
+ const {
234
+ navigator: t = te,
235
+ read: n = !1,
236
+ source: o,
237
+ copiedDuring: a = 1500,
238
+ legacy: c = !1
239
+ } = e, u = B(() => t && "clipboard" in t), r = H("clipboard-read"), s = H("clipboard-write"), l = M(() => u.value || c), f = T(""), v = T(!1), k = ke(() => v.value = !1, a, { immediate: !1 });
240
+ async function S() {
241
+ let d = !(u.value && b(r.value));
242
+ if (!d)
243
+ try {
244
+ f.value = await t.clipboard.readText();
245
+ } catch {
246
+ d = !0;
247
+ }
248
+ d && (f.value = C());
249
+ }
250
+ l.value && n && L(["copy", "cut"], S, { passive: !0 });
251
+ async function h(d = A(o)) {
252
+ if (l.value && d != null) {
253
+ let p = !(u.value && b(s.value));
254
+ if (!p)
255
+ try {
256
+ await t.clipboard.writeText(d);
257
+ } catch {
258
+ p = !0;
259
+ }
260
+ p && w(d), f.value = d, v.value = !0, k.start();
261
+ }
262
+ }
263
+ function w(d) {
264
+ const p = document.createElement("textarea");
265
+ p.value = d ?? "", p.style.position = "absolute", p.style.opacity = "0", document.body.appendChild(p), p.select(), document.execCommand("copy"), p.remove();
266
+ }
267
+ function C() {
268
+ var d, p, y;
269
+ return (y = (p = (d = document == null ? void 0 : document.getSelection) == null ? void 0 : d.call(document)) == null ? void 0 : p.toString()) != null ? y : "";
270
+ }
271
+ function b(d) {
272
+ return d === "granted" || d === "prompt";
273
+ }
274
+ return {
275
+ isSupported: l,
276
+ text: f,
277
+ copied: v,
278
+ copy: h
279
+ };
280
+ }
281
+ const R = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, D = "__vueuse_ssr_handlers__", We = /* @__PURE__ */ Ne();
282
+ function Ne() {
283
+ return D in R || (R[D] = R[D] || {}), R[D];
284
+ }
285
+ function oe(e, t) {
286
+ return We[e] || t;
287
+ }
288
+ function _e(e) {
289
+ return Oe("(prefers-color-scheme: dark)", e);
290
+ }
291
+ function je(e) {
292
+ return e == null ? "any" : e instanceof Set ? "set" : e instanceof Map ? "map" : e instanceof Date ? "date" : typeof e == "boolean" ? "boolean" : typeof e == "string" ? "string" : typeof e == "object" ? "object" : Number.isNaN(e) ? "any" : "number";
293
+ }
294
+ const Fe = {
295
+ boolean: {
296
+ read: (e) => e === "true",
297
+ write: (e) => String(e)
298
+ },
299
+ object: {
300
+ read: (e) => JSON.parse(e),
301
+ write: (e) => JSON.stringify(e)
302
+ },
303
+ number: {
304
+ read: (e) => Number.parseFloat(e),
305
+ write: (e) => String(e)
306
+ },
307
+ any: {
308
+ read: (e) => e,
309
+ write: (e) => String(e)
310
+ },
311
+ string: {
312
+ read: (e) => e,
313
+ write: (e) => String(e)
314
+ },
315
+ map: {
316
+ read: (e) => new Map(JSON.parse(e)),
317
+ write: (e) => JSON.stringify(Array.from(e.entries()))
318
+ },
319
+ set: {
320
+ read: (e) => new Set(JSON.parse(e)),
321
+ write: (e) => JSON.stringify(Array.from(e))
322
+ },
323
+ date: {
324
+ read: (e) => new Date(e),
325
+ write: (e) => e.toISOString()
326
+ }
327
+ }, G = "vueuse-storage";
328
+ function Le(e, t, n, o = {}) {
329
+ var a;
330
+ const {
331
+ flush: c = "pre",
332
+ deep: u = !0,
333
+ listenToStorageChanges: r = !0,
334
+ writeDefaults: s = !0,
335
+ mergeDefaults: l = !1,
336
+ shallow: f,
337
+ window: v = F,
338
+ eventFilter: k,
339
+ onError: S = (i) => {
340
+ console.error(i);
341
+ },
342
+ initOnMounted: h
343
+ } = o, w = (f ? T : Q)(typeof t == "function" ? t() : t), C = M(() => A(e));
344
+ if (!n)
345
+ try {
346
+ n = oe("getDefaultStorage", () => {
347
+ var i;
348
+ return (i = F) == null ? void 0 : i.localStorage;
349
+ })();
350
+ } catch (i) {
351
+ S(i);
352
+ }
353
+ if (!n)
354
+ return w;
355
+ const b = A(t), d = je(b), p = (a = o.serializer) != null ? a : Fe[d], { pause: y, resume: O } = Ce(
356
+ w,
357
+ () => N(w.value),
358
+ { flush: c, deep: u, eventFilter: k }
359
+ );
360
+ x(C, () => E(), { flush: c }), v && r && ee(() => {
361
+ n instanceof Storage ? L(v, "storage", E, { passive: !0 }) : L(v, G, W), h && E();
362
+ }), h || E();
363
+ function _(i, m) {
364
+ if (v) {
365
+ const g = {
366
+ key: C.value,
367
+ oldValue: i,
368
+ newValue: m,
369
+ storageArea: n
370
+ };
371
+ v.dispatchEvent(n instanceof Storage ? new StorageEvent("storage", g) : new CustomEvent(G, {
372
+ detail: g
373
+ }));
374
+ }
375
+ }
376
+ function N(i) {
377
+ try {
378
+ const m = n.getItem(C.value);
379
+ if (i == null)
380
+ _(m, null), n.removeItem(C.value);
381
+ else {
382
+ const g = p.write(i);
383
+ m !== g && (n.setItem(C.value, g), _(m, g));
384
+ }
385
+ } catch (m) {
386
+ S(m);
387
+ }
388
+ }
389
+ function j(i) {
390
+ const m = i ? i.newValue : n.getItem(C.value);
391
+ if (m == null)
392
+ return s && b != null && n.setItem(C.value, p.write(b)), b;
393
+ if (!i && l) {
394
+ const g = p.read(m);
395
+ return typeof l == "function" ? l(g, b) : d === "object" && !Array.isArray(g) ? { ...b, ...g } : g;
396
+ } else return typeof m != "string" ? m : p.read(m);
397
+ }
398
+ function E(i) {
399
+ if (!(i && i.storageArea !== n)) {
400
+ if (i && i.key == null) {
401
+ w.value = b;
402
+ return;
403
+ }
404
+ if (!(i && i.key !== C.value)) {
405
+ y();
406
+ try {
407
+ (i == null ? void 0 : i.newValue) !== p.write(w.value) && (w.value = j(i));
408
+ } catch (m) {
409
+ S(m);
410
+ } finally {
411
+ i ? q(O) : O();
412
+ }
413
+ }
414
+ }
415
+ }
416
+ function W(i) {
417
+ E(i.detail);
418
+ }
419
+ return w;
420
+ }
421
+ const Re = "*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";
422
+ function De(e = {}) {
423
+ const {
424
+ selector: t = "html",
425
+ attribute: n = "class",
426
+ initialValue: o = "auto",
427
+ window: a = F,
428
+ storage: c,
429
+ storageKey: u = "vueuse-color-scheme",
430
+ listenToStorageChanges: r = !0,
431
+ storageRef: s,
432
+ emitAuto: l,
433
+ disableTransition: f = !0
434
+ } = e, v = {
435
+ auto: "",
436
+ light: "light",
437
+ dark: "dark",
438
+ ...e.modes || {}
439
+ }, k = _e({ window: a }), S = M(() => k.value ? "dark" : "light"), h = s || (u == null ? Y(o) : Le(u, o, c, { window: a, listenToStorageChanges: r })), w = M(() => h.value === "auto" ? S.value : h.value), C = oe(
440
+ "updateHTMLAttrs",
441
+ (y, O, _) => {
442
+ const N = typeof y == "string" ? a == null ? void 0 : a.document.querySelector(y) : ne(y);
443
+ if (!N)
444
+ return;
445
+ const j = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Set();
446
+ let W = null;
447
+ if (O === "class") {
448
+ const m = _.split(/\s/g);
449
+ Object.values(v).flatMap((g) => (g || "").split(/\s/g)).filter(Boolean).forEach((g) => {
450
+ m.includes(g) ? j.add(g) : E.add(g);
451
+ });
452
+ } else
453
+ W = { key: O, value: _ };
454
+ if (j.size === 0 && E.size === 0 && W === null)
455
+ return;
456
+ let i;
457
+ f && (i = a.document.createElement("style"), i.appendChild(document.createTextNode(Re)), a.document.head.appendChild(i));
458
+ for (const m of j)
459
+ N.classList.add(m);
460
+ for (const m of E)
461
+ N.classList.remove(m);
462
+ W && N.setAttribute(W.key, W.value), f && (a.getComputedStyle(i).opacity, document.head.removeChild(i));
463
+ }
464
+ );
465
+ function b(y) {
466
+ var O;
467
+ C(t, n, (O = v[y]) != null ? O : y);
468
+ }
469
+ function d(y) {
470
+ e.onChanged ? e.onChanged(y, b) : b(y);
471
+ }
472
+ x(w, d, { flush: "post", immediate: !0 }), ee(() => d(w.value));
473
+ const p = M({
474
+ get() {
475
+ return l ? h.value : w.value;
476
+ },
477
+ set(y) {
478
+ h.value = y;
479
+ }
480
+ });
481
+ return Object.assign(p, { store: h, system: S, state: w });
482
+ }
483
+ function Pe(e = {}) {
484
+ const {
485
+ valueDark: t = "dark",
486
+ valueLight: n = ""
487
+ } = e, o = De({
488
+ ...e,
489
+ onChanged: (u, r) => {
490
+ var s;
491
+ e.onChanged ? (s = e.onChanged) == null || s.call(e, u === "dark", r, u) : r(u);
492
+ },
493
+ modes: {
494
+ dark: t,
495
+ light: n
496
+ }
497
+ }), a = M(() => o.system.value);
498
+ return M({
499
+ get() {
500
+ return o.value === "dark";
501
+ },
502
+ set(u) {
503
+ const r = u ? "dark" : "light";
504
+ a.value === r ? o.value = "auto" : o.value = r;
505
+ }
506
+ });
507
+ }
508
+ export {
509
+ ze as useClipboard,
510
+ Pe as useDark
511
+ };
@@ -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(104, 184, 93, 0.8);
14
+ border: 1px solid #dee2e6;
15
+ box-shadow: 0 4px 6px rgba(104, 184, 93, 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
+ window.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,74 @@
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="{{ model.favicon_url }}" rel="shortcut icon" />
11
+ <title>{{ model.title }}</title>
12
+
13
+ {%- for link in model.css_links %}
14
+ <link rel="stylesheet" href="{{ model.prefix | safe }}{{link}}" />
15
+ {% endfor -%}
16
+
17
+ {%- for content in model.style_tags %}
18
+ <style>{{content}}</style>
19
+ {% endfor -%}
20
+
21
+ {{ sse_style(model.is_debug) }}
22
+ </head>
23
+
24
+ <body>
25
+ {{ sse_html(model.is_debug) }}
26
+
27
+ <div id="app">
28
+ <insta-ui :config="config"></insta-ui>
29
+ </div>
30
+
31
+ <script type="importmap">
32
+ {
33
+ "imports":{{model.import_maps_string | safe}}
34
+ }
35
+ </script>
36
+
37
+ {%- for info in model.js_links -%}
38
+ <script src="{{ model.prefix | safe }}{{info.link}}"></script>
39
+ {%- endfor -%}
40
+
41
+ {%- for content in model.script_tags -%}
42
+ <script>{{content}}</script>
43
+ {%- endfor -%}
44
+
45
+ {{ sse_script(model.is_debug) }}
46
+
47
+ <script type="module">
48
+ import { createApp } from 'vue'
49
+ import {install as installInsta} from 'instaui'
50
+ const True = true;
51
+ const False = false;
52
+ const None = undefined;
53
+
54
+ const appConfig = {{model.config_dict | safe}};
55
+
56
+ const app = createApp({
57
+ setup() {
58
+ return {
59
+ config:appConfig
60
+ }
61
+ }
62
+ })
63
+
64
+ installInsta(app, appConfig)
65
+ {% for info in model.vue_app_component -%}
66
+ app.component('{{info.name | safe}}',(await import('{{info.url | safe }}')).default)
67
+ {% endfor -%}
68
+ {% for plugin_url in model.vue_app_use -%}
69
+ app.use(await import('{{plugin_url | safe }}'))
70
+ {% endfor -%}
71
+ app.mount('#app')
72
+ </script>
73
+ </body>
74
+ </html>