@synnaxlabs/drift 0.52.3 → 0.53.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/index.cjs +1 -1
- package/dist/index.js +18 -18
- package/dist/react.cjs +1 -1
- package/dist/react.js +5 -5
- package/dist/{selectors-D1g2urZp.js → selectors-DZMH3BUG.js} +1 -1
- package/dist/{selectors-bSOXrqbl.cjs → selectors-xTfOgDbG.cjs} +1 -1
- package/dist/src/tauri/index.d.ts +3 -0
- package/dist/src/tauri/index.d.ts.map +1 -1
- package/dist/{state-CGc6dCmt.js → state-CAgVbv4Z.js} +1028 -932
- package/dist/{state-BFBdNgbN.cjs → state-CIOo9w2K.cjs} +9 -9
- package/dist/tauri.cjs +1 -1
- package/dist/tauri.js +118 -107
- package/package.json +3 -3
package/dist/tauri.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { K as
|
|
1
|
+
import { K as H, L as T, r as g, M as te, N as ne, Y as se, b as le, O as j, E as ae } from "./state-CAgVbv4Z.js";
|
|
2
2
|
function re(t, e, i, n) {
|
|
3
3
|
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");
|
|
4
4
|
return i === "m" ? n : i === "a" ? n.call(t) : n ? n.value : e.get(t);
|
|
@@ -37,24 +37,24 @@ var r;
|
|
|
37
37
|
(function(t) {
|
|
38
38
|
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";
|
|
39
39
|
})(r || (r = {}));
|
|
40
|
-
async function
|
|
40
|
+
async function J(t, e) {
|
|
41
41
|
window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(t, e), await s("plugin:event|unlisten", {
|
|
42
42
|
event: t,
|
|
43
43
|
eventId: e
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
async function
|
|
46
|
+
async function D(t, e, i) {
|
|
47
47
|
var n;
|
|
48
48
|
const l = typeof i?.target == "string" ? { kind: "AnyLabel", label: i.target } : (n = i?.target) !== null && n !== void 0 ? n : { kind: "Any" };
|
|
49
49
|
return s("plugin:event|listen", {
|
|
50
50
|
event: t,
|
|
51
51
|
target: l,
|
|
52
52
|
handler: ue(e)
|
|
53
|
-
}).then((o) => async () =>
|
|
53
|
+
}).then((o) => async () => J(t, o));
|
|
54
54
|
}
|
|
55
|
-
async function
|
|
56
|
-
return
|
|
57
|
-
|
|
55
|
+
async function N(t, e, i) {
|
|
56
|
+
return D(t, (n) => {
|
|
57
|
+
J(t, n.id), e(n);
|
|
58
58
|
}, i);
|
|
59
59
|
}
|
|
60
60
|
async function k(t, e) {
|
|
@@ -63,7 +63,7 @@ async function k(t, e) {
|
|
|
63
63
|
payload: e
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
async function
|
|
66
|
+
async function q(t, e, i) {
|
|
67
67
|
await s("plugin:event|emit_to", {
|
|
68
68
|
target: typeof t == "string" ? { kind: "AnyLabel", label: t } : t,
|
|
69
69
|
event: e,
|
|
@@ -152,7 +152,7 @@ class h {
|
|
|
152
152
|
return this[c]();
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
class
|
|
155
|
+
class L {
|
|
156
156
|
constructor(...e) {
|
|
157
157
|
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]);
|
|
158
158
|
}
|
|
@@ -204,7 +204,7 @@ class u {
|
|
|
204
204
|
* @since 2.0.0
|
|
205
205
|
*/
|
|
206
206
|
toLogical(e) {
|
|
207
|
-
return new
|
|
207
|
+
return new L(this.x / e, this.y / e);
|
|
208
208
|
}
|
|
209
209
|
[c]() {
|
|
210
210
|
return {
|
|
@@ -221,7 +221,7 @@ class d {
|
|
|
221
221
|
this.position = e;
|
|
222
222
|
}
|
|
223
223
|
toLogical(e) {
|
|
224
|
-
return this.position instanceof
|
|
224
|
+
return this.position instanceof L ? this.position : this.position.toLogical(e);
|
|
225
225
|
}
|
|
226
226
|
toPhysical(e) {
|
|
227
227
|
return this.position instanceof u ? this.position : this.position.toPhysical(e);
|
|
@@ -238,7 +238,7 @@ class d {
|
|
|
238
238
|
return this[c]();
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
class
|
|
241
|
+
class f extends ce {
|
|
242
242
|
/**
|
|
243
243
|
* Creates an Image from a resource ID. For internal use only.
|
|
244
244
|
*
|
|
@@ -250,10 +250,10 @@ class v extends ce {
|
|
|
250
250
|
/** Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height. */
|
|
251
251
|
static async new(e, i, n) {
|
|
252
252
|
return s("plugin:image|new", {
|
|
253
|
-
rgba:
|
|
253
|
+
rgba: O(e),
|
|
254
254
|
width: i,
|
|
255
255
|
height: n
|
|
256
|
-
}).then((l) => new
|
|
256
|
+
}).then((l) => new f(l));
|
|
257
257
|
}
|
|
258
258
|
/**
|
|
259
259
|
* Creates a new image using the provided bytes by inferring the file format.
|
|
@@ -270,8 +270,8 @@ class v extends ce {
|
|
|
270
270
|
*/
|
|
271
271
|
static async fromBytes(e) {
|
|
272
272
|
return s("plugin:image|from_bytes", {
|
|
273
|
-
bytes:
|
|
274
|
-
}).then((i) => new
|
|
273
|
+
bytes: O(e)
|
|
274
|
+
}).then((i) => new f(i));
|
|
275
275
|
}
|
|
276
276
|
/**
|
|
277
277
|
* Creates a new image using the provided path.
|
|
@@ -286,7 +286,7 @@ class v extends ce {
|
|
|
286
286
|
* ```
|
|
287
287
|
*/
|
|
288
288
|
static async fromPath(e) {
|
|
289
|
-
return s("plugin:image|from_path", { path: e }).then((i) => new
|
|
289
|
+
return s("plugin:image|from_path", { path: e }).then((i) => new f(i));
|
|
290
290
|
}
|
|
291
291
|
/** Returns the RGBA data for this image, in row-major order from top to bottom. */
|
|
292
292
|
async rgba() {
|
|
@@ -299,13 +299,13 @@ class v extends ce {
|
|
|
299
299
|
return s("plugin:image|size", { rid: this.rid });
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
|
-
function
|
|
303
|
-
return t == null ? null : typeof t == "string" ? t : t instanceof
|
|
302
|
+
function O(t) {
|
|
303
|
+
return t == null ? null : typeof t == "string" ? t : t instanceof f ? t.rid : t;
|
|
304
304
|
}
|
|
305
|
-
var
|
|
305
|
+
var R;
|
|
306
306
|
(function(t) {
|
|
307
307
|
t[t.Critical = 1] = "Critical", t[t.Informational = 2] = "Informational";
|
|
308
|
-
})(
|
|
308
|
+
})(R || (R = {}));
|
|
309
309
|
class he {
|
|
310
310
|
constructor(e) {
|
|
311
311
|
this._preventDefault = !1, this.event = e.event, this.id = e.id;
|
|
@@ -317,24 +317,24 @@ class he {
|
|
|
317
317
|
return this._preventDefault;
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
|
-
var
|
|
320
|
+
var M;
|
|
321
321
|
(function(t) {
|
|
322
322
|
t.None = "none", t.Normal = "normal", t.Indeterminate = "indeterminate", t.Paused = "paused", t.Error = "error";
|
|
323
|
-
})(
|
|
324
|
-
function
|
|
325
|
-
return new
|
|
323
|
+
})(M || (M = {}));
|
|
324
|
+
function Z() {
|
|
325
|
+
return new P(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {
|
|
326
326
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
327
327
|
skip: !0
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
|
-
async function
|
|
331
|
-
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new
|
|
330
|
+
async function I() {
|
|
331
|
+
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new P(e, {
|
|
332
332
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
333
333
|
skip: !0
|
|
334
334
|
})));
|
|
335
335
|
}
|
|
336
|
-
const
|
|
337
|
-
class
|
|
336
|
+
const E = ["tauri://created", "tauri://error"];
|
|
337
|
+
class P {
|
|
338
338
|
/**
|
|
339
339
|
* Creates a new Window.
|
|
340
340
|
* @example
|
|
@@ -375,19 +375,19 @@ class x {
|
|
|
375
375
|
*/
|
|
376
376
|
static async getByLabel(e) {
|
|
377
377
|
var i;
|
|
378
|
-
return (i = (await
|
|
378
|
+
return (i = (await I()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
|
|
379
379
|
}
|
|
380
380
|
/**
|
|
381
381
|
* Get an instance of `Window` for the current window.
|
|
382
382
|
*/
|
|
383
383
|
static getCurrent() {
|
|
384
|
-
return
|
|
384
|
+
return Z();
|
|
385
385
|
}
|
|
386
386
|
/**
|
|
387
387
|
* Gets a list of instances of `Window` for all available windows.
|
|
388
388
|
*/
|
|
389
389
|
static async getAll() {
|
|
390
|
-
return
|
|
390
|
+
return I();
|
|
391
391
|
}
|
|
392
392
|
/**
|
|
393
393
|
* Gets the focused window.
|
|
@@ -400,7 +400,7 @@ class x {
|
|
|
400
400
|
* @returns The Window instance or `undefined` if there is not any focused window.
|
|
401
401
|
*/
|
|
402
402
|
static async getFocusedWindow() {
|
|
403
|
-
for (const e of await
|
|
403
|
+
for (const e of await I())
|
|
404
404
|
if (await e.isFocused())
|
|
405
405
|
return e;
|
|
406
406
|
return null;
|
|
@@ -428,7 +428,7 @@ class x {
|
|
|
428
428
|
return this._handleTauriEvent(e, i) ? () => {
|
|
429
429
|
const n = this.listeners[e];
|
|
430
430
|
n.splice(n.indexOf(i), 1);
|
|
431
|
-
} :
|
|
431
|
+
} : D(e, i, {
|
|
432
432
|
target: { kind: "Window", label: this.label }
|
|
433
433
|
});
|
|
434
434
|
}
|
|
@@ -455,7 +455,7 @@ class x {
|
|
|
455
455
|
return this._handleTauriEvent(e, i) ? () => {
|
|
456
456
|
const n = this.listeners[e];
|
|
457
457
|
n.splice(n.indexOf(i), 1);
|
|
458
|
-
} :
|
|
458
|
+
} : N(e, i, {
|
|
459
459
|
target: { kind: "Window", label: this.label }
|
|
460
460
|
});
|
|
461
461
|
}
|
|
@@ -471,7 +471,7 @@ class x {
|
|
|
471
471
|
* @param payload Event payload.
|
|
472
472
|
*/
|
|
473
473
|
async emit(e, i) {
|
|
474
|
-
if (
|
|
474
|
+
if (E.includes(e)) {
|
|
475
475
|
for (const n of this.listeners[e] || [])
|
|
476
476
|
n({
|
|
477
477
|
event: e,
|
|
@@ -495,7 +495,7 @@ class x {
|
|
|
495
495
|
* @param payload Event payload.
|
|
496
496
|
*/
|
|
497
497
|
async emitTo(e, i, n) {
|
|
498
|
-
if (
|
|
498
|
+
if (E.includes(i)) {
|
|
499
499
|
for (const l of this.listeners[i] || [])
|
|
500
500
|
l({
|
|
501
501
|
event: i,
|
|
@@ -504,11 +504,11 @@ class x {
|
|
|
504
504
|
});
|
|
505
505
|
return;
|
|
506
506
|
}
|
|
507
|
-
return
|
|
507
|
+
return q(e, i, n);
|
|
508
508
|
}
|
|
509
509
|
/** @ignore */
|
|
510
510
|
_handleTauriEvent(e, i) {
|
|
511
|
-
return
|
|
511
|
+
return E.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
|
|
512
512
|
}
|
|
513
513
|
// Getters
|
|
514
514
|
/**
|
|
@@ -837,7 +837,7 @@ class x {
|
|
|
837
837
|
*/
|
|
838
838
|
async requestUserAttention(e) {
|
|
839
839
|
let i = null;
|
|
840
|
-
return e && (e ===
|
|
840
|
+
return e && (e === R.Critical ? i = { type: "Critical" } : i = { type: "Informational" }), s("plugin:window|request_user_attention", {
|
|
841
841
|
label: this.label,
|
|
842
842
|
value: i
|
|
843
843
|
});
|
|
@@ -1407,7 +1407,7 @@ class x {
|
|
|
1407
1407
|
async setIcon(e) {
|
|
1408
1408
|
return s("plugin:window|set_icon", {
|
|
1409
1409
|
label: this.label,
|
|
1410
|
-
value:
|
|
1410
|
+
value: O(e)
|
|
1411
1411
|
});
|
|
1412
1412
|
}
|
|
1413
1413
|
/**
|
|
@@ -1642,7 +1642,7 @@ class x {
|
|
|
1642
1642
|
async setOverlayIcon(e) {
|
|
1643
1643
|
return s("plugin:window|set_overlay_icon", {
|
|
1644
1644
|
label: this.label,
|
|
1645
|
-
value: e ?
|
|
1645
|
+
value: e ? O(e) : void 0
|
|
1646
1646
|
});
|
|
1647
1647
|
}
|
|
1648
1648
|
/**
|
|
@@ -1916,22 +1916,22 @@ class x {
|
|
|
1916
1916
|
return this.listen(r.WINDOW_THEME_CHANGED, e);
|
|
1917
1917
|
}
|
|
1918
1918
|
}
|
|
1919
|
-
var
|
|
1919
|
+
var F;
|
|
1920
1920
|
(function(t) {
|
|
1921
1921
|
t.Disabled = "disabled", t.Throttle = "throttle", t.Suspend = "suspend";
|
|
1922
|
-
})(
|
|
1923
|
-
var
|
|
1922
|
+
})(F || (F = {}));
|
|
1923
|
+
var B;
|
|
1924
1924
|
(function(t) {
|
|
1925
1925
|
t.Default = "default", t.FluentOverlay = "fluentOverlay";
|
|
1926
|
-
})(
|
|
1927
|
-
var
|
|
1926
|
+
})(B || (B = {}));
|
|
1927
|
+
var V;
|
|
1928
1928
|
(function(t) {
|
|
1929
1929
|
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";
|
|
1930
|
-
})(
|
|
1931
|
-
var
|
|
1930
|
+
})(V || (V = {}));
|
|
1931
|
+
var U;
|
|
1932
1932
|
(function(t) {
|
|
1933
1933
|
t.FollowsWindowActiveState = "followsWindowActiveState", t.Active = "active", t.Inactive = "inactive";
|
|
1934
|
-
})(
|
|
1934
|
+
})(U || (U = {}));
|
|
1935
1935
|
function we(t) {
|
|
1936
1936
|
return t === null ? null : {
|
|
1937
1937
|
name: t.name,
|
|
@@ -1947,14 +1947,14 @@ function we(t) {
|
|
|
1947
1947
|
async function be() {
|
|
1948
1948
|
return s("plugin:window|available_monitors").then((t) => t.map(we));
|
|
1949
1949
|
}
|
|
1950
|
-
function
|
|
1951
|
-
return new
|
|
1950
|
+
function Y() {
|
|
1951
|
+
return new C(Z(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, {
|
|
1952
1952
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
1953
1953
|
skip: !0
|
|
1954
1954
|
});
|
|
1955
1955
|
}
|
|
1956
|
-
async function
|
|
1957
|
-
return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new
|
|
1956
|
+
async function G() {
|
|
1957
|
+
return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new C(new P(e.windowLabel, {
|
|
1958
1958
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
1959
1959
|
skip: !0
|
|
1960
1960
|
}), e.label, {
|
|
@@ -1963,7 +1963,7 @@ async function V() {
|
|
|
1963
1963
|
})));
|
|
1964
1964
|
}
|
|
1965
1965
|
const A = ["tauri://created", "tauri://error"];
|
|
1966
|
-
class
|
|
1966
|
+
class C {
|
|
1967
1967
|
/**
|
|
1968
1968
|
* Creates a new Webview.
|
|
1969
1969
|
* @example
|
|
@@ -2018,19 +2018,19 @@ class L {
|
|
|
2018
2018
|
*/
|
|
2019
2019
|
static async getByLabel(e) {
|
|
2020
2020
|
var i;
|
|
2021
|
-
return (i = (await
|
|
2021
|
+
return (i = (await G()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
|
|
2022
2022
|
}
|
|
2023
2023
|
/**
|
|
2024
2024
|
* Get an instance of `Webview` for the current webview.
|
|
2025
2025
|
*/
|
|
2026
2026
|
static getCurrent() {
|
|
2027
|
-
return
|
|
2027
|
+
return Y();
|
|
2028
2028
|
}
|
|
2029
2029
|
/**
|
|
2030
2030
|
* Gets a list of instances of `Webview` for all available webviews.
|
|
2031
2031
|
*/
|
|
2032
2032
|
static async getAll() {
|
|
2033
|
-
return
|
|
2033
|
+
return G();
|
|
2034
2034
|
}
|
|
2035
2035
|
/**
|
|
2036
2036
|
* Listen to an emitted event on this webview.
|
|
@@ -2055,7 +2055,7 @@ class L {
|
|
|
2055
2055
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2056
2056
|
const n = this.listeners[e];
|
|
2057
2057
|
n.splice(n.indexOf(i), 1);
|
|
2058
|
-
} :
|
|
2058
|
+
} : D(e, i, {
|
|
2059
2059
|
target: { kind: "Webview", label: this.label }
|
|
2060
2060
|
});
|
|
2061
2061
|
}
|
|
@@ -2082,7 +2082,7 @@ class L {
|
|
|
2082
2082
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2083
2083
|
const n = this.listeners[e];
|
|
2084
2084
|
n.splice(n.indexOf(i), 1);
|
|
2085
|
-
} :
|
|
2085
|
+
} : N(e, i, {
|
|
2086
2086
|
target: { kind: "Webview", label: this.label }
|
|
2087
2087
|
});
|
|
2088
2088
|
}
|
|
@@ -2133,7 +2133,7 @@ class L {
|
|
|
2133
2133
|
});
|
|
2134
2134
|
return;
|
|
2135
2135
|
}
|
|
2136
|
-
return
|
|
2136
|
+
return q(e, i, n);
|
|
2137
2137
|
}
|
|
2138
2138
|
/** @ignore */
|
|
2139
2139
|
_handleTauriEvent(e, i) {
|
|
@@ -2408,11 +2408,11 @@ class L {
|
|
|
2408
2408
|
};
|
|
2409
2409
|
}
|
|
2410
2410
|
}
|
|
2411
|
-
function
|
|
2412
|
-
const t =
|
|
2411
|
+
function $() {
|
|
2412
|
+
const t = Y();
|
|
2413
2413
|
return new b(t.label, { skip: !0 });
|
|
2414
2414
|
}
|
|
2415
|
-
async function
|
|
2415
|
+
async function S() {
|
|
2416
2416
|
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new b(e, {
|
|
2417
2417
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
2418
2418
|
skip: !0
|
|
@@ -2461,20 +2461,20 @@ class b {
|
|
|
2461
2461
|
*/
|
|
2462
2462
|
static async getByLabel(e) {
|
|
2463
2463
|
var i;
|
|
2464
|
-
const n = (i = (await
|
|
2464
|
+
const n = (i = (await S()).find((l) => l.label === e)) !== null && i !== void 0 ? i : null;
|
|
2465
2465
|
return n ? new b(n.label, { skip: !0 }) : null;
|
|
2466
2466
|
}
|
|
2467
2467
|
/**
|
|
2468
2468
|
* Get an instance of `Webview` for the current webview.
|
|
2469
2469
|
*/
|
|
2470
2470
|
static getCurrent() {
|
|
2471
|
-
return
|
|
2471
|
+
return $();
|
|
2472
2472
|
}
|
|
2473
2473
|
/**
|
|
2474
2474
|
* Gets a list of instances of `Webview` for all available webviews.
|
|
2475
2475
|
*/
|
|
2476
2476
|
static async getAll() {
|
|
2477
|
-
return
|
|
2477
|
+
return S();
|
|
2478
2478
|
}
|
|
2479
2479
|
/**
|
|
2480
2480
|
* Listen to an emitted event on this webview window.
|
|
@@ -2499,7 +2499,7 @@ class b {
|
|
|
2499
2499
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2500
2500
|
const n = this.listeners[e];
|
|
2501
2501
|
n.splice(n.indexOf(i), 1);
|
|
2502
|
-
} :
|
|
2502
|
+
} : D(e, i, {
|
|
2503
2503
|
target: { kind: "WebviewWindow", label: this.label }
|
|
2504
2504
|
});
|
|
2505
2505
|
}
|
|
@@ -2526,7 +2526,7 @@ class b {
|
|
|
2526
2526
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2527
2527
|
const n = this.listeners[e];
|
|
2528
2528
|
n.splice(n.indexOf(i), 1);
|
|
2529
|
-
} :
|
|
2529
|
+
} : N(e, i, {
|
|
2530
2530
|
target: { kind: "WebviewWindow", label: this.label }
|
|
2531
2531
|
});
|
|
2532
2532
|
}
|
|
@@ -2550,7 +2550,7 @@ class b {
|
|
|
2550
2550
|
return s("plugin:window|set_background_color", { color: e }).then(() => s("plugin:webview|set_webview_background_color", { color: e }));
|
|
2551
2551
|
}
|
|
2552
2552
|
}
|
|
2553
|
-
de(b, [
|
|
2553
|
+
de(b, [P, C]);
|
|
2554
2554
|
function de(t, e) {
|
|
2555
2555
|
(Array.isArray(e) ? e : [e]).forEach((i) => {
|
|
2556
2556
|
Object.getOwnPropertyNames(i.prototype).forEach((n) => {
|
|
@@ -2564,35 +2564,36 @@ function de(t, e) {
|
|
|
2564
2564
|
});
|
|
2565
2565
|
});
|
|
2566
2566
|
}
|
|
2567
|
-
const ye = (t) => JSON.stringify(t), pe = (t) => JSON.parse(t),
|
|
2567
|
+
const ye = (t) => JSON.stringify(t), pe = (t) => JSON.parse(t), z = "drift://action", ge = "tauri://error", _e = "tauri://created", fe = (t) => new Error(`Window not found: ${t}`), y = 250, ve = H.seconds(1), me = H.seconds(1), v = (t) => {
|
|
2568
2568
|
if (t != null)
|
|
2569
2569
|
return {
|
|
2570
2570
|
width: Math.max(t.width, y),
|
|
2571
2571
|
height: Math.max(t.height, y)
|
|
2572
2572
|
};
|
|
2573
|
-
},
|
|
2573
|
+
}, De = (t) => {
|
|
2574
2574
|
const { size: e, maxSize: i } = t;
|
|
2575
|
-
return { ...t, maxSize:
|
|
2576
|
-
},
|
|
2577
|
-
const i =
|
|
2578
|
-
return
|
|
2579
|
-
}),
|
|
2580
|
-
class
|
|
2575
|
+
return { ...t, maxSize: v(i), size: v(e) };
|
|
2576
|
+
}, ze = async () => (await be()).map((e) => {
|
|
2577
|
+
const i = m(e.position, e.scaleFactor), n = { width: e.size.width, height: e.size.height };
|
|
2578
|
+
return j.construct(i, n);
|
|
2579
|
+
}), x = async (t) => (await ze()).some((i) => j.contains(i, t));
|
|
2580
|
+
class Se {
|
|
2581
2581
|
win;
|
|
2582
2582
|
unsubscribe;
|
|
2583
2583
|
fullscreenPoll = null;
|
|
2584
|
+
monitorChangePoll = null;
|
|
2584
2585
|
/**
|
|
2585
2586
|
* @param window - The WebviewWindow to use as the underlying engine for this runtime.
|
|
2586
2587
|
* This should not be set in 99% of cases. Only use this if you know what you're doing.
|
|
2587
2588
|
*/
|
|
2588
2589
|
constructor(e) {
|
|
2589
|
-
this.win = e ??
|
|
2590
|
+
this.win = e ?? $(), this.unsubscribe = {};
|
|
2590
2591
|
}
|
|
2591
2592
|
async configure() {
|
|
2592
|
-
await this.startFullscreenPoll();
|
|
2593
|
+
await this.startFullscreenPoll(), this.startMonitorChangePoll();
|
|
2593
2594
|
}
|
|
2594
2595
|
async startFullscreenPoll() {
|
|
2595
|
-
if (
|
|
2596
|
+
if (T.getOS() !== "macOS") return;
|
|
2596
2597
|
let e = (await this.getProps()).fullscreen;
|
|
2597
2598
|
this.fullscreenPoll != null && clearInterval(this.fullscreenPoll), this.fullscreenPoll = setInterval(() => {
|
|
2598
2599
|
this.win.isFullscreen().then((i) => {
|
|
@@ -2607,7 +2608,17 @@ class Oe {
|
|
|
2607
2608
|
"WHITELIST"
|
|
2608
2609
|
).catch(console.error));
|
|
2609
2610
|
}).catch(console.error);
|
|
2610
|
-
},
|
|
2611
|
+
}, ve.milliseconds);
|
|
2612
|
+
}
|
|
2613
|
+
startMonitorChangePoll() {
|
|
2614
|
+
T.getOS() !== "macOS" && (this.monitorChangePoll != null && clearInterval(this.monitorChangePoll), this.monitorChangePoll = setInterval(() => {
|
|
2615
|
+
this.repositionIfOffScreen().catch(console.error);
|
|
2616
|
+
}, me.milliseconds));
|
|
2617
|
+
}
|
|
2618
|
+
async repositionIfOffScreen() {
|
|
2619
|
+
if (await this.win.isMinimized()) return;
|
|
2620
|
+
const e = await this.win.scaleFactor(), i = m(await this.win.innerPosition(), e);
|
|
2621
|
+
await x(i) || await this.win.center();
|
|
2611
2622
|
}
|
|
2612
2623
|
label() {
|
|
2613
2624
|
return this.win.label;
|
|
@@ -2616,18 +2627,18 @@ class Oe {
|
|
|
2616
2627
|
return this.win.label === te;
|
|
2617
2628
|
}
|
|
2618
2629
|
release() {
|
|
2619
|
-
Object.values(this.unsubscribe).forEach((e) => e?.()), this.fullscreenPoll != null && clearInterval(this.fullscreenPoll), this.unsubscribe = {};
|
|
2630
|
+
Object.values(this.unsubscribe).forEach((e) => e?.()), this.fullscreenPoll != null && clearInterval(this.fullscreenPoll), this.monitorChangePoll != null && clearInterval(this.monitorChangePoll), this.unsubscribe = {};
|
|
2620
2631
|
}
|
|
2621
2632
|
async emit(e, i, n = this.label()) {
|
|
2622
2633
|
const l = ye({ ...e, emitter: n });
|
|
2623
|
-
if (i == null) return await k(
|
|
2634
|
+
if (i == null) return await k(z, l);
|
|
2624
2635
|
const o = await b.getByLabel(i);
|
|
2625
|
-
if (o == null) throw
|
|
2626
|
-
await o.emit(
|
|
2636
|
+
if (o == null) throw fe(i);
|
|
2637
|
+
await o.emit(z, l);
|
|
2627
2638
|
}
|
|
2628
2639
|
async subscribe(e) {
|
|
2629
|
-
this.release(), await this.startFullscreenPoll(), this.unsubscribe[
|
|
2630
|
-
|
|
2640
|
+
this.release(), await this.startFullscreenPoll(), this.startMonitorChangePoll(), this.unsubscribe[z] = await D(
|
|
2641
|
+
z,
|
|
2631
2642
|
(n) => e(pe(n.payload))
|
|
2632
2643
|
);
|
|
2633
2644
|
const i = We();
|
|
@@ -2650,8 +2661,8 @@ class Oe {
|
|
|
2650
2661
|
}
|
|
2651
2662
|
async create(e, i) {
|
|
2652
2663
|
i = se.copy(i);
|
|
2653
|
-
const { size: n, minSize: l, maxSize: o, position: a, ...
|
|
2654
|
-
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
|
|
2664
|
+
const { size: n, minSize: l, maxSize: o, position: a, ...Q } = De(i);
|
|
2665
|
+
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 x(a) || (a.x = 0, a.y = 0));
|
|
2655
2666
|
try {
|
|
2656
2667
|
const p = new b(e, {
|
|
2657
2668
|
x: a?.x,
|
|
@@ -2664,10 +2675,10 @@ class Oe {
|
|
|
2664
2675
|
maxHeight: o?.height,
|
|
2665
2676
|
titleBarStyle: "overlay",
|
|
2666
2677
|
dragDropEnabled: !1,
|
|
2667
|
-
...
|
|
2678
|
+
...Q
|
|
2668
2679
|
});
|
|
2669
|
-
return await new Promise((
|
|
2670
|
-
p.once(ge, (
|
|
2680
|
+
return await new Promise((X, ee) => {
|
|
2681
|
+
p.once(ge, (ie) => ee(new Error(JSON.stringify(ie.payload)))), p.once(_e, () => X());
|
|
2671
2682
|
});
|
|
2672
2683
|
} catch (p) {
|
|
2673
2684
|
console.error(p);
|
|
@@ -2682,7 +2693,7 @@ class Oe {
|
|
|
2682
2693
|
console.error(n, e);
|
|
2683
2694
|
}
|
|
2684
2695
|
else {
|
|
2685
|
-
const n = await
|
|
2696
|
+
const n = await S();
|
|
2686
2697
|
console.error(
|
|
2687
2698
|
"Window not found",
|
|
2688
2699
|
e,
|
|
@@ -2691,7 +2702,7 @@ class Oe {
|
|
|
2691
2702
|
}
|
|
2692
2703
|
}
|
|
2693
2704
|
async listLabels() {
|
|
2694
|
-
return (await
|
|
2705
|
+
return (await S()).map((i) => i.label);
|
|
2695
2706
|
}
|
|
2696
2707
|
async focus() {
|
|
2697
2708
|
return await this.win.setFocus();
|
|
@@ -2712,17 +2723,17 @@ class Oe {
|
|
|
2712
2723
|
return await this.win.center();
|
|
2713
2724
|
}
|
|
2714
2725
|
async setPosition(e) {
|
|
2715
|
-
const i = new
|
|
2716
|
-
await
|
|
2726
|
+
const i = new L(e.x, e.y);
|
|
2727
|
+
await x(e) || (i.x = 0, i.y = 0), await this.win.setPosition(i);
|
|
2717
2728
|
}
|
|
2718
2729
|
async setSize(e) {
|
|
2719
|
-
e =
|
|
2730
|
+
e = v(e), await this.win.setSize(new _(e.width, e.height));
|
|
2720
2731
|
}
|
|
2721
2732
|
async setMinSize(e) {
|
|
2722
|
-
e =
|
|
2733
|
+
e = v(e), await this.win.setMinSize(new _(e.width, e.height));
|
|
2723
2734
|
}
|
|
2724
2735
|
async setMaxSize(e) {
|
|
2725
|
-
e =
|
|
2736
|
+
e = v(e), await this.win.setMaxSize(new _(e.width, e.height));
|
|
2726
2737
|
}
|
|
2727
2738
|
async setResizable(e) {
|
|
2728
2739
|
return r.WINDOW_RESIZED in this.unsubscribe && !e && (this.unsubscribe[r.WINDOW_RESIZED]?.(), delete this.unsubscribe[r.WINDOW_RESIZED]), await this.win.setResizable(e);
|
|
@@ -2742,8 +2753,8 @@ class Oe {
|
|
|
2742
2753
|
async getProps() {
|
|
2743
2754
|
const e = await this.win.scaleFactor(), i = await this.win.isVisible();
|
|
2744
2755
|
return {
|
|
2745
|
-
position:
|
|
2746
|
-
size:
|
|
2756
|
+
position: m(await this.win.innerPosition(), e),
|
|
2757
|
+
size: K(await this.win.innerSize(), e),
|
|
2747
2758
|
maximized: await this.win.isMaximized(),
|
|
2748
2759
|
visible: i,
|
|
2749
2760
|
fullscreen: await this.win.isFullscreen()
|
|
@@ -2760,8 +2771,8 @@ const We = () => [
|
|
|
2760
2771
|
maximized: await t.isMaximized(),
|
|
2761
2772
|
visible: i,
|
|
2762
2773
|
minimized: !i,
|
|
2763
|
-
position:
|
|
2764
|
-
size:
|
|
2774
|
+
position: m(await t.innerPosition(), e),
|
|
2775
|
+
size: K(await t.innerSize(), e)
|
|
2765
2776
|
};
|
|
2766
2777
|
return g(n);
|
|
2767
2778
|
}
|
|
@@ -2772,7 +2783,7 @@ const We = () => [
|
|
|
2772
2783
|
handler: async (t) => {
|
|
2773
2784
|
const e = await t?.scaleFactor();
|
|
2774
2785
|
if (e == null) return null;
|
|
2775
|
-
const i =
|
|
2786
|
+
const i = m(await t.innerPosition(), e), n = await t.isVisible(), l = {
|
|
2776
2787
|
label: t.label,
|
|
2777
2788
|
visible: n,
|
|
2778
2789
|
position: i
|
|
@@ -2795,7 +2806,7 @@ const We = () => [
|
|
|
2795
2806
|
label: t.label
|
|
2796
2807
|
})
|
|
2797
2808
|
}
|
|
2798
|
-
],
|
|
2809
|
+
], m = (t, e) => le.scale(t, 1 / e), K = (t, e) => ae.scale(t, 1 / e);
|
|
2799
2810
|
export {
|
|
2800
|
-
|
|
2811
|
+
Se as TauriRuntime
|
|
2801
2812
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synnaxlabs/drift",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.53.0",
|
|
4
4
|
"description": "State synchronization and Redux state synchronization for Tauri Apps",
|
|
5
5
|
"repository": "https://github.com/synnaxlabs/synnax/tree/main/drift",
|
|
6
6
|
"type": "module",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"react-dom": "^19.2.4",
|
|
22
22
|
"react-redux": "^9.2.0",
|
|
23
23
|
"zod": "^4.3.6",
|
|
24
|
-
"@synnaxlabs/x": "^0.
|
|
24
|
+
"@synnaxlabs/x": "^0.53.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "^25.1.0",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"typescript": "^5.9.3",
|
|
37
37
|
"vite": "^7.3.1",
|
|
38
38
|
"vitest": "^3.2.4",
|
|
39
|
-
"@synnaxlabs/eslint-config": "^0.0.0",
|
|
40
39
|
"@synnaxlabs/tsconfig": "^0.0.0",
|
|
40
|
+
"@synnaxlabs/eslint-config": "^0.0.0",
|
|
41
41
|
"@synnaxlabs/vite-plugin": "^0.0.0"
|
|
42
42
|
},
|
|
43
43
|
"files": [
|