tauri-notice-window 1.0.7 → 1.0.9
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 +444 -1
- package/dist/components/NoticeLayout.d.ts.map +1 -1
- package/dist/config/noticeConfig.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +359 -289
- package/dist/index.js.map +1 -1
- package/dist/stores/messageQueueStore.d.ts +1 -0
- package/dist/stores/messageQueueStore.d.ts.map +1 -1
- package/dist/types/message.d.ts +2 -0
- package/dist/types/message.d.ts.map +1 -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,33 +1,35 @@
|
|
|
1
|
-
import { create as
|
|
2
|
-
import { syncTabs as
|
|
3
|
-
import
|
|
4
|
-
import { useCallback as
|
|
5
|
-
import { jsx as
|
|
6
|
-
const
|
|
1
|
+
import { create as ge } from "zustand";
|
|
2
|
+
import { syncTabs as ye } from "zustand-sync";
|
|
3
|
+
import be from "dexie";
|
|
4
|
+
import { useCallback as I, useState as E, useEffect as G } from "react";
|
|
5
|
+
import { jsx as A, Fragment as pe } from "react/jsx-runtime";
|
|
6
|
+
const K = "tauri-notice-config", Q = {
|
|
7
7
|
routePrefix: "/notice",
|
|
8
8
|
databaseName: "tauri-notice-db",
|
|
9
9
|
defaultWidth: 400,
|
|
10
|
-
defaultHeight: 300
|
|
11
|
-
|
|
10
|
+
defaultHeight: 300,
|
|
11
|
+
notFoundUrl: "/404"
|
|
12
|
+
// Default 404 page
|
|
13
|
+
}, X = () => {
|
|
12
14
|
try {
|
|
13
|
-
const t = localStorage.getItem(
|
|
15
|
+
const t = localStorage.getItem(K);
|
|
14
16
|
if (t)
|
|
15
|
-
return { ...
|
|
17
|
+
return { ...Q, ...JSON.parse(t) };
|
|
16
18
|
} catch (t) {
|
|
17
19
|
console.warn("Failed to load config from localStorage:", t);
|
|
18
20
|
}
|
|
19
|
-
return
|
|
20
|
-
},
|
|
21
|
+
return Q;
|
|
22
|
+
}, _e = (t) => {
|
|
21
23
|
try {
|
|
22
|
-
localStorage.setItem(
|
|
24
|
+
localStorage.setItem(K, JSON.stringify(t));
|
|
23
25
|
} catch (e) {
|
|
24
26
|
console.warn("Failed to save config to localStorage:", e);
|
|
25
27
|
}
|
|
26
|
-
},
|
|
27
|
-
const i = { ...
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
class
|
|
28
|
+
}, He = (t) => {
|
|
29
|
+
const i = { ...X(), ...t };
|
|
30
|
+
_e(i);
|
|
31
|
+
}, ee = () => X();
|
|
32
|
+
class fe extends be {
|
|
31
33
|
messages;
|
|
32
34
|
constructor(e) {
|
|
33
35
|
super(e), this.version(1).stores({
|
|
@@ -35,14 +37,14 @@ class he extends ce {
|
|
|
35
37
|
});
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
|
-
let
|
|
39
|
-
const
|
|
40
|
-
if (!
|
|
41
|
-
const t =
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
return
|
|
45
|
-
}, h = () =>
|
|
40
|
+
let D = null;
|
|
41
|
+
const te = () => {
|
|
42
|
+
if (!D) {
|
|
43
|
+
const t = ee();
|
|
44
|
+
D = new fe(t.databaseName);
|
|
45
|
+
}
|
|
46
|
+
return D;
|
|
47
|
+
}, h = () => D || te(), me = async (t) => {
|
|
46
48
|
const e = {
|
|
47
49
|
...t,
|
|
48
50
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -52,30 +54,36 @@ const X = () => {
|
|
|
52
54
|
queuePosition: 0
|
|
53
55
|
};
|
|
54
56
|
await h().messages.put(e);
|
|
55
|
-
},
|
|
57
|
+
}, ve = async (t) => !!await h().messages.get(t), We = async (t) => {
|
|
56
58
|
const e = await h().messages.get(t);
|
|
57
59
|
return e?.isShown === !0 || e?.queueStatus === "shown";
|
|
58
|
-
},
|
|
60
|
+
}, Se = async () => await h().messages.where("queueStatus").equals("pending").sortBy("queuePosition"), De = async (t, e) => {
|
|
59
61
|
await h().messages.update(t, { queueStatus: e });
|
|
60
|
-
},
|
|
62
|
+
}, ie = async (t) => {
|
|
61
63
|
await h().messages.update(t, {
|
|
62
64
|
queueStatus: "shown",
|
|
63
65
|
isShown: !0
|
|
64
66
|
});
|
|
65
|
-
},
|
|
67
|
+
}, Ne = async (t) => {
|
|
66
68
|
await h().messages.update(t, {
|
|
67
69
|
queueStatus: "hidden"
|
|
68
70
|
});
|
|
69
|
-
},
|
|
71
|
+
}, ne = async (t) => await h().messages.get(t), Ve = async (t) => {
|
|
70
72
|
await h().messages.delete(t);
|
|
71
|
-
|
|
73
|
+
try {
|
|
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 () => {
|
|
72
80
|
await h().messages.where("queueStatus").anyOf(["pending", "showing"]).delete();
|
|
73
|
-
},
|
|
81
|
+
}, Ae = async (t) => {
|
|
74
82
|
const e = t.map(
|
|
75
83
|
(i) => h().messages.update(i.id, { queuePosition: i.position })
|
|
76
84
|
);
|
|
77
85
|
await Promise.all(e);
|
|
78
|
-
},
|
|
86
|
+
}, Oe = (t, e) => ({
|
|
79
87
|
// Initial state
|
|
80
88
|
queue: [],
|
|
81
89
|
currentMessage: null,
|
|
@@ -85,11 +93,11 @@ const X = () => {
|
|
|
85
93
|
// Enqueue a new message
|
|
86
94
|
enqueue: async (i) => {
|
|
87
95
|
const n = e();
|
|
88
|
-
if (await
|
|
96
|
+
if (await We(i.id)) {
|
|
89
97
|
console.log(`Message ${i.id} was already shown, skipping`);
|
|
90
98
|
return;
|
|
91
99
|
}
|
|
92
|
-
if (await
|
|
100
|
+
if (await ve(i.id) || await me(i), !n.queue.some((u) => u.id === i.id)) {
|
|
93
101
|
const u = [...n.queue, i];
|
|
94
102
|
t({ queue: u }), await e().persistQueue();
|
|
95
103
|
}
|
|
@@ -110,10 +118,14 @@ const X = () => {
|
|
|
110
118
|
t({ isProcessing: !1, currentMessage: null });
|
|
111
119
|
return;
|
|
112
120
|
}
|
|
121
|
+
if (!await ne(n.id)) {
|
|
122
|
+
console.log(`Message ${n.id} was deleted, skipping to next`), await e().showNext();
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
113
125
|
t({
|
|
114
126
|
currentMessage: n,
|
|
115
127
|
isProcessing: !0
|
|
116
|
-
}), await
|
|
128
|
+
}), await De(n.id, "showing"), await e().persistQueue();
|
|
117
129
|
},
|
|
118
130
|
// Clear current message and show next
|
|
119
131
|
clearCurrent: () => {
|
|
@@ -138,16 +150,16 @@ const X = () => {
|
|
|
138
150
|
initializeFromDatabase: async () => {
|
|
139
151
|
if (e().initialized) return;
|
|
140
152
|
t({ initialized: !0 });
|
|
141
|
-
const n = await
|
|
153
|
+
const n = await Se();
|
|
142
154
|
n.length > 0 && (t({ queue: n }), await e().showNext());
|
|
143
155
|
},
|
|
144
156
|
// Persist queue to database
|
|
145
157
|
persistQueue: async () => {
|
|
146
|
-
const n = e().queue.map((a,
|
|
158
|
+
const n = e().queue.map((a, l) => ({
|
|
147
159
|
id: a.id,
|
|
148
|
-
position:
|
|
160
|
+
position: l
|
|
149
161
|
}));
|
|
150
|
-
await
|
|
162
|
+
await Ae(n);
|
|
151
163
|
},
|
|
152
164
|
// Clear all messages on logout
|
|
153
165
|
clearOnLogout: async () => {
|
|
@@ -157,7 +169,19 @@ const X = () => {
|
|
|
157
169
|
isProcessing: !1,
|
|
158
170
|
activeWindowIds: [],
|
|
159
171
|
initialized: !1
|
|
160
|
-
}), await
|
|
172
|
+
}), await ze();
|
|
173
|
+
},
|
|
174
|
+
// Remove a specific message from the queue by ID
|
|
175
|
+
removeFromQueue: (i) => {
|
|
176
|
+
const n = e(), a = n.queue.filter((l) => l.id !== i);
|
|
177
|
+
t({ queue: a }), n.currentMessage?.id === i && (async () => {
|
|
178
|
+
try {
|
|
179
|
+
const { closeNoticeWindow: r } = await Promise.resolve().then(() => Fe);
|
|
180
|
+
await r(i);
|
|
181
|
+
} catch (r) {
|
|
182
|
+
console.warn("Failed to close notice window:", r), e().clearCurrent();
|
|
183
|
+
}
|
|
184
|
+
})();
|
|
161
185
|
},
|
|
162
186
|
// Add active window ID
|
|
163
187
|
addActiveWindow: (i) => {
|
|
@@ -168,7 +192,7 @@ const X = () => {
|
|
|
168
192
|
removeActiveWindow: (i) => {
|
|
169
193
|
const n = e(), a = String(i);
|
|
170
194
|
t({
|
|
171
|
-
activeWindowIds: n.activeWindowIds.filter((
|
|
195
|
+
activeWindowIds: n.activeWindowIds.filter((l) => l !== a)
|
|
172
196
|
});
|
|
173
197
|
},
|
|
174
198
|
// Check if window is active
|
|
@@ -176,46 +200,50 @@ const X = () => {
|
|
|
176
200
|
const n = e(), a = String(i);
|
|
177
201
|
return n.activeWindowIds.includes(a);
|
|
178
202
|
}
|
|
179
|
-
}),
|
|
180
|
-
|
|
203
|
+
}), w = ge()(
|
|
204
|
+
ye(Oe, {
|
|
181
205
|
name: "tauri-notice-queue"
|
|
182
206
|
})
|
|
183
|
-
),
|
|
207
|
+
), S = {
|
|
184
208
|
queueLength: (t) => t.queue.length,
|
|
185
209
|
currentMessage: (t) => t.currentMessage,
|
|
186
210
|
isProcessing: (t) => t.isProcessing,
|
|
187
211
|
queue: (t) => t.queue
|
|
188
|
-
},
|
|
189
|
-
|
|
190
|
-
|
|
212
|
+
}, Pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
213
|
+
__proto__: null,
|
|
214
|
+
messageQueueSelectors: S,
|
|
215
|
+
useMessageQueueStore: w
|
|
216
|
+
}, Symbol.toStringTag, { value: "Module" })), $e = () => {
|
|
217
|
+
const t = w((i) => i.enqueue);
|
|
218
|
+
return { showNotice: I(
|
|
191
219
|
async (i) => {
|
|
192
220
|
await t(i);
|
|
193
221
|
},
|
|
194
222
|
[t]
|
|
195
223
|
) };
|
|
196
224
|
};
|
|
197
|
-
function
|
|
225
|
+
function xe(t, e, i, n) {
|
|
198
226
|
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");
|
|
199
227
|
return i === "m" ? n : i === "a" ? n.call(t) : n ? n.value : e.get(t);
|
|
200
228
|
}
|
|
201
|
-
function
|
|
229
|
+
function Ie(t, e, i, n, a) {
|
|
202
230
|
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");
|
|
203
231
|
return e.set(t, i), i;
|
|
204
232
|
}
|
|
205
|
-
var
|
|
206
|
-
const
|
|
207
|
-
function
|
|
233
|
+
var O;
|
|
234
|
+
const d = "__TAURI_TO_IPC_KEY__";
|
|
235
|
+
function Me(t, e = !1) {
|
|
208
236
|
return window.__TAURI_INTERNALS__.transformCallback(t, e);
|
|
209
237
|
}
|
|
210
238
|
async function s(t, e = {}, i) {
|
|
211
239
|
return window.__TAURI_INTERNALS__.invoke(t, e, i);
|
|
212
240
|
}
|
|
213
|
-
class
|
|
241
|
+
class ke {
|
|
214
242
|
get rid() {
|
|
215
|
-
return
|
|
243
|
+
return xe(this, O, "f");
|
|
216
244
|
}
|
|
217
245
|
constructor(e) {
|
|
218
|
-
|
|
246
|
+
O.set(this, void 0), Ie(this, O, e);
|
|
219
247
|
}
|
|
220
248
|
/**
|
|
221
249
|
* Destroys and cleans up this resource from memory.
|
|
@@ -227,8 +255,8 @@ class Ae {
|
|
|
227
255
|
});
|
|
228
256
|
}
|
|
229
257
|
}
|
|
230
|
-
|
|
231
|
-
class
|
|
258
|
+
O = /* @__PURE__ */ new WeakMap();
|
|
259
|
+
class se {
|
|
232
260
|
constructor(...e) {
|
|
233
261
|
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]);
|
|
234
262
|
}
|
|
@@ -248,19 +276,19 @@ class te {
|
|
|
248
276
|
* @since 2.0.0
|
|
249
277
|
*/
|
|
250
278
|
toPhysical(e) {
|
|
251
|
-
return new
|
|
279
|
+
return new y(this.width * e, this.height * e);
|
|
252
280
|
}
|
|
253
|
-
[
|
|
281
|
+
[d]() {
|
|
254
282
|
return {
|
|
255
283
|
width: this.width,
|
|
256
284
|
height: this.height
|
|
257
285
|
};
|
|
258
286
|
}
|
|
259
287
|
toJSON() {
|
|
260
|
-
return this[
|
|
288
|
+
return this[d]();
|
|
261
289
|
}
|
|
262
290
|
}
|
|
263
|
-
class
|
|
291
|
+
class y {
|
|
264
292
|
constructor(...e) {
|
|
265
293
|
this.type = "Physical", e.length === 1 ? "Physical" in e[0] ? (this.width = e[0].Physical.width, this.height = e[0].Physical.height) : (this.width = e[0].width, this.height = e[0].height) : (this.width = e[0], this.height = e[1]);
|
|
266
294
|
}
|
|
@@ -276,16 +304,16 @@ class b {
|
|
|
276
304
|
* ```
|
|
277
305
|
*/
|
|
278
306
|
toLogical(e) {
|
|
279
|
-
return new
|
|
307
|
+
return new se(this.width / e, this.height / e);
|
|
280
308
|
}
|
|
281
|
-
[
|
|
309
|
+
[d]() {
|
|
282
310
|
return {
|
|
283
311
|
width: this.width,
|
|
284
312
|
height: this.height
|
|
285
313
|
};
|
|
286
314
|
}
|
|
287
315
|
toJSON() {
|
|
288
|
-
return this[
|
|
316
|
+
return this[d]();
|
|
289
317
|
}
|
|
290
318
|
}
|
|
291
319
|
class g {
|
|
@@ -293,12 +321,12 @@ class g {
|
|
|
293
321
|
this.size = e;
|
|
294
322
|
}
|
|
295
323
|
toLogical(e) {
|
|
296
|
-
return this.size instanceof
|
|
324
|
+
return this.size instanceof se ? this.size : this.size.toLogical(e);
|
|
297
325
|
}
|
|
298
326
|
toPhysical(e) {
|
|
299
|
-
return this.size instanceof
|
|
327
|
+
return this.size instanceof y ? this.size : this.size.toPhysical(e);
|
|
300
328
|
}
|
|
301
|
-
[
|
|
329
|
+
[d]() {
|
|
302
330
|
return {
|
|
303
331
|
[`${this.size.type}`]: {
|
|
304
332
|
width: this.size.width,
|
|
@@ -307,10 +335,10 @@ class g {
|
|
|
307
335
|
};
|
|
308
336
|
}
|
|
309
337
|
toJSON() {
|
|
310
|
-
return this[
|
|
338
|
+
return this[d]();
|
|
311
339
|
}
|
|
312
340
|
}
|
|
313
|
-
class
|
|
341
|
+
class ae {
|
|
314
342
|
constructor(...e) {
|
|
315
343
|
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]);
|
|
316
344
|
}
|
|
@@ -332,14 +360,14 @@ class ie {
|
|
|
332
360
|
toPhysical(e) {
|
|
333
361
|
return new c(this.x * e, this.y * e);
|
|
334
362
|
}
|
|
335
|
-
[
|
|
363
|
+
[d]() {
|
|
336
364
|
return {
|
|
337
365
|
x: this.x,
|
|
338
366
|
y: this.y
|
|
339
367
|
};
|
|
340
368
|
}
|
|
341
369
|
toJSON() {
|
|
342
|
-
return this[
|
|
370
|
+
return this[d]();
|
|
343
371
|
}
|
|
344
372
|
}
|
|
345
373
|
class c {
|
|
@@ -362,29 +390,29 @@ class c {
|
|
|
362
390
|
* @since 2.0.0
|
|
363
391
|
*/
|
|
364
392
|
toLogical(e) {
|
|
365
|
-
return new
|
|
393
|
+
return new ae(this.x / e, this.y / e);
|
|
366
394
|
}
|
|
367
|
-
[
|
|
395
|
+
[d]() {
|
|
368
396
|
return {
|
|
369
397
|
x: this.x,
|
|
370
398
|
y: this.y
|
|
371
399
|
};
|
|
372
400
|
}
|
|
373
401
|
toJSON() {
|
|
374
|
-
return this[
|
|
402
|
+
return this[d]();
|
|
375
403
|
}
|
|
376
404
|
}
|
|
377
|
-
class
|
|
405
|
+
class _ {
|
|
378
406
|
constructor(e) {
|
|
379
407
|
this.position = e;
|
|
380
408
|
}
|
|
381
409
|
toLogical(e) {
|
|
382
|
-
return this.position instanceof
|
|
410
|
+
return this.position instanceof ae ? this.position : this.position.toLogical(e);
|
|
383
411
|
}
|
|
384
412
|
toPhysical(e) {
|
|
385
413
|
return this.position instanceof c ? this.position : this.position.toPhysical(e);
|
|
386
414
|
}
|
|
387
|
-
[
|
|
415
|
+
[d]() {
|
|
388
416
|
return {
|
|
389
417
|
[`${this.position.type}`]: {
|
|
390
418
|
x: this.position.x,
|
|
@@ -393,47 +421,47 @@ class p {
|
|
|
393
421
|
};
|
|
394
422
|
}
|
|
395
423
|
toJSON() {
|
|
396
|
-
return this[
|
|
424
|
+
return this[d]();
|
|
397
425
|
}
|
|
398
426
|
}
|
|
399
427
|
var o;
|
|
400
428
|
(function(t) {
|
|
401
429
|
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";
|
|
402
430
|
})(o || (o = {}));
|
|
403
|
-
async function
|
|
431
|
+
async function re(t, e) {
|
|
404
432
|
window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(t, e), await s("plugin:event|unlisten", {
|
|
405
433
|
event: t,
|
|
406
434
|
eventId: e
|
|
407
435
|
});
|
|
408
436
|
}
|
|
409
|
-
async function
|
|
437
|
+
async function M(t, e, i) {
|
|
410
438
|
var n;
|
|
411
439
|
const a = typeof i?.target == "string" ? { kind: "AnyLabel", label: i.target } : (n = i?.target) !== null && n !== void 0 ? n : { kind: "Any" };
|
|
412
440
|
return s("plugin:event|listen", {
|
|
413
441
|
event: t,
|
|
414
442
|
target: a,
|
|
415
|
-
handler:
|
|
416
|
-
}).then((
|
|
443
|
+
handler: Me(e)
|
|
444
|
+
}).then((l) => async () => re(t, l));
|
|
417
445
|
}
|
|
418
|
-
async function
|
|
419
|
-
return
|
|
420
|
-
|
|
446
|
+
async function B(t, e, i) {
|
|
447
|
+
return M(t, (n) => {
|
|
448
|
+
re(t, n.id), e(n);
|
|
421
449
|
}, i);
|
|
422
450
|
}
|
|
423
|
-
async function
|
|
451
|
+
async function le(t, e) {
|
|
424
452
|
await s("plugin:event|emit", {
|
|
425
453
|
event: t,
|
|
426
454
|
payload: e
|
|
427
455
|
});
|
|
428
456
|
}
|
|
429
|
-
async function
|
|
457
|
+
async function oe(t, e, i) {
|
|
430
458
|
await s("plugin:event|emit_to", {
|
|
431
459
|
target: typeof t == "string" ? { kind: "AnyLabel", label: t } : t,
|
|
432
460
|
event: e,
|
|
433
461
|
payload: i
|
|
434
462
|
});
|
|
435
463
|
}
|
|
436
|
-
class
|
|
464
|
+
class N extends ke {
|
|
437
465
|
/**
|
|
438
466
|
* Creates an Image from a resource ID. For internal use only.
|
|
439
467
|
*
|
|
@@ -445,10 +473,10 @@ class W extends Ae {
|
|
|
445
473
|
/** Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height. */
|
|
446
474
|
static async new(e, i, n) {
|
|
447
475
|
return s("plugin:image|new", {
|
|
448
|
-
rgba:
|
|
476
|
+
rgba: x(e),
|
|
449
477
|
width: i,
|
|
450
478
|
height: n
|
|
451
|
-
}).then((a) => new
|
|
479
|
+
}).then((a) => new N(a));
|
|
452
480
|
}
|
|
453
481
|
/**
|
|
454
482
|
* Creates a new image using the provided bytes by inferring the file format.
|
|
@@ -465,8 +493,8 @@ class W extends Ae {
|
|
|
465
493
|
*/
|
|
466
494
|
static async fromBytes(e) {
|
|
467
495
|
return s("plugin:image|from_bytes", {
|
|
468
|
-
bytes:
|
|
469
|
-
}).then((i) => new
|
|
496
|
+
bytes: x(e)
|
|
497
|
+
}).then((i) => new N(i));
|
|
470
498
|
}
|
|
471
499
|
/**
|
|
472
500
|
* Creates a new image using the provided path.
|
|
@@ -481,7 +509,7 @@ class W extends Ae {
|
|
|
481
509
|
* ```
|
|
482
510
|
*/
|
|
483
511
|
static async fromPath(e) {
|
|
484
|
-
return s("plugin:image|from_path", { path: e }).then((i) => new
|
|
512
|
+
return s("plugin:image|from_path", { path: e }).then((i) => new N(i));
|
|
485
513
|
}
|
|
486
514
|
/** Returns the RGBA data for this image, in row-major order from top to bottom. */
|
|
487
515
|
async rgba() {
|
|
@@ -494,14 +522,14 @@ class W extends Ae {
|
|
|
494
522
|
return s("plugin:image|size", { rid: this.rid });
|
|
495
523
|
}
|
|
496
524
|
}
|
|
497
|
-
function
|
|
498
|
-
return t == null ? null : typeof t == "string" ? t : t instanceof
|
|
525
|
+
function x(t) {
|
|
526
|
+
return t == null ? null : typeof t == "string" ? t : t instanceof N ? t.rid : t;
|
|
499
527
|
}
|
|
500
|
-
var
|
|
528
|
+
var F;
|
|
501
529
|
(function(t) {
|
|
502
530
|
t[t.Critical = 1] = "Critical", t[t.Informational = 2] = "Informational";
|
|
503
|
-
})(
|
|
504
|
-
class
|
|
531
|
+
})(F || (F = {}));
|
|
532
|
+
class Ce {
|
|
505
533
|
constructor(e) {
|
|
506
534
|
this._preventDefault = !1, this.event = e.event, this.id = e.id;
|
|
507
535
|
}
|
|
@@ -512,24 +540,24 @@ class Oe {
|
|
|
512
540
|
return this._preventDefault;
|
|
513
541
|
}
|
|
514
542
|
}
|
|
515
|
-
var
|
|
543
|
+
var j;
|
|
516
544
|
(function(t) {
|
|
517
545
|
t.None = "none", t.Normal = "normal", t.Indeterminate = "indeterminate", t.Paused = "paused", t.Error = "error";
|
|
518
|
-
})(
|
|
519
|
-
function
|
|
520
|
-
return new
|
|
546
|
+
})(j || (j = {}));
|
|
547
|
+
function ue() {
|
|
548
|
+
return new k(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {
|
|
521
549
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
522
550
|
skip: !0
|
|
523
551
|
});
|
|
524
552
|
}
|
|
525
|
-
async function
|
|
526
|
-
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new
|
|
553
|
+
async function R() {
|
|
554
|
+
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new k(e, {
|
|
527
555
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
528
556
|
skip: !0
|
|
529
557
|
})));
|
|
530
558
|
}
|
|
531
|
-
const
|
|
532
|
-
class
|
|
559
|
+
const T = ["tauri://created", "tauri://error"];
|
|
560
|
+
class k {
|
|
533
561
|
/**
|
|
534
562
|
* Creates a new Window.
|
|
535
563
|
* @example
|
|
@@ -570,19 +598,19 @@ class P {
|
|
|
570
598
|
*/
|
|
571
599
|
static async getByLabel(e) {
|
|
572
600
|
var i;
|
|
573
|
-
return (i = (await
|
|
601
|
+
return (i = (await R()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
|
|
574
602
|
}
|
|
575
603
|
/**
|
|
576
604
|
* Get an instance of `Window` for the current window.
|
|
577
605
|
*/
|
|
578
606
|
static getCurrent() {
|
|
579
|
-
return
|
|
607
|
+
return ue();
|
|
580
608
|
}
|
|
581
609
|
/**
|
|
582
610
|
* Gets a list of instances of `Window` for all available windows.
|
|
583
611
|
*/
|
|
584
612
|
static async getAll() {
|
|
585
|
-
return
|
|
613
|
+
return R();
|
|
586
614
|
}
|
|
587
615
|
/**
|
|
588
616
|
* Gets the focused window.
|
|
@@ -595,7 +623,7 @@ class P {
|
|
|
595
623
|
* @returns The Window instance or `undefined` if there is not any focused window.
|
|
596
624
|
*/
|
|
597
625
|
static async getFocusedWindow() {
|
|
598
|
-
for (const e of await
|
|
626
|
+
for (const e of await R())
|
|
599
627
|
if (await e.isFocused())
|
|
600
628
|
return e;
|
|
601
629
|
return null;
|
|
@@ -623,7 +651,7 @@ class P {
|
|
|
623
651
|
return this._handleTauriEvent(e, i) ? () => {
|
|
624
652
|
const n = this.listeners[e];
|
|
625
653
|
n.splice(n.indexOf(i), 1);
|
|
626
|
-
} :
|
|
654
|
+
} : M(e, i, {
|
|
627
655
|
target: { kind: "Window", label: this.label }
|
|
628
656
|
});
|
|
629
657
|
}
|
|
@@ -650,7 +678,7 @@ class P {
|
|
|
650
678
|
return this._handleTauriEvent(e, i) ? () => {
|
|
651
679
|
const n = this.listeners[e];
|
|
652
680
|
n.splice(n.indexOf(i), 1);
|
|
653
|
-
} :
|
|
681
|
+
} : B(e, i, {
|
|
654
682
|
target: { kind: "Window", label: this.label }
|
|
655
683
|
});
|
|
656
684
|
}
|
|
@@ -666,7 +694,7 @@ class P {
|
|
|
666
694
|
* @param payload Event payload.
|
|
667
695
|
*/
|
|
668
696
|
async emit(e, i) {
|
|
669
|
-
if (
|
|
697
|
+
if (T.includes(e)) {
|
|
670
698
|
for (const n of this.listeners[e] || [])
|
|
671
699
|
n({
|
|
672
700
|
event: e,
|
|
@@ -675,7 +703,7 @@ class P {
|
|
|
675
703
|
});
|
|
676
704
|
return;
|
|
677
705
|
}
|
|
678
|
-
return
|
|
706
|
+
return le(e, i);
|
|
679
707
|
}
|
|
680
708
|
/**
|
|
681
709
|
* Emits an event to all {@link EventTarget|targets} matching the given target.
|
|
@@ -690,7 +718,7 @@ class P {
|
|
|
690
718
|
* @param payload Event payload.
|
|
691
719
|
*/
|
|
692
720
|
async emitTo(e, i, n) {
|
|
693
|
-
if (
|
|
721
|
+
if (T.includes(i)) {
|
|
694
722
|
for (const a of this.listeners[i] || [])
|
|
695
723
|
a({
|
|
696
724
|
event: i,
|
|
@@ -699,11 +727,11 @@ class P {
|
|
|
699
727
|
});
|
|
700
728
|
return;
|
|
701
729
|
}
|
|
702
|
-
return
|
|
730
|
+
return oe(e, i, n);
|
|
703
731
|
}
|
|
704
732
|
/** @ignore */
|
|
705
733
|
_handleTauriEvent(e, i) {
|
|
706
|
-
return
|
|
734
|
+
return T.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
|
|
707
735
|
}
|
|
708
736
|
// Getters
|
|
709
737
|
/**
|
|
@@ -765,7 +793,7 @@ class P {
|
|
|
765
793
|
async innerSize() {
|
|
766
794
|
return s("plugin:window|inner_size", {
|
|
767
795
|
label: this.label
|
|
768
|
-
}).then((e) => new
|
|
796
|
+
}).then((e) => new y(e));
|
|
769
797
|
}
|
|
770
798
|
/**
|
|
771
799
|
* The physical size of the entire window.
|
|
@@ -781,7 +809,7 @@ class P {
|
|
|
781
809
|
async outerSize() {
|
|
782
810
|
return s("plugin:window|outer_size", {
|
|
783
811
|
label: this.label
|
|
784
|
-
}).then((e) => new
|
|
812
|
+
}).then((e) => new y(e));
|
|
785
813
|
}
|
|
786
814
|
/**
|
|
787
815
|
* Gets the window's current fullscreen state.
|
|
@@ -1032,7 +1060,7 @@ class P {
|
|
|
1032
1060
|
*/
|
|
1033
1061
|
async requestUserAttention(e) {
|
|
1034
1062
|
let i = null;
|
|
1035
|
-
return e && (e ===
|
|
1063
|
+
return e && (e === F.Critical ? i = { type: "Critical" } : i = { type: "Informational" }), s("plugin:window|request_user_attention", {
|
|
1036
1064
|
label: this.label,
|
|
1037
1065
|
value: i
|
|
1038
1066
|
});
|
|
@@ -1508,7 +1536,7 @@ class P {
|
|
|
1508
1536
|
async setPosition(e) {
|
|
1509
1537
|
return s("plugin:window|set_position", {
|
|
1510
1538
|
label: this.label,
|
|
1511
|
-
value: e instanceof
|
|
1539
|
+
value: e instanceof _ ? e : new _(e)
|
|
1512
1540
|
});
|
|
1513
1541
|
}
|
|
1514
1542
|
/**
|
|
@@ -1602,7 +1630,7 @@ class P {
|
|
|
1602
1630
|
async setIcon(e) {
|
|
1603
1631
|
return s("plugin:window|set_icon", {
|
|
1604
1632
|
label: this.label,
|
|
1605
|
-
value:
|
|
1633
|
+
value: x(e)
|
|
1606
1634
|
});
|
|
1607
1635
|
}
|
|
1608
1636
|
/**
|
|
@@ -1720,7 +1748,7 @@ class P {
|
|
|
1720
1748
|
async setCursorPosition(e) {
|
|
1721
1749
|
return s("plugin:window|set_cursor_position", {
|
|
1722
1750
|
label: this.label,
|
|
1723
|
-
value: e instanceof
|
|
1751
|
+
value: e instanceof _ ? e : new _(e)
|
|
1724
1752
|
});
|
|
1725
1753
|
}
|
|
1726
1754
|
/**
|
|
@@ -1837,7 +1865,7 @@ class P {
|
|
|
1837
1865
|
async setOverlayIcon(e) {
|
|
1838
1866
|
return s("plugin:window|set_overlay_icon", {
|
|
1839
1867
|
label: this.label,
|
|
1840
|
-
value: e ?
|
|
1868
|
+
value: e ? x(e) : void 0
|
|
1841
1869
|
});
|
|
1842
1870
|
}
|
|
1843
1871
|
/**
|
|
@@ -1927,7 +1955,7 @@ class P {
|
|
|
1927
1955
|
*/
|
|
1928
1956
|
async onResized(e) {
|
|
1929
1957
|
return this.listen(o.WINDOW_RESIZED, (i) => {
|
|
1930
|
-
i.payload = new
|
|
1958
|
+
i.payload = new y(i.payload), e(i);
|
|
1931
1959
|
});
|
|
1932
1960
|
}
|
|
1933
1961
|
/**
|
|
@@ -1976,7 +2004,7 @@ class P {
|
|
|
1976
2004
|
*/
|
|
1977
2005
|
async onCloseRequested(e) {
|
|
1978
2006
|
return this.listen(o.WINDOW_CLOSE_REQUESTED, async (i) => {
|
|
1979
|
-
const n = new
|
|
2007
|
+
const n = new Ce(i);
|
|
1980
2008
|
await e(n), n.isPreventDefault() || await this.destroy();
|
|
1981
2009
|
});
|
|
1982
2010
|
}
|
|
@@ -2006,37 +2034,37 @@ class P {
|
|
|
2006
2034
|
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
|
2007
2035
|
*/
|
|
2008
2036
|
async onDragDropEvent(e) {
|
|
2009
|
-
const i = await this.listen(o.DRAG_ENTER, (
|
|
2037
|
+
const i = await this.listen(o.DRAG_ENTER, (r) => {
|
|
2010
2038
|
e({
|
|
2011
|
-
...
|
|
2039
|
+
...r,
|
|
2012
2040
|
payload: {
|
|
2013
2041
|
type: "enter",
|
|
2014
|
-
paths:
|
|
2015
|
-
position: new c(
|
|
2042
|
+
paths: r.payload.paths,
|
|
2043
|
+
position: new c(r.payload.position)
|
|
2016
2044
|
}
|
|
2017
2045
|
});
|
|
2018
|
-
}), n = await this.listen(o.DRAG_OVER, (
|
|
2046
|
+
}), n = await this.listen(o.DRAG_OVER, (r) => {
|
|
2019
2047
|
e({
|
|
2020
|
-
...
|
|
2048
|
+
...r,
|
|
2021
2049
|
payload: {
|
|
2022
2050
|
type: "over",
|
|
2023
|
-
position: new c(
|
|
2051
|
+
position: new c(r.payload.position)
|
|
2024
2052
|
}
|
|
2025
2053
|
});
|
|
2026
|
-
}), a = await this.listen(o.DRAG_DROP, (
|
|
2054
|
+
}), a = await this.listen(o.DRAG_DROP, (r) => {
|
|
2027
2055
|
e({
|
|
2028
|
-
...
|
|
2056
|
+
...r,
|
|
2029
2057
|
payload: {
|
|
2030
2058
|
type: "drop",
|
|
2031
|
-
paths:
|
|
2032
|
-
position: new c(
|
|
2059
|
+
paths: r.payload.paths,
|
|
2060
|
+
position: new c(r.payload.position)
|
|
2033
2061
|
}
|
|
2034
2062
|
});
|
|
2035
|
-
}),
|
|
2036
|
-
e({ ...
|
|
2063
|
+
}), l = await this.listen(o.DRAG_LEAVE, (r) => {
|
|
2064
|
+
e({ ...r, payload: { type: "leave" } });
|
|
2037
2065
|
});
|
|
2038
2066
|
return () => {
|
|
2039
|
-
i(), a(), n(),
|
|
2067
|
+
i(), a(), n(), l();
|
|
2040
2068
|
};
|
|
2041
2069
|
}
|
|
2042
2070
|
/**
|
|
@@ -2115,41 +2143,41 @@ var H;
|
|
|
2115
2143
|
(function(t) {
|
|
2116
2144
|
t.Disabled = "disabled", t.Throttle = "throttle", t.Suspend = "suspend";
|
|
2117
2145
|
})(H || (H = {}));
|
|
2118
|
-
var
|
|
2146
|
+
var V;
|
|
2119
2147
|
(function(t) {
|
|
2120
2148
|
t.Default = "default", t.FluentOverlay = "fluentOverlay";
|
|
2121
|
-
})(
|
|
2122
|
-
var
|
|
2149
|
+
})(V || (V = {}));
|
|
2150
|
+
var $;
|
|
2123
2151
|
(function(t) {
|
|
2124
2152
|
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";
|
|
2125
|
-
})(
|
|
2126
|
-
var
|
|
2153
|
+
})($ || ($ = {}));
|
|
2154
|
+
var J;
|
|
2127
2155
|
(function(t) {
|
|
2128
2156
|
t.FollowsWindowActiveState = "followsWindowActiveState", t.Active = "active", t.Inactive = "inactive";
|
|
2129
|
-
})(
|
|
2130
|
-
function
|
|
2157
|
+
})(J || (J = {}));
|
|
2158
|
+
function Le(t) {
|
|
2131
2159
|
return t === null ? null : {
|
|
2132
2160
|
name: t.name,
|
|
2133
2161
|
scaleFactor: t.scaleFactor,
|
|
2134
2162
|
position: new c(t.position),
|
|
2135
|
-
size: new
|
|
2163
|
+
size: new y(t.size),
|
|
2136
2164
|
workArea: {
|
|
2137
2165
|
position: new c(t.workArea.position),
|
|
2138
|
-
size: new
|
|
2166
|
+
size: new y(t.workArea.size)
|
|
2139
2167
|
}
|
|
2140
2168
|
};
|
|
2141
2169
|
}
|
|
2142
|
-
async function
|
|
2143
|
-
return s("plugin:window|primary_monitor").then(
|
|
2170
|
+
async function Ee() {
|
|
2171
|
+
return s("plugin:window|primary_monitor").then(Le);
|
|
2144
2172
|
}
|
|
2145
|
-
function
|
|
2146
|
-
return new
|
|
2173
|
+
function ce() {
|
|
2174
|
+
return new U(ue(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, {
|
|
2147
2175
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
2148
2176
|
skip: !0
|
|
2149
2177
|
});
|
|
2150
2178
|
}
|
|
2151
|
-
async function
|
|
2152
|
-
return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new
|
|
2179
|
+
async function Z() {
|
|
2180
|
+
return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new U(new k(e.windowLabel, {
|
|
2153
2181
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
2154
2182
|
skip: !0
|
|
2155
2183
|
}), e.label, {
|
|
@@ -2157,8 +2185,8 @@ async function $() {
|
|
|
2157
2185
|
skip: !0
|
|
2158
2186
|
})));
|
|
2159
2187
|
}
|
|
2160
|
-
const
|
|
2161
|
-
class
|
|
2188
|
+
const q = ["tauri://created", "tauri://error"];
|
|
2189
|
+
class U {
|
|
2162
2190
|
/**
|
|
2163
2191
|
* Creates a new Webview.
|
|
2164
2192
|
* @example
|
|
@@ -2213,19 +2241,19 @@ class T {
|
|
|
2213
2241
|
*/
|
|
2214
2242
|
static async getByLabel(e) {
|
|
2215
2243
|
var i;
|
|
2216
|
-
return (i = (await
|
|
2244
|
+
return (i = (await Z()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
|
|
2217
2245
|
}
|
|
2218
2246
|
/**
|
|
2219
2247
|
* Get an instance of `Webview` for the current webview.
|
|
2220
2248
|
*/
|
|
2221
2249
|
static getCurrent() {
|
|
2222
|
-
return
|
|
2250
|
+
return ce();
|
|
2223
2251
|
}
|
|
2224
2252
|
/**
|
|
2225
2253
|
* Gets a list of instances of `Webview` for all available webviews.
|
|
2226
2254
|
*/
|
|
2227
2255
|
static async getAll() {
|
|
2228
|
-
return
|
|
2256
|
+
return Z();
|
|
2229
2257
|
}
|
|
2230
2258
|
/**
|
|
2231
2259
|
* Listen to an emitted event on this webview.
|
|
@@ -2250,7 +2278,7 @@ class T {
|
|
|
2250
2278
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2251
2279
|
const n = this.listeners[e];
|
|
2252
2280
|
n.splice(n.indexOf(i), 1);
|
|
2253
|
-
} :
|
|
2281
|
+
} : M(e, i, {
|
|
2254
2282
|
target: { kind: "Webview", label: this.label }
|
|
2255
2283
|
});
|
|
2256
2284
|
}
|
|
@@ -2277,7 +2305,7 @@ class T {
|
|
|
2277
2305
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2278
2306
|
const n = this.listeners[e];
|
|
2279
2307
|
n.splice(n.indexOf(i), 1);
|
|
2280
|
-
} :
|
|
2308
|
+
} : B(e, i, {
|
|
2281
2309
|
target: { kind: "Webview", label: this.label }
|
|
2282
2310
|
});
|
|
2283
2311
|
}
|
|
@@ -2294,7 +2322,7 @@ class T {
|
|
|
2294
2322
|
* @param payload Event payload.
|
|
2295
2323
|
*/
|
|
2296
2324
|
async emit(e, i) {
|
|
2297
|
-
if (
|
|
2325
|
+
if (q.includes(e)) {
|
|
2298
2326
|
for (const n of this.listeners[e] || [])
|
|
2299
2327
|
n({
|
|
2300
2328
|
event: e,
|
|
@@ -2303,7 +2331,7 @@ class T {
|
|
|
2303
2331
|
});
|
|
2304
2332
|
return;
|
|
2305
2333
|
}
|
|
2306
|
-
return
|
|
2334
|
+
return le(e, i);
|
|
2307
2335
|
}
|
|
2308
2336
|
/**
|
|
2309
2337
|
* Emits an event to all {@link EventTarget|targets} matching the given target.
|
|
@@ -2319,7 +2347,7 @@ class T {
|
|
|
2319
2347
|
* @param payload Event payload.
|
|
2320
2348
|
*/
|
|
2321
2349
|
async emitTo(e, i, n) {
|
|
2322
|
-
if (
|
|
2350
|
+
if (q.includes(i)) {
|
|
2323
2351
|
for (const a of this.listeners[i] || [])
|
|
2324
2352
|
a({
|
|
2325
2353
|
event: i,
|
|
@@ -2328,11 +2356,11 @@ class T {
|
|
|
2328
2356
|
});
|
|
2329
2357
|
return;
|
|
2330
2358
|
}
|
|
2331
|
-
return
|
|
2359
|
+
return oe(e, i, n);
|
|
2332
2360
|
}
|
|
2333
2361
|
/** @ignore */
|
|
2334
2362
|
_handleTauriEvent(e, i) {
|
|
2335
|
-
return
|
|
2363
|
+
return q.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
|
|
2336
2364
|
}
|
|
2337
2365
|
// Getters
|
|
2338
2366
|
/**
|
|
@@ -2364,7 +2392,7 @@ class T {
|
|
|
2364
2392
|
async size() {
|
|
2365
2393
|
return s("plugin:webview|webview_size", {
|
|
2366
2394
|
label: this.label
|
|
2367
|
-
}).then((e) => new
|
|
2395
|
+
}).then((e) => new y(e));
|
|
2368
2396
|
}
|
|
2369
2397
|
// Setters
|
|
2370
2398
|
/**
|
|
@@ -2413,7 +2441,7 @@ class T {
|
|
|
2413
2441
|
async setPosition(e) {
|
|
2414
2442
|
return s("plugin:webview|set_webview_position", {
|
|
2415
2443
|
label: this.label,
|
|
2416
|
-
value: e instanceof
|
|
2444
|
+
value: e instanceof _ ? e : new _(e)
|
|
2417
2445
|
});
|
|
2418
2446
|
}
|
|
2419
2447
|
/**
|
|
@@ -2569,51 +2597,51 @@ class T {
|
|
|
2569
2597
|
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
|
2570
2598
|
*/
|
|
2571
2599
|
async onDragDropEvent(e) {
|
|
2572
|
-
const i = await this.listen(o.DRAG_ENTER, (
|
|
2600
|
+
const i = await this.listen(o.DRAG_ENTER, (r) => {
|
|
2573
2601
|
e({
|
|
2574
|
-
...
|
|
2602
|
+
...r,
|
|
2575
2603
|
payload: {
|
|
2576
2604
|
type: "enter",
|
|
2577
|
-
paths:
|
|
2578
|
-
position: new c(
|
|
2605
|
+
paths: r.payload.paths,
|
|
2606
|
+
position: new c(r.payload.position)
|
|
2579
2607
|
}
|
|
2580
2608
|
});
|
|
2581
|
-
}), n = await this.listen(o.DRAG_OVER, (
|
|
2609
|
+
}), n = await this.listen(o.DRAG_OVER, (r) => {
|
|
2582
2610
|
e({
|
|
2583
|
-
...
|
|
2611
|
+
...r,
|
|
2584
2612
|
payload: {
|
|
2585
2613
|
type: "over",
|
|
2586
|
-
position: new c(
|
|
2614
|
+
position: new c(r.payload.position)
|
|
2587
2615
|
}
|
|
2588
2616
|
});
|
|
2589
|
-
}), a = await this.listen(o.DRAG_DROP, (
|
|
2617
|
+
}), a = await this.listen(o.DRAG_DROP, (r) => {
|
|
2590
2618
|
e({
|
|
2591
|
-
...
|
|
2619
|
+
...r,
|
|
2592
2620
|
payload: {
|
|
2593
2621
|
type: "drop",
|
|
2594
|
-
paths:
|
|
2595
|
-
position: new c(
|
|
2622
|
+
paths: r.payload.paths,
|
|
2623
|
+
position: new c(r.payload.position)
|
|
2596
2624
|
}
|
|
2597
2625
|
});
|
|
2598
|
-
}),
|
|
2599
|
-
e({ ...
|
|
2626
|
+
}), l = await this.listen(o.DRAG_LEAVE, (r) => {
|
|
2627
|
+
e({ ...r, payload: { type: "leave" } });
|
|
2600
2628
|
});
|
|
2601
2629
|
return () => {
|
|
2602
|
-
i(), a(), n(),
|
|
2630
|
+
i(), a(), n(), l();
|
|
2603
2631
|
};
|
|
2604
2632
|
}
|
|
2605
2633
|
}
|
|
2606
|
-
function
|
|
2607
|
-
const t =
|
|
2608
|
-
return new
|
|
2634
|
+
function P() {
|
|
2635
|
+
const t = ce();
|
|
2636
|
+
return new f(t.label, { skip: !0 });
|
|
2609
2637
|
}
|
|
2610
|
-
async function
|
|
2611
|
-
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new
|
|
2638
|
+
async function Y() {
|
|
2639
|
+
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new f(e, {
|
|
2612
2640
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
2613
2641
|
skip: !0
|
|
2614
2642
|
})));
|
|
2615
2643
|
}
|
|
2616
|
-
class
|
|
2644
|
+
class f {
|
|
2617
2645
|
/**
|
|
2618
2646
|
* Creates a new {@link Window} hosting a {@link Webview}.
|
|
2619
2647
|
* @example
|
|
@@ -2656,20 +2684,20 @@ class _ {
|
|
|
2656
2684
|
*/
|
|
2657
2685
|
static async getByLabel(e) {
|
|
2658
2686
|
var i;
|
|
2659
|
-
const n = (i = (await
|
|
2660
|
-
return n ? new
|
|
2687
|
+
const n = (i = (await Y()).find((a) => a.label === e)) !== null && i !== void 0 ? i : null;
|
|
2688
|
+
return n ? new f(n.label, { skip: !0 }) : null;
|
|
2661
2689
|
}
|
|
2662
2690
|
/**
|
|
2663
2691
|
* Get an instance of `Webview` for the current webview.
|
|
2664
2692
|
*/
|
|
2665
2693
|
static getCurrent() {
|
|
2666
|
-
return
|
|
2694
|
+
return P();
|
|
2667
2695
|
}
|
|
2668
2696
|
/**
|
|
2669
2697
|
* Gets a list of instances of `Webview` for all available webviews.
|
|
2670
2698
|
*/
|
|
2671
2699
|
static async getAll() {
|
|
2672
|
-
return
|
|
2700
|
+
return Y();
|
|
2673
2701
|
}
|
|
2674
2702
|
/**
|
|
2675
2703
|
* Listen to an emitted event on this webivew window.
|
|
@@ -2694,7 +2722,7 @@ class _ {
|
|
|
2694
2722
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2695
2723
|
const n = this.listeners[e];
|
|
2696
2724
|
n.splice(n.indexOf(i), 1);
|
|
2697
|
-
} :
|
|
2725
|
+
} : M(e, i, {
|
|
2698
2726
|
target: { kind: "WebviewWindow", label: this.label }
|
|
2699
2727
|
});
|
|
2700
2728
|
}
|
|
@@ -2721,7 +2749,7 @@ class _ {
|
|
|
2721
2749
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2722
2750
|
const n = this.listeners[e];
|
|
2723
2751
|
n.splice(n.indexOf(i), 1);
|
|
2724
|
-
} :
|
|
2752
|
+
} : B(e, i, {
|
|
2725
2753
|
target: { kind: "WebviewWindow", label: this.label }
|
|
2726
2754
|
});
|
|
2727
2755
|
}
|
|
@@ -2745,8 +2773,8 @@ class _ {
|
|
|
2745
2773
|
return s("plugin:window|set_background_color", { color: e }).then(() => s("plugin:webview|set_webview_background_color", { color: e }));
|
|
2746
2774
|
}
|
|
2747
2775
|
}
|
|
2748
|
-
|
|
2749
|
-
function
|
|
2776
|
+
Re(f, [k, U]);
|
|
2777
|
+
function Re(t, e) {
|
|
2750
2778
|
(Array.isArray(e) ? e : [e]).forEach((i) => {
|
|
2751
2779
|
Object.getOwnPropertyNames(i.prototype).forEach((n) => {
|
|
2752
2780
|
var a;
|
|
@@ -2759,14 +2787,21 @@ function ke(t, e) {
|
|
|
2759
2787
|
});
|
|
2760
2788
|
});
|
|
2761
2789
|
}
|
|
2762
|
-
const
|
|
2790
|
+
const z = /* @__PURE__ */ new Map(), Te = (t) => {
|
|
2791
|
+
if (!t || t.trim() === "") return !1;
|
|
2792
|
+
try {
|
|
2793
|
+
return !!(t.startsWith("/") || t.startsWith("http://") || t.startsWith("https://") || t.startsWith("tauri://"));
|
|
2794
|
+
} catch {
|
|
2795
|
+
return !1;
|
|
2796
|
+
}
|
|
2797
|
+
}, qe = async (t, e, i) => {
|
|
2763
2798
|
const n = i?.padding ?? 20;
|
|
2764
2799
|
if (i?.x !== void 0 && i?.y !== void 0)
|
|
2765
2800
|
return { x: i.x, y: i.y };
|
|
2766
|
-
let a = 1920,
|
|
2801
|
+
let a = 1920, l = 1080;
|
|
2767
2802
|
try {
|
|
2768
|
-
const u = await
|
|
2769
|
-
u?.size && (a = u.size.width,
|
|
2803
|
+
const u = await Ee();
|
|
2804
|
+
u?.size && (a = u.size.width, l = u.size.height);
|
|
2770
2805
|
} catch (u) {
|
|
2771
2806
|
console.warn("Failed to get monitor info, using defaults:", u);
|
|
2772
2807
|
}
|
|
@@ -2774,7 +2809,7 @@ const S = /* @__PURE__ */ new Map(), Me = async (t, e, i) => {
|
|
|
2774
2809
|
case "right-bottom":
|
|
2775
2810
|
return {
|
|
2776
2811
|
x: a - t - n,
|
|
2777
|
-
y:
|
|
2812
|
+
y: l - e - n
|
|
2778
2813
|
};
|
|
2779
2814
|
case "right-top":
|
|
2780
2815
|
return {
|
|
@@ -2784,7 +2819,7 @@ const S = /* @__PURE__ */ new Map(), Me = async (t, e, i) => {
|
|
|
2784
2819
|
case "left-bottom":
|
|
2785
2820
|
return {
|
|
2786
2821
|
x: n,
|
|
2787
|
-
y:
|
|
2822
|
+
y: l - e - n
|
|
2788
2823
|
};
|
|
2789
2824
|
case "left-top":
|
|
2790
2825
|
return {
|
|
@@ -2794,157 +2829,192 @@ const S = /* @__PURE__ */ new Map(), Me = async (t, e, i) => {
|
|
|
2794
2829
|
case "center":
|
|
2795
2830
|
return {
|
|
2796
2831
|
x: (a - t) / 2,
|
|
2797
|
-
y: (
|
|
2832
|
+
y: (l - e) / 2
|
|
2798
2833
|
};
|
|
2799
2834
|
default:
|
|
2800
2835
|
return {
|
|
2801
2836
|
x: a - t - n,
|
|
2802
|
-
y:
|
|
2837
|
+
y: l - e - n
|
|
2803
2838
|
};
|
|
2804
2839
|
}
|
|
2805
|
-
},
|
|
2806
|
-
const e = String(t.id), i =
|
|
2840
|
+
}, we = async (t) => {
|
|
2841
|
+
const e = String(t.id), i = w.getState();
|
|
2807
2842
|
if (i.isWindowActive(e)) {
|
|
2808
2843
|
console.log(`Notice window already open for message: ${e}`);
|
|
2809
2844
|
return;
|
|
2810
2845
|
}
|
|
2811
|
-
const n =
|
|
2846
|
+
const n = ee(), a = `notice-${e}`;
|
|
2847
|
+
let l = `${n.routePrefix}/${t.type}?id=${t.id}`;
|
|
2848
|
+
Te(l) || (console.warn(`Invalid window URL: ${l}. Using fallback 404 page.`), l = n.notFoundUrl || "/404");
|
|
2849
|
+
const r = t.min_width || n.defaultWidth, u = t.min_height || n.defaultHeight, { x: m, y: v } = await qe(r, u, t.windowPosition);
|
|
2812
2850
|
try {
|
|
2813
|
-
const
|
|
2814
|
-
url:
|
|
2851
|
+
const b = new f(a, {
|
|
2852
|
+
url: l,
|
|
2815
2853
|
title: t.title,
|
|
2816
|
-
width:
|
|
2854
|
+
width: r,
|
|
2817
2855
|
height: u,
|
|
2818
|
-
x:
|
|
2819
|
-
y:
|
|
2856
|
+
x: m,
|
|
2857
|
+
y: v,
|
|
2820
2858
|
resizable: !0,
|
|
2821
2859
|
decorations: !0,
|
|
2822
2860
|
skipTaskbar: !1,
|
|
2823
2861
|
alwaysOnTop: !0
|
|
2824
2862
|
});
|
|
2825
|
-
|
|
2826
|
-
|
|
2863
|
+
z.set(e, b), i.addActiveWindow(e), b.once("tauri://destroyed", async () => {
|
|
2864
|
+
z.delete(e), i.removeActiveWindow(e), await ie(e), i.clearCurrent();
|
|
2827
2865
|
}), console.log(`Created notice window: ${a}`);
|
|
2828
|
-
} catch (
|
|
2829
|
-
console.error("Failed to create notice window:",
|
|
2866
|
+
} catch (b) {
|
|
2867
|
+
console.error("Failed to create notice window:", b), i.removeActiveWindow(e), i.clearCurrent();
|
|
2830
2868
|
}
|
|
2831
|
-
},
|
|
2832
|
-
const e = String(t), i =
|
|
2869
|
+
}, C = async (t) => {
|
|
2870
|
+
const e = String(t), i = z.get(e), n = w.getState();
|
|
2833
2871
|
if (i)
|
|
2834
2872
|
try {
|
|
2835
|
-
await i.close(),
|
|
2873
|
+
await i.close(), z.delete(e), n.removeActiveWindow(e), await ie(e), n.clearCurrent(), console.log(`Closed notice window: ${e}`);
|
|
2836
2874
|
} catch (a) {
|
|
2837
2875
|
console.error("Failed to close notice window:", a);
|
|
2838
2876
|
}
|
|
2839
|
-
},
|
|
2840
|
-
const t = Array.from(
|
|
2841
|
-
(e) =>
|
|
2877
|
+
}, de = async () => {
|
|
2878
|
+
const t = Array.from(z.keys()).map(
|
|
2879
|
+
(e) => C(e)
|
|
2842
2880
|
);
|
|
2843
2881
|
await Promise.all(t);
|
|
2844
|
-
},
|
|
2882
|
+
}, he = () => {
|
|
2845
2883
|
let t = null;
|
|
2846
|
-
|
|
2884
|
+
w.subscribe((e) => {
|
|
2847
2885
|
const i = e.currentMessage;
|
|
2848
|
-
i && i !== t ? (t = i,
|
|
2886
|
+
i && i !== t ? (t = i, we(i)) : i || (t = null);
|
|
2849
2887
|
}), console.log("Notice window system initialized");
|
|
2850
|
-
},
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2888
|
+
}, Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2889
|
+
__proto__: null,
|
|
2890
|
+
closeAllNoticeWindows: de,
|
|
2891
|
+
closeNoticeWindow: C,
|
|
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);
|
|
2854
2898
|
}, [t]) };
|
|
2855
|
-
},
|
|
2856
|
-
const t =
|
|
2857
|
-
return { hideNotice:
|
|
2899
|
+
}, Ze = () => {
|
|
2900
|
+
const t = w();
|
|
2901
|
+
return { hideNotice: I(
|
|
2858
2902
|
async (i) => {
|
|
2859
|
-
await
|
|
2903
|
+
await Ne(i), await C(i), t.currentMessage?.id === i && t.clearCurrent();
|
|
2860
2904
|
},
|
|
2861
2905
|
[t]
|
|
2862
2906
|
) };
|
|
2863
|
-
},
|
|
2864
|
-
const t =
|
|
2865
|
-
return { hideAllNotices:
|
|
2866
|
-
await
|
|
2907
|
+
}, Ye = () => {
|
|
2908
|
+
const t = w((i) => i.clearOnLogout);
|
|
2909
|
+
return { hideAllNotices: I(async () => {
|
|
2910
|
+
await de(), await t();
|
|
2867
2911
|
}, [t]) };
|
|
2868
|
-
},
|
|
2869
|
-
const t =
|
|
2912
|
+
}, Ke = () => {
|
|
2913
|
+
const t = w(S.queueLength), e = w(S.currentMessage), i = w(S.isProcessing), n = w(S.queue);
|
|
2870
2914
|
return {
|
|
2871
2915
|
queueLength: t,
|
|
2872
2916
|
currentMessage: e,
|
|
2873
2917
|
isProcessing: i,
|
|
2874
2918
|
queue: n
|
|
2875
2919
|
};
|
|
2876
|
-
},
|
|
2877
|
-
const [n, a] =
|
|
2878
|
-
return
|
|
2920
|
+
}, Xe = ({ children: t, onLoad: e, onClose: i }) => {
|
|
2921
|
+
const [n, a] = E(null), [l, r] = E(!0), [u, m] = E(null);
|
|
2922
|
+
return G(() => {
|
|
2879
2923
|
(async () => {
|
|
2880
2924
|
try {
|
|
2881
|
-
const
|
|
2882
|
-
if (!
|
|
2883
|
-
|
|
2925
|
+
const p = new URLSearchParams(window.location.search).get("id");
|
|
2926
|
+
if (!p) {
|
|
2927
|
+
m("No message ID provided"), r(!1), setTimeout(async () => {
|
|
2928
|
+
try {
|
|
2929
|
+
await P().close();
|
|
2930
|
+
} catch (W) {
|
|
2931
|
+
console.error("Failed to close window:", W);
|
|
2932
|
+
}
|
|
2933
|
+
}, 1e3);
|
|
2884
2934
|
return;
|
|
2885
2935
|
}
|
|
2886
|
-
const
|
|
2887
|
-
if (!
|
|
2888
|
-
|
|
2936
|
+
const L = await ne(p);
|
|
2937
|
+
if (!L) {
|
|
2938
|
+
console.log(`Message ${p} not found in database, closing window`), m("Message not found"), r(!1), setTimeout(async () => {
|
|
2939
|
+
try {
|
|
2940
|
+
await P().close();
|
|
2941
|
+
} catch (W) {
|
|
2942
|
+
console.error("Failed to close window:", W);
|
|
2943
|
+
}
|
|
2944
|
+
}, 500);
|
|
2889
2945
|
return;
|
|
2890
2946
|
}
|
|
2891
|
-
a(
|
|
2892
|
-
} catch (
|
|
2893
|
-
console.error("Failed to load message:",
|
|
2947
|
+
a(L), r(!1), e && e(L);
|
|
2948
|
+
} catch (b) {
|
|
2949
|
+
console.error("Failed to load message:", b), m("Failed to load message"), r(!1), setTimeout(async () => {
|
|
2950
|
+
try {
|
|
2951
|
+
await P().close();
|
|
2952
|
+
} catch (p) {
|
|
2953
|
+
console.error("Failed to close window:", p);
|
|
2954
|
+
}
|
|
2955
|
+
}, 1e3);
|
|
2894
2956
|
}
|
|
2895
2957
|
})();
|
|
2896
|
-
}, [e]),
|
|
2958
|
+
}, [e]), G(() => {
|
|
2897
2959
|
if (!n || !i) return;
|
|
2898
|
-
const
|
|
2960
|
+
const v = () => {
|
|
2899
2961
|
i(n);
|
|
2900
2962
|
};
|
|
2901
|
-
return window.addEventListener("beforeunload",
|
|
2902
|
-
window.removeEventListener("beforeunload",
|
|
2963
|
+
return window.addEventListener("beforeunload", v), () => {
|
|
2964
|
+
window.removeEventListener("beforeunload", v);
|
|
2903
2965
|
};
|
|
2904
|
-
}, [n, i]),
|
|
2966
|
+
}, [n, i]), l ? /* @__PURE__ */ A("div", { style: {
|
|
2905
2967
|
display: "flex",
|
|
2906
2968
|
justifyContent: "center",
|
|
2907
2969
|
alignItems: "center",
|
|
2908
2970
|
height: "100vh",
|
|
2909
2971
|
fontFamily: "system-ui, -apple-system, sans-serif"
|
|
2910
|
-
}, children: "Loading..." }) : u
|
|
2972
|
+
}, children: "Loading..." }) : u ? /* @__PURE__ */ A("div", { style: {
|
|
2973
|
+
display: "flex",
|
|
2974
|
+
justifyContent: "center",
|
|
2975
|
+
alignItems: "center",
|
|
2976
|
+
height: "100vh",
|
|
2977
|
+
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
2978
|
+
color: "#ef4444"
|
|
2979
|
+
}, children: u }) : n ? /* @__PURE__ */ A(pe, { children: t(n) }) : /* @__PURE__ */ A("div", { style: {
|
|
2911
2980
|
display: "flex",
|
|
2912
2981
|
justifyContent: "center",
|
|
2913
2982
|
alignItems: "center",
|
|
2914
2983
|
height: "100vh",
|
|
2915
2984
|
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
2916
2985
|
color: "#ef4444"
|
|
2917
|
-
}, children:
|
|
2918
|
-
},
|
|
2919
|
-
|
|
2920
|
-
const { initializeFromDatabase: t } =
|
|
2986
|
+
}, children: "Closing window..." });
|
|
2987
|
+
}, et = async () => {
|
|
2988
|
+
te(), he();
|
|
2989
|
+
const { initializeFromDatabase: t } = w.getState();
|
|
2921
2990
|
await t(), console.log("Tauri Notice System initialized");
|
|
2922
2991
|
};
|
|
2923
2992
|
export {
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2993
|
+
Xe as NoticeLayout,
|
|
2994
|
+
ze as clearPendingMessages,
|
|
2995
|
+
de as closeAllNoticeWindows,
|
|
2996
|
+
C as closeNoticeWindow,
|
|
2997
|
+
we as createNoticeWindow,
|
|
2998
|
+
Ve as deleteMessageById,
|
|
2999
|
+
ne as getMessage,
|
|
3000
|
+
ee as getNoticeConfig,
|
|
3001
|
+
Se as getPendingMessages,
|
|
3002
|
+
ve as hasMessage,
|
|
3003
|
+
te as initializeDatabase,
|
|
3004
|
+
et as initializeNoticeSystem,
|
|
3005
|
+
he as initializeNoticeWindowSystem,
|
|
3006
|
+
We as isMessageShown,
|
|
3007
|
+
Ne as markAsHidden,
|
|
3008
|
+
ie as markAsShown,
|
|
3009
|
+
S as messageQueueSelectors,
|
|
3010
|
+
me as saveMessage,
|
|
3011
|
+
He as setNoticeConfig,
|
|
3012
|
+
De as updateQueueStatus,
|
|
3013
|
+
Je as useCloseNotice,
|
|
3014
|
+
Ye as useHideAllNotices,
|
|
3015
|
+
Ze as useHideNotice,
|
|
3016
|
+
Ke as useMessageQueue,
|
|
3017
|
+
w as useMessageQueueStore,
|
|
3018
|
+
$e as useNoticeWindow
|
|
2949
3019
|
};
|
|
2950
3020
|
//# sourceMappingURL=index.js.map
|