@synnaxlabs/drift 0.43.0 → 0.44.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.
- package/dist/electron.cjs +1 -1
- package/dist/electron.js +153 -160
- package/dist/index.cjs +1 -1
- package/dist/index.js +150 -150
- package/dist/react.cjs +1 -1
- package/dist/react.js +2 -2
- package/dist/selectors-2mPd0CjI.cjs +1 -0
- package/dist/{selectors-CzAkOydY.js → selectors-C36jHClh.js} +2 -5
- package/dist/src/state.d.ts.map +1 -1
- package/dist/src/window.d.ts +1 -1
- package/dist/src/window.d.ts.map +1 -1
- package/dist/state-D41-Dai4.js +12075 -0
- package/dist/state-yfMrLzJG.cjs +34 -0
- package/dist/tauri.cjs +1 -1
- package/dist/tauri.js +216 -188
- package/package.json +14 -14
- package/dist/selectors-DrXQNVVN.cjs +0 -1
- package/dist/state-BGByXBtX.cjs +0 -61
- package/dist/state-C1PObbun.js +0 -13735
package/dist/tauri.js
CHANGED
|
@@ -1,30 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { H as te, J as ne, r as g, M as se, L as le, A as ae, K as re, P as U } from "./state-C1PObbun.js";
|
|
5
|
-
import { o as oe } from "./debounce-DOZKRZa9.js";
|
|
6
|
-
function ue(t, e, i, n) {
|
|
1
|
+
import { G as X, H as ee, r as g, M as ie, K as te, _ as ne, J as se, $ as U } from "./state-D41-Dai4.js";
|
|
2
|
+
import { o as le } from "./debounce-DOZKRZa9.js";
|
|
3
|
+
function ae(t, e, i, n) {
|
|
7
4
|
if (typeof e == "function" ? t !== e || !n : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
8
5
|
return i === "m" ? n : i === "a" ? n.call(t) : n ? n.value : e.get(t);
|
|
9
6
|
}
|
|
10
|
-
function
|
|
7
|
+
function re(t, e, i, n, l) {
|
|
11
8
|
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");
|
|
12
9
|
return e.set(t, i), i;
|
|
13
10
|
}
|
|
14
|
-
var
|
|
11
|
+
var W;
|
|
15
12
|
const c = "__TAURI_TO_IPC_KEY__";
|
|
16
|
-
function
|
|
13
|
+
function oe(t, e = !1) {
|
|
17
14
|
return window.__TAURI_INTERNALS__.transformCallback(t, e);
|
|
18
15
|
}
|
|
19
16
|
async function s(t, e = {}, i) {
|
|
20
17
|
return window.__TAURI_INTERNALS__.invoke(t, e, i);
|
|
21
18
|
}
|
|
22
|
-
class
|
|
19
|
+
class ue {
|
|
23
20
|
get rid() {
|
|
24
|
-
return
|
|
21
|
+
return ae(this, W, "f");
|
|
25
22
|
}
|
|
26
23
|
constructor(e) {
|
|
27
|
-
|
|
24
|
+
W.set(this, void 0), re(this, W, e);
|
|
28
25
|
}
|
|
29
26
|
/**
|
|
30
27
|
* Destroys and cleans up this resource from memory.
|
|
@@ -36,38 +33,38 @@ class we {
|
|
|
36
33
|
});
|
|
37
34
|
}
|
|
38
35
|
}
|
|
39
|
-
|
|
40
|
-
var
|
|
36
|
+
W = /* @__PURE__ */ new WeakMap();
|
|
37
|
+
var r;
|
|
41
38
|
(function(t) {
|
|
42
39
|
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";
|
|
43
|
-
})(
|
|
40
|
+
})(r || (r = {}));
|
|
44
41
|
async function G(t, e) {
|
|
45
|
-
await s("plugin:event|unlisten", {
|
|
42
|
+
window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(t, e), await s("plugin:event|unlisten", {
|
|
46
43
|
event: t,
|
|
47
44
|
eventId: e
|
|
48
45
|
});
|
|
49
46
|
}
|
|
50
|
-
async function
|
|
47
|
+
async function f(t, e, i) {
|
|
51
48
|
var n;
|
|
52
|
-
const l = typeof
|
|
49
|
+
const l = typeof i?.target == "string" ? { kind: "AnyLabel", label: i.target } : (n = i?.target) !== null && n !== void 0 ? n : { kind: "Any" };
|
|
53
50
|
return s("plugin:event|listen", {
|
|
54
51
|
event: t,
|
|
55
52
|
target: l,
|
|
56
|
-
handler:
|
|
57
|
-
}).then((
|
|
53
|
+
handler: oe(e)
|
|
54
|
+
}).then((o) => async () => G(t, o));
|
|
58
55
|
}
|
|
59
56
|
async function k(t, e, i) {
|
|
60
|
-
return
|
|
57
|
+
return f(t, (n) => {
|
|
61
58
|
G(t, n.id), e(n);
|
|
62
59
|
}, i);
|
|
63
60
|
}
|
|
64
|
-
async function
|
|
61
|
+
async function P(t, e) {
|
|
65
62
|
await s("plugin:event|emit", {
|
|
66
63
|
event: t,
|
|
67
64
|
payload: e
|
|
68
65
|
});
|
|
69
66
|
}
|
|
70
|
-
async function
|
|
67
|
+
async function H(t, e, i) {
|
|
71
68
|
await s("plugin:event|emit_to", {
|
|
72
69
|
target: typeof t == "string" ? { kind: "AnyLabel", label: t } : t,
|
|
73
70
|
event: e,
|
|
@@ -94,7 +91,7 @@ class _ {
|
|
|
94
91
|
* @since 2.0.0
|
|
95
92
|
*/
|
|
96
93
|
toPhysical(e) {
|
|
97
|
-
return new
|
|
94
|
+
return new w(this.width * e, this.height * e);
|
|
98
95
|
}
|
|
99
96
|
[c]() {
|
|
100
97
|
return {
|
|
@@ -106,7 +103,7 @@ class _ {
|
|
|
106
103
|
return this[c]();
|
|
107
104
|
}
|
|
108
105
|
}
|
|
109
|
-
class
|
|
106
|
+
class w {
|
|
110
107
|
constructor(...e) {
|
|
111
108
|
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]);
|
|
112
109
|
}
|
|
@@ -142,7 +139,7 @@ class h {
|
|
|
142
139
|
return this.size instanceof _ ? this.size : this.size.toLogical(e);
|
|
143
140
|
}
|
|
144
141
|
toPhysical(e) {
|
|
145
|
-
return this.size instanceof
|
|
142
|
+
return this.size instanceof w ? this.size : this.size.toPhysical(e);
|
|
146
143
|
}
|
|
147
144
|
[c]() {
|
|
148
145
|
return {
|
|
@@ -242,7 +239,7 @@ class d {
|
|
|
242
239
|
return this[c]();
|
|
243
240
|
}
|
|
244
241
|
}
|
|
245
|
-
class
|
|
242
|
+
class m extends ue {
|
|
246
243
|
/**
|
|
247
244
|
* Creates an Image from a resource ID. For internal use only.
|
|
248
245
|
*
|
|
@@ -257,7 +254,7 @@ class v extends we {
|
|
|
257
254
|
rgba: z(e),
|
|
258
255
|
width: i,
|
|
259
256
|
height: n
|
|
260
|
-
}).then((l) => new
|
|
257
|
+
}).then((l) => new m(l));
|
|
261
258
|
}
|
|
262
259
|
/**
|
|
263
260
|
* Creates a new image using the provided bytes by inferring the file format.
|
|
@@ -275,7 +272,7 @@ class v extends we {
|
|
|
275
272
|
static async fromBytes(e) {
|
|
276
273
|
return s("plugin:image|from_bytes", {
|
|
277
274
|
bytes: z(e)
|
|
278
|
-
}).then((i) => new
|
|
275
|
+
}).then((i) => new m(i));
|
|
279
276
|
}
|
|
280
277
|
/**
|
|
281
278
|
* Creates a new image using the provided path.
|
|
@@ -290,7 +287,7 @@ class v extends we {
|
|
|
290
287
|
* ```
|
|
291
288
|
*/
|
|
292
289
|
static async fromPath(e) {
|
|
293
|
-
return s("plugin:image|from_path", { path: e }).then((i) => new
|
|
290
|
+
return s("plugin:image|from_path", { path: e }).then((i) => new m(i));
|
|
294
291
|
}
|
|
295
292
|
/** Returns the RGBA data for this image, in row-major order from top to bottom. */
|
|
296
293
|
async rgba() {
|
|
@@ -304,13 +301,13 @@ class v extends we {
|
|
|
304
301
|
}
|
|
305
302
|
}
|
|
306
303
|
function z(t) {
|
|
307
|
-
return t == null ? null : typeof t == "string" ? t : t instanceof
|
|
304
|
+
return t == null ? null : typeof t == "string" ? t : t instanceof m ? t.rid : t;
|
|
308
305
|
}
|
|
309
|
-
var
|
|
306
|
+
var R;
|
|
310
307
|
(function(t) {
|
|
311
308
|
t[t.Critical = 1] = "Critical", t[t.Informational = 2] = "Informational";
|
|
312
|
-
})(
|
|
313
|
-
class
|
|
309
|
+
})(R || (R = {}));
|
|
310
|
+
class ce {
|
|
314
311
|
constructor(e) {
|
|
315
312
|
this._preventDefault = !1, this.event = e.event, this.id = e.id;
|
|
316
313
|
}
|
|
@@ -325,20 +322,20 @@ var T;
|
|
|
325
322
|
(function(t) {
|
|
326
323
|
t.None = "none", t.Normal = "normal", t.Indeterminate = "indeterminate", t.Paused = "paused", t.Error = "error";
|
|
327
324
|
})(T || (T = {}));
|
|
328
|
-
function
|
|
329
|
-
return new
|
|
325
|
+
function j() {
|
|
326
|
+
return new x(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {
|
|
330
327
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
331
328
|
skip: !0
|
|
332
329
|
});
|
|
333
330
|
}
|
|
334
|
-
async function
|
|
335
|
-
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new
|
|
331
|
+
async function E() {
|
|
332
|
+
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new x(e, {
|
|
336
333
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
337
334
|
skip: !0
|
|
338
335
|
})));
|
|
339
336
|
}
|
|
340
337
|
const A = ["tauri://created", "tauri://error"];
|
|
341
|
-
class
|
|
338
|
+
class x {
|
|
342
339
|
/**
|
|
343
340
|
* Creates a new Window.
|
|
344
341
|
* @example
|
|
@@ -358,7 +355,7 @@ class P {
|
|
|
358
355
|
*/
|
|
359
356
|
constructor(e, i = {}) {
|
|
360
357
|
var n;
|
|
361
|
-
this.label = e, this.listeners = /* @__PURE__ */ Object.create(null), i
|
|
358
|
+
this.label = e, this.listeners = /* @__PURE__ */ Object.create(null), i?.skip || s("plugin:window|create", {
|
|
362
359
|
options: {
|
|
363
360
|
...i,
|
|
364
361
|
parent: typeof i.parent == "string" ? i.parent : (n = i.parent) === null || n === void 0 ? void 0 : n.label,
|
|
@@ -379,19 +376,19 @@ class P {
|
|
|
379
376
|
*/
|
|
380
377
|
static async getByLabel(e) {
|
|
381
378
|
var i;
|
|
382
|
-
return (i = (await
|
|
379
|
+
return (i = (await E()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
|
|
383
380
|
}
|
|
384
381
|
/**
|
|
385
382
|
* Get an instance of `Window` for the current window.
|
|
386
383
|
*/
|
|
387
384
|
static getCurrent() {
|
|
388
|
-
return
|
|
385
|
+
return j();
|
|
389
386
|
}
|
|
390
387
|
/**
|
|
391
388
|
* Gets a list of instances of `Window` for all available windows.
|
|
392
389
|
*/
|
|
393
390
|
static async getAll() {
|
|
394
|
-
return
|
|
391
|
+
return E();
|
|
395
392
|
}
|
|
396
393
|
/**
|
|
397
394
|
* Gets the focused window.
|
|
@@ -404,7 +401,7 @@ class P {
|
|
|
404
401
|
* @returns The Window instance or `undefined` if there is not any focused window.
|
|
405
402
|
*/
|
|
406
403
|
static async getFocusedWindow() {
|
|
407
|
-
for (const e of await
|
|
404
|
+
for (const e of await E())
|
|
408
405
|
if (await e.isFocused())
|
|
409
406
|
return e;
|
|
410
407
|
return null;
|
|
@@ -432,7 +429,7 @@ class P {
|
|
|
432
429
|
return this._handleTauriEvent(e, i) ? () => {
|
|
433
430
|
const n = this.listeners[e];
|
|
434
431
|
n.splice(n.indexOf(i), 1);
|
|
435
|
-
} :
|
|
432
|
+
} : f(e, i, {
|
|
436
433
|
target: { kind: "Window", label: this.label }
|
|
437
434
|
});
|
|
438
435
|
}
|
|
@@ -484,7 +481,7 @@ class P {
|
|
|
484
481
|
});
|
|
485
482
|
return;
|
|
486
483
|
}
|
|
487
|
-
return
|
|
484
|
+
return P(e, i);
|
|
488
485
|
}
|
|
489
486
|
/**
|
|
490
487
|
* Emits an event to all {@link EventTarget|targets} matching the given target.
|
|
@@ -508,7 +505,7 @@ class P {
|
|
|
508
505
|
});
|
|
509
506
|
return;
|
|
510
507
|
}
|
|
511
|
-
return
|
|
508
|
+
return H(e, i, n);
|
|
512
509
|
}
|
|
513
510
|
/** @ignore */
|
|
514
511
|
_handleTauriEvent(e, i) {
|
|
@@ -574,7 +571,7 @@ class P {
|
|
|
574
571
|
async innerSize() {
|
|
575
572
|
return s("plugin:window|inner_size", {
|
|
576
573
|
label: this.label
|
|
577
|
-
}).then((e) => new
|
|
574
|
+
}).then((e) => new w(e));
|
|
578
575
|
}
|
|
579
576
|
/**
|
|
580
577
|
* The physical size of the entire window.
|
|
@@ -590,7 +587,7 @@ class P {
|
|
|
590
587
|
async outerSize() {
|
|
591
588
|
return s("plugin:window|outer_size", {
|
|
592
589
|
label: this.label
|
|
593
|
-
}).then((e) => new
|
|
590
|
+
}).then((e) => new w(e));
|
|
594
591
|
}
|
|
595
592
|
/**
|
|
596
593
|
* Gets the window's current fullscreen state.
|
|
@@ -841,7 +838,7 @@ class P {
|
|
|
841
838
|
*/
|
|
842
839
|
async requestUserAttention(e) {
|
|
843
840
|
let i = null;
|
|
844
|
-
return e && (e ===
|
|
841
|
+
return e && (e === R.Critical ? i = { type: "Critical" } : i = { type: "Informational" }), s("plugin:window|request_user_attention", {
|
|
845
842
|
label: this.label,
|
|
846
843
|
value: i
|
|
847
844
|
});
|
|
@@ -1296,10 +1293,10 @@ class P {
|
|
|
1296
1293
|
return s("plugin:window|set_size_constraints", {
|
|
1297
1294
|
label: this.label,
|
|
1298
1295
|
value: {
|
|
1299
|
-
minWidth: i(e
|
|
1300
|
-
minHeight: i(e
|
|
1301
|
-
maxWidth: i(e
|
|
1302
|
-
maxHeight: i(e
|
|
1296
|
+
minWidth: i(e?.minWidth),
|
|
1297
|
+
minHeight: i(e?.minHeight),
|
|
1298
|
+
maxWidth: i(e?.maxWidth),
|
|
1299
|
+
maxHeight: i(e?.maxHeight)
|
|
1303
1300
|
}
|
|
1304
1301
|
});
|
|
1305
1302
|
}
|
|
@@ -1697,8 +1694,8 @@ class P {
|
|
|
1697
1694
|
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
|
1698
1695
|
*/
|
|
1699
1696
|
async onResized(e) {
|
|
1700
|
-
return this.listen(
|
|
1701
|
-
i.payload = new
|
|
1697
|
+
return this.listen(r.WINDOW_RESIZED, (i) => {
|
|
1698
|
+
i.payload = new w(i.payload), e(i);
|
|
1702
1699
|
});
|
|
1703
1700
|
}
|
|
1704
1701
|
/**
|
|
@@ -1719,7 +1716,7 @@ class P {
|
|
|
1719
1716
|
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
|
1720
1717
|
*/
|
|
1721
1718
|
async onMoved(e) {
|
|
1722
|
-
return this.listen(
|
|
1719
|
+
return this.listen(r.WINDOW_MOVED, (i) => {
|
|
1723
1720
|
i.payload = new u(i.payload), e(i);
|
|
1724
1721
|
});
|
|
1725
1722
|
}
|
|
@@ -1746,8 +1743,8 @@ class P {
|
|
|
1746
1743
|
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
|
1747
1744
|
*/
|
|
1748
1745
|
async onCloseRequested(e) {
|
|
1749
|
-
return this.listen(
|
|
1750
|
-
const n = new
|
|
1746
|
+
return this.listen(r.WINDOW_CLOSE_REQUESTED, async (i) => {
|
|
1747
|
+
const n = new ce(i);
|
|
1751
1748
|
await e(n), n.isPreventDefault() || await this.destroy();
|
|
1752
1749
|
});
|
|
1753
1750
|
}
|
|
@@ -1777,7 +1774,7 @@ class P {
|
|
|
1777
1774
|
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
|
1778
1775
|
*/
|
|
1779
1776
|
async onDragDropEvent(e) {
|
|
1780
|
-
const i = await this.listen(
|
|
1777
|
+
const i = await this.listen(r.DRAG_ENTER, (a) => {
|
|
1781
1778
|
e({
|
|
1782
1779
|
...a,
|
|
1783
1780
|
payload: {
|
|
@@ -1786,7 +1783,7 @@ class P {
|
|
|
1786
1783
|
position: new u(a.payload.position)
|
|
1787
1784
|
}
|
|
1788
1785
|
});
|
|
1789
|
-
}), n = await this.listen(
|
|
1786
|
+
}), n = await this.listen(r.DRAG_OVER, (a) => {
|
|
1790
1787
|
e({
|
|
1791
1788
|
...a,
|
|
1792
1789
|
payload: {
|
|
@@ -1794,7 +1791,7 @@ class P {
|
|
|
1794
1791
|
position: new u(a.payload.position)
|
|
1795
1792
|
}
|
|
1796
1793
|
});
|
|
1797
|
-
}), l = await this.listen(
|
|
1794
|
+
}), l = await this.listen(r.DRAG_DROP, (a) => {
|
|
1798
1795
|
e({
|
|
1799
1796
|
...a,
|
|
1800
1797
|
payload: {
|
|
@@ -1803,11 +1800,11 @@ class P {
|
|
|
1803
1800
|
position: new u(a.payload.position)
|
|
1804
1801
|
}
|
|
1805
1802
|
});
|
|
1806
|
-
}),
|
|
1803
|
+
}), o = await this.listen(r.DRAG_LEAVE, (a) => {
|
|
1807
1804
|
e({ ...a, payload: { type: "leave" } });
|
|
1808
1805
|
});
|
|
1809
1806
|
return () => {
|
|
1810
|
-
i(), l(), n(),
|
|
1807
|
+
i(), l(), n(), o();
|
|
1811
1808
|
};
|
|
1812
1809
|
}
|
|
1813
1810
|
/**
|
|
@@ -1828,9 +1825,9 @@ class P {
|
|
|
1828
1825
|
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
|
1829
1826
|
*/
|
|
1830
1827
|
async onFocusChanged(e) {
|
|
1831
|
-
const i = await this.listen(
|
|
1828
|
+
const i = await this.listen(r.WINDOW_FOCUS, (l) => {
|
|
1832
1829
|
e({ ...l, payload: !0 });
|
|
1833
|
-
}), n = await this.listen(
|
|
1830
|
+
}), n = await this.listen(r.WINDOW_BLUR, (l) => {
|
|
1834
1831
|
e({ ...l, payload: !1 });
|
|
1835
1832
|
});
|
|
1836
1833
|
return () => {
|
|
@@ -1859,7 +1856,7 @@ class P {
|
|
|
1859
1856
|
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
|
1860
1857
|
*/
|
|
1861
1858
|
async onScaleChanged(e) {
|
|
1862
|
-
return this.listen(
|
|
1859
|
+
return this.listen(r.WINDOW_SCALE_FACTOR_CHANGED, e);
|
|
1863
1860
|
}
|
|
1864
1861
|
/**
|
|
1865
1862
|
* Listen to the system theme change.
|
|
@@ -1879,40 +1876,44 @@ class P {
|
|
|
1879
1876
|
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
|
1880
1877
|
*/
|
|
1881
1878
|
async onThemeChanged(e) {
|
|
1882
|
-
return this.listen(
|
|
1879
|
+
return this.listen(r.WINDOW_THEME_CHANGED, e);
|
|
1883
1880
|
}
|
|
1884
1881
|
}
|
|
1885
|
-
var
|
|
1882
|
+
var C;
|
|
1886
1883
|
(function(t) {
|
|
1887
1884
|
t.Disabled = "disabled", t.Throttle = "throttle", t.Suspend = "suspend";
|
|
1888
|
-
})(
|
|
1889
|
-
var
|
|
1885
|
+
})(C || (C = {}));
|
|
1886
|
+
var M;
|
|
1890
1887
|
(function(t) {
|
|
1891
1888
|
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";
|
|
1892
|
-
})(
|
|
1893
|
-
var
|
|
1889
|
+
})(M || (M = {}));
|
|
1890
|
+
var F;
|
|
1894
1891
|
(function(t) {
|
|
1895
1892
|
t.FollowsWindowActiveState = "followsWindowActiveState", t.Active = "active", t.Inactive = "inactive";
|
|
1896
|
-
})(
|
|
1897
|
-
function
|
|
1893
|
+
})(F || (F = {}));
|
|
1894
|
+
function he(t) {
|
|
1898
1895
|
return t === null ? null : {
|
|
1899
1896
|
name: t.name,
|
|
1900
1897
|
scaleFactor: t.scaleFactor,
|
|
1901
1898
|
position: new u(t.position),
|
|
1902
|
-
size: new
|
|
1899
|
+
size: new w(t.size),
|
|
1900
|
+
workArea: {
|
|
1901
|
+
position: new u(t.workArea.position),
|
|
1902
|
+
size: new w(t.workArea.size)
|
|
1903
|
+
}
|
|
1903
1904
|
};
|
|
1904
1905
|
}
|
|
1905
|
-
async function
|
|
1906
|
-
return s("plugin:window|available_monitors").then((t) => t.map(
|
|
1906
|
+
async function we() {
|
|
1907
|
+
return s("plugin:window|available_monitors").then((t) => t.map(he));
|
|
1907
1908
|
}
|
|
1908
|
-
function
|
|
1909
|
-
return new
|
|
1909
|
+
function J() {
|
|
1910
|
+
return new L(j(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, {
|
|
1910
1911
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
1911
1912
|
skip: !0
|
|
1912
1913
|
});
|
|
1913
1914
|
}
|
|
1914
|
-
async function
|
|
1915
|
-
return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new
|
|
1915
|
+
async function B() {
|
|
1916
|
+
return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new L(new x(e.windowLabel, {
|
|
1916
1917
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
1917
1918
|
skip: !0
|
|
1918
1919
|
}), e.label, {
|
|
@@ -1920,8 +1921,8 @@ async function V() {
|
|
|
1920
1921
|
skip: !0
|
|
1921
1922
|
})));
|
|
1922
1923
|
}
|
|
1923
|
-
const
|
|
1924
|
-
class
|
|
1924
|
+
const I = ["tauri://created", "tauri://error"];
|
|
1925
|
+
class L {
|
|
1925
1926
|
/**
|
|
1926
1927
|
* Creates a new Webview.
|
|
1927
1928
|
* @example
|
|
@@ -1929,14 +1930,24 @@ class C {
|
|
|
1929
1930
|
* import { Window } from '@tauri-apps/api/window'
|
|
1930
1931
|
* import { Webview } from '@tauri-apps/api/webview'
|
|
1931
1932
|
* const appWindow = new Window('my-label')
|
|
1932
|
-
*
|
|
1933
|
-
*
|
|
1934
|
-
*
|
|
1935
|
-
*
|
|
1936
|
-
*
|
|
1937
|
-
*
|
|
1938
|
-
*
|
|
1939
|
-
*
|
|
1933
|
+
*
|
|
1934
|
+
* appWindow.once('tauri://created', async function() {
|
|
1935
|
+
* const webview = new Webview(appWindow, 'my-label', {
|
|
1936
|
+
* url: 'https://github.com/tauri-apps/tauri',
|
|
1937
|
+
*
|
|
1938
|
+
* // create a webview with specific logical position and size
|
|
1939
|
+
* x: 0,
|
|
1940
|
+
* y: 0,
|
|
1941
|
+
* width: 800,
|
|
1942
|
+
* height: 600,
|
|
1943
|
+
* });
|
|
1944
|
+
*
|
|
1945
|
+
* webview.once('tauri://created', function () {
|
|
1946
|
+
* // webview successfully created
|
|
1947
|
+
* });
|
|
1948
|
+
* webview.once('tauri://error', function (e) {
|
|
1949
|
+
* // an error happened creating the webview
|
|
1950
|
+
* });
|
|
1940
1951
|
* });
|
|
1941
1952
|
* ```
|
|
1942
1953
|
*
|
|
@@ -1945,10 +1956,12 @@ class C {
|
|
|
1945
1956
|
* @returns The {@link Webview} instance to communicate with the webview.
|
|
1946
1957
|
*/
|
|
1947
1958
|
constructor(e, i, n) {
|
|
1948
|
-
this.window = e, this.label = i, this.listeners = /* @__PURE__ */ Object.create(null), n
|
|
1959
|
+
this.window = e, this.label = i, this.listeners = /* @__PURE__ */ Object.create(null), n?.skip || s("plugin:webview|create_webview", {
|
|
1949
1960
|
windowLabel: e.label,
|
|
1950
|
-
|
|
1951
|
-
|
|
1961
|
+
options: {
|
|
1962
|
+
...n,
|
|
1963
|
+
label: i
|
|
1964
|
+
}
|
|
1952
1965
|
}).then(async () => this.emit("tauri://created")).catch(async (l) => this.emit("tauri://error", l));
|
|
1953
1966
|
}
|
|
1954
1967
|
/**
|
|
@@ -1964,19 +1977,19 @@ class C {
|
|
|
1964
1977
|
*/
|
|
1965
1978
|
static async getByLabel(e) {
|
|
1966
1979
|
var i;
|
|
1967
|
-
return (i = (await
|
|
1980
|
+
return (i = (await B()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
|
|
1968
1981
|
}
|
|
1969
1982
|
/**
|
|
1970
1983
|
* Get an instance of `Webview` for the current webview.
|
|
1971
1984
|
*/
|
|
1972
1985
|
static getCurrent() {
|
|
1973
|
-
return
|
|
1986
|
+
return J();
|
|
1974
1987
|
}
|
|
1975
1988
|
/**
|
|
1976
1989
|
* Gets a list of instances of `Webview` for all available webviews.
|
|
1977
1990
|
*/
|
|
1978
1991
|
static async getAll() {
|
|
1979
|
-
return
|
|
1992
|
+
return B();
|
|
1980
1993
|
}
|
|
1981
1994
|
/**
|
|
1982
1995
|
* Listen to an emitted event on this webview.
|
|
@@ -2001,7 +2014,7 @@ class C {
|
|
|
2001
2014
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2002
2015
|
const n = this.listeners[e];
|
|
2003
2016
|
n.splice(n.indexOf(i), 1);
|
|
2004
|
-
} :
|
|
2017
|
+
} : f(e, i, {
|
|
2005
2018
|
target: { kind: "Webview", label: this.label }
|
|
2006
2019
|
});
|
|
2007
2020
|
}
|
|
@@ -2045,7 +2058,7 @@ class C {
|
|
|
2045
2058
|
* @param payload Event payload.
|
|
2046
2059
|
*/
|
|
2047
2060
|
async emit(e, i) {
|
|
2048
|
-
if (
|
|
2061
|
+
if (I.includes(e)) {
|
|
2049
2062
|
for (const n of this.listeners[e] || [])
|
|
2050
2063
|
n({
|
|
2051
2064
|
event: e,
|
|
@@ -2054,7 +2067,7 @@ class C {
|
|
|
2054
2067
|
});
|
|
2055
2068
|
return;
|
|
2056
2069
|
}
|
|
2057
|
-
return
|
|
2070
|
+
return P(e, i);
|
|
2058
2071
|
}
|
|
2059
2072
|
/**
|
|
2060
2073
|
* Emits an event to all {@link EventTarget|targets} matching the given target.
|
|
@@ -2070,7 +2083,7 @@ class C {
|
|
|
2070
2083
|
* @param payload Event payload.
|
|
2071
2084
|
*/
|
|
2072
2085
|
async emitTo(e, i, n) {
|
|
2073
|
-
if (
|
|
2086
|
+
if (I.includes(i)) {
|
|
2074
2087
|
for (const l of this.listeners[i] || [])
|
|
2075
2088
|
l({
|
|
2076
2089
|
event: i,
|
|
@@ -2079,11 +2092,11 @@ class C {
|
|
|
2079
2092
|
});
|
|
2080
2093
|
return;
|
|
2081
2094
|
}
|
|
2082
|
-
return
|
|
2095
|
+
return H(e, i, n);
|
|
2083
2096
|
}
|
|
2084
2097
|
/** @ignore */
|
|
2085
2098
|
_handleTauriEvent(e, i) {
|
|
2086
|
-
return
|
|
2099
|
+
return I.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
|
|
2087
2100
|
}
|
|
2088
2101
|
// Getters
|
|
2089
2102
|
/**
|
|
@@ -2115,7 +2128,7 @@ class C {
|
|
|
2115
2128
|
async size() {
|
|
2116
2129
|
return s("plugin:webview|webview_size", {
|
|
2117
2130
|
label: this.label
|
|
2118
|
-
}).then((e) => new
|
|
2131
|
+
}).then((e) => new w(e));
|
|
2119
2132
|
}
|
|
2120
2133
|
// Setters
|
|
2121
2134
|
/**
|
|
@@ -2182,6 +2195,22 @@ class C {
|
|
|
2182
2195
|
label: this.label
|
|
2183
2196
|
});
|
|
2184
2197
|
}
|
|
2198
|
+
/**
|
|
2199
|
+
* Sets whether the webview should automatically grow and shrink its size and position when the parent window resizes.
|
|
2200
|
+
* @example
|
|
2201
|
+
* ```typescript
|
|
2202
|
+
* import { getCurrentWebview } from '@tauri-apps/api/webview';
|
|
2203
|
+
* await getCurrentWebview().setAutoResize(true);
|
|
2204
|
+
* ```
|
|
2205
|
+
*
|
|
2206
|
+
* @returns A promise indicating the success or failure of the operation.
|
|
2207
|
+
*/
|
|
2208
|
+
async setAutoResize(e) {
|
|
2209
|
+
return s("plugin:webview|set_webview_auto_resize", {
|
|
2210
|
+
label: this.label,
|
|
2211
|
+
value: e
|
|
2212
|
+
});
|
|
2213
|
+
}
|
|
2185
2214
|
/**
|
|
2186
2215
|
* Hide the webview.
|
|
2187
2216
|
* @example
|
|
@@ -2304,7 +2333,7 @@ class C {
|
|
|
2304
2333
|
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
|
2305
2334
|
*/
|
|
2306
2335
|
async onDragDropEvent(e) {
|
|
2307
|
-
const i = await this.listen(
|
|
2336
|
+
const i = await this.listen(r.DRAG_ENTER, (a) => {
|
|
2308
2337
|
e({
|
|
2309
2338
|
...a,
|
|
2310
2339
|
payload: {
|
|
@@ -2313,7 +2342,7 @@ class C {
|
|
|
2313
2342
|
position: new u(a.payload.position)
|
|
2314
2343
|
}
|
|
2315
2344
|
});
|
|
2316
|
-
}), n = await this.listen(
|
|
2345
|
+
}), n = await this.listen(r.DRAG_OVER, (a) => {
|
|
2317
2346
|
e({
|
|
2318
2347
|
...a,
|
|
2319
2348
|
payload: {
|
|
@@ -2321,7 +2350,7 @@ class C {
|
|
|
2321
2350
|
position: new u(a.payload.position)
|
|
2322
2351
|
}
|
|
2323
2352
|
});
|
|
2324
|
-
}), l = await this.listen(
|
|
2353
|
+
}), l = await this.listen(r.DRAG_DROP, (a) => {
|
|
2325
2354
|
e({
|
|
2326
2355
|
...a,
|
|
2327
2356
|
payload: {
|
|
@@ -2330,25 +2359,25 @@ class C {
|
|
|
2330
2359
|
position: new u(a.payload.position)
|
|
2331
2360
|
}
|
|
2332
2361
|
});
|
|
2333
|
-
}),
|
|
2362
|
+
}), o = await this.listen(r.DRAG_LEAVE, (a) => {
|
|
2334
2363
|
e({ ...a, payload: { type: "leave" } });
|
|
2335
2364
|
});
|
|
2336
2365
|
return () => {
|
|
2337
|
-
i(), l(), n(),
|
|
2366
|
+
i(), l(), n(), o();
|
|
2338
2367
|
};
|
|
2339
2368
|
}
|
|
2340
2369
|
}
|
|
2341
|
-
function
|
|
2342
|
-
const t =
|
|
2343
|
-
return new
|
|
2370
|
+
function Z() {
|
|
2371
|
+
const t = J();
|
|
2372
|
+
return new b(t.label, { skip: !0 });
|
|
2344
2373
|
}
|
|
2345
|
-
async function
|
|
2346
|
-
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new
|
|
2374
|
+
async function O() {
|
|
2375
|
+
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new b(e, {
|
|
2347
2376
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
2348
2377
|
skip: !0
|
|
2349
2378
|
})));
|
|
2350
2379
|
}
|
|
2351
|
-
class
|
|
2380
|
+
class b {
|
|
2352
2381
|
/**
|
|
2353
2382
|
* Creates a new {@link Window} hosting a {@link Webview}.
|
|
2354
2383
|
* @example
|
|
@@ -2370,7 +2399,7 @@ class w {
|
|
|
2370
2399
|
*/
|
|
2371
2400
|
constructor(e, i = {}) {
|
|
2372
2401
|
var n;
|
|
2373
|
-
this.label = e, this.listeners = /* @__PURE__ */ Object.create(null), i
|
|
2402
|
+
this.label = e, this.listeners = /* @__PURE__ */ Object.create(null), i?.skip || s("plugin:webview|create_webview_window", {
|
|
2374
2403
|
options: {
|
|
2375
2404
|
...i,
|
|
2376
2405
|
parent: typeof i.parent == "string" ? i.parent : (n = i.parent) === null || n === void 0 ? void 0 : n.label,
|
|
@@ -2391,20 +2420,20 @@ class w {
|
|
|
2391
2420
|
*/
|
|
2392
2421
|
static async getByLabel(e) {
|
|
2393
2422
|
var i;
|
|
2394
|
-
const n = (i = (await
|
|
2395
|
-
return n ? new
|
|
2423
|
+
const n = (i = (await O()).find((l) => l.label === e)) !== null && i !== void 0 ? i : null;
|
|
2424
|
+
return n ? new b(n.label, { skip: !0 }) : null;
|
|
2396
2425
|
}
|
|
2397
2426
|
/**
|
|
2398
2427
|
* Get an instance of `Webview` for the current webview.
|
|
2399
2428
|
*/
|
|
2400
2429
|
static getCurrent() {
|
|
2401
|
-
return
|
|
2430
|
+
return Z();
|
|
2402
2431
|
}
|
|
2403
2432
|
/**
|
|
2404
2433
|
* Gets a list of instances of `Webview` for all available webviews.
|
|
2405
2434
|
*/
|
|
2406
2435
|
static async getAll() {
|
|
2407
|
-
return
|
|
2436
|
+
return O();
|
|
2408
2437
|
}
|
|
2409
2438
|
/**
|
|
2410
2439
|
* Listen to an emitted event on this webivew window.
|
|
@@ -2429,7 +2458,7 @@ class w {
|
|
|
2429
2458
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2430
2459
|
const n = this.listeners[e];
|
|
2431
2460
|
n.splice(n.indexOf(i), 1);
|
|
2432
|
-
} :
|
|
2461
|
+
} : f(e, i, {
|
|
2433
2462
|
target: { kind: "WebviewWindow", label: this.label }
|
|
2434
2463
|
});
|
|
2435
2464
|
}
|
|
@@ -2480,8 +2509,8 @@ class w {
|
|
|
2480
2509
|
return s("plugin:window|set_background_color", { color: e }).then(() => s("plugin:webview|set_webview_background_color", { color: e }));
|
|
2481
2510
|
}
|
|
2482
2511
|
}
|
|
2483
|
-
|
|
2484
|
-
function
|
|
2512
|
+
be(b, [x, L]);
|
|
2513
|
+
function be(t, e) {
|
|
2485
2514
|
(Array.isArray(e) ? e : [e]).forEach((i) => {
|
|
2486
2515
|
Object.getOwnPropertyNames(i.prototype).forEach((n) => {
|
|
2487
2516
|
var l;
|
|
@@ -2494,35 +2523,35 @@ function pe(t, e) {
|
|
|
2494
2523
|
});
|
|
2495
2524
|
});
|
|
2496
2525
|
}
|
|
2497
|
-
const
|
|
2526
|
+
const de = (t) => JSON.stringify(t), ye = (t) => JSON.parse(t), D = "drift://action", pe = "tauri://error", ge = "tauri://created", _e = (t) => new Error(`Window not found: ${t}`), y = 250, me = X.seconds(1), v = (t) => {
|
|
2498
2527
|
if (t != null)
|
|
2499
2528
|
return {
|
|
2500
2529
|
width: Math.max(t.width, y),
|
|
2501
2530
|
height: Math.max(t.height, y)
|
|
2502
2531
|
};
|
|
2503
|
-
},
|
|
2532
|
+
}, ve = (t) => {
|
|
2504
2533
|
const { size: e, maxSize: i } = t;
|
|
2505
|
-
return { ...t, maxSize:
|
|
2506
|
-
},
|
|
2507
|
-
const i =
|
|
2534
|
+
return { ...t, maxSize: v(i), size: v(e) };
|
|
2535
|
+
}, fe = async () => (await we()).map((e) => {
|
|
2536
|
+
const i = S(e.position, e.scaleFactor), n = { width: e.size.width, height: e.size.height };
|
|
2508
2537
|
return U.construct(i, n);
|
|
2509
|
-
}),
|
|
2510
|
-
class
|
|
2538
|
+
}), V = async (t) => (await fe()).some((i) => U.contains(i, t));
|
|
2539
|
+
class Oe {
|
|
2540
|
+
win;
|
|
2541
|
+
unsubscribe;
|
|
2542
|
+
fullscreenPoll = null;
|
|
2511
2543
|
/**
|
|
2512
2544
|
* @param window - The WebviewWindow to use as the underlying engine for this runtime.
|
|
2513
2545
|
* This should not be set in 99% of cases. Only use this if you know what you're doing.
|
|
2514
2546
|
*/
|
|
2515
2547
|
constructor(e) {
|
|
2516
|
-
|
|
2517
|
-
D(this, "unsubscribe");
|
|
2518
|
-
D(this, "fullscreenPoll", null);
|
|
2519
|
-
this.win = e ?? q(), this.unsubscribe = {};
|
|
2548
|
+
this.win = e ?? Z(), this.unsubscribe = {};
|
|
2520
2549
|
}
|
|
2521
2550
|
async configure() {
|
|
2522
2551
|
await this.startFullscreenPoll();
|
|
2523
2552
|
}
|
|
2524
2553
|
async startFullscreenPoll() {
|
|
2525
|
-
if (
|
|
2554
|
+
if (ee.getOS() !== "macOS") return;
|
|
2526
2555
|
let e = (await this.getProps()).fullscreen;
|
|
2527
2556
|
this.fullscreenPoll = setInterval(() => {
|
|
2528
2557
|
this.win.isFullscreen().then((i) => {
|
|
@@ -2537,40 +2566,40 @@ class Se {
|
|
|
2537
2566
|
"WHITELIST"
|
|
2538
2567
|
).catch(console.error));
|
|
2539
2568
|
}).catch(console.error);
|
|
2540
|
-
},
|
|
2569
|
+
}, me.milliseconds);
|
|
2541
2570
|
}
|
|
2542
2571
|
label() {
|
|
2543
2572
|
return this.win.label;
|
|
2544
2573
|
}
|
|
2545
2574
|
isMain() {
|
|
2546
|
-
return this.win.label ===
|
|
2575
|
+
return this.win.label === ie;
|
|
2547
2576
|
}
|
|
2548
2577
|
release() {
|
|
2549
|
-
Object.values(this.unsubscribe).forEach((e) => e
|
|
2578
|
+
Object.values(this.unsubscribe).forEach((e) => e?.()), this.fullscreenPoll != null && clearInterval(this.fullscreenPoll), this.unsubscribe = {};
|
|
2550
2579
|
}
|
|
2551
2580
|
async emit(e, i, n = this.label()) {
|
|
2552
|
-
const l =
|
|
2553
|
-
if (i == null) return await
|
|
2554
|
-
const
|
|
2555
|
-
if (
|
|
2556
|
-
await
|
|
2581
|
+
const l = de({ ...e, emitter: n });
|
|
2582
|
+
if (i == null) return await P(D, l);
|
|
2583
|
+
const o = await b.getByLabel(i);
|
|
2584
|
+
if (o == null) throw _e(i);
|
|
2585
|
+
await o.emit(D, l);
|
|
2557
2586
|
}
|
|
2558
2587
|
async subscribe(e) {
|
|
2559
|
-
this.release(), await this.startFullscreenPoll(), this.unsubscribe[
|
|
2560
|
-
|
|
2561
|
-
(n) => e(
|
|
2588
|
+
this.release(), await this.startFullscreenPoll(), this.unsubscribe[D] = await f(
|
|
2589
|
+
D,
|
|
2590
|
+
(n) => e(ye(n.payload))
|
|
2562
2591
|
);
|
|
2563
|
-
const i =
|
|
2564
|
-
for (const { key: n, handler: l, debounce:
|
|
2592
|
+
const i = De();
|
|
2593
|
+
for (const { key: n, handler: l, debounce: o } of i)
|
|
2565
2594
|
this.unsubscribe[n] = await this.win.listen(
|
|
2566
2595
|
n,
|
|
2567
|
-
|
|
2596
|
+
le(() => {
|
|
2568
2597
|
l(this.win).then((a) => {
|
|
2569
2598
|
a != null && this.emit({ action: a }, void 0, "WHITELIST").catch(
|
|
2570
2599
|
console.error
|
|
2571
2600
|
);
|
|
2572
2601
|
}).catch(console.error);
|
|
2573
|
-
},
|
|
2602
|
+
}, o)
|
|
2574
2603
|
);
|
|
2575
2604
|
}
|
|
2576
2605
|
onCloseRequested(e) {
|
|
@@ -2579,32 +2608,32 @@ class Se {
|
|
|
2579
2608
|
});
|
|
2580
2609
|
}
|
|
2581
2610
|
async create(e, i) {
|
|
2582
|
-
i =
|
|
2583
|
-
const { size: n, minSize: l, maxSize:
|
|
2584
|
-
|
|
2611
|
+
i = te.copy(i);
|
|
2612
|
+
const { size: n, minSize: l, maxSize: o, position: a, ...$ } = ve(i);
|
|
2613
|
+
n?.width != null && (n.width = Math.max(n.width, y)), n?.height != null && (n.height = Math.max(n.height, y)), o?.width != null && (o.width = Math.max(o.width, y)), o?.height != null && (o.height = Math.max(o.height, y)), a != null && (await V(a) || (a.x = 0, a.y = 0));
|
|
2585
2614
|
try {
|
|
2586
|
-
const p = new
|
|
2587
|
-
x: a
|
|
2588
|
-
y: a
|
|
2589
|
-
width: n
|
|
2590
|
-
height: n
|
|
2591
|
-
minWidth: l
|
|
2592
|
-
minHeight: l
|
|
2593
|
-
maxWidth:
|
|
2594
|
-
maxHeight:
|
|
2615
|
+
const p = new b(e, {
|
|
2616
|
+
x: a?.x,
|
|
2617
|
+
y: a?.y,
|
|
2618
|
+
width: n?.width,
|
|
2619
|
+
height: n?.height,
|
|
2620
|
+
minWidth: l?.width,
|
|
2621
|
+
minHeight: l?.height,
|
|
2622
|
+
maxWidth: o?.width,
|
|
2623
|
+
maxHeight: o?.height,
|
|
2595
2624
|
titleBarStyle: "overlay",
|
|
2596
2625
|
dragDropEnabled: !1,
|
|
2597
|
-
|
|
2626
|
+
...$
|
|
2598
2627
|
});
|
|
2599
|
-
return await new Promise((
|
|
2600
|
-
p.once(
|
|
2628
|
+
return await new Promise((K, Q) => {
|
|
2629
|
+
p.once(pe, (Y) => Q(new Error(JSON.stringify(Y.payload)))), p.once(ge, () => K());
|
|
2601
2630
|
});
|
|
2602
2631
|
} catch (p) {
|
|
2603
2632
|
console.error(p);
|
|
2604
2633
|
}
|
|
2605
2634
|
}
|
|
2606
2635
|
async close(e) {
|
|
2607
|
-
const i = await
|
|
2636
|
+
const i = await b.getByLabel(e);
|
|
2608
2637
|
if (i != null)
|
|
2609
2638
|
try {
|
|
2610
2639
|
await i.destroy();
|
|
@@ -2612,7 +2641,7 @@ class Se {
|
|
|
2612
2641
|
console.error(n, e);
|
|
2613
2642
|
}
|
|
2614
2643
|
else {
|
|
2615
|
-
const n = await
|
|
2644
|
+
const n = await O();
|
|
2616
2645
|
console.error(
|
|
2617
2646
|
"Window not found",
|
|
2618
2647
|
e,
|
|
@@ -2621,7 +2650,7 @@ class Se {
|
|
|
2621
2650
|
}
|
|
2622
2651
|
}
|
|
2623
2652
|
async listLabels() {
|
|
2624
|
-
return (await
|
|
2653
|
+
return (await O()).map((i) => i.label);
|
|
2625
2654
|
}
|
|
2626
2655
|
async focus() {
|
|
2627
2656
|
return await this.win.setFocus();
|
|
@@ -2643,20 +2672,19 @@ class Se {
|
|
|
2643
2672
|
}
|
|
2644
2673
|
async setPosition(e) {
|
|
2645
2674
|
const i = new N(e.x, e.y);
|
|
2646
|
-
await
|
|
2675
|
+
await V(e) || (i.x = 0, i.y = 0), await this.win.setPosition(i);
|
|
2647
2676
|
}
|
|
2648
2677
|
async setSize(e) {
|
|
2649
|
-
e =
|
|
2678
|
+
e = v(e), await this.win.setSize(new _(e.width, e.height));
|
|
2650
2679
|
}
|
|
2651
2680
|
async setMinSize(e) {
|
|
2652
|
-
e =
|
|
2681
|
+
e = v(e), await this.win.setMinSize(new _(e.width, e.height));
|
|
2653
2682
|
}
|
|
2654
2683
|
async setMaxSize(e) {
|
|
2655
|
-
e =
|
|
2684
|
+
e = v(e), await this.win.setMaxSize(new _(e.width, e.height));
|
|
2656
2685
|
}
|
|
2657
2686
|
async setResizable(e) {
|
|
2658
|
-
|
|
2659
|
-
return o.WINDOW_RESIZED in this.unsubscribe && !e && ((n = (i = this.unsubscribe)[o.WINDOW_RESIZED]) == null || n.call(i), delete this.unsubscribe[o.WINDOW_RESIZED]), await this.win.setResizable(e);
|
|
2687
|
+
return r.WINDOW_RESIZED in this.unsubscribe && !e && (this.unsubscribe[r.WINDOW_RESIZED]?.(), delete this.unsubscribe[r.WINDOW_RESIZED]), await this.win.setResizable(e);
|
|
2660
2688
|
}
|
|
2661
2689
|
async setSkipTaskbar(e) {
|
|
2662
2690
|
return await this.win.setSkipTaskbar(e);
|
|
@@ -2673,17 +2701,17 @@ class Se {
|
|
|
2673
2701
|
async getProps() {
|
|
2674
2702
|
const e = await this.win.scaleFactor(), i = await this.win.isVisible();
|
|
2675
2703
|
return {
|
|
2676
|
-
position:
|
|
2677
|
-
size:
|
|
2704
|
+
position: S(await this.win.innerPosition(), e),
|
|
2705
|
+
size: q(await this.win.innerSize(), e),
|
|
2678
2706
|
maximized: await this.win.isMaximized(),
|
|
2679
2707
|
visible: i,
|
|
2680
2708
|
fullscreen: await this.win.isFullscreen()
|
|
2681
2709
|
};
|
|
2682
2710
|
}
|
|
2683
2711
|
}
|
|
2684
|
-
const
|
|
2712
|
+
const De = () => [
|
|
2685
2713
|
{
|
|
2686
|
-
key:
|
|
2714
|
+
key: r.WINDOW_RESIZED,
|
|
2687
2715
|
debounce: 200,
|
|
2688
2716
|
handler: async (t) => {
|
|
2689
2717
|
const e = await t.scaleFactor(), i = await t.isVisible(), n = {
|
|
@@ -2691,19 +2719,19 @@ const ze = () => [
|
|
|
2691
2719
|
maximized: await t.isMaximized(),
|
|
2692
2720
|
visible: i,
|
|
2693
2721
|
minimized: !i,
|
|
2694
|
-
position:
|
|
2695
|
-
size:
|
|
2722
|
+
position: S(await t.innerPosition(), e),
|
|
2723
|
+
size: q(await t.innerSize(), e)
|
|
2696
2724
|
};
|
|
2697
2725
|
return g(n);
|
|
2698
2726
|
}
|
|
2699
2727
|
},
|
|
2700
2728
|
{
|
|
2701
|
-
key:
|
|
2729
|
+
key: r.WINDOW_MOVED,
|
|
2702
2730
|
debounce: 200,
|
|
2703
2731
|
handler: async (t) => {
|
|
2704
|
-
const e = await
|
|
2732
|
+
const e = await t?.scaleFactor();
|
|
2705
2733
|
if (e == null) return null;
|
|
2706
|
-
const i =
|
|
2734
|
+
const i = S(await t.innerPosition(), e), n = await t.isVisible(), l = {
|
|
2707
2735
|
label: t.label,
|
|
2708
2736
|
visible: n,
|
|
2709
2737
|
position: i
|
|
@@ -2712,12 +2740,12 @@ const ze = () => [
|
|
|
2712
2740
|
}
|
|
2713
2741
|
},
|
|
2714
2742
|
{
|
|
2715
|
-
key:
|
|
2743
|
+
key: r.WINDOW_BLUR,
|
|
2716
2744
|
debounce: 0,
|
|
2717
2745
|
handler: async (t) => g({ focus: !1, label: t.label })
|
|
2718
2746
|
},
|
|
2719
2747
|
{
|
|
2720
|
-
key:
|
|
2748
|
+
key: r.WINDOW_FOCUS,
|
|
2721
2749
|
debounce: 0,
|
|
2722
2750
|
handler: async (t) => g({
|
|
2723
2751
|
focus: !0,
|
|
@@ -2726,7 +2754,7 @@ const ze = () => [
|
|
|
2726
2754
|
label: t.label
|
|
2727
2755
|
})
|
|
2728
2756
|
}
|
|
2729
|
-
],
|
|
2757
|
+
], S = (t, e) => se.scale(t, 1 / e), q = (t, e) => ne.scale(t, 1 / e);
|
|
2730
2758
|
export {
|
|
2731
|
-
|
|
2759
|
+
Oe as TauriRuntime
|
|
2732
2760
|
};
|