@vasakgroup/vue-libvasak 0.2.2 → 0.3.0

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.
@@ -1,2087 +1,288 @@
1
- import { createElementBlock as s, openBlock as r, renderSlot as k, defineComponent as m, createElementVNode as u, ref as x, onMounted as q, toDisplayString as g, unref as W, Fragment as F, createVNode as Z, normalizeClass as d, createCommentVNode as w, renderList as Q, withModifiers as Y, computed as T } from "vue";
2
- const D = (t, e) => {
3
- const i = t.__vccOpts || t;
4
- for (const [a, l] of e)
5
- i[a] = l;
6
- return i;
7
- }, K = {}, X = { class: "sidebar" };
8
- function ee(t, e) {
9
- return r(), s("div", X, [
10
- k(t.$slots, "default")
11
- ]);
12
- }
13
- const te = /* @__PURE__ */ D(K, [["render", ee]]), ie = {
14
- href: "#",
15
- class: "sidebar-button"
16
- }, ne = ["src", "alt"], ae = /* @__PURE__ */ m({
17
- __name: "SideButton",
1
+ import { defineComponent as h, ref as x, watch as L, createElementBlock as l, openBlock as a, createCommentVNode as u, createElementVNode as i, toDisplayString as m, normalizeClass as b, renderSlot as y, toRef as D, onMounted as T, onUnmounted as E, computed as w, onBeforeUnmount as O, Fragment as $, renderList as I, createBlock as A, withCtx as P, unref as z, createVNode as W, withModifiers as G } from "vue";
2
+ import { getIconSource as C } from "@vasakgroup/plugin-vicons";
3
+ import { listen as N } from "@tauri-apps/api/event";
4
+ import { getCurrentWindow as R } from "@tauri-apps/api/window";
5
+ const U = { class: "flex flex-col gap-2" }, q = ["aria-expanded"], H = {
6
+ key: 1,
7
+ class: "flex flex-col gap-1"
8
+ }, V = /* @__PURE__ */ h({
9
+ __name: "SideGroup",
18
10
  props: {
19
- title: {
20
- type: String,
21
- default: "Link"
22
- },
23
- image: {
24
- type: String,
25
- default: ""
26
- }
11
+ title: {},
12
+ collapsed: { type: Boolean, default: !1 },
13
+ defaultOpen: { type: Boolean, default: !0 }
27
14
  },
28
- setup(t) {
29
- return (e, i) => (r(), s("a", ie, [
30
- u("img", {
31
- src: t.image,
32
- alt: t.title,
33
- class: "img-fluid"
34
- }, null, 8, ne)
35
- ]));
36
- }
37
- });
38
- function le(t, e, i, a) {
39
- if (typeof e == "function" ? t !== e || !a : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
40
- return i === "m" ? a : i === "a" ? a.call(t) : a ? a.value : e.get(t);
41
- }
42
- function se(t, e, i, a, l) {
43
- if (typeof e == "function" ? t !== e || !0 : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
44
- return e.set(t, i), i;
45
- }
46
- var I;
47
- const y = "__TAURI_TO_IPC_KEY__";
48
- function re(t, e = !1) {
49
- return window.__TAURI_INTERNALS__.transformCallback(t, e);
50
- }
51
- async function n(t, e = {}, i) {
52
- return window.__TAURI_INTERNALS__.invoke(t, e, i);
53
- }
54
- class oe {
55
- get rid() {
56
- return le(this, I, "f");
57
- }
58
- constructor(e) {
59
- I.set(this, void 0), se(this, I, e);
60
- }
61
- /**
62
- * Destroys and cleans up this resource from memory.
63
- * **You should not call any method on this object anymore and should drop any reference to it.**
64
- */
65
- async close() {
66
- return n("plugin:resources|close", {
67
- rid: this.rid
68
- });
69
- }
70
- }
71
- I = /* @__PURE__ */ new WeakMap();
72
- class V {
73
- constructor(...e) {
74
- this.type = "Logical", e.length === 1 ? "Logical" in e[0] ? (this.width = e[0].Logical.width, this.height = e[0].Logical.height) : (this.width = e[0].width, this.height = e[0].height) : (this.width = e[0], this.height = e[1]);
75
- }
76
- /**
77
- * Converts the logical size to a physical one.
78
- * @example
79
- * ```typescript
80
- * import { LogicalSize } from '@tauri-apps/api/dpi';
81
- * import { getCurrentWindow } from '@tauri-apps/api/window';
82
- *
83
- * const appWindow = getCurrentWindow();
84
- * const factor = await appWindow.scaleFactor();
85
- * const size = new LogicalSize(400, 500);
86
- * const physical = size.toPhysical(factor);
87
- * ```
88
- *
89
- * @since 2.0.0
90
- */
91
- toPhysical(e) {
92
- return new C(this.width * e, this.height * e);
93
- }
94
- [y]() {
95
- return {
96
- width: this.width,
97
- height: this.height
98
- };
99
- }
100
- toJSON() {
101
- return this[y]();
102
- }
103
- }
104
- class C {
105
- constructor(...e) {
106
- this.type = "Physical", e.length === 1 ? "Physical" in e[0] ? (this.width = e[0].Physical.width, this.height = e[0].Physical.height) : (this.width = e[0].width, this.height = e[0].height) : (this.width = e[0], this.height = e[1]);
107
- }
108
- /**
109
- * Converts the physical size to a logical one.
110
- * @example
111
- * ```typescript
112
- * import { getCurrentWindow } from '@tauri-apps/api/window';
113
- * const appWindow = getCurrentWindow();
114
- * const factor = await appWindow.scaleFactor();
115
- * const size = await appWindow.innerSize(); // PhysicalSize
116
- * const logical = size.toLogical(factor);
117
- * ```
118
- */
119
- toLogical(e) {
120
- return new V(this.width / e, this.height / e);
121
- }
122
- [y]() {
123
- return {
124
- width: this.width,
125
- height: this.height
126
- };
127
- }
128
- toJSON() {
129
- return this[y]();
130
- }
131
- }
132
- class _ {
133
- constructor(e) {
134
- this.size = e;
135
- }
136
- toLogical(e) {
137
- return this.size instanceof V ? this.size : this.size.toLogical(e);
138
- }
139
- toPhysical(e) {
140
- return this.size instanceof C ? this.size : this.size.toPhysical(e);
141
- }
142
- [y]() {
143
- return {
144
- [`${this.size.type}`]: {
145
- width: this.size.width,
146
- height: this.size.height
15
+ setup(e) {
16
+ const s = e, t = x(s.defaultOpen);
17
+ return L(
18
+ () => s.collapsed,
19
+ (n) => {
20
+ n && (t.value = !0);
147
21
  }
148
- };
149
- }
150
- toJSON() {
151
- return this[y]();
152
- }
153
- }
154
- class U {
155
- constructor(...e) {
156
- this.type = "Logical", e.length === 1 ? "Logical" in e[0] ? (this.x = e[0].Logical.x, this.y = e[0].Logical.y) : (this.x = e[0].x, this.y = e[0].y) : (this.x = e[0], this.y = e[1]);
157
- }
158
- /**
159
- * Converts the logical position to a physical one.
160
- * @example
161
- * ```typescript
162
- * import { LogicalPosition } from '@tauri-apps/api/dpi';
163
- * import { getCurrentWindow } from '@tauri-apps/api/window';
164
- *
165
- * const appWindow = getCurrentWindow();
166
- * const factor = await appWindow.scaleFactor();
167
- * const position = new LogicalPosition(400, 500);
168
- * const physical = position.toPhysical(factor);
169
- * ```
170
- *
171
- * @since 2.0.0
172
- */
173
- toPhysical(e) {
174
- return new f(this.x * e, this.y * e);
175
- }
176
- [y]() {
177
- return {
178
- x: this.x,
179
- y: this.y
180
- };
181
- }
182
- toJSON() {
183
- return this[y]();
184
- }
185
- }
186
- class f {
187
- constructor(...e) {
188
- this.type = "Physical", e.length === 1 ? "Physical" in e[0] ? (this.x = e[0].Physical.x, this.y = e[0].Physical.y) : (this.x = e[0].x, this.y = e[0].y) : (this.x = e[0], this.y = e[1]);
189
- }
190
- /**
191
- * Converts the physical position to a logical one.
192
- * @example
193
- * ```typescript
194
- * import { PhysicalPosition } from '@tauri-apps/api/dpi';
195
- * import { getCurrentWindow } from '@tauri-apps/api/window';
196
- *
197
- * const appWindow = getCurrentWindow();
198
- * const factor = await appWindow.scaleFactor();
199
- * const position = new PhysicalPosition(400, 500);
200
- * const physical = position.toLogical(factor);
201
- * ```
202
- *
203
- * @since 2.0.0
204
- */
205
- toLogical(e) {
206
- return new U(this.x / e, this.y / e);
207
- }
208
- [y]() {
209
- return {
210
- x: this.x,
211
- y: this.y
212
- };
213
- }
214
- toJSON() {
215
- return this[y]();
216
- }
217
- }
218
- class z {
219
- constructor(e) {
220
- this.position = e;
221
- }
222
- toLogical(e) {
223
- return this.position instanceof U ? this.position : this.position.toLogical(e);
224
- }
225
- toPhysical(e) {
226
- return this.position instanceof f ? this.position : this.position.toPhysical(e);
22
+ ), (n, r) => (a(), l("section", U, [
23
+ e.collapsed ? u("", !0) : (a(), l("button", {
24
+ key: 0,
25
+ type: "button",
26
+ class: "group flex w-full items-center justify-between rounded-corner px-2 py-1 text-tx-muted text-xs uppercase tracking-[0.08em] hover:bg-ui-surface/60",
27
+ "aria-expanded": t.value,
28
+ onClick: r[0] || (r[0] = (c) => t.value = !t.value)
29
+ }, [
30
+ i("span", null, m(e.title), 1),
31
+ i("span", {
32
+ class: b(["text-[10px] transition-transform duration-200", t.value ? "rotate-180" : ""])
33
+ }, " v ", 2)
34
+ ], 8, q)),
35
+ t.value || e.collapsed ? (a(), l("div", H, [
36
+ y(n.$slots, "default")
37
+ ])) : u("", !0)
38
+ ]));
227
39
  }
228
- [y]() {
229
- return {
230
- [`${this.position.type}`]: {
231
- x: this.position.x,
232
- y: this.position.y
40
+ }), J = ["title", "aria-label", "disabled", "aria-current"], K = ["src"], Q = { key: 1 }, X = {
41
+ key: 0,
42
+ class: "min-w-0 flex-1 truncate font-medium"
43
+ }, Y = {
44
+ key: 1,
45
+ class: "rounded-corner bg-ui-surface px-2 py-0.5 font-semibold text-tx-muted text-xs"
46
+ }, M = /* @__PURE__ */ h({
47
+ __name: "SideButton",
48
+ props: {
49
+ label: {},
50
+ icon: { default: "" },
51
+ active: { type: Boolean, default: !1 },
52
+ collapsed: { type: Boolean, default: !1 },
53
+ disabled: { type: Boolean, default: !1 },
54
+ badge: { default: "" }
55
+ },
56
+ emits: ["click"],
57
+ setup(e) {
58
+ const s = e, t = x(""), n = D(s, "icon");
59
+ let r = null, c = !1, d = 0;
60
+ async function f() {
61
+ const o = ++d, g = n.value;
62
+ if (!g) {
63
+ t.value = "";
64
+ return;
233
65
  }
234
- };
235
- }
236
- toJSON() {
237
- return this[y]();
238
- }
239
- }
240
- var b;
241
- (function(t) {
242
- t.WINDOW_RESIZED = "tauri://resize", t.WINDOW_MOVED = "tauri://move", t.WINDOW_CLOSE_REQUESTED = "tauri://close-requested", t.WINDOW_DESTROYED = "tauri://destroyed", t.WINDOW_FOCUS = "tauri://focus", t.WINDOW_BLUR = "tauri://blur", t.WINDOW_SCALE_FACTOR_CHANGED = "tauri://scale-change", t.WINDOW_THEME_CHANGED = "tauri://theme-changed", t.WINDOW_CREATED = "tauri://window-created", t.WEBVIEW_CREATED = "tauri://webview-created", t.DRAG_ENTER = "tauri://drag-enter", t.DRAG_OVER = "tauri://drag-over", t.DRAG_DROP = "tauri://drag-drop", t.DRAG_LEAVE = "tauri://drag-leave";
243
- })(b || (b = {}));
244
- async function G(t, e) {
245
- window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(t, e), await n("plugin:event|unlisten", {
246
- event: t,
247
- eventId: e
248
- });
249
- }
250
- async function H(t, e, i) {
251
- var a;
252
- const l = typeof i?.target == "string" ? { kind: "AnyLabel", label: i.target } : (a = i?.target) !== null && a !== void 0 ? a : { kind: "Any" };
253
- return n("plugin:event|listen", {
254
- event: t,
255
- target: l,
256
- handler: re(e)
257
- }).then((c) => async () => G(t, c));
258
- }
259
- async function ue(t, e, i) {
260
- return H(t, (a) => {
261
- G(t, a.id), e(a);
262
- }, i);
263
- }
264
- async function ce(t, e) {
265
- await n("plugin:event|emit", {
266
- event: t,
267
- payload: e
268
- });
269
- }
270
- async function de(t, e, i) {
271
- await n("plugin:event|emit_to", {
272
- target: typeof t == "string" ? { kind: "AnyLabel", label: t } : t,
273
- event: e,
274
- payload: i
275
- });
276
- }
277
- class S extends oe {
278
- /**
279
- * Creates an Image from a resource ID. For internal use only.
280
- *
281
- * @ignore
282
- */
283
- constructor(e) {
284
- super(e);
285
- }
286
- /** Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height. */
287
- static async new(e, i, a) {
288
- return n("plugin:image|new", {
289
- rgba: A(e),
290
- width: i,
291
- height: a
292
- }).then((l) => new S(l));
293
- }
294
- /**
295
- * Creates a new image using the provided bytes by inferring the file format.
296
- * If the format is known, prefer [@link Image.fromPngBytes] or [@link Image.fromIcoBytes].
297
- *
298
- * Only `ico` and `png` are supported (based on activated feature flag).
299
- *
300
- * Note that you need the `image-ico` or `image-png` Cargo features to use this API.
301
- * To enable it, change your Cargo.toml file:
302
- * ```toml
303
- * [dependencies]
304
- * tauri = { version = "...", features = ["...", "image-png"] }
305
- * ```
306
- */
307
- static async fromBytes(e) {
308
- return n("plugin:image|from_bytes", {
309
- bytes: A(e)
310
- }).then((i) => new S(i));
311
- }
312
- /**
313
- * Creates a new image using the provided path.
314
- *
315
- * Only `ico` and `png` are supported (based on activated feature flag).
316
- *
317
- * Note that you need the `image-ico` or `image-png` Cargo features to use this API.
318
- * To enable it, change your Cargo.toml file:
319
- * ```toml
320
- * [dependencies]
321
- * tauri = { version = "...", features = ["...", "image-png"] }
322
- * ```
323
- */
324
- static async fromPath(e) {
325
- return n("plugin:image|from_path", { path: e }).then((i) => new S(i));
326
- }
327
- /** Returns the RGBA data for this image, in row-major order from top to bottom. */
328
- async rgba() {
329
- return n("plugin:image|rgba", {
330
- rid: this.rid
331
- }).then((e) => new Uint8Array(e));
332
- }
333
- /** Returns the size of this image. */
334
- async size() {
335
- return n("plugin:image|size", { rid: this.rid });
336
- }
337
- }
338
- function A(t) {
339
- return t == null ? null : typeof t == "string" ? t : t instanceof S ? t.rid : t;
340
- }
341
- var B;
342
- (function(t) {
343
- t[t.Critical = 1] = "Critical", t[t.Informational = 2] = "Informational";
344
- })(B || (B = {}));
345
- class he {
346
- constructor(e) {
347
- this._preventDefault = !1, this.event = e.event, this.id = e.id;
348
- }
349
- preventDefault() {
350
- this._preventDefault = !0;
351
- }
352
- isPreventDefault() {
353
- return this._preventDefault;
354
- }
355
- }
356
- var R;
357
- (function(t) {
358
- t.None = "none", t.Normal = "normal", t.Indeterminate = "indeterminate", t.Paused = "paused", t.Error = "error";
359
- })(R || (R = {}));
360
- function j() {
361
- return new J(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {
362
- // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
363
- skip: !0
364
- });
365
- }
366
- async function $() {
367
- return n("plugin:window|get_all_windows").then((t) => t.map((e) => new J(e, {
368
- // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
369
- skip: !0
370
- })));
371
- }
372
- const O = ["tauri://created", "tauri://error"];
373
- class J {
374
- /**
375
- * Creates a new Window.
376
- * @example
377
- * ```typescript
378
- * import { Window } from '@tauri-apps/api/window';
379
- * const appWindow = new Window('my-label');
380
- * appWindow.once('tauri://created', function () {
381
- * // window successfully created
382
- * });
383
- * appWindow.once('tauri://error', function (e) {
384
- * // an error happened creating the window
385
- * });
386
- * ```
387
- *
388
- * @param label The unique window label. Must be alphanumeric: `a-zA-Z-/:_`.
389
- * @returns The {@link Window} instance to communicate with the window.
390
- */
391
- constructor(e, i = {}) {
392
- var a;
393
- this.label = e, this.listeners = /* @__PURE__ */ Object.create(null), i?.skip || n("plugin:window|create", {
394
- options: {
395
- ...i,
396
- parent: typeof i.parent == "string" ? i.parent : (a = i.parent) === null || a === void 0 ? void 0 : a.label,
397
- label: e
66
+ const p = await C(g);
67
+ o === d && (t.value = p);
68
+ }
69
+ return T(async () => {
70
+ const o = await N("vicons:theme-changed", f);
71
+ if (c) {
72
+ o();
73
+ return;
398
74
  }
399
- }).then(async () => this.emit("tauri://created")).catch(async (l) => this.emit("tauri://error", l));
400
- }
401
- /**
402
- * Gets the Window associated with the given label.
403
- * @example
404
- * ```typescript
405
- * import { Window } from '@tauri-apps/api/window';
406
- * const mainWindow = Window.getByLabel('main');
407
- * ```
408
- *
409
- * @param label The window label.
410
- * @returns The Window instance to communicate with the window or null if the window doesn't exist.
411
- */
412
- static async getByLabel(e) {
413
- var i;
414
- return (i = (await $()).find((a) => a.label === e)) !== null && i !== void 0 ? i : null;
415
- }
416
- /**
417
- * Get an instance of `Window` for the current window.
418
- */
419
- static getCurrent() {
420
- return j();
421
- }
422
- /**
423
- * Gets a list of instances of `Window` for all available windows.
424
- */
425
- static async getAll() {
426
- return $();
427
- }
428
- /**
429
- * Gets the focused window.
430
- * @example
431
- * ```typescript
432
- * import { Window } from '@tauri-apps/api/window';
433
- * const focusedWindow = Window.getFocusedWindow();
434
- * ```
435
- *
436
- * @returns The Window instance or `undefined` if there is not any focused window.
437
- */
438
- static async getFocusedWindow() {
439
- for (const e of await $())
440
- if (await e.isFocused())
441
- return e;
442
- return null;
443
- }
444
- /**
445
- * Listen to an emitted event on this window.
446
- *
447
- * @example
448
- * ```typescript
449
- * import { getCurrentWindow } from '@tauri-apps/api/window';
450
- * const unlisten = await getCurrentWindow().listen<string>('state-changed', (event) => {
451
- * console.log(`Got error: ${payload}`);
452
- * });
453
- *
454
- * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
455
- * unlisten();
456
- * ```
457
- *
458
- * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
459
- * @param handler Event handler.
460
- * @returns A promise resolving to a function to unlisten to the event.
461
- * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
462
- */
463
- async listen(e, i) {
464
- return this._handleTauriEvent(e, i) ? () => {
465
- const a = this.listeners[e];
466
- a.splice(a.indexOf(i), 1);
467
- } : H(e, i, {
468
- target: { kind: "Window", label: this.label }
469
- });
470
- }
471
- /**
472
- * Listen to an emitted event on this window only once.
473
- *
474
- * @example
475
- * ```typescript
476
- * import { getCurrentWindow } from '@tauri-apps/api/window';
477
- * const unlisten = await getCurrentWindow().once<null>('initialized', (event) => {
478
- * console.log(`Window initialized!`);
479
- * });
480
- *
481
- * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
482
- * unlisten();
483
- * ```
484
- *
485
- * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
486
- * @param handler Event handler.
487
- * @returns A promise resolving to a function to unlisten to the event.
488
- * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
489
- */
490
- async once(e, i) {
491
- return this._handleTauriEvent(e, i) ? () => {
492
- const a = this.listeners[e];
493
- a.splice(a.indexOf(i), 1);
494
- } : ue(e, i, {
495
- target: { kind: "Window", label: this.label }
496
- });
497
- }
498
- /**
499
- * Emits an event to all {@link EventTarget|targets}.
500
- * @example
501
- * ```typescript
502
- * import { getCurrentWindow } from '@tauri-apps/api/window';
503
- * await getCurrentWindow().emit('window-loaded', { loggedIn: true, token: 'authToken' });
504
- * ```
505
- *
506
- * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
507
- * @param payload Event payload.
508
- */
509
- async emit(e, i) {
510
- if (O.includes(e)) {
511
- for (const a of this.listeners[e] || [])
512
- a({
513
- event: e,
514
- id: -1,
515
- payload: i
516
- });
517
- return;
75
+ r = o, await f();
76
+ }), E(() => {
77
+ c = !0, r?.();
78
+ }), L(n, f), (o, g) => (a(), l("button", {
79
+ type: "button",
80
+ title: e.collapsed ? e.label : void 0,
81
+ "aria-label": e.collapsed ? e.label : void 0,
82
+ disabled: e.disabled,
83
+ "aria-current": e.active ? "page" : void 0,
84
+ class: b(["group relative flex w-full items-center gap-3 rounded-corner border px-3 py-2 text-left text-sm transition-all duration-200", [
85
+ e.active ? "border-secondary bg-primary/15 text-tx-main shadow-sm" : "border-transparent bg-ui-bg/30 hover:border-ui-border hover:bg-ui-surface/70",
86
+ e.disabled ? "cursor-not-allowed opacity-60" : "cursor-pointer",
87
+ e.collapsed ? "justify-center px-2" : ""
88
+ ]]),
89
+ onClick: g[0] || (g[0] = (p) => o.$emit("click"))
90
+ }, [
91
+ i("span", {
92
+ class: b(["flex h-8 w-8 shrink-0 items-center justify-center rounded-corner font-semibold text-xs uppercase tracking-wide", e.active ? "border-secondary bg-primary/20" : ""]),
93
+ "aria-hidden": "true"
94
+ }, [
95
+ t.value ? (a(), l("img", {
96
+ key: 0,
97
+ src: t.value,
98
+ alt: "",
99
+ class: "h-8 w-8 object-contain"
100
+ }, null, 8, K)) : (a(), l("span", Q, m(e.label.charAt(0).toUpperCase()), 1))
101
+ ], 2),
102
+ e.collapsed ? u("", !0) : (a(), l("span", X, m(e.label), 1)),
103
+ !e.collapsed && e.badge !== "" ? (a(), l("span", Y, m(e.badge), 1)) : u("", !0)
104
+ ], 10, J));
105
+ }
106
+ }), Z = {
107
+ key: 0,
108
+ class: "flex flex-col gap-2 border-ui-border border-b p-2"
109
+ }, _ = { class: "flex items-center gap-2" }, ee = ["aria-label", "aria-expanded"], te = {
110
+ key: 0,
111
+ class: "min-w-0 flex-1"
112
+ }, ae = {
113
+ key: 0,
114
+ class: "truncate font-semibold text-sm"
115
+ }, le = {
116
+ key: 1,
117
+ class: "truncate text-tx-muted text-xs"
118
+ }, ne = { key: 0 }, oe = {
119
+ key: 1,
120
+ class: "flex justify-center border-ui-border border-b p-2"
121
+ }, se = ["aria-label", "aria-expanded"], ie = { class: "flex-1 space-y-3 overflow-y-auto p-2" }, re = /* @__PURE__ */ h({
122
+ __name: "SideBar",
123
+ props: {
124
+ title: { default: "" },
125
+ subtitle: { default: "" },
126
+ categories: { default: () => [] },
127
+ modelValue: { default: "" },
128
+ collapsed: { type: Boolean, default: void 0 },
129
+ collapseLabel: { default: "Collapse" },
130
+ expandLabel: { default: "Expand" }
131
+ },
132
+ emits: ["update:modelValue", "update:collapsed", "change"],
133
+ setup(e, { expose: s, emit: t }) {
134
+ const n = e, r = t, c = x(n.collapsed ?? !1), d = x(!1);
135
+ let f = null;
136
+ const o = w(() => d.value || c.value), g = w(() => !!(n.title || n.subtitle));
137
+ w(() => n.categories.length > 0);
138
+ function p() {
139
+ d.value = f?.matches ?? !1;
518
140
  }
519
- return ce(e, i);
520
- }
521
- /**
522
- * Emits an event to all {@link EventTarget|targets} matching the given target.
523
- *
524
- * @example
525
- * ```typescript
526
- * import { getCurrentWindow } from '@tauri-apps/api/window';
527
- * await getCurrentWindow().emit('main', 'window-loaded', { loggedIn: true, token: 'authToken' });
528
- * ```
529
- * @param target Label of the target Window/Webview/WebviewWindow or raw {@link EventTarget} object.
530
- * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
531
- * @param payload Event payload.
532
- */
533
- async emitTo(e, i, a) {
534
- if (O.includes(i)) {
535
- for (const l of this.listeners[i] || [])
536
- l({
537
- event: i,
538
- id: -1,
539
- payload: a
540
- });
541
- return;
141
+ function j() {
142
+ c.value = !c.value, r("update:collapsed", c.value);
542
143
  }
543
- return de(e, i, a);
544
- }
545
- /** @ignore */
546
- _handleTauriEvent(e, i) {
547
- return O.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
548
- }
549
- // Getters
550
- /**
551
- * The scale factor that can be used to map physical pixels to logical pixels.
552
- * @example
553
- * ```typescript
554
- * import { getCurrentWindow } from '@tauri-apps/api/window';
555
- * const factor = await getCurrentWindow().scaleFactor();
556
- * ```
557
- *
558
- * @returns The window's monitor scale factor.
559
- */
560
- async scaleFactor() {
561
- return n("plugin:window|scale_factor", {
562
- label: this.label
563
- });
564
- }
565
- /**
566
- * The position of the top-left hand corner of the window's client area relative to the top-left hand corner of the desktop.
567
- * @example
568
- * ```typescript
569
- * import { getCurrentWindow } from '@tauri-apps/api/window';
570
- * const position = await getCurrentWindow().innerPosition();
571
- * ```
572
- *
573
- * @returns The window's inner position.
574
- */
575
- async innerPosition() {
576
- return n("plugin:window|inner_position", {
577
- label: this.label
578
- }).then((e) => new f(e));
579
- }
580
- /**
581
- * The position of the top-left hand corner of the window relative to the top-left hand corner of the desktop.
582
- * @example
583
- * ```typescript
584
- * import { getCurrentWindow } from '@tauri-apps/api/window';
585
- * const position = await getCurrentWindow().outerPosition();
586
- * ```
587
- *
588
- * @returns The window's outer position.
589
- */
590
- async outerPosition() {
591
- return n("plugin:window|outer_position", {
592
- label: this.label
593
- }).then((e) => new f(e));
594
- }
595
- /**
596
- * The physical size of the window's client area.
597
- * The client area is the content of the window, excluding the title bar and borders.
598
- * @example
599
- * ```typescript
600
- * import { getCurrentWindow } from '@tauri-apps/api/window';
601
- * const size = await getCurrentWindow().innerSize();
602
- * ```
603
- *
604
- * @returns The window's inner size.
605
- */
606
- async innerSize() {
607
- return n("plugin:window|inner_size", {
608
- label: this.label
609
- }).then((e) => new C(e));
610
- }
611
- /**
612
- * The physical size of the entire window.
613
- * These dimensions include the title bar and borders. If you don't want that (and you usually don't), use inner_size instead.
614
- * @example
615
- * ```typescript
616
- * import { getCurrentWindow } from '@tauri-apps/api/window';
617
- * const size = await getCurrentWindow().outerSize();
618
- * ```
619
- *
620
- * @returns The window's outer size.
621
- */
622
- async outerSize() {
623
- return n("plugin:window|outer_size", {
624
- label: this.label
625
- }).then((e) => new C(e));
626
- }
627
- /**
628
- * Gets the window's current fullscreen state.
629
- * @example
630
- * ```typescript
631
- * import { getCurrentWindow } from '@tauri-apps/api/window';
632
- * const fullscreen = await getCurrentWindow().isFullscreen();
633
- * ```
634
- *
635
- * @returns Whether the window is in fullscreen mode or not.
636
- */
637
- async isFullscreen() {
638
- return n("plugin:window|is_fullscreen", {
639
- label: this.label
640
- });
641
- }
642
- /**
643
- * Gets the window's current minimized state.
644
- * @example
645
- * ```typescript
646
- * import { getCurrentWindow } from '@tauri-apps/api/window';
647
- * const minimized = await getCurrentWindow().isMinimized();
648
- * ```
649
- */
650
- async isMinimized() {
651
- return n("plugin:window|is_minimized", {
652
- label: this.label
653
- });
654
- }
655
- /**
656
- * Gets the window's current maximized state.
657
- * @example
658
- * ```typescript
659
- * import { getCurrentWindow } from '@tauri-apps/api/window';
660
- * const maximized = await getCurrentWindow().isMaximized();
661
- * ```
662
- *
663
- * @returns Whether the window is maximized or not.
664
- */
665
- async isMaximized() {
666
- return n("plugin:window|is_maximized", {
667
- label: this.label
668
- });
669
- }
670
- /**
671
- * Gets the window's current focus state.
672
- * @example
673
- * ```typescript
674
- * import { getCurrentWindow } from '@tauri-apps/api/window';
675
- * const focused = await getCurrentWindow().isFocused();
676
- * ```
677
- *
678
- * @returns Whether the window is focused or not.
679
- */
680
- async isFocused() {
681
- return n("plugin:window|is_focused", {
682
- label: this.label
683
- });
684
- }
685
- /**
686
- * Gets the window's current decorated state.
687
- * @example
688
- * ```typescript
689
- * import { getCurrentWindow } from '@tauri-apps/api/window';
690
- * const decorated = await getCurrentWindow().isDecorated();
691
- * ```
692
- *
693
- * @returns Whether the window is decorated or not.
694
- */
695
- async isDecorated() {
696
- return n("plugin:window|is_decorated", {
697
- label: this.label
698
- });
699
- }
700
- /**
701
- * Gets the window's current resizable state.
702
- * @example
703
- * ```typescript
704
- * import { getCurrentWindow } from '@tauri-apps/api/window';
705
- * const resizable = await getCurrentWindow().isResizable();
706
- * ```
707
- *
708
- * @returns Whether the window is resizable or not.
709
- */
710
- async isResizable() {
711
- return n("plugin:window|is_resizable", {
712
- label: this.label
713
- });
714
- }
715
- /**
716
- * Gets the window's native maximize button state.
717
- *
718
- * #### Platform-specific
719
- *
720
- * - **Linux / iOS / Android:** Unsupported.
721
- *
722
- * @example
723
- * ```typescript
724
- * import { getCurrentWindow } from '@tauri-apps/api/window';
725
- * const maximizable = await getCurrentWindow().isMaximizable();
726
- * ```
727
- *
728
- * @returns Whether the window's native maximize button is enabled or not.
729
- */
730
- async isMaximizable() {
731
- return n("plugin:window|is_maximizable", {
732
- label: this.label
733
- });
734
- }
735
- /**
736
- * Gets the window's native minimize button state.
737
- *
738
- * #### Platform-specific
739
- *
740
- * - **Linux / iOS / Android:** Unsupported.
741
- *
742
- * @example
743
- * ```typescript
744
- * import { getCurrentWindow } from '@tauri-apps/api/window';
745
- * const minimizable = await getCurrentWindow().isMinimizable();
746
- * ```
747
- *
748
- * @returns Whether the window's native minimize button is enabled or not.
749
- */
750
- async isMinimizable() {
751
- return n("plugin:window|is_minimizable", {
752
- label: this.label
753
- });
754
- }
755
- /**
756
- * Gets the window's native close button state.
757
- *
758
- * #### Platform-specific
759
- *
760
- * - **iOS / Android:** Unsupported.
761
- *
762
- * @example
763
- * ```typescript
764
- * import { getCurrentWindow } from '@tauri-apps/api/window';
765
- * const closable = await getCurrentWindow().isClosable();
766
- * ```
767
- *
768
- * @returns Whether the window's native close button is enabled or not.
769
- */
770
- async isClosable() {
771
- return n("plugin:window|is_closable", {
772
- label: this.label
773
- });
774
- }
775
- /**
776
- * Gets the window's current visible state.
777
- * @example
778
- * ```typescript
779
- * import { getCurrentWindow } from '@tauri-apps/api/window';
780
- * const visible = await getCurrentWindow().isVisible();
781
- * ```
782
- *
783
- * @returns Whether the window is visible or not.
784
- */
785
- async isVisible() {
786
- return n("plugin:window|is_visible", {
787
- label: this.label
788
- });
789
- }
790
- /**
791
- * Gets the window's current title.
792
- * @example
793
- * ```typescript
794
- * import { getCurrentWindow } from '@tauri-apps/api/window';
795
- * const title = await getCurrentWindow().title();
796
- * ```
797
- */
798
- async title() {
799
- return n("plugin:window|title", {
800
- label: this.label
801
- });
802
- }
803
- /**
804
- * Gets the window's current theme.
805
- *
806
- * #### Platform-specific
807
- *
808
- * - **macOS:** Theme was introduced on macOS 10.14. Returns `light` on macOS 10.13 and below.
809
- *
810
- * @example
811
- * ```typescript
812
- * import { getCurrentWindow } from '@tauri-apps/api/window';
813
- * const theme = await getCurrentWindow().theme();
814
- * ```
815
- *
816
- * @returns The window theme.
817
- */
818
- async theme() {
819
- return n("plugin:window|theme", {
820
- label: this.label
821
- });
822
- }
823
- /**
824
- * Whether the window is configured to be always on top of other windows or not.
825
- * @example
826
- * ```typescript
827
- * import { getCurrentWindow } from '@tauri-apps/api/window';
828
- * const alwaysOnTop = await getCurrentWindow().isAlwaysOnTop();
829
- * ```
830
- *
831
- * @returns Whether the window is visible or not.
832
- */
833
- async isAlwaysOnTop() {
834
- return n("plugin:window|is_always_on_top", {
835
- label: this.label
836
- });
837
- }
838
- // Setters
839
- /**
840
- * Centers the window.
841
- * @example
842
- * ```typescript
843
- * import { getCurrentWindow } from '@tauri-apps/api/window';
844
- * await getCurrentWindow().center();
845
- * ```
846
- *
847
- * @returns A promise indicating the success or failure of the operation.
848
- */
849
- async center() {
850
- return n("plugin:window|center", {
851
- label: this.label
852
- });
853
- }
854
- /**
855
- * Requests user attention to the window, this has no effect if the application
856
- * is already focused. How requesting for user attention manifests is platform dependent,
857
- * see `UserAttentionType` for details.
858
- *
859
- * Providing `null` will unset the request for user attention. Unsetting the request for
860
- * user attention might not be done automatically by the WM when the window receives input.
861
- *
862
- * #### Platform-specific
863
- *
864
- * - **macOS:** `null` has no effect.
865
- * - **Linux:** Urgency levels have the same effect.
866
- * @example
867
- * ```typescript
868
- * import { getCurrentWindow } from '@tauri-apps/api/window';
869
- * await getCurrentWindow().requestUserAttention();
870
- * ```
871
- *
872
- * @returns A promise indicating the success or failure of the operation.
873
- */
874
- async requestUserAttention(e) {
875
- let i = null;
876
- return e && (e === B.Critical ? i = { type: "Critical" } : i = { type: "Informational" }), n("plugin:window|request_user_attention", {
877
- label: this.label,
878
- value: i
879
- });
880
- }
881
- /**
882
- * Updates the window resizable flag.
883
- * @example
884
- * ```typescript
885
- * import { getCurrentWindow } from '@tauri-apps/api/window';
886
- * await getCurrentWindow().setResizable(false);
887
- * ```
888
- *
889
- * @returns A promise indicating the success or failure of the operation.
890
- */
891
- async setResizable(e) {
892
- return n("plugin:window|set_resizable", {
893
- label: this.label,
894
- value: e
895
- });
896
- }
897
- /**
898
- * Enable or disable the window.
899
- * @example
900
- * ```typescript
901
- * import { getCurrentWindow } from '@tauri-apps/api/window';
902
- * await getCurrentWindow().setEnabled(false);
903
- * ```
904
- *
905
- * @returns A promise indicating the success or failure of the operation.
906
- *
907
- * @since 2.0.0
908
- */
909
- async setEnabled(e) {
910
- return n("plugin:window|set_enabled", {
911
- label: this.label,
912
- value: e
913
- });
914
- }
915
- /**
916
- * Whether the window is enabled or disabled.
917
- * @example
918
- * ```typescript
919
- * import { getCurrentWindow } from '@tauri-apps/api/window';
920
- * await getCurrentWindow().setEnabled(false);
921
- * ```
922
- *
923
- * @returns A promise indicating the success or failure of the operation.
924
- *
925
- * @since 2.0.0
926
- */
927
- async isEnabled() {
928
- return n("plugin:window|is_enabled", {
929
- label: this.label
930
- });
931
- }
932
- /**
933
- * Sets whether the window's native maximize button is enabled or not.
934
- * If resizable is set to false, this setting is ignored.
935
- *
936
- * #### Platform-specific
937
- *
938
- * - **macOS:** Disables the "zoom" button in the window titlebar, which is also used to enter fullscreen mode.
939
- * - **Linux / iOS / Android:** Unsupported.
940
- *
941
- * @example
942
- * ```typescript
943
- * import { getCurrentWindow } from '@tauri-apps/api/window';
944
- * await getCurrentWindow().setMaximizable(false);
945
- * ```
946
- *
947
- * @returns A promise indicating the success or failure of the operation.
948
- */
949
- async setMaximizable(e) {
950
- return n("plugin:window|set_maximizable", {
951
- label: this.label,
952
- value: e
953
- });
954
- }
955
- /**
956
- * Sets whether the window's native minimize button is enabled or not.
957
- *
958
- * #### Platform-specific
959
- *
960
- * - **Linux / iOS / Android:** Unsupported.
961
- *
962
- * @example
963
- * ```typescript
964
- * import { getCurrentWindow } from '@tauri-apps/api/window';
965
- * await getCurrentWindow().setMinimizable(false);
966
- * ```
967
- *
968
- * @returns A promise indicating the success or failure of the operation.
969
- */
970
- async setMinimizable(e) {
971
- return n("plugin:window|set_minimizable", {
972
- label: this.label,
973
- value: e
974
- });
975
- }
976
- /**
977
- * Sets whether the window's native close button is enabled or not.
978
- *
979
- * #### Platform-specific
980
- *
981
- * - **Linux:** GTK+ will do its best to convince the window manager not to show a close button. Depending on the system, this function may not have any effect when called on a window that is already visible
982
- * - **iOS / Android:** Unsupported.
983
- *
984
- * @example
985
- * ```typescript
986
- * import { getCurrentWindow } from '@tauri-apps/api/window';
987
- * await getCurrentWindow().setClosable(false);
988
- * ```
989
- *
990
- * @returns A promise indicating the success or failure of the operation.
991
- */
992
- async setClosable(e) {
993
- return n("plugin:window|set_closable", {
994
- label: this.label,
995
- value: e
996
- });
997
- }
998
- /**
999
- * Sets the window title.
1000
- * @example
1001
- * ```typescript
1002
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1003
- * await getCurrentWindow().setTitle('Tauri');
1004
- * ```
1005
- *
1006
- * @param title The new title
1007
- * @returns A promise indicating the success or failure of the operation.
1008
- */
1009
- async setTitle(e) {
1010
- return n("plugin:window|set_title", {
1011
- label: this.label,
1012
- value: e
1013
- });
1014
- }
1015
- /**
1016
- * Maximizes the window.
1017
- * @example
1018
- * ```typescript
1019
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1020
- * await getCurrentWindow().maximize();
1021
- * ```
1022
- *
1023
- * @returns A promise indicating the success or failure of the operation.
1024
- */
1025
- async maximize() {
1026
- return n("plugin:window|maximize", {
1027
- label: this.label
1028
- });
1029
- }
1030
- /**
1031
- * Unmaximizes the window.
1032
- * @example
1033
- * ```typescript
1034
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1035
- * await getCurrentWindow().unmaximize();
1036
- * ```
1037
- *
1038
- * @returns A promise indicating the success or failure of the operation.
1039
- */
1040
- async unmaximize() {
1041
- return n("plugin:window|unmaximize", {
1042
- label: this.label
1043
- });
1044
- }
1045
- /**
1046
- * Toggles the window maximized state.
1047
- * @example
1048
- * ```typescript
1049
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1050
- * await getCurrentWindow().toggleMaximize();
1051
- * ```
1052
- *
1053
- * @returns A promise indicating the success or failure of the operation.
1054
- */
1055
- async toggleMaximize() {
1056
- return n("plugin:window|toggle_maximize", {
1057
- label: this.label
1058
- });
1059
- }
1060
- /**
1061
- * Minimizes the window.
1062
- * @example
1063
- * ```typescript
1064
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1065
- * await getCurrentWindow().minimize();
1066
- * ```
1067
- *
1068
- * @returns A promise indicating the success or failure of the operation.
1069
- */
1070
- async minimize() {
1071
- return n("plugin:window|minimize", {
1072
- label: this.label
1073
- });
1074
- }
1075
- /**
1076
- * Unminimizes the window.
1077
- * @example
1078
- * ```typescript
1079
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1080
- * await getCurrentWindow().unminimize();
1081
- * ```
1082
- *
1083
- * @returns A promise indicating the success or failure of the operation.
1084
- */
1085
- async unminimize() {
1086
- return n("plugin:window|unminimize", {
1087
- label: this.label
1088
- });
1089
- }
1090
- /**
1091
- * Sets the window visibility to true.
1092
- * @example
1093
- * ```typescript
1094
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1095
- * await getCurrentWindow().show();
1096
- * ```
1097
- *
1098
- * @returns A promise indicating the success or failure of the operation.
1099
- */
1100
- async show() {
1101
- return n("plugin:window|show", {
1102
- label: this.label
1103
- });
1104
- }
1105
- /**
1106
- * Sets the window visibility to false.
1107
- * @example
1108
- * ```typescript
1109
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1110
- * await getCurrentWindow().hide();
1111
- * ```
1112
- *
1113
- * @returns A promise indicating the success or failure of the operation.
1114
- */
1115
- async hide() {
1116
- return n("plugin:window|hide", {
1117
- label: this.label
1118
- });
1119
- }
1120
- /**
1121
- * Closes the window.
1122
- *
1123
- * Note this emits a closeRequested event so you can intercept it. To force window close, use {@link Window.destroy}.
1124
- * @example
1125
- * ```typescript
1126
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1127
- * await getCurrentWindow().close();
1128
- * ```
1129
- *
1130
- * @returns A promise indicating the success or failure of the operation.
1131
- */
1132
- async close() {
1133
- return n("plugin:window|close", {
1134
- label: this.label
1135
- });
1136
- }
1137
- /**
1138
- * Destroys the window. Behaves like {@link Window.close} but forces the window close instead of emitting a closeRequested event.
1139
- * @example
1140
- * ```typescript
1141
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1142
- * await getCurrentWindow().destroy();
1143
- * ```
1144
- *
1145
- * @returns A promise indicating the success or failure of the operation.
1146
- */
1147
- async destroy() {
1148
- return n("plugin:window|destroy", {
1149
- label: this.label
1150
- });
1151
- }
1152
- /**
1153
- * Whether the window should have borders and bars.
1154
- * @example
1155
- * ```typescript
1156
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1157
- * await getCurrentWindow().setDecorations(false);
1158
- * ```
1159
- *
1160
- * @param decorations Whether the window should have borders and bars.
1161
- * @returns A promise indicating the success or failure of the operation.
1162
- */
1163
- async setDecorations(e) {
1164
- return n("plugin:window|set_decorations", {
1165
- label: this.label,
1166
- value: e
1167
- });
1168
- }
1169
- /**
1170
- * Whether or not the window should have shadow.
1171
- *
1172
- * #### Platform-specific
1173
- *
1174
- * - **Windows:**
1175
- * - `false` has no effect on decorated window, shadows are always ON.
1176
- * - `true` will make undecorated window have a 1px white border,
1177
- * and on Windows 11, it will have a rounded corners.
1178
- * - **Linux:** Unsupported.
1179
- *
1180
- * @example
1181
- * ```typescript
1182
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1183
- * await getCurrentWindow().setShadow(false);
1184
- * ```
1185
- *
1186
- * @returns A promise indicating the success or failure of the operation.
1187
- */
1188
- async setShadow(e) {
1189
- return n("plugin:window|set_shadow", {
1190
- label: this.label,
1191
- value: e
1192
- });
1193
- }
1194
- /**
1195
- * Set window effects.
1196
- */
1197
- async setEffects(e) {
1198
- return n("plugin:window|set_effects", {
1199
- label: this.label,
1200
- value: e
1201
- });
1202
- }
1203
- /**
1204
- * Clear any applied effects if possible.
1205
- */
1206
- async clearEffects() {
1207
- return n("plugin:window|set_effects", {
1208
- label: this.label,
1209
- value: null
1210
- });
1211
- }
1212
- /**
1213
- * Whether the window should always be on top of other windows.
1214
- * @example
1215
- * ```typescript
1216
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1217
- * await getCurrentWindow().setAlwaysOnTop(true);
1218
- * ```
1219
- *
1220
- * @param alwaysOnTop Whether the window should always be on top of other windows or not.
1221
- * @returns A promise indicating the success or failure of the operation.
1222
- */
1223
- async setAlwaysOnTop(e) {
1224
- return n("plugin:window|set_always_on_top", {
1225
- label: this.label,
1226
- value: e
1227
- });
1228
- }
1229
- /**
1230
- * Whether the window should always be below other windows.
1231
- * @example
1232
- * ```typescript
1233
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1234
- * await getCurrentWindow().setAlwaysOnBottom(true);
1235
- * ```
1236
- *
1237
- * @param alwaysOnBottom Whether the window should always be below other windows or not.
1238
- * @returns A promise indicating the success or failure of the operation.
1239
- */
1240
- async setAlwaysOnBottom(e) {
1241
- return n("plugin:window|set_always_on_bottom", {
1242
- label: this.label,
1243
- value: e
1244
- });
1245
- }
1246
- /**
1247
- * Prevents the window contents from being captured by other apps.
1248
- * @example
1249
- * ```typescript
1250
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1251
- * await getCurrentWindow().setContentProtected(true);
1252
- * ```
1253
- *
1254
- * @returns A promise indicating the success or failure of the operation.
1255
- */
1256
- async setContentProtected(e) {
1257
- return n("plugin:window|set_content_protected", {
1258
- label: this.label,
1259
- value: e
1260
- });
1261
- }
1262
- /**
1263
- * Resizes the window with a new inner size.
1264
- * @example
1265
- * ```typescript
1266
- * import { getCurrentWindow, LogicalSize } from '@tauri-apps/api/window';
1267
- * await getCurrentWindow().setSize(new LogicalSize(600, 500));
1268
- * ```
1269
- *
1270
- * @param size The logical or physical inner size.
1271
- * @returns A promise indicating the success or failure of the operation.
1272
- */
1273
- async setSize(e) {
1274
- return n("plugin:window|set_size", {
1275
- label: this.label,
1276
- value: e instanceof _ ? e : new _(e)
1277
- });
1278
- }
1279
- /**
1280
- * Sets the window minimum inner size. If the `size` argument is not provided, the constraint is unset.
1281
- * @example
1282
- * ```typescript
1283
- * import { getCurrentWindow, PhysicalSize } from '@tauri-apps/api/window';
1284
- * await getCurrentWindow().setMinSize(new PhysicalSize(600, 500));
1285
- * ```
1286
- *
1287
- * @param size The logical or physical inner size, or `null` to unset the constraint.
1288
- * @returns A promise indicating the success or failure of the operation.
1289
- */
1290
- async setMinSize(e) {
1291
- return n("plugin:window|set_min_size", {
1292
- label: this.label,
1293
- value: e instanceof _ ? e : e ? new _(e) : null
1294
- });
1295
- }
1296
- /**
1297
- * Sets the window maximum inner size. If the `size` argument is undefined, the constraint is unset.
1298
- * @example
1299
- * ```typescript
1300
- * import { getCurrentWindow, LogicalSize } from '@tauri-apps/api/window';
1301
- * await getCurrentWindow().setMaxSize(new LogicalSize(600, 500));
1302
- * ```
1303
- *
1304
- * @param size The logical or physical inner size, or `null` to unset the constraint.
1305
- * @returns A promise indicating the success or failure of the operation.
1306
- */
1307
- async setMaxSize(e) {
1308
- return n("plugin:window|set_max_size", {
1309
- label: this.label,
1310
- value: e instanceof _ ? e : e ? new _(e) : null
1311
- });
1312
- }
1313
- /**
1314
- * Sets the window inner size constraints.
1315
- * @example
1316
- * ```typescript
1317
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1318
- * await getCurrentWindow().setSizeConstraints({ minWidth: 300 });
1319
- * ```
1320
- *
1321
- * @param constraints The logical or physical inner size, or `null` to unset the constraint.
1322
- * @returns A promise indicating the success or failure of the operation.
1323
- */
1324
- async setSizeConstraints(e) {
1325
- function i(a) {
1326
- return a ? { Logical: a } : null;
144
+ function F(v) {
145
+ r("update:modelValue", v), r("change", v);
1327
146
  }
1328
- return n("plugin:window|set_size_constraints", {
1329
- label: this.label,
1330
- value: {
1331
- minWidth: i(e?.minWidth),
1332
- minHeight: i(e?.minHeight),
1333
- maxWidth: i(e?.maxWidth),
1334
- maxHeight: i(e?.maxHeight)
147
+ return L(
148
+ () => n.collapsed,
149
+ (v) => {
150
+ v !== void 0 && (c.value = v);
1335
151
  }
1336
- });
1337
- }
1338
- /**
1339
- * Sets the window outer position.
1340
- * @example
1341
- * ```typescript
1342
- * import { getCurrentWindow, LogicalPosition } from '@tauri-apps/api/window';
1343
- * await getCurrentWindow().setPosition(new LogicalPosition(600, 500));
1344
- * ```
1345
- *
1346
- * @param position The new position, in logical or physical pixels.
1347
- * @returns A promise indicating the success or failure of the operation.
1348
- */
1349
- async setPosition(e) {
1350
- return n("plugin:window|set_position", {
1351
- label: this.label,
1352
- value: e instanceof z ? e : new z(e)
1353
- });
1354
- }
1355
- /**
1356
- * Sets the window fullscreen state.
1357
- * @example
1358
- * ```typescript
1359
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1360
- * await getCurrentWindow().setFullscreen(true);
1361
- * ```
1362
- *
1363
- * @param fullscreen Whether the window should go to fullscreen or not.
1364
- * @returns A promise indicating the success or failure of the operation.
1365
- */
1366
- async setFullscreen(e) {
1367
- return n("plugin:window|set_fullscreen", {
1368
- label: this.label,
1369
- value: e
1370
- });
1371
- }
1372
- /**
1373
- * On macOS, Toggles a fullscreen mode that doesn’t require a new macOS space. Returns a boolean indicating whether the transition was successful (this won’t work if the window was already in the native fullscreen).
1374
- * This is how fullscreen used to work on macOS in versions before Lion. And allows the user to have a fullscreen window without using another space or taking control over the entire monitor.
1375
- *
1376
- * On other platforms, this is the same as {@link Window.setFullscreen}.
1377
- *
1378
- * @param fullscreen Whether the window should go to simple fullscreen or not.
1379
- * @returns A promise indicating the success or failure of the operation.
1380
- */
1381
- async setSimpleFullscreen(e) {
1382
- return n("plugin:window|set_simple_fullscreen", {
1383
- label: this.label,
1384
- value: e
1385
- });
1386
- }
1387
- /**
1388
- * Bring the window to front and focus.
1389
- * @example
1390
- * ```typescript
1391
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1392
- * await getCurrentWindow().setFocus();
1393
- * ```
1394
- *
1395
- * @returns A promise indicating the success or failure of the operation.
1396
- */
1397
- async setFocus() {
1398
- return n("plugin:window|set_focus", {
1399
- label: this.label
1400
- });
1401
- }
1402
- /**
1403
- * Sets whether the window can be focused.
1404
- *
1405
- * #### Platform-specific
1406
- *
1407
- * - **macOS**: If the window is already focused, it is not possible to unfocus it after calling `set_focusable(false)`.
1408
- * In this case, you might consider calling {@link Window.setFocus} but it will move the window to the back i.e. at the bottom in terms of z-order.
1409
- *
1410
- * @example
1411
- * ```typescript
1412
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1413
- * await getCurrentWindow().setFocusable(true);
1414
- * ```
1415
- *
1416
- * @param focusable Whether the window can be focused.
1417
- * @returns A promise indicating the success or failure of the operation.
1418
- */
1419
- async setFocusable(e) {
1420
- return n("plugin:window|set_focusable", {
1421
- label: this.label,
1422
- value: e
1423
- });
1424
- }
1425
- /**
1426
- * Sets the window icon.
1427
- * @example
1428
- * ```typescript
1429
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1430
- * await getCurrentWindow().setIcon('/tauri/awesome.png');
1431
- * ```
1432
- *
1433
- * Note that you may need the `image-ico` or `image-png` Cargo features to use this API.
1434
- * To enable it, change your Cargo.toml file:
1435
- * ```toml
1436
- * [dependencies]
1437
- * tauri = { version = "...", features = ["...", "image-png"] }
1438
- * ```
1439
- *
1440
- * @param icon Icon bytes or path to the icon file.
1441
- * @returns A promise indicating the success or failure of the operation.
1442
- */
1443
- async setIcon(e) {
1444
- return n("plugin:window|set_icon", {
1445
- label: this.label,
1446
- value: A(e)
1447
- });
1448
- }
1449
- /**
1450
- * Whether the window icon should be hidden from the taskbar or not.
1451
- *
1452
- * #### Platform-specific
1453
- *
1454
- * - **macOS:** Unsupported.
1455
- * @example
1456
- * ```typescript
1457
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1458
- * await getCurrentWindow().setSkipTaskbar(true);
1459
- * ```
1460
- *
1461
- * @param skip true to hide window icon, false to show it.
1462
- * @returns A promise indicating the success or failure of the operation.
1463
- */
1464
- async setSkipTaskbar(e) {
1465
- return n("plugin:window|set_skip_taskbar", {
1466
- label: this.label,
1467
- value: e
1468
- });
1469
- }
1470
- /**
1471
- * Grabs the cursor, preventing it from leaving the window.
1472
- *
1473
- * There's no guarantee that the cursor will be hidden. You should
1474
- * hide it by yourself if you want so.
1475
- *
1476
- * #### Platform-specific
1477
- *
1478
- * - **Linux:** Unsupported.
1479
- * - **macOS:** This locks the cursor in a fixed location, which looks visually awkward.
1480
- * @example
1481
- * ```typescript
1482
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1483
- * await getCurrentWindow().setCursorGrab(true);
1484
- * ```
1485
- *
1486
- * @param grab `true` to grab the cursor icon, `false` to release it.
1487
- * @returns A promise indicating the success or failure of the operation.
1488
- */
1489
- async setCursorGrab(e) {
1490
- return n("plugin:window|set_cursor_grab", {
1491
- label: this.label,
1492
- value: e
1493
- });
1494
- }
1495
- /**
1496
- * Modifies the cursor's visibility.
1497
- *
1498
- * #### Platform-specific
1499
- *
1500
- * - **Windows:** The cursor is only hidden within the confines of the window.
1501
- * - **macOS:** The cursor is hidden as long as the window has input focus, even if the cursor is
1502
- * outside of the window.
1503
- * @example
1504
- * ```typescript
1505
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1506
- * await getCurrentWindow().setCursorVisible(false);
1507
- * ```
1508
- *
1509
- * @param visible If `false`, this will hide the cursor. If `true`, this will show the cursor.
1510
- * @returns A promise indicating the success or failure of the operation.
1511
- */
1512
- async setCursorVisible(e) {
1513
- return n("plugin:window|set_cursor_visible", {
1514
- label: this.label,
1515
- value: e
1516
- });
1517
- }
1518
- /**
1519
- * Modifies the cursor icon of the window.
1520
- * @example
1521
- * ```typescript
1522
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1523
- * await getCurrentWindow().setCursorIcon('help');
1524
- * ```
1525
- *
1526
- * @param icon The new cursor icon.
1527
- * @returns A promise indicating the success or failure of the operation.
1528
- */
1529
- async setCursorIcon(e) {
1530
- return n("plugin:window|set_cursor_icon", {
1531
- label: this.label,
1532
- value: e
1533
- });
1534
- }
1535
- /**
1536
- * Sets the window background color.
1537
- *
1538
- * #### Platform-specific:
1539
- *
1540
- * - **Windows:** alpha channel is ignored.
1541
- * - **iOS / Android:** Unsupported.
1542
- *
1543
- * @returns A promise indicating the success or failure of the operation.
1544
- *
1545
- * @since 2.1.0
1546
- */
1547
- async setBackgroundColor(e) {
1548
- return n("plugin:window|set_background_color", { color: e });
1549
- }
1550
- /**
1551
- * Changes the position of the cursor in window coordinates.
1552
- * @example
1553
- * ```typescript
1554
- * import { getCurrentWindow, LogicalPosition } from '@tauri-apps/api/window';
1555
- * await getCurrentWindow().setCursorPosition(new LogicalPosition(600, 300));
1556
- * ```
1557
- *
1558
- * @param position The new cursor position.
1559
- * @returns A promise indicating the success or failure of the operation.
1560
- */
1561
- async setCursorPosition(e) {
1562
- return n("plugin:window|set_cursor_position", {
1563
- label: this.label,
1564
- value: e instanceof z ? e : new z(e)
1565
- });
1566
- }
1567
- /**
1568
- * Changes the cursor events behavior.
1569
- *
1570
- * @example
1571
- * ```typescript
1572
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1573
- * await getCurrentWindow().setIgnoreCursorEvents(true);
1574
- * ```
1575
- *
1576
- * @param ignore `true` to ignore the cursor events; `false` to process them as usual.
1577
- * @returns A promise indicating the success or failure of the operation.
1578
- */
1579
- async setIgnoreCursorEvents(e) {
1580
- return n("plugin:window|set_ignore_cursor_events", {
1581
- label: this.label,
1582
- value: e
1583
- });
1584
- }
1585
- /**
1586
- * Starts dragging the window.
1587
- * @example
1588
- * ```typescript
1589
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1590
- * await getCurrentWindow().startDragging();
1591
- * ```
1592
- *
1593
- * @return A promise indicating the success or failure of the operation.
1594
- */
1595
- async startDragging() {
1596
- return n("plugin:window|start_dragging", {
1597
- label: this.label
1598
- });
1599
- }
1600
- /**
1601
- * Starts resize-dragging the window.
1602
- * @example
1603
- * ```typescript
1604
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1605
- * await getCurrentWindow().startResizeDragging();
1606
- * ```
1607
- *
1608
- * @return A promise indicating the success or failure of the operation.
1609
- */
1610
- async startResizeDragging(e) {
1611
- return n("plugin:window|start_resize_dragging", {
1612
- label: this.label,
1613
- value: e
1614
- });
1615
- }
1616
- /**
1617
- * Sets the badge count. It is app wide and not specific to this window.
1618
- *
1619
- * #### Platform-specific
1620
- *
1621
- * - **Windows**: Unsupported. Use @{linkcode Window.setOverlayIcon} instead.
1622
- *
1623
- * @example
1624
- * ```typescript
1625
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1626
- * await getCurrentWindow().setBadgeCount(5);
1627
- * ```
1628
- *
1629
- * @param count The badge count. Use `undefined` to remove the badge.
1630
- * @return A promise indicating the success or failure of the operation.
1631
- */
1632
- async setBadgeCount(e) {
1633
- return n("plugin:window|set_badge_count", {
1634
- label: this.label,
1635
- value: e
1636
- });
1637
- }
1638
- /**
1639
- * Sets the badge cont **macOS only**.
1640
- *
1641
- * @example
1642
- * ```typescript
1643
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1644
- * await getCurrentWindow().setBadgeLabel("Hello");
1645
- * ```
1646
- *
1647
- * @param label The badge label. Use `undefined` to remove the badge.
1648
- * @return A promise indicating the success or failure of the operation.
1649
- */
1650
- async setBadgeLabel(e) {
1651
- return n("plugin:window|set_badge_label", {
1652
- label: this.label,
1653
- value: e
1654
- });
1655
- }
1656
- /**
1657
- * Sets the overlay icon. **Windows only**
1658
- * The overlay icon can be set for every window.
1659
- *
1660
- *
1661
- * Note that you may need the `image-ico` or `image-png` Cargo features to use this API.
1662
- * To enable it, change your Cargo.toml file:
1663
- *
1664
- * ```toml
1665
- * [dependencies]
1666
- * tauri = { version = "...", features = ["...", "image-png"] }
1667
- * ```
1668
- *
1669
- * @example
1670
- * ```typescript
1671
- * import { getCurrentWindow } from '@tauri-apps/api/window';
1672
- * await getCurrentWindow().setOverlayIcon("/tauri/awesome.png");
1673
- * ```
1674
- *
1675
- * @param icon Icon bytes or path to the icon file. Use `undefined` to remove the overlay icon.
1676
- * @return A promise indicating the success or failure of the operation.
1677
- */
1678
- async setOverlayIcon(e) {
1679
- return n("plugin:window|set_overlay_icon", {
1680
- label: this.label,
1681
- value: e ? A(e) : void 0
1682
- });
1683
- }
1684
- /**
1685
- * Sets the taskbar progress state.
1686
- *
1687
- * #### Platform-specific
1688
- *
1689
- * - **Linux / macOS**: Progress bar is app-wide and not specific to this window.
1690
- * - **Linux**: Only supported desktop environments with `libunity` (e.g. GNOME).
1691
- *
1692
- * @example
1693
- * ```typescript
1694
- * import { getCurrentWindow, ProgressBarStatus } from '@tauri-apps/api/window';
1695
- * await getCurrentWindow().setProgressBar({
1696
- * status: ProgressBarStatus.Normal,
1697
- * progress: 50,
1698
- * });
1699
- * ```
1700
- *
1701
- * @return A promise indicating the success or failure of the operation.
1702
- */
1703
- async setProgressBar(e) {
1704
- return n("plugin:window|set_progress_bar", {
1705
- label: this.label,
1706
- value: e
1707
- });
1708
- }
1709
- /**
1710
- * Sets whether the window should be visible on all workspaces or virtual desktops.
1711
- *
1712
- * #### Platform-specific
1713
- *
1714
- * - **Windows / iOS / Android:** Unsupported.
1715
- *
1716
- * @since 2.0.0
1717
- */
1718
- async setVisibleOnAllWorkspaces(e) {
1719
- return n("plugin:window|set_visible_on_all_workspaces", {
1720
- label: this.label,
1721
- value: e
1722
- });
1723
- }
1724
- /**
1725
- * Sets the title bar style. **macOS only**.
1726
- *
1727
- * @since 2.0.0
1728
- */
1729
- async setTitleBarStyle(e) {
1730
- return n("plugin:window|set_title_bar_style", {
1731
- label: this.label,
1732
- value: e
1733
- });
1734
- }
1735
- /**
1736
- * Set window theme, pass in `null` or `undefined` to follow system theme
1737
- *
1738
- * #### Platform-specific
1739
- *
1740
- * - **Linux / macOS**: Theme is app-wide and not specific to this window.
1741
- * - **iOS / Android:** Unsupported.
1742
- *
1743
- * @since 2.0.0
1744
- */
1745
- async setTheme(e) {
1746
- return n("plugin:window|set_theme", {
1747
- label: this.label,
1748
- value: e
1749
- });
1750
- }
1751
- // Listeners
1752
- /**
1753
- * Listen to window resize.
1754
- *
1755
- * @example
1756
- * ```typescript
1757
- * import { getCurrentWindow } from "@tauri-apps/api/window";
1758
- * const unlisten = await getCurrentWindow().onResized(({ payload: size }) => {
1759
- * console.log('Window resized', size);
1760
- * });
1761
- *
1762
- * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
1763
- * unlisten();
1764
- * ```
1765
- *
1766
- * @returns A promise resolving to a function to unlisten to the event.
1767
- * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
1768
- */
1769
- async onResized(e) {
1770
- return this.listen(b.WINDOW_RESIZED, (i) => {
1771
- i.payload = new C(i.payload), e(i);
1772
- });
1773
- }
1774
- /**
1775
- * Listen to window move.
1776
- *
1777
- * @example
1778
- * ```typescript
1779
- * import { getCurrentWindow } from "@tauri-apps/api/window";
1780
- * const unlisten = await getCurrentWindow().onMoved(({ payload: position }) => {
1781
- * console.log('Window moved', position);
1782
- * });
1783
- *
1784
- * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
1785
- * unlisten();
1786
- * ```
1787
- *
1788
- * @returns A promise resolving to a function to unlisten to the event.
1789
- * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
1790
- */
1791
- async onMoved(e) {
1792
- return this.listen(b.WINDOW_MOVED, (i) => {
1793
- i.payload = new f(i.payload), e(i);
1794
- });
1795
- }
1796
- /**
1797
- * Listen to window close requested. Emitted when the user requests to closes the window.
1798
- *
1799
- * @example
1800
- * ```typescript
1801
- * import { getCurrentWindow } from "@tauri-apps/api/window";
1802
- * import { confirm } from '@tauri-apps/api/dialog';
1803
- * const unlisten = await getCurrentWindow().onCloseRequested(async (event) => {
1804
- * const confirmed = await confirm('Are you sure?');
1805
- * if (!confirmed) {
1806
- * // user did not confirm closing the window; let's prevent it
1807
- * event.preventDefault();
1808
- * }
1809
- * });
1810
- *
1811
- * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
1812
- * unlisten();
1813
- * ```
1814
- *
1815
- * @returns A promise resolving to a function to unlisten to the event.
1816
- * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
1817
- */
1818
- async onCloseRequested(e) {
1819
- return this.listen(b.WINDOW_CLOSE_REQUESTED, async (i) => {
1820
- const a = new he(i);
1821
- await e(a), a.isPreventDefault() || await this.destroy();
1822
- });
1823
- }
1824
- /**
1825
- * Listen to a file drop event.
1826
- * The listener is triggered when the user hovers the selected files on the webview,
1827
- * drops the files or cancels the operation.
1828
- *
1829
- * @example
1830
- * ```typescript
1831
- * import { getCurrentWindow } from "@tauri-apps/api/webview";
1832
- * const unlisten = await getCurrentWindow().onDragDropEvent((event) => {
1833
- * if (event.payload.type === 'over') {
1834
- * console.log('User hovering', event.payload.position);
1835
- * } else if (event.payload.type === 'drop') {
1836
- * console.log('User dropped', event.payload.paths);
1837
- * } else {
1838
- * console.log('File drop cancelled');
1839
- * }
1840
- * });
1841
- *
1842
- * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
1843
- * unlisten();
1844
- * ```
1845
- *
1846
- * @returns A promise resolving to a function to unlisten to the event.
1847
- * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
1848
- */
1849
- async onDragDropEvent(e) {
1850
- const i = await this.listen(b.DRAG_ENTER, (o) => {
1851
- e({
1852
- ...o,
1853
- payload: {
1854
- type: "enter",
1855
- paths: o.payload.paths,
1856
- position: new f(o.payload.position)
1857
- }
1858
- });
1859
- }), a = await this.listen(b.DRAG_OVER, (o) => {
1860
- e({
1861
- ...o,
1862
- payload: {
1863
- type: "over",
1864
- position: new f(o.payload.position)
1865
- }
1866
- });
1867
- }), l = await this.listen(b.DRAG_DROP, (o) => {
1868
- e({
1869
- ...o,
1870
- payload: {
1871
- type: "drop",
1872
- paths: o.payload.paths,
1873
- position: new f(o.payload.position)
1874
- }
1875
- });
1876
- }), c = await this.listen(b.DRAG_LEAVE, (o) => {
1877
- e({ ...o, payload: { type: "leave" } });
1878
- });
1879
- return () => {
1880
- i(), l(), a(), c();
1881
- };
1882
- }
1883
- /**
1884
- * Listen to window focus change.
1885
- *
1886
- * @example
1887
- * ```typescript
1888
- * import { getCurrentWindow } from "@tauri-apps/api/window";
1889
- * const unlisten = await getCurrentWindow().onFocusChanged(({ payload: focused }) => {
1890
- * console.log('Focus changed, window is focused? ' + focused);
1891
- * });
1892
- *
1893
- * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
1894
- * unlisten();
1895
- * ```
1896
- *
1897
- * @returns A promise resolving to a function to unlisten to the event.
1898
- * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
1899
- */
1900
- async onFocusChanged(e) {
1901
- const i = await this.listen(b.WINDOW_FOCUS, (l) => {
1902
- e({ ...l, payload: !0 });
1903
- }), a = await this.listen(b.WINDOW_BLUR, (l) => {
1904
- e({ ...l, payload: !1 });
1905
- });
1906
- return () => {
1907
- i(), a();
1908
- };
1909
- }
1910
- /**
1911
- * Listen to window scale change. Emitted when the window's scale factor has changed.
1912
- * The following user actions can cause DPI changes:
1913
- * - Changing the display's resolution.
1914
- * - Changing the display's scale factor (e.g. in Control Panel on Windows).
1915
- * - Moving the window to a display with a different scale factor.
1916
- *
1917
- * @example
1918
- * ```typescript
1919
- * import { getCurrentWindow } from "@tauri-apps/api/window";
1920
- * const unlisten = await getCurrentWindow().onScaleChanged(({ payload }) => {
1921
- * console.log('Scale changed', payload.scaleFactor, payload.size);
1922
- * });
1923
- *
1924
- * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
1925
- * unlisten();
1926
- * ```
1927
- *
1928
- * @returns A promise resolving to a function to unlisten to the event.
1929
- * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
1930
- */
1931
- async onScaleChanged(e) {
1932
- return this.listen(b.WINDOW_SCALE_FACTOR_CHANGED, e);
1933
- }
1934
- /**
1935
- * Listen to the system theme change.
1936
- *
1937
- * @example
1938
- * ```typescript
1939
- * import { getCurrentWindow } from "@tauri-apps/api/window";
1940
- * const unlisten = await getCurrentWindow().onThemeChanged(({ payload: theme }) => {
1941
- * console.log('New theme: ' + theme);
1942
- * });
1943
- *
1944
- * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
1945
- * unlisten();
1946
- * ```
1947
- *
1948
- * @returns A promise resolving to a function to unlisten to the event.
1949
- * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
1950
- */
1951
- async onThemeChanged(e) {
1952
- return this.listen(b.WINDOW_THEME_CHANGED, e);
1953
- }
1954
- }
1955
- var N;
1956
- (function(t) {
1957
- t.Disabled = "disabled", t.Throttle = "throttle", t.Suspend = "suspend";
1958
- })(N || (N = {}));
1959
- var E;
1960
- (function(t) {
1961
- t.Default = "default", t.FluentOverlay = "fluentOverlay";
1962
- })(E || (E = {}));
1963
- var P;
1964
- (function(t) {
1965
- t.AppearanceBased = "appearanceBased", t.Light = "light", t.Dark = "dark", t.MediumLight = "mediumLight", t.UltraDark = "ultraDark", t.Titlebar = "titlebar", t.Selection = "selection", t.Menu = "menu", t.Popover = "popover", t.Sidebar = "sidebar", t.HeaderView = "headerView", t.Sheet = "sheet", t.WindowBackground = "windowBackground", t.HudWindow = "hudWindow", t.FullScreenUI = "fullScreenUI", t.Tooltip = "tooltip", t.ContentBackground = "contentBackground", t.UnderWindowBackground = "underWindowBackground", t.UnderPageBackground = "underPageBackground", t.Mica = "mica", t.Blur = "blur", t.Acrylic = "acrylic", t.Tabbed = "tabbed", t.TabbedDark = "tabbedDark", t.TabbedLight = "tabbedLight";
1966
- })(P || (P = {}));
1967
- var M;
1968
- (function(t) {
1969
- t.FollowsWindowActiveState = "followsWindowActiveState", t.Active = "active", t.Inactive = "inactive";
1970
- })(M || (M = {}));
1971
- async function be(t, e = {}, i) {
1972
- return window.__TAURI_INTERNALS__.invoke(t, e, i);
1973
- }
1974
- async function ge(t) {
1975
- try {
1976
- return await be("plugin:vicons|get_icon", { name: t });
1977
- } catch (e) {
1978
- console.error("[Icon Error] Error obteniendo icono:", e);
1979
- }
1980
- return "";
1981
- }
1982
- function we(t) {
1983
- try {
1984
- const e = atob(t.substring(0, 32)), i = new Uint8Array(e.length);
1985
- for (let a = 0; a < e.length; a++)
1986
- i[a] = e.charCodeAt(a);
1987
- return i[0] === 137 && i[1] === 80 && i[2] === 78 && i[3] === 71 ? "image/png" : "image/svg+xml";
1988
- } catch (e) {
1989
- return console.error("Error identificando tipo de imagen:", e), "image/png";
1990
- }
1991
- }
1992
- async function L(t) {
1993
- try {
1994
- const e = await ge(t);
1995
- return `data:${we(e)};base64,${e}`;
1996
- } catch (e) {
1997
- return console.error("[Icon Error] Error obteniendo icono:", e), "";
152
+ ), T(() => {
153
+ f = window.matchMedia("(max-width: 767px)"), p(), f.addEventListener("change", p);
154
+ }), O(() => f?.removeEventListener("change", p)), s({ collapsed: o }), (v, nt) => (a(), l("aside", {
155
+ class: b(["relative z-30 flex h-full shrink-0 flex-col rounded-corner border border-ui-border bg-ui-bg/80 transition-all duration-300", ["w-[84px]", o.value ? "md:w-[84px]" : "md:w-72"]])
156
+ }, [
157
+ g.value || v.$slots.header ? (a(), l("header", Z, [
158
+ i("div", _, [
159
+ i("button", {
160
+ type: "button",
161
+ class: "hidden h-10 w-10 items-center justify-center rounded-corner border border-ui-border bg-ui-surface/70 font-semibold text-sm md:inline-flex",
162
+ "aria-label": o.value ? e.expandLabel : e.collapseLabel,
163
+ "aria-expanded": !o.value,
164
+ onClick: j
165
+ }, m(o.value ? ">" : "<"), 9, ee),
166
+ g.value && !o.value ? (a(), l("div", te, [
167
+ e.title ? (a(), l("p", ae, m(e.title), 1)) : u("", !0),
168
+ e.subtitle ? (a(), l("p", le, m(e.subtitle), 1)) : u("", !0)
169
+ ])) : u("", !0)
170
+ ]),
171
+ v.$slots.header && !o.value ? (a(), l("div", ne, [
172
+ y(v.$slots, "header", { collapsed: o.value })
173
+ ])) : u("", !0)
174
+ ])) : (a(), l("div", oe, [
175
+ i("button", {
176
+ type: "button",
177
+ class: "hidden h-10 w-10 items-center justify-center rounded-corner border border-ui-border bg-ui-surface/70 font-semibold text-sm md:inline-flex",
178
+ "aria-label": o.value ? e.expandLabel : e.collapseLabel,
179
+ "aria-expanded": !o.value,
180
+ onClick: j
181
+ }, m(o.value ? ">" : "<"), 9, se)
182
+ ])),
183
+ i("div", ie, [
184
+ (a(!0), l($, null, I(e.categories, (S) => (a(), A(V, {
185
+ key: S.id,
186
+ title: S.title,
187
+ collapsed: o.value
188
+ }, {
189
+ default: P(() => [
190
+ (a(!0), l($, null, I(S.items, (k) => (a(), A(M, {
191
+ key: k.id,
192
+ label: k.label,
193
+ icon: k.icon,
194
+ badge: k.badge,
195
+ disabled: k.disabled,
196
+ collapsed: o.value,
197
+ active: e.modelValue === k.id,
198
+ onClick: (ot) => F(k.id)
199
+ }, null, 8, ["label", "icon", "badge", "disabled", "collapsed", "active", "onClick"]))), 128))
200
+ ]),
201
+ _: 2
202
+ }, 1032, ["title", "collapsed"]))), 128)),
203
+ y(v.$slots, "default", { collapsed: o.value })
204
+ ])
205
+ ], 2));
1998
206
  }
1999
- }
2000
- const ye = { "data-tauri-drag-region": "" }, me = ["src", "alt"], pe = { "data-tauri-drag-region": "" }, fe = { "data-tauri-drag-region": "" }, ve = ["src"], _e = ["src"], ke = ["src"], xe = /* @__PURE__ */ m({
207
+ }), ce = { "data-tauri-drag-region": "" }, de = ["src", "alt"], ue = { "data-tauri-drag-region": "" }, me = { "data-tauri-drag-region": "" }, fe = ["src"], be = ["src"], ge = ["src"], he = /* @__PURE__ */ h({
2001
208
  __name: "TopBar",
2002
209
  props: {
2003
210
  title: String,
2004
211
  image: String
2005
212
  },
2006
- setup(t) {
2007
- const e = x(null), i = j(), a = x(""), l = x(""), c = x(""), o = t;
2008
- return q(async () => {
2009
- a.value = await L("window-close"), l.value = await L("window-minimize"), c.value = await L("window-maximize");
2010
- }), (p, h) => (r(), s("div", {
213
+ setup(e) {
214
+ const s = x(null), t = R(), n = x(""), r = x(""), c = x(""), d = e;
215
+ return T(async () => {
216
+ n.value = await C("window-close"), r.value = await C("window-minimize"), c.value = await C("window-maximize");
217
+ }), (f, o) => (a(), l("div", {
2011
218
  "data-tauri-drag-region": "",
2012
219
  class: "flex h-8 px-4 py-1 bg-primary dark:bg-primary-dark rounded-t-corner-window justify-between align-center",
2013
220
  ref_key: "bar",
2014
- ref: e
221
+ ref: s
2015
222
  }, [
2016
- u("div", ye, [
2017
- u("img", {
2018
- src: o.image,
223
+ i("div", ce, [
224
+ i("img", {
225
+ src: d.image,
2019
226
  "data-tauri-drag-region": "",
2020
227
  class: "h-6 w-auto",
2021
- alt: o.title
2022
- }, null, 8, me)
228
+ alt: d.title
229
+ }, null, 8, de)
2023
230
  ]),
2024
- u("div", pe, g(o.title), 1),
2025
- u("div", fe, [
2026
- u("span", {
231
+ i("div", ue, m(d.title), 1),
232
+ i("div", me, [
233
+ i("span", {
2027
234
  class: "win-button",
2028
- onClick: h[0] || (h[0] = (v) => W(i).minimize())
235
+ onClick: o[0] || (o[0] = (g) => z(t).minimize())
2029
236
  }, [
2030
- u("img", {
2031
- src: l.value,
237
+ i("img", {
238
+ src: r.value,
2032
239
  class: "h-6 w-6 inline-block",
2033
240
  alt: "Minimize"
2034
- }, null, 8, ve)
241
+ }, null, 8, fe)
2035
242
  ]),
2036
- u("span", {
243
+ i("span", {
2037
244
  class: "win-button",
2038
- onClick: h[1] || (h[1] = (v) => W(i).toggleMaximize())
245
+ onClick: o[1] || (o[1] = (g) => z(t).toggleMaximize())
2039
246
  }, [
2040
- u("img", {
247
+ i("img", {
2041
248
  src: c.value,
2042
249
  class: "h-6 w-6 inline-block",
2043
250
  alt: "Maximize"
2044
- }, null, 8, _e)
251
+ }, null, 8, be)
2045
252
  ]),
2046
- u("span", {
253
+ i("span", {
2047
254
  class: "win-button",
2048
- onClick: h[2] || (h[2] = (v) => W(i).close())
255
+ onClick: o[2] || (o[2] = (g) => z(t).close())
2049
256
  }, [
2050
- u("img", {
2051
- src: a.value,
257
+ i("img", {
258
+ src: n.value,
2052
259
  class: "h-6 w-6 inline-block",
2053
260
  alt: "Close"
2054
- }, null, 8, ke)
261
+ }, null, 8, ge)
2055
262
  ])
2056
263
  ])
2057
264
  ], 512));
2058
265
  }
2059
- }), Ce = /* @__PURE__ */ m({
266
+ }), ve = /* @__PURE__ */ h({
2060
267
  __name: "WindowFrame",
2061
268
  props: {
2062
- title: {
2063
- type: String,
2064
- default: "Vasak"
2065
- },
2066
- image: {
2067
- type: String,
2068
- default: ""
2069
- }
269
+ title: { default: "Vasak" },
270
+ image: { default: "" }
2070
271
  },
2071
- setup(t) {
2072
- const e = t;
2073
- return (i, a) => (r(), s(F, null, [
2074
- Z(xe, {
2075
- title: e.title,
2076
- image: e.image
272
+ setup(e) {
273
+ const s = e;
274
+ return (t, n) => (a(), l($, null, [
275
+ W(he, {
276
+ title: s.title,
277
+ image: s.image
2077
278
  }, null, 8, ["title", "image"]),
2078
- k(i.$slots, "default")
279
+ y(t.$slots, "default")
2079
280
  ], 64));
2080
281
  }
2081
- }), Se = ["type", "disabled"], De = {
282
+ }), xe = ["type", "disabled"], ye = {
2082
283
  key: 0,
2083
284
  class: "w-4 h-4 animate-spin rounded-full border-2 border-current border-t-transparent"
2084
- }, ze = ["src", "alt"], Ie = { key: 2 }, Ae = ["src", "alt"], We = /* @__PURE__ */ m({
285
+ }, ke = ["src", "alt"], pe = { key: 2 }, we = ["src", "alt"], Ce = /* @__PURE__ */ h({
2085
286
  __name: "ActionButton",
2086
287
  props: {
2087
288
  label: {},
@@ -2099,8 +300,8 @@ const ye = { "data-tauri-drag-region": "" }, me = ["src", "alt"], pe = { "data-t
2099
300
  preventDefault: { type: Boolean, default: !1 }
2100
301
  },
2101
302
  emits: ["click"],
2102
- setup(t, { emit: e }) {
2103
- const i = t, a = e, l = {
303
+ setup(e, { emit: s }) {
304
+ const t = e, n = s, r = {
2104
305
  primary: "bg-primary dark:bg-primary-dark text-tx-on-primary dark:text-tx-on-primary-dark hover:bg-primary/90 dark:hover:bg-primary-dark/90",
2105
306
  secondary: "bg-secondary dark:bg-secondary-dark text-tx-on-primary dark:text-tx-on-primary-dark hover:bg-secondary/80 dark:hover:bg-secondary-dark/80",
2106
307
  danger: "bg-status-error dark:bg-status-error-dark text-tx-on-primary dark:text-tx-on-primary-dark hover:bg-status-error/90 dark:hover:bg-status-error-dark/90"
@@ -2108,65 +309,70 @@ const ye = { "data-tauri-drag-region": "" }, me = ["src", "alt"], pe = { "data-t
2108
309
  sm: "px-2 py-1 text-xs",
2109
310
  md: "px-3 py-1 text-sm",
2110
311
  lg: "px-4 py-2 text-base"
2111
- }, o = (p) => {
2112
- i.stopPropagation && p.stopPropagation(), i.preventDefault && p.preventDefault(), !i.disabled && !i.loading && a("click");
312
+ }, d = (f) => {
313
+ t.stopPropagation && f.stopPropagation(), t.preventDefault && f.preventDefault(), !t.disabled && !t.loading && n("click");
2113
314
  };
2114
- return (p, h) => (r(), s("button", {
2115
- type: i.type,
2116
- onClick: o,
2117
- class: d(["rounded-corner transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2", [
2118
- l[i.variant],
2119
- c[i.size],
2120
- i.fullWidth ? "w-full" : "",
2121
- i.iconSrc && !i.label ? "px-2 py-2" : "",
2122
- t.customClass
315
+ return (f, o) => (a(), l("button", {
316
+ type: t.type,
317
+ onClick: d,
318
+ class: b(["rounded-corner transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2", [
319
+ r[t.variant],
320
+ c[t.size],
321
+ t.fullWidth ? "w-full" : "",
322
+ t.iconSrc && !t.label ? "px-2 py-2" : "",
323
+ e.customClass
2123
324
  ]]),
2124
- disabled: i.disabled || i.loading
325
+ disabled: t.disabled || t.loading
2125
326
  }, [
2126
- t.loading ? (r(), s("span", De)) : w("", !0),
2127
- i.iconSrc && !i.iconRight ? (r(), s("img", {
327
+ e.loading ? (a(), l("span", ye)) : u("", !0),
328
+ t.iconSrc && !t.iconRight ? (a(), l("img", {
2128
329
  key: 1,
2129
- src: i.iconSrc,
2130
- alt: i.iconAlt || i.label,
330
+ src: t.iconSrc,
331
+ alt: t.iconAlt || t.label,
2131
332
  class: "w-4 h-4"
2132
- }, null, 8, ze)) : w("", !0),
2133
- i.label ? (r(), s("span", Ie, g(i.label), 1)) : w("", !0),
2134
- i.iconSrc && i.iconRight ? (r(), s("img", {
333
+ }, null, 8, ke)) : u("", !0),
334
+ t.label ? (a(), l("span", pe, m(t.label), 1)) : u("", !0),
335
+ t.iconSrc && t.iconRight ? (a(), l("img", {
2135
336
  key: 3,
2136
- src: i.iconSrc,
2137
- alt: i.iconAlt || i.label,
337
+ src: t.iconSrc,
338
+ alt: t.iconAlt || t.label,
2138
339
  class: "w-4 h-4"
2139
- }, null, 8, Ae)) : w("", !0)
2140
- ], 10, Se));
2141
- }
2142
- }), $e = /* @__PURE__ */ D(We, [["__scopeId", "data-v-2eaf6e27"]]), Oe = { class: "text-base font-semibold m-0 text-primary dark:text-primary-dark" }, Le = /* @__PURE__ */ m({
340
+ }, null, 8, we)) : u("", !0)
341
+ ], 10, xe));
342
+ }
343
+ }), B = (e, s) => {
344
+ const t = e.__vccOpts || e;
345
+ for (const [n, r] of s)
346
+ t[n] = r;
347
+ return t;
348
+ }, $e = /* @__PURE__ */ B(Ce, [["__scopeId", "data-v-2eaf6e27"]]), Be = { class: "text-base font-semibold m-0 text-primary dark:text-primary-dark" }, Se = /* @__PURE__ */ h({
2143
349
  __name: "ConfigSection",
2144
350
  props: {
2145
351
  title: {},
2146
352
  icon: { default: "" },
2147
353
  customClass: { default: () => ({}) }
2148
354
  },
2149
- setup(t) {
2150
- return (e, i) => (r(), s("div", {
2151
- class: d(["flex flex-col gap-4 p-4 background rounded-corner", t.customClass])
355
+ setup(e) {
356
+ return (s, t) => (a(), l("div", {
357
+ class: b(["flex flex-col gap-4 p-4 background rounded-corner", e.customClass])
2152
358
  }, [
2153
- u("h3", Oe, g(t.icon ? `${t.icon} ${t.title}` : t.title), 1),
2154
- k(e.$slots, "default", {}, void 0, !0)
359
+ i("h3", Be, m(e.icon ? `${e.icon} ${e.title}` : e.title), 1),
360
+ y(s.$slots, "default", {}, void 0, !0)
2155
361
  ], 2));
2156
362
  }
2157
- }), Be = /* @__PURE__ */ D(Le, [["__scopeId", "data-v-45bd4eab"]]), Te = { class: "flex items-center gap-3 flex-1 min-w-0" }, Re = ["src", "alt"], Ne = { class: "min-w-0" }, Ee = { class: "font-semibold truncate" }, Pe = {
363
+ }), ze = /* @__PURE__ */ B(Se, [["__scopeId", "data-v-45bd4eab"]]), Ie = { class: "flex items-center gap-3 flex-1 min-w-0" }, Le = ["src", "alt"], Te = { class: "min-w-0" }, je = { class: "font-semibold truncate" }, Ae = {
2158
364
  key: 0,
2159
365
  class: "text-xs text-gray-400 truncate"
2160
- }, Me = {
366
+ }, Ve = {
2161
367
  key: 1,
2162
368
  class: "text-xs text-gray-400 truncate"
2163
- }, Fe = {
369
+ }, Me = {
2164
370
  key: 2,
2165
371
  class: "text-xs text-gray-400 flex gap-2 mt-1"
2166
- }, Ve = {
372
+ }, Fe = {
2167
373
  key: 1,
2168
374
  class: "w-2 h-2 rounded-full bg-green-500"
2169
- }, Ue = /* @__PURE__ */ m({
375
+ }, De = /* @__PURE__ */ h({
2170
376
  __name: "DeviceCard",
2171
377
  props: {
2172
378
  icon: {},
@@ -2182,40 +388,40 @@ const ye = { "data-tauri-drag-region": "" }, me = ["src", "alt"], pe = { "data-t
2182
388
  clickable: { type: Boolean, default: !1 }
2183
389
  },
2184
390
  emits: ["action", "click"],
2185
- setup(t, { emit: e }) {
2186
- const i = e, a = () => {
2187
- i("action");
2188
- }, l = () => {
2189
- i("click");
391
+ setup(e, { emit: s }) {
392
+ const t = s, n = () => {
393
+ t("action");
394
+ }, r = () => {
395
+ t("click");
2190
396
  };
2191
- return (c, o) => (r(), s("div", {
2192
- class: d(["flex items-center justify-between background rounded-vsk px-6 py-3 mb-4", [{ "border-l-4 border-green-500": t.isConnected }, t.customClass]]),
2193
- onClick: l
397
+ return (c, d) => (a(), l("div", {
398
+ class: b(["flex items-center justify-between background rounded-vsk px-6 py-3 mb-4", [{ "border-l-4 border-green-500": e.isConnected }, e.customClass]]),
399
+ onClick: r
2194
400
  }, [
2195
- u("div", Te, [
2196
- u("img", {
2197
- src: t.icon,
2198
- alt: t.title,
401
+ i("div", Ie, [
402
+ i("img", {
403
+ src: e.icon,
404
+ alt: e.title,
2199
405
  class: "h-7 w-7 shrink-0"
2200
- }, null, 8, Re),
2201
- u("div", Ne, [
2202
- u("div", Ee, g(t.title), 1),
2203
- t.subtitle ? (r(), s("div", Pe, g(t.subtitle), 1)) : w("", !0),
2204
- t.metadata ? (r(), s("div", Me, g(t.metadata), 1)) : w("", !0),
2205
- t.extraInfo && t.extraInfo.length > 0 ? (r(), s("div", Fe, [
2206
- (r(!0), s(F, null, Q(t.extraInfo, (p, h) => (r(), s("span", { key: h }, g(p), 1))), 128))
2207
- ])) : w("", !0)
406
+ }, null, 8, Le),
407
+ i("div", Te, [
408
+ i("div", je, m(e.title), 1),
409
+ e.subtitle ? (a(), l("div", Ae, m(e.subtitle), 1)) : u("", !0),
410
+ e.metadata ? (a(), l("div", Ve, m(e.metadata), 1)) : u("", !0),
411
+ e.extraInfo && e.extraInfo.length > 0 ? (a(), l("div", Me, [
412
+ (a(!0), l($, null, I(e.extraInfo, (f, o) => (a(), l("span", { key: o }, m(f), 1))), 128))
413
+ ])) : u("", !0)
2208
414
  ])
2209
415
  ]),
2210
- t.showActionButton ? (r(), s("button", {
416
+ e.showActionButton ? (a(), l("button", {
2211
417
  key: 0,
2212
418
  class: "bg-vsk-primary rounded-vsk px-4 py-2 text-sm font-semibold cursor-pointer hover:opacity-70",
2213
- onClick: Y(a, ["stop"])
2214
- }, g(t.actionLabel), 1)) : w("", !0),
2215
- t.showStatusIndicator && t.isConnected ? (r(), s("div", Ve)) : w("", !0)
419
+ onClick: G(n, ["stop"])
420
+ }, m(e.actionLabel), 1)) : u("", !0),
421
+ e.showStatusIndicator && e.isConnected ? (a(), l("div", Fe)) : u("", !0)
2216
422
  ], 2));
2217
423
  }
2218
- }), Ge = ["for"], He = /* @__PURE__ */ m({
424
+ }), Ee = ["for"], Oe = /* @__PURE__ */ h({
2219
425
  __name: "FormGroup",
2220
426
  props: {
2221
427
  label: {},
@@ -2223,46 +429,46 @@ const ye = { "data-tauri-drag-region": "" }, me = ["src", "alt"], pe = { "data-t
2223
429
  customClass: { default: () => ({}) },
2224
430
  labelClass: { default: () => ({}) }
2225
431
  },
2226
- setup(t) {
2227
- return (e, i) => (r(), s("div", {
2228
- class: d(["flex flex-col gap-2", t.customClass])
432
+ setup(e) {
433
+ return (s, t) => (a(), l("div", {
434
+ class: b(["flex flex-col gap-2", e.customClass])
2229
435
  }, [
2230
- t.label ? (r(), s("label", {
436
+ e.label ? (a(), l("label", {
2231
437
  key: 0,
2232
- for: t.htmlFor,
2233
- class: d(["text-sm font-medium text-primary dark:text-primary-dark", t.labelClass])
2234
- }, g(t.label), 11, Ge)) : w("", !0),
2235
- k(e.$slots, "default", {}, void 0, !0)
438
+ for: e.htmlFor,
439
+ class: b(["text-sm font-medium text-primary dark:text-primary-dark", e.labelClass])
440
+ }, m(e.label), 11, Ee)) : u("", !0),
441
+ y(s.$slots, "default", {}, void 0, !0)
2236
442
  ], 2));
2237
443
  }
2238
- }), je = /* @__PURE__ */ D(He, [["__scopeId", "data-v-c0d9d9cb"]]), Je = /* @__PURE__ */ m({
444
+ }), Pe = /* @__PURE__ */ B(Oe, [["__scopeId", "data-v-c0d9d9cb"]]), We = /* @__PURE__ */ h({
2239
445
  __name: "ListCard",
2240
446
  props: {
2241
447
  clickable: { type: Boolean, default: !1 },
2242
448
  customClass: { default: () => ({}) }
2243
449
  },
2244
450
  emits: ["click"],
2245
- setup(t, { emit: e }) {
2246
- const i = t, a = e, l = () => {
2247
- i.clickable && a("click");
451
+ setup(e, { emit: s }) {
452
+ const t = e, n = s, r = () => {
453
+ t.clickable && n("click");
2248
454
  };
2249
- return (c, o) => (r(), s("div", {
2250
- class: d([
455
+ return (c, d) => (a(), l("div", {
456
+ class: b([
2251
457
  "flex items-center justify-between background p-3 rounded-vsk border border-vsk-primary/70 transition-colors duration-200",
2252
458
  {
2253
- "hover:bg-vsk-primary/5 cursor-pointer": i.clickable
459
+ "hover:bg-vsk-primary/5 cursor-pointer": t.clickable
2254
460
  },
2255
- t.customClass
461
+ e.customClass
2256
462
  ]),
2257
- onClick: l
463
+ onClick: r
2258
464
  }, [
2259
- k(c.$slots, "default", {}, void 0, !0)
465
+ y(c.$slots, "default", {}, void 0, !0)
2260
466
  ], 2));
2261
467
  }
2262
- }), qe = /* @__PURE__ */ D(Je, [["__scopeId", "data-v-f86d47da"]]), Ze = { class: "background rounded-corner flex flex-row items-center gap-2 justify-between w-full h-auto p-4 transition-all duration-200 hover:bg-ui-surface/80 dark:hover:bg-ui-surface-dark/80" }, Qe = ["src", "alt", "title"], Ye = {
468
+ }), Ge = /* @__PURE__ */ B(We, [["__scopeId", "data-v-f86d47da"]]), Ne = { class: "background rounded-corner flex flex-row items-center gap-2 justify-between w-full h-auto p-4 transition-all duration-200 hover:bg-ui-surface/80 dark:hover:bg-ui-surface-dark/80" }, Re = ["src", "alt", "title"], Ue = {
2263
469
  key: 1,
2264
470
  class: "w-8 h-8 flex items-center justify-center"
2265
- }, Ke = ["src", "alt"], Xe = ["min", "max", "value"], et = /* @__PURE__ */ m({
471
+ }, qe = ["src", "alt"], He = ["min", "max", "value"], Je = /* @__PURE__ */ h({
2266
472
  __name: "SliderControl",
2267
473
  props: {
2268
474
  icon: {},
@@ -2276,50 +482,50 @@ const ye = { "data-tauri-drag-region": "" }, me = ["src", "alt"], pe = { "data-t
2276
482
  getPercentageClass: { type: Function, default: () => "" }
2277
483
  },
2278
484
  emits: ["update:modelValue", "buttonClick"],
2279
- setup(t, { emit: e }) {
2280
- const i = t, a = e, l = T(() => {
2281
- if (i.max <= i.min) return 0;
2282
- const h = i.max - i.min, v = i.modelValue - i.min;
2283
- return Math.round(v / h * 100);
2284
- }), c = T(() => i.getPercentageClass ? i.getPercentageClass(l.value) : ""), o = (h) => {
2285
- const v = h.target;
2286
- a("update:modelValue", Number(v.value));
2287
- }, p = () => {
2288
- a("buttonClick");
485
+ setup(e, { emit: s }) {
486
+ const t = e, n = s, r = w(() => {
487
+ if (t.max <= t.min) return 0;
488
+ const o = t.max - t.min, g = t.modelValue - t.min;
489
+ return Math.round(g / o * 100);
490
+ }), c = w(() => t.getPercentageClass ? t.getPercentageClass(r.value) : ""), d = (o) => {
491
+ const g = o.target;
492
+ n("update:modelValue", Number(g.value));
493
+ }, f = () => {
494
+ n("buttonClick");
2289
495
  };
2290
- return (h, v) => (r(), s("div", Ze, [
2291
- t.showButton ? (r(), s("button", {
496
+ return (o, g) => (a(), l("div", Ne, [
497
+ e.showButton ? (a(), l("button", {
2292
498
  key: 0,
2293
- onClick: p,
499
+ onClick: f,
2294
500
  class: "w-8 h-8 flex items-center justify-center rounded-corner transition-all duration-200 hover:bg-ui-surface/80 dark:hover:bg-ui-surface-dark/80 hover:scale-110 active:scale-95"
2295
501
  }, [
2296
- u("img", {
2297
- src: t.icon,
2298
- alt: t.alt,
2299
- title: t.tooltip,
2300
- class: d(["w-6 h-6 transition-all duration-200", t.iconClass])
2301
- }, null, 10, Qe)
2302
- ])) : (r(), s("div", Ye, [
2303
- u("img", {
2304
- src: t.icon,
2305
- alt: t.alt,
502
+ i("img", {
503
+ src: e.icon,
504
+ alt: e.alt,
505
+ title: e.tooltip,
506
+ class: b(["w-6 h-6 transition-all duration-200", e.iconClass])
507
+ }, null, 10, Re)
508
+ ])) : (a(), l("div", Ue, [
509
+ i("img", {
510
+ src: e.icon,
511
+ alt: e.alt,
2306
512
  class: "w-6 h-6 transition-all duration-200"
2307
- }, null, 8, Ke)
513
+ }, null, 8, qe)
2308
514
  ])),
2309
- u("input", {
515
+ i("input", {
2310
516
  type: "range",
2311
- min: t.min,
2312
- max: t.max,
2313
- value: t.modelValue,
2314
- onInput: o,
517
+ min: e.min,
518
+ max: e.max,
519
+ value: e.modelValue,
520
+ onInput: d,
2315
521
  class: "flex-1 transition-all duration-200 hover:scale-105"
2316
- }, null, 40, Xe),
2317
- u("span", {
2318
- class: d(["w-12 text-right transition-all duration-200 font-medium", c.value])
2319
- }, g(l.value) + "% ", 3)
522
+ }, null, 40, He),
523
+ i("span", {
524
+ class: b(["w-12 text-right transition-all duration-200 font-medium", c.value])
525
+ }, m(r.value) + "% ", 3)
2320
526
  ]));
2321
527
  }
2322
- }), tt = ["disabled"], it = /* @__PURE__ */ m({
528
+ }), Ke = ["disabled"], Qe = /* @__PURE__ */ h({
2323
529
  __name: "SwitchToggle",
2324
530
  props: {
2325
531
  isOn: { type: Boolean },
@@ -2330,32 +536,32 @@ const ye = { "data-tauri-drag-region": "" }, me = ["src", "alt"], pe = { "data-t
2330
536
  customClass: { default: "" }
2331
537
  },
2332
538
  emits: ["toggle"],
2333
- setup(t, { emit: e }) {
2334
- const i = t, a = e, l = () => {
2335
- a("toggle", !i.isOn);
539
+ setup(e, { emit: s }) {
540
+ const t = e, n = s, r = () => {
541
+ n("toggle", !t.isOn);
2336
542
  };
2337
- return (c, o) => (r(), s("button", {
543
+ return (c, d) => (a(), l("button", {
2338
544
  type: "button",
2339
- onClick: l,
2340
- disabled: t.disabled,
2341
- class: d([
545
+ onClick: r,
546
+ disabled: e.disabled,
547
+ class: b([
2342
548
  "relative inline-flex items-center rounded-full transition-colors",
2343
- t.size === "small" ? "h-6 w-11" : "h-7 w-12",
2344
- t.isOn ? t.activeClass : t.inactiveClass,
2345
- t.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer",
2346
- t.customClass
549
+ e.size === "small" ? "h-6 w-11" : "h-7 w-12",
550
+ e.isOn ? e.activeClass : e.inactiveClass,
551
+ e.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer",
552
+ e.customClass
2347
553
  ])
2348
554
  }, [
2349
- u("span", {
2350
- class: d([
555
+ i("span", {
556
+ class: b([
2351
557
  "inline-block transform rounded-full bg-white shadow transition-transform",
2352
- t.size === "small" ? "h-4 w-4" : "h-6 w-6",
2353
- t.isOn ? t.size === "small" ? "translate-x-6" : "translate-x-5" : "translate-x-1"
558
+ e.size === "small" ? "h-4 w-4" : "h-6 w-6",
559
+ e.isOn ? e.size === "small" ? "translate-x-6" : "translate-x-5" : "translate-x-1"
2354
560
  ])
2355
561
  }, null, 2)
2356
- ], 10, tt));
562
+ ], 10, Ke));
2357
563
  }
2358
- }), nt = ["disabled"], at = ["src", "alt", "title"], lt = /* @__PURE__ */ m({
564
+ }), Xe = ["disabled"], Ye = ["src", "alt", "title"], Ze = /* @__PURE__ */ h({
2359
565
  __name: "ToggleControl",
2360
566
  props: {
2361
567
  icon: {},
@@ -2367,37 +573,37 @@ const ye = { "data-tauri-drag-region": "" }, me = ["src", "alt"], pe = { "data-t
2367
573
  customClass: { default: () => ({}) }
2368
574
  },
2369
575
  emits: ["click"],
2370
- setup(t, { emit: e }) {
2371
- const i = e, a = () => {
2372
- i("click");
576
+ setup(e, { emit: s }) {
577
+ const t = s, n = () => {
578
+ t("click");
2373
579
  };
2374
- return (l, c) => (r(), s("button", {
2375
- onClick: a,
2376
- class: d(["p-2 rounded-corner background hover:opacity-50 transition-all duration-300 h-17.5 w-17.5 group relative overflow-hidden hover:scale-105 hover:shadow-lg active:scale-95", {
2377
- "animate-pulse": t.isLoading,
2378
- "ring-2 ring-primary dark:ring-primary-dark": t.isActive,
2379
- "opacity-60": !t.isActive,
2380
- ...t.customClass
580
+ return (r, c) => (a(), l("button", {
581
+ onClick: n,
582
+ class: b(["p-2 rounded-corner background hover:opacity-50 transition-all duration-300 h-17.5 w-17.5 group relative overflow-hidden hover:scale-105 hover:shadow-lg active:scale-95", {
583
+ "animate-pulse": e.isLoading,
584
+ "ring-2 ring-primary dark:ring-primary-dark": e.isActive,
585
+ "opacity-60": !e.isActive,
586
+ ...e.customClass
2381
587
  }]),
2382
- disabled: t.isLoading
588
+ disabled: e.isLoading
2383
589
  }, [
2384
- u("img", {
2385
- src: t.icon,
2386
- alt: t.alt,
2387
- title: t.tooltip,
2388
- class: d(["m-auto w-12.5 h-12.5 transition-all duration-300 group-hover:scale-110 relative z-10", {
2389
- "animate-spin": t.isLoading,
2390
- "filter brightness-75": !t.isActive,
2391
- "drop-shadow-lg": t.isActive,
2392
- ...t.iconClass
590
+ i("img", {
591
+ src: e.icon,
592
+ alt: e.alt,
593
+ title: e.tooltip,
594
+ class: b(["m-auto w-12.5 h-12.5 transition-all duration-300 group-hover:scale-110 relative z-10", {
595
+ "animate-spin": e.isLoading,
596
+ "filter brightness-75": !e.isActive,
597
+ "drop-shadow-lg": e.isActive,
598
+ ...e.iconClass
2393
599
  }])
2394
- }, null, 10, at)
2395
- ], 10, nt));
600
+ }, null, 10, Ye)
601
+ ], 10, Xe));
2396
602
  }
2397
- }), st = ["title"], rt = ["src", "alt"], ot = {
603
+ }), _e = ["title"], et = ["src", "alt"], tt = {
2398
604
  key: 0,
2399
605
  class: "absolute bottom-1 right-1 bg-primary dark:bg-primary-dark text-white text-xs rounded-full w-4 h-4 flex items-center justify-center font-bold animate-bounce"
2400
- }, ut = /* @__PURE__ */ m({
606
+ }, at = /* @__PURE__ */ h({
2401
607
  __name: "TrayIconButton",
2402
608
  props: {
2403
609
  icon: {},
@@ -2411,68 +617,70 @@ const ye = { "data-tauri-drag-region": "" }, me = ["src", "alt"], pe = { "data-t
2411
617
  customTooltipText: { default: "" }
2412
618
  },
2413
619
  emits: ["click"],
2414
- setup(t, { emit: e }) {
2415
- const i = e, a = x(!1), l = () => {
2416
- i("click");
620
+ setup(e, { emit: s }) {
621
+ const t = s, n = x(!1), r = () => {
622
+ t("click");
2417
623
  };
2418
- return (c, o) => (r(), s("div", {
2419
- class: d(["p-1 rounded-corner relative hover:bg-primary dark:hover:bg-primary-dark group transition-all duration-300", t.customClass]),
2420
- title: t.tooltip,
2421
- onClick: l,
2422
- onMouseenter: o[0] || (o[0] = (p) => a.value = !0),
2423
- onMouseleave: o[1] || (o[1] = (p) => a.value = !1)
624
+ return (c, d) => (a(), l("div", {
625
+ class: b(["p-1 rounded-corner relative hover:bg-primary dark:hover:bg-primary-dark group transition-all duration-300", e.customClass]),
626
+ title: e.tooltip,
627
+ onClick: r,
628
+ onMouseenter: d[0] || (d[0] = (f) => n.value = !0),
629
+ onMouseleave: d[1] || (d[1] = (f) => n.value = !1)
2424
630
  }, [
2425
- u("img", {
2426
- src: t.icon,
2427
- alt: t.alt,
2428
- class: d(["m-auto h-5.5 w-auto transition-all duration-300", t.iconClass])
2429
- }, null, 10, rt),
2430
- t.badge !== null && t.badge > 0 ? (r(), s("div", ot, g(t.badge), 1)) : w("", !0),
2431
- t.showCustomTooltip && t.customTooltipText ? (r(), s("div", {
631
+ i("img", {
632
+ src: e.icon,
633
+ alt: e.alt,
634
+ class: b(["m-auto h-5.5 w-auto transition-all duration-300", e.iconClass])
635
+ }, null, 10, et),
636
+ e.badge !== null && e.badge > 0 ? (a(), l("div", tt, m(e.badge), 1)) : u("", !0),
637
+ e.showCustomTooltip && e.customTooltipText ? (a(), l("div", {
2432
638
  key: 1,
2433
- class: d(["absolute top-1 left-1/2 transform -translate-x-1/2 text-xs font-semibold p-1 rounded-corner transition-all duration-300 pointer-events-none background", [
2434
- t.tooltipClass,
639
+ class: b(["absolute top-1 left-1/2 transform -translate-x-1/2 text-xs font-semibold p-1 rounded-corner transition-all duration-300 pointer-events-none background", [
640
+ e.tooltipClass,
2435
641
  {
2436
- "opacity-0 -translate-y-2": !a.value,
2437
- "opacity-100 translate-y-0": a.value
642
+ "opacity-0 -translate-y-2": !n.value,
643
+ "opacity-100 translate-y-0": n.value
2438
644
  }
2439
645
  ]])
2440
- }, g(t.customTooltipText), 3)) : w("", !0),
2441
- k(c.$slots, "default")
2442
- ], 42, st));
2443
- }
2444
- }), ct = [
2445
- te,
2446
- ae,
2447
- Ce,
646
+ }, m(e.customTooltipText), 3)) : u("", !0),
647
+ y(c.$slots, "default")
648
+ ], 42, _e));
649
+ }
650
+ }), lt = [
651
+ re,
652
+ M,
653
+ V,
654
+ ve,
2448
655
  $e,
2449
- Be,
2450
- Ue,
2451
- je,
2452
- qe,
2453
- et,
2454
- it,
2455
- lt,
2456
- ut
2457
- ], ht = {
2458
- install(t) {
2459
- ct.forEach((e) => {
2460
- t.component(e.name, e);
656
+ ze,
657
+ De,
658
+ Pe,
659
+ Ge,
660
+ Je,
661
+ Qe,
662
+ Ze,
663
+ at
664
+ ], dt = {
665
+ install(e) {
666
+ lt.forEach((s) => {
667
+ e.component(s.name, s);
2461
668
  });
2462
669
  }
2463
670
  };
2464
671
  export {
2465
672
  $e as ActionButton,
2466
- Be as ConfigSection,
2467
- Ue as DeviceCard,
2468
- je as FormGroup,
2469
- qe as ListCard,
2470
- te as SideBar,
2471
- ae as SideButton,
2472
- et as SliderControl,
2473
- it as SwitchToggle,
2474
- lt as ToggleControl,
2475
- ut as TrayIconButton,
2476
- Ce as WindowFrame,
2477
- ht as default
673
+ ze as ConfigSection,
674
+ De as DeviceCard,
675
+ Pe as FormGroup,
676
+ Ge as ListCard,
677
+ re as SideBar,
678
+ M as SideButton,
679
+ V as SideGroup,
680
+ Je as SliderControl,
681
+ Qe as SwitchToggle,
682
+ Ze as ToggleControl,
683
+ at as TrayIconButton,
684
+ ve as WindowFrame,
685
+ dt as default
2478
686
  };