tauri-notice-window 1.0.10 → 1.0.12
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 +81 -25
- package/dist/config/noticeConfig.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +51 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +143 -132
- package/dist/index.js.map +1 -1
- package/dist/types/message.d.ts +4 -0
- package/dist/types/message.d.ts.map +1 -1
- package/dist/utils/noticeWindow.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
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
|
|
4
|
+
import { useCallback as P, useState as L, useEffect as G } from "react";
|
|
5
5
|
import { jsx as N, 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",
|
|
9
9
|
defaultWidth: 400,
|
|
10
10
|
defaultHeight: 300,
|
|
11
|
-
notFoundUrl: "/404"
|
|
11
|
+
notFoundUrl: "/404",
|
|
12
12
|
// Default 404 page
|
|
13
|
+
defaultDecorations: !0
|
|
14
|
+
// Show title bar by default
|
|
13
15
|
}, X = () => {
|
|
14
16
|
try {
|
|
15
17
|
const t = localStorage.getItem(K);
|
|
@@ -37,14 +39,14 @@ class ye extends de {
|
|
|
37
39
|
});
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
|
-
let
|
|
42
|
+
let W = null;
|
|
41
43
|
const te = () => {
|
|
42
|
-
if (!
|
|
44
|
+
if (!W) {
|
|
43
45
|
const t = ee();
|
|
44
|
-
|
|
46
|
+
W = new ye(t.databaseName);
|
|
45
47
|
}
|
|
46
|
-
return
|
|
47
|
-
},
|
|
48
|
+
return W;
|
|
49
|
+
}, g = () => W || te(), be = async (t) => {
|
|
48
50
|
const e = {
|
|
49
51
|
...t,
|
|
50
52
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -53,28 +55,28 @@ const te = () => {
|
|
|
53
55
|
queueStatus: "pending",
|
|
54
56
|
queuePosition: 0
|
|
55
57
|
};
|
|
56
|
-
await
|
|
57
|
-
}, pe = async (t) => !!await
|
|
58
|
-
const e = await
|
|
58
|
+
await g().messages.put(e);
|
|
59
|
+
}, pe = async (t) => !!await g().messages.get(t), _e = async (t) => {
|
|
60
|
+
const e = await g().messages.get(t);
|
|
59
61
|
return e?.isShown === !0 || e?.queueStatus === "shown";
|
|
60
|
-
}, fe = async () => await
|
|
61
|
-
await
|
|
62
|
+
}, fe = async () => await g().messages.where("queueStatus").equals("pending").sortBy("queuePosition"), me = async (t, e) => {
|
|
63
|
+
await g().messages.update(t, { queueStatus: e });
|
|
62
64
|
}, ve = async (t) => {
|
|
63
|
-
await
|
|
65
|
+
await g().messages.update(t, {
|
|
64
66
|
queueStatus: "shown",
|
|
65
67
|
isShown: !0
|
|
66
68
|
});
|
|
67
69
|
}, We = async (t) => {
|
|
68
|
-
await
|
|
70
|
+
await g().messages.update(t, {
|
|
69
71
|
queueStatus: "hidden"
|
|
70
72
|
});
|
|
71
|
-
}, ie = async (t) => await
|
|
72
|
-
await
|
|
73
|
+
}, ie = async (t) => await g().messages.get(t), Se = async (t) => {
|
|
74
|
+
await g().messages.delete(t);
|
|
73
75
|
}, De = async () => {
|
|
74
|
-
await
|
|
76
|
+
await g().messages.where("queueStatus").anyOf(["pending", "showing"]).delete();
|
|
75
77
|
}, Ae = async (t) => {
|
|
76
78
|
const e = t.map(
|
|
77
|
-
(i) =>
|
|
79
|
+
(i) => g().messages.update(i.id, { queuePosition: i.position })
|
|
78
80
|
);
|
|
79
81
|
await Promise.all(e);
|
|
80
82
|
}, Ne = (t, e) => ({
|
|
@@ -199,7 +201,7 @@ const te = () => {
|
|
|
199
201
|
const n = e(), a = String(i);
|
|
200
202
|
return n.activeWindowIds.includes(a);
|
|
201
203
|
}
|
|
202
|
-
}),
|
|
204
|
+
}), c = ce()(
|
|
203
205
|
we(Ne, {
|
|
204
206
|
name: "tauri-notice-queue"
|
|
205
207
|
})
|
|
@@ -209,8 +211,8 @@ const te = () => {
|
|
|
209
211
|
isProcessing: (t) => t.isProcessing,
|
|
210
212
|
queue: (t) => t.queue
|
|
211
213
|
}, Ve = () => {
|
|
212
|
-
const t =
|
|
213
|
-
return { showNotice:
|
|
214
|
+
const t = c((i) => i.enqueue);
|
|
215
|
+
return { showNotice: P(
|
|
214
216
|
async (i) => {
|
|
215
217
|
await t(i);
|
|
216
218
|
},
|
|
@@ -221,24 +223,24 @@ function ze(t, e, i, n) {
|
|
|
221
223
|
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");
|
|
222
224
|
return i === "m" ? n : i === "a" ? n.call(t) : n ? n.value : e.get(t);
|
|
223
225
|
}
|
|
224
|
-
function
|
|
226
|
+
function Me(t, e, i, n, a) {
|
|
225
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");
|
|
226
228
|
return e.set(t, i), i;
|
|
227
229
|
}
|
|
228
|
-
var
|
|
230
|
+
var M;
|
|
229
231
|
const d = "__TAURI_TO_IPC_KEY__";
|
|
230
|
-
function
|
|
232
|
+
function Oe(t, e = !1) {
|
|
231
233
|
return window.__TAURI_INTERNALS__.transformCallback(t, e);
|
|
232
234
|
}
|
|
233
235
|
async function s(t, e = {}, i) {
|
|
234
236
|
return window.__TAURI_INTERNALS__.invoke(t, e, i);
|
|
235
237
|
}
|
|
236
|
-
class
|
|
238
|
+
class xe {
|
|
237
239
|
get rid() {
|
|
238
|
-
return ze(this,
|
|
240
|
+
return ze(this, M, "f");
|
|
239
241
|
}
|
|
240
242
|
constructor(e) {
|
|
241
|
-
|
|
243
|
+
M.set(this, void 0), Me(this, M, e);
|
|
242
244
|
}
|
|
243
245
|
/**
|
|
244
246
|
* Destroys and cleans up this resource from memory.
|
|
@@ -250,7 +252,7 @@ class Pe {
|
|
|
250
252
|
});
|
|
251
253
|
}
|
|
252
254
|
}
|
|
253
|
-
|
|
255
|
+
M = /* @__PURE__ */ new WeakMap();
|
|
254
256
|
class ne {
|
|
255
257
|
constructor(...e) {
|
|
256
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]);
|
|
@@ -271,7 +273,7 @@ class ne {
|
|
|
271
273
|
* @since 2.0.0
|
|
272
274
|
*/
|
|
273
275
|
toPhysical(e) {
|
|
274
|
-
return new
|
|
276
|
+
return new b(this.width * e, this.height * e);
|
|
275
277
|
}
|
|
276
278
|
[d]() {
|
|
277
279
|
return {
|
|
@@ -283,7 +285,7 @@ class ne {
|
|
|
283
285
|
return this[d]();
|
|
284
286
|
}
|
|
285
287
|
}
|
|
286
|
-
class
|
|
288
|
+
class b {
|
|
287
289
|
constructor(...e) {
|
|
288
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]);
|
|
289
291
|
}
|
|
@@ -311,7 +313,7 @@ class y {
|
|
|
311
313
|
return this[d]();
|
|
312
314
|
}
|
|
313
315
|
}
|
|
314
|
-
class
|
|
316
|
+
class y {
|
|
315
317
|
constructor(e) {
|
|
316
318
|
this.size = e;
|
|
317
319
|
}
|
|
@@ -319,7 +321,7 @@ class g {
|
|
|
319
321
|
return this.size instanceof ne ? this.size : this.size.toLogical(e);
|
|
320
322
|
}
|
|
321
323
|
toPhysical(e) {
|
|
322
|
-
return this.size instanceof
|
|
324
|
+
return this.size instanceof b ? this.size : this.size.toPhysical(e);
|
|
323
325
|
}
|
|
324
326
|
[d]() {
|
|
325
327
|
return {
|
|
@@ -353,7 +355,7 @@ class se {
|
|
|
353
355
|
* @since 2.0.0
|
|
354
356
|
*/
|
|
355
357
|
toPhysical(e) {
|
|
356
|
-
return new
|
|
358
|
+
return new w(this.x * e, this.y * e);
|
|
357
359
|
}
|
|
358
360
|
[d]() {
|
|
359
361
|
return {
|
|
@@ -365,7 +367,7 @@ class se {
|
|
|
365
367
|
return this[d]();
|
|
366
368
|
}
|
|
367
369
|
}
|
|
368
|
-
class
|
|
370
|
+
class w {
|
|
369
371
|
constructor(...e) {
|
|
370
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]);
|
|
371
373
|
}
|
|
@@ -397,7 +399,7 @@ class c {
|
|
|
397
399
|
return this[d]();
|
|
398
400
|
}
|
|
399
401
|
}
|
|
400
|
-
class
|
|
402
|
+
class p {
|
|
401
403
|
constructor(e) {
|
|
402
404
|
this.position = e;
|
|
403
405
|
}
|
|
@@ -405,7 +407,7 @@ class _ {
|
|
|
405
407
|
return this.position instanceof se ? this.position : this.position.toLogical(e);
|
|
406
408
|
}
|
|
407
409
|
toPhysical(e) {
|
|
408
|
-
return this.position instanceof
|
|
410
|
+
return this.position instanceof w ? this.position : this.position.toPhysical(e);
|
|
409
411
|
}
|
|
410
412
|
[d]() {
|
|
411
413
|
return {
|
|
@@ -435,7 +437,7 @@ async function I(t, e, i) {
|
|
|
435
437
|
return s("plugin:event|listen", {
|
|
436
438
|
event: t,
|
|
437
439
|
target: a,
|
|
438
|
-
handler:
|
|
440
|
+
handler: Oe(e)
|
|
439
441
|
}).then((l) => async () => ae(t, l));
|
|
440
442
|
}
|
|
441
443
|
async function F(t, e, i) {
|
|
@@ -456,7 +458,7 @@ async function le(t, e, i) {
|
|
|
456
458
|
payload: i
|
|
457
459
|
});
|
|
458
460
|
}
|
|
459
|
-
class
|
|
461
|
+
class S extends xe {
|
|
460
462
|
/**
|
|
461
463
|
* Creates an Image from a resource ID. For internal use only.
|
|
462
464
|
*
|
|
@@ -468,10 +470,10 @@ class D extends Pe {
|
|
|
468
470
|
/** Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height. */
|
|
469
471
|
static async new(e, i, n) {
|
|
470
472
|
return s("plugin:image|new", {
|
|
471
|
-
rgba:
|
|
473
|
+
rgba: x(e),
|
|
472
474
|
width: i,
|
|
473
475
|
height: n
|
|
474
|
-
}).then((a) => new
|
|
476
|
+
}).then((a) => new S(a));
|
|
475
477
|
}
|
|
476
478
|
/**
|
|
477
479
|
* Creates a new image using the provided bytes by inferring the file format.
|
|
@@ -488,8 +490,8 @@ class D extends Pe {
|
|
|
488
490
|
*/
|
|
489
491
|
static async fromBytes(e) {
|
|
490
492
|
return s("plugin:image|from_bytes", {
|
|
491
|
-
bytes:
|
|
492
|
-
}).then((i) => new
|
|
493
|
+
bytes: x(e)
|
|
494
|
+
}).then((i) => new S(i));
|
|
493
495
|
}
|
|
494
496
|
/**
|
|
495
497
|
* Creates a new image using the provided path.
|
|
@@ -504,7 +506,7 @@ class D extends Pe {
|
|
|
504
506
|
* ```
|
|
505
507
|
*/
|
|
506
508
|
static async fromPath(e) {
|
|
507
|
-
return s("plugin:image|from_path", { path: e }).then((i) => new
|
|
509
|
+
return s("plugin:image|from_path", { path: e }).then((i) => new S(i));
|
|
508
510
|
}
|
|
509
511
|
/** Returns the RGBA data for this image, in row-major order from top to bottom. */
|
|
510
512
|
async rgba() {
|
|
@@ -517,14 +519,14 @@ class D extends Pe {
|
|
|
517
519
|
return s("plugin:image|size", { rid: this.rid });
|
|
518
520
|
}
|
|
519
521
|
}
|
|
520
|
-
function
|
|
521
|
-
return t == null ? null : typeof t == "string" ? t : t instanceof
|
|
522
|
+
function x(t) {
|
|
523
|
+
return t == null ? null : typeof t == "string" ? t : t instanceof S ? t.rid : t;
|
|
522
524
|
}
|
|
523
525
|
var q;
|
|
524
526
|
(function(t) {
|
|
525
527
|
t[t.Critical = 1] = "Critical", t[t.Informational = 2] = "Informational";
|
|
526
528
|
})(q || (q = {}));
|
|
527
|
-
class
|
|
529
|
+
class Pe {
|
|
528
530
|
constructor(e) {
|
|
529
531
|
this._preventDefault = !1, this.event = e.event, this.id = e.id;
|
|
530
532
|
}
|
|
@@ -757,7 +759,7 @@ class k {
|
|
|
757
759
|
async innerPosition() {
|
|
758
760
|
return s("plugin:window|inner_position", {
|
|
759
761
|
label: this.label
|
|
760
|
-
}).then((e) => new
|
|
762
|
+
}).then((e) => new w(e));
|
|
761
763
|
}
|
|
762
764
|
/**
|
|
763
765
|
* The position of the top-left hand corner of the window relative to the top-left hand corner of the desktop.
|
|
@@ -772,7 +774,7 @@ class k {
|
|
|
772
774
|
async outerPosition() {
|
|
773
775
|
return s("plugin:window|outer_position", {
|
|
774
776
|
label: this.label
|
|
775
|
-
}).then((e) => new
|
|
777
|
+
}).then((e) => new w(e));
|
|
776
778
|
}
|
|
777
779
|
/**
|
|
778
780
|
* The physical size of the window's client area.
|
|
@@ -788,7 +790,7 @@ class k {
|
|
|
788
790
|
async innerSize() {
|
|
789
791
|
return s("plugin:window|inner_size", {
|
|
790
792
|
label: this.label
|
|
791
|
-
}).then((e) => new
|
|
793
|
+
}).then((e) => new b(e));
|
|
792
794
|
}
|
|
793
795
|
/**
|
|
794
796
|
* The physical size of the entire window.
|
|
@@ -804,7 +806,7 @@ class k {
|
|
|
804
806
|
async outerSize() {
|
|
805
807
|
return s("plugin:window|outer_size", {
|
|
806
808
|
label: this.label
|
|
807
|
-
}).then((e) => new
|
|
809
|
+
}).then((e) => new b(e));
|
|
808
810
|
}
|
|
809
811
|
/**
|
|
810
812
|
* Gets the window's current fullscreen state.
|
|
@@ -1455,7 +1457,7 @@ class k {
|
|
|
1455
1457
|
async setSize(e) {
|
|
1456
1458
|
return s("plugin:window|set_size", {
|
|
1457
1459
|
label: this.label,
|
|
1458
|
-
value: e instanceof
|
|
1460
|
+
value: e instanceof y ? e : new y(e)
|
|
1459
1461
|
});
|
|
1460
1462
|
}
|
|
1461
1463
|
/**
|
|
@@ -1472,7 +1474,7 @@ class k {
|
|
|
1472
1474
|
async setMinSize(e) {
|
|
1473
1475
|
return s("plugin:window|set_min_size", {
|
|
1474
1476
|
label: this.label,
|
|
1475
|
-
value: e instanceof
|
|
1477
|
+
value: e instanceof y ? e : e ? new y(e) : null
|
|
1476
1478
|
});
|
|
1477
1479
|
}
|
|
1478
1480
|
/**
|
|
@@ -1489,7 +1491,7 @@ class k {
|
|
|
1489
1491
|
async setMaxSize(e) {
|
|
1490
1492
|
return s("plugin:window|set_max_size", {
|
|
1491
1493
|
label: this.label,
|
|
1492
|
-
value: e instanceof
|
|
1494
|
+
value: e instanceof y ? e : e ? new y(e) : null
|
|
1493
1495
|
});
|
|
1494
1496
|
}
|
|
1495
1497
|
/**
|
|
@@ -1531,7 +1533,7 @@ class k {
|
|
|
1531
1533
|
async setPosition(e) {
|
|
1532
1534
|
return s("plugin:window|set_position", {
|
|
1533
1535
|
label: this.label,
|
|
1534
|
-
value: e instanceof
|
|
1536
|
+
value: e instanceof p ? e : new p(e)
|
|
1535
1537
|
});
|
|
1536
1538
|
}
|
|
1537
1539
|
/**
|
|
@@ -1625,7 +1627,7 @@ class k {
|
|
|
1625
1627
|
async setIcon(e) {
|
|
1626
1628
|
return s("plugin:window|set_icon", {
|
|
1627
1629
|
label: this.label,
|
|
1628
|
-
value:
|
|
1630
|
+
value: x(e)
|
|
1629
1631
|
});
|
|
1630
1632
|
}
|
|
1631
1633
|
/**
|
|
@@ -1743,7 +1745,7 @@ class k {
|
|
|
1743
1745
|
async setCursorPosition(e) {
|
|
1744
1746
|
return s("plugin:window|set_cursor_position", {
|
|
1745
1747
|
label: this.label,
|
|
1746
|
-
value: e instanceof
|
|
1748
|
+
value: e instanceof p ? e : new p(e)
|
|
1747
1749
|
});
|
|
1748
1750
|
}
|
|
1749
1751
|
/**
|
|
@@ -1860,7 +1862,7 @@ class k {
|
|
|
1860
1862
|
async setOverlayIcon(e) {
|
|
1861
1863
|
return s("plugin:window|set_overlay_icon", {
|
|
1862
1864
|
label: this.label,
|
|
1863
|
-
value: e ?
|
|
1865
|
+
value: e ? x(e) : void 0
|
|
1864
1866
|
});
|
|
1865
1867
|
}
|
|
1866
1868
|
/**
|
|
@@ -1950,7 +1952,7 @@ class k {
|
|
|
1950
1952
|
*/
|
|
1951
1953
|
async onResized(e) {
|
|
1952
1954
|
return this.listen(o.WINDOW_RESIZED, (i) => {
|
|
1953
|
-
i.payload = new
|
|
1955
|
+
i.payload = new b(i.payload), e(i);
|
|
1954
1956
|
});
|
|
1955
1957
|
}
|
|
1956
1958
|
/**
|
|
@@ -1972,7 +1974,7 @@ class k {
|
|
|
1972
1974
|
*/
|
|
1973
1975
|
async onMoved(e) {
|
|
1974
1976
|
return this.listen(o.WINDOW_MOVED, (i) => {
|
|
1975
|
-
i.payload = new
|
|
1977
|
+
i.payload = new w(i.payload), e(i);
|
|
1976
1978
|
});
|
|
1977
1979
|
}
|
|
1978
1980
|
/**
|
|
@@ -1999,7 +2001,7 @@ class k {
|
|
|
1999
2001
|
*/
|
|
2000
2002
|
async onCloseRequested(e) {
|
|
2001
2003
|
return this.listen(o.WINDOW_CLOSE_REQUESTED, async (i) => {
|
|
2002
|
-
const n = new
|
|
2004
|
+
const n = new Pe(i);
|
|
2003
2005
|
await e(n), n.isPreventDefault() || await this.destroy();
|
|
2004
2006
|
});
|
|
2005
2007
|
}
|
|
@@ -2035,7 +2037,7 @@ class k {
|
|
|
2035
2037
|
payload: {
|
|
2036
2038
|
type: "enter",
|
|
2037
2039
|
paths: r.payload.paths,
|
|
2038
|
-
position: new
|
|
2040
|
+
position: new w(r.payload.position)
|
|
2039
2041
|
}
|
|
2040
2042
|
});
|
|
2041
2043
|
}), n = await this.listen(o.DRAG_OVER, (r) => {
|
|
@@ -2043,7 +2045,7 @@ class k {
|
|
|
2043
2045
|
...r,
|
|
2044
2046
|
payload: {
|
|
2045
2047
|
type: "over",
|
|
2046
|
-
position: new
|
|
2048
|
+
position: new w(r.payload.position)
|
|
2047
2049
|
}
|
|
2048
2050
|
});
|
|
2049
2051
|
}), a = await this.listen(o.DRAG_DROP, (r) => {
|
|
@@ -2052,7 +2054,7 @@ class k {
|
|
|
2052
2054
|
payload: {
|
|
2053
2055
|
type: "drop",
|
|
2054
2056
|
paths: r.payload.paths,
|
|
2055
|
-
position: new
|
|
2057
|
+
position: new w(r.payload.position)
|
|
2056
2058
|
}
|
|
2057
2059
|
});
|
|
2058
2060
|
}), l = await this.listen(o.DRAG_LEAVE, (r) => {
|
|
@@ -2138,14 +2140,14 @@ var V;
|
|
|
2138
2140
|
(function(t) {
|
|
2139
2141
|
t.Disabled = "disabled", t.Throttle = "throttle", t.Suspend = "suspend";
|
|
2140
2142
|
})(V || (V = {}));
|
|
2141
|
-
var
|
|
2143
|
+
var $;
|
|
2142
2144
|
(function(t) {
|
|
2143
2145
|
t.Default = "default", t.FluentOverlay = "fluentOverlay";
|
|
2144
|
-
})(
|
|
2145
|
-
var
|
|
2146
|
+
})($ || ($ = {}));
|
|
2147
|
+
var j;
|
|
2146
2148
|
(function(t) {
|
|
2147
2149
|
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";
|
|
2148
|
-
})(
|
|
2150
|
+
})(j || (j = {}));
|
|
2149
2151
|
var J;
|
|
2150
2152
|
(function(t) {
|
|
2151
2153
|
t.FollowsWindowActiveState = "followsWindowActiveState", t.Active = "active", t.Inactive = "inactive";
|
|
@@ -2154,11 +2156,11 @@ function Ie(t) {
|
|
|
2154
2156
|
return t === null ? null : {
|
|
2155
2157
|
name: t.name,
|
|
2156
2158
|
scaleFactor: t.scaleFactor,
|
|
2157
|
-
position: new
|
|
2158
|
-
size: new
|
|
2159
|
+
position: new w(t.position),
|
|
2160
|
+
size: new b(t.size),
|
|
2159
2161
|
workArea: {
|
|
2160
|
-
position: new
|
|
2161
|
-
size: new
|
|
2162
|
+
position: new w(t.workArea.position),
|
|
2163
|
+
size: new b(t.workArea.size)
|
|
2162
2164
|
}
|
|
2163
2165
|
};
|
|
2164
2166
|
}
|
|
@@ -2371,7 +2373,7 @@ class B {
|
|
|
2371
2373
|
async position() {
|
|
2372
2374
|
return s("plugin:webview|webview_position", {
|
|
2373
2375
|
label: this.label
|
|
2374
|
-
}).then((e) => new
|
|
2376
|
+
}).then((e) => new w(e));
|
|
2375
2377
|
}
|
|
2376
2378
|
/**
|
|
2377
2379
|
* The physical size of the webview's client area.
|
|
@@ -2387,7 +2389,7 @@ class B {
|
|
|
2387
2389
|
async size() {
|
|
2388
2390
|
return s("plugin:webview|webview_size", {
|
|
2389
2391
|
label: this.label
|
|
2390
|
-
}).then((e) => new
|
|
2392
|
+
}).then((e) => new b(e));
|
|
2391
2393
|
}
|
|
2392
2394
|
// Setters
|
|
2393
2395
|
/**
|
|
@@ -2419,7 +2421,7 @@ class B {
|
|
|
2419
2421
|
async setSize(e) {
|
|
2420
2422
|
return s("plugin:webview|set_webview_size", {
|
|
2421
2423
|
label: this.label,
|
|
2422
|
-
value: e instanceof
|
|
2424
|
+
value: e instanceof y ? e : new y(e)
|
|
2423
2425
|
});
|
|
2424
2426
|
}
|
|
2425
2427
|
/**
|
|
@@ -2436,7 +2438,7 @@ class B {
|
|
|
2436
2438
|
async setPosition(e) {
|
|
2437
2439
|
return s("plugin:webview|set_webview_position", {
|
|
2438
2440
|
label: this.label,
|
|
2439
|
-
value: e instanceof
|
|
2441
|
+
value: e instanceof p ? e : new p(e)
|
|
2440
2442
|
});
|
|
2441
2443
|
}
|
|
2442
2444
|
/**
|
|
@@ -2598,7 +2600,7 @@ class B {
|
|
|
2598
2600
|
payload: {
|
|
2599
2601
|
type: "enter",
|
|
2600
2602
|
paths: r.payload.paths,
|
|
2601
|
-
position: new
|
|
2603
|
+
position: new w(r.payload.position)
|
|
2602
2604
|
}
|
|
2603
2605
|
});
|
|
2604
2606
|
}), n = await this.listen(o.DRAG_OVER, (r) => {
|
|
@@ -2606,7 +2608,7 @@ class B {
|
|
|
2606
2608
|
...r,
|
|
2607
2609
|
payload: {
|
|
2608
2610
|
type: "over",
|
|
2609
|
-
position: new
|
|
2611
|
+
position: new w(r.payload.position)
|
|
2610
2612
|
}
|
|
2611
2613
|
});
|
|
2612
2614
|
}), a = await this.listen(o.DRAG_DROP, (r) => {
|
|
@@ -2615,7 +2617,7 @@ class B {
|
|
|
2615
2617
|
payload: {
|
|
2616
2618
|
type: "drop",
|
|
2617
2619
|
paths: r.payload.paths,
|
|
2618
|
-
position: new
|
|
2620
|
+
position: new w(r.payload.position)
|
|
2619
2621
|
}
|
|
2620
2622
|
});
|
|
2621
2623
|
}), l = await this.listen(o.DRAG_LEAVE, (r) => {
|
|
@@ -2626,17 +2628,17 @@ class B {
|
|
|
2626
2628
|
};
|
|
2627
2629
|
}
|
|
2628
2630
|
}
|
|
2629
|
-
function
|
|
2631
|
+
function O() {
|
|
2630
2632
|
const t = ue();
|
|
2631
|
-
return new
|
|
2633
|
+
return new _(t.label, { skip: !0 });
|
|
2632
2634
|
}
|
|
2633
2635
|
async function Y() {
|
|
2634
|
-
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new
|
|
2636
|
+
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new _(e, {
|
|
2635
2637
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
2636
2638
|
skip: !0
|
|
2637
2639
|
})));
|
|
2638
2640
|
}
|
|
2639
|
-
class
|
|
2641
|
+
class _ {
|
|
2640
2642
|
/**
|
|
2641
2643
|
* Creates a new {@link Window} hosting a {@link Webview}.
|
|
2642
2644
|
* @example
|
|
@@ -2680,13 +2682,13 @@ class f {
|
|
|
2680
2682
|
static async getByLabel(e) {
|
|
2681
2683
|
var i;
|
|
2682
2684
|
const n = (i = (await Y()).find((a) => a.label === e)) !== null && i !== void 0 ? i : null;
|
|
2683
|
-
return n ? new
|
|
2685
|
+
return n ? new _(n.label, { skip: !0 }) : null;
|
|
2684
2686
|
}
|
|
2685
2687
|
/**
|
|
2686
2688
|
* Get an instance of `Webview` for the current webview.
|
|
2687
2689
|
*/
|
|
2688
2690
|
static getCurrent() {
|
|
2689
|
-
return
|
|
2691
|
+
return O();
|
|
2690
2692
|
}
|
|
2691
2693
|
/**
|
|
2692
2694
|
* Gets a list of instances of `Webview` for all available webviews.
|
|
@@ -2768,7 +2770,7 @@ class f {
|
|
|
2768
2770
|
return s("plugin:window|set_background_color", { color: e }).then(() => s("plugin:webview|set_webview_background_color", { color: e }));
|
|
2769
2771
|
}
|
|
2770
2772
|
}
|
|
2771
|
-
Ce(
|
|
2773
|
+
Ce(_, [k, B]);
|
|
2772
2774
|
function Ce(t, e) {
|
|
2773
2775
|
(Array.isArray(e) ? e : [e]).forEach((i) => {
|
|
2774
2776
|
Object.getOwnPropertyNames(i.prototype).forEach((n) => {
|
|
@@ -2782,7 +2784,7 @@ function Ce(t, e) {
|
|
|
2782
2784
|
});
|
|
2783
2785
|
});
|
|
2784
2786
|
}
|
|
2785
|
-
const
|
|
2787
|
+
const D = /* @__PURE__ */ new Map(), Le = (t) => {
|
|
2786
2788
|
if (!t || t.trim() === "") return !1;
|
|
2787
2789
|
try {
|
|
2788
2790
|
return !!(t.startsWith("/") || t.startsWith("http://") || t.startsWith("https://") || t.startsWith("tauri://"));
|
|
@@ -2833,7 +2835,7 @@ const A = /* @__PURE__ */ new Map(), Le = (t) => {
|
|
|
2833
2835
|
};
|
|
2834
2836
|
}
|
|
2835
2837
|
}, Re = async (t) => {
|
|
2836
|
-
const e = String(t.id), i =
|
|
2838
|
+
const e = String(t.id), i = c.getState();
|
|
2837
2839
|
if (i.isWindowActive(e)) {
|
|
2838
2840
|
console.log(`Notice window already open for message: ${e}`);
|
|
2839
2841
|
return;
|
|
@@ -2841,65 +2843,65 @@ const A = /* @__PURE__ */ new Map(), Le = (t) => {
|
|
|
2841
2843
|
const n = ee(), a = `notice-${e}`;
|
|
2842
2844
|
let l = `${n.routePrefix}/${t.type}?id=${t.id}`;
|
|
2843
2845
|
Le(l) || (console.warn(`Invalid window URL: ${l}. Using fallback 404 page.`), l = n.notFoundUrl || "/404");
|
|
2844
|
-
const r = t.min_width || n.defaultWidth, u = t.min_height || n.defaultHeight, { x: m, y:
|
|
2846
|
+
const r = t.min_width || n.defaultWidth, u = t.min_height || n.defaultHeight, f = t.decorations ?? n.defaultDecorations ?? !0, { x: m, y: A } = await Ee(r, u, t.windowPosition);
|
|
2845
2847
|
try {
|
|
2846
|
-
const
|
|
2848
|
+
const h = new _(a, {
|
|
2847
2849
|
url: l,
|
|
2848
2850
|
title: t.title,
|
|
2849
2851
|
width: r,
|
|
2850
2852
|
height: u,
|
|
2851
2853
|
x: m,
|
|
2852
|
-
y:
|
|
2854
|
+
y: A,
|
|
2853
2855
|
resizable: !0,
|
|
2854
|
-
decorations:
|
|
2856
|
+
decorations: f,
|
|
2855
2857
|
skipTaskbar: !1,
|
|
2856
2858
|
alwaysOnTop: !0
|
|
2857
2859
|
});
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
+
D.set(e, h), i.addActiveWindow(e), h.once("tauri://destroyed", async () => {
|
|
2861
|
+
D.delete(e), i.removeActiveWindow(e), await i.markMessageAsShown(e), i.clearCurrent();
|
|
2860
2862
|
}), console.log(`Created notice window: ${a}`);
|
|
2861
|
-
} catch (
|
|
2862
|
-
console.error("Failed to create notice window:",
|
|
2863
|
+
} catch (h) {
|
|
2864
|
+
console.error("Failed to create notice window:", h), i.removeActiveWindow(e), i.clearCurrent();
|
|
2863
2865
|
}
|
|
2864
2866
|
}, U = async (t) => {
|
|
2865
|
-
const e = String(t), i =
|
|
2867
|
+
const e = String(t), i = D.get(e), n = c.getState();
|
|
2866
2868
|
if (i)
|
|
2867
2869
|
try {
|
|
2868
|
-
await i.close(),
|
|
2870
|
+
await i.close(), D.delete(e), n.removeActiveWindow(e), await n.markMessageAsShown(e), n.clearCurrent(), console.log(`Closed notice window: ${e}`);
|
|
2869
2871
|
} catch (a) {
|
|
2870
2872
|
console.error("Failed to close notice window:", a);
|
|
2871
2873
|
}
|
|
2872
2874
|
}, Te = async () => {
|
|
2873
|
-
const t = Array.from(
|
|
2875
|
+
const t = Array.from(D.keys()).map(
|
|
2874
2876
|
(e) => U(e)
|
|
2875
2877
|
);
|
|
2876
2878
|
await Promise.all(t);
|
|
2877
2879
|
}, qe = () => {
|
|
2878
2880
|
let t = null;
|
|
2879
|
-
|
|
2881
|
+
c.subscribe((e) => {
|
|
2880
2882
|
const i = e.currentMessage;
|
|
2881
2883
|
i && i !== t ? (t = i, Re(i)) : i || (t = null);
|
|
2882
2884
|
}), console.log("Notice window system initialized");
|
|
2883
|
-
},
|
|
2884
|
-
const t =
|
|
2885
|
-
return { closeNotice:
|
|
2885
|
+
}, $e = () => {
|
|
2886
|
+
const t = c((i) => i.currentMessage);
|
|
2887
|
+
return { closeNotice: P(async () => {
|
|
2886
2888
|
t && await U(t.id);
|
|
2887
2889
|
}, [t]) };
|
|
2888
|
-
},
|
|
2889
|
-
const t =
|
|
2890
|
-
return { hideNotice:
|
|
2890
|
+
}, je = () => {
|
|
2891
|
+
const t = c((i) => i.hideMessage);
|
|
2892
|
+
return { hideNotice: P(
|
|
2891
2893
|
async (i) => {
|
|
2892
2894
|
await t(i), await U(i);
|
|
2893
2895
|
},
|
|
2894
2896
|
[t]
|
|
2895
2897
|
) };
|
|
2896
2898
|
}, Je = () => {
|
|
2897
|
-
const t =
|
|
2898
|
-
return { hideAllNotices:
|
|
2899
|
+
const t = c((i) => i.clearOnLogout);
|
|
2900
|
+
return { hideAllNotices: P(async () => {
|
|
2899
2901
|
await Te(), await t();
|
|
2900
2902
|
}, [t]) };
|
|
2901
2903
|
}, Ze = () => {
|
|
2902
|
-
const t =
|
|
2904
|
+
const t = c(z.queueLength), e = c(z.currentMessage), i = c(z.isProcessing), n = c(z.queue);
|
|
2903
2905
|
return {
|
|
2904
2906
|
queueLength: t,
|
|
2905
2907
|
currentMessage: e,
|
|
@@ -2907,50 +2909,50 @@ const A = /* @__PURE__ */ new Map(), Le = (t) => {
|
|
|
2907
2909
|
queue: n
|
|
2908
2910
|
};
|
|
2909
2911
|
}, Ye = ({ children: t, onLoad: e, onClose: i }) => {
|
|
2910
|
-
const [n, a] = L(null), [l, r] = L(!0), [u,
|
|
2912
|
+
const [n, a] = L(null), [l, r] = L(!0), [u, f] = L(null);
|
|
2911
2913
|
return G(() => {
|
|
2912
2914
|
(async () => {
|
|
2913
2915
|
try {
|
|
2914
|
-
const
|
|
2915
|
-
if (!
|
|
2916
|
-
|
|
2916
|
+
const h = new URLSearchParams(window.location.search).get("id");
|
|
2917
|
+
if (!h) {
|
|
2918
|
+
f("No message ID provided"), r(!1), setTimeout(async () => {
|
|
2917
2919
|
try {
|
|
2918
|
-
await
|
|
2919
|
-
} catch (
|
|
2920
|
-
console.error("Failed to close window:",
|
|
2920
|
+
await O().close();
|
|
2921
|
+
} catch (v) {
|
|
2922
|
+
console.error("Failed to close window:", v);
|
|
2921
2923
|
}
|
|
2922
2924
|
}, 1e3);
|
|
2923
2925
|
return;
|
|
2924
2926
|
}
|
|
2925
|
-
const C = await ie(
|
|
2927
|
+
const C = await ie(h);
|
|
2926
2928
|
if (!C) {
|
|
2927
|
-
console.log(`Message ${
|
|
2929
|
+
console.log(`Message ${h} not found in database, closing window`), f("Message not found"), r(!1), setTimeout(async () => {
|
|
2928
2930
|
try {
|
|
2929
|
-
await
|
|
2930
|
-
} catch (
|
|
2931
|
-
console.error("Failed to close window:",
|
|
2931
|
+
await O().close();
|
|
2932
|
+
} catch (v) {
|
|
2933
|
+
console.error("Failed to close window:", v);
|
|
2932
2934
|
}
|
|
2933
2935
|
}, 500);
|
|
2934
2936
|
return;
|
|
2935
2937
|
}
|
|
2936
2938
|
a(C), r(!1), e && e(C);
|
|
2937
|
-
} catch (
|
|
2938
|
-
console.error("Failed to load message:",
|
|
2939
|
+
} catch (A) {
|
|
2940
|
+
console.error("Failed to load message:", A), f("Failed to load message"), r(!1), setTimeout(async () => {
|
|
2939
2941
|
try {
|
|
2940
|
-
await
|
|
2941
|
-
} catch (
|
|
2942
|
-
console.error("Failed to close window:",
|
|
2942
|
+
await O().close();
|
|
2943
|
+
} catch (h) {
|
|
2944
|
+
console.error("Failed to close window:", h);
|
|
2943
2945
|
}
|
|
2944
2946
|
}, 1e3);
|
|
2945
2947
|
}
|
|
2946
2948
|
})();
|
|
2947
2949
|
}, [e]), G(() => {
|
|
2948
2950
|
if (!n || !i) return;
|
|
2949
|
-
const
|
|
2951
|
+
const m = () => {
|
|
2950
2952
|
i(n);
|
|
2951
2953
|
};
|
|
2952
|
-
return window.addEventListener("beforeunload",
|
|
2953
|
-
window.removeEventListener("beforeunload",
|
|
2954
|
+
return window.addEventListener("beforeunload", m), () => {
|
|
2955
|
+
window.removeEventListener("beforeunload", m);
|
|
2954
2956
|
};
|
|
2955
2957
|
}, [n, i]), l ? /* @__PURE__ */ N("div", { style: {
|
|
2956
2958
|
display: "flex",
|
|
@@ -2975,27 +2977,36 @@ const A = /* @__PURE__ */ new Map(), Le = (t) => {
|
|
|
2975
2977
|
}, children: "Closing window..." });
|
|
2976
2978
|
}, Ke = async () => {
|
|
2977
2979
|
te(), qe();
|
|
2978
|
-
const { initializeFromDatabase: t } =
|
|
2980
|
+
const { initializeFromDatabase: t } = c.getState();
|
|
2979
2981
|
await t(), console.log("Tauri Notice System initialized");
|
|
2982
|
+
}, Xe = async (t) => {
|
|
2983
|
+
await c.getState().deleteMessage(t);
|
|
2984
|
+
}, et = async (t) => {
|
|
2985
|
+
await c.getState().hideMessage(t);
|
|
2986
|
+
}, tt = async (t) => {
|
|
2987
|
+
await c.getState().markMessageAsShown(t);
|
|
2980
2988
|
};
|
|
2981
2989
|
export {
|
|
2982
2990
|
Ye as NoticeLayout,
|
|
2983
2991
|
Te as closeAllNoticeWindows,
|
|
2984
2992
|
U as closeNoticeWindow,
|
|
2985
2993
|
Re as createNoticeWindow,
|
|
2994
|
+
Xe as deleteMessageById,
|
|
2986
2995
|
ie as getMessage,
|
|
2987
2996
|
ee as getNoticeConfig,
|
|
2988
2997
|
fe as getPendingMessages,
|
|
2998
|
+
et as hideMessageById,
|
|
2989
2999
|
te as initializeDatabase,
|
|
2990
3000
|
Ke as initializeNoticeSystem,
|
|
2991
3001
|
qe as initializeNoticeWindowSystem,
|
|
3002
|
+
tt as markMessageAsShown,
|
|
2992
3003
|
z as messageQueueSelectors,
|
|
2993
3004
|
He as setNoticeConfig,
|
|
2994
|
-
|
|
3005
|
+
$e as useCloseNotice,
|
|
2995
3006
|
Je as useHideAllNotices,
|
|
2996
|
-
|
|
3007
|
+
je as useHideNotice,
|
|
2997
3008
|
Ze as useMessageQueue,
|
|
2998
|
-
|
|
3009
|
+
c as useMessageQueueStore,
|
|
2999
3010
|
Ve as useNoticeWindow
|
|
3000
3011
|
};
|
|
3001
3012
|
//# sourceMappingURL=index.js.map
|