@vasakgroup/vue-libvasak 0.0.3 → 0.2.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.
@@ -0,0 +1,2477 @@
1
+ import { createElementBlock as s, openBlock as o, renderSlot as k, defineComponent as y, createElementVNode as u, ref as x, onMounted as q, toDisplayString as w, unref as W, Fragment as F, createVNode as Z, normalizeClass as d, createCommentVNode as g, 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 [l, a] of e)
5
+ i[l] = a;
6
+ return i;
7
+ }, K = {}, X = { class: "sidebar" };
8
+ function ee(t, e) {
9
+ return o(), 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"], le = /* @__PURE__ */ y({
17
+ __name: "SideButton",
18
+ props: {
19
+ title: {
20
+ type: String,
21
+ default: "Link"
22
+ },
23
+ image: {
24
+ type: String,
25
+ default: ""
26
+ }
27
+ },
28
+ setup(t) {
29
+ return (e, i) => (o(), 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 ae(t, e, i, l) {
39
+ if (typeof e == "function" ? t !== e || !l : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
40
+ return i === "m" ? l : i === "a" ? l.call(t) : l ? l.value : e.get(t);
41
+ }
42
+ function se(t, e, i, l, a) {
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 m = "__TAURI_TO_IPC_KEY__";
48
+ function oe(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 re {
55
+ get rid() {
56
+ return ae(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
+ [m]() {
95
+ return {
96
+ width: this.width,
97
+ height: this.height
98
+ };
99
+ }
100
+ toJSON() {
101
+ return this[m]();
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
+ [m]() {
123
+ return {
124
+ width: this.width,
125
+ height: this.height
126
+ };
127
+ }
128
+ toJSON() {
129
+ return this[m]();
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
+ [m]() {
143
+ return {
144
+ [`${this.size.type}`]: {
145
+ width: this.size.width,
146
+ height: this.size.height
147
+ }
148
+ };
149
+ }
150
+ toJSON() {
151
+ return this[m]();
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 p(this.x * e, this.y * e);
175
+ }
176
+ [m]() {
177
+ return {
178
+ x: this.x,
179
+ y: this.y
180
+ };
181
+ }
182
+ toJSON() {
183
+ return this[m]();
184
+ }
185
+ }
186
+ class p {
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
+ [m]() {
209
+ return {
210
+ x: this.x,
211
+ y: this.y
212
+ };
213
+ }
214
+ toJSON() {
215
+ return this[m]();
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 p ? this.position : this.position.toPhysical(e);
227
+ }
228
+ [m]() {
229
+ return {
230
+ [`${this.position.type}`]: {
231
+ x: this.position.x,
232
+ y: this.position.y
233
+ }
234
+ };
235
+ }
236
+ toJSON() {
237
+ return this[m]();
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 l;
252
+ const a = typeof i?.target == "string" ? { kind: "AnyLabel", label: i.target } : (l = i?.target) !== null && l !== void 0 ? l : { kind: "Any" };
253
+ return n("plugin:event|listen", {
254
+ event: t,
255
+ target: a,
256
+ handler: oe(e)
257
+ }).then((c) => async () => G(t, c));
258
+ }
259
+ async function ue(t, e, i) {
260
+ return H(t, (l) => {
261
+ G(t, l.id), e(l);
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 re {
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, l) {
288
+ return n("plugin:image|new", {
289
+ rgba: A(e),
290
+ width: i,
291
+ height: l
292
+ }).then((a) => new S(a));
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 l;
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 : (l = i.parent) === null || l === void 0 ? void 0 : l.label,
397
+ label: e
398
+ }
399
+ }).then(async () => this.emit("tauri://created")).catch(async (a) => this.emit("tauri://error", a));
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((l) => l.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 l = this.listeners[e];
466
+ l.splice(l.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 l = this.listeners[e];
493
+ l.splice(l.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 l of this.listeners[e] || [])
512
+ l({
513
+ event: e,
514
+ id: -1,
515
+ payload: i
516
+ });
517
+ return;
518
+ }
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, l) {
534
+ if (O.includes(i)) {
535
+ for (const a of this.listeners[i] || [])
536
+ a({
537
+ event: i,
538
+ id: -1,
539
+ payload: l
540
+ });
541
+ return;
542
+ }
543
+ return de(e, i, l);
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 p(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 p(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(l) {
1326
+ return l ? { Logical: l } : null;
1327
+ }
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)
1335
+ }
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 p(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 l = new he(i);
1821
+ await e(l), l.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, (r) => {
1851
+ e({
1852
+ ...r,
1853
+ payload: {
1854
+ type: "enter",
1855
+ paths: r.payload.paths,
1856
+ position: new p(r.payload.position)
1857
+ }
1858
+ });
1859
+ }), l = await this.listen(b.DRAG_OVER, (r) => {
1860
+ e({
1861
+ ...r,
1862
+ payload: {
1863
+ type: "over",
1864
+ position: new p(r.payload.position)
1865
+ }
1866
+ });
1867
+ }), a = await this.listen(b.DRAG_DROP, (r) => {
1868
+ e({
1869
+ ...r,
1870
+ payload: {
1871
+ type: "drop",
1872
+ paths: r.payload.paths,
1873
+ position: new p(r.payload.position)
1874
+ }
1875
+ });
1876
+ }), c = await this.listen(b.DRAG_LEAVE, (r) => {
1877
+ e({ ...r, payload: { type: "leave" } });
1878
+ });
1879
+ return () => {
1880
+ i(), a(), l(), 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, (a) => {
1902
+ e({ ...a, payload: !0 });
1903
+ }), l = await this.listen(b.WINDOW_BLUR, (a) => {
1904
+ e({ ...a, payload: !1 });
1905
+ });
1906
+ return () => {
1907
+ i(), l();
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 we(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 ge(t) {
1983
+ try {
1984
+ const e = atob(t.substring(0, 32)), i = new Uint8Array(e.length);
1985
+ for (let l = 0; l < e.length; l++)
1986
+ i[l] = e.charCodeAt(l);
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 we(t);
1995
+ return `data:${ge(e)};base64,${e}`;
1996
+ } catch (e) {
1997
+ return console.error("[Icon Error] Error obteniendo icono:", e), "";
1998
+ }
1999
+ }
2000
+ const me = { "data-tauri-drag-region": "" }, ye = ["src"], fe = { "data-tauri-drag-region": "" }, pe = { "data-tauri-drag-region": "" }, ve = ["src"], _e = ["src"], ke = ["src"], xe = /* @__PURE__ */ y({
2001
+ __name: "TopBar",
2002
+ props: {
2003
+ title: String,
2004
+ image: String
2005
+ },
2006
+ setup(t) {
2007
+ const e = x(null), i = j(), l = x(""), a = x(""), c = x(""), r = t;
2008
+ return q(async () => {
2009
+ l.value = await L("window-close"), a.value = await L("window-minimize"), c.value = await L("window-maximize");
2010
+ }), (f, h) => (o(), s("div", {
2011
+ "data-tauri-drag-region": "",
2012
+ class: "flex h-8 px-4 py-1 bg-vsk-primary rounded-t-window justify-between align-center",
2013
+ ref_key: "bar",
2014
+ ref: e
2015
+ }, [
2016
+ u("div", me, [
2017
+ u("img", {
2018
+ src: r.image,
2019
+ "data-tauri-drag-region": "",
2020
+ class: "h-6 w-auto"
2021
+ }, null, 8, ye)
2022
+ ]),
2023
+ u("div", fe, w(r.title), 1),
2024
+ u("div", pe, [
2025
+ u("span", {
2026
+ class: "win-button",
2027
+ onClick: h[0] || (h[0] = (v) => W(i).minimize())
2028
+ }, [
2029
+ u("img", {
2030
+ src: a.value,
2031
+ class: "h-6 w-6 inline-block",
2032
+ alt: "Minimize"
2033
+ }, null, 8, ve)
2034
+ ]),
2035
+ u("span", {
2036
+ class: "win-button",
2037
+ onClick: h[1] || (h[1] = (v) => W(i).toggleMaximize())
2038
+ }, [
2039
+ u("img", {
2040
+ src: c.value,
2041
+ class: "h-6 w-6 inline-block",
2042
+ alt: "Maximize"
2043
+ }, null, 8, _e)
2044
+ ]),
2045
+ u("span", {
2046
+ class: "win-button",
2047
+ onClick: h[2] || (h[2] = (v) => W(i).close())
2048
+ }, [
2049
+ u("img", {
2050
+ src: l.value,
2051
+ class: "h-6 w-6 inline-block",
2052
+ alt: "Close"
2053
+ }, null, 8, ke)
2054
+ ])
2055
+ ])
2056
+ ], 512));
2057
+ }
2058
+ }), Ce = /* @__PURE__ */ y({
2059
+ __name: "WindowFrame",
2060
+ props: {
2061
+ title: {
2062
+ type: String,
2063
+ default: "Vasak"
2064
+ },
2065
+ image: {
2066
+ type: String,
2067
+ default: ""
2068
+ }
2069
+ },
2070
+ setup(t) {
2071
+ const e = t;
2072
+ return (i, l) => (o(), s(F, null, [
2073
+ Z(xe, {
2074
+ title: e.title,
2075
+ image: e.image
2076
+ }, null, 8, ["title", "image"]),
2077
+ k(i.$slots, "default")
2078
+ ], 64));
2079
+ }
2080
+ }), Se = ["type", "disabled"], De = {
2081
+ key: 0,
2082
+ class: "w-4 h-4 animate-spin rounded-full border-2 border-current border-t-transparent"
2083
+ }, ze = ["src", "alt"], Ie = { key: 2 }, Ae = ["src", "alt"], We = /* @__PURE__ */ y({
2084
+ __name: "ActionButton",
2085
+ props: {
2086
+ label: {},
2087
+ disabled: { type: Boolean, default: !1 },
2088
+ variant: { default: "primary" },
2089
+ loading: { type: Boolean, default: !1 },
2090
+ customClass: { default: () => ({}) },
2091
+ size: { default: "md" },
2092
+ fullWidth: { type: Boolean, default: !1 },
2093
+ iconSrc: { default: "" },
2094
+ iconAlt: { default: "" },
2095
+ iconRight: { type: Boolean, default: !1 },
2096
+ type: { default: "button" },
2097
+ stopPropagation: { type: Boolean, default: !1 },
2098
+ preventDefault: { type: Boolean, default: !1 }
2099
+ },
2100
+ emits: ["click"],
2101
+ setup(t, { emit: e }) {
2102
+ const i = t, l = e, a = {
2103
+ primary: "bg-vsk-primary text-white hover:bg-vsk-primary/90",
2104
+ secondary: "bg-vsk-border text-vsk-text hover:bg-vsk-border/80",
2105
+ danger: "bg-red-600 text-white hover:bg-red-700"
2106
+ }, c = {
2107
+ sm: "px-2 py-1 text-xs",
2108
+ md: "px-3 py-1 text-sm",
2109
+ lg: "px-4 py-2 text-base"
2110
+ }, r = (f) => {
2111
+ i.stopPropagation && f.stopPropagation(), i.preventDefault && f.preventDefault(), !i.disabled && !i.loading && l("click");
2112
+ };
2113
+ return (f, h) => (o(), s("button", {
2114
+ type: i.type,
2115
+ onClick: r,
2116
+ class: d(["rounded-vsk transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2", [
2117
+ a[i.variant],
2118
+ c[i.size],
2119
+ i.fullWidth ? "w-full" : "",
2120
+ i.iconSrc && !i.label ? "px-2 py-2" : "",
2121
+ t.customClass
2122
+ ]]),
2123
+ disabled: i.disabled || i.loading
2124
+ }, [
2125
+ t.loading ? (o(), s("span", De)) : g("", !0),
2126
+ i.iconSrc && !i.iconRight ? (o(), s("img", {
2127
+ key: 1,
2128
+ src: i.iconSrc,
2129
+ alt: i.iconAlt || i.label,
2130
+ class: "w-4 h-4"
2131
+ }, null, 8, ze)) : g("", !0),
2132
+ i.label ? (o(), s("span", Ie, w(i.label), 1)) : g("", !0),
2133
+ i.iconSrc && i.iconRight ? (o(), s("img", {
2134
+ key: 3,
2135
+ src: i.iconSrc,
2136
+ alt: i.iconAlt || i.label,
2137
+ class: "w-4 h-4"
2138
+ }, null, 8, Ae)) : g("", !0)
2139
+ ], 10, Se));
2140
+ }
2141
+ }), $e = /* @__PURE__ */ D(We, [["__scopeId", "data-v-d1ce8923"]]), Oe = { class: "text-base font-semibold m-0 text-vsk-primary" }, Le = /* @__PURE__ */ y({
2142
+ __name: "ConfigSection",
2143
+ props: {
2144
+ title: {},
2145
+ icon: { default: "" },
2146
+ customClass: { default: () => ({}) }
2147
+ },
2148
+ setup(t) {
2149
+ return (e, i) => (o(), s("div", {
2150
+ class: d(["flex flex-col gap-4 p-4 background rounded-vsk", t.customClass])
2151
+ }, [
2152
+ u("h3", Oe, w(t.icon ? `${t.icon} ${t.title}` : t.title), 1),
2153
+ k(e.$slots, "default", {}, void 0, !0)
2154
+ ], 2));
2155
+ }
2156
+ }), Be = /* @__PURE__ */ D(Le, [["__scopeId", "data-v-89531d08"]]), 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 = {
2157
+ key: 0,
2158
+ class: "text-xs text-gray-400 truncate"
2159
+ }, Me = {
2160
+ key: 1,
2161
+ class: "text-xs text-gray-400 truncate"
2162
+ }, Fe = {
2163
+ key: 2,
2164
+ class: "text-xs text-gray-400 flex gap-2 mt-1"
2165
+ }, Ve = {
2166
+ key: 1,
2167
+ class: "w-2 h-2 rounded-full bg-green-500"
2168
+ }, Ue = /* @__PURE__ */ y({
2169
+ __name: "DeviceCard",
2170
+ props: {
2171
+ icon: {},
2172
+ title: {},
2173
+ subtitle: { default: "" },
2174
+ metadata: { default: "" },
2175
+ extraInfo: { default: () => [] },
2176
+ isConnected: { type: Boolean, default: !1 },
2177
+ showActionButton: { type: Boolean, default: !0 },
2178
+ actionLabel: { default: "Conectar" },
2179
+ showStatusIndicator: { type: Boolean, default: !1 },
2180
+ customClass: { default: "" },
2181
+ clickable: { type: Boolean, default: !1 }
2182
+ },
2183
+ emits: ["action", "click"],
2184
+ setup(t, { emit: e }) {
2185
+ const i = e, l = () => {
2186
+ i("action");
2187
+ }, a = () => {
2188
+ i("click");
2189
+ };
2190
+ return (c, r) => (o(), s("div", {
2191
+ 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]]),
2192
+ onClick: a
2193
+ }, [
2194
+ u("div", Te, [
2195
+ u("img", {
2196
+ src: t.icon,
2197
+ alt: t.title,
2198
+ class: "h-7 w-7 shrink-0"
2199
+ }, null, 8, Re),
2200
+ u("div", Ne, [
2201
+ u("div", Ee, w(t.title), 1),
2202
+ t.subtitle ? (o(), s("div", Pe, w(t.subtitle), 1)) : g("", !0),
2203
+ t.metadata ? (o(), s("div", Me, w(t.metadata), 1)) : g("", !0),
2204
+ t.extraInfo && t.extraInfo.length > 0 ? (o(), s("div", Fe, [
2205
+ (o(!0), s(F, null, Q(t.extraInfo, (f, h) => (o(), s("span", { key: h }, w(f), 1))), 128))
2206
+ ])) : g("", !0)
2207
+ ])
2208
+ ]),
2209
+ t.showActionButton ? (o(), s("button", {
2210
+ key: 0,
2211
+ class: "bg-vsk-primary rounded-vsk px-4 py-2 text-sm font-semibold cursor-pointer hover:opacity-70",
2212
+ onClick: Y(l, ["stop"])
2213
+ }, w(t.actionLabel), 1)) : g("", !0),
2214
+ t.showStatusIndicator && t.isConnected ? (o(), s("div", Ve)) : g("", !0)
2215
+ ], 2));
2216
+ }
2217
+ }), Ge = ["for"], He = /* @__PURE__ */ y({
2218
+ __name: "FormGroup",
2219
+ props: {
2220
+ label: {},
2221
+ htmlFor: { default: "" },
2222
+ customClass: { default: () => ({}) },
2223
+ labelClass: { default: () => ({}) }
2224
+ },
2225
+ setup(t) {
2226
+ return (e, i) => (o(), s("div", {
2227
+ class: d(["flex flex-col gap-2", t.customClass])
2228
+ }, [
2229
+ t.label ? (o(), s("label", {
2230
+ key: 0,
2231
+ for: t.htmlFor,
2232
+ class: d(["text-sm font-medium text-vsk-primary", t.labelClass])
2233
+ }, w(t.label), 11, Ge)) : g("", !0),
2234
+ k(e.$slots, "default", {}, void 0, !0)
2235
+ ], 2));
2236
+ }
2237
+ }), je = /* @__PURE__ */ D(He, [["__scopeId", "data-v-a4bd01fc"]]), Je = /* @__PURE__ */ y({
2238
+ __name: "ListCard",
2239
+ props: {
2240
+ clickable: { type: Boolean, default: !1 },
2241
+ customClass: { default: () => ({}) }
2242
+ },
2243
+ emits: ["click"],
2244
+ setup(t, { emit: e }) {
2245
+ const i = t, l = e, a = () => {
2246
+ i.clickable && l("click");
2247
+ };
2248
+ return (c, r) => (o(), s("div", {
2249
+ class: d([
2250
+ "flex items-center justify-between background p-3 rounded-vsk border border-vsk-primary/70 transition-colors duration-200",
2251
+ {
2252
+ "hover:bg-vsk-primary/5 cursor-pointer": i.clickable
2253
+ },
2254
+ t.customClass
2255
+ ]),
2256
+ onClick: a
2257
+ }, [
2258
+ k(c.$slots, "default", {}, void 0, !0)
2259
+ ], 2));
2260
+ }
2261
+ }), qe = /* @__PURE__ */ D(Je, [["__scopeId", "data-v-f86d47da"]]), Ze = { class: "background rounded-vsk flex flex-row items-center gap-2 justify-between w-full h-auto p-4 transition-all duration-200 hover:bg-white/60 dark:hover:bg-black/60" }, Qe = ["src", "alt", "title"], Ye = {
2262
+ key: 1,
2263
+ class: "w-8 h-8 flex items-center justify-center"
2264
+ }, Ke = ["src", "alt"], Xe = ["min", "max", "value"], et = /* @__PURE__ */ y({
2265
+ __name: "SliderControl",
2266
+ props: {
2267
+ icon: {},
2268
+ alt: { default: "" },
2269
+ tooltip: { default: "" },
2270
+ modelValue: {},
2271
+ min: { default: 0 },
2272
+ max: { default: 100 },
2273
+ showButton: { type: Boolean, default: !1 },
2274
+ iconClass: { default: () => ({}) },
2275
+ getPercentageClass: { type: Function, default: () => "" }
2276
+ },
2277
+ emits: ["update:modelValue", "buttonClick"],
2278
+ setup(t, { emit: e }) {
2279
+ const i = t, l = e, a = T(() => {
2280
+ if (i.max <= i.min) return 0;
2281
+ const h = i.max - i.min, v = i.modelValue - i.min;
2282
+ return Math.round(v / h * 100);
2283
+ }), c = T(() => i.getPercentageClass ? i.getPercentageClass(a.value) : ""), r = (h) => {
2284
+ const v = h.target;
2285
+ l("update:modelValue", Number(v.value));
2286
+ }, f = () => {
2287
+ l("buttonClick");
2288
+ };
2289
+ return (h, v) => (o(), s("div", Ze, [
2290
+ t.showButton ? (o(), s("button", {
2291
+ key: 0,
2292
+ onClick: f,
2293
+ class: "w-8 h-8 flex items-center justify-center rounded-vsk transition-all duration-200 hover:bg-white/30 dark:hover:bg-black/30 hover:scale-110 active:scale-95"
2294
+ }, [
2295
+ u("img", {
2296
+ src: t.icon,
2297
+ alt: t.alt,
2298
+ title: t.tooltip,
2299
+ class: d(["w-6 h-6 transition-all duration-200", t.iconClass])
2300
+ }, null, 10, Qe)
2301
+ ])) : (o(), s("div", Ye, [
2302
+ u("img", {
2303
+ src: t.icon,
2304
+ alt: t.alt,
2305
+ class: "w-6 h-6 transition-all duration-200"
2306
+ }, null, 8, Ke)
2307
+ ])),
2308
+ u("input", {
2309
+ type: "range",
2310
+ min: t.min,
2311
+ max: t.max,
2312
+ value: t.modelValue,
2313
+ onInput: r,
2314
+ class: "flex-1 transition-all duration-200 hover:scale-105"
2315
+ }, null, 40, Xe),
2316
+ u("span", {
2317
+ class: d(["w-12 text-right transition-all duration-200 font-medium", c.value])
2318
+ }, w(a.value) + "% ", 3)
2319
+ ]));
2320
+ }
2321
+ }), tt = ["disabled"], it = /* @__PURE__ */ y({
2322
+ __name: "SwitchToggle",
2323
+ props: {
2324
+ isOn: { type: Boolean },
2325
+ disabled: { type: Boolean, default: !1 },
2326
+ size: { default: "small" },
2327
+ activeClass: { default: "bg-vsk-primary" },
2328
+ inactiveClass: { default: "background" },
2329
+ customClass: { default: "" }
2330
+ },
2331
+ emits: ["toggle"],
2332
+ setup(t, { emit: e }) {
2333
+ const i = t, l = e, a = () => {
2334
+ l("toggle", !i.isOn);
2335
+ };
2336
+ return (c, r) => (o(), s("button", {
2337
+ type: "button",
2338
+ onClick: a,
2339
+ disabled: t.disabled,
2340
+ class: d([
2341
+ "relative inline-flex items-center rounded-full transition-colors",
2342
+ t.size === "small" ? "h-6 w-11" : "h-7 w-12",
2343
+ t.isOn ? t.activeClass : t.inactiveClass,
2344
+ t.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer",
2345
+ t.customClass
2346
+ ])
2347
+ }, [
2348
+ u("span", {
2349
+ class: d([
2350
+ "inline-block transform rounded-full bg-white shadow transition-transform",
2351
+ t.size === "small" ? "h-4 w-4" : "h-6 w-6",
2352
+ t.isOn ? t.size === "small" ? "translate-x-6" : "translate-x-5" : "translate-x-1"
2353
+ ])
2354
+ }, null, 2)
2355
+ ], 10, tt));
2356
+ }
2357
+ }), nt = ["disabled"], lt = ["src", "alt", "title"], at = /* @__PURE__ */ y({
2358
+ __name: "ToggleControl",
2359
+ props: {
2360
+ icon: {},
2361
+ alt: { default: "" },
2362
+ tooltip: { default: "" },
2363
+ isActive: { type: Boolean, default: !1 },
2364
+ isLoading: { type: Boolean, default: !1 },
2365
+ iconClass: { default: () => ({}) },
2366
+ customClass: { default: () => ({}) }
2367
+ },
2368
+ emits: ["click"],
2369
+ setup(t, { emit: e }) {
2370
+ const i = e, l = () => {
2371
+ i("click");
2372
+ };
2373
+ return (a, c) => (o(), s("button", {
2374
+ onClick: l,
2375
+ class: d(["p-2 rounded-vsk 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", {
2376
+ "animate-pulse": t.isLoading,
2377
+ "ring-2 ring-vsk-primary/50": t.isActive,
2378
+ "opacity-60": !t.isActive,
2379
+ ...t.customClass
2380
+ }]),
2381
+ disabled: t.isLoading
2382
+ }, [
2383
+ u("img", {
2384
+ src: t.icon,
2385
+ alt: t.alt,
2386
+ title: t.tooltip,
2387
+ class: d(["m-auto w-12.5 h-12.5 transition-all duration-300 group-hover:scale-110 relative z-10", {
2388
+ "animate-spin": t.isLoading,
2389
+ "filter brightness-75": !t.isActive,
2390
+ "drop-shadow-lg": t.isActive,
2391
+ ...t.iconClass
2392
+ }])
2393
+ }, null, 10, lt)
2394
+ ], 10, nt));
2395
+ }
2396
+ }), st = ["title"], ot = ["src", "alt"], rt = {
2397
+ key: 0,
2398
+ class: "absolute bottom-1 right-1 bg-vsk-primary text-white text-xs rounded-full w-4 h-4 flex items-center justify-center font-bold animate-bounce"
2399
+ }, ut = /* @__PURE__ */ y({
2400
+ __name: "TrayIconButton",
2401
+ props: {
2402
+ icon: {},
2403
+ alt: { default: "" },
2404
+ tooltip: { default: "" },
2405
+ badge: { default: null },
2406
+ iconClass: { default: () => ({}) },
2407
+ customClass: { default: "" },
2408
+ tooltipClass: { default: "" },
2409
+ showCustomTooltip: { type: Boolean, default: !1 },
2410
+ customTooltipText: { default: "" }
2411
+ },
2412
+ emits: ["click"],
2413
+ setup(t, { emit: e }) {
2414
+ const i = e, l = x(!1), a = () => {
2415
+ i("click");
2416
+ };
2417
+ return (c, r) => (o(), s("div", {
2418
+ class: d(["p-1 rounded-vsk relative hover:bg-vsk-primary/30 group transition-all duration-300", t.customClass]),
2419
+ title: t.tooltip,
2420
+ onClick: a,
2421
+ onMouseenter: r[0] || (r[0] = (f) => l.value = !0),
2422
+ onMouseleave: r[1] || (r[1] = (f) => l.value = !1)
2423
+ }, [
2424
+ u("img", {
2425
+ src: t.icon,
2426
+ alt: t.alt,
2427
+ class: d(["m-auto h-5.5 w-auto transition-all duration-300", t.iconClass])
2428
+ }, null, 10, ot),
2429
+ t.badge !== null && t.badge > 0 ? (o(), s("div", rt, w(t.badge), 1)) : g("", !0),
2430
+ t.showCustomTooltip && t.customTooltipText ? (o(), s("div", {
2431
+ key: 1,
2432
+ class: d(["absolute top-1 left-1/2 transform -translate-x-1/2 text-xs font-semibold p-1 rounded-vsk transition-all duration-300 pointer-events-none background", [
2433
+ t.tooltipClass,
2434
+ {
2435
+ "opacity-0 -translate-y-2": !l.value,
2436
+ "opacity-100 translate-y-0": l.value
2437
+ }
2438
+ ]])
2439
+ }, w(t.customTooltipText), 3)) : g("", !0),
2440
+ k(c.$slots, "default")
2441
+ ], 42, st));
2442
+ }
2443
+ }), ct = [
2444
+ te,
2445
+ le,
2446
+ Ce,
2447
+ $e,
2448
+ Be,
2449
+ Ue,
2450
+ je,
2451
+ qe,
2452
+ et,
2453
+ it,
2454
+ at,
2455
+ ut
2456
+ ], ht = {
2457
+ install(t) {
2458
+ ct.forEach((e) => {
2459
+ t.component(e.name, e);
2460
+ });
2461
+ }
2462
+ };
2463
+ export {
2464
+ $e as ActionButton,
2465
+ Be as ConfigSection,
2466
+ Ue as DeviceCard,
2467
+ je as FormGroup,
2468
+ qe as ListCard,
2469
+ te as SideBar,
2470
+ le as SideButton,
2471
+ et as SliderControl,
2472
+ it as SwitchToggle,
2473
+ at as ToggleControl,
2474
+ ut as TrayIconButton,
2475
+ Ce as WindowFrame,
2476
+ ht as default
2477
+ };