instaui 0.1.3__py3-none-any.whl → 0.1.5__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 (93) hide show
  1. instaui/components/content.py +4 -4
  2. instaui/components/echarts/echarts.js +128 -0
  3. instaui/components/echarts/echarts.py +194 -0
  4. instaui/components/echarts/static/echarts.esm.min.js +45 -0
  5. instaui/components/element.py +103 -13
  6. instaui/components/html/__init__.py +31 -18
  7. instaui/components/html/_preset.py +4 -0
  8. instaui/components/html/heading.py +51 -0
  9. instaui/components/html/range.py +3 -0
  10. instaui/components/html/select.py +16 -35
  11. instaui/components/html/table.py +36 -0
  12. instaui/components/html/textarea.py +28 -0
  13. instaui/components/markdown/markdown.js +33 -0
  14. instaui/components/markdown/markdown.py +41 -0
  15. instaui/components/markdown/static/github-markdown.css +12 -0
  16. instaui/components/markdown/static/marked.esm.js +2579 -0
  17. instaui/components/shiki_code/shiki_code.js +126 -0
  18. instaui/components/shiki_code/shiki_code.py +99 -0
  19. instaui/components/shiki_code/static/langs/css.mjs +5 -0
  20. instaui/components/shiki_code/static/langs/markdown.mjs +5 -0
  21. instaui/components/shiki_code/static/langs/python.mjs +5 -0
  22. instaui/components/shiki_code/static/langs/shell.mjs +2 -0
  23. instaui/components/shiki_code/static/langs/shellscript.mjs +5 -0
  24. instaui/components/shiki_code/static/shiki-core.js +5784 -0
  25. instaui/components/shiki_code/static/shiki-style.css +175 -0
  26. instaui/components/shiki_code/static/shiki-transformers.js +461 -0
  27. instaui/components/shiki_code/static/themes/vitesse-dark.mjs +2 -0
  28. instaui/components/shiki_code/static/themes/vitesse-light.mjs +2 -0
  29. instaui/components/value_element.py +7 -3
  30. instaui/components/vfor.py +1 -1
  31. instaui/consts.py +2 -1
  32. instaui/daisyui/__init__.py +26 -0
  33. instaui/daisyui/_index.py +20 -0
  34. instaui/daisyui/button.py +38 -0
  35. instaui/daisyui/checkbox.py +17 -0
  36. instaui/daisyui/static/daisyui.css +1 -0
  37. instaui/daisyui/static/themes.css +1 -0
  38. instaui/daisyui/table.py +35 -0
  39. instaui/dependencies/component_dependency.py +11 -5
  40. instaui/event/js_event.py +1 -0
  41. instaui/event/web_event.py +6 -7
  42. instaui/fastapi_server/dependency_router.py +4 -3
  43. instaui/fastapi_server/resource.py +12 -16
  44. instaui/fastapi_server/server.py +34 -24
  45. instaui/handlers/event_handler.py +3 -1
  46. instaui/handlers/watch_handler.py +4 -0
  47. instaui/html_tools.py +44 -2
  48. instaui/inject.py +3 -3
  49. instaui/runtime/_app.py +43 -4
  50. instaui/runtime/_link_manager.py +89 -0
  51. instaui/runtime/resource.py +21 -8
  52. instaui/shadcn_classless/_index.py +42 -0
  53. instaui/shadcn_classless/static/shadcn-classless.css +403 -0
  54. instaui/spa_router/_functions.py +1 -1
  55. instaui/spa_router/_route_model.py +1 -1
  56. instaui/static/insta-ui.css +1 -1
  57. instaui/static/insta-ui.esm-browser.prod.js +1308 -1252
  58. instaui/static/insta-ui.js.map +1 -1
  59. instaui/static/instaui-tools-browser.js +511 -0
  60. instaui/static/templates/webview.html +78 -0
  61. instaui/systems/module_system.py +30 -0
  62. instaui/tailwind/__init__.py +6 -0
  63. instaui/tailwind/_index.py +24 -0
  64. instaui/{static/tailwindcss.min.js → tailwind/static/tailwindcss-v3.min.js} +62 -62
  65. instaui/tailwind/static/tailwindcss-v4.min.js +8 -0
  66. instaui/template/_utils.py +23 -0
  67. instaui/template/webview_template.py +50 -0
  68. instaui/template/zero_template.py +18 -17
  69. instaui/ui/__build_init.py +73 -0
  70. instaui/ui/__init__.py +74 -58
  71. instaui/ui/__init__.pyi +135 -0
  72. instaui/ui/events.py +1 -1
  73. instaui/ui_functions/server.py +3 -1
  74. instaui/vars/event_context.py +4 -0
  75. instaui/vars/web_computed.py +30 -30
  76. instaui/watch/web_watch.py +5 -6
  77. instaui/webview/__init__.py +1 -0
  78. instaui/webview/_utils.py +8 -0
  79. instaui/webview/api.py +72 -0
  80. instaui/webview/func.py +114 -0
  81. instaui/webview/index.py +162 -0
  82. instaui/webview/resource.py +172 -0
  83. instaui/zero/func.py +31 -23
  84. instaui/zero/scope.py +110 -4
  85. {instaui-0.1.3.dist-info → instaui-0.1.5.dist-info}/METADATA +4 -1
  86. {instaui-0.1.3.dist-info → instaui-0.1.5.dist-info}/RECORD +88 -44
  87. instaui/handlers/computed_handler.py +0 -42
  88. instaui/handlers/config_handler.py +0 -13
  89. instaui/static/insta-ui.iife.js +0 -29
  90. instaui/static/insta-ui.iife.js.map +0 -1
  91. instaui/zero/test.html +0 -44
  92. {instaui-0.1.3.dist-info → instaui-0.1.5.dist-info}/LICENSE +0 -0
  93. {instaui-0.1.3.dist-info → instaui-0.1.5.dist-info}/WHEEL +0 -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,78 @@
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="{{link}}" />
15
+ {% endfor -%}
16
+
17
+ {%- for content in model.style_tags %}
18
+ <style>{{content}}</style>
19
+ {% endfor -%}
20
+
21
+ </head>
22
+
23
+ <body>
24
+
25
+ <div id="app">
26
+ <insta-ui :config="config"></insta-ui>
27
+ </div>
28
+
29
+ <script type="importmap">
30
+ {
31
+ "imports":{{model.import_maps_string | safe}}
32
+ }
33
+ </script>
34
+
35
+ {%- for link in model.js_links -%}
36
+ <script src="{{link}}"></script>
37
+ {%- endfor -%}
38
+
39
+ {%- for content in model.script_tags -%}
40
+ <script>{{content}}</script>
41
+ {%- endfor -%}
42
+
43
+
44
+ <script type="module">
45
+ import { createApp } from 'vue'
46
+ import installInsta from 'instaui'
47
+ const True = true;
48
+ const False = false;
49
+ const None = undefined;
50
+
51
+ const appConfig = {{model.config_dict | safe}};
52
+
53
+ window.addEventListener('pywebviewready',async () => {
54
+ const app = createApp({
55
+ {% if model.on_app_mounted %}
56
+ mounted() {
57
+ pywebview.api.on_app_mounted()
58
+ },
59
+ {% endif %}
60
+ setup() {
61
+ return {
62
+ config:appConfig
63
+ }
64
+ }
65
+ })
66
+
67
+ installInsta(app, appConfig)
68
+ {% for info in model.vue_app_component -%}
69
+ app.component('{{info.name | safe}}',(await import('{{info.url | safe }}')).default)
70
+ {% endfor -%}
71
+ {% for plugin_url in model.vue_app_use -%}
72
+ app.use(await import('{{plugin_url | safe }}'))
73
+ {% endfor -%}
74
+ app.mount('#app')
75
+ })
76
+ </script>
77
+ </body>
78
+ </html>
@@ -0,0 +1,30 @@
1
+ from importlib import import_module
2
+ from types import ModuleType
3
+ from typing import Any, List
4
+
5
+
6
+ class LazyModule(ModuleType):
7
+ def __init__(self, name: str, member: str):
8
+ super().__init__(name)
9
+ self._name = name
10
+ self._mod = None
11
+ self._member_obj = None
12
+ self._member = member
13
+
14
+ def __getattr__(self, attr: str) -> Any:
15
+ self.__try_import()
16
+ return getattr(self._member_obj, attr)
17
+
18
+ def __call__(self, *args: Any, **kwds: Any) -> Any:
19
+ self.__try_import()
20
+ return self._member_obj(*args, **kwds) # type: ignore
21
+
22
+ def __dir__(self) -> List[str]:
23
+ if self._mod is None:
24
+ self._mod = import_module(self._name)
25
+ return dir(self._mod)
26
+
27
+ def __try_import(self):
28
+ if self._mod is None:
29
+ self._mod = import_module(self._name)
30
+ self._member_obj = getattr(self._mod, self._member)
@@ -0,0 +1,6 @@
1
+ __all__ = [
2
+ "use_tailwind",
3
+ ]
4
+
5
+
6
+ from ._index import use_tailwind
@@ -0,0 +1,24 @@
1
+ from pathlib import Path
2
+ from typing import Literal
3
+ from instaui.runtime._app import get_app_slot
4
+
5
+
6
+ _STATIC_DIR = Path(__file__).parent / "static"
7
+ _V3_JS = _STATIC_DIR / "tailwindcss-v3.min.js"
8
+ _V4_JS = _STATIC_DIR / "tailwindcss-v4.min.js"
9
+
10
+
11
+ def use_tailwind(value=True, *, version: Literal["v3", "v4"] = "v4"):
12
+ """Enable or disable Tailwind CSS.
13
+
14
+ Args:
15
+ value (bool, optional): Whether to enable or disable Tailwind CSS. Defaults to True.
16
+ version (Literal[&quot;v3&quot;, &quot;v4&quot;], optional): The version of Tailwind CSS to use. Defaults to "v4".
17
+ """
18
+ js_file = _V3_JS if version == "v3" else _V4_JS
19
+
20
+ if value:
21
+ get_app_slot()._html_resource.add_js_link(js_file)
22
+
23
+ else:
24
+ get_app_slot()._html_resource.remove_js_link(js_file)