tauri-notice-window 1.0.9 → 1.0.11
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 +191 -83
- package/dist/hooks/useHideNotice.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +53 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +212 -222
- package/dist/index.js.map +1 -1
- package/dist/stores/messageQueueStore.d.ts +4 -1
- package/dist/stores/messageQueueStore.d.ts.map +1 -1
- package/dist/utils/db.d.ts +2 -1
- package/dist/utils/db.d.ts.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
|
-
import { create as
|
|
2
|
-
import { syncTabs as
|
|
3
|
-
import
|
|
4
|
-
import { useCallback as
|
|
5
|
-
import { jsx as
|
|
1
|
+
import { create as ce } from "zustand";
|
|
2
|
+
import { syncTabs as we } from "zustand-sync";
|
|
3
|
+
import de from "dexie";
|
|
4
|
+
import { useCallback as P, useState as L, useEffect as G } from "react";
|
|
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",
|
|
@@ -19,7 +19,7 @@ const K = "tauri-notice-config", Q = {
|
|
|
19
19
|
console.warn("Failed to load config from localStorage:", t);
|
|
20
20
|
}
|
|
21
21
|
return Q;
|
|
22
|
-
},
|
|
22
|
+
}, ge = (t) => {
|
|
23
23
|
try {
|
|
24
24
|
localStorage.setItem(K, JSON.stringify(t));
|
|
25
25
|
} catch (e) {
|
|
@@ -27,9 +27,9 @@ const K = "tauri-notice-config", Q = {
|
|
|
27
27
|
}
|
|
28
28
|
}, He = (t) => {
|
|
29
29
|
const i = { ...X(), ...t };
|
|
30
|
-
|
|
30
|
+
ge(i);
|
|
31
31
|
}, ee = () => X();
|
|
32
|
-
class
|
|
32
|
+
class ye extends de {
|
|
33
33
|
messages;
|
|
34
34
|
constructor(e) {
|
|
35
35
|
super(e), this.version(1).stores({
|
|
@@ -37,14 +37,14 @@ class fe extends be {
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
let
|
|
40
|
+
let S = null;
|
|
41
41
|
const te = () => {
|
|
42
|
-
if (!
|
|
42
|
+
if (!S) {
|
|
43
43
|
const t = ee();
|
|
44
|
-
|
|
44
|
+
S = new ye(t.databaseName);
|
|
45
45
|
}
|
|
46
|
-
return
|
|
47
|
-
}, h = () =>
|
|
46
|
+
return S;
|
|
47
|
+
}, h = () => S || te(), be = async (t) => {
|
|
48
48
|
const e = {
|
|
49
49
|
...t,
|
|
50
50
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -54,36 +54,30 @@ const te = () => {
|
|
|
54
54
|
queuePosition: 0
|
|
55
55
|
};
|
|
56
56
|
await h().messages.put(e);
|
|
57
|
-
},
|
|
57
|
+
}, pe = async (t) => !!await h().messages.get(t), _e = async (t) => {
|
|
58
58
|
const e = await h().messages.get(t);
|
|
59
59
|
return e?.isShown === !0 || e?.queueStatus === "shown";
|
|
60
|
-
},
|
|
60
|
+
}, fe = async () => await h().messages.where("queueStatus").equals("pending").sortBy("queuePosition"), me = async (t, e) => {
|
|
61
61
|
await h().messages.update(t, { queueStatus: e });
|
|
62
|
-
},
|
|
62
|
+
}, ve = async (t) => {
|
|
63
63
|
await h().messages.update(t, {
|
|
64
64
|
queueStatus: "shown",
|
|
65
65
|
isShown: !0
|
|
66
66
|
});
|
|
67
|
-
},
|
|
67
|
+
}, We = async (t) => {
|
|
68
68
|
await h().messages.update(t, {
|
|
69
69
|
queueStatus: "hidden"
|
|
70
70
|
});
|
|
71
|
-
},
|
|
71
|
+
}, ie = async (t) => await h().messages.get(t), Se = async (t) => {
|
|
72
72
|
await h().messages.delete(t);
|
|
73
|
-
|
|
74
|
-
const { useMessageQueueStore: e } = await Promise.resolve().then(() => Pe), { removeFromQueue: i } = e.getState();
|
|
75
|
-
i(t);
|
|
76
|
-
} catch (e) {
|
|
77
|
-
console.warn("Failed to remove message from queue store:", e);
|
|
78
|
-
}
|
|
79
|
-
}, ze = async () => {
|
|
73
|
+
}, Ae = async () => {
|
|
80
74
|
await h().messages.where("queueStatus").anyOf(["pending", "showing"]).delete();
|
|
81
|
-
},
|
|
75
|
+
}, De = async (t) => {
|
|
82
76
|
const e = t.map(
|
|
83
77
|
(i) => h().messages.update(i.id, { queuePosition: i.position })
|
|
84
78
|
);
|
|
85
79
|
await Promise.all(e);
|
|
86
|
-
},
|
|
80
|
+
}, Ne = (t, e) => ({
|
|
87
81
|
// Initial state
|
|
88
82
|
queue: [],
|
|
89
83
|
currentMessage: null,
|
|
@@ -93,11 +87,11 @@ const te = () => {
|
|
|
93
87
|
// Enqueue a new message
|
|
94
88
|
enqueue: async (i) => {
|
|
95
89
|
const n = e();
|
|
96
|
-
if (await
|
|
90
|
+
if (await _e(i.id)) {
|
|
97
91
|
console.log(`Message ${i.id} was already shown, skipping`);
|
|
98
92
|
return;
|
|
99
93
|
}
|
|
100
|
-
if (await
|
|
94
|
+
if (await pe(i.id) || await be(i), !n.queue.some((u) => u.id === i.id)) {
|
|
101
95
|
const u = [...n.queue, i];
|
|
102
96
|
t({ queue: u }), await e().persistQueue();
|
|
103
97
|
}
|
|
@@ -118,14 +112,14 @@ const te = () => {
|
|
|
118
112
|
t({ isProcessing: !1, currentMessage: null });
|
|
119
113
|
return;
|
|
120
114
|
}
|
|
121
|
-
if (!await
|
|
115
|
+
if (!await ie(n.id)) {
|
|
122
116
|
console.log(`Message ${n.id} was deleted, skipping to next`), await e().showNext();
|
|
123
117
|
return;
|
|
124
118
|
}
|
|
125
119
|
t({
|
|
126
120
|
currentMessage: n,
|
|
127
121
|
isProcessing: !0
|
|
128
|
-
}), await
|
|
122
|
+
}), await me(n.id, "showing"), await e().persistQueue();
|
|
129
123
|
},
|
|
130
124
|
// Clear current message and show next
|
|
131
125
|
clearCurrent: () => {
|
|
@@ -150,7 +144,7 @@ const te = () => {
|
|
|
150
144
|
initializeFromDatabase: async () => {
|
|
151
145
|
if (e().initialized) return;
|
|
152
146
|
t({ initialized: !0 });
|
|
153
|
-
const n = await
|
|
147
|
+
const n = await fe();
|
|
154
148
|
n.length > 0 && (t({ queue: n }), await e().showNext());
|
|
155
149
|
},
|
|
156
150
|
// Persist queue to database
|
|
@@ -159,7 +153,7 @@ const te = () => {
|
|
|
159
153
|
id: a.id,
|
|
160
154
|
position: l
|
|
161
155
|
}));
|
|
162
|
-
await
|
|
156
|
+
await De(n);
|
|
163
157
|
},
|
|
164
158
|
// Clear all messages on logout
|
|
165
159
|
clearOnLogout: async () => {
|
|
@@ -169,19 +163,24 @@ const te = () => {
|
|
|
169
163
|
isProcessing: !1,
|
|
170
164
|
activeWindowIds: [],
|
|
171
165
|
initialized: !1
|
|
172
|
-
}), await
|
|
166
|
+
}), await Ae();
|
|
173
167
|
},
|
|
174
|
-
// Remove a specific message from the queue by ID
|
|
175
|
-
removeFromQueue: (i) => {
|
|
168
|
+
// Remove a specific message from the queue by ID (memory only)
|
|
169
|
+
removeFromQueue: async (i) => {
|
|
176
170
|
const n = e(), a = n.queue.filter((l) => l.id !== i);
|
|
177
|
-
t({ queue: a }), n.currentMessage?.id === i && (
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
171
|
+
t({ queue: a }), await e().persistQueue(), n.currentMessage?.id === i && e().clearCurrent();
|
|
172
|
+
},
|
|
173
|
+
// Delete message completely (from both memory and database)
|
|
174
|
+
deleteMessage: async (i) => {
|
|
175
|
+
await Se(i), await e().removeFromQueue(i);
|
|
176
|
+
},
|
|
177
|
+
// Hide a message (mark as hidden and remove from queue)
|
|
178
|
+
hideMessage: async (i) => {
|
|
179
|
+
await We(i), await e().removeFromQueue(i);
|
|
180
|
+
},
|
|
181
|
+
// Mark message as shown in database
|
|
182
|
+
markMessageAsShown: async (i) => {
|
|
183
|
+
await ve(i);
|
|
185
184
|
},
|
|
186
185
|
// Add active window ID
|
|
187
186
|
addActiveWindow: (i) => {
|
|
@@ -200,50 +199,46 @@ const te = () => {
|
|
|
200
199
|
const n = e(), a = String(i);
|
|
201
200
|
return n.activeWindowIds.includes(a);
|
|
202
201
|
}
|
|
203
|
-
}),
|
|
204
|
-
|
|
202
|
+
}), c = ce()(
|
|
203
|
+
we(Ne, {
|
|
205
204
|
name: "tauri-notice-queue"
|
|
206
205
|
})
|
|
207
|
-
),
|
|
206
|
+
), z = {
|
|
208
207
|
queueLength: (t) => t.queue.length,
|
|
209
208
|
currentMessage: (t) => t.currentMessage,
|
|
210
209
|
isProcessing: (t) => t.isProcessing,
|
|
211
210
|
queue: (t) => t.queue
|
|
212
|
-
},
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
useMessageQueueStore: w
|
|
216
|
-
}, Symbol.toStringTag, { value: "Module" })), $e = () => {
|
|
217
|
-
const t = w((i) => i.enqueue);
|
|
218
|
-
return { showNotice: I(
|
|
211
|
+
}, Ve = () => {
|
|
212
|
+
const t = c((i) => i.enqueue);
|
|
213
|
+
return { showNotice: P(
|
|
219
214
|
async (i) => {
|
|
220
215
|
await t(i);
|
|
221
216
|
},
|
|
222
217
|
[t]
|
|
223
218
|
) };
|
|
224
219
|
};
|
|
225
|
-
function
|
|
220
|
+
function ze(t, e, i, n) {
|
|
226
221
|
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");
|
|
227
222
|
return i === "m" ? n : i === "a" ? n.call(t) : n ? n.value : e.get(t);
|
|
228
223
|
}
|
|
229
|
-
function
|
|
224
|
+
function Me(t, e, i, n, a) {
|
|
230
225
|
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");
|
|
231
226
|
return e.set(t, i), i;
|
|
232
227
|
}
|
|
233
|
-
var
|
|
228
|
+
var M;
|
|
234
229
|
const d = "__TAURI_TO_IPC_KEY__";
|
|
235
|
-
function
|
|
230
|
+
function Oe(t, e = !1) {
|
|
236
231
|
return window.__TAURI_INTERNALS__.transformCallback(t, e);
|
|
237
232
|
}
|
|
238
233
|
async function s(t, e = {}, i) {
|
|
239
234
|
return window.__TAURI_INTERNALS__.invoke(t, e, i);
|
|
240
235
|
}
|
|
241
|
-
class
|
|
236
|
+
class xe {
|
|
242
237
|
get rid() {
|
|
243
|
-
return
|
|
238
|
+
return ze(this, M, "f");
|
|
244
239
|
}
|
|
245
240
|
constructor(e) {
|
|
246
|
-
|
|
241
|
+
M.set(this, void 0), Me(this, M, e);
|
|
247
242
|
}
|
|
248
243
|
/**
|
|
249
244
|
* Destroys and cleans up this resource from memory.
|
|
@@ -255,8 +250,8 @@ class ke {
|
|
|
255
250
|
});
|
|
256
251
|
}
|
|
257
252
|
}
|
|
258
|
-
|
|
259
|
-
class
|
|
253
|
+
M = /* @__PURE__ */ new WeakMap();
|
|
254
|
+
class ne {
|
|
260
255
|
constructor(...e) {
|
|
261
256
|
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]);
|
|
262
257
|
}
|
|
@@ -304,7 +299,7 @@ class y {
|
|
|
304
299
|
* ```
|
|
305
300
|
*/
|
|
306
301
|
toLogical(e) {
|
|
307
|
-
return new
|
|
302
|
+
return new ne(this.width / e, this.height / e);
|
|
308
303
|
}
|
|
309
304
|
[d]() {
|
|
310
305
|
return {
|
|
@@ -321,7 +316,7 @@ class g {
|
|
|
321
316
|
this.size = e;
|
|
322
317
|
}
|
|
323
318
|
toLogical(e) {
|
|
324
|
-
return this.size instanceof
|
|
319
|
+
return this.size instanceof ne ? this.size : this.size.toLogical(e);
|
|
325
320
|
}
|
|
326
321
|
toPhysical(e) {
|
|
327
322
|
return this.size instanceof y ? this.size : this.size.toPhysical(e);
|
|
@@ -338,7 +333,7 @@ class g {
|
|
|
338
333
|
return this[d]();
|
|
339
334
|
}
|
|
340
335
|
}
|
|
341
|
-
class
|
|
336
|
+
class se {
|
|
342
337
|
constructor(...e) {
|
|
343
338
|
this.type = "Logical", e.length === 1 ? "Logical" in e[0] ? (this.x = e[0].Logical.x, this.y = e[0].Logical.y) : (this.x = e[0].x, this.y = e[0].y) : (this.x = e[0], this.y = e[1]);
|
|
344
339
|
}
|
|
@@ -358,7 +353,7 @@ class ae {
|
|
|
358
353
|
* @since 2.0.0
|
|
359
354
|
*/
|
|
360
355
|
toPhysical(e) {
|
|
361
|
-
return new
|
|
356
|
+
return new w(this.x * e, this.y * e);
|
|
362
357
|
}
|
|
363
358
|
[d]() {
|
|
364
359
|
return {
|
|
@@ -370,7 +365,7 @@ class ae {
|
|
|
370
365
|
return this[d]();
|
|
371
366
|
}
|
|
372
367
|
}
|
|
373
|
-
class
|
|
368
|
+
class w {
|
|
374
369
|
constructor(...e) {
|
|
375
370
|
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]);
|
|
376
371
|
}
|
|
@@ -390,7 +385,7 @@ class c {
|
|
|
390
385
|
* @since 2.0.0
|
|
391
386
|
*/
|
|
392
387
|
toLogical(e) {
|
|
393
|
-
return new
|
|
388
|
+
return new se(this.x / e, this.y / e);
|
|
394
389
|
}
|
|
395
390
|
[d]() {
|
|
396
391
|
return {
|
|
@@ -407,10 +402,10 @@ class _ {
|
|
|
407
402
|
this.position = e;
|
|
408
403
|
}
|
|
409
404
|
toLogical(e) {
|
|
410
|
-
return this.position instanceof
|
|
405
|
+
return this.position instanceof se ? this.position : this.position.toLogical(e);
|
|
411
406
|
}
|
|
412
407
|
toPhysical(e) {
|
|
413
|
-
return this.position instanceof
|
|
408
|
+
return this.position instanceof w ? this.position : this.position.toPhysical(e);
|
|
414
409
|
}
|
|
415
410
|
[d]() {
|
|
416
411
|
return {
|
|
@@ -428,40 +423,40 @@ var o;
|
|
|
428
423
|
(function(t) {
|
|
429
424
|
t.WINDOW_RESIZED = "tauri://resize", t.WINDOW_MOVED = "tauri://move", t.WINDOW_CLOSE_REQUESTED = "tauri://close-requested", t.WINDOW_DESTROYED = "tauri://destroyed", t.WINDOW_FOCUS = "tauri://focus", t.WINDOW_BLUR = "tauri://blur", t.WINDOW_SCALE_FACTOR_CHANGED = "tauri://scale-change", t.WINDOW_THEME_CHANGED = "tauri://theme-changed", t.WINDOW_CREATED = "tauri://window-created", t.WEBVIEW_CREATED = "tauri://webview-created", t.DRAG_ENTER = "tauri://drag-enter", t.DRAG_OVER = "tauri://drag-over", t.DRAG_DROP = "tauri://drag-drop", t.DRAG_LEAVE = "tauri://drag-leave";
|
|
430
425
|
})(o || (o = {}));
|
|
431
|
-
async function
|
|
426
|
+
async function ae(t, e) {
|
|
432
427
|
window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(t, e), await s("plugin:event|unlisten", {
|
|
433
428
|
event: t,
|
|
434
429
|
eventId: e
|
|
435
430
|
});
|
|
436
431
|
}
|
|
437
|
-
async function
|
|
432
|
+
async function I(t, e, i) {
|
|
438
433
|
var n;
|
|
439
434
|
const a = typeof i?.target == "string" ? { kind: "AnyLabel", label: i.target } : (n = i?.target) !== null && n !== void 0 ? n : { kind: "Any" };
|
|
440
435
|
return s("plugin:event|listen", {
|
|
441
436
|
event: t,
|
|
442
437
|
target: a,
|
|
443
|
-
handler:
|
|
444
|
-
}).then((l) => async () =>
|
|
438
|
+
handler: Oe(e)
|
|
439
|
+
}).then((l) => async () => ae(t, l));
|
|
445
440
|
}
|
|
446
|
-
async function
|
|
447
|
-
return
|
|
448
|
-
|
|
441
|
+
async function F(t, e, i) {
|
|
442
|
+
return I(t, (n) => {
|
|
443
|
+
ae(t, n.id), e(n);
|
|
449
444
|
}, i);
|
|
450
445
|
}
|
|
451
|
-
async function
|
|
446
|
+
async function re(t, e) {
|
|
452
447
|
await s("plugin:event|emit", {
|
|
453
448
|
event: t,
|
|
454
449
|
payload: e
|
|
455
450
|
});
|
|
456
451
|
}
|
|
457
|
-
async function
|
|
452
|
+
async function le(t, e, i) {
|
|
458
453
|
await s("plugin:event|emit_to", {
|
|
459
454
|
target: typeof t == "string" ? { kind: "AnyLabel", label: t } : t,
|
|
460
455
|
event: e,
|
|
461
456
|
payload: i
|
|
462
457
|
});
|
|
463
458
|
}
|
|
464
|
-
class
|
|
459
|
+
class A extends xe {
|
|
465
460
|
/**
|
|
466
461
|
* Creates an Image from a resource ID. For internal use only.
|
|
467
462
|
*
|
|
@@ -476,7 +471,7 @@ class N extends ke {
|
|
|
476
471
|
rgba: x(e),
|
|
477
472
|
width: i,
|
|
478
473
|
height: n
|
|
479
|
-
}).then((a) => new
|
|
474
|
+
}).then((a) => new A(a));
|
|
480
475
|
}
|
|
481
476
|
/**
|
|
482
477
|
* Creates a new image using the provided bytes by inferring the file format.
|
|
@@ -494,7 +489,7 @@ class N extends ke {
|
|
|
494
489
|
static async fromBytes(e) {
|
|
495
490
|
return s("plugin:image|from_bytes", {
|
|
496
491
|
bytes: x(e)
|
|
497
|
-
}).then((i) => new
|
|
492
|
+
}).then((i) => new A(i));
|
|
498
493
|
}
|
|
499
494
|
/**
|
|
500
495
|
* Creates a new image using the provided path.
|
|
@@ -509,7 +504,7 @@ class N extends ke {
|
|
|
509
504
|
* ```
|
|
510
505
|
*/
|
|
511
506
|
static async fromPath(e) {
|
|
512
|
-
return s("plugin:image|from_path", { path: e }).then((i) => new
|
|
507
|
+
return s("plugin:image|from_path", { path: e }).then((i) => new A(i));
|
|
513
508
|
}
|
|
514
509
|
/** Returns the RGBA data for this image, in row-major order from top to bottom. */
|
|
515
510
|
async rgba() {
|
|
@@ -523,13 +518,13 @@ class N extends ke {
|
|
|
523
518
|
}
|
|
524
519
|
}
|
|
525
520
|
function x(t) {
|
|
526
|
-
return t == null ? null : typeof t == "string" ? t : t instanceof
|
|
521
|
+
return t == null ? null : typeof t == "string" ? t : t instanceof A ? t.rid : t;
|
|
527
522
|
}
|
|
528
|
-
var
|
|
523
|
+
var q;
|
|
529
524
|
(function(t) {
|
|
530
525
|
t[t.Critical = 1] = "Critical", t[t.Informational = 2] = "Informational";
|
|
531
|
-
})(
|
|
532
|
-
class
|
|
526
|
+
})(q || (q = {}));
|
|
527
|
+
class Pe {
|
|
533
528
|
constructor(e) {
|
|
534
529
|
this._preventDefault = !1, this.event = e.event, this.id = e.id;
|
|
535
530
|
}
|
|
@@ -540,23 +535,23 @@ class Ce {
|
|
|
540
535
|
return this._preventDefault;
|
|
541
536
|
}
|
|
542
537
|
}
|
|
543
|
-
var
|
|
538
|
+
var H;
|
|
544
539
|
(function(t) {
|
|
545
540
|
t.None = "none", t.Normal = "normal", t.Indeterminate = "indeterminate", t.Paused = "paused", t.Error = "error";
|
|
546
|
-
})(
|
|
547
|
-
function
|
|
541
|
+
})(H || (H = {}));
|
|
542
|
+
function oe() {
|
|
548
543
|
return new k(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {
|
|
549
544
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
550
545
|
skip: !0
|
|
551
546
|
});
|
|
552
547
|
}
|
|
553
|
-
async function
|
|
548
|
+
async function E() {
|
|
554
549
|
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new k(e, {
|
|
555
550
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
556
551
|
skip: !0
|
|
557
552
|
})));
|
|
558
553
|
}
|
|
559
|
-
const
|
|
554
|
+
const R = ["tauri://created", "tauri://error"];
|
|
560
555
|
class k {
|
|
561
556
|
/**
|
|
562
557
|
* Creates a new Window.
|
|
@@ -598,19 +593,19 @@ class k {
|
|
|
598
593
|
*/
|
|
599
594
|
static async getByLabel(e) {
|
|
600
595
|
var i;
|
|
601
|
-
return (i = (await
|
|
596
|
+
return (i = (await E()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
|
|
602
597
|
}
|
|
603
598
|
/**
|
|
604
599
|
* Get an instance of `Window` for the current window.
|
|
605
600
|
*/
|
|
606
601
|
static getCurrent() {
|
|
607
|
-
return
|
|
602
|
+
return oe();
|
|
608
603
|
}
|
|
609
604
|
/**
|
|
610
605
|
* Gets a list of instances of `Window` for all available windows.
|
|
611
606
|
*/
|
|
612
607
|
static async getAll() {
|
|
613
|
-
return
|
|
608
|
+
return E();
|
|
614
609
|
}
|
|
615
610
|
/**
|
|
616
611
|
* Gets the focused window.
|
|
@@ -623,7 +618,7 @@ class k {
|
|
|
623
618
|
* @returns The Window instance or `undefined` if there is not any focused window.
|
|
624
619
|
*/
|
|
625
620
|
static async getFocusedWindow() {
|
|
626
|
-
for (const e of await
|
|
621
|
+
for (const e of await E())
|
|
627
622
|
if (await e.isFocused())
|
|
628
623
|
return e;
|
|
629
624
|
return null;
|
|
@@ -651,7 +646,7 @@ class k {
|
|
|
651
646
|
return this._handleTauriEvent(e, i) ? () => {
|
|
652
647
|
const n = this.listeners[e];
|
|
653
648
|
n.splice(n.indexOf(i), 1);
|
|
654
|
-
} :
|
|
649
|
+
} : I(e, i, {
|
|
655
650
|
target: { kind: "Window", label: this.label }
|
|
656
651
|
});
|
|
657
652
|
}
|
|
@@ -678,7 +673,7 @@ class k {
|
|
|
678
673
|
return this._handleTauriEvent(e, i) ? () => {
|
|
679
674
|
const n = this.listeners[e];
|
|
680
675
|
n.splice(n.indexOf(i), 1);
|
|
681
|
-
} :
|
|
676
|
+
} : F(e, i, {
|
|
682
677
|
target: { kind: "Window", label: this.label }
|
|
683
678
|
});
|
|
684
679
|
}
|
|
@@ -694,7 +689,7 @@ class k {
|
|
|
694
689
|
* @param payload Event payload.
|
|
695
690
|
*/
|
|
696
691
|
async emit(e, i) {
|
|
697
|
-
if (
|
|
692
|
+
if (R.includes(e)) {
|
|
698
693
|
for (const n of this.listeners[e] || [])
|
|
699
694
|
n({
|
|
700
695
|
event: e,
|
|
@@ -703,7 +698,7 @@ class k {
|
|
|
703
698
|
});
|
|
704
699
|
return;
|
|
705
700
|
}
|
|
706
|
-
return
|
|
701
|
+
return re(e, i);
|
|
707
702
|
}
|
|
708
703
|
/**
|
|
709
704
|
* Emits an event to all {@link EventTarget|targets} matching the given target.
|
|
@@ -718,7 +713,7 @@ class k {
|
|
|
718
713
|
* @param payload Event payload.
|
|
719
714
|
*/
|
|
720
715
|
async emitTo(e, i, n) {
|
|
721
|
-
if (
|
|
716
|
+
if (R.includes(i)) {
|
|
722
717
|
for (const a of this.listeners[i] || [])
|
|
723
718
|
a({
|
|
724
719
|
event: i,
|
|
@@ -727,11 +722,11 @@ class k {
|
|
|
727
722
|
});
|
|
728
723
|
return;
|
|
729
724
|
}
|
|
730
|
-
return
|
|
725
|
+
return le(e, i, n);
|
|
731
726
|
}
|
|
732
727
|
/** @ignore */
|
|
733
728
|
_handleTauriEvent(e, i) {
|
|
734
|
-
return
|
|
729
|
+
return R.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
|
|
735
730
|
}
|
|
736
731
|
// Getters
|
|
737
732
|
/**
|
|
@@ -762,7 +757,7 @@ class k {
|
|
|
762
757
|
async innerPosition() {
|
|
763
758
|
return s("plugin:window|inner_position", {
|
|
764
759
|
label: this.label
|
|
765
|
-
}).then((e) => new
|
|
760
|
+
}).then((e) => new w(e));
|
|
766
761
|
}
|
|
767
762
|
/**
|
|
768
763
|
* The position of the top-left hand corner of the window relative to the top-left hand corner of the desktop.
|
|
@@ -777,7 +772,7 @@ class k {
|
|
|
777
772
|
async outerPosition() {
|
|
778
773
|
return s("plugin:window|outer_position", {
|
|
779
774
|
label: this.label
|
|
780
|
-
}).then((e) => new
|
|
775
|
+
}).then((e) => new w(e));
|
|
781
776
|
}
|
|
782
777
|
/**
|
|
783
778
|
* The physical size of the window's client area.
|
|
@@ -1060,7 +1055,7 @@ class k {
|
|
|
1060
1055
|
*/
|
|
1061
1056
|
async requestUserAttention(e) {
|
|
1062
1057
|
let i = null;
|
|
1063
|
-
return e && (e ===
|
|
1058
|
+
return e && (e === q.Critical ? i = { type: "Critical" } : i = { type: "Informational" }), s("plugin:window|request_user_attention", {
|
|
1064
1059
|
label: this.label,
|
|
1065
1060
|
value: i
|
|
1066
1061
|
});
|
|
@@ -1977,7 +1972,7 @@ class k {
|
|
|
1977
1972
|
*/
|
|
1978
1973
|
async onMoved(e) {
|
|
1979
1974
|
return this.listen(o.WINDOW_MOVED, (i) => {
|
|
1980
|
-
i.payload = new
|
|
1975
|
+
i.payload = new w(i.payload), e(i);
|
|
1981
1976
|
});
|
|
1982
1977
|
}
|
|
1983
1978
|
/**
|
|
@@ -2004,7 +1999,7 @@ class k {
|
|
|
2004
1999
|
*/
|
|
2005
2000
|
async onCloseRequested(e) {
|
|
2006
2001
|
return this.listen(o.WINDOW_CLOSE_REQUESTED, async (i) => {
|
|
2007
|
-
const n = new
|
|
2002
|
+
const n = new Pe(i);
|
|
2008
2003
|
await e(n), n.isPreventDefault() || await this.destroy();
|
|
2009
2004
|
});
|
|
2010
2005
|
}
|
|
@@ -2040,7 +2035,7 @@ class k {
|
|
|
2040
2035
|
payload: {
|
|
2041
2036
|
type: "enter",
|
|
2042
2037
|
paths: r.payload.paths,
|
|
2043
|
-
position: new
|
|
2038
|
+
position: new w(r.payload.position)
|
|
2044
2039
|
}
|
|
2045
2040
|
});
|
|
2046
2041
|
}), n = await this.listen(o.DRAG_OVER, (r) => {
|
|
@@ -2048,7 +2043,7 @@ class k {
|
|
|
2048
2043
|
...r,
|
|
2049
2044
|
payload: {
|
|
2050
2045
|
type: "over",
|
|
2051
|
-
position: new
|
|
2046
|
+
position: new w(r.payload.position)
|
|
2052
2047
|
}
|
|
2053
2048
|
});
|
|
2054
2049
|
}), a = await this.listen(o.DRAG_DROP, (r) => {
|
|
@@ -2057,7 +2052,7 @@ class k {
|
|
|
2057
2052
|
payload: {
|
|
2058
2053
|
type: "drop",
|
|
2059
2054
|
paths: r.payload.paths,
|
|
2060
|
-
position: new
|
|
2055
|
+
position: new w(r.payload.position)
|
|
2061
2056
|
}
|
|
2062
2057
|
});
|
|
2063
2058
|
}), l = await this.listen(o.DRAG_LEAVE, (r) => {
|
|
@@ -2139,45 +2134,45 @@ class k {
|
|
|
2139
2134
|
return this.listen(o.WINDOW_THEME_CHANGED, e);
|
|
2140
2135
|
}
|
|
2141
2136
|
}
|
|
2142
|
-
var H;
|
|
2143
|
-
(function(t) {
|
|
2144
|
-
t.Disabled = "disabled", t.Throttle = "throttle", t.Suspend = "suspend";
|
|
2145
|
-
})(H || (H = {}));
|
|
2146
2137
|
var V;
|
|
2147
2138
|
(function(t) {
|
|
2148
|
-
t.
|
|
2139
|
+
t.Disabled = "disabled", t.Throttle = "throttle", t.Suspend = "suspend";
|
|
2149
2140
|
})(V || (V = {}));
|
|
2150
2141
|
var $;
|
|
2151
2142
|
(function(t) {
|
|
2152
|
-
t.
|
|
2143
|
+
t.Default = "default", t.FluentOverlay = "fluentOverlay";
|
|
2153
2144
|
})($ || ($ = {}));
|
|
2145
|
+
var j;
|
|
2146
|
+
(function(t) {
|
|
2147
|
+
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
|
+
})(j || (j = {}));
|
|
2154
2149
|
var J;
|
|
2155
2150
|
(function(t) {
|
|
2156
2151
|
t.FollowsWindowActiveState = "followsWindowActiveState", t.Active = "active", t.Inactive = "inactive";
|
|
2157
2152
|
})(J || (J = {}));
|
|
2158
|
-
function
|
|
2153
|
+
function Ie(t) {
|
|
2159
2154
|
return t === null ? null : {
|
|
2160
2155
|
name: t.name,
|
|
2161
2156
|
scaleFactor: t.scaleFactor,
|
|
2162
|
-
position: new
|
|
2157
|
+
position: new w(t.position),
|
|
2163
2158
|
size: new y(t.size),
|
|
2164
2159
|
workArea: {
|
|
2165
|
-
position: new
|
|
2160
|
+
position: new w(t.workArea.position),
|
|
2166
2161
|
size: new y(t.workArea.size)
|
|
2167
2162
|
}
|
|
2168
2163
|
};
|
|
2169
2164
|
}
|
|
2170
|
-
async function
|
|
2171
|
-
return s("plugin:window|primary_monitor").then(
|
|
2165
|
+
async function ke() {
|
|
2166
|
+
return s("plugin:window|primary_monitor").then(Ie);
|
|
2172
2167
|
}
|
|
2173
|
-
function
|
|
2174
|
-
return new
|
|
2168
|
+
function ue() {
|
|
2169
|
+
return new B(oe(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, {
|
|
2175
2170
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
2176
2171
|
skip: !0
|
|
2177
2172
|
});
|
|
2178
2173
|
}
|
|
2179
2174
|
async function Z() {
|
|
2180
|
-
return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new
|
|
2175
|
+
return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new B(new k(e.windowLabel, {
|
|
2181
2176
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
2182
2177
|
skip: !0
|
|
2183
2178
|
}), e.label, {
|
|
@@ -2185,8 +2180,8 @@ async function Z() {
|
|
|
2185
2180
|
skip: !0
|
|
2186
2181
|
})));
|
|
2187
2182
|
}
|
|
2188
|
-
const
|
|
2189
|
-
class
|
|
2183
|
+
const T = ["tauri://created", "tauri://error"];
|
|
2184
|
+
class B {
|
|
2190
2185
|
/**
|
|
2191
2186
|
* Creates a new Webview.
|
|
2192
2187
|
* @example
|
|
@@ -2247,7 +2242,7 @@ class U {
|
|
|
2247
2242
|
* Get an instance of `Webview` for the current webview.
|
|
2248
2243
|
*/
|
|
2249
2244
|
static getCurrent() {
|
|
2250
|
-
return
|
|
2245
|
+
return ue();
|
|
2251
2246
|
}
|
|
2252
2247
|
/**
|
|
2253
2248
|
* Gets a list of instances of `Webview` for all available webviews.
|
|
@@ -2278,7 +2273,7 @@ class U {
|
|
|
2278
2273
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2279
2274
|
const n = this.listeners[e];
|
|
2280
2275
|
n.splice(n.indexOf(i), 1);
|
|
2281
|
-
} :
|
|
2276
|
+
} : I(e, i, {
|
|
2282
2277
|
target: { kind: "Webview", label: this.label }
|
|
2283
2278
|
});
|
|
2284
2279
|
}
|
|
@@ -2305,7 +2300,7 @@ class U {
|
|
|
2305
2300
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2306
2301
|
const n = this.listeners[e];
|
|
2307
2302
|
n.splice(n.indexOf(i), 1);
|
|
2308
|
-
} :
|
|
2303
|
+
} : F(e, i, {
|
|
2309
2304
|
target: { kind: "Webview", label: this.label }
|
|
2310
2305
|
});
|
|
2311
2306
|
}
|
|
@@ -2322,7 +2317,7 @@ class U {
|
|
|
2322
2317
|
* @param payload Event payload.
|
|
2323
2318
|
*/
|
|
2324
2319
|
async emit(e, i) {
|
|
2325
|
-
if (
|
|
2320
|
+
if (T.includes(e)) {
|
|
2326
2321
|
for (const n of this.listeners[e] || [])
|
|
2327
2322
|
n({
|
|
2328
2323
|
event: e,
|
|
@@ -2331,7 +2326,7 @@ class U {
|
|
|
2331
2326
|
});
|
|
2332
2327
|
return;
|
|
2333
2328
|
}
|
|
2334
|
-
return
|
|
2329
|
+
return re(e, i);
|
|
2335
2330
|
}
|
|
2336
2331
|
/**
|
|
2337
2332
|
* Emits an event to all {@link EventTarget|targets} matching the given target.
|
|
@@ -2347,7 +2342,7 @@ class U {
|
|
|
2347
2342
|
* @param payload Event payload.
|
|
2348
2343
|
*/
|
|
2349
2344
|
async emitTo(e, i, n) {
|
|
2350
|
-
if (
|
|
2345
|
+
if (T.includes(i)) {
|
|
2351
2346
|
for (const a of this.listeners[i] || [])
|
|
2352
2347
|
a({
|
|
2353
2348
|
event: i,
|
|
@@ -2356,11 +2351,11 @@ class U {
|
|
|
2356
2351
|
});
|
|
2357
2352
|
return;
|
|
2358
2353
|
}
|
|
2359
|
-
return
|
|
2354
|
+
return le(e, i, n);
|
|
2360
2355
|
}
|
|
2361
2356
|
/** @ignore */
|
|
2362
2357
|
_handleTauriEvent(e, i) {
|
|
2363
|
-
return
|
|
2358
|
+
return T.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
|
|
2364
2359
|
}
|
|
2365
2360
|
// Getters
|
|
2366
2361
|
/**
|
|
@@ -2376,7 +2371,7 @@ class U {
|
|
|
2376
2371
|
async position() {
|
|
2377
2372
|
return s("plugin:webview|webview_position", {
|
|
2378
2373
|
label: this.label
|
|
2379
|
-
}).then((e) => new
|
|
2374
|
+
}).then((e) => new w(e));
|
|
2380
2375
|
}
|
|
2381
2376
|
/**
|
|
2382
2377
|
* The physical size of the webview's client area.
|
|
@@ -2603,7 +2598,7 @@ class U {
|
|
|
2603
2598
|
payload: {
|
|
2604
2599
|
type: "enter",
|
|
2605
2600
|
paths: r.payload.paths,
|
|
2606
|
-
position: new
|
|
2601
|
+
position: new w(r.payload.position)
|
|
2607
2602
|
}
|
|
2608
2603
|
});
|
|
2609
2604
|
}), n = await this.listen(o.DRAG_OVER, (r) => {
|
|
@@ -2611,7 +2606,7 @@ class U {
|
|
|
2611
2606
|
...r,
|
|
2612
2607
|
payload: {
|
|
2613
2608
|
type: "over",
|
|
2614
|
-
position: new
|
|
2609
|
+
position: new w(r.payload.position)
|
|
2615
2610
|
}
|
|
2616
2611
|
});
|
|
2617
2612
|
}), a = await this.listen(o.DRAG_DROP, (r) => {
|
|
@@ -2620,7 +2615,7 @@ class U {
|
|
|
2620
2615
|
payload: {
|
|
2621
2616
|
type: "drop",
|
|
2622
2617
|
paths: r.payload.paths,
|
|
2623
|
-
position: new
|
|
2618
|
+
position: new w(r.payload.position)
|
|
2624
2619
|
}
|
|
2625
2620
|
});
|
|
2626
2621
|
}), l = await this.listen(o.DRAG_LEAVE, (r) => {
|
|
@@ -2631,8 +2626,8 @@ class U {
|
|
|
2631
2626
|
};
|
|
2632
2627
|
}
|
|
2633
2628
|
}
|
|
2634
|
-
function
|
|
2635
|
-
const t =
|
|
2629
|
+
function O() {
|
|
2630
|
+
const t = ue();
|
|
2636
2631
|
return new f(t.label, { skip: !0 });
|
|
2637
2632
|
}
|
|
2638
2633
|
async function Y() {
|
|
@@ -2691,7 +2686,7 @@ class f {
|
|
|
2691
2686
|
* Get an instance of `Webview` for the current webview.
|
|
2692
2687
|
*/
|
|
2693
2688
|
static getCurrent() {
|
|
2694
|
-
return
|
|
2689
|
+
return O();
|
|
2695
2690
|
}
|
|
2696
2691
|
/**
|
|
2697
2692
|
* Gets a list of instances of `Webview` for all available webviews.
|
|
@@ -2722,7 +2717,7 @@ class f {
|
|
|
2722
2717
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2723
2718
|
const n = this.listeners[e];
|
|
2724
2719
|
n.splice(n.indexOf(i), 1);
|
|
2725
|
-
} :
|
|
2720
|
+
} : I(e, i, {
|
|
2726
2721
|
target: { kind: "WebviewWindow", label: this.label }
|
|
2727
2722
|
});
|
|
2728
2723
|
}
|
|
@@ -2749,7 +2744,7 @@ class f {
|
|
|
2749
2744
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2750
2745
|
const n = this.listeners[e];
|
|
2751
2746
|
n.splice(n.indexOf(i), 1);
|
|
2752
|
-
} :
|
|
2747
|
+
} : F(e, i, {
|
|
2753
2748
|
target: { kind: "WebviewWindow", label: this.label }
|
|
2754
2749
|
});
|
|
2755
2750
|
}
|
|
@@ -2773,8 +2768,8 @@ class f {
|
|
|
2773
2768
|
return s("plugin:window|set_background_color", { color: e }).then(() => s("plugin:webview|set_webview_background_color", { color: e }));
|
|
2774
2769
|
}
|
|
2775
2770
|
}
|
|
2776
|
-
|
|
2777
|
-
function
|
|
2771
|
+
Ce(f, [k, B]);
|
|
2772
|
+
function Ce(t, e) {
|
|
2778
2773
|
(Array.isArray(e) ? e : [e]).forEach((i) => {
|
|
2779
2774
|
Object.getOwnPropertyNames(i.prototype).forEach((n) => {
|
|
2780
2775
|
var a;
|
|
@@ -2787,20 +2782,20 @@ function Re(t, e) {
|
|
|
2787
2782
|
});
|
|
2788
2783
|
});
|
|
2789
2784
|
}
|
|
2790
|
-
const
|
|
2785
|
+
const D = /* @__PURE__ */ new Map(), Le = (t) => {
|
|
2791
2786
|
if (!t || t.trim() === "") return !1;
|
|
2792
2787
|
try {
|
|
2793
2788
|
return !!(t.startsWith("/") || t.startsWith("http://") || t.startsWith("https://") || t.startsWith("tauri://"));
|
|
2794
2789
|
} catch {
|
|
2795
2790
|
return !1;
|
|
2796
2791
|
}
|
|
2797
|
-
},
|
|
2792
|
+
}, Ee = async (t, e, i) => {
|
|
2798
2793
|
const n = i?.padding ?? 20;
|
|
2799
2794
|
if (i?.x !== void 0 && i?.y !== void 0)
|
|
2800
2795
|
return { x: i.x, y: i.y };
|
|
2801
2796
|
let a = 1920, l = 1080;
|
|
2802
2797
|
try {
|
|
2803
|
-
const u = await
|
|
2798
|
+
const u = await ke();
|
|
2804
2799
|
u?.size && (a = u.size.width, l = u.size.height);
|
|
2805
2800
|
} catch (u) {
|
|
2806
2801
|
console.warn("Failed to get monitor info, using defaults:", u);
|
|
@@ -2837,16 +2832,16 @@ const z = /* @__PURE__ */ new Map(), Te = (t) => {
|
|
|
2837
2832
|
y: l - e - n
|
|
2838
2833
|
};
|
|
2839
2834
|
}
|
|
2840
|
-
},
|
|
2841
|
-
const e = String(t.id), i =
|
|
2835
|
+
}, Re = async (t) => {
|
|
2836
|
+
const e = String(t.id), i = c.getState();
|
|
2842
2837
|
if (i.isWindowActive(e)) {
|
|
2843
2838
|
console.log(`Notice window already open for message: ${e}`);
|
|
2844
2839
|
return;
|
|
2845
2840
|
}
|
|
2846
2841
|
const n = ee(), a = `notice-${e}`;
|
|
2847
2842
|
let l = `${n.routePrefix}/${t.type}?id=${t.id}`;
|
|
2848
|
-
|
|
2849
|
-
const r = t.min_width || n.defaultWidth, u = t.min_height || n.defaultHeight, { x: m, y: v } = await
|
|
2843
|
+
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: v } = await Ee(r, u, t.windowPosition);
|
|
2850
2845
|
try {
|
|
2851
2846
|
const b = new f(a, {
|
|
2852
2847
|
url: l,
|
|
@@ -2860,65 +2855,59 @@ const z = /* @__PURE__ */ new Map(), Te = (t) => {
|
|
|
2860
2855
|
skipTaskbar: !1,
|
|
2861
2856
|
alwaysOnTop: !0
|
|
2862
2857
|
});
|
|
2863
|
-
|
|
2864
|
-
|
|
2858
|
+
D.set(e, b), i.addActiveWindow(e), b.once("tauri://destroyed", async () => {
|
|
2859
|
+
D.delete(e), i.removeActiveWindow(e), await i.markMessageAsShown(e), i.clearCurrent();
|
|
2865
2860
|
}), console.log(`Created notice window: ${a}`);
|
|
2866
2861
|
} catch (b) {
|
|
2867
2862
|
console.error("Failed to create notice window:", b), i.removeActiveWindow(e), i.clearCurrent();
|
|
2868
2863
|
}
|
|
2869
|
-
},
|
|
2870
|
-
const e = String(t), i =
|
|
2864
|
+
}, U = async (t) => {
|
|
2865
|
+
const e = String(t), i = D.get(e), n = c.getState();
|
|
2871
2866
|
if (i)
|
|
2872
2867
|
try {
|
|
2873
|
-
await i.close(),
|
|
2868
|
+
await i.close(), D.delete(e), n.removeActiveWindow(e), await n.markMessageAsShown(e), n.clearCurrent(), console.log(`Closed notice window: ${e}`);
|
|
2874
2869
|
} catch (a) {
|
|
2875
2870
|
console.error("Failed to close notice window:", a);
|
|
2876
2871
|
}
|
|
2877
|
-
},
|
|
2878
|
-
const t = Array.from(
|
|
2879
|
-
(e) =>
|
|
2872
|
+
}, Te = async () => {
|
|
2873
|
+
const t = Array.from(D.keys()).map(
|
|
2874
|
+
(e) => U(e)
|
|
2880
2875
|
);
|
|
2881
2876
|
await Promise.all(t);
|
|
2882
|
-
},
|
|
2877
|
+
}, qe = () => {
|
|
2883
2878
|
let t = null;
|
|
2884
|
-
|
|
2879
|
+
c.subscribe((e) => {
|
|
2885
2880
|
const i = e.currentMessage;
|
|
2886
|
-
i && i !== t ? (t = i,
|
|
2881
|
+
i && i !== t ? (t = i, Re(i)) : i || (t = null);
|
|
2887
2882
|
}), console.log("Notice window system initialized");
|
|
2888
|
-
},
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
createNoticeWindow: we,
|
|
2893
|
-
initializeNoticeWindowSystem: he
|
|
2894
|
-
}, Symbol.toStringTag, { value: "Module" })), Je = () => {
|
|
2895
|
-
const t = w((i) => i.currentMessage);
|
|
2896
|
-
return { closeNotice: I(async () => {
|
|
2897
|
-
t && await C(t.id);
|
|
2883
|
+
}, $e = () => {
|
|
2884
|
+
const t = c((i) => i.currentMessage);
|
|
2885
|
+
return { closeNotice: P(async () => {
|
|
2886
|
+
t && await U(t.id);
|
|
2898
2887
|
}, [t]) };
|
|
2899
|
-
},
|
|
2900
|
-
const t =
|
|
2901
|
-
return { hideNotice:
|
|
2888
|
+
}, je = () => {
|
|
2889
|
+
const t = c((i) => i.hideMessage);
|
|
2890
|
+
return { hideNotice: P(
|
|
2902
2891
|
async (i) => {
|
|
2903
|
-
await
|
|
2892
|
+
await t(i), await U(i);
|
|
2904
2893
|
},
|
|
2905
2894
|
[t]
|
|
2906
2895
|
) };
|
|
2907
|
-
},
|
|
2908
|
-
const t =
|
|
2909
|
-
return { hideAllNotices:
|
|
2910
|
-
await
|
|
2896
|
+
}, Je = () => {
|
|
2897
|
+
const t = c((i) => i.clearOnLogout);
|
|
2898
|
+
return { hideAllNotices: P(async () => {
|
|
2899
|
+
await Te(), await t();
|
|
2911
2900
|
}, [t]) };
|
|
2912
|
-
},
|
|
2913
|
-
const t =
|
|
2901
|
+
}, Ze = () => {
|
|
2902
|
+
const t = c(z.queueLength), e = c(z.currentMessage), i = c(z.isProcessing), n = c(z.queue);
|
|
2914
2903
|
return {
|
|
2915
2904
|
queueLength: t,
|
|
2916
2905
|
currentMessage: e,
|
|
2917
2906
|
isProcessing: i,
|
|
2918
2907
|
queue: n
|
|
2919
2908
|
};
|
|
2920
|
-
},
|
|
2921
|
-
const [n, a] =
|
|
2909
|
+
}, Ye = ({ children: t, onLoad: e, onClose: i }) => {
|
|
2910
|
+
const [n, a] = L(null), [l, r] = L(!0), [u, m] = L(null);
|
|
2922
2911
|
return G(() => {
|
|
2923
2912
|
(async () => {
|
|
2924
2913
|
try {
|
|
@@ -2926,29 +2915,29 @@ const z = /* @__PURE__ */ new Map(), Te = (t) => {
|
|
|
2926
2915
|
if (!p) {
|
|
2927
2916
|
m("No message ID provided"), r(!1), setTimeout(async () => {
|
|
2928
2917
|
try {
|
|
2929
|
-
await
|
|
2918
|
+
await O().close();
|
|
2930
2919
|
} catch (W) {
|
|
2931
2920
|
console.error("Failed to close window:", W);
|
|
2932
2921
|
}
|
|
2933
2922
|
}, 1e3);
|
|
2934
2923
|
return;
|
|
2935
2924
|
}
|
|
2936
|
-
const
|
|
2937
|
-
if (!
|
|
2925
|
+
const C = await ie(p);
|
|
2926
|
+
if (!C) {
|
|
2938
2927
|
console.log(`Message ${p} not found in database, closing window`), m("Message not found"), r(!1), setTimeout(async () => {
|
|
2939
2928
|
try {
|
|
2940
|
-
await
|
|
2929
|
+
await O().close();
|
|
2941
2930
|
} catch (W) {
|
|
2942
2931
|
console.error("Failed to close window:", W);
|
|
2943
2932
|
}
|
|
2944
2933
|
}, 500);
|
|
2945
2934
|
return;
|
|
2946
2935
|
}
|
|
2947
|
-
a(
|
|
2936
|
+
a(C), r(!1), e && e(C);
|
|
2948
2937
|
} catch (b) {
|
|
2949
2938
|
console.error("Failed to load message:", b), m("Failed to load message"), r(!1), setTimeout(async () => {
|
|
2950
2939
|
try {
|
|
2951
|
-
await
|
|
2940
|
+
await O().close();
|
|
2952
2941
|
} catch (p) {
|
|
2953
2942
|
console.error("Failed to close window:", p);
|
|
2954
2943
|
}
|
|
@@ -2963,20 +2952,20 @@ const z = /* @__PURE__ */ new Map(), Te = (t) => {
|
|
|
2963
2952
|
return window.addEventListener("beforeunload", v), () => {
|
|
2964
2953
|
window.removeEventListener("beforeunload", v);
|
|
2965
2954
|
};
|
|
2966
|
-
}, [n, i]), l ? /* @__PURE__ */
|
|
2955
|
+
}, [n, i]), l ? /* @__PURE__ */ N("div", { style: {
|
|
2967
2956
|
display: "flex",
|
|
2968
2957
|
justifyContent: "center",
|
|
2969
2958
|
alignItems: "center",
|
|
2970
2959
|
height: "100vh",
|
|
2971
2960
|
fontFamily: "system-ui, -apple-system, sans-serif"
|
|
2972
|
-
}, children: "Loading..." }) : u ? /* @__PURE__ */
|
|
2961
|
+
}, children: "Loading..." }) : u ? /* @__PURE__ */ N("div", { style: {
|
|
2973
2962
|
display: "flex",
|
|
2974
2963
|
justifyContent: "center",
|
|
2975
2964
|
alignItems: "center",
|
|
2976
2965
|
height: "100vh",
|
|
2977
2966
|
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
2978
2967
|
color: "#ef4444"
|
|
2979
|
-
}, children: u }) : n ? /* @__PURE__ */
|
|
2968
|
+
}, children: u }) : n ? /* @__PURE__ */ N(he, { children: t(n) }) : /* @__PURE__ */ N("div", { style: {
|
|
2980
2969
|
display: "flex",
|
|
2981
2970
|
justifyContent: "center",
|
|
2982
2971
|
alignItems: "center",
|
|
@@ -2984,37 +2973,38 @@ const z = /* @__PURE__ */ new Map(), Te = (t) => {
|
|
|
2984
2973
|
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
2985
2974
|
color: "#ef4444"
|
|
2986
2975
|
}, children: "Closing window..." });
|
|
2987
|
-
},
|
|
2988
|
-
te(),
|
|
2989
|
-
const { initializeFromDatabase: t } =
|
|
2976
|
+
}, Ke = async () => {
|
|
2977
|
+
te(), qe();
|
|
2978
|
+
const { initializeFromDatabase: t } = c.getState();
|
|
2990
2979
|
await t(), console.log("Tauri Notice System initialized");
|
|
2980
|
+
}, Xe = async (t) => {
|
|
2981
|
+
await c.getState().deleteMessage(t);
|
|
2982
|
+
}, et = async (t) => {
|
|
2983
|
+
await c.getState().hideMessage(t);
|
|
2984
|
+
}, tt = async (t) => {
|
|
2985
|
+
await c.getState().markMessageAsShown(t);
|
|
2991
2986
|
};
|
|
2992
2987
|
export {
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
ne as getMessage,
|
|
2988
|
+
Ye as NoticeLayout,
|
|
2989
|
+
Te as closeAllNoticeWindows,
|
|
2990
|
+
U as closeNoticeWindow,
|
|
2991
|
+
Re as createNoticeWindow,
|
|
2992
|
+
Xe as deleteMessageById,
|
|
2993
|
+
ie as getMessage,
|
|
3000
2994
|
ee as getNoticeConfig,
|
|
3001
|
-
|
|
3002
|
-
|
|
2995
|
+
fe as getPendingMessages,
|
|
2996
|
+
et as hideMessageById,
|
|
3003
2997
|
te as initializeDatabase,
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
ie as markAsShown,
|
|
3009
|
-
S as messageQueueSelectors,
|
|
3010
|
-
me as saveMessage,
|
|
2998
|
+
Ke as initializeNoticeSystem,
|
|
2999
|
+
qe as initializeNoticeWindowSystem,
|
|
3000
|
+
tt as markMessageAsShown,
|
|
3001
|
+
z as messageQueueSelectors,
|
|
3011
3002
|
He as setNoticeConfig,
|
|
3012
|
-
|
|
3013
|
-
Je as
|
|
3014
|
-
|
|
3015
|
-
Ze as
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
$e as useNoticeWindow
|
|
3003
|
+
$e as useCloseNotice,
|
|
3004
|
+
Je as useHideAllNotices,
|
|
3005
|
+
je as useHideNotice,
|
|
3006
|
+
Ze as useMessageQueue,
|
|
3007
|
+
c as useMessageQueueStore,
|
|
3008
|
+
Ve as useNoticeWindow
|
|
3019
3009
|
};
|
|
3020
3010
|
//# sourceMappingURL=index.js.map
|