tauri-notice-window 1.0.13 → 1.0.15
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 +18 -0
- 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.js +309 -295
- package/dist/index.js.map +1 -1
- package/dist/types/message.d.ts +6 -0
- package/dist/types/message.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,37 +1,39 @@
|
|
|
1
|
-
import { create as
|
|
2
|
-
import { syncTabs as
|
|
3
|
-
import
|
|
4
|
-
import { useCallback as P, useState as L, useEffect as
|
|
5
|
-
import { jsx as
|
|
6
|
-
const
|
|
1
|
+
import { create as we } from "zustand";
|
|
2
|
+
import { syncTabs as he } from "zustand-sync";
|
|
3
|
+
import ge from "dexie";
|
|
4
|
+
import { useCallback as P, useState as L, useEffect as H } from "react";
|
|
5
|
+
import { jsx as z, Fragment as ye } from "react/jsx-runtime";
|
|
6
|
+
const ee = "tauri-notice-config", $ = {
|
|
7
7
|
routePrefix: "/notice",
|
|
8
8
|
databaseName: "tauri-notice-db",
|
|
9
9
|
defaultWidth: 400,
|
|
10
10
|
defaultHeight: 300,
|
|
11
11
|
notFoundUrl: "/404",
|
|
12
12
|
// Default 404 page
|
|
13
|
-
defaultDecorations: !0
|
|
13
|
+
defaultDecorations: !0,
|
|
14
14
|
// Show title bar by default
|
|
15
|
-
|
|
15
|
+
loadTimeout: 4e3
|
|
16
|
+
// Auto-close after 4s if stuck (only when decorations=false)
|
|
17
|
+
}, te = () => {
|
|
16
18
|
try {
|
|
17
|
-
const t = localStorage.getItem(
|
|
19
|
+
const t = localStorage.getItem(ee);
|
|
18
20
|
if (t)
|
|
19
|
-
return {
|
|
21
|
+
return { ...$, ...JSON.parse(t) };
|
|
20
22
|
} catch (t) {
|
|
21
23
|
console.warn("Failed to load config from localStorage:", t);
|
|
22
24
|
}
|
|
23
|
-
return
|
|
24
|
-
},
|
|
25
|
+
return $;
|
|
26
|
+
}, be = (t) => {
|
|
25
27
|
try {
|
|
26
|
-
localStorage.setItem(
|
|
28
|
+
localStorage.setItem(ee, JSON.stringify(t));
|
|
27
29
|
} catch (e) {
|
|
28
30
|
console.warn("Failed to save config to localStorage:", e);
|
|
29
31
|
}
|
|
30
|
-
},
|
|
31
|
-
const i = { ...
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
class
|
|
32
|
+
}, Je = (t) => {
|
|
33
|
+
const i = { ...te(), ...t };
|
|
34
|
+
be(i);
|
|
35
|
+
}, ie = () => te();
|
|
36
|
+
class pe extends ge {
|
|
35
37
|
messages;
|
|
36
38
|
constructor(e) {
|
|
37
39
|
super(e), this.version(1).stores({
|
|
@@ -39,14 +41,14 @@ class ye extends de {
|
|
|
39
41
|
});
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
|
-
let
|
|
43
|
-
const
|
|
44
|
-
if (!
|
|
45
|
-
const t =
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
return
|
|
49
|
-
},
|
|
44
|
+
let S = null;
|
|
45
|
+
const ne = () => {
|
|
46
|
+
if (!S) {
|
|
47
|
+
const t = ie();
|
|
48
|
+
S = new pe(t.databaseName);
|
|
49
|
+
}
|
|
50
|
+
return S;
|
|
51
|
+
}, y = () => S || ne(), _e = async (t) => {
|
|
50
52
|
const e = {
|
|
51
53
|
...t,
|
|
52
54
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -55,31 +57,31 @@ const te = () => {
|
|
|
55
57
|
queueStatus: "pending",
|
|
56
58
|
queuePosition: 0
|
|
57
59
|
};
|
|
58
|
-
await
|
|
59
|
-
},
|
|
60
|
-
const e = await
|
|
60
|
+
await y().messages.put(e);
|
|
61
|
+
}, fe = async (t) => !!await y().messages.get(t), me = async (t) => {
|
|
62
|
+
const e = await y().messages.get(t);
|
|
61
63
|
return e?.isShown === !0 || e?.queueStatus === "shown";
|
|
62
|
-
},
|
|
63
|
-
await
|
|
64
|
-
},
|
|
65
|
-
await
|
|
64
|
+
}, ve = async () => await y().messages.where("queueStatus").equals("pending").sortBy("queuePosition"), We = async (t, e) => {
|
|
65
|
+
await y().messages.update(t, { queueStatus: e });
|
|
66
|
+
}, Se = async (t) => {
|
|
67
|
+
await y().messages.update(t, {
|
|
66
68
|
queueStatus: "shown",
|
|
67
69
|
isShown: !0
|
|
68
70
|
});
|
|
69
|
-
},
|
|
70
|
-
await
|
|
71
|
+
}, De = async (t) => {
|
|
72
|
+
await y().messages.update(t, {
|
|
71
73
|
queueStatus: "hidden"
|
|
72
74
|
});
|
|
73
|
-
},
|
|
74
|
-
await
|
|
75
|
-
},
|
|
76
|
-
await
|
|
77
|
-
},
|
|
75
|
+
}, se = async (t) => await y().messages.get(t), Ae = async (t) => {
|
|
76
|
+
await y().messages.delete(t);
|
|
77
|
+
}, Ne = async () => {
|
|
78
|
+
await y().messages.where("queueStatus").anyOf(["pending", "showing"]).delete();
|
|
79
|
+
}, ze = async (t) => {
|
|
78
80
|
const e = t.map(
|
|
79
|
-
(i) =>
|
|
81
|
+
(i) => y().messages.update(i.id, { queuePosition: i.position })
|
|
80
82
|
);
|
|
81
83
|
await Promise.all(e);
|
|
82
|
-
},
|
|
84
|
+
}, Me = (t, e) => ({
|
|
83
85
|
// Initial state
|
|
84
86
|
queue: [],
|
|
85
87
|
currentMessage: null,
|
|
@@ -89,13 +91,13 @@ const te = () => {
|
|
|
89
91
|
// Enqueue a new message
|
|
90
92
|
enqueue: async (i) => {
|
|
91
93
|
const n = e();
|
|
92
|
-
if (await
|
|
94
|
+
if (await me(i.id)) {
|
|
93
95
|
console.log(`Message ${i.id} was already shown, skipping`);
|
|
94
96
|
return;
|
|
95
97
|
}
|
|
96
|
-
if (await
|
|
97
|
-
const
|
|
98
|
-
t({ queue:
|
|
98
|
+
if (await fe(i.id) || await _e(i), !n.queue.some((d) => d.id === i.id)) {
|
|
99
|
+
const d = [...n.queue, i];
|
|
100
|
+
t({ queue: d }), await e().persistQueue();
|
|
99
101
|
}
|
|
100
102
|
!n.isProcessing && !n.currentMessage && await e().showNext();
|
|
101
103
|
},
|
|
@@ -114,14 +116,14 @@ const te = () => {
|
|
|
114
116
|
t({ isProcessing: !1, currentMessage: null });
|
|
115
117
|
return;
|
|
116
118
|
}
|
|
117
|
-
if (!await
|
|
119
|
+
if (!await se(n.id)) {
|
|
118
120
|
console.log(`Message ${n.id} was deleted, skipping to next`), await e().showNext();
|
|
119
121
|
return;
|
|
120
122
|
}
|
|
121
123
|
t({
|
|
122
124
|
currentMessage: n,
|
|
123
125
|
isProcessing: !0
|
|
124
|
-
}), await
|
|
126
|
+
}), await We(n.id, "showing"), await e().persistQueue();
|
|
125
127
|
},
|
|
126
128
|
// Clear current message and show next
|
|
127
129
|
clearCurrent: () => {
|
|
@@ -146,7 +148,7 @@ const te = () => {
|
|
|
146
148
|
initializeFromDatabase: async () => {
|
|
147
149
|
if (e().initialized) return;
|
|
148
150
|
t({ initialized: !0 });
|
|
149
|
-
const n = await
|
|
151
|
+
const n = await ve();
|
|
150
152
|
n.length > 0 && (t({ queue: n }), await e().showNext());
|
|
151
153
|
},
|
|
152
154
|
// Persist queue to database
|
|
@@ -155,7 +157,7 @@ const te = () => {
|
|
|
155
157
|
id: a.id,
|
|
156
158
|
position: l
|
|
157
159
|
}));
|
|
158
|
-
await
|
|
160
|
+
await ze(n);
|
|
159
161
|
},
|
|
160
162
|
// Clear all messages on logout
|
|
161
163
|
clearOnLogout: async () => {
|
|
@@ -165,7 +167,7 @@ const te = () => {
|
|
|
165
167
|
isProcessing: !1,
|
|
166
168
|
activeWindowIds: [],
|
|
167
169
|
initialized: !1
|
|
168
|
-
}), await
|
|
170
|
+
}), await Ne();
|
|
169
171
|
},
|
|
170
172
|
// Remove a specific message from the queue by ID (memory only)
|
|
171
173
|
removeFromQueue: async (i) => {
|
|
@@ -174,15 +176,15 @@ const te = () => {
|
|
|
174
176
|
},
|
|
175
177
|
// Delete message completely (from both memory and database)
|
|
176
178
|
deleteMessage: async (i) => {
|
|
177
|
-
await
|
|
179
|
+
await Ae(i), await e().removeFromQueue(i);
|
|
178
180
|
},
|
|
179
181
|
// Hide a message (mark as hidden and remove from queue)
|
|
180
182
|
hideMessage: async (i) => {
|
|
181
|
-
await
|
|
183
|
+
await De(i), await e().removeFromQueue(i);
|
|
182
184
|
},
|
|
183
185
|
// Mark message as shown in database
|
|
184
186
|
markMessageAsShown: async (i) => {
|
|
185
|
-
await
|
|
187
|
+
await Se(i);
|
|
186
188
|
},
|
|
187
189
|
// Add active window ID
|
|
188
190
|
addActiveWindow: (i) => {
|
|
@@ -201,17 +203,17 @@ const te = () => {
|
|
|
201
203
|
const n = e(), a = String(i);
|
|
202
204
|
return n.activeWindowIds.includes(a);
|
|
203
205
|
}
|
|
204
|
-
}),
|
|
205
|
-
|
|
206
|
+
}), w = we()(
|
|
207
|
+
he(Me, {
|
|
206
208
|
name: "tauri-notice-queue"
|
|
207
209
|
})
|
|
208
|
-
),
|
|
210
|
+
), M = {
|
|
209
211
|
queueLength: (t) => t.queue.length,
|
|
210
212
|
currentMessage: (t) => t.currentMessage,
|
|
211
213
|
isProcessing: (t) => t.isProcessing,
|
|
212
214
|
queue: (t) => t.queue
|
|
213
|
-
},
|
|
214
|
-
const t =
|
|
215
|
+
}, Ze = () => {
|
|
216
|
+
const t = w((i) => i.enqueue);
|
|
215
217
|
return { showNotice: P(
|
|
216
218
|
async (i) => {
|
|
217
219
|
await t(i);
|
|
@@ -219,28 +221,28 @@ const te = () => {
|
|
|
219
221
|
[t]
|
|
220
222
|
) };
|
|
221
223
|
};
|
|
222
|
-
function
|
|
224
|
+
function Oe(t, e, i, n) {
|
|
223
225
|
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");
|
|
224
226
|
return i === "m" ? n : i === "a" ? n.call(t) : n ? n.value : e.get(t);
|
|
225
227
|
}
|
|
226
|
-
function
|
|
228
|
+
function xe(t, e, i, n, a) {
|
|
227
229
|
if (typeof e == "function" ? t !== e || !0 : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
228
230
|
return e.set(t, i), i;
|
|
229
231
|
}
|
|
230
|
-
var
|
|
231
|
-
const
|
|
232
|
-
function
|
|
232
|
+
var O;
|
|
233
|
+
const g = "__TAURI_TO_IPC_KEY__";
|
|
234
|
+
function Ie(t, e = !1) {
|
|
233
235
|
return window.__TAURI_INTERNALS__.transformCallback(t, e);
|
|
234
236
|
}
|
|
235
237
|
async function s(t, e = {}, i) {
|
|
236
238
|
return window.__TAURI_INTERNALS__.invoke(t, e, i);
|
|
237
239
|
}
|
|
238
|
-
class
|
|
240
|
+
class Pe {
|
|
239
241
|
get rid() {
|
|
240
|
-
return
|
|
242
|
+
return Oe(this, O, "f");
|
|
241
243
|
}
|
|
242
244
|
constructor(e) {
|
|
243
|
-
|
|
245
|
+
O.set(this, void 0), xe(this, O, e);
|
|
244
246
|
}
|
|
245
247
|
/**
|
|
246
248
|
* Destroys and cleans up this resource from memory.
|
|
@@ -252,8 +254,8 @@ class xe {
|
|
|
252
254
|
});
|
|
253
255
|
}
|
|
254
256
|
}
|
|
255
|
-
|
|
256
|
-
class
|
|
257
|
+
O = /* @__PURE__ */ new WeakMap();
|
|
258
|
+
class ae {
|
|
257
259
|
constructor(...e) {
|
|
258
260
|
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]);
|
|
259
261
|
}
|
|
@@ -273,19 +275,19 @@ class ne {
|
|
|
273
275
|
* @since 2.0.0
|
|
274
276
|
*/
|
|
275
277
|
toPhysical(e) {
|
|
276
|
-
return new
|
|
278
|
+
return new _(this.width * e, this.height * e);
|
|
277
279
|
}
|
|
278
|
-
[
|
|
280
|
+
[g]() {
|
|
279
281
|
return {
|
|
280
282
|
width: this.width,
|
|
281
283
|
height: this.height
|
|
282
284
|
};
|
|
283
285
|
}
|
|
284
286
|
toJSON() {
|
|
285
|
-
return this[
|
|
287
|
+
return this[g]();
|
|
286
288
|
}
|
|
287
289
|
}
|
|
288
|
-
class
|
|
290
|
+
class _ {
|
|
289
291
|
constructor(...e) {
|
|
290
292
|
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]);
|
|
291
293
|
}
|
|
@@ -301,29 +303,29 @@ class p {
|
|
|
301
303
|
* ```
|
|
302
304
|
*/
|
|
303
305
|
toLogical(e) {
|
|
304
|
-
return new
|
|
306
|
+
return new ae(this.width / e, this.height / e);
|
|
305
307
|
}
|
|
306
|
-
[
|
|
308
|
+
[g]() {
|
|
307
309
|
return {
|
|
308
310
|
width: this.width,
|
|
309
311
|
height: this.height
|
|
310
312
|
};
|
|
311
313
|
}
|
|
312
314
|
toJSON() {
|
|
313
|
-
return this[
|
|
315
|
+
return this[g]();
|
|
314
316
|
}
|
|
315
317
|
}
|
|
316
|
-
class
|
|
318
|
+
class p {
|
|
317
319
|
constructor(e) {
|
|
318
320
|
this.size = e;
|
|
319
321
|
}
|
|
320
322
|
toLogical(e) {
|
|
321
|
-
return this.size instanceof
|
|
323
|
+
return this.size instanceof ae ? this.size : this.size.toLogical(e);
|
|
322
324
|
}
|
|
323
325
|
toPhysical(e) {
|
|
324
|
-
return this.size instanceof
|
|
326
|
+
return this.size instanceof _ ? this.size : this.size.toPhysical(e);
|
|
325
327
|
}
|
|
326
|
-
[
|
|
328
|
+
[g]() {
|
|
327
329
|
return {
|
|
328
330
|
[`${this.size.type}`]: {
|
|
329
331
|
width: this.size.width,
|
|
@@ -332,10 +334,10 @@ class b {
|
|
|
332
334
|
};
|
|
333
335
|
}
|
|
334
336
|
toJSON() {
|
|
335
|
-
return this[
|
|
337
|
+
return this[g]();
|
|
336
338
|
}
|
|
337
339
|
}
|
|
338
|
-
class
|
|
340
|
+
class re {
|
|
339
341
|
constructor(...e) {
|
|
340
342
|
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]);
|
|
341
343
|
}
|
|
@@ -355,19 +357,19 @@ class se {
|
|
|
355
357
|
* @since 2.0.0
|
|
356
358
|
*/
|
|
357
359
|
toPhysical(e) {
|
|
358
|
-
return new
|
|
360
|
+
return new h(this.x * e, this.y * e);
|
|
359
361
|
}
|
|
360
|
-
[
|
|
362
|
+
[g]() {
|
|
361
363
|
return {
|
|
362
364
|
x: this.x,
|
|
363
365
|
y: this.y
|
|
364
366
|
};
|
|
365
367
|
}
|
|
366
368
|
toJSON() {
|
|
367
|
-
return this[
|
|
369
|
+
return this[g]();
|
|
368
370
|
}
|
|
369
371
|
}
|
|
370
|
-
class
|
|
372
|
+
class h {
|
|
371
373
|
constructor(...e) {
|
|
372
374
|
this.type = "Physical", e.length === 1 ? "Physical" in e[0] ? (this.x = e[0].Physical.x, this.y = e[0].Physical.y) : (this.x = e[0].x, this.y = e[0].y) : (this.x = e[0], this.y = e[1]);
|
|
373
375
|
}
|
|
@@ -387,29 +389,29 @@ class w {
|
|
|
387
389
|
* @since 2.0.0
|
|
388
390
|
*/
|
|
389
391
|
toLogical(e) {
|
|
390
|
-
return new
|
|
392
|
+
return new re(this.x / e, this.y / e);
|
|
391
393
|
}
|
|
392
|
-
[
|
|
394
|
+
[g]() {
|
|
393
395
|
return {
|
|
394
396
|
x: this.x,
|
|
395
397
|
y: this.y
|
|
396
398
|
};
|
|
397
399
|
}
|
|
398
400
|
toJSON() {
|
|
399
|
-
return this[
|
|
401
|
+
return this[g]();
|
|
400
402
|
}
|
|
401
403
|
}
|
|
402
|
-
class
|
|
404
|
+
class m {
|
|
403
405
|
constructor(e) {
|
|
404
406
|
this.position = e;
|
|
405
407
|
}
|
|
406
408
|
toLogical(e) {
|
|
407
|
-
return this.position instanceof
|
|
409
|
+
return this.position instanceof re ? this.position : this.position.toLogical(e);
|
|
408
410
|
}
|
|
409
411
|
toPhysical(e) {
|
|
410
|
-
return this.position instanceof
|
|
412
|
+
return this.position instanceof h ? this.position : this.position.toPhysical(e);
|
|
411
413
|
}
|
|
412
|
-
[
|
|
414
|
+
[g]() {
|
|
413
415
|
return {
|
|
414
416
|
[`${this.position.type}`]: {
|
|
415
417
|
x: this.position.x,
|
|
@@ -418,47 +420,47 @@ class _ {
|
|
|
418
420
|
};
|
|
419
421
|
}
|
|
420
422
|
toJSON() {
|
|
421
|
-
return this[
|
|
423
|
+
return this[g]();
|
|
422
424
|
}
|
|
423
425
|
}
|
|
424
426
|
var o;
|
|
425
427
|
(function(t) {
|
|
426
428
|
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";
|
|
427
429
|
})(o || (o = {}));
|
|
428
|
-
async function
|
|
430
|
+
async function le(t, e) {
|
|
429
431
|
window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(t, e), await s("plugin:event|unlisten", {
|
|
430
432
|
event: t,
|
|
431
433
|
eventId: e
|
|
432
434
|
});
|
|
433
435
|
}
|
|
434
|
-
async function
|
|
436
|
+
async function k(t, e, i) {
|
|
435
437
|
var n;
|
|
436
438
|
const a = typeof i?.target == "string" ? { kind: "AnyLabel", label: i.target } : (n = i?.target) !== null && n !== void 0 ? n : { kind: "Any" };
|
|
437
439
|
return s("plugin:event|listen", {
|
|
438
440
|
event: t,
|
|
439
441
|
target: a,
|
|
440
|
-
handler:
|
|
441
|
-
}).then((l) => async () =>
|
|
442
|
+
handler: Ie(e)
|
|
443
|
+
}).then((l) => async () => le(t, l));
|
|
442
444
|
}
|
|
443
445
|
async function F(t, e, i) {
|
|
444
|
-
return
|
|
445
|
-
|
|
446
|
+
return k(t, (n) => {
|
|
447
|
+
le(t, n.id), e(n);
|
|
446
448
|
}, i);
|
|
447
449
|
}
|
|
448
|
-
async function
|
|
450
|
+
async function oe(t, e) {
|
|
449
451
|
await s("plugin:event|emit", {
|
|
450
452
|
event: t,
|
|
451
453
|
payload: e
|
|
452
454
|
});
|
|
453
455
|
}
|
|
454
|
-
async function
|
|
456
|
+
async function ue(t, e, i) {
|
|
455
457
|
await s("plugin:event|emit_to", {
|
|
456
458
|
target: typeof t == "string" ? { kind: "AnyLabel", label: t } : t,
|
|
457
459
|
event: e,
|
|
458
460
|
payload: i
|
|
459
461
|
});
|
|
460
462
|
}
|
|
461
|
-
class
|
|
463
|
+
class D extends Pe {
|
|
462
464
|
/**
|
|
463
465
|
* Creates an Image from a resource ID. For internal use only.
|
|
464
466
|
*
|
|
@@ -470,10 +472,10 @@ class S extends xe {
|
|
|
470
472
|
/** Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height. */
|
|
471
473
|
static async new(e, i, n) {
|
|
472
474
|
return s("plugin:image|new", {
|
|
473
|
-
rgba:
|
|
475
|
+
rgba: I(e),
|
|
474
476
|
width: i,
|
|
475
477
|
height: n
|
|
476
|
-
}).then((a) => new
|
|
478
|
+
}).then((a) => new D(a));
|
|
477
479
|
}
|
|
478
480
|
/**
|
|
479
481
|
* Creates a new image using the provided bytes by inferring the file format.
|
|
@@ -490,8 +492,8 @@ class S extends xe {
|
|
|
490
492
|
*/
|
|
491
493
|
static async fromBytes(e) {
|
|
492
494
|
return s("plugin:image|from_bytes", {
|
|
493
|
-
bytes:
|
|
494
|
-
}).then((i) => new
|
|
495
|
+
bytes: I(e)
|
|
496
|
+
}).then((i) => new D(i));
|
|
495
497
|
}
|
|
496
498
|
/**
|
|
497
499
|
* Creates a new image using the provided path.
|
|
@@ -506,7 +508,7 @@ class S extends xe {
|
|
|
506
508
|
* ```
|
|
507
509
|
*/
|
|
508
510
|
static async fromPath(e) {
|
|
509
|
-
return s("plugin:image|from_path", { path: e }).then((i) => new
|
|
511
|
+
return s("plugin:image|from_path", { path: e }).then((i) => new D(i));
|
|
510
512
|
}
|
|
511
513
|
/** Returns the RGBA data for this image, in row-major order from top to bottom. */
|
|
512
514
|
async rgba() {
|
|
@@ -519,14 +521,14 @@ class S extends xe {
|
|
|
519
521
|
return s("plugin:image|size", { rid: this.rid });
|
|
520
522
|
}
|
|
521
523
|
}
|
|
522
|
-
function
|
|
523
|
-
return t == null ? null : typeof t == "string" ? t : t instanceof
|
|
524
|
+
function I(t) {
|
|
525
|
+
return t == null ? null : typeof t == "string" ? t : t instanceof D ? t.rid : t;
|
|
524
526
|
}
|
|
525
527
|
var q;
|
|
526
528
|
(function(t) {
|
|
527
529
|
t[t.Critical = 1] = "Critical", t[t.Informational = 2] = "Informational";
|
|
528
530
|
})(q || (q = {}));
|
|
529
|
-
class
|
|
531
|
+
class ke {
|
|
530
532
|
constructor(e) {
|
|
531
533
|
this._preventDefault = !1, this.event = e.event, this.id = e.id;
|
|
532
534
|
}
|
|
@@ -537,24 +539,24 @@ class Pe {
|
|
|
537
539
|
return this._preventDefault;
|
|
538
540
|
}
|
|
539
541
|
}
|
|
540
|
-
var
|
|
542
|
+
var V;
|
|
541
543
|
(function(t) {
|
|
542
544
|
t.None = "none", t.Normal = "normal", t.Indeterminate = "indeterminate", t.Paused = "paused", t.Error = "error";
|
|
543
|
-
})(
|
|
544
|
-
function
|
|
545
|
-
return new
|
|
545
|
+
})(V || (V = {}));
|
|
546
|
+
function ce() {
|
|
547
|
+
return new C(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {
|
|
546
548
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
547
549
|
skip: !0
|
|
548
550
|
});
|
|
549
551
|
}
|
|
550
|
-
async function
|
|
551
|
-
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new
|
|
552
|
+
async function T() {
|
|
553
|
+
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new C(e, {
|
|
552
554
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
553
555
|
skip: !0
|
|
554
556
|
})));
|
|
555
557
|
}
|
|
556
|
-
const
|
|
557
|
-
class
|
|
558
|
+
const E = ["tauri://created", "tauri://error"];
|
|
559
|
+
class C {
|
|
558
560
|
/**
|
|
559
561
|
* Creates a new Window.
|
|
560
562
|
* @example
|
|
@@ -595,19 +597,19 @@ class k {
|
|
|
595
597
|
*/
|
|
596
598
|
static async getByLabel(e) {
|
|
597
599
|
var i;
|
|
598
|
-
return (i = (await
|
|
600
|
+
return (i = (await T()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
|
|
599
601
|
}
|
|
600
602
|
/**
|
|
601
603
|
* Get an instance of `Window` for the current window.
|
|
602
604
|
*/
|
|
603
605
|
static getCurrent() {
|
|
604
|
-
return
|
|
606
|
+
return ce();
|
|
605
607
|
}
|
|
606
608
|
/**
|
|
607
609
|
* Gets a list of instances of `Window` for all available windows.
|
|
608
610
|
*/
|
|
609
611
|
static async getAll() {
|
|
610
|
-
return
|
|
612
|
+
return T();
|
|
611
613
|
}
|
|
612
614
|
/**
|
|
613
615
|
* Gets the focused window.
|
|
@@ -620,7 +622,7 @@ class k {
|
|
|
620
622
|
* @returns The Window instance or `undefined` if there is not any focused window.
|
|
621
623
|
*/
|
|
622
624
|
static async getFocusedWindow() {
|
|
623
|
-
for (const e of await
|
|
625
|
+
for (const e of await T())
|
|
624
626
|
if (await e.isFocused())
|
|
625
627
|
return e;
|
|
626
628
|
return null;
|
|
@@ -648,7 +650,7 @@ class k {
|
|
|
648
650
|
return this._handleTauriEvent(e, i) ? () => {
|
|
649
651
|
const n = this.listeners[e];
|
|
650
652
|
n.splice(n.indexOf(i), 1);
|
|
651
|
-
} :
|
|
653
|
+
} : k(e, i, {
|
|
652
654
|
target: { kind: "Window", label: this.label }
|
|
653
655
|
});
|
|
654
656
|
}
|
|
@@ -691,7 +693,7 @@ class k {
|
|
|
691
693
|
* @param payload Event payload.
|
|
692
694
|
*/
|
|
693
695
|
async emit(e, i) {
|
|
694
|
-
if (
|
|
696
|
+
if (E.includes(e)) {
|
|
695
697
|
for (const n of this.listeners[e] || [])
|
|
696
698
|
n({
|
|
697
699
|
event: e,
|
|
@@ -700,7 +702,7 @@ class k {
|
|
|
700
702
|
});
|
|
701
703
|
return;
|
|
702
704
|
}
|
|
703
|
-
return
|
|
705
|
+
return oe(e, i);
|
|
704
706
|
}
|
|
705
707
|
/**
|
|
706
708
|
* Emits an event to all {@link EventTarget|targets} matching the given target.
|
|
@@ -715,7 +717,7 @@ class k {
|
|
|
715
717
|
* @param payload Event payload.
|
|
716
718
|
*/
|
|
717
719
|
async emitTo(e, i, n) {
|
|
718
|
-
if (
|
|
720
|
+
if (E.includes(i)) {
|
|
719
721
|
for (const a of this.listeners[i] || [])
|
|
720
722
|
a({
|
|
721
723
|
event: i,
|
|
@@ -724,11 +726,11 @@ class k {
|
|
|
724
726
|
});
|
|
725
727
|
return;
|
|
726
728
|
}
|
|
727
|
-
return
|
|
729
|
+
return ue(e, i, n);
|
|
728
730
|
}
|
|
729
731
|
/** @ignore */
|
|
730
732
|
_handleTauriEvent(e, i) {
|
|
731
|
-
return
|
|
733
|
+
return E.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
|
|
732
734
|
}
|
|
733
735
|
// Getters
|
|
734
736
|
/**
|
|
@@ -759,7 +761,7 @@ class k {
|
|
|
759
761
|
async innerPosition() {
|
|
760
762
|
return s("plugin:window|inner_position", {
|
|
761
763
|
label: this.label
|
|
762
|
-
}).then((e) => new
|
|
764
|
+
}).then((e) => new h(e));
|
|
763
765
|
}
|
|
764
766
|
/**
|
|
765
767
|
* The position of the top-left hand corner of the window relative to the top-left hand corner of the desktop.
|
|
@@ -774,7 +776,7 @@ class k {
|
|
|
774
776
|
async outerPosition() {
|
|
775
777
|
return s("plugin:window|outer_position", {
|
|
776
778
|
label: this.label
|
|
777
|
-
}).then((e) => new
|
|
779
|
+
}).then((e) => new h(e));
|
|
778
780
|
}
|
|
779
781
|
/**
|
|
780
782
|
* The physical size of the window's client area.
|
|
@@ -790,7 +792,7 @@ class k {
|
|
|
790
792
|
async innerSize() {
|
|
791
793
|
return s("plugin:window|inner_size", {
|
|
792
794
|
label: this.label
|
|
793
|
-
}).then((e) => new
|
|
795
|
+
}).then((e) => new _(e));
|
|
794
796
|
}
|
|
795
797
|
/**
|
|
796
798
|
* The physical size of the entire window.
|
|
@@ -806,7 +808,7 @@ class k {
|
|
|
806
808
|
async outerSize() {
|
|
807
809
|
return s("plugin:window|outer_size", {
|
|
808
810
|
label: this.label
|
|
809
|
-
}).then((e) => new
|
|
811
|
+
}).then((e) => new _(e));
|
|
810
812
|
}
|
|
811
813
|
/**
|
|
812
814
|
* Gets the window's current fullscreen state.
|
|
@@ -1457,7 +1459,7 @@ class k {
|
|
|
1457
1459
|
async setSize(e) {
|
|
1458
1460
|
return s("plugin:window|set_size", {
|
|
1459
1461
|
label: this.label,
|
|
1460
|
-
value: e instanceof
|
|
1462
|
+
value: e instanceof p ? e : new p(e)
|
|
1461
1463
|
});
|
|
1462
1464
|
}
|
|
1463
1465
|
/**
|
|
@@ -1474,7 +1476,7 @@ class k {
|
|
|
1474
1476
|
async setMinSize(e) {
|
|
1475
1477
|
return s("plugin:window|set_min_size", {
|
|
1476
1478
|
label: this.label,
|
|
1477
|
-
value: e instanceof
|
|
1479
|
+
value: e instanceof p ? e : e ? new p(e) : null
|
|
1478
1480
|
});
|
|
1479
1481
|
}
|
|
1480
1482
|
/**
|
|
@@ -1491,7 +1493,7 @@ class k {
|
|
|
1491
1493
|
async setMaxSize(e) {
|
|
1492
1494
|
return s("plugin:window|set_max_size", {
|
|
1493
1495
|
label: this.label,
|
|
1494
|
-
value: e instanceof
|
|
1496
|
+
value: e instanceof p ? e : e ? new p(e) : null
|
|
1495
1497
|
});
|
|
1496
1498
|
}
|
|
1497
1499
|
/**
|
|
@@ -1533,7 +1535,7 @@ class k {
|
|
|
1533
1535
|
async setPosition(e) {
|
|
1534
1536
|
return s("plugin:window|set_position", {
|
|
1535
1537
|
label: this.label,
|
|
1536
|
-
value: e instanceof
|
|
1538
|
+
value: e instanceof m ? e : new m(e)
|
|
1537
1539
|
});
|
|
1538
1540
|
}
|
|
1539
1541
|
/**
|
|
@@ -1627,7 +1629,7 @@ class k {
|
|
|
1627
1629
|
async setIcon(e) {
|
|
1628
1630
|
return s("plugin:window|set_icon", {
|
|
1629
1631
|
label: this.label,
|
|
1630
|
-
value:
|
|
1632
|
+
value: I(e)
|
|
1631
1633
|
});
|
|
1632
1634
|
}
|
|
1633
1635
|
/**
|
|
@@ -1745,7 +1747,7 @@ class k {
|
|
|
1745
1747
|
async setCursorPosition(e) {
|
|
1746
1748
|
return s("plugin:window|set_cursor_position", {
|
|
1747
1749
|
label: this.label,
|
|
1748
|
-
value: e instanceof
|
|
1750
|
+
value: e instanceof m ? e : new m(e)
|
|
1749
1751
|
});
|
|
1750
1752
|
}
|
|
1751
1753
|
/**
|
|
@@ -1862,7 +1864,7 @@ class k {
|
|
|
1862
1864
|
async setOverlayIcon(e) {
|
|
1863
1865
|
return s("plugin:window|set_overlay_icon", {
|
|
1864
1866
|
label: this.label,
|
|
1865
|
-
value: e ?
|
|
1867
|
+
value: e ? I(e) : void 0
|
|
1866
1868
|
});
|
|
1867
1869
|
}
|
|
1868
1870
|
/**
|
|
@@ -1952,7 +1954,7 @@ class k {
|
|
|
1952
1954
|
*/
|
|
1953
1955
|
async onResized(e) {
|
|
1954
1956
|
return this.listen(o.WINDOW_RESIZED, (i) => {
|
|
1955
|
-
i.payload = new
|
|
1957
|
+
i.payload = new _(i.payload), e(i);
|
|
1956
1958
|
});
|
|
1957
1959
|
}
|
|
1958
1960
|
/**
|
|
@@ -1974,7 +1976,7 @@ class k {
|
|
|
1974
1976
|
*/
|
|
1975
1977
|
async onMoved(e) {
|
|
1976
1978
|
return this.listen(o.WINDOW_MOVED, (i) => {
|
|
1977
|
-
i.payload = new
|
|
1979
|
+
i.payload = new h(i.payload), e(i);
|
|
1978
1980
|
});
|
|
1979
1981
|
}
|
|
1980
1982
|
/**
|
|
@@ -2001,7 +2003,7 @@ class k {
|
|
|
2001
2003
|
*/
|
|
2002
2004
|
async onCloseRequested(e) {
|
|
2003
2005
|
return this.listen(o.WINDOW_CLOSE_REQUESTED, async (i) => {
|
|
2004
|
-
const n = new
|
|
2006
|
+
const n = new ke(i);
|
|
2005
2007
|
await e(n), n.isPreventDefault() || await this.destroy();
|
|
2006
2008
|
});
|
|
2007
2009
|
}
|
|
@@ -2037,7 +2039,7 @@ class k {
|
|
|
2037
2039
|
payload: {
|
|
2038
2040
|
type: "enter",
|
|
2039
2041
|
paths: r.payload.paths,
|
|
2040
|
-
position: new
|
|
2042
|
+
position: new h(r.payload.position)
|
|
2041
2043
|
}
|
|
2042
2044
|
});
|
|
2043
2045
|
}), n = await this.listen(o.DRAG_OVER, (r) => {
|
|
@@ -2045,7 +2047,7 @@ class k {
|
|
|
2045
2047
|
...r,
|
|
2046
2048
|
payload: {
|
|
2047
2049
|
type: "over",
|
|
2048
|
-
position: new
|
|
2050
|
+
position: new h(r.payload.position)
|
|
2049
2051
|
}
|
|
2050
2052
|
});
|
|
2051
2053
|
}), a = await this.listen(o.DRAG_DROP, (r) => {
|
|
@@ -2054,7 +2056,7 @@ class k {
|
|
|
2054
2056
|
payload: {
|
|
2055
2057
|
type: "drop",
|
|
2056
2058
|
paths: r.payload.paths,
|
|
2057
|
-
position: new
|
|
2059
|
+
position: new h(r.payload.position)
|
|
2058
2060
|
}
|
|
2059
2061
|
});
|
|
2060
2062
|
}), l = await this.listen(o.DRAG_LEAVE, (r) => {
|
|
@@ -2136,45 +2138,45 @@ class k {
|
|
|
2136
2138
|
return this.listen(o.WINDOW_THEME_CHANGED, e);
|
|
2137
2139
|
}
|
|
2138
2140
|
}
|
|
2139
|
-
var
|
|
2141
|
+
var j;
|
|
2140
2142
|
(function(t) {
|
|
2141
2143
|
t.Disabled = "disabled", t.Throttle = "throttle", t.Suspend = "suspend";
|
|
2142
|
-
})(
|
|
2143
|
-
var
|
|
2144
|
+
})(j || (j = {}));
|
|
2145
|
+
var J;
|
|
2144
2146
|
(function(t) {
|
|
2145
2147
|
t.Default = "default", t.FluentOverlay = "fluentOverlay";
|
|
2146
|
-
})(
|
|
2147
|
-
var
|
|
2148
|
+
})(J || (J = {}));
|
|
2149
|
+
var Z;
|
|
2148
2150
|
(function(t) {
|
|
2149
2151
|
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";
|
|
2150
|
-
})(
|
|
2151
|
-
var
|
|
2152
|
+
})(Z || (Z = {}));
|
|
2153
|
+
var Y;
|
|
2152
2154
|
(function(t) {
|
|
2153
2155
|
t.FollowsWindowActiveState = "followsWindowActiveState", t.Active = "active", t.Inactive = "inactive";
|
|
2154
|
-
})(
|
|
2155
|
-
function
|
|
2156
|
+
})(Y || (Y = {}));
|
|
2157
|
+
function Ce(t) {
|
|
2156
2158
|
return t === null ? null : {
|
|
2157
2159
|
name: t.name,
|
|
2158
2160
|
scaleFactor: t.scaleFactor,
|
|
2159
|
-
position: new
|
|
2160
|
-
size: new
|
|
2161
|
+
position: new h(t.position),
|
|
2162
|
+
size: new _(t.size),
|
|
2161
2163
|
workArea: {
|
|
2162
|
-
position: new
|
|
2163
|
-
size: new
|
|
2164
|
+
position: new h(t.workArea.position),
|
|
2165
|
+
size: new _(t.workArea.size)
|
|
2164
2166
|
}
|
|
2165
2167
|
};
|
|
2166
2168
|
}
|
|
2167
|
-
async function
|
|
2168
|
-
return s("plugin:window|primary_monitor").then(
|
|
2169
|
+
async function Le() {
|
|
2170
|
+
return s("plugin:window|primary_monitor").then(Ce);
|
|
2169
2171
|
}
|
|
2170
|
-
function
|
|
2171
|
-
return new B(
|
|
2172
|
+
function de() {
|
|
2173
|
+
return new B(ce(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, {
|
|
2172
2174
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
2173
2175
|
skip: !0
|
|
2174
2176
|
});
|
|
2175
2177
|
}
|
|
2176
|
-
async function
|
|
2177
|
-
return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new B(new
|
|
2178
|
+
async function K() {
|
|
2179
|
+
return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new B(new C(e.windowLabel, {
|
|
2178
2180
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
2179
2181
|
skip: !0
|
|
2180
2182
|
}), e.label, {
|
|
@@ -2182,7 +2184,7 @@ async function Z() {
|
|
|
2182
2184
|
skip: !0
|
|
2183
2185
|
})));
|
|
2184
2186
|
}
|
|
2185
|
-
const
|
|
2187
|
+
const R = ["tauri://created", "tauri://error"];
|
|
2186
2188
|
class B {
|
|
2187
2189
|
/**
|
|
2188
2190
|
* Creates a new Webview.
|
|
@@ -2238,19 +2240,19 @@ class B {
|
|
|
2238
2240
|
*/
|
|
2239
2241
|
static async getByLabel(e) {
|
|
2240
2242
|
var i;
|
|
2241
|
-
return (i = (await
|
|
2243
|
+
return (i = (await K()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
|
|
2242
2244
|
}
|
|
2243
2245
|
/**
|
|
2244
2246
|
* Get an instance of `Webview` for the current webview.
|
|
2245
2247
|
*/
|
|
2246
2248
|
static getCurrent() {
|
|
2247
|
-
return
|
|
2249
|
+
return de();
|
|
2248
2250
|
}
|
|
2249
2251
|
/**
|
|
2250
2252
|
* Gets a list of instances of `Webview` for all available webviews.
|
|
2251
2253
|
*/
|
|
2252
2254
|
static async getAll() {
|
|
2253
|
-
return
|
|
2255
|
+
return K();
|
|
2254
2256
|
}
|
|
2255
2257
|
/**
|
|
2256
2258
|
* Listen to an emitted event on this webview.
|
|
@@ -2275,7 +2277,7 @@ class B {
|
|
|
2275
2277
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2276
2278
|
const n = this.listeners[e];
|
|
2277
2279
|
n.splice(n.indexOf(i), 1);
|
|
2278
|
-
} :
|
|
2280
|
+
} : k(e, i, {
|
|
2279
2281
|
target: { kind: "Webview", label: this.label }
|
|
2280
2282
|
});
|
|
2281
2283
|
}
|
|
@@ -2319,7 +2321,7 @@ class B {
|
|
|
2319
2321
|
* @param payload Event payload.
|
|
2320
2322
|
*/
|
|
2321
2323
|
async emit(e, i) {
|
|
2322
|
-
if (
|
|
2324
|
+
if (R.includes(e)) {
|
|
2323
2325
|
for (const n of this.listeners[e] || [])
|
|
2324
2326
|
n({
|
|
2325
2327
|
event: e,
|
|
@@ -2328,7 +2330,7 @@ class B {
|
|
|
2328
2330
|
});
|
|
2329
2331
|
return;
|
|
2330
2332
|
}
|
|
2331
|
-
return
|
|
2333
|
+
return oe(e, i);
|
|
2332
2334
|
}
|
|
2333
2335
|
/**
|
|
2334
2336
|
* Emits an event to all {@link EventTarget|targets} matching the given target.
|
|
@@ -2344,7 +2346,7 @@ class B {
|
|
|
2344
2346
|
* @param payload Event payload.
|
|
2345
2347
|
*/
|
|
2346
2348
|
async emitTo(e, i, n) {
|
|
2347
|
-
if (
|
|
2349
|
+
if (R.includes(i)) {
|
|
2348
2350
|
for (const a of this.listeners[i] || [])
|
|
2349
2351
|
a({
|
|
2350
2352
|
event: i,
|
|
@@ -2353,11 +2355,11 @@ class B {
|
|
|
2353
2355
|
});
|
|
2354
2356
|
return;
|
|
2355
2357
|
}
|
|
2356
|
-
return
|
|
2358
|
+
return ue(e, i, n);
|
|
2357
2359
|
}
|
|
2358
2360
|
/** @ignore */
|
|
2359
2361
|
_handleTauriEvent(e, i) {
|
|
2360
|
-
return
|
|
2362
|
+
return R.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
|
|
2361
2363
|
}
|
|
2362
2364
|
// Getters
|
|
2363
2365
|
/**
|
|
@@ -2373,7 +2375,7 @@ class B {
|
|
|
2373
2375
|
async position() {
|
|
2374
2376
|
return s("plugin:webview|webview_position", {
|
|
2375
2377
|
label: this.label
|
|
2376
|
-
}).then((e) => new
|
|
2378
|
+
}).then((e) => new h(e));
|
|
2377
2379
|
}
|
|
2378
2380
|
/**
|
|
2379
2381
|
* The physical size of the webview's client area.
|
|
@@ -2389,7 +2391,7 @@ class B {
|
|
|
2389
2391
|
async size() {
|
|
2390
2392
|
return s("plugin:webview|webview_size", {
|
|
2391
2393
|
label: this.label
|
|
2392
|
-
}).then((e) => new
|
|
2394
|
+
}).then((e) => new _(e));
|
|
2393
2395
|
}
|
|
2394
2396
|
// Setters
|
|
2395
2397
|
/**
|
|
@@ -2421,7 +2423,7 @@ class B {
|
|
|
2421
2423
|
async setSize(e) {
|
|
2422
2424
|
return s("plugin:webview|set_webview_size", {
|
|
2423
2425
|
label: this.label,
|
|
2424
|
-
value: e instanceof
|
|
2426
|
+
value: e instanceof p ? e : new p(e)
|
|
2425
2427
|
});
|
|
2426
2428
|
}
|
|
2427
2429
|
/**
|
|
@@ -2438,7 +2440,7 @@ class B {
|
|
|
2438
2440
|
async setPosition(e) {
|
|
2439
2441
|
return s("plugin:webview|set_webview_position", {
|
|
2440
2442
|
label: this.label,
|
|
2441
|
-
value: e instanceof
|
|
2443
|
+
value: e instanceof m ? e : new m(e)
|
|
2442
2444
|
});
|
|
2443
2445
|
}
|
|
2444
2446
|
/**
|
|
@@ -2600,7 +2602,7 @@ class B {
|
|
|
2600
2602
|
payload: {
|
|
2601
2603
|
type: "enter",
|
|
2602
2604
|
paths: r.payload.paths,
|
|
2603
|
-
position: new
|
|
2605
|
+
position: new h(r.payload.position)
|
|
2604
2606
|
}
|
|
2605
2607
|
});
|
|
2606
2608
|
}), n = await this.listen(o.DRAG_OVER, (r) => {
|
|
@@ -2608,7 +2610,7 @@ class B {
|
|
|
2608
2610
|
...r,
|
|
2609
2611
|
payload: {
|
|
2610
2612
|
type: "over",
|
|
2611
|
-
position: new
|
|
2613
|
+
position: new h(r.payload.position)
|
|
2612
2614
|
}
|
|
2613
2615
|
});
|
|
2614
2616
|
}), a = await this.listen(o.DRAG_DROP, (r) => {
|
|
@@ -2617,7 +2619,7 @@ class B {
|
|
|
2617
2619
|
payload: {
|
|
2618
2620
|
type: "drop",
|
|
2619
2621
|
paths: r.payload.paths,
|
|
2620
|
-
position: new
|
|
2622
|
+
position: new h(r.payload.position)
|
|
2621
2623
|
}
|
|
2622
2624
|
});
|
|
2623
2625
|
}), l = await this.listen(o.DRAG_LEAVE, (r) => {
|
|
@@ -2628,17 +2630,17 @@ class B {
|
|
|
2628
2630
|
};
|
|
2629
2631
|
}
|
|
2630
2632
|
}
|
|
2631
|
-
function
|
|
2632
|
-
const t =
|
|
2633
|
-
return new
|
|
2633
|
+
function x() {
|
|
2634
|
+
const t = de();
|
|
2635
|
+
return new v(t.label, { skip: !0 });
|
|
2634
2636
|
}
|
|
2635
|
-
async function
|
|
2636
|
-
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new
|
|
2637
|
+
async function X() {
|
|
2638
|
+
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new v(e, {
|
|
2637
2639
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
2638
2640
|
skip: !0
|
|
2639
2641
|
})));
|
|
2640
2642
|
}
|
|
2641
|
-
class
|
|
2643
|
+
class v {
|
|
2642
2644
|
/**
|
|
2643
2645
|
* Creates a new {@link Window} hosting a {@link Webview}.
|
|
2644
2646
|
* @example
|
|
@@ -2681,20 +2683,20 @@ class f {
|
|
|
2681
2683
|
*/
|
|
2682
2684
|
static async getByLabel(e) {
|
|
2683
2685
|
var i;
|
|
2684
|
-
const n = (i = (await
|
|
2685
|
-
return n ? new
|
|
2686
|
+
const n = (i = (await X()).find((a) => a.label === e)) !== null && i !== void 0 ? i : null;
|
|
2687
|
+
return n ? new v(n.label, { skip: !0 }) : null;
|
|
2686
2688
|
}
|
|
2687
2689
|
/**
|
|
2688
2690
|
* Get an instance of `Webview` for the current webview.
|
|
2689
2691
|
*/
|
|
2690
2692
|
static getCurrent() {
|
|
2691
|
-
return
|
|
2693
|
+
return x();
|
|
2692
2694
|
}
|
|
2693
2695
|
/**
|
|
2694
2696
|
* Gets a list of instances of `Webview` for all available webviews.
|
|
2695
2697
|
*/
|
|
2696
2698
|
static async getAll() {
|
|
2697
|
-
return
|
|
2699
|
+
return X();
|
|
2698
2700
|
}
|
|
2699
2701
|
/**
|
|
2700
2702
|
* Listen to an emitted event on this webivew window.
|
|
@@ -2719,7 +2721,7 @@ class f {
|
|
|
2719
2721
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2720
2722
|
const n = this.listeners[e];
|
|
2721
2723
|
n.splice(n.indexOf(i), 1);
|
|
2722
|
-
} :
|
|
2724
|
+
} : k(e, i, {
|
|
2723
2725
|
target: { kind: "WebviewWindow", label: this.label }
|
|
2724
2726
|
});
|
|
2725
2727
|
}
|
|
@@ -2770,8 +2772,8 @@ class f {
|
|
|
2770
2772
|
return s("plugin:window|set_background_color", { color: e }).then(() => s("plugin:webview|set_webview_background_color", { color: e }));
|
|
2771
2773
|
}
|
|
2772
2774
|
}
|
|
2773
|
-
|
|
2774
|
-
function
|
|
2775
|
+
Te(v, [C, B]);
|
|
2776
|
+
function Te(t, e) {
|
|
2775
2777
|
(Array.isArray(e) ? e : [e]).forEach((i) => {
|
|
2776
2778
|
Object.getOwnPropertyNames(i.prototype).forEach((n) => {
|
|
2777
2779
|
var a;
|
|
@@ -2784,23 +2786,23 @@ function Ce(t, e) {
|
|
|
2784
2786
|
});
|
|
2785
2787
|
});
|
|
2786
2788
|
}
|
|
2787
|
-
const
|
|
2789
|
+
const A = /* @__PURE__ */ new Map(), Ee = () => navigator.platform.toLowerCase().includes("mac") || navigator.userAgent.toLowerCase().includes("mac"), Re = (t) => {
|
|
2788
2790
|
if (!t || t.trim() === "") return !1;
|
|
2789
2791
|
try {
|
|
2790
2792
|
return !!(t.startsWith("/") || t.startsWith("http://") || t.startsWith("https://") || t.startsWith("tauri://"));
|
|
2791
2793
|
} catch {
|
|
2792
2794
|
return !1;
|
|
2793
2795
|
}
|
|
2794
|
-
},
|
|
2796
|
+
}, qe = async (t, e, i) => {
|
|
2795
2797
|
const n = i?.padding ?? 20;
|
|
2796
2798
|
if (i?.x !== void 0 && i?.y !== void 0)
|
|
2797
2799
|
return { x: i.x, y: i.y };
|
|
2798
2800
|
let a = 1920, l = 1080;
|
|
2799
2801
|
try {
|
|
2800
|
-
const
|
|
2801
|
-
|
|
2802
|
-
} catch (
|
|
2803
|
-
console.warn("Failed to get monitor info, using defaults:",
|
|
2802
|
+
const d = await Le();
|
|
2803
|
+
d?.size && (a = d.size.width, l = d.size.height);
|
|
2804
|
+
} catch (d) {
|
|
2805
|
+
console.warn("Failed to get monitor info, using defaults:", d);
|
|
2804
2806
|
}
|
|
2805
2807
|
switch (i?.position ?? "right-bottom") {
|
|
2806
2808
|
case "right-bottom":
|
|
@@ -2834,146 +2836,158 @@ const D = /* @__PURE__ */ new Map(), Le = (t) => {
|
|
|
2834
2836
|
y: l - e - n
|
|
2835
2837
|
};
|
|
2836
2838
|
}
|
|
2837
|
-
},
|
|
2838
|
-
const e = String(t.id), i =
|
|
2839
|
+
}, Fe = async (t) => {
|
|
2840
|
+
const e = String(t.id), i = w.getState();
|
|
2839
2841
|
if (i.isWindowActive(e)) {
|
|
2840
2842
|
console.log(`Notice window already open for message: ${e}`);
|
|
2841
2843
|
return;
|
|
2842
2844
|
}
|
|
2843
|
-
const n =
|
|
2845
|
+
const n = ie(), a = `notice-${e}`;
|
|
2844
2846
|
let l = `${n.routePrefix}/${t.type}?id=${t.id}`;
|
|
2845
|
-
|
|
2846
|
-
const r = t.min_width || n.defaultWidth,
|
|
2847
|
+
Re(l) || (console.warn(`Invalid window URL: ${l}. Using fallback 404 page.`), l = n.notFoundUrl || "/404");
|
|
2848
|
+
const r = t.min_width || n.defaultWidth, d = t.min_height || n.defaultHeight, f = t.decorations ?? n.defaultDecorations ?? !0, { x: W, y: N } = await qe(r, d, t.windowPosition);
|
|
2847
2849
|
try {
|
|
2848
|
-
const
|
|
2850
|
+
const u = {
|
|
2849
2851
|
url: l,
|
|
2850
2852
|
title: t.title,
|
|
2851
2853
|
width: r,
|
|
2852
|
-
height:
|
|
2853
|
-
x:
|
|
2854
|
-
y:
|
|
2854
|
+
height: d,
|
|
2855
|
+
x: W,
|
|
2856
|
+
y: N,
|
|
2855
2857
|
resizable: !0,
|
|
2856
|
-
decorations: y,
|
|
2857
|
-
transparent: !y,
|
|
2858
|
-
// Enable transparency for borderless windows (macOS fix)
|
|
2859
|
-
visible: y,
|
|
2860
|
-
// Start hidden if no decorations (macOS fix)
|
|
2861
2858
|
skipTaskbar: !1,
|
|
2862
2859
|
alwaysOnTop: !0
|
|
2863
|
-
}
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2860
|
+
};
|
|
2861
|
+
f ? u.decorations = !0 : Ee() ? (u.decorations = !0, u.titleBarStyle = "overlay", u.hiddenTitle = !0) : (u.decorations = !1, u.transparent = !0);
|
|
2862
|
+
const b = new v(a, u);
|
|
2863
|
+
A.set(e, b), i.addActiveWindow(e);
|
|
2864
|
+
let c = null;
|
|
2865
|
+
const G = n.loadTimeout ?? 1e4;
|
|
2866
|
+
!f && G > 0 && (c = setTimeout(async () => {
|
|
2867
|
+
console.warn(`Notice window ${a} load timeout - auto closing`);
|
|
2868
|
+
try {
|
|
2869
|
+
await b.close();
|
|
2870
|
+
} catch {
|
|
2871
|
+
}
|
|
2872
|
+
}, G)), b.once("tauri://created", () => {
|
|
2873
|
+
c && (clearTimeout(c), c = null), console.log(`Notice window created successfully: ${a}`);
|
|
2874
|
+
}), b.once("tauri://error", async (Q) => {
|
|
2875
|
+
if (console.error(`Notice window error: ${a}`, Q), c && (clearTimeout(c), c = null), !f)
|
|
2876
|
+
try {
|
|
2877
|
+
await b.close();
|
|
2878
|
+
} catch {
|
|
2879
|
+
}
|
|
2880
|
+
}), b.once("tauri://destroyed", async () => {
|
|
2881
|
+
c && (clearTimeout(c), c = null), A.delete(e), i.removeActiveWindow(e), await i.markMessageAsShown(e), i.clearCurrent();
|
|
2868
2882
|
}), console.log(`Created notice window: ${a}`);
|
|
2869
|
-
} catch (
|
|
2870
|
-
console.error("Failed to create notice window:",
|
|
2883
|
+
} catch (u) {
|
|
2884
|
+
console.error("Failed to create notice window:", u), i.removeActiveWindow(e), i.clearCurrent();
|
|
2871
2885
|
}
|
|
2872
2886
|
}, U = async (t) => {
|
|
2873
|
-
const e = String(t), i =
|
|
2887
|
+
const e = String(t), i = A.get(e), n = w.getState();
|
|
2874
2888
|
if (i)
|
|
2875
2889
|
try {
|
|
2876
|
-
await i.close(),
|
|
2890
|
+
await i.close(), A.delete(e), n.removeActiveWindow(e), await n.markMessageAsShown(e), n.clearCurrent(), console.log(`Closed notice window: ${e}`);
|
|
2877
2891
|
} catch (a) {
|
|
2878
2892
|
console.error("Failed to close notice window:", a);
|
|
2879
2893
|
}
|
|
2880
|
-
},
|
|
2881
|
-
const t = Array.from(
|
|
2894
|
+
}, Be = async () => {
|
|
2895
|
+
const t = Array.from(A.keys()).map(
|
|
2882
2896
|
(e) => U(e)
|
|
2883
2897
|
);
|
|
2884
2898
|
await Promise.all(t);
|
|
2885
|
-
},
|
|
2899
|
+
}, Ue = () => {
|
|
2886
2900
|
let t = null;
|
|
2887
|
-
|
|
2901
|
+
w.subscribe((e) => {
|
|
2888
2902
|
const i = e.currentMessage;
|
|
2889
|
-
i && i !== t ? (t = i,
|
|
2903
|
+
i && i !== t ? (t = i, Fe(i)) : i || (t = null);
|
|
2890
2904
|
}), console.log("Notice window system initialized");
|
|
2891
|
-
},
|
|
2892
|
-
const t =
|
|
2905
|
+
}, Ye = () => {
|
|
2906
|
+
const t = w((i) => i.currentMessage);
|
|
2893
2907
|
return { closeNotice: P(async () => {
|
|
2894
2908
|
t && await U(t.id);
|
|
2895
2909
|
}, [t]) };
|
|
2896
|
-
},
|
|
2897
|
-
const t =
|
|
2910
|
+
}, Ke = () => {
|
|
2911
|
+
const t = w((i) => i.hideMessage);
|
|
2898
2912
|
return { hideNotice: P(
|
|
2899
2913
|
async (i) => {
|
|
2900
2914
|
await t(i), await U(i);
|
|
2901
2915
|
},
|
|
2902
2916
|
[t]
|
|
2903
2917
|
) };
|
|
2904
|
-
},
|
|
2905
|
-
const t =
|
|
2918
|
+
}, Xe = () => {
|
|
2919
|
+
const t = w((i) => i.clearOnLogout);
|
|
2906
2920
|
return { hideAllNotices: P(async () => {
|
|
2907
|
-
await
|
|
2921
|
+
await Be(), await t();
|
|
2908
2922
|
}, [t]) };
|
|
2909
|
-
},
|
|
2910
|
-
const t =
|
|
2923
|
+
}, et = () => {
|
|
2924
|
+
const t = w(M.queueLength), e = w(M.currentMessage), i = w(M.isProcessing), n = w(M.queue);
|
|
2911
2925
|
return {
|
|
2912
2926
|
queueLength: t,
|
|
2913
2927
|
currentMessage: e,
|
|
2914
2928
|
isProcessing: i,
|
|
2915
2929
|
queue: n
|
|
2916
2930
|
};
|
|
2917
|
-
},
|
|
2918
|
-
const [n, a] = L(null), [l, r] = L(!0), [
|
|
2919
|
-
return
|
|
2931
|
+
}, tt = ({ children: t, onLoad: e, onClose: i }) => {
|
|
2932
|
+
const [n, a] = L(null), [l, r] = L(!0), [d, f] = L(null);
|
|
2933
|
+
return H(() => {
|
|
2920
2934
|
(async () => {
|
|
2921
2935
|
try {
|
|
2922
|
-
const
|
|
2923
|
-
if (!
|
|
2924
|
-
|
|
2936
|
+
const u = new URLSearchParams(window.location.search).get("id");
|
|
2937
|
+
if (!u) {
|
|
2938
|
+
f("No message ID provided"), r(!1), setTimeout(async () => {
|
|
2925
2939
|
try {
|
|
2926
|
-
await
|
|
2927
|
-
} catch (
|
|
2928
|
-
console.error("Failed to close window:",
|
|
2940
|
+
await x().close();
|
|
2941
|
+
} catch (c) {
|
|
2942
|
+
console.error("Failed to close window:", c);
|
|
2929
2943
|
}
|
|
2930
2944
|
}, 1e3);
|
|
2931
2945
|
return;
|
|
2932
2946
|
}
|
|
2933
|
-
const
|
|
2934
|
-
if (!
|
|
2935
|
-
console.log(`Message ${
|
|
2947
|
+
const b = await se(u);
|
|
2948
|
+
if (!b) {
|
|
2949
|
+
console.log(`Message ${u} not found in database, closing window`), f("Message not found"), r(!1), setTimeout(async () => {
|
|
2936
2950
|
try {
|
|
2937
|
-
await
|
|
2938
|
-
} catch (
|
|
2939
|
-
console.error("Failed to close window:",
|
|
2951
|
+
await x().close();
|
|
2952
|
+
} catch (c) {
|
|
2953
|
+
console.error("Failed to close window:", c);
|
|
2940
2954
|
}
|
|
2941
2955
|
}, 500);
|
|
2942
2956
|
return;
|
|
2943
2957
|
}
|
|
2944
|
-
a(
|
|
2945
|
-
} catch (
|
|
2946
|
-
console.error("Failed to load message:",
|
|
2958
|
+
a(b), r(!1), e && e(b);
|
|
2959
|
+
} catch (N) {
|
|
2960
|
+
console.error("Failed to load message:", N), f("Failed to load message"), r(!1), setTimeout(async () => {
|
|
2947
2961
|
try {
|
|
2948
|
-
await
|
|
2949
|
-
} catch (
|
|
2950
|
-
console.error("Failed to close window:",
|
|
2962
|
+
await x().close();
|
|
2963
|
+
} catch (u) {
|
|
2964
|
+
console.error("Failed to close window:", u);
|
|
2951
2965
|
}
|
|
2952
2966
|
}, 1e3);
|
|
2953
2967
|
}
|
|
2954
2968
|
})();
|
|
2955
|
-
}, [e]),
|
|
2969
|
+
}, [e]), H(() => {
|
|
2956
2970
|
if (!n || !i) return;
|
|
2957
|
-
const
|
|
2971
|
+
const W = () => {
|
|
2958
2972
|
i(n);
|
|
2959
2973
|
};
|
|
2960
|
-
return window.addEventListener("beforeunload",
|
|
2961
|
-
window.removeEventListener("beforeunload",
|
|
2974
|
+
return window.addEventListener("beforeunload", W), () => {
|
|
2975
|
+
window.removeEventListener("beforeunload", W);
|
|
2962
2976
|
};
|
|
2963
|
-
}, [n, i]), l ? /* @__PURE__ */
|
|
2977
|
+
}, [n, i]), l ? /* @__PURE__ */ z("div", { style: {
|
|
2964
2978
|
display: "flex",
|
|
2965
2979
|
justifyContent: "center",
|
|
2966
2980
|
alignItems: "center",
|
|
2967
2981
|
height: "100vh",
|
|
2968
2982
|
fontFamily: "system-ui, -apple-system, sans-serif"
|
|
2969
|
-
}, children: "Loading..." }) :
|
|
2983
|
+
}, children: "Loading..." }) : d ? /* @__PURE__ */ z("div", { style: {
|
|
2970
2984
|
display: "flex",
|
|
2971
2985
|
justifyContent: "center",
|
|
2972
2986
|
alignItems: "center",
|
|
2973
2987
|
height: "100vh",
|
|
2974
2988
|
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
2975
2989
|
color: "#ef4444"
|
|
2976
|
-
}, children:
|
|
2990
|
+
}, children: d }) : n ? /* @__PURE__ */ z(ye, { children: t(n) }) : /* @__PURE__ */ z("div", { style: {
|
|
2977
2991
|
display: "flex",
|
|
2978
2992
|
justifyContent: "center",
|
|
2979
2993
|
alignItems: "center",
|
|
@@ -2981,38 +2995,38 @@ const D = /* @__PURE__ */ new Map(), Le = (t) => {
|
|
|
2981
2995
|
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
2982
2996
|
color: "#ef4444"
|
|
2983
2997
|
}, children: "Closing window..." });
|
|
2984
|
-
},
|
|
2985
|
-
|
|
2986
|
-
const { initializeFromDatabase: t } =
|
|
2998
|
+
}, it = async () => {
|
|
2999
|
+
ne(), Ue();
|
|
3000
|
+
const { initializeFromDatabase: t } = w.getState();
|
|
2987
3001
|
await t(), console.log("Tauri Notice System initialized");
|
|
2988
|
-
},
|
|
2989
|
-
await
|
|
2990
|
-
},
|
|
2991
|
-
await
|
|
2992
|
-
},
|
|
2993
|
-
await
|
|
3002
|
+
}, nt = async (t) => {
|
|
3003
|
+
await w.getState().deleteMessage(t);
|
|
3004
|
+
}, st = async (t) => {
|
|
3005
|
+
await w.getState().hideMessage(t);
|
|
3006
|
+
}, at = async (t) => {
|
|
3007
|
+
await w.getState().markMessageAsShown(t);
|
|
2994
3008
|
};
|
|
2995
3009
|
export {
|
|
2996
|
-
|
|
2997
|
-
|
|
3010
|
+
tt as NoticeLayout,
|
|
3011
|
+
Be as closeAllNoticeWindows,
|
|
2998
3012
|
U as closeNoticeWindow,
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3013
|
+
Fe as createNoticeWindow,
|
|
3014
|
+
nt as deleteMessageById,
|
|
3015
|
+
se as getMessage,
|
|
3016
|
+
ie as getNoticeConfig,
|
|
3017
|
+
ve as getPendingMessages,
|
|
3018
|
+
st as hideMessageById,
|
|
3019
|
+
ne as initializeDatabase,
|
|
3020
|
+
it as initializeNoticeSystem,
|
|
3021
|
+
Ue as initializeNoticeWindowSystem,
|
|
3022
|
+
at as markMessageAsShown,
|
|
3023
|
+
M as messageQueueSelectors,
|
|
3024
|
+
Je as setNoticeConfig,
|
|
3025
|
+
Ye as useCloseNotice,
|
|
3026
|
+
Xe as useHideAllNotices,
|
|
3027
|
+
Ke as useHideNotice,
|
|
3028
|
+
et as useMessageQueue,
|
|
3029
|
+
w as useMessageQueueStore,
|
|
3030
|
+
Ze as useNoticeWindow
|
|
3017
3031
|
};
|
|
3018
3032
|
//# sourceMappingURL=index.js.map
|