tauri-notice-window 1.0.2 → 1.0.4
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 +86 -1
- package/dist/components/NoticeLayout.d.ts +5 -1
- package/dist/components/NoticeLayout.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +259 -243
- package/dist/index.js.map +1 -1
- package/dist/stores/messageQueueStore.d.ts.map +1 -1
- package/dist/utils/db.d.ts +6 -0
- package/dist/utils/db.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,33 +1,33 @@
|
|
|
1
|
-
import { create as
|
|
2
|
-
import { syncTabs as
|
|
3
|
-
import
|
|
4
|
-
import { useCallback as
|
|
5
|
-
import { jsx as
|
|
6
|
-
const
|
|
1
|
+
import { create as oe } from "zustand";
|
|
2
|
+
import { syncTabs as ue } from "zustand-sync";
|
|
3
|
+
import ce from "dexie";
|
|
4
|
+
import { useCallback as A, useState as I, useEffect as B } from "react";
|
|
5
|
+
import { jsx as k, Fragment as de } from "react/jsx-runtime";
|
|
6
|
+
const Z = "tauri-notice-config", G = {
|
|
7
7
|
routePrefix: "/notice",
|
|
8
8
|
databaseName: "tauri-notice-db",
|
|
9
9
|
defaultWidth: 400,
|
|
10
10
|
defaultHeight: 300
|
|
11
|
-
},
|
|
11
|
+
}, Y = () => {
|
|
12
12
|
try {
|
|
13
|
-
const t = localStorage.getItem(
|
|
13
|
+
const t = localStorage.getItem(Z);
|
|
14
14
|
if (t)
|
|
15
|
-
return { ...
|
|
15
|
+
return { ...G, ...JSON.parse(t) };
|
|
16
16
|
} catch (t) {
|
|
17
17
|
console.warn("Failed to load config from localStorage:", t);
|
|
18
18
|
}
|
|
19
|
-
return
|
|
20
|
-
},
|
|
19
|
+
return G;
|
|
20
|
+
}, we = (t) => {
|
|
21
21
|
try {
|
|
22
|
-
localStorage.setItem(
|
|
22
|
+
localStorage.setItem(Z, JSON.stringify(t));
|
|
23
23
|
} catch (e) {
|
|
24
24
|
console.warn("Failed to save config to localStorage:", e);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
const i = { ...
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
class
|
|
26
|
+
}, Ge = (t) => {
|
|
27
|
+
const i = { ...Y(), ...t };
|
|
28
|
+
we(i);
|
|
29
|
+
}, K = () => Y();
|
|
30
|
+
class he extends ce {
|
|
31
31
|
messages;
|
|
32
32
|
constructor(e) {
|
|
33
33
|
super(e), this.version(1).stores({
|
|
@@ -35,14 +35,14 @@ class de extends re {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
let
|
|
39
|
-
const
|
|
40
|
-
if (!
|
|
41
|
-
const t =
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
return
|
|
45
|
-
}, h = () =>
|
|
38
|
+
let v = null;
|
|
39
|
+
const X = () => {
|
|
40
|
+
if (!v) {
|
|
41
|
+
const t = K();
|
|
42
|
+
v = new he(t.databaseName);
|
|
43
|
+
}
|
|
44
|
+
return v;
|
|
45
|
+
}, h = () => v || X(), ge = async (t) => {
|
|
46
46
|
const e = {
|
|
47
47
|
...t,
|
|
48
48
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -52,25 +52,28 @@ const Y = () => {
|
|
|
52
52
|
queuePosition: 0
|
|
53
53
|
};
|
|
54
54
|
await h().messages.put(e);
|
|
55
|
-
},
|
|
55
|
+
}, be = async (t) => !!await h().messages.get(t), ye = async (t) => {
|
|
56
|
+
const e = await h().messages.get(t);
|
|
57
|
+
return e?.isShown === !0 || e?.queueStatus === "shown";
|
|
58
|
+
}, pe = async () => await h().messages.where("queueStatus").equals("pending").sortBy("queuePosition"), _e = async (t, e) => {
|
|
56
59
|
await h().messages.update(t, { queueStatus: e });
|
|
57
|
-
},
|
|
60
|
+
}, ee = async (t) => {
|
|
58
61
|
await h().messages.update(t, {
|
|
59
62
|
queueStatus: "shown",
|
|
60
63
|
isShown: !0
|
|
61
64
|
});
|
|
62
|
-
},
|
|
65
|
+
}, fe = async (t) => {
|
|
63
66
|
await h().messages.update(t, {
|
|
64
67
|
queueStatus: "hidden"
|
|
65
68
|
});
|
|
66
|
-
},
|
|
69
|
+
}, me = async (t) => await h().messages.get(t), ve = async () => {
|
|
67
70
|
await h().messages.where("queueStatus").anyOf(["pending", "showing"]).delete();
|
|
68
|
-
},
|
|
71
|
+
}, We = async (t) => {
|
|
69
72
|
const e = t.map(
|
|
70
73
|
(i) => h().messages.update(i.id, { queuePosition: i.position })
|
|
71
74
|
);
|
|
72
75
|
await Promise.all(e);
|
|
73
|
-
},
|
|
76
|
+
}, Se = (t, e) => ({
|
|
74
77
|
// Initial state
|
|
75
78
|
queue: [],
|
|
76
79
|
currentMessage: null,
|
|
@@ -80,9 +83,13 @@ const Y = () => {
|
|
|
80
83
|
// Enqueue a new message
|
|
81
84
|
enqueue: async (i) => {
|
|
82
85
|
const n = e();
|
|
83
|
-
if (await
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
if (await ye(i.id)) {
|
|
87
|
+
console.log(`Message ${i.id} was already shown, skipping`);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (await be(i.id) || await ge(i), !n.queue.some((u) => u.id === i.id)) {
|
|
91
|
+
const u = [...n.queue, i];
|
|
92
|
+
t({ queue: u }), await e().persistQueue();
|
|
86
93
|
}
|
|
87
94
|
!n.isProcessing && !n.currentMessage && await e().showNext();
|
|
88
95
|
},
|
|
@@ -104,7 +111,7 @@ const Y = () => {
|
|
|
104
111
|
t({
|
|
105
112
|
currentMessage: n,
|
|
106
113
|
isProcessing: !0
|
|
107
|
-
}), await
|
|
114
|
+
}), await _e(n.id, "showing"), await e().persistQueue();
|
|
108
115
|
},
|
|
109
116
|
// Clear current message and show next
|
|
110
117
|
clearCurrent: () => {
|
|
@@ -129,7 +136,7 @@ const Y = () => {
|
|
|
129
136
|
initializeFromDatabase: async () => {
|
|
130
137
|
if (e().initialized) return;
|
|
131
138
|
t({ initialized: !0 });
|
|
132
|
-
const n = await
|
|
139
|
+
const n = await pe();
|
|
133
140
|
n.length > 0 && (t({ queue: n }), await e().showNext());
|
|
134
141
|
},
|
|
135
142
|
// Persist queue to database
|
|
@@ -138,7 +145,7 @@ const Y = () => {
|
|
|
138
145
|
id: a.id,
|
|
139
146
|
position: r
|
|
140
147
|
}));
|
|
141
|
-
await
|
|
148
|
+
await We(n);
|
|
142
149
|
},
|
|
143
150
|
// Clear all messages on logout
|
|
144
151
|
clearOnLogout: async () => {
|
|
@@ -148,7 +155,7 @@ const Y = () => {
|
|
|
148
155
|
isProcessing: !1,
|
|
149
156
|
activeWindowIds: [],
|
|
150
157
|
initialized: !1
|
|
151
|
-
}), await
|
|
158
|
+
}), await ve();
|
|
152
159
|
},
|
|
153
160
|
// Add active window ID
|
|
154
161
|
addActiveWindow: (i) => {
|
|
@@ -167,8 +174,8 @@ const Y = () => {
|
|
|
167
174
|
const n = e(), a = String(i);
|
|
168
175
|
return n.activeWindowIds.includes(a);
|
|
169
176
|
}
|
|
170
|
-
}),
|
|
171
|
-
|
|
177
|
+
}), d = oe()(
|
|
178
|
+
ue(Se, {
|
|
172
179
|
name: "tauri-notice-queue"
|
|
173
180
|
})
|
|
174
181
|
), D = {
|
|
@@ -176,37 +183,37 @@ const Y = () => {
|
|
|
176
183
|
currentMessage: (t) => t.currentMessage,
|
|
177
184
|
isProcessing: (t) => t.isProcessing,
|
|
178
185
|
queue: (t) => t.queue
|
|
179
|
-
},
|
|
180
|
-
const t =
|
|
181
|
-
return { showNotice:
|
|
186
|
+
}, Ue = () => {
|
|
187
|
+
const t = d((i) => i.enqueue);
|
|
188
|
+
return { showNotice: A(
|
|
182
189
|
async (i) => {
|
|
183
190
|
await t(i);
|
|
184
191
|
},
|
|
185
192
|
[t]
|
|
186
193
|
) };
|
|
187
194
|
};
|
|
188
|
-
function
|
|
195
|
+
function De(t, e, i, n) {
|
|
189
196
|
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");
|
|
190
197
|
return i === "m" ? n : i === "a" ? n.call(t) : n ? n.value : e.get(t);
|
|
191
198
|
}
|
|
192
|
-
function
|
|
199
|
+
function Ne(t, e, i, n, a) {
|
|
193
200
|
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");
|
|
194
201
|
return e.set(t, i), i;
|
|
195
202
|
}
|
|
196
|
-
var
|
|
197
|
-
const
|
|
198
|
-
function
|
|
203
|
+
var N;
|
|
204
|
+
const w = "__TAURI_TO_IPC_KEY__";
|
|
205
|
+
function ze(t, e = !1) {
|
|
199
206
|
return window.__TAURI_INTERNALS__.transformCallback(t, e);
|
|
200
207
|
}
|
|
201
208
|
async function s(t, e = {}, i) {
|
|
202
209
|
return window.__TAURI_INTERNALS__.invoke(t, e, i);
|
|
203
210
|
}
|
|
204
|
-
class
|
|
211
|
+
class Ae {
|
|
205
212
|
get rid() {
|
|
206
|
-
return
|
|
213
|
+
return De(this, N, "f");
|
|
207
214
|
}
|
|
208
215
|
constructor(e) {
|
|
209
|
-
|
|
216
|
+
N.set(this, void 0), Ne(this, N, e);
|
|
210
217
|
}
|
|
211
218
|
/**
|
|
212
219
|
* Destroys and cleans up this resource from memory.
|
|
@@ -218,8 +225,8 @@ class Ne {
|
|
|
218
225
|
});
|
|
219
226
|
}
|
|
220
227
|
}
|
|
221
|
-
|
|
222
|
-
class
|
|
228
|
+
N = /* @__PURE__ */ new WeakMap();
|
|
229
|
+
class te {
|
|
223
230
|
constructor(...e) {
|
|
224
231
|
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]);
|
|
225
232
|
}
|
|
@@ -241,14 +248,14 @@ class K {
|
|
|
241
248
|
toPhysical(e) {
|
|
242
249
|
return new b(this.width * e, this.height * e);
|
|
243
250
|
}
|
|
244
|
-
[
|
|
251
|
+
[w]() {
|
|
245
252
|
return {
|
|
246
253
|
width: this.width,
|
|
247
254
|
height: this.height
|
|
248
255
|
};
|
|
249
256
|
}
|
|
250
257
|
toJSON() {
|
|
251
|
-
return this[
|
|
258
|
+
return this[w]();
|
|
252
259
|
}
|
|
253
260
|
}
|
|
254
261
|
class b {
|
|
@@ -267,16 +274,16 @@ class b {
|
|
|
267
274
|
* ```
|
|
268
275
|
*/
|
|
269
276
|
toLogical(e) {
|
|
270
|
-
return new
|
|
277
|
+
return new te(this.width / e, this.height / e);
|
|
271
278
|
}
|
|
272
|
-
[
|
|
279
|
+
[w]() {
|
|
273
280
|
return {
|
|
274
281
|
width: this.width,
|
|
275
282
|
height: this.height
|
|
276
283
|
};
|
|
277
284
|
}
|
|
278
285
|
toJSON() {
|
|
279
|
-
return this[
|
|
286
|
+
return this[w]();
|
|
280
287
|
}
|
|
281
288
|
}
|
|
282
289
|
class g {
|
|
@@ -284,12 +291,12 @@ class g {
|
|
|
284
291
|
this.size = e;
|
|
285
292
|
}
|
|
286
293
|
toLogical(e) {
|
|
287
|
-
return this.size instanceof
|
|
294
|
+
return this.size instanceof te ? this.size : this.size.toLogical(e);
|
|
288
295
|
}
|
|
289
296
|
toPhysical(e) {
|
|
290
297
|
return this.size instanceof b ? this.size : this.size.toPhysical(e);
|
|
291
298
|
}
|
|
292
|
-
[
|
|
299
|
+
[w]() {
|
|
293
300
|
return {
|
|
294
301
|
[`${this.size.type}`]: {
|
|
295
302
|
width: this.size.width,
|
|
@@ -298,10 +305,10 @@ class g {
|
|
|
298
305
|
};
|
|
299
306
|
}
|
|
300
307
|
toJSON() {
|
|
301
|
-
return this[
|
|
308
|
+
return this[w]();
|
|
302
309
|
}
|
|
303
310
|
}
|
|
304
|
-
class
|
|
311
|
+
class ie {
|
|
305
312
|
constructor(...e) {
|
|
306
313
|
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]);
|
|
307
314
|
}
|
|
@@ -321,19 +328,19 @@ class X {
|
|
|
321
328
|
* @since 2.0.0
|
|
322
329
|
*/
|
|
323
330
|
toPhysical(e) {
|
|
324
|
-
return new
|
|
331
|
+
return new c(this.x * e, this.y * e);
|
|
325
332
|
}
|
|
326
|
-
[
|
|
333
|
+
[w]() {
|
|
327
334
|
return {
|
|
328
335
|
x: this.x,
|
|
329
336
|
y: this.y
|
|
330
337
|
};
|
|
331
338
|
}
|
|
332
339
|
toJSON() {
|
|
333
|
-
return this[
|
|
340
|
+
return this[w]();
|
|
334
341
|
}
|
|
335
342
|
}
|
|
336
|
-
class
|
|
343
|
+
class c {
|
|
337
344
|
constructor(...e) {
|
|
338
345
|
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]);
|
|
339
346
|
}
|
|
@@ -353,16 +360,16 @@ class u {
|
|
|
353
360
|
* @since 2.0.0
|
|
354
361
|
*/
|
|
355
362
|
toLogical(e) {
|
|
356
|
-
return new
|
|
363
|
+
return new ie(this.x / e, this.y / e);
|
|
357
364
|
}
|
|
358
|
-
[
|
|
365
|
+
[w]() {
|
|
359
366
|
return {
|
|
360
367
|
x: this.x,
|
|
361
368
|
y: this.y
|
|
362
369
|
};
|
|
363
370
|
}
|
|
364
371
|
toJSON() {
|
|
365
|
-
return this[
|
|
372
|
+
return this[w]();
|
|
366
373
|
}
|
|
367
374
|
}
|
|
368
375
|
class p {
|
|
@@ -370,12 +377,12 @@ class p {
|
|
|
370
377
|
this.position = e;
|
|
371
378
|
}
|
|
372
379
|
toLogical(e) {
|
|
373
|
-
return this.position instanceof
|
|
380
|
+
return this.position instanceof ie ? this.position : this.position.toLogical(e);
|
|
374
381
|
}
|
|
375
382
|
toPhysical(e) {
|
|
376
|
-
return this.position instanceof
|
|
383
|
+
return this.position instanceof c ? this.position : this.position.toPhysical(e);
|
|
377
384
|
}
|
|
378
|
-
[
|
|
385
|
+
[w]() {
|
|
379
386
|
return {
|
|
380
387
|
[`${this.position.type}`]: {
|
|
381
388
|
x: this.position.x,
|
|
@@ -384,47 +391,47 @@ class p {
|
|
|
384
391
|
};
|
|
385
392
|
}
|
|
386
393
|
toJSON() {
|
|
387
|
-
return this[
|
|
394
|
+
return this[w]();
|
|
388
395
|
}
|
|
389
396
|
}
|
|
390
397
|
var o;
|
|
391
398
|
(function(t) {
|
|
392
399
|
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";
|
|
393
400
|
})(o || (o = {}));
|
|
394
|
-
async function
|
|
401
|
+
async function ne(t, e) {
|
|
395
402
|
window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(t, e), await s("plugin:event|unlisten", {
|
|
396
403
|
event: t,
|
|
397
404
|
eventId: e
|
|
398
405
|
});
|
|
399
406
|
}
|
|
400
|
-
async function
|
|
407
|
+
async function O(t, e, i) {
|
|
401
408
|
var n;
|
|
402
409
|
const a = typeof i?.target == "string" ? { kind: "AnyLabel", label: i.target } : (n = i?.target) !== null && n !== void 0 ? n : { kind: "Any" };
|
|
403
410
|
return s("plugin:event|listen", {
|
|
404
411
|
event: t,
|
|
405
412
|
target: a,
|
|
406
|
-
handler:
|
|
407
|
-
}).then((r) => async () =>
|
|
413
|
+
handler: ze(e)
|
|
414
|
+
}).then((r) => async () => ne(t, r));
|
|
408
415
|
}
|
|
409
|
-
async function
|
|
410
|
-
return
|
|
411
|
-
|
|
416
|
+
async function E(t, e, i) {
|
|
417
|
+
return O(t, (n) => {
|
|
418
|
+
ne(t, n.id), e(n);
|
|
412
419
|
}, i);
|
|
413
420
|
}
|
|
414
|
-
async function
|
|
421
|
+
async function se(t, e) {
|
|
415
422
|
await s("plugin:event|emit", {
|
|
416
423
|
event: t,
|
|
417
424
|
payload: e
|
|
418
425
|
});
|
|
419
426
|
}
|
|
420
|
-
async function
|
|
427
|
+
async function ae(t, e, i) {
|
|
421
428
|
await s("plugin:event|emit_to", {
|
|
422
429
|
target: typeof t == "string" ? { kind: "AnyLabel", label: t } : t,
|
|
423
430
|
event: e,
|
|
424
431
|
payload: i
|
|
425
432
|
});
|
|
426
433
|
}
|
|
427
|
-
class
|
|
434
|
+
class W extends Ae {
|
|
428
435
|
/**
|
|
429
436
|
* Creates an Image from a resource ID. For internal use only.
|
|
430
437
|
*
|
|
@@ -436,10 +443,10 @@ class m extends Ne {
|
|
|
436
443
|
/** Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height. */
|
|
437
444
|
static async new(e, i, n) {
|
|
438
445
|
return s("plugin:image|new", {
|
|
439
|
-
rgba:
|
|
446
|
+
rgba: z(e),
|
|
440
447
|
width: i,
|
|
441
448
|
height: n
|
|
442
|
-
}).then((a) => new
|
|
449
|
+
}).then((a) => new W(a));
|
|
443
450
|
}
|
|
444
451
|
/**
|
|
445
452
|
* Creates a new image using the provided bytes by inferring the file format.
|
|
@@ -456,8 +463,8 @@ class m extends Ne {
|
|
|
456
463
|
*/
|
|
457
464
|
static async fromBytes(e) {
|
|
458
465
|
return s("plugin:image|from_bytes", {
|
|
459
|
-
bytes:
|
|
460
|
-
}).then((i) => new
|
|
466
|
+
bytes: z(e)
|
|
467
|
+
}).then((i) => new W(i));
|
|
461
468
|
}
|
|
462
469
|
/**
|
|
463
470
|
* Creates a new image using the provided path.
|
|
@@ -472,7 +479,7 @@ class m extends Ne {
|
|
|
472
479
|
* ```
|
|
473
480
|
*/
|
|
474
481
|
static async fromPath(e) {
|
|
475
|
-
return s("plugin:image|from_path", { path: e }).then((i) => new
|
|
482
|
+
return s("plugin:image|from_path", { path: e }).then((i) => new W(i));
|
|
476
483
|
}
|
|
477
484
|
/** Returns the RGBA data for this image, in row-major order from top to bottom. */
|
|
478
485
|
async rgba() {
|
|
@@ -485,14 +492,14 @@ class m extends Ne {
|
|
|
485
492
|
return s("plugin:image|size", { rid: this.rid });
|
|
486
493
|
}
|
|
487
494
|
}
|
|
488
|
-
function
|
|
489
|
-
return t == null ? null : typeof t == "string" ? t : t instanceof
|
|
495
|
+
function z(t) {
|
|
496
|
+
return t == null ? null : typeof t == "string" ? t : t instanceof W ? t.rid : t;
|
|
490
497
|
}
|
|
491
|
-
var
|
|
498
|
+
var R;
|
|
492
499
|
(function(t) {
|
|
493
500
|
t[t.Critical = 1] = "Critical", t[t.Informational = 2] = "Informational";
|
|
494
|
-
})(
|
|
495
|
-
class
|
|
501
|
+
})(R || (R = {}));
|
|
502
|
+
class Oe {
|
|
496
503
|
constructor(e) {
|
|
497
504
|
this._preventDefault = !1, this.event = e.event, this.id = e.id;
|
|
498
505
|
}
|
|
@@ -503,24 +510,24 @@ class ze {
|
|
|
503
510
|
return this._preventDefault;
|
|
504
511
|
}
|
|
505
512
|
}
|
|
506
|
-
var
|
|
513
|
+
var U;
|
|
507
514
|
(function(t) {
|
|
508
515
|
t.None = "none", t.Normal = "normal", t.Indeterminate = "indeterminate", t.Paused = "paused", t.Error = "error";
|
|
509
|
-
})(
|
|
510
|
-
function
|
|
511
|
-
return new
|
|
516
|
+
})(U || (U = {}));
|
|
517
|
+
function le() {
|
|
518
|
+
return new P(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {
|
|
512
519
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
513
520
|
skip: !0
|
|
514
521
|
});
|
|
515
522
|
}
|
|
516
|
-
async function
|
|
517
|
-
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new
|
|
523
|
+
async function C() {
|
|
524
|
+
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new P(e, {
|
|
518
525
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
519
526
|
skip: !0
|
|
520
527
|
})));
|
|
521
528
|
}
|
|
522
|
-
const
|
|
523
|
-
class
|
|
529
|
+
const L = ["tauri://created", "tauri://error"];
|
|
530
|
+
class P {
|
|
524
531
|
/**
|
|
525
532
|
* Creates a new Window.
|
|
526
533
|
* @example
|
|
@@ -561,19 +568,19 @@ class O {
|
|
|
561
568
|
*/
|
|
562
569
|
static async getByLabel(e) {
|
|
563
570
|
var i;
|
|
564
|
-
return (i = (await
|
|
571
|
+
return (i = (await C()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
|
|
565
572
|
}
|
|
566
573
|
/**
|
|
567
574
|
* Get an instance of `Window` for the current window.
|
|
568
575
|
*/
|
|
569
576
|
static getCurrent() {
|
|
570
|
-
return
|
|
577
|
+
return le();
|
|
571
578
|
}
|
|
572
579
|
/**
|
|
573
580
|
* Gets a list of instances of `Window` for all available windows.
|
|
574
581
|
*/
|
|
575
582
|
static async getAll() {
|
|
576
|
-
return
|
|
583
|
+
return C();
|
|
577
584
|
}
|
|
578
585
|
/**
|
|
579
586
|
* Gets the focused window.
|
|
@@ -586,7 +593,7 @@ class O {
|
|
|
586
593
|
* @returns The Window instance or `undefined` if there is not any focused window.
|
|
587
594
|
*/
|
|
588
595
|
static async getFocusedWindow() {
|
|
589
|
-
for (const e of await
|
|
596
|
+
for (const e of await C())
|
|
590
597
|
if (await e.isFocused())
|
|
591
598
|
return e;
|
|
592
599
|
return null;
|
|
@@ -614,7 +621,7 @@ class O {
|
|
|
614
621
|
return this._handleTauriEvent(e, i) ? () => {
|
|
615
622
|
const n = this.listeners[e];
|
|
616
623
|
n.splice(n.indexOf(i), 1);
|
|
617
|
-
} :
|
|
624
|
+
} : O(e, i, {
|
|
618
625
|
target: { kind: "Window", label: this.label }
|
|
619
626
|
});
|
|
620
627
|
}
|
|
@@ -641,7 +648,7 @@ class O {
|
|
|
641
648
|
return this._handleTauriEvent(e, i) ? () => {
|
|
642
649
|
const n = this.listeners[e];
|
|
643
650
|
n.splice(n.indexOf(i), 1);
|
|
644
|
-
} :
|
|
651
|
+
} : E(e, i, {
|
|
645
652
|
target: { kind: "Window", label: this.label }
|
|
646
653
|
});
|
|
647
654
|
}
|
|
@@ -657,7 +664,7 @@ class O {
|
|
|
657
664
|
* @param payload Event payload.
|
|
658
665
|
*/
|
|
659
666
|
async emit(e, i) {
|
|
660
|
-
if (
|
|
667
|
+
if (L.includes(e)) {
|
|
661
668
|
for (const n of this.listeners[e] || [])
|
|
662
669
|
n({
|
|
663
670
|
event: e,
|
|
@@ -666,7 +673,7 @@ class O {
|
|
|
666
673
|
});
|
|
667
674
|
return;
|
|
668
675
|
}
|
|
669
|
-
return
|
|
676
|
+
return se(e, i);
|
|
670
677
|
}
|
|
671
678
|
/**
|
|
672
679
|
* Emits an event to all {@link EventTarget|targets} matching the given target.
|
|
@@ -681,7 +688,7 @@ class O {
|
|
|
681
688
|
* @param payload Event payload.
|
|
682
689
|
*/
|
|
683
690
|
async emitTo(e, i, n) {
|
|
684
|
-
if (
|
|
691
|
+
if (L.includes(i)) {
|
|
685
692
|
for (const a of this.listeners[i] || [])
|
|
686
693
|
a({
|
|
687
694
|
event: i,
|
|
@@ -690,11 +697,11 @@ class O {
|
|
|
690
697
|
});
|
|
691
698
|
return;
|
|
692
699
|
}
|
|
693
|
-
return
|
|
700
|
+
return ae(e, i, n);
|
|
694
701
|
}
|
|
695
702
|
/** @ignore */
|
|
696
703
|
_handleTauriEvent(e, i) {
|
|
697
|
-
return
|
|
704
|
+
return L.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
|
|
698
705
|
}
|
|
699
706
|
// Getters
|
|
700
707
|
/**
|
|
@@ -725,7 +732,7 @@ class O {
|
|
|
725
732
|
async innerPosition() {
|
|
726
733
|
return s("plugin:window|inner_position", {
|
|
727
734
|
label: this.label
|
|
728
|
-
}).then((e) => new
|
|
735
|
+
}).then((e) => new c(e));
|
|
729
736
|
}
|
|
730
737
|
/**
|
|
731
738
|
* The position of the top-left hand corner of the window relative to the top-left hand corner of the desktop.
|
|
@@ -740,7 +747,7 @@ class O {
|
|
|
740
747
|
async outerPosition() {
|
|
741
748
|
return s("plugin:window|outer_position", {
|
|
742
749
|
label: this.label
|
|
743
|
-
}).then((e) => new
|
|
750
|
+
}).then((e) => new c(e));
|
|
744
751
|
}
|
|
745
752
|
/**
|
|
746
753
|
* The physical size of the window's client area.
|
|
@@ -1023,7 +1030,7 @@ class O {
|
|
|
1023
1030
|
*/
|
|
1024
1031
|
async requestUserAttention(e) {
|
|
1025
1032
|
let i = null;
|
|
1026
|
-
return e && (e ===
|
|
1033
|
+
return e && (e === R.Critical ? i = { type: "Critical" } : i = { type: "Informational" }), s("plugin:window|request_user_attention", {
|
|
1027
1034
|
label: this.label,
|
|
1028
1035
|
value: i
|
|
1029
1036
|
});
|
|
@@ -1593,7 +1600,7 @@ class O {
|
|
|
1593
1600
|
async setIcon(e) {
|
|
1594
1601
|
return s("plugin:window|set_icon", {
|
|
1595
1602
|
label: this.label,
|
|
1596
|
-
value:
|
|
1603
|
+
value: z(e)
|
|
1597
1604
|
});
|
|
1598
1605
|
}
|
|
1599
1606
|
/**
|
|
@@ -1828,7 +1835,7 @@ class O {
|
|
|
1828
1835
|
async setOverlayIcon(e) {
|
|
1829
1836
|
return s("plugin:window|set_overlay_icon", {
|
|
1830
1837
|
label: this.label,
|
|
1831
|
-
value: e ?
|
|
1838
|
+
value: e ? z(e) : void 0
|
|
1832
1839
|
});
|
|
1833
1840
|
}
|
|
1834
1841
|
/**
|
|
@@ -1940,7 +1947,7 @@ class O {
|
|
|
1940
1947
|
*/
|
|
1941
1948
|
async onMoved(e) {
|
|
1942
1949
|
return this.listen(o.WINDOW_MOVED, (i) => {
|
|
1943
|
-
i.payload = new
|
|
1950
|
+
i.payload = new c(i.payload), e(i);
|
|
1944
1951
|
});
|
|
1945
1952
|
}
|
|
1946
1953
|
/**
|
|
@@ -1967,7 +1974,7 @@ class O {
|
|
|
1967
1974
|
*/
|
|
1968
1975
|
async onCloseRequested(e) {
|
|
1969
1976
|
return this.listen(o.WINDOW_CLOSE_REQUESTED, async (i) => {
|
|
1970
|
-
const n = new
|
|
1977
|
+
const n = new Oe(i);
|
|
1971
1978
|
await e(n), n.isPreventDefault() || await this.destroy();
|
|
1972
1979
|
});
|
|
1973
1980
|
}
|
|
@@ -2003,7 +2010,7 @@ class O {
|
|
|
2003
2010
|
payload: {
|
|
2004
2011
|
type: "enter",
|
|
2005
2012
|
paths: l.payload.paths,
|
|
2006
|
-
position: new
|
|
2013
|
+
position: new c(l.payload.position)
|
|
2007
2014
|
}
|
|
2008
2015
|
});
|
|
2009
2016
|
}), n = await this.listen(o.DRAG_OVER, (l) => {
|
|
@@ -2011,7 +2018,7 @@ class O {
|
|
|
2011
2018
|
...l,
|
|
2012
2019
|
payload: {
|
|
2013
2020
|
type: "over",
|
|
2014
|
-
position: new
|
|
2021
|
+
position: new c(l.payload.position)
|
|
2015
2022
|
}
|
|
2016
2023
|
});
|
|
2017
2024
|
}), a = await this.listen(o.DRAG_DROP, (l) => {
|
|
@@ -2020,7 +2027,7 @@ class O {
|
|
|
2020
2027
|
payload: {
|
|
2021
2028
|
type: "drop",
|
|
2022
2029
|
paths: l.payload.paths,
|
|
2023
|
-
position: new
|
|
2030
|
+
position: new c(l.payload.position)
|
|
2024
2031
|
}
|
|
2025
2032
|
});
|
|
2026
2033
|
}), r = await this.listen(o.DRAG_LEAVE, (l) => {
|
|
@@ -2102,45 +2109,45 @@ class O {
|
|
|
2102
2109
|
return this.listen(o.WINDOW_THEME_CHANGED, e);
|
|
2103
2110
|
}
|
|
2104
2111
|
}
|
|
2105
|
-
var
|
|
2112
|
+
var H;
|
|
2106
2113
|
(function(t) {
|
|
2107
2114
|
t.Disabled = "disabled", t.Throttle = "throttle", t.Suspend = "suspend";
|
|
2108
|
-
})(
|
|
2109
|
-
var
|
|
2115
|
+
})(H || (H = {}));
|
|
2116
|
+
var Q;
|
|
2110
2117
|
(function(t) {
|
|
2111
2118
|
t.Default = "default", t.FluentOverlay = "fluentOverlay";
|
|
2112
|
-
})(
|
|
2113
|
-
var
|
|
2119
|
+
})(Q || (Q = {}));
|
|
2120
|
+
var V;
|
|
2114
2121
|
(function(t) {
|
|
2115
2122
|
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";
|
|
2116
|
-
})(
|
|
2117
|
-
var
|
|
2123
|
+
})(V || (V = {}));
|
|
2124
|
+
var j;
|
|
2118
2125
|
(function(t) {
|
|
2119
2126
|
t.FollowsWindowActiveState = "followsWindowActiveState", t.Active = "active", t.Inactive = "inactive";
|
|
2120
|
-
})(
|
|
2121
|
-
function
|
|
2127
|
+
})(j || (j = {}));
|
|
2128
|
+
function Pe(t) {
|
|
2122
2129
|
return t === null ? null : {
|
|
2123
2130
|
name: t.name,
|
|
2124
2131
|
scaleFactor: t.scaleFactor,
|
|
2125
|
-
position: new
|
|
2132
|
+
position: new c(t.position),
|
|
2126
2133
|
size: new b(t.size),
|
|
2127
2134
|
workArea: {
|
|
2128
|
-
position: new
|
|
2135
|
+
position: new c(t.workArea.position),
|
|
2129
2136
|
size: new b(t.workArea.size)
|
|
2130
2137
|
}
|
|
2131
2138
|
};
|
|
2132
2139
|
}
|
|
2133
|
-
async function
|
|
2134
|
-
return s("plugin:window|primary_monitor").then(
|
|
2140
|
+
async function xe() {
|
|
2141
|
+
return s("plugin:window|primary_monitor").then(Pe);
|
|
2135
2142
|
}
|
|
2136
|
-
function
|
|
2137
|
-
return new
|
|
2143
|
+
function re() {
|
|
2144
|
+
return new T(le(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, {
|
|
2138
2145
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
2139
2146
|
skip: !0
|
|
2140
2147
|
});
|
|
2141
2148
|
}
|
|
2142
|
-
async function
|
|
2143
|
-
return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new
|
|
2149
|
+
async function $() {
|
|
2150
|
+
return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new T(new P(e.windowLabel, {
|
|
2144
2151
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
2145
2152
|
skip: !0
|
|
2146
2153
|
}), e.label, {
|
|
@@ -2148,8 +2155,8 @@ async function V() {
|
|
|
2148
2155
|
skip: !0
|
|
2149
2156
|
})));
|
|
2150
2157
|
}
|
|
2151
|
-
const
|
|
2152
|
-
class
|
|
2158
|
+
const M = ["tauri://created", "tauri://error"];
|
|
2159
|
+
class T {
|
|
2153
2160
|
/**
|
|
2154
2161
|
* Creates a new Webview.
|
|
2155
2162
|
* @example
|
|
@@ -2204,19 +2211,19 @@ class E {
|
|
|
2204
2211
|
*/
|
|
2205
2212
|
static async getByLabel(e) {
|
|
2206
2213
|
var i;
|
|
2207
|
-
return (i = (await
|
|
2214
|
+
return (i = (await $()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
|
|
2208
2215
|
}
|
|
2209
2216
|
/**
|
|
2210
2217
|
* Get an instance of `Webview` for the current webview.
|
|
2211
2218
|
*/
|
|
2212
2219
|
static getCurrent() {
|
|
2213
|
-
return
|
|
2220
|
+
return re();
|
|
2214
2221
|
}
|
|
2215
2222
|
/**
|
|
2216
2223
|
* Gets a list of instances of `Webview` for all available webviews.
|
|
2217
2224
|
*/
|
|
2218
2225
|
static async getAll() {
|
|
2219
|
-
return
|
|
2226
|
+
return $();
|
|
2220
2227
|
}
|
|
2221
2228
|
/**
|
|
2222
2229
|
* Listen to an emitted event on this webview.
|
|
@@ -2241,7 +2248,7 @@ class E {
|
|
|
2241
2248
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2242
2249
|
const n = this.listeners[e];
|
|
2243
2250
|
n.splice(n.indexOf(i), 1);
|
|
2244
|
-
} :
|
|
2251
|
+
} : O(e, i, {
|
|
2245
2252
|
target: { kind: "Webview", label: this.label }
|
|
2246
2253
|
});
|
|
2247
2254
|
}
|
|
@@ -2268,7 +2275,7 @@ class E {
|
|
|
2268
2275
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2269
2276
|
const n = this.listeners[e];
|
|
2270
2277
|
n.splice(n.indexOf(i), 1);
|
|
2271
|
-
} :
|
|
2278
|
+
} : E(e, i, {
|
|
2272
2279
|
target: { kind: "Webview", label: this.label }
|
|
2273
2280
|
});
|
|
2274
2281
|
}
|
|
@@ -2285,7 +2292,7 @@ class E {
|
|
|
2285
2292
|
* @param payload Event payload.
|
|
2286
2293
|
*/
|
|
2287
2294
|
async emit(e, i) {
|
|
2288
|
-
if (
|
|
2295
|
+
if (M.includes(e)) {
|
|
2289
2296
|
for (const n of this.listeners[e] || [])
|
|
2290
2297
|
n({
|
|
2291
2298
|
event: e,
|
|
@@ -2294,7 +2301,7 @@ class E {
|
|
|
2294
2301
|
});
|
|
2295
2302
|
return;
|
|
2296
2303
|
}
|
|
2297
|
-
return
|
|
2304
|
+
return se(e, i);
|
|
2298
2305
|
}
|
|
2299
2306
|
/**
|
|
2300
2307
|
* Emits an event to all {@link EventTarget|targets} matching the given target.
|
|
@@ -2310,7 +2317,7 @@ class E {
|
|
|
2310
2317
|
* @param payload Event payload.
|
|
2311
2318
|
*/
|
|
2312
2319
|
async emitTo(e, i, n) {
|
|
2313
|
-
if (
|
|
2320
|
+
if (M.includes(i)) {
|
|
2314
2321
|
for (const a of this.listeners[i] || [])
|
|
2315
2322
|
a({
|
|
2316
2323
|
event: i,
|
|
@@ -2319,11 +2326,11 @@ class E {
|
|
|
2319
2326
|
});
|
|
2320
2327
|
return;
|
|
2321
2328
|
}
|
|
2322
|
-
return
|
|
2329
|
+
return ae(e, i, n);
|
|
2323
2330
|
}
|
|
2324
2331
|
/** @ignore */
|
|
2325
2332
|
_handleTauriEvent(e, i) {
|
|
2326
|
-
return
|
|
2333
|
+
return M.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
|
|
2327
2334
|
}
|
|
2328
2335
|
// Getters
|
|
2329
2336
|
/**
|
|
@@ -2339,7 +2346,7 @@ class E {
|
|
|
2339
2346
|
async position() {
|
|
2340
2347
|
return s("plugin:webview|webview_position", {
|
|
2341
2348
|
label: this.label
|
|
2342
|
-
}).then((e) => new
|
|
2349
|
+
}).then((e) => new c(e));
|
|
2343
2350
|
}
|
|
2344
2351
|
/**
|
|
2345
2352
|
* The physical size of the webview's client area.
|
|
@@ -2566,7 +2573,7 @@ class E {
|
|
|
2566
2573
|
payload: {
|
|
2567
2574
|
type: "enter",
|
|
2568
2575
|
paths: l.payload.paths,
|
|
2569
|
-
position: new
|
|
2576
|
+
position: new c(l.payload.position)
|
|
2570
2577
|
}
|
|
2571
2578
|
});
|
|
2572
2579
|
}), n = await this.listen(o.DRAG_OVER, (l) => {
|
|
@@ -2574,7 +2581,7 @@ class E {
|
|
|
2574
2581
|
...l,
|
|
2575
2582
|
payload: {
|
|
2576
2583
|
type: "over",
|
|
2577
|
-
position: new
|
|
2584
|
+
position: new c(l.payload.position)
|
|
2578
2585
|
}
|
|
2579
2586
|
});
|
|
2580
2587
|
}), a = await this.listen(o.DRAG_DROP, (l) => {
|
|
@@ -2583,7 +2590,7 @@ class E {
|
|
|
2583
2590
|
payload: {
|
|
2584
2591
|
type: "drop",
|
|
2585
2592
|
paths: l.payload.paths,
|
|
2586
|
-
position: new
|
|
2593
|
+
position: new c(l.payload.position)
|
|
2587
2594
|
}
|
|
2588
2595
|
});
|
|
2589
2596
|
}), r = await this.listen(o.DRAG_LEAVE, (l) => {
|
|
@@ -2594,11 +2601,11 @@ class E {
|
|
|
2594
2601
|
};
|
|
2595
2602
|
}
|
|
2596
2603
|
}
|
|
2597
|
-
function
|
|
2598
|
-
const t =
|
|
2604
|
+
function Ie() {
|
|
2605
|
+
const t = re();
|
|
2599
2606
|
return new _(t.label, { skip: !0 });
|
|
2600
2607
|
}
|
|
2601
|
-
async function
|
|
2608
|
+
async function J() {
|
|
2602
2609
|
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new _(e, {
|
|
2603
2610
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
2604
2611
|
skip: !0
|
|
@@ -2647,20 +2654,20 @@ class _ {
|
|
|
2647
2654
|
*/
|
|
2648
2655
|
static async getByLabel(e) {
|
|
2649
2656
|
var i;
|
|
2650
|
-
const n = (i = (await
|
|
2657
|
+
const n = (i = (await J()).find((a) => a.label === e)) !== null && i !== void 0 ? i : null;
|
|
2651
2658
|
return n ? new _(n.label, { skip: !0 }) : null;
|
|
2652
2659
|
}
|
|
2653
2660
|
/**
|
|
2654
2661
|
* Get an instance of `Webview` for the current webview.
|
|
2655
2662
|
*/
|
|
2656
2663
|
static getCurrent() {
|
|
2657
|
-
return
|
|
2664
|
+
return Ie();
|
|
2658
2665
|
}
|
|
2659
2666
|
/**
|
|
2660
2667
|
* Gets a list of instances of `Webview` for all available webviews.
|
|
2661
2668
|
*/
|
|
2662
2669
|
static async getAll() {
|
|
2663
|
-
return
|
|
2670
|
+
return J();
|
|
2664
2671
|
}
|
|
2665
2672
|
/**
|
|
2666
2673
|
* Listen to an emitted event on this webivew window.
|
|
@@ -2685,7 +2692,7 @@ class _ {
|
|
|
2685
2692
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2686
2693
|
const n = this.listeners[e];
|
|
2687
2694
|
n.splice(n.indexOf(i), 1);
|
|
2688
|
-
} :
|
|
2695
|
+
} : O(e, i, {
|
|
2689
2696
|
target: { kind: "WebviewWindow", label: this.label }
|
|
2690
2697
|
});
|
|
2691
2698
|
}
|
|
@@ -2712,7 +2719,7 @@ class _ {
|
|
|
2712
2719
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2713
2720
|
const n = this.listeners[e];
|
|
2714
2721
|
n.splice(n.indexOf(i), 1);
|
|
2715
|
-
} :
|
|
2722
|
+
} : E(e, i, {
|
|
2716
2723
|
target: { kind: "WebviewWindow", label: this.label }
|
|
2717
2724
|
});
|
|
2718
2725
|
}
|
|
@@ -2736,8 +2743,8 @@ class _ {
|
|
|
2736
2743
|
return s("plugin:window|set_background_color", { color: e }).then(() => s("plugin:webview|set_webview_background_color", { color: e }));
|
|
2737
2744
|
}
|
|
2738
2745
|
}
|
|
2739
|
-
|
|
2740
|
-
function
|
|
2746
|
+
ke(_, [P, T]);
|
|
2747
|
+
function ke(t, e) {
|
|
2741
2748
|
(Array.isArray(e) ? e : [e]).forEach((i) => {
|
|
2742
2749
|
Object.getOwnPropertyNames(i.prototype).forEach((n) => {
|
|
2743
2750
|
var a;
|
|
@@ -2750,16 +2757,16 @@ function xe(t, e) {
|
|
|
2750
2757
|
});
|
|
2751
2758
|
});
|
|
2752
2759
|
}
|
|
2753
|
-
const
|
|
2760
|
+
const S = /* @__PURE__ */ new Map(), Ce = async (t, e, i) => {
|
|
2754
2761
|
const n = i?.padding ?? 20;
|
|
2755
2762
|
if (i?.x !== void 0 && i?.y !== void 0)
|
|
2756
2763
|
return { x: i.x, y: i.y };
|
|
2757
2764
|
let a = 1920, r = 1080;
|
|
2758
2765
|
try {
|
|
2759
|
-
const
|
|
2760
|
-
|
|
2761
|
-
} catch (
|
|
2762
|
-
console.warn("Failed to get monitor info, using defaults:",
|
|
2766
|
+
const u = await xe();
|
|
2767
|
+
u?.size && (a = u.size.width, r = u.size.height);
|
|
2768
|
+
} catch (u) {
|
|
2769
|
+
console.warn("Failed to get monitor info, using defaults:", u);
|
|
2763
2770
|
}
|
|
2764
2771
|
switch (i?.position ?? "right-bottom") {
|
|
2765
2772
|
case "right-bottom":
|
|
@@ -2793,139 +2800,148 @@ const v = /* @__PURE__ */ new Map(), Ie = async (t, e, i) => {
|
|
|
2793
2800
|
y: r - e - n
|
|
2794
2801
|
};
|
|
2795
2802
|
}
|
|
2796
|
-
},
|
|
2797
|
-
const e = String(t.id), i =
|
|
2803
|
+
}, Le = async (t) => {
|
|
2804
|
+
const e = String(t.id), i = d.getState();
|
|
2798
2805
|
if (i.isWindowActive(e)) {
|
|
2799
2806
|
console.log(`Notice window already open for message: ${e}`);
|
|
2800
2807
|
return;
|
|
2801
2808
|
}
|
|
2802
|
-
const n =
|
|
2809
|
+
const n = K(), a = `notice-${e}`, r = `${n.routePrefix}/${t.type}?id=${t.id}`, l = t.min_width || n.defaultWidth, u = t.min_height || n.defaultHeight, { x: f, y: m } = await Ce(l, u, t.windowPosition);
|
|
2803
2810
|
try {
|
|
2804
2811
|
const y = new _(a, {
|
|
2805
2812
|
url: r,
|
|
2806
2813
|
title: t.title,
|
|
2807
2814
|
width: l,
|
|
2808
|
-
height:
|
|
2809
|
-
x:
|
|
2810
|
-
y:
|
|
2815
|
+
height: u,
|
|
2816
|
+
x: f,
|
|
2817
|
+
y: m,
|
|
2811
2818
|
resizable: !0,
|
|
2812
2819
|
decorations: !0,
|
|
2813
2820
|
skipTaskbar: !1,
|
|
2814
2821
|
alwaysOnTop: !0
|
|
2815
2822
|
});
|
|
2816
|
-
|
|
2817
|
-
|
|
2823
|
+
S.set(e, y), i.addActiveWindow(e), y.once("tauri://destroyed", async () => {
|
|
2824
|
+
S.delete(e), i.removeActiveWindow(e), await ee(e), i.clearCurrent();
|
|
2818
2825
|
}), console.log(`Created notice window: ${a}`);
|
|
2819
2826
|
} catch (y) {
|
|
2820
2827
|
console.error("Failed to create notice window:", y), i.removeActiveWindow(e), i.clearCurrent();
|
|
2821
2828
|
}
|
|
2822
|
-
},
|
|
2823
|
-
const e = String(t), i =
|
|
2829
|
+
}, q = async (t) => {
|
|
2830
|
+
const e = String(t), i = S.get(e), n = d.getState();
|
|
2824
2831
|
if (i)
|
|
2825
2832
|
try {
|
|
2826
|
-
await i.close(),
|
|
2827
|
-
} catch (
|
|
2828
|
-
console.error("Failed to close notice window:",
|
|
2833
|
+
await i.close(), S.delete(e), n.removeActiveWindow(e), await ee(e), n.clearCurrent(), console.log(`Closed notice window: ${e}`);
|
|
2834
|
+
} catch (a) {
|
|
2835
|
+
console.error("Failed to close notice window:", a);
|
|
2829
2836
|
}
|
|
2830
|
-
},
|
|
2831
|
-
const t = Array.from(
|
|
2832
|
-
(e) =>
|
|
2837
|
+
}, Me = async () => {
|
|
2838
|
+
const t = Array.from(S.keys()).map(
|
|
2839
|
+
(e) => q(e)
|
|
2833
2840
|
);
|
|
2834
2841
|
await Promise.all(t);
|
|
2835
|
-
},
|
|
2842
|
+
}, Re = () => {
|
|
2836
2843
|
let t = null;
|
|
2837
|
-
|
|
2844
|
+
d.subscribe((e) => {
|
|
2838
2845
|
const i = e.currentMessage;
|
|
2839
|
-
i && i !== t ? (t = i,
|
|
2846
|
+
i && i !== t ? (t = i, Le(i)) : i || (t = null);
|
|
2840
2847
|
}), console.log("Notice window system initialized");
|
|
2841
|
-
},
|
|
2842
|
-
const t =
|
|
2843
|
-
return { closeNotice:
|
|
2844
|
-
t && await
|
|
2848
|
+
}, He = () => {
|
|
2849
|
+
const t = d((i) => i.currentMessage);
|
|
2850
|
+
return { closeNotice: A(async () => {
|
|
2851
|
+
t && await q(t.id);
|
|
2845
2852
|
}, [t]) };
|
|
2846
|
-
},
|
|
2847
|
-
const t =
|
|
2848
|
-
return { hideNotice:
|
|
2853
|
+
}, Qe = () => {
|
|
2854
|
+
const t = d();
|
|
2855
|
+
return { hideNotice: A(
|
|
2849
2856
|
async (i) => {
|
|
2850
|
-
await
|
|
2857
|
+
await fe(i), await q(i), t.currentMessage?.id === i && t.clearCurrent();
|
|
2851
2858
|
},
|
|
2852
2859
|
[t]
|
|
2853
2860
|
) };
|
|
2854
|
-
},
|
|
2855
|
-
const t =
|
|
2856
|
-
return { hideAllNotices:
|
|
2857
|
-
await
|
|
2861
|
+
}, Ve = () => {
|
|
2862
|
+
const t = d((i) => i.clearOnLogout);
|
|
2863
|
+
return { hideAllNotices: A(async () => {
|
|
2864
|
+
await Me(), await t();
|
|
2858
2865
|
}, [t]) };
|
|
2859
|
-
},
|
|
2860
|
-
const t =
|
|
2866
|
+
}, je = () => {
|
|
2867
|
+
const t = d(D.queueLength), e = d(D.currentMessage), i = d(D.isProcessing), n = d(D.queue);
|
|
2861
2868
|
return {
|
|
2862
2869
|
queueLength: t,
|
|
2863
2870
|
currentMessage: e,
|
|
2864
2871
|
isProcessing: i,
|
|
2865
2872
|
queue: n
|
|
2866
2873
|
};
|
|
2867
|
-
},
|
|
2868
|
-
const [
|
|
2869
|
-
return
|
|
2874
|
+
}, $e = ({ children: t, onLoad: e, onClose: i }) => {
|
|
2875
|
+
const [n, a] = I(null), [r, l] = I(!0), [u, f] = I(null);
|
|
2876
|
+
return B(() => {
|
|
2870
2877
|
(async () => {
|
|
2871
2878
|
try {
|
|
2872
|
-
const
|
|
2873
|
-
if (!
|
|
2874
|
-
|
|
2879
|
+
const F = new URLSearchParams(window.location.search).get("id");
|
|
2880
|
+
if (!F) {
|
|
2881
|
+
f("No message ID provided"), l(!1);
|
|
2875
2882
|
return;
|
|
2876
2883
|
}
|
|
2877
|
-
const
|
|
2878
|
-
if (!
|
|
2879
|
-
|
|
2884
|
+
const x = await me(F);
|
|
2885
|
+
if (!x) {
|
|
2886
|
+
f("Message not found"), l(!1);
|
|
2880
2887
|
return;
|
|
2881
2888
|
}
|
|
2882
|
-
|
|
2883
|
-
} catch (
|
|
2884
|
-
console.error("Failed to load message:",
|
|
2889
|
+
a(x), l(!1), e && e(x);
|
|
2890
|
+
} catch (y) {
|
|
2891
|
+
console.error("Failed to load message:", y), f("Failed to load message"), l(!1);
|
|
2885
2892
|
}
|
|
2886
2893
|
})();
|
|
2887
|
-
}, [e]),
|
|
2894
|
+
}, [e]), B(() => {
|
|
2895
|
+
if (!n || !i) return;
|
|
2896
|
+
const m = () => {
|
|
2897
|
+
i(n);
|
|
2898
|
+
};
|
|
2899
|
+
return window.addEventListener("beforeunload", m), () => {
|
|
2900
|
+
window.removeEventListener("beforeunload", m);
|
|
2901
|
+
};
|
|
2902
|
+
}, [n, i]), r ? /* @__PURE__ */ k("div", { style: {
|
|
2888
2903
|
display: "flex",
|
|
2889
2904
|
justifyContent: "center",
|
|
2890
2905
|
alignItems: "center",
|
|
2891
2906
|
height: "100vh",
|
|
2892
2907
|
fontFamily: "system-ui, -apple-system, sans-serif"
|
|
2893
|
-
}, children: "Loading..." }) :
|
|
2908
|
+
}, children: "Loading..." }) : u || !n ? /* @__PURE__ */ k("div", { style: {
|
|
2894
2909
|
display: "flex",
|
|
2895
2910
|
justifyContent: "center",
|
|
2896
2911
|
alignItems: "center",
|
|
2897
2912
|
height: "100vh",
|
|
2898
2913
|
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
2899
2914
|
color: "#ef4444"
|
|
2900
|
-
}, children:
|
|
2901
|
-
},
|
|
2902
|
-
|
|
2903
|
-
const { initializeFromDatabase: t } =
|
|
2915
|
+
}, children: u || "Message not found" }) : /* @__PURE__ */ k(de, { children: t(n) });
|
|
2916
|
+
}, Je = async () => {
|
|
2917
|
+
X(), Re();
|
|
2918
|
+
const { initializeFromDatabase: t } = d.getState();
|
|
2904
2919
|
await t(), console.log("Tauri Notice System initialized");
|
|
2905
2920
|
};
|
|
2906
2921
|
export {
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2922
|
+
$e as NoticeLayout,
|
|
2923
|
+
ve as clearPendingMessages,
|
|
2924
|
+
Me as closeAllNoticeWindows,
|
|
2925
|
+
q as closeNoticeWindow,
|
|
2926
|
+
Le as createNoticeWindow,
|
|
2927
|
+
me as getMessage,
|
|
2928
|
+
K as getNoticeConfig,
|
|
2929
|
+
pe as getPendingMessages,
|
|
2930
|
+
be as hasMessage,
|
|
2931
|
+
X as initializeDatabase,
|
|
2932
|
+
Je as initializeNoticeSystem,
|
|
2933
|
+
Re as initializeNoticeWindowSystem,
|
|
2934
|
+
ye as isMessageShown,
|
|
2935
|
+
fe as markAsHidden,
|
|
2936
|
+
ee as markAsShown,
|
|
2921
2937
|
D as messageQueueSelectors,
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2938
|
+
ge as saveMessage,
|
|
2939
|
+
Ge as setNoticeConfig,
|
|
2940
|
+
He as useCloseNotice,
|
|
2941
|
+
Ve as useHideAllNotices,
|
|
2942
|
+
Qe as useHideNotice,
|
|
2943
|
+
je as useMessageQueue,
|
|
2944
|
+
d as useMessageQueueStore,
|
|
2945
|
+
Ue as useNoticeWindow
|
|
2930
2946
|
};
|
|
2931
2947
|
//# sourceMappingURL=index.js.map
|