tauri-notice-window 1.0.12 → 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 +29 -2
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +167 -166
- 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,8 +227,8 @@ 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
|
|
231
|
-
const
|
|
230
|
+
var O;
|
|
231
|
+
const h = "__TAURI_TO_IPC_KEY__";
|
|
232
232
|
function Oe(t, e = !1) {
|
|
233
233
|
return window.__TAURI_INTERNALS__.transformCallback(t, e);
|
|
234
234
|
}
|
|
@@ -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]);
|
|
@@ -275,14 +275,14 @@ class ne {
|
|
|
275
275
|
toPhysical(e) {
|
|
276
276
|
return new b(this.width * e, this.height * e);
|
|
277
277
|
}
|
|
278
|
-
[
|
|
278
|
+
[h]() {
|
|
279
279
|
return {
|
|
280
280
|
width: this.width,
|
|
281
281
|
height: this.height
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
284
|
toJSON() {
|
|
285
|
-
return this[
|
|
285
|
+
return this[h]();
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
class b {
|
|
@@ -303,14 +303,14 @@ class b {
|
|
|
303
303
|
toLogical(e) {
|
|
304
304
|
return new ne(this.width / e, this.height / e);
|
|
305
305
|
}
|
|
306
|
-
[
|
|
306
|
+
[h]() {
|
|
307
307
|
return {
|
|
308
308
|
width: this.width,
|
|
309
309
|
height: this.height
|
|
310
310
|
};
|
|
311
311
|
}
|
|
312
312
|
toJSON() {
|
|
313
|
-
return this[
|
|
313
|
+
return this[h]();
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
class y {
|
|
@@ -323,7 +323,7 @@ class y {
|
|
|
323
323
|
toPhysical(e) {
|
|
324
324
|
return this.size instanceof b ? this.size : this.size.toPhysical(e);
|
|
325
325
|
}
|
|
326
|
-
[
|
|
326
|
+
[h]() {
|
|
327
327
|
return {
|
|
328
328
|
[`${this.size.type}`]: {
|
|
329
329
|
width: this.size.width,
|
|
@@ -332,7 +332,7 @@ class y {
|
|
|
332
332
|
};
|
|
333
333
|
}
|
|
334
334
|
toJSON() {
|
|
335
|
-
return this[
|
|
335
|
+
return this[h]();
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
class se {
|
|
@@ -355,19 +355,19 @@ 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 {
|
|
362
362
|
x: this.x,
|
|
363
363
|
y: this.y
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
366
|
toJSON() {
|
|
367
|
-
return this[
|
|
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
|
}
|
|
@@ -389,17 +389,17 @@ class w {
|
|
|
389
389
|
toLogical(e) {
|
|
390
390
|
return new se(this.x / e, this.y / e);
|
|
391
391
|
}
|
|
392
|
-
[
|
|
392
|
+
[h]() {
|
|
393
393
|
return {
|
|
394
394
|
x: this.x,
|
|
395
395
|
y: this.y
|
|
396
396
|
};
|
|
397
397
|
}
|
|
398
398
|
toJSON() {
|
|
399
|
-
return this[
|
|
399
|
+
return this[h]();
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
|
-
class
|
|
402
|
+
class _ {
|
|
403
403
|
constructor(e) {
|
|
404
404
|
this.position = e;
|
|
405
405
|
}
|
|
@@ -407,9 +407,9 @@ class p {
|
|
|
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 {
|
|
414
414
|
[`${this.position.type}`]: {
|
|
415
415
|
x: this.position.x,
|
|
@@ -418,7 +418,7 @@ class p {
|
|
|
418
418
|
};
|
|
419
419
|
}
|
|
420
420
|
toJSON() {
|
|
421
|
-
return this[
|
|
421
|
+
return this[h]();
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
424
|
var o;
|
|
@@ -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.
|
|
@@ -1533,7 +1533,7 @@ class k {
|
|
|
1533
1533
|
async setPosition(e) {
|
|
1534
1534
|
return s("plugin:window|set_position", {
|
|
1535
1535
|
label: this.label,
|
|
1536
|
-
value: e instanceof
|
|
1536
|
+
value: e instanceof _ ? e : new _(e)
|
|
1537
1537
|
});
|
|
1538
1538
|
}
|
|
1539
1539
|
/**
|
|
@@ -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
|
/**
|
|
@@ -1745,7 +1745,7 @@ class k {
|
|
|
1745
1745
|
async setCursorPosition(e) {
|
|
1746
1746
|
return s("plugin:window|set_cursor_position", {
|
|
1747
1747
|
label: this.label,
|
|
1748
|
-
value: e instanceof
|
|
1748
|
+
value: e instanceof _ ? e : new _(e)
|
|
1749
1749
|
});
|
|
1750
1750
|
}
|
|
1751
1751
|
/**
|
|
@@ -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
|
/**
|
|
@@ -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,10 +2156,10 @@ function Ie(t) {
|
|
|
2156
2156
|
return t === null ? null : {
|
|
2157
2157
|
name: t.name,
|
|
2158
2158
|
scaleFactor: t.scaleFactor,
|
|
2159
|
-
position: new
|
|
2159
|
+
position: new d(t.position),
|
|
2160
2160
|
size: new b(t.size),
|
|
2161
2161
|
workArea: {
|
|
2162
|
-
position: new
|
|
2162
|
+
position: new d(t.workArea.position),
|
|
2163
2163
|
size: new b(t.workArea.size)
|
|
2164
2164
|
}
|
|
2165
2165
|
};
|
|
@@ -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.
|
|
@@ -2438,7 +2438,7 @@ class B {
|
|
|
2438
2438
|
async setPosition(e) {
|
|
2439
2439
|
return s("plugin:webview|set_webview_position", {
|
|
2440
2440
|
label: this.label,
|
|
2441
|
-
value: e instanceof
|
|
2441
|
+
value: e instanceof _ ? e : new _(e)
|
|
2442
2442
|
});
|
|
2443
2443
|
}
|
|
2444
2444
|
/**
|
|
@@ -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,17 +2628,17 @@ class B {
|
|
|
2628
2628
|
};
|
|
2629
2629
|
}
|
|
2630
2630
|
}
|
|
2631
|
-
function
|
|
2631
|
+
function x() {
|
|
2632
2632
|
const t = ue();
|
|
2633
|
-
return new
|
|
2633
|
+
return new f(t.label, { skip: !0 });
|
|
2634
2634
|
}
|
|
2635
2635
|
async function Y() {
|
|
2636
|
-
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 f(e, {
|
|
2637
2637
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
2638
2638
|
skip: !0
|
|
2639
2639
|
})));
|
|
2640
2640
|
}
|
|
2641
|
-
class
|
|
2641
|
+
class f {
|
|
2642
2642
|
/**
|
|
2643
2643
|
* Creates a new {@link Window} hosting a {@link Webview}.
|
|
2644
2644
|
* @example
|
|
@@ -2682,13 +2682,13 @@ class _ {
|
|
|
2682
2682
|
static async getByLabel(e) {
|
|
2683
2683
|
var i;
|
|
2684
2684
|
const n = (i = (await Y()).find((a) => a.label === e)) !== null && i !== void 0 ? i : null;
|
|
2685
|
-
return n ? new
|
|
2685
|
+
return n ? new f(n.label, { skip: !0 }) : null;
|
|
2686
2686
|
}
|
|
2687
2687
|
/**
|
|
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 _ {
|
|
|
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 _ {
|
|
|
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(
|
|
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,140 +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: f,
|
|
2857
2856
|
skipTaskbar: !1,
|
|
2858
2857
|
alwaysOnTop: !0
|
|
2859
|
-
}
|
|
2860
|
-
|
|
2861
|
-
|
|
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();
|
|
2862
2863
|
}), console.log(`Created notice window: ${a}`);
|
|
2863
|
-
} catch (
|
|
2864
|
-
console.error("Failed to create notice window:",
|
|
2864
|
+
} catch (u) {
|
|
2865
|
+
console.error("Failed to create notice window:", u), i.removeActiveWindow(e), i.clearCurrent();
|
|
2865
2866
|
}
|
|
2866
2867
|
}, U = async (t) => {
|
|
2867
|
-
const e = String(t), i =
|
|
2868
|
+
const e = String(t), i = A.get(e), n = w.getState();
|
|
2868
2869
|
if (i)
|
|
2869
2870
|
try {
|
|
2870
|
-
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}`);
|
|
2871
2872
|
} catch (a) {
|
|
2872
2873
|
console.error("Failed to close notice window:", a);
|
|
2873
2874
|
}
|
|
2874
|
-
},
|
|
2875
|
-
const t = Array.from(
|
|
2875
|
+
}, qe = async () => {
|
|
2876
|
+
const t = Array.from(A.keys()).map(
|
|
2876
2877
|
(e) => U(e)
|
|
2877
2878
|
);
|
|
2878
2879
|
await Promise.all(t);
|
|
2879
|
-
},
|
|
2880
|
+
}, Fe = () => {
|
|
2880
2881
|
let t = null;
|
|
2881
|
-
|
|
2882
|
+
w.subscribe((e) => {
|
|
2882
2883
|
const i = e.currentMessage;
|
|
2883
|
-
i && i !== t ? (t = i,
|
|
2884
|
+
i && i !== t ? (t = i, Te(i)) : i || (t = null);
|
|
2884
2885
|
}), console.log("Notice window system initialized");
|
|
2885
|
-
},
|
|
2886
|
-
const t =
|
|
2887
|
-
return { closeNotice:
|
|
2886
|
+
}, je = () => {
|
|
2887
|
+
const t = w((i) => i.currentMessage);
|
|
2888
|
+
return { closeNotice: I(async () => {
|
|
2888
2889
|
t && await U(t.id);
|
|
2889
2890
|
}, [t]) };
|
|
2890
|
-
},
|
|
2891
|
-
const t =
|
|
2892
|
-
return { hideNotice:
|
|
2891
|
+
}, Je = () => {
|
|
2892
|
+
const t = w((i) => i.hideMessage);
|
|
2893
|
+
return { hideNotice: I(
|
|
2893
2894
|
async (i) => {
|
|
2894
2895
|
await t(i), await U(i);
|
|
2895
2896
|
},
|
|
2896
2897
|
[t]
|
|
2897
2898
|
) };
|
|
2898
|
-
}, Je = () => {
|
|
2899
|
-
const t = c((i) => i.clearOnLogout);
|
|
2900
|
-
return { hideAllNotices: P(async () => {
|
|
2901
|
-
await Te(), await t();
|
|
2902
|
-
}, [t]) };
|
|
2903
2899
|
}, Ze = () => {
|
|
2904
|
-
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);
|
|
2905
2906
|
return {
|
|
2906
2907
|
queueLength: t,
|
|
2907
2908
|
currentMessage: e,
|
|
2908
2909
|
isProcessing: i,
|
|
2909
2910
|
queue: n
|
|
2910
2911
|
};
|
|
2911
|
-
},
|
|
2912
|
-
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);
|
|
2913
2914
|
return G(() => {
|
|
2914
2915
|
(async () => {
|
|
2915
2916
|
try {
|
|
2916
|
-
const
|
|
2917
|
-
if (!
|
|
2918
|
-
|
|
2917
|
+
const u = new URLSearchParams(window.location.search).get("id");
|
|
2918
|
+
if (!u) {
|
|
2919
|
+
m("No message ID provided"), r(!1), setTimeout(async () => {
|
|
2919
2920
|
try {
|
|
2920
|
-
await
|
|
2921
|
-
} catch (
|
|
2922
|
-
console.error("Failed to close window:",
|
|
2921
|
+
await x().close();
|
|
2922
|
+
} catch (W) {
|
|
2923
|
+
console.error("Failed to close window:", W);
|
|
2923
2924
|
}
|
|
2924
2925
|
}, 1e3);
|
|
2925
2926
|
return;
|
|
2926
2927
|
}
|
|
2927
|
-
const
|
|
2928
|
-
if (!
|
|
2929
|
-
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 () => {
|
|
2930
2931
|
try {
|
|
2931
|
-
await
|
|
2932
|
-
} catch (
|
|
2933
|
-
console.error("Failed to close window:",
|
|
2932
|
+
await x().close();
|
|
2933
|
+
} catch (W) {
|
|
2934
|
+
console.error("Failed to close window:", W);
|
|
2934
2935
|
}
|
|
2935
2936
|
}, 500);
|
|
2936
2937
|
return;
|
|
2937
2938
|
}
|
|
2938
|
-
a(
|
|
2939
|
-
} catch (
|
|
2940
|
-
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 () => {
|
|
2941
2942
|
try {
|
|
2942
|
-
await
|
|
2943
|
-
} catch (
|
|
2944
|
-
console.error("Failed to close window:",
|
|
2943
|
+
await x().close();
|
|
2944
|
+
} catch (u) {
|
|
2945
|
+
console.error("Failed to close window:", u);
|
|
2945
2946
|
}
|
|
2946
2947
|
}, 1e3);
|
|
2947
2948
|
}
|
|
2948
2949
|
})();
|
|
2949
2950
|
}, [e]), G(() => {
|
|
2950
2951
|
if (!n || !i) return;
|
|
2951
|
-
const
|
|
2952
|
+
const v = () => {
|
|
2952
2953
|
i(n);
|
|
2953
2954
|
};
|
|
2954
|
-
return window.addEventListener("beforeunload",
|
|
2955
|
-
window.removeEventListener("beforeunload",
|
|
2955
|
+
return window.addEventListener("beforeunload", v), () => {
|
|
2956
|
+
window.removeEventListener("beforeunload", v);
|
|
2956
2957
|
};
|
|
2957
|
-
}, [n, i]), l ? /* @__PURE__ */
|
|
2958
|
+
}, [n, i]), l ? /* @__PURE__ */ z("div", { style: {
|
|
2958
2959
|
display: "flex",
|
|
2959
2960
|
justifyContent: "center",
|
|
2960
2961
|
alignItems: "center",
|
|
2961
2962
|
height: "100vh",
|
|
2962
2963
|
fontFamily: "system-ui, -apple-system, sans-serif"
|
|
2963
|
-
}, children: "Loading..." }) :
|
|
2964
|
+
}, children: "Loading..." }) : c ? /* @__PURE__ */ z("div", { style: {
|
|
2964
2965
|
display: "flex",
|
|
2965
2966
|
justifyContent: "center",
|
|
2966
2967
|
alignItems: "center",
|
|
2967
2968
|
height: "100vh",
|
|
2968
2969
|
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
2969
2970
|
color: "#ef4444"
|
|
2970
|
-
}, children:
|
|
2971
|
+
}, children: c }) : n ? /* @__PURE__ */ z(he, { children: t(n) }) : /* @__PURE__ */ z("div", { style: {
|
|
2971
2972
|
display: "flex",
|
|
2972
2973
|
justifyContent: "center",
|
|
2973
2974
|
alignItems: "center",
|
|
@@ -2975,38 +2976,38 @@ const D = /* @__PURE__ */ new Map(), Le = (t) => {
|
|
|
2975
2976
|
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
2976
2977
|
color: "#ef4444"
|
|
2977
2978
|
}, children: "Closing window..." });
|
|
2978
|
-
},
|
|
2979
|
-
te(),
|
|
2980
|
-
const { initializeFromDatabase: t } =
|
|
2979
|
+
}, Xe = async () => {
|
|
2980
|
+
te(), Fe();
|
|
2981
|
+
const { initializeFromDatabase: t } = w.getState();
|
|
2981
2982
|
await t(), console.log("Tauri Notice System initialized");
|
|
2982
|
-
}, Xe = async (t) => {
|
|
2983
|
-
await c.getState().deleteMessage(t);
|
|
2984
2983
|
}, et = async (t) => {
|
|
2985
|
-
await
|
|
2984
|
+
await w.getState().deleteMessage(t);
|
|
2986
2985
|
}, tt = async (t) => {
|
|
2987
|
-
await
|
|
2986
|
+
await w.getState().hideMessage(t);
|
|
2987
|
+
}, it = async (t) => {
|
|
2988
|
+
await w.getState().markMessageAsShown(t);
|
|
2988
2989
|
};
|
|
2989
2990
|
export {
|
|
2990
|
-
|
|
2991
|
-
|
|
2991
|
+
Ke as NoticeLayout,
|
|
2992
|
+
qe as closeAllNoticeWindows,
|
|
2992
2993
|
U as closeNoticeWindow,
|
|
2993
|
-
|
|
2994
|
-
|
|
2994
|
+
Te as createNoticeWindow,
|
|
2995
|
+
et as deleteMessageById,
|
|
2995
2996
|
ie as getMessage,
|
|
2996
2997
|
ee as getNoticeConfig,
|
|
2997
2998
|
fe as getPendingMessages,
|
|
2998
|
-
|
|
2999
|
+
tt as hideMessageById,
|
|
2999
3000
|
te as initializeDatabase,
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
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
|
|
3011
3012
|
};
|
|
3012
3013
|
//# sourceMappingURL=index.js.map
|