@synnaxlabs/drift 0.38.0 → 0.39.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 +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +138 -138
- package/dist/react.cjs +1 -1
- package/dist/react.js +32 -32
- package/dist/{selectors-DSYdcjUd.cjs → selectors-BOlMfPQR.cjs} +1 -1
- package/dist/{selectors-CDBV8JlK.js → selectors-ChR2waHK.js} +1 -1
- package/dist/src/configureStore.d.ts.map +1 -1
- package/dist/src/debug.d.ts.map +1 -1
- package/dist/src/electron/index.d.ts.map +1 -1
- package/dist/src/middleware.d.ts.map +1 -1
- package/dist/src/react/Provider.d.ts.map +1 -1
- package/dist/src/react/hooks.d.ts.map +1 -1
- package/dist/src/react/selectors.d.ts.map +1 -1
- package/dist/src/selectors.d.ts.map +1 -1
- package/dist/src/serialization/index.d.ts.map +1 -1
- package/dist/src/state.d.ts.map +1 -1
- package/dist/src/sugar.d.ts.map +1 -1
- package/dist/src/sync.d.ts.map +1 -1
- package/dist/src/tauri/index.d.ts.map +1 -1
- package/dist/src/validate.d.ts.map +1 -1
- package/dist/state-5JemPjJN.cjs +13 -0
- package/dist/{state-B6yPmERI.js → state-B4NiJdX7.js} +1319 -1346
- package/dist/tauri.cjs +1 -1
- package/dist/tauri.js +108 -103
- package/package.json +12 -11
- package/dist/state--TjGqMVk.cjs +0 -13
package/dist/tauri.js
CHANGED
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var D = (t, e, i) =>
|
|
4
|
-
import { H as
|
|
5
|
-
import { o as
|
|
6
|
-
function
|
|
7
|
-
if (
|
|
8
|
-
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");
|
|
1
|
+
var ee = Object.defineProperty;
|
|
2
|
+
var ie = (t, e, i) => e in t ? ee(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
|
|
3
|
+
var D = (t, e, i) => ie(t, typeof e != "symbol" ? e + "" : e, i);
|
|
4
|
+
import { H as te, J as ne, r as g, M as se, K as le, _ as ae, G as re, L as H } from "./state-B4NiJdX7.js";
|
|
5
|
+
import { o as oe } from "./debounce-DOZKRZa9.js";
|
|
6
|
+
function ue(t, e, i, n) {
|
|
7
|
+
if (typeof e == "function" ? t !== e || !0 : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
9
8
|
return i === "m" ? n : i === "a" ? n.call(t) : n ? n.value : e.get(t);
|
|
10
9
|
}
|
|
11
|
-
function
|
|
10
|
+
function ce(t, e, i, n, l) {
|
|
12
11
|
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");
|
|
13
12
|
return e.set(t, i), i;
|
|
14
13
|
}
|
|
15
14
|
var O;
|
|
16
15
|
const c = "__TAURI_TO_IPC_KEY__";
|
|
17
|
-
function
|
|
16
|
+
function he(t, e = !1) {
|
|
18
17
|
return window.__TAURI_INTERNALS__.transformCallback(t, e);
|
|
19
18
|
}
|
|
20
19
|
async function s(t, e = {}, i) {
|
|
21
20
|
return window.__TAURI_INTERNALS__.invoke(t, e, i);
|
|
22
21
|
}
|
|
23
|
-
class
|
|
22
|
+
class we {
|
|
24
23
|
get rid() {
|
|
25
|
-
return
|
|
24
|
+
return ue(this, O, "f");
|
|
26
25
|
}
|
|
27
26
|
constructor(e) {
|
|
28
|
-
O.set(this, void 0),
|
|
27
|
+
O.set(this, void 0), ce(this, O, e);
|
|
29
28
|
}
|
|
30
29
|
/**
|
|
31
30
|
* Destroys and cleans up this resource from memory.
|
|
@@ -42,24 +41,24 @@ var o;
|
|
|
42
41
|
(function(t) {
|
|
43
42
|
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";
|
|
44
43
|
})(o || (o = {}));
|
|
45
|
-
async function
|
|
44
|
+
async function U(t, e) {
|
|
46
45
|
await s("plugin:event|unlisten", {
|
|
47
46
|
event: t,
|
|
48
47
|
eventId: e
|
|
49
48
|
});
|
|
50
49
|
}
|
|
51
|
-
async function
|
|
50
|
+
async function m(t, e, i) {
|
|
52
51
|
var n;
|
|
53
52
|
const l = typeof (i == null ? void 0 : i.target) == "string" ? { kind: "AnyLabel", label: i.target } : (n = i == null ? void 0 : i.target) !== null && n !== void 0 ? n : { kind: "Any" };
|
|
54
53
|
return s("plugin:event|listen", {
|
|
55
54
|
event: t,
|
|
56
55
|
target: l,
|
|
57
|
-
handler:
|
|
58
|
-
}).then((r) => async () =>
|
|
56
|
+
handler: he(e)
|
|
57
|
+
}).then((r) => async () => U(t, r));
|
|
59
58
|
}
|
|
60
59
|
async function A(t, e, i) {
|
|
61
|
-
return
|
|
62
|
-
|
|
60
|
+
return m(t, (n) => {
|
|
61
|
+
U(t, n.id), e(n);
|
|
63
62
|
}, i);
|
|
64
63
|
}
|
|
65
64
|
async function L(t, e) {
|
|
@@ -68,7 +67,7 @@ async function L(t, e) {
|
|
|
68
67
|
payload: e
|
|
69
68
|
});
|
|
70
69
|
}
|
|
71
|
-
async function
|
|
70
|
+
async function j(t, e, i) {
|
|
72
71
|
await s("plugin:event|emit_to", {
|
|
73
72
|
target: typeof t == "string" ? { kind: "AnyLabel", label: t } : t,
|
|
74
73
|
event: e,
|
|
@@ -95,7 +94,7 @@ class _ {
|
|
|
95
94
|
* @since 2.0.0
|
|
96
95
|
*/
|
|
97
96
|
toPhysical(e) {
|
|
98
|
-
return new
|
|
97
|
+
return new b(this.width * e, this.height * e);
|
|
99
98
|
}
|
|
100
99
|
[c]() {
|
|
101
100
|
return {
|
|
@@ -107,7 +106,7 @@ class _ {
|
|
|
107
106
|
return this[c]();
|
|
108
107
|
}
|
|
109
108
|
}
|
|
110
|
-
class
|
|
109
|
+
class b {
|
|
111
110
|
constructor(...e) {
|
|
112
111
|
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]);
|
|
113
112
|
}
|
|
@@ -143,7 +142,7 @@ class h {
|
|
|
143
142
|
return this.size instanceof _ ? this.size : this.size.toLogical(e);
|
|
144
143
|
}
|
|
145
144
|
toPhysical(e) {
|
|
146
|
-
return this.size instanceof
|
|
145
|
+
return this.size instanceof b ? this.size : this.size.toPhysical(e);
|
|
147
146
|
}
|
|
148
147
|
[c]() {
|
|
149
148
|
return {
|
|
@@ -221,7 +220,7 @@ class u {
|
|
|
221
220
|
return this[c]();
|
|
222
221
|
}
|
|
223
222
|
}
|
|
224
|
-
class
|
|
223
|
+
class d {
|
|
225
224
|
constructor(e) {
|
|
226
225
|
this.position = e;
|
|
227
226
|
}
|
|
@@ -243,7 +242,7 @@ class b {
|
|
|
243
242
|
return this[c]();
|
|
244
243
|
}
|
|
245
244
|
}
|
|
246
|
-
class
|
|
245
|
+
class v extends we {
|
|
247
246
|
/**
|
|
248
247
|
* Creates an Image from a resource ID. For internal use only.
|
|
249
248
|
*
|
|
@@ -258,7 +257,7 @@ class f extends he {
|
|
|
258
257
|
rgba: z(e),
|
|
259
258
|
width: i,
|
|
260
259
|
height: n
|
|
261
|
-
}).then((l) => new
|
|
260
|
+
}).then((l) => new v(l));
|
|
262
261
|
}
|
|
263
262
|
/**
|
|
264
263
|
* Creates a new image using the provided bytes by inferring the file format.
|
|
@@ -276,7 +275,7 @@ class f extends he {
|
|
|
276
275
|
static async fromBytes(e) {
|
|
277
276
|
return s("plugin:image|from_bytes", {
|
|
278
277
|
bytes: z(e)
|
|
279
|
-
}).then((i) => new
|
|
278
|
+
}).then((i) => new v(i));
|
|
280
279
|
}
|
|
281
280
|
/**
|
|
282
281
|
* Creates a new image using the provided path.
|
|
@@ -291,7 +290,7 @@ class f extends he {
|
|
|
291
290
|
* ```
|
|
292
291
|
*/
|
|
293
292
|
static async fromPath(e) {
|
|
294
|
-
return s("plugin:image|from_path", { path: e }).then((i) => new
|
|
293
|
+
return s("plugin:image|from_path", { path: e }).then((i) => new v(i));
|
|
295
294
|
}
|
|
296
295
|
/** Returns the RGBA data for this image, in row-major order from top to bottom. */
|
|
297
296
|
async rgba() {
|
|
@@ -305,13 +304,13 @@ class f extends he {
|
|
|
305
304
|
}
|
|
306
305
|
}
|
|
307
306
|
function z(t) {
|
|
308
|
-
return t == null ? null : typeof t == "string" ? t : t instanceof
|
|
307
|
+
return t == null ? null : typeof t == "string" ? t : t instanceof v ? t.rid : t;
|
|
309
308
|
}
|
|
310
309
|
var k;
|
|
311
310
|
(function(t) {
|
|
312
311
|
t[t.Critical = 1] = "Critical", t[t.Informational = 2] = "Informational";
|
|
313
312
|
})(k || (k = {}));
|
|
314
|
-
class
|
|
313
|
+
class be {
|
|
315
314
|
constructor(e) {
|
|
316
315
|
this._preventDefault = !1, this.event = e.event, this.id = e.id;
|
|
317
316
|
}
|
|
@@ -326,20 +325,20 @@ var T;
|
|
|
326
325
|
(function(t) {
|
|
327
326
|
t.None = "none", t.Normal = "normal", t.Indeterminate = "indeterminate", t.Paused = "paused", t.Error = "error";
|
|
328
327
|
})(T || (T = {}));
|
|
329
|
-
function
|
|
330
|
-
return new
|
|
328
|
+
function J() {
|
|
329
|
+
return new S(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {
|
|
331
330
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
332
331
|
skip: !0
|
|
333
332
|
});
|
|
334
333
|
}
|
|
335
|
-
async function
|
|
336
|
-
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new
|
|
334
|
+
async function P() {
|
|
335
|
+
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new S(e, {
|
|
337
336
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
338
337
|
skip: !0
|
|
339
338
|
})));
|
|
340
339
|
}
|
|
341
|
-
const
|
|
342
|
-
class
|
|
340
|
+
const R = ["tauri://created", "tauri://error"];
|
|
341
|
+
class S {
|
|
343
342
|
/**
|
|
344
343
|
* Creates a new Window.
|
|
345
344
|
* @example
|
|
@@ -380,19 +379,19 @@ class P {
|
|
|
380
379
|
*/
|
|
381
380
|
static async getByLabel(e) {
|
|
382
381
|
var i;
|
|
383
|
-
return (i = (await
|
|
382
|
+
return (i = (await P()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
|
|
384
383
|
}
|
|
385
384
|
/**
|
|
386
385
|
* Get an instance of `Window` for the current window.
|
|
387
386
|
*/
|
|
388
387
|
static getCurrent() {
|
|
389
|
-
return
|
|
388
|
+
return J();
|
|
390
389
|
}
|
|
391
390
|
/**
|
|
392
391
|
* Gets a list of instances of `Window` for all available windows.
|
|
393
392
|
*/
|
|
394
393
|
static async getAll() {
|
|
395
|
-
return
|
|
394
|
+
return P();
|
|
396
395
|
}
|
|
397
396
|
/**
|
|
398
397
|
* Gets the focused window.
|
|
@@ -405,7 +404,7 @@ class P {
|
|
|
405
404
|
* @returns The Window instance or `undefined` if there is not any focused window.
|
|
406
405
|
*/
|
|
407
406
|
static async getFocusedWindow() {
|
|
408
|
-
for (const e of await
|
|
407
|
+
for (const e of await P())
|
|
409
408
|
if (await e.isFocused())
|
|
410
409
|
return e;
|
|
411
410
|
return null;
|
|
@@ -433,7 +432,7 @@ class P {
|
|
|
433
432
|
return this._handleTauriEvent(e, i) ? () => {
|
|
434
433
|
const n = this.listeners[e];
|
|
435
434
|
n.splice(n.indexOf(i), 1);
|
|
436
|
-
} :
|
|
435
|
+
} : m(e, i, {
|
|
437
436
|
target: { kind: "Window", label: this.label }
|
|
438
437
|
});
|
|
439
438
|
}
|
|
@@ -476,7 +475,7 @@ class P {
|
|
|
476
475
|
* @param payload Event payload.
|
|
477
476
|
*/
|
|
478
477
|
async emit(e, i) {
|
|
479
|
-
if (
|
|
478
|
+
if (R.includes(e)) {
|
|
480
479
|
for (const n of this.listeners[e] || [])
|
|
481
480
|
n({
|
|
482
481
|
event: e,
|
|
@@ -500,7 +499,7 @@ class P {
|
|
|
500
499
|
* @param payload Event payload.
|
|
501
500
|
*/
|
|
502
501
|
async emitTo(e, i, n) {
|
|
503
|
-
if (
|
|
502
|
+
if (R.includes(i)) {
|
|
504
503
|
for (const l of this.listeners[i] || [])
|
|
505
504
|
l({
|
|
506
505
|
event: i,
|
|
@@ -509,11 +508,11 @@ class P {
|
|
|
509
508
|
});
|
|
510
509
|
return;
|
|
511
510
|
}
|
|
512
|
-
return
|
|
511
|
+
return j(e, i, n);
|
|
513
512
|
}
|
|
514
513
|
/** @ignore */
|
|
515
514
|
_handleTauriEvent(e, i) {
|
|
516
|
-
return
|
|
515
|
+
return R.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
|
|
517
516
|
}
|
|
518
517
|
// Getters
|
|
519
518
|
/**
|
|
@@ -575,7 +574,7 @@ class P {
|
|
|
575
574
|
async innerSize() {
|
|
576
575
|
return s("plugin:window|inner_size", {
|
|
577
576
|
label: this.label
|
|
578
|
-
}).then((e) => new
|
|
577
|
+
}).then((e) => new b(e));
|
|
579
578
|
}
|
|
580
579
|
/**
|
|
581
580
|
* The physical size of the entire window.
|
|
@@ -591,7 +590,7 @@ class P {
|
|
|
591
590
|
async outerSize() {
|
|
592
591
|
return s("plugin:window|outer_size", {
|
|
593
592
|
label: this.label
|
|
594
|
-
}).then((e) => new
|
|
593
|
+
}).then((e) => new b(e));
|
|
595
594
|
}
|
|
596
595
|
/**
|
|
597
596
|
* Gets the window's current fullscreen state.
|
|
@@ -1303,7 +1302,7 @@ class P {
|
|
|
1303
1302
|
async setPosition(e) {
|
|
1304
1303
|
return s("plugin:window|set_position", {
|
|
1305
1304
|
label: this.label,
|
|
1306
|
-
value: e instanceof
|
|
1305
|
+
value: e instanceof d ? e : new d(e)
|
|
1307
1306
|
});
|
|
1308
1307
|
}
|
|
1309
1308
|
/**
|
|
@@ -1477,7 +1476,7 @@ class P {
|
|
|
1477
1476
|
async setCursorPosition(e) {
|
|
1478
1477
|
return s("plugin:window|set_cursor_position", {
|
|
1479
1478
|
label: this.label,
|
|
1480
|
-
value: e instanceof
|
|
1479
|
+
value: e instanceof d ? e : new d(e)
|
|
1481
1480
|
});
|
|
1482
1481
|
}
|
|
1483
1482
|
/**
|
|
@@ -1684,7 +1683,7 @@ class P {
|
|
|
1684
1683
|
*/
|
|
1685
1684
|
async onResized(e) {
|
|
1686
1685
|
return this.listen(o.WINDOW_RESIZED, (i) => {
|
|
1687
|
-
i.payload = new
|
|
1686
|
+
i.payload = new b(i.payload), e(i);
|
|
1688
1687
|
});
|
|
1689
1688
|
}
|
|
1690
1689
|
/**
|
|
@@ -1733,7 +1732,7 @@ class P {
|
|
|
1733
1732
|
*/
|
|
1734
1733
|
async onCloseRequested(e) {
|
|
1735
1734
|
return this.listen(o.WINDOW_CLOSE_REQUESTED, async (i) => {
|
|
1736
|
-
const n = new
|
|
1735
|
+
const n = new be(i);
|
|
1737
1736
|
await e(n), n.isPreventDefault() || await this.destroy();
|
|
1738
1737
|
});
|
|
1739
1738
|
}
|
|
@@ -1870,31 +1869,35 @@ class P {
|
|
|
1870
1869
|
}
|
|
1871
1870
|
var M;
|
|
1872
1871
|
(function(t) {
|
|
1873
|
-
t.
|
|
1872
|
+
t.Disabled = "disabled", t.Throttle = "throttle", t.Suspend = "suspend";
|
|
1874
1873
|
})(M || (M = {}));
|
|
1875
1874
|
var F;
|
|
1876
1875
|
(function(t) {
|
|
1877
|
-
t.
|
|
1876
|
+
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";
|
|
1878
1877
|
})(F || (F = {}));
|
|
1878
|
+
var B;
|
|
1879
|
+
(function(t) {
|
|
1880
|
+
t.FollowsWindowActiveState = "followsWindowActiveState", t.Active = "active", t.Inactive = "inactive";
|
|
1881
|
+
})(B || (B = {}));
|
|
1879
1882
|
function de(t) {
|
|
1880
1883
|
return t === null ? null : {
|
|
1881
1884
|
name: t.name,
|
|
1882
1885
|
scaleFactor: t.scaleFactor,
|
|
1883
1886
|
position: new u(t.position),
|
|
1884
|
-
size: new
|
|
1887
|
+
size: new b(t.size)
|
|
1885
1888
|
};
|
|
1886
1889
|
}
|
|
1887
|
-
async function
|
|
1890
|
+
async function ye() {
|
|
1888
1891
|
return s("plugin:window|available_monitors").then((t) => t.map(de));
|
|
1889
1892
|
}
|
|
1890
|
-
function
|
|
1891
|
-
return new C(
|
|
1893
|
+
function Z() {
|
|
1894
|
+
return new C(J(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, {
|
|
1892
1895
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
1893
1896
|
skip: !0
|
|
1894
1897
|
});
|
|
1895
1898
|
}
|
|
1896
|
-
async function
|
|
1897
|
-
return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new C(new
|
|
1899
|
+
async function V() {
|
|
1900
|
+
return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new C(new S(e.windowLabel, {
|
|
1898
1901
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
1899
1902
|
skip: !0
|
|
1900
1903
|
}), e.label, {
|
|
@@ -1946,19 +1949,19 @@ class C {
|
|
|
1946
1949
|
*/
|
|
1947
1950
|
static async getByLabel(e) {
|
|
1948
1951
|
var i;
|
|
1949
|
-
return (i = (await
|
|
1952
|
+
return (i = (await V()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
|
|
1950
1953
|
}
|
|
1951
1954
|
/**
|
|
1952
1955
|
* Get an instance of `Webview` for the current webview.
|
|
1953
1956
|
*/
|
|
1954
1957
|
static getCurrent() {
|
|
1955
|
-
return
|
|
1958
|
+
return Z();
|
|
1956
1959
|
}
|
|
1957
1960
|
/**
|
|
1958
1961
|
* Gets a list of instances of `Webview` for all available webviews.
|
|
1959
1962
|
*/
|
|
1960
1963
|
static async getAll() {
|
|
1961
|
-
return
|
|
1964
|
+
return V();
|
|
1962
1965
|
}
|
|
1963
1966
|
/**
|
|
1964
1967
|
* Listen to an emitted event on this webview.
|
|
@@ -1983,7 +1986,7 @@ class C {
|
|
|
1983
1986
|
return this._handleTauriEvent(e, i) ? () => {
|
|
1984
1987
|
const n = this.listeners[e];
|
|
1985
1988
|
n.splice(n.indexOf(i), 1);
|
|
1986
|
-
} :
|
|
1989
|
+
} : m(e, i, {
|
|
1987
1990
|
target: { kind: "Webview", label: this.label }
|
|
1988
1991
|
});
|
|
1989
1992
|
}
|
|
@@ -2061,7 +2064,7 @@ class C {
|
|
|
2061
2064
|
});
|
|
2062
2065
|
return;
|
|
2063
2066
|
}
|
|
2064
|
-
return
|
|
2067
|
+
return j(e, i, n);
|
|
2065
2068
|
}
|
|
2066
2069
|
/** @ignore */
|
|
2067
2070
|
_handleTauriEvent(e, i) {
|
|
@@ -2097,7 +2100,7 @@ class C {
|
|
|
2097
2100
|
async size() {
|
|
2098
2101
|
return s("plugin:webview|webview_size", {
|
|
2099
2102
|
label: this.label
|
|
2100
|
-
}).then((e) => new
|
|
2103
|
+
}).then((e) => new b(e));
|
|
2101
2104
|
}
|
|
2102
2105
|
// Setters
|
|
2103
2106
|
/**
|
|
@@ -2146,7 +2149,7 @@ class C {
|
|
|
2146
2149
|
async setPosition(e) {
|
|
2147
2150
|
return s("plugin:webview|set_webview_position", {
|
|
2148
2151
|
label: this.label,
|
|
2149
|
-
value: e instanceof
|
|
2152
|
+
value: e instanceof d ? e : new d(e)
|
|
2150
2153
|
});
|
|
2151
2154
|
}
|
|
2152
2155
|
/**
|
|
@@ -2320,8 +2323,8 @@ class C {
|
|
|
2320
2323
|
};
|
|
2321
2324
|
}
|
|
2322
2325
|
}
|
|
2323
|
-
function
|
|
2324
|
-
const t =
|
|
2326
|
+
function q() {
|
|
2327
|
+
const t = Z();
|
|
2325
2328
|
return new w(t.label, { skip: !0 });
|
|
2326
2329
|
}
|
|
2327
2330
|
async function E() {
|
|
@@ -2380,7 +2383,7 @@ class w {
|
|
|
2380
2383
|
* Get an instance of `Webview` for the current webview.
|
|
2381
2384
|
*/
|
|
2382
2385
|
static getCurrent() {
|
|
2383
|
-
return
|
|
2386
|
+
return q();
|
|
2384
2387
|
}
|
|
2385
2388
|
/**
|
|
2386
2389
|
* Gets a list of instances of `Webview` for all available webviews.
|
|
@@ -2411,7 +2414,7 @@ class w {
|
|
|
2411
2414
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2412
2415
|
const n = this.listeners[e];
|
|
2413
2416
|
n.splice(n.indexOf(i), 1);
|
|
2414
|
-
} :
|
|
2417
|
+
} : m(e, i, {
|
|
2415
2418
|
target: { kind: "WebviewWindow", label: this.label }
|
|
2416
2419
|
});
|
|
2417
2420
|
}
|
|
@@ -2462,8 +2465,8 @@ class w {
|
|
|
2462
2465
|
return s("plugin:window|set_background_color", { color: e }).then(() => s("plugin:webview|set_webview_background_color", { color: e }));
|
|
2463
2466
|
}
|
|
2464
2467
|
}
|
|
2465
|
-
|
|
2466
|
-
function
|
|
2468
|
+
pe(w, [S, C]);
|
|
2469
|
+
function pe(t, e) {
|
|
2467
2470
|
(Array.isArray(e) ? e : [e]).forEach((i) => {
|
|
2468
2471
|
Object.getOwnPropertyNames(i.prototype).forEach((n) => {
|
|
2469
2472
|
var l;
|
|
@@ -2476,19 +2479,19 @@ function ye(t, e) {
|
|
|
2476
2479
|
});
|
|
2477
2480
|
});
|
|
2478
2481
|
}
|
|
2479
|
-
const
|
|
2482
|
+
const ge = (t) => JSON.stringify(t), _e = (t) => JSON.parse(t), W = "drift://action", ve = "tauri://error", fe = "tauri://created", me = (t) => new Error(`Window not found: ${t}`), y = 250, De = te.seconds(1), f = (t) => {
|
|
2480
2483
|
if (t != null)
|
|
2481
2484
|
return {
|
|
2482
2485
|
width: Math.max(t.width, y),
|
|
2483
2486
|
height: Math.max(t.height, y)
|
|
2484
2487
|
};
|
|
2485
|
-
},
|
|
2488
|
+
}, We = (t) => {
|
|
2486
2489
|
const { size: e, maxSize: i } = t;
|
|
2487
|
-
return { ...t, maxSize:
|
|
2488
|
-
},
|
|
2490
|
+
return { ...t, maxSize: f(i), size: f(e) };
|
|
2491
|
+
}, Oe = async () => (await ye()).map((e) => {
|
|
2489
2492
|
const i = I(e.position, e.scaleFactor), n = { width: e.size.width, height: e.size.height };
|
|
2490
|
-
return
|
|
2491
|
-
}),
|
|
2493
|
+
return H.construct(i, n);
|
|
2494
|
+
}), G = async (t) => (await Oe()).some((i) => H.contains(i, t));
|
|
2492
2495
|
class Pe {
|
|
2493
2496
|
/**
|
|
2494
2497
|
* @param window - The WebviewWindow to use as the underlying engine for this runtime.
|
|
@@ -2498,13 +2501,13 @@ class Pe {
|
|
|
2498
2501
|
D(this, "win");
|
|
2499
2502
|
D(this, "unsubscribe");
|
|
2500
2503
|
D(this, "fullscreenPoll", null);
|
|
2501
|
-
this.win = e ??
|
|
2504
|
+
this.win = e ?? q(), this.unsubscribe = {};
|
|
2502
2505
|
}
|
|
2503
2506
|
async configure() {
|
|
2504
2507
|
await this.startFullscreenPoll();
|
|
2505
2508
|
}
|
|
2506
2509
|
async startFullscreenPoll() {
|
|
2507
|
-
if (
|
|
2510
|
+
if (ne.getOS() !== "macOS") return;
|
|
2508
2511
|
let e = (await this.getProps()).fullscreen;
|
|
2509
2512
|
this.fullscreenPoll = setInterval(() => {
|
|
2510
2513
|
this.win.isFullscreen().then((i) => {
|
|
@@ -2517,38 +2520,40 @@ class Pe {
|
|
|
2517
2520
|
},
|
|
2518
2521
|
void 0,
|
|
2519
2522
|
"WHITELIST"
|
|
2520
|
-
));
|
|
2523
|
+
).catch(console.error));
|
|
2521
2524
|
}).catch(console.error);
|
|
2522
|
-
},
|
|
2525
|
+
}, De.milliseconds);
|
|
2523
2526
|
}
|
|
2524
2527
|
label() {
|
|
2525
2528
|
return this.win.label;
|
|
2526
2529
|
}
|
|
2527
2530
|
isMain() {
|
|
2528
|
-
return this.win.label ===
|
|
2531
|
+
return this.win.label === se;
|
|
2529
2532
|
}
|
|
2530
2533
|
release() {
|
|
2531
2534
|
Object.values(this.unsubscribe).forEach((e) => e == null ? void 0 : e()), this.fullscreenPoll != null && clearInterval(this.fullscreenPoll), this.unsubscribe = {};
|
|
2532
2535
|
}
|
|
2533
2536
|
async emit(e, i, n = this.label()) {
|
|
2534
|
-
const l =
|
|
2537
|
+
const l = ge({ ...e, emitter: n });
|
|
2535
2538
|
if (i == null) return await L(W, l);
|
|
2536
2539
|
const r = await w.getByLabel(i);
|
|
2537
2540
|
if (r == null) throw me(i);
|
|
2538
2541
|
await r.emit(W, l);
|
|
2539
2542
|
}
|
|
2540
2543
|
async subscribe(e) {
|
|
2541
|
-
this.release(), await this.startFullscreenPoll(), this.unsubscribe[W] = await
|
|
2544
|
+
this.release(), await this.startFullscreenPoll(), this.unsubscribe[W] = await m(
|
|
2542
2545
|
W,
|
|
2543
|
-
(n) => e(
|
|
2546
|
+
(n) => e(_e(n.payload))
|
|
2544
2547
|
);
|
|
2545
|
-
const i =
|
|
2548
|
+
const i = ze();
|
|
2546
2549
|
for (const { key: n, handler: l, debounce: r } of i)
|
|
2547
2550
|
this.unsubscribe[n] = await this.win.listen(
|
|
2548
2551
|
n,
|
|
2549
|
-
|
|
2552
|
+
oe(() => {
|
|
2550
2553
|
l(this.win).then((a) => {
|
|
2551
|
-
a != null && this.emit({ action: a }, void 0, "WHITELIST")
|
|
2554
|
+
a != null && this.emit({ action: a }, void 0, "WHITELIST").catch(
|
|
2555
|
+
console.error
|
|
2556
|
+
);
|
|
2552
2557
|
}).catch(console.error);
|
|
2553
2558
|
}, r)
|
|
2554
2559
|
);
|
|
@@ -2559,9 +2564,9 @@ class Pe {
|
|
|
2559
2564
|
});
|
|
2560
2565
|
}
|
|
2561
2566
|
async create(e, i) {
|
|
2562
|
-
i =
|
|
2563
|
-
const { size: n, minSize: l, maxSize: r, position: a,
|
|
2564
|
-
(n == null ? void 0 : n.width) != null && (n.width = Math.max(n.width, y)), (n == null ? void 0 : n.height) != null && (n.height = Math.max(n.height, y)), (r == null ? void 0 : r.width) != null && (r.width = Math.max(r.width, y)), (r == null ? void 0 : r.height) != null && (r.height = Math.max(r.height, y)), a != null && (await
|
|
2567
|
+
i = le.copy(i);
|
|
2568
|
+
const { size: n, minSize: l, maxSize: r, position: a, ...K } = We(i);
|
|
2569
|
+
(n == null ? void 0 : n.width) != null && (n.width = Math.max(n.width, y)), (n == null ? void 0 : n.height) != null && (n.height = Math.max(n.height, y)), (r == null ? void 0 : r.width) != null && (r.width = Math.max(r.width, y)), (r == null ? void 0 : r.height) != null && (r.height = Math.max(r.height, y)), a != null && (await G(a) || (a.x = 0, a.y = 0));
|
|
2565
2570
|
try {
|
|
2566
2571
|
const p = new w(e, {
|
|
2567
2572
|
x: a == null ? void 0 : a.x,
|
|
@@ -2574,10 +2579,10 @@ class Pe {
|
|
|
2574
2579
|
maxHeight: r == null ? void 0 : r.height,
|
|
2575
2580
|
titleBarStyle: "overlay",
|
|
2576
2581
|
dragDropEnabled: !1,
|
|
2577
|
-
|
|
2582
|
+
...K
|
|
2578
2583
|
});
|
|
2579
|
-
return await new Promise((
|
|
2580
|
-
p.once(
|
|
2584
|
+
return await new Promise((Q, Y) => {
|
|
2585
|
+
p.once(ve, (X) => Y(new Error(JSON.stringify(X.payload)))), p.once(fe, () => Q());
|
|
2581
2586
|
});
|
|
2582
2587
|
} catch (p) {
|
|
2583
2588
|
console.error(p);
|
|
@@ -2623,16 +2628,16 @@ class Pe {
|
|
|
2623
2628
|
}
|
|
2624
2629
|
async setPosition(e) {
|
|
2625
2630
|
const i = new N(e.x, e.y);
|
|
2626
|
-
await
|
|
2631
|
+
await G(e) || (i.x = 0, i.y = 0), await this.win.setPosition(i);
|
|
2627
2632
|
}
|
|
2628
2633
|
async setSize(e) {
|
|
2629
|
-
e =
|
|
2634
|
+
e = f(e), await this.win.setSize(new _(e.width, e.height));
|
|
2630
2635
|
}
|
|
2631
2636
|
async setMinSize(e) {
|
|
2632
|
-
e =
|
|
2637
|
+
e = f(e), await this.win.setMinSize(new _(e.width, e.height));
|
|
2633
2638
|
}
|
|
2634
2639
|
async setMaxSize(e) {
|
|
2635
|
-
e =
|
|
2640
|
+
e = f(e), await this.win.setMaxSize(new _(e.width, e.height));
|
|
2636
2641
|
}
|
|
2637
2642
|
async setResizable(e) {
|
|
2638
2643
|
var i, n;
|
|
@@ -2654,14 +2659,14 @@ class Pe {
|
|
|
2654
2659
|
const e = await this.win.scaleFactor(), i = await this.win.isVisible();
|
|
2655
2660
|
return {
|
|
2656
2661
|
position: I(await this.win.innerPosition(), e),
|
|
2657
|
-
size:
|
|
2662
|
+
size: $(await this.win.innerSize(), e),
|
|
2658
2663
|
maximized: await this.win.isMaximized(),
|
|
2659
2664
|
visible: i,
|
|
2660
2665
|
fullscreen: await this.win.isFullscreen()
|
|
2661
2666
|
};
|
|
2662
2667
|
}
|
|
2663
2668
|
}
|
|
2664
|
-
const
|
|
2669
|
+
const ze = () => [
|
|
2665
2670
|
{
|
|
2666
2671
|
key: o.WINDOW_RESIZED,
|
|
2667
2672
|
debounce: 200,
|
|
@@ -2672,7 +2677,7 @@ const Oe = () => [
|
|
|
2672
2677
|
visible: i,
|
|
2673
2678
|
minimized: !i,
|
|
2674
2679
|
position: I(await t.innerPosition(), e),
|
|
2675
|
-
size:
|
|
2680
|
+
size: $(await t.innerSize(), e)
|
|
2676
2681
|
};
|
|
2677
2682
|
return g(n);
|
|
2678
2683
|
}
|
|
@@ -2706,7 +2711,7 @@ const Oe = () => [
|
|
|
2706
2711
|
label: t.label
|
|
2707
2712
|
})
|
|
2708
2713
|
}
|
|
2709
|
-
], I = (t, e) =>
|
|
2714
|
+
], I = (t, e) => re.scale(t, 1 / e), $ = (t, e) => ae.scale(t, 1 / e);
|
|
2710
2715
|
export {
|
|
2711
2716
|
Pe as TauriRuntime
|
|
2712
2717
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synnaxlabs/drift",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.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",
|
|
@@ -14,27 +14,28 @@
|
|
|
14
14
|
"application level state"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@reduxjs/toolkit": "^2.
|
|
18
|
-
"@tauri-apps/api": "^2.
|
|
17
|
+
"@reduxjs/toolkit": "^2.6.1",
|
|
18
|
+
"@tauri-apps/api": "^2.3.0",
|
|
19
19
|
"async-mutex": "^0.5.0",
|
|
20
20
|
"proxy-memoize": "2.0.3",
|
|
21
21
|
"react": "^19.0.0",
|
|
22
22
|
"react-dom": "^19.0.0",
|
|
23
23
|
"react-redux": "^9.2.0",
|
|
24
|
-
"zod": "^3.24.
|
|
25
|
-
"@synnaxlabs/x": "0.
|
|
24
|
+
"zod": "^3.24.2",
|
|
25
|
+
"@synnaxlabs/x": "0.39.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@tauri-apps/api": "^2.1.1",
|
|
29
|
-
"@types/react": "^19.0.
|
|
30
|
-
"
|
|
31
|
-
"
|
|
29
|
+
"@types/react": "^19.0.10",
|
|
30
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
31
|
+
"electron": "^33.4.4",
|
|
32
|
+
"eslint": "^9.22.0",
|
|
32
33
|
"react": "^19.0.0",
|
|
33
34
|
"react-dom": "^19.0.0",
|
|
34
35
|
"react-redux": "^9.2.0",
|
|
35
|
-
"typescript": "^5.
|
|
36
|
-
"vite": "^6.
|
|
37
|
-
"vitest": "^2.1.
|
|
36
|
+
"typescript": "^5.8.2",
|
|
37
|
+
"vite": "^6.2.1",
|
|
38
|
+
"vitest": "^2.1.9",
|
|
38
39
|
"@synnaxlabs/tsconfig": "0.0.2",
|
|
39
40
|
"@synnaxlabs/vite-plugin": "0.0.1",
|
|
40
41
|
"eslint-config-synnaxlabs": "0.0.1"
|