tauri-notice-window 1.0.13 → 1.0.14
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/README.md +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +160 -165
- package/dist/index.js.map +1 -1
- package/dist/utils/noticeWindow.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { create as ce } from "zustand";
|
|
2
2
|
import { syncTabs as we } from "zustand-sync";
|
|
3
3
|
import de from "dexie";
|
|
4
|
-
import { useCallback as
|
|
5
|
-
import { jsx as
|
|
4
|
+
import { useCallback as I, useState as L, useEffect as G } from "react";
|
|
5
|
+
import { jsx as z, Fragment as he } from "react/jsx-runtime";
|
|
6
6
|
const K = "tauri-notice-config", Q = {
|
|
7
7
|
routePrefix: "/notice",
|
|
8
8
|
databaseName: "tauri-notice-db",
|
|
@@ -27,7 +27,7 @@ const K = "tauri-notice-config", Q = {
|
|
|
27
27
|
} catch (e) {
|
|
28
28
|
console.warn("Failed to save config to localStorage:", e);
|
|
29
29
|
}
|
|
30
|
-
},
|
|
30
|
+
}, Ve = (t) => {
|
|
31
31
|
const i = { ...X(), ...t };
|
|
32
32
|
ge(i);
|
|
33
33
|
}, ee = () => X();
|
|
@@ -39,14 +39,14 @@ class ye extends de {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
let
|
|
42
|
+
let S = null;
|
|
43
43
|
const te = () => {
|
|
44
|
-
if (!
|
|
44
|
+
if (!S) {
|
|
45
45
|
const t = ee();
|
|
46
|
-
|
|
46
|
+
S = new ye(t.databaseName);
|
|
47
47
|
}
|
|
48
|
-
return
|
|
49
|
-
}, g = () =>
|
|
48
|
+
return S;
|
|
49
|
+
}, g = () => S || te(), be = async (t) => {
|
|
50
50
|
const e = {
|
|
51
51
|
...t,
|
|
52
52
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -93,9 +93,9 @@ const te = () => {
|
|
|
93
93
|
console.log(`Message ${i.id} was already shown, skipping`);
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
|
-
if (await pe(i.id) || await be(i), !n.queue.some((
|
|
97
|
-
const
|
|
98
|
-
t({ queue:
|
|
96
|
+
if (await pe(i.id) || await be(i), !n.queue.some((c) => c.id === i.id)) {
|
|
97
|
+
const c = [...n.queue, i];
|
|
98
|
+
t({ queue: c }), await e().persistQueue();
|
|
99
99
|
}
|
|
100
100
|
!n.isProcessing && !n.currentMessage && await e().showNext();
|
|
101
101
|
},
|
|
@@ -201,18 +201,18 @@ const te = () => {
|
|
|
201
201
|
const n = e(), a = String(i);
|
|
202
202
|
return n.activeWindowIds.includes(a);
|
|
203
203
|
}
|
|
204
|
-
}),
|
|
204
|
+
}), w = ce()(
|
|
205
205
|
we(Ne, {
|
|
206
206
|
name: "tauri-notice-queue"
|
|
207
207
|
})
|
|
208
|
-
),
|
|
208
|
+
), M = {
|
|
209
209
|
queueLength: (t) => t.queue.length,
|
|
210
210
|
currentMessage: (t) => t.currentMessage,
|
|
211
211
|
isProcessing: (t) => t.isProcessing,
|
|
212
212
|
queue: (t) => t.queue
|
|
213
|
-
},
|
|
214
|
-
const t =
|
|
215
|
-
return { showNotice:
|
|
213
|
+
}, $e = () => {
|
|
214
|
+
const t = w((i) => i.enqueue);
|
|
215
|
+
return { showNotice: I(
|
|
216
216
|
async (i) => {
|
|
217
217
|
await t(i);
|
|
218
218
|
},
|
|
@@ -227,7 +227,7 @@ function Me(t, e, i, n, a) {
|
|
|
227
227
|
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");
|
|
228
228
|
return e.set(t, i), i;
|
|
229
229
|
}
|
|
230
|
-
var
|
|
230
|
+
var O;
|
|
231
231
|
const h = "__TAURI_TO_IPC_KEY__";
|
|
232
232
|
function Oe(t, e = !1) {
|
|
233
233
|
return window.__TAURI_INTERNALS__.transformCallback(t, e);
|
|
@@ -237,10 +237,10 @@ async function s(t, e = {}, i) {
|
|
|
237
237
|
}
|
|
238
238
|
class xe {
|
|
239
239
|
get rid() {
|
|
240
|
-
return ze(this,
|
|
240
|
+
return ze(this, O, "f");
|
|
241
241
|
}
|
|
242
242
|
constructor(e) {
|
|
243
|
-
|
|
243
|
+
O.set(this, void 0), Me(this, O, e);
|
|
244
244
|
}
|
|
245
245
|
/**
|
|
246
246
|
* Destroys and cleans up this resource from memory.
|
|
@@ -252,7 +252,7 @@ class xe {
|
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
|
|
255
|
+
O = /* @__PURE__ */ new WeakMap();
|
|
256
256
|
class ne {
|
|
257
257
|
constructor(...e) {
|
|
258
258
|
this.type = "Logical", e.length === 1 ? "Logical" in e[0] ? (this.width = e[0].Logical.width, this.height = e[0].Logical.height) : (this.width = e[0].width, this.height = e[0].height) : (this.width = e[0], this.height = e[1]);
|
|
@@ -273,7 +273,7 @@ class ne {
|
|
|
273
273
|
* @since 2.0.0
|
|
274
274
|
*/
|
|
275
275
|
toPhysical(e) {
|
|
276
|
-
return new
|
|
276
|
+
return new b(this.width * e, this.height * e);
|
|
277
277
|
}
|
|
278
278
|
[h]() {
|
|
279
279
|
return {
|
|
@@ -285,7 +285,7 @@ class ne {
|
|
|
285
285
|
return this[h]();
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
|
-
class
|
|
288
|
+
class b {
|
|
289
289
|
constructor(...e) {
|
|
290
290
|
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]);
|
|
291
291
|
}
|
|
@@ -313,7 +313,7 @@ class p {
|
|
|
313
313
|
return this[h]();
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
|
-
class
|
|
316
|
+
class y {
|
|
317
317
|
constructor(e) {
|
|
318
318
|
this.size = e;
|
|
319
319
|
}
|
|
@@ -321,7 +321,7 @@ class b {
|
|
|
321
321
|
return this.size instanceof ne ? this.size : this.size.toLogical(e);
|
|
322
322
|
}
|
|
323
323
|
toPhysical(e) {
|
|
324
|
-
return this.size instanceof
|
|
324
|
+
return this.size instanceof b ? this.size : this.size.toPhysical(e);
|
|
325
325
|
}
|
|
326
326
|
[h]() {
|
|
327
327
|
return {
|
|
@@ -355,7 +355,7 @@ class se {
|
|
|
355
355
|
* @since 2.0.0
|
|
356
356
|
*/
|
|
357
357
|
toPhysical(e) {
|
|
358
|
-
return new
|
|
358
|
+
return new d(this.x * e, this.y * e);
|
|
359
359
|
}
|
|
360
360
|
[h]() {
|
|
361
361
|
return {
|
|
@@ -367,7 +367,7 @@ class se {
|
|
|
367
367
|
return this[h]();
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
-
class
|
|
370
|
+
class d {
|
|
371
371
|
constructor(...e) {
|
|
372
372
|
this.type = "Physical", e.length === 1 ? "Physical" in e[0] ? (this.x = e[0].Physical.x, this.y = e[0].Physical.y) : (this.x = e[0].x, this.y = e[0].y) : (this.x = e[0], this.y = e[1]);
|
|
373
373
|
}
|
|
@@ -407,7 +407,7 @@ class _ {
|
|
|
407
407
|
return this.position instanceof se ? this.position : this.position.toLogical(e);
|
|
408
408
|
}
|
|
409
409
|
toPhysical(e) {
|
|
410
|
-
return this.position instanceof
|
|
410
|
+
return this.position instanceof d ? this.position : this.position.toPhysical(e);
|
|
411
411
|
}
|
|
412
412
|
[h]() {
|
|
413
413
|
return {
|
|
@@ -431,7 +431,7 @@ async function ae(t, e) {
|
|
|
431
431
|
eventId: e
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
|
-
async function
|
|
434
|
+
async function k(t, e, i) {
|
|
435
435
|
var n;
|
|
436
436
|
const a = typeof i?.target == "string" ? { kind: "AnyLabel", label: i.target } : (n = i?.target) !== null && n !== void 0 ? n : { kind: "Any" };
|
|
437
437
|
return s("plugin:event|listen", {
|
|
@@ -441,7 +441,7 @@ async function I(t, e, i) {
|
|
|
441
441
|
}).then((l) => async () => ae(t, l));
|
|
442
442
|
}
|
|
443
443
|
async function F(t, e, i) {
|
|
444
|
-
return
|
|
444
|
+
return k(t, (n) => {
|
|
445
445
|
ae(t, n.id), e(n);
|
|
446
446
|
}, i);
|
|
447
447
|
}
|
|
@@ -458,7 +458,7 @@ async function le(t, e, i) {
|
|
|
458
458
|
payload: i
|
|
459
459
|
});
|
|
460
460
|
}
|
|
461
|
-
class
|
|
461
|
+
class D extends xe {
|
|
462
462
|
/**
|
|
463
463
|
* Creates an Image from a resource ID. For internal use only.
|
|
464
464
|
*
|
|
@@ -470,10 +470,10 @@ class S extends xe {
|
|
|
470
470
|
/** Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height. */
|
|
471
471
|
static async new(e, i, n) {
|
|
472
472
|
return s("plugin:image|new", {
|
|
473
|
-
rgba:
|
|
473
|
+
rgba: P(e),
|
|
474
474
|
width: i,
|
|
475
475
|
height: n
|
|
476
|
-
}).then((a) => new
|
|
476
|
+
}).then((a) => new D(a));
|
|
477
477
|
}
|
|
478
478
|
/**
|
|
479
479
|
* Creates a new image using the provided bytes by inferring the file format.
|
|
@@ -490,8 +490,8 @@ class S extends xe {
|
|
|
490
490
|
*/
|
|
491
491
|
static async fromBytes(e) {
|
|
492
492
|
return s("plugin:image|from_bytes", {
|
|
493
|
-
bytes:
|
|
494
|
-
}).then((i) => new
|
|
493
|
+
bytes: P(e)
|
|
494
|
+
}).then((i) => new D(i));
|
|
495
495
|
}
|
|
496
496
|
/**
|
|
497
497
|
* Creates a new image using the provided path.
|
|
@@ -506,7 +506,7 @@ class S extends xe {
|
|
|
506
506
|
* ```
|
|
507
507
|
*/
|
|
508
508
|
static async fromPath(e) {
|
|
509
|
-
return s("plugin:image|from_path", { path: e }).then((i) => new
|
|
509
|
+
return s("plugin:image|from_path", { path: e }).then((i) => new D(i));
|
|
510
510
|
}
|
|
511
511
|
/** Returns the RGBA data for this image, in row-major order from top to bottom. */
|
|
512
512
|
async rgba() {
|
|
@@ -519,8 +519,8 @@ class S extends xe {
|
|
|
519
519
|
return s("plugin:image|size", { rid: this.rid });
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
|
-
function
|
|
523
|
-
return t == null ? null : typeof t == "string" ? t : t instanceof
|
|
522
|
+
function P(t) {
|
|
523
|
+
return t == null ? null : typeof t == "string" ? t : t instanceof D ? t.rid : t;
|
|
524
524
|
}
|
|
525
525
|
var q;
|
|
526
526
|
(function(t) {
|
|
@@ -542,19 +542,19 @@ var H;
|
|
|
542
542
|
t.None = "none", t.Normal = "normal", t.Indeterminate = "indeterminate", t.Paused = "paused", t.Error = "error";
|
|
543
543
|
})(H || (H = {}));
|
|
544
544
|
function oe() {
|
|
545
|
-
return new
|
|
545
|
+
return new C(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {
|
|
546
546
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
547
547
|
skip: !0
|
|
548
548
|
});
|
|
549
549
|
}
|
|
550
550
|
async function E() {
|
|
551
|
-
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new
|
|
551
|
+
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new C(e, {
|
|
552
552
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
553
553
|
skip: !0
|
|
554
554
|
})));
|
|
555
555
|
}
|
|
556
556
|
const R = ["tauri://created", "tauri://error"];
|
|
557
|
-
class
|
|
557
|
+
class C {
|
|
558
558
|
/**
|
|
559
559
|
* Creates a new Window.
|
|
560
560
|
* @example
|
|
@@ -648,7 +648,7 @@ class k {
|
|
|
648
648
|
return this._handleTauriEvent(e, i) ? () => {
|
|
649
649
|
const n = this.listeners[e];
|
|
650
650
|
n.splice(n.indexOf(i), 1);
|
|
651
|
-
} :
|
|
651
|
+
} : k(e, i, {
|
|
652
652
|
target: { kind: "Window", label: this.label }
|
|
653
653
|
});
|
|
654
654
|
}
|
|
@@ -759,7 +759,7 @@ class k {
|
|
|
759
759
|
async innerPosition() {
|
|
760
760
|
return s("plugin:window|inner_position", {
|
|
761
761
|
label: this.label
|
|
762
|
-
}).then((e) => new
|
|
762
|
+
}).then((e) => new d(e));
|
|
763
763
|
}
|
|
764
764
|
/**
|
|
765
765
|
* The position of the top-left hand corner of the window relative to the top-left hand corner of the desktop.
|
|
@@ -774,7 +774,7 @@ class k {
|
|
|
774
774
|
async outerPosition() {
|
|
775
775
|
return s("plugin:window|outer_position", {
|
|
776
776
|
label: this.label
|
|
777
|
-
}).then((e) => new
|
|
777
|
+
}).then((e) => new d(e));
|
|
778
778
|
}
|
|
779
779
|
/**
|
|
780
780
|
* The physical size of the window's client area.
|
|
@@ -790,7 +790,7 @@ class k {
|
|
|
790
790
|
async innerSize() {
|
|
791
791
|
return s("plugin:window|inner_size", {
|
|
792
792
|
label: this.label
|
|
793
|
-
}).then((e) => new
|
|
793
|
+
}).then((e) => new b(e));
|
|
794
794
|
}
|
|
795
795
|
/**
|
|
796
796
|
* The physical size of the entire window.
|
|
@@ -806,7 +806,7 @@ class k {
|
|
|
806
806
|
async outerSize() {
|
|
807
807
|
return s("plugin:window|outer_size", {
|
|
808
808
|
label: this.label
|
|
809
|
-
}).then((e) => new
|
|
809
|
+
}).then((e) => new b(e));
|
|
810
810
|
}
|
|
811
811
|
/**
|
|
812
812
|
* Gets the window's current fullscreen state.
|
|
@@ -1457,7 +1457,7 @@ class k {
|
|
|
1457
1457
|
async setSize(e) {
|
|
1458
1458
|
return s("plugin:window|set_size", {
|
|
1459
1459
|
label: this.label,
|
|
1460
|
-
value: e instanceof
|
|
1460
|
+
value: e instanceof y ? e : new y(e)
|
|
1461
1461
|
});
|
|
1462
1462
|
}
|
|
1463
1463
|
/**
|
|
@@ -1474,7 +1474,7 @@ class k {
|
|
|
1474
1474
|
async setMinSize(e) {
|
|
1475
1475
|
return s("plugin:window|set_min_size", {
|
|
1476
1476
|
label: this.label,
|
|
1477
|
-
value: e instanceof
|
|
1477
|
+
value: e instanceof y ? e : e ? new y(e) : null
|
|
1478
1478
|
});
|
|
1479
1479
|
}
|
|
1480
1480
|
/**
|
|
@@ -1491,7 +1491,7 @@ class k {
|
|
|
1491
1491
|
async setMaxSize(e) {
|
|
1492
1492
|
return s("plugin:window|set_max_size", {
|
|
1493
1493
|
label: this.label,
|
|
1494
|
-
value: e instanceof
|
|
1494
|
+
value: e instanceof y ? e : e ? new y(e) : null
|
|
1495
1495
|
});
|
|
1496
1496
|
}
|
|
1497
1497
|
/**
|
|
@@ -1627,7 +1627,7 @@ class k {
|
|
|
1627
1627
|
async setIcon(e) {
|
|
1628
1628
|
return s("plugin:window|set_icon", {
|
|
1629
1629
|
label: this.label,
|
|
1630
|
-
value:
|
|
1630
|
+
value: P(e)
|
|
1631
1631
|
});
|
|
1632
1632
|
}
|
|
1633
1633
|
/**
|
|
@@ -1862,7 +1862,7 @@ class k {
|
|
|
1862
1862
|
async setOverlayIcon(e) {
|
|
1863
1863
|
return s("plugin:window|set_overlay_icon", {
|
|
1864
1864
|
label: this.label,
|
|
1865
|
-
value: e ?
|
|
1865
|
+
value: e ? P(e) : void 0
|
|
1866
1866
|
});
|
|
1867
1867
|
}
|
|
1868
1868
|
/**
|
|
@@ -1952,7 +1952,7 @@ class k {
|
|
|
1952
1952
|
*/
|
|
1953
1953
|
async onResized(e) {
|
|
1954
1954
|
return this.listen(o.WINDOW_RESIZED, (i) => {
|
|
1955
|
-
i.payload = new
|
|
1955
|
+
i.payload = new b(i.payload), e(i);
|
|
1956
1956
|
});
|
|
1957
1957
|
}
|
|
1958
1958
|
/**
|
|
@@ -1974,7 +1974,7 @@ class k {
|
|
|
1974
1974
|
*/
|
|
1975
1975
|
async onMoved(e) {
|
|
1976
1976
|
return this.listen(o.WINDOW_MOVED, (i) => {
|
|
1977
|
-
i.payload = new
|
|
1977
|
+
i.payload = new d(i.payload), e(i);
|
|
1978
1978
|
});
|
|
1979
1979
|
}
|
|
1980
1980
|
/**
|
|
@@ -2037,7 +2037,7 @@ class k {
|
|
|
2037
2037
|
payload: {
|
|
2038
2038
|
type: "enter",
|
|
2039
2039
|
paths: r.payload.paths,
|
|
2040
|
-
position: new
|
|
2040
|
+
position: new d(r.payload.position)
|
|
2041
2041
|
}
|
|
2042
2042
|
});
|
|
2043
2043
|
}), n = await this.listen(o.DRAG_OVER, (r) => {
|
|
@@ -2045,7 +2045,7 @@ class k {
|
|
|
2045
2045
|
...r,
|
|
2046
2046
|
payload: {
|
|
2047
2047
|
type: "over",
|
|
2048
|
-
position: new
|
|
2048
|
+
position: new d(r.payload.position)
|
|
2049
2049
|
}
|
|
2050
2050
|
});
|
|
2051
2051
|
}), a = await this.listen(o.DRAG_DROP, (r) => {
|
|
@@ -2054,7 +2054,7 @@ class k {
|
|
|
2054
2054
|
payload: {
|
|
2055
2055
|
type: "drop",
|
|
2056
2056
|
paths: r.payload.paths,
|
|
2057
|
-
position: new
|
|
2057
|
+
position: new d(r.payload.position)
|
|
2058
2058
|
}
|
|
2059
2059
|
});
|
|
2060
2060
|
}), l = await this.listen(o.DRAG_LEAVE, (r) => {
|
|
@@ -2156,11 +2156,11 @@ function Ie(t) {
|
|
|
2156
2156
|
return t === null ? null : {
|
|
2157
2157
|
name: t.name,
|
|
2158
2158
|
scaleFactor: t.scaleFactor,
|
|
2159
|
-
position: new
|
|
2160
|
-
size: new
|
|
2159
|
+
position: new d(t.position),
|
|
2160
|
+
size: new b(t.size),
|
|
2161
2161
|
workArea: {
|
|
2162
|
-
position: new
|
|
2163
|
-
size: new
|
|
2162
|
+
position: new d(t.workArea.position),
|
|
2163
|
+
size: new b(t.workArea.size)
|
|
2164
2164
|
}
|
|
2165
2165
|
};
|
|
2166
2166
|
}
|
|
@@ -2174,7 +2174,7 @@ function ue() {
|
|
|
2174
2174
|
});
|
|
2175
2175
|
}
|
|
2176
2176
|
async function Z() {
|
|
2177
|
-
return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new B(new
|
|
2177
|
+
return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new B(new C(e.windowLabel, {
|
|
2178
2178
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
2179
2179
|
skip: !0
|
|
2180
2180
|
}), e.label, {
|
|
@@ -2275,7 +2275,7 @@ class B {
|
|
|
2275
2275
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2276
2276
|
const n = this.listeners[e];
|
|
2277
2277
|
n.splice(n.indexOf(i), 1);
|
|
2278
|
-
} :
|
|
2278
|
+
} : k(e, i, {
|
|
2279
2279
|
target: { kind: "Webview", label: this.label }
|
|
2280
2280
|
});
|
|
2281
2281
|
}
|
|
@@ -2373,7 +2373,7 @@ class B {
|
|
|
2373
2373
|
async position() {
|
|
2374
2374
|
return s("plugin:webview|webview_position", {
|
|
2375
2375
|
label: this.label
|
|
2376
|
-
}).then((e) => new
|
|
2376
|
+
}).then((e) => new d(e));
|
|
2377
2377
|
}
|
|
2378
2378
|
/**
|
|
2379
2379
|
* The physical size of the webview's client area.
|
|
@@ -2389,7 +2389,7 @@ class B {
|
|
|
2389
2389
|
async size() {
|
|
2390
2390
|
return s("plugin:webview|webview_size", {
|
|
2391
2391
|
label: this.label
|
|
2392
|
-
}).then((e) => new
|
|
2392
|
+
}).then((e) => new b(e));
|
|
2393
2393
|
}
|
|
2394
2394
|
// Setters
|
|
2395
2395
|
/**
|
|
@@ -2421,7 +2421,7 @@ class B {
|
|
|
2421
2421
|
async setSize(e) {
|
|
2422
2422
|
return s("plugin:webview|set_webview_size", {
|
|
2423
2423
|
label: this.label,
|
|
2424
|
-
value: e instanceof
|
|
2424
|
+
value: e instanceof y ? e : new y(e)
|
|
2425
2425
|
});
|
|
2426
2426
|
}
|
|
2427
2427
|
/**
|
|
@@ -2600,7 +2600,7 @@ class B {
|
|
|
2600
2600
|
payload: {
|
|
2601
2601
|
type: "enter",
|
|
2602
2602
|
paths: r.payload.paths,
|
|
2603
|
-
position: new
|
|
2603
|
+
position: new d(r.payload.position)
|
|
2604
2604
|
}
|
|
2605
2605
|
});
|
|
2606
2606
|
}), n = await this.listen(o.DRAG_OVER, (r) => {
|
|
@@ -2608,7 +2608,7 @@ class B {
|
|
|
2608
2608
|
...r,
|
|
2609
2609
|
payload: {
|
|
2610
2610
|
type: "over",
|
|
2611
|
-
position: new
|
|
2611
|
+
position: new d(r.payload.position)
|
|
2612
2612
|
}
|
|
2613
2613
|
});
|
|
2614
2614
|
}), a = await this.listen(o.DRAG_DROP, (r) => {
|
|
@@ -2617,7 +2617,7 @@ class B {
|
|
|
2617
2617
|
payload: {
|
|
2618
2618
|
type: "drop",
|
|
2619
2619
|
paths: r.payload.paths,
|
|
2620
|
-
position: new
|
|
2620
|
+
position: new d(r.payload.position)
|
|
2621
2621
|
}
|
|
2622
2622
|
});
|
|
2623
2623
|
}), l = await this.listen(o.DRAG_LEAVE, (r) => {
|
|
@@ -2628,7 +2628,7 @@ class B {
|
|
|
2628
2628
|
};
|
|
2629
2629
|
}
|
|
2630
2630
|
}
|
|
2631
|
-
function
|
|
2631
|
+
function x() {
|
|
2632
2632
|
const t = ue();
|
|
2633
2633
|
return new f(t.label, { skip: !0 });
|
|
2634
2634
|
}
|
|
@@ -2688,7 +2688,7 @@ class f {
|
|
|
2688
2688
|
* Get an instance of `Webview` for the current webview.
|
|
2689
2689
|
*/
|
|
2690
2690
|
static getCurrent() {
|
|
2691
|
-
return
|
|
2691
|
+
return x();
|
|
2692
2692
|
}
|
|
2693
2693
|
/**
|
|
2694
2694
|
* Gets a list of instances of `Webview` for all available webviews.
|
|
@@ -2719,7 +2719,7 @@ class f {
|
|
|
2719
2719
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2720
2720
|
const n = this.listeners[e];
|
|
2721
2721
|
n.splice(n.indexOf(i), 1);
|
|
2722
|
-
} :
|
|
2722
|
+
} : k(e, i, {
|
|
2723
2723
|
target: { kind: "WebviewWindow", label: this.label }
|
|
2724
2724
|
});
|
|
2725
2725
|
}
|
|
@@ -2770,7 +2770,7 @@ class f {
|
|
|
2770
2770
|
return s("plugin:window|set_background_color", { color: e }).then(() => s("plugin:webview|set_webview_background_color", { color: e }));
|
|
2771
2771
|
}
|
|
2772
2772
|
}
|
|
2773
|
-
Ce(f, [
|
|
2773
|
+
Ce(f, [C, B]);
|
|
2774
2774
|
function Ce(t, e) {
|
|
2775
2775
|
(Array.isArray(e) ? e : [e]).forEach((i) => {
|
|
2776
2776
|
Object.getOwnPropertyNames(i.prototype).forEach((n) => {
|
|
@@ -2784,23 +2784,23 @@ function Ce(t, e) {
|
|
|
2784
2784
|
});
|
|
2785
2785
|
});
|
|
2786
2786
|
}
|
|
2787
|
-
const
|
|
2787
|
+
const A = /* @__PURE__ */ new Map(), Le = () => navigator.platform.toLowerCase().includes("mac") || navigator.userAgent.toLowerCase().includes("mac"), Ee = (t) => {
|
|
2788
2788
|
if (!t || t.trim() === "") return !1;
|
|
2789
2789
|
try {
|
|
2790
2790
|
return !!(t.startsWith("/") || t.startsWith("http://") || t.startsWith("https://") || t.startsWith("tauri://"));
|
|
2791
2791
|
} catch {
|
|
2792
2792
|
return !1;
|
|
2793
2793
|
}
|
|
2794
|
-
},
|
|
2794
|
+
}, Re = async (t, e, i) => {
|
|
2795
2795
|
const n = i?.padding ?? 20;
|
|
2796
2796
|
if (i?.x !== void 0 && i?.y !== void 0)
|
|
2797
2797
|
return { x: i.x, y: i.y };
|
|
2798
2798
|
let a = 1920, l = 1080;
|
|
2799
2799
|
try {
|
|
2800
|
-
const
|
|
2801
|
-
|
|
2802
|
-
} catch (
|
|
2803
|
-
console.warn("Failed to get monitor info, using defaults:",
|
|
2800
|
+
const c = await ke();
|
|
2801
|
+
c?.size && (a = c.size.width, l = c.size.height);
|
|
2802
|
+
} catch (c) {
|
|
2803
|
+
console.warn("Failed to get monitor info, using defaults:", c);
|
|
2804
2804
|
}
|
|
2805
2805
|
switch (i?.position ?? "right-bottom") {
|
|
2806
2806
|
case "right-bottom":
|
|
@@ -2834,146 +2834,141 @@ const D = /* @__PURE__ */ new Map(), Le = (t) => {
|
|
|
2834
2834
|
y: l - e - n
|
|
2835
2835
|
};
|
|
2836
2836
|
}
|
|
2837
|
-
},
|
|
2838
|
-
const e = String(t.id), i =
|
|
2837
|
+
}, Te = async (t) => {
|
|
2838
|
+
const e = String(t.id), i = w.getState();
|
|
2839
2839
|
if (i.isWindowActive(e)) {
|
|
2840
2840
|
console.log(`Notice window already open for message: ${e}`);
|
|
2841
2841
|
return;
|
|
2842
2842
|
}
|
|
2843
2843
|
const n = ee(), a = `notice-${e}`;
|
|
2844
2844
|
let l = `${n.routePrefix}/${t.type}?id=${t.id}`;
|
|
2845
|
-
|
|
2846
|
-
const r = t.min_width || n.defaultWidth,
|
|
2845
|
+
Ee(l) || (console.warn(`Invalid window URL: ${l}. Using fallback 404 page.`), l = n.notFoundUrl || "/404");
|
|
2846
|
+
const r = t.min_width || n.defaultWidth, c = t.min_height || n.defaultHeight, m = t.decorations ?? n.defaultDecorations ?? !0, { x: v, y: N } = await Re(r, c, t.windowPosition);
|
|
2847
2847
|
try {
|
|
2848
|
-
const
|
|
2848
|
+
const u = {
|
|
2849
2849
|
url: l,
|
|
2850
2850
|
title: t.title,
|
|
2851
2851
|
width: r,
|
|
2852
|
-
height:
|
|
2853
|
-
x:
|
|
2854
|
-
y:
|
|
2852
|
+
height: c,
|
|
2853
|
+
x: v,
|
|
2854
|
+
y: N,
|
|
2855
2855
|
resizable: !0,
|
|
2856
|
-
decorations: y,
|
|
2857
|
-
transparent: !y,
|
|
2858
|
-
// Enable transparency for borderless windows (macOS fix)
|
|
2859
|
-
visible: y,
|
|
2860
|
-
// Start hidden if no decorations (macOS fix)
|
|
2861
2856
|
skipTaskbar: !1,
|
|
2862
2857
|
alwaysOnTop: !0
|
|
2863
|
-
}
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2858
|
+
};
|
|
2859
|
+
m ? u.decorations = !0 : Le() ? (u.decorations = !0, u.titleBarStyle = "overlay", u.hiddenTitle = !0) : (u.decorations = !1, u.transparent = !0);
|
|
2860
|
+
const p = new f(a, u);
|
|
2861
|
+
A.set(e, p), i.addActiveWindow(e), p.once("tauri://destroyed", async () => {
|
|
2862
|
+
A.delete(e), i.removeActiveWindow(e), await i.markMessageAsShown(e), i.clearCurrent();
|
|
2868
2863
|
}), console.log(`Created notice window: ${a}`);
|
|
2869
|
-
} catch (
|
|
2870
|
-
console.error("Failed to create notice window:",
|
|
2864
|
+
} catch (u) {
|
|
2865
|
+
console.error("Failed to create notice window:", u), i.removeActiveWindow(e), i.clearCurrent();
|
|
2871
2866
|
}
|
|
2872
2867
|
}, U = async (t) => {
|
|
2873
|
-
const e = String(t), i =
|
|
2868
|
+
const e = String(t), i = A.get(e), n = w.getState();
|
|
2874
2869
|
if (i)
|
|
2875
2870
|
try {
|
|
2876
|
-
await i.close(),
|
|
2871
|
+
await i.close(), A.delete(e), n.removeActiveWindow(e), await n.markMessageAsShown(e), n.clearCurrent(), console.log(`Closed notice window: ${e}`);
|
|
2877
2872
|
} catch (a) {
|
|
2878
2873
|
console.error("Failed to close notice window:", a);
|
|
2879
2874
|
}
|
|
2880
|
-
},
|
|
2881
|
-
const t = Array.from(
|
|
2875
|
+
}, qe = async () => {
|
|
2876
|
+
const t = Array.from(A.keys()).map(
|
|
2882
2877
|
(e) => U(e)
|
|
2883
2878
|
);
|
|
2884
2879
|
await Promise.all(t);
|
|
2885
|
-
},
|
|
2880
|
+
}, Fe = () => {
|
|
2886
2881
|
let t = null;
|
|
2887
|
-
|
|
2882
|
+
w.subscribe((e) => {
|
|
2888
2883
|
const i = e.currentMessage;
|
|
2889
|
-
i && i !== t ? (t = i,
|
|
2884
|
+
i && i !== t ? (t = i, Te(i)) : i || (t = null);
|
|
2890
2885
|
}), console.log("Notice window system initialized");
|
|
2891
|
-
},
|
|
2892
|
-
const t =
|
|
2893
|
-
return { closeNotice:
|
|
2886
|
+
}, je = () => {
|
|
2887
|
+
const t = w((i) => i.currentMessage);
|
|
2888
|
+
return { closeNotice: I(async () => {
|
|
2894
2889
|
t && await U(t.id);
|
|
2895
2890
|
}, [t]) };
|
|
2896
|
-
},
|
|
2897
|
-
const t =
|
|
2898
|
-
return { hideNotice:
|
|
2891
|
+
}, Je = () => {
|
|
2892
|
+
const t = w((i) => i.hideMessage);
|
|
2893
|
+
return { hideNotice: I(
|
|
2899
2894
|
async (i) => {
|
|
2900
2895
|
await t(i), await U(i);
|
|
2901
2896
|
},
|
|
2902
2897
|
[t]
|
|
2903
2898
|
) };
|
|
2904
|
-
}, Je = () => {
|
|
2905
|
-
const t = c((i) => i.clearOnLogout);
|
|
2906
|
-
return { hideAllNotices: P(async () => {
|
|
2907
|
-
await Te(), await t();
|
|
2908
|
-
}, [t]) };
|
|
2909
2899
|
}, Ze = () => {
|
|
2910
|
-
const t =
|
|
2900
|
+
const t = w((i) => i.clearOnLogout);
|
|
2901
|
+
return { hideAllNotices: I(async () => {
|
|
2902
|
+
await qe(), await t();
|
|
2903
|
+
}, [t]) };
|
|
2904
|
+
}, Ye = () => {
|
|
2905
|
+
const t = w(M.queueLength), e = w(M.currentMessage), i = w(M.isProcessing), n = w(M.queue);
|
|
2911
2906
|
return {
|
|
2912
2907
|
queueLength: t,
|
|
2913
2908
|
currentMessage: e,
|
|
2914
2909
|
isProcessing: i,
|
|
2915
2910
|
queue: n
|
|
2916
2911
|
};
|
|
2917
|
-
},
|
|
2918
|
-
const [n, a] = L(null), [l, r] = L(!0), [
|
|
2912
|
+
}, Ke = ({ children: t, onLoad: e, onClose: i }) => {
|
|
2913
|
+
const [n, a] = L(null), [l, r] = L(!0), [c, m] = L(null);
|
|
2919
2914
|
return G(() => {
|
|
2920
2915
|
(async () => {
|
|
2921
2916
|
try {
|
|
2922
|
-
const
|
|
2923
|
-
if (!
|
|
2924
|
-
|
|
2917
|
+
const u = new URLSearchParams(window.location.search).get("id");
|
|
2918
|
+
if (!u) {
|
|
2919
|
+
m("No message ID provided"), r(!1), setTimeout(async () => {
|
|
2925
2920
|
try {
|
|
2926
|
-
await
|
|
2927
|
-
} catch (
|
|
2928
|
-
console.error("Failed to close window:",
|
|
2921
|
+
await x().close();
|
|
2922
|
+
} catch (W) {
|
|
2923
|
+
console.error("Failed to close window:", W);
|
|
2929
2924
|
}
|
|
2930
2925
|
}, 1e3);
|
|
2931
2926
|
return;
|
|
2932
2927
|
}
|
|
2933
|
-
const
|
|
2934
|
-
if (!
|
|
2935
|
-
console.log(`Message ${
|
|
2928
|
+
const p = await ie(u);
|
|
2929
|
+
if (!p) {
|
|
2930
|
+
console.log(`Message ${u} not found in database, closing window`), m("Message not found"), r(!1), setTimeout(async () => {
|
|
2936
2931
|
try {
|
|
2937
|
-
await
|
|
2938
|
-
} catch (
|
|
2939
|
-
console.error("Failed to close window:",
|
|
2932
|
+
await x().close();
|
|
2933
|
+
} catch (W) {
|
|
2934
|
+
console.error("Failed to close window:", W);
|
|
2940
2935
|
}
|
|
2941
2936
|
}, 500);
|
|
2942
2937
|
return;
|
|
2943
2938
|
}
|
|
2944
|
-
a(
|
|
2945
|
-
} catch (
|
|
2946
|
-
console.error("Failed to load message:",
|
|
2939
|
+
a(p), r(!1), e && e(p);
|
|
2940
|
+
} catch (N) {
|
|
2941
|
+
console.error("Failed to load message:", N), m("Failed to load message"), r(!1), setTimeout(async () => {
|
|
2947
2942
|
try {
|
|
2948
|
-
await
|
|
2949
|
-
} catch (
|
|
2950
|
-
console.error("Failed to close window:",
|
|
2943
|
+
await x().close();
|
|
2944
|
+
} catch (u) {
|
|
2945
|
+
console.error("Failed to close window:", u);
|
|
2951
2946
|
}
|
|
2952
2947
|
}, 1e3);
|
|
2953
2948
|
}
|
|
2954
2949
|
})();
|
|
2955
2950
|
}, [e]), G(() => {
|
|
2956
2951
|
if (!n || !i) return;
|
|
2957
|
-
const
|
|
2952
|
+
const v = () => {
|
|
2958
2953
|
i(n);
|
|
2959
2954
|
};
|
|
2960
|
-
return window.addEventListener("beforeunload",
|
|
2961
|
-
window.removeEventListener("beforeunload",
|
|
2955
|
+
return window.addEventListener("beforeunload", v), () => {
|
|
2956
|
+
window.removeEventListener("beforeunload", v);
|
|
2962
2957
|
};
|
|
2963
|
-
}, [n, i]), l ? /* @__PURE__ */
|
|
2958
|
+
}, [n, i]), l ? /* @__PURE__ */ z("div", { style: {
|
|
2964
2959
|
display: "flex",
|
|
2965
2960
|
justifyContent: "center",
|
|
2966
2961
|
alignItems: "center",
|
|
2967
2962
|
height: "100vh",
|
|
2968
2963
|
fontFamily: "system-ui, -apple-system, sans-serif"
|
|
2969
|
-
}, children: "Loading..." }) :
|
|
2964
|
+
}, children: "Loading..." }) : c ? /* @__PURE__ */ z("div", { style: {
|
|
2970
2965
|
display: "flex",
|
|
2971
2966
|
justifyContent: "center",
|
|
2972
2967
|
alignItems: "center",
|
|
2973
2968
|
height: "100vh",
|
|
2974
2969
|
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
2975
2970
|
color: "#ef4444"
|
|
2976
|
-
}, children:
|
|
2971
|
+
}, children: c }) : n ? /* @__PURE__ */ z(he, { children: t(n) }) : /* @__PURE__ */ z("div", { style: {
|
|
2977
2972
|
display: "flex",
|
|
2978
2973
|
justifyContent: "center",
|
|
2979
2974
|
alignItems: "center",
|
|
@@ -2981,38 +2976,38 @@ const D = /* @__PURE__ */ new Map(), Le = (t) => {
|
|
|
2981
2976
|
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
2982
2977
|
color: "#ef4444"
|
|
2983
2978
|
}, children: "Closing window..." });
|
|
2984
|
-
},
|
|
2985
|
-
te(),
|
|
2986
|
-
const { initializeFromDatabase: t } =
|
|
2979
|
+
}, Xe = async () => {
|
|
2980
|
+
te(), Fe();
|
|
2981
|
+
const { initializeFromDatabase: t } = w.getState();
|
|
2987
2982
|
await t(), console.log("Tauri Notice System initialized");
|
|
2988
|
-
}, Xe = async (t) => {
|
|
2989
|
-
await c.getState().deleteMessage(t);
|
|
2990
2983
|
}, et = async (t) => {
|
|
2991
|
-
await
|
|
2984
|
+
await w.getState().deleteMessage(t);
|
|
2992
2985
|
}, tt = async (t) => {
|
|
2993
|
-
await
|
|
2986
|
+
await w.getState().hideMessage(t);
|
|
2987
|
+
}, it = async (t) => {
|
|
2988
|
+
await w.getState().markMessageAsShown(t);
|
|
2994
2989
|
};
|
|
2995
2990
|
export {
|
|
2996
|
-
|
|
2997
|
-
|
|
2991
|
+
Ke as NoticeLayout,
|
|
2992
|
+
qe as closeAllNoticeWindows,
|
|
2998
2993
|
U as closeNoticeWindow,
|
|
2999
|
-
|
|
3000
|
-
|
|
2994
|
+
Te as createNoticeWindow,
|
|
2995
|
+
et as deleteMessageById,
|
|
3001
2996
|
ie as getMessage,
|
|
3002
2997
|
ee as getNoticeConfig,
|
|
3003
2998
|
fe as getPendingMessages,
|
|
3004
|
-
|
|
2999
|
+
tt as hideMessageById,
|
|
3005
3000
|
te as initializeDatabase,
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3001
|
+
Xe as initializeNoticeSystem,
|
|
3002
|
+
Fe as initializeNoticeWindowSystem,
|
|
3003
|
+
it as markMessageAsShown,
|
|
3004
|
+
M as messageQueueSelectors,
|
|
3005
|
+
Ve as setNoticeConfig,
|
|
3006
|
+
je as useCloseNotice,
|
|
3007
|
+
Ze as useHideAllNotices,
|
|
3008
|
+
Je as useHideNotice,
|
|
3009
|
+
Ye as useMessageQueue,
|
|
3010
|
+
w as useMessageQueueStore,
|
|
3011
|
+
$e as useNoticeWindow
|
|
3017
3012
|
};
|
|
3018
3013
|
//# sourceMappingURL=index.js.map
|