tauri-notice-window 1.0.10 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -30,4 +30,55 @@ export { initializeDatabase, getPendingMessages, getMessage, };
30
30
  * ```
31
31
  */
32
32
  export declare const initializeNoticeSystem: () => Promise<void>;
33
+ /**
34
+ * Delete a message by ID
35
+ * Removes the message from both the runtime queue (Zustand) and persistent storage (IndexedDB)
36
+ * If the message is currently being displayed, its window will be closed automatically
37
+ *
38
+ * @param messageId - The ID of the message to delete
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * import { deleteMessageById } from 'tauri-notice-window'
43
+ *
44
+ * // Delete a specific message
45
+ * await deleteMessageById('message-123')
46
+ *
47
+ * // If message is currently shown, window closes and next message displays
48
+ * ```
49
+ */
50
+ export declare const deleteMessageById: (messageId: string) => Promise<void>;
51
+ /**
52
+ * Hide a message by ID
53
+ * Marks the message as hidden in the database and removes it from the queue
54
+ * Typically used for server-triggered hide events
55
+ *
56
+ * @param messageId - The ID of the message to hide
57
+ *
58
+ * @example
59
+ * ```typescript
60
+ * import { hideMessageById } from 'tauri-notice-window'
61
+ *
62
+ * // Server triggers hide via websocket
63
+ * socket.on('hide_message', async (data) => {
64
+ * await hideMessageById(data.message_id)
65
+ * })
66
+ * ```
67
+ */
68
+ export declare const hideMessageById: (messageId: string) => Promise<void>;
69
+ /**
70
+ * Mark a message as shown
71
+ * Updates the database to prevent the message from being shown again
72
+ *
73
+ * @param messageId - The ID of the message to mark as shown
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * import { markMessageAsShown } from 'tauri-notice-window'
78
+ *
79
+ * // Manually mark a message as shown without displaying it
80
+ * await markMessageAsShown('message-123')
81
+ * ```
82
+ */
83
+ export declare const markMessageAsShown: (messageId: string) => Promise<void>;
33
84
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAG/F,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AACxF,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,CAAA;AAGtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAGzD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAGxD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGxE,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,GACtB,CAAA;AAED,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACX,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,GACX,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,QAAa,OAAO,CAAC,IAAI,CAY3D,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAG/F,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AACxF,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,CAAA;AAGtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAGzD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAGxD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGxE,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,GACtB,CAAA;AAED,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACX,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,GACX,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,QAAa,OAAO,CAAC,IAAI,CAY3D,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,iBAAiB,GAAU,WAAW,MAAM,KAAG,OAAO,CAAC,IAAI,CAGvE,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,eAAe,GAAU,WAAW,MAAM,KAAG,OAAO,CAAC,IAAI,CAGrE,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,GAAU,WAAW,MAAM,KAAG,OAAO,CAAC,IAAI,CAGxE,CAAA"}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { create as ce } from "zustand";
2
2
  import { syncTabs as we } from "zustand-sync";
3
3
  import de from "dexie";
4
- import { useCallback as M, useState as L, useEffect as G } from "react";
4
+ import { useCallback as P, useState as L, useEffect as G } from "react";
5
5
  import { jsx as N, Fragment as he } from "react/jsx-runtime";
6
6
  const K = "tauri-notice-config", Q = {
7
7
  routePrefix: "/notice",
@@ -70,9 +70,9 @@ const te = () => {
70
70
  });
71
71
  }, ie = async (t) => await h().messages.get(t), Se = async (t) => {
72
72
  await h().messages.delete(t);
73
- }, De = async () => {
73
+ }, Ae = async () => {
74
74
  await h().messages.where("queueStatus").anyOf(["pending", "showing"]).delete();
75
- }, Ae = async (t) => {
75
+ }, De = async (t) => {
76
76
  const e = t.map(
77
77
  (i) => h().messages.update(i.id, { queuePosition: i.position })
78
78
  );
@@ -153,7 +153,7 @@ const te = () => {
153
153
  id: a.id,
154
154
  position: l
155
155
  }));
156
- await Ae(n);
156
+ await De(n);
157
157
  },
158
158
  // Clear all messages on logout
159
159
  clearOnLogout: async () => {
@@ -163,7 +163,7 @@ const te = () => {
163
163
  isProcessing: !1,
164
164
  activeWindowIds: [],
165
165
  initialized: !1
166
- }), await De();
166
+ }), await Ae();
167
167
  },
168
168
  // Remove a specific message from the queue by ID (memory only)
169
169
  removeFromQueue: async (i) => {
@@ -199,7 +199,7 @@ const te = () => {
199
199
  const n = e(), a = String(i);
200
200
  return n.activeWindowIds.includes(a);
201
201
  }
202
- }), w = ce()(
202
+ }), c = ce()(
203
203
  we(Ne, {
204
204
  name: "tauri-notice-queue"
205
205
  })
@@ -209,8 +209,8 @@ const te = () => {
209
209
  isProcessing: (t) => t.isProcessing,
210
210
  queue: (t) => t.queue
211
211
  }, Ve = () => {
212
- const t = w((i) => i.enqueue);
213
- return { showNotice: M(
212
+ const t = c((i) => i.enqueue);
213
+ return { showNotice: P(
214
214
  async (i) => {
215
215
  await t(i);
216
216
  },
@@ -221,24 +221,24 @@ function ze(t, e, i, n) {
221
221
  if (typeof e == "function" ? t !== e || !n : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
222
222
  return i === "m" ? n : i === "a" ? n.call(t) : n ? n.value : e.get(t);
223
223
  }
224
- function Oe(t, e, i, n, a) {
224
+ function Me(t, e, i, n, a) {
225
225
  if (typeof e == "function" ? t !== e || !0 : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
226
226
  return e.set(t, i), i;
227
227
  }
228
- var O;
228
+ var M;
229
229
  const d = "__TAURI_TO_IPC_KEY__";
230
- function xe(t, e = !1) {
230
+ function Oe(t, e = !1) {
231
231
  return window.__TAURI_INTERNALS__.transformCallback(t, e);
232
232
  }
233
233
  async function s(t, e = {}, i) {
234
234
  return window.__TAURI_INTERNALS__.invoke(t, e, i);
235
235
  }
236
- class Pe {
236
+ class xe {
237
237
  get rid() {
238
- return ze(this, O, "f");
238
+ return ze(this, M, "f");
239
239
  }
240
240
  constructor(e) {
241
- O.set(this, void 0), Oe(this, O, e);
241
+ M.set(this, void 0), Me(this, M, e);
242
242
  }
243
243
  /**
244
244
  * Destroys and cleans up this resource from memory.
@@ -250,7 +250,7 @@ class Pe {
250
250
  });
251
251
  }
252
252
  }
253
- O = /* @__PURE__ */ new WeakMap();
253
+ M = /* @__PURE__ */ new WeakMap();
254
254
  class ne {
255
255
  constructor(...e) {
256
256
  this.type = "Logical", e.length === 1 ? "Logical" in e[0] ? (this.width = e[0].Logical.width, this.height = e[0].Logical.height) : (this.width = e[0].width, this.height = e[0].height) : (this.width = e[0], this.height = e[1]);
@@ -353,7 +353,7 @@ class se {
353
353
  * @since 2.0.0
354
354
  */
355
355
  toPhysical(e) {
356
- return new c(this.x * e, this.y * e);
356
+ return new w(this.x * e, this.y * e);
357
357
  }
358
358
  [d]() {
359
359
  return {
@@ -365,7 +365,7 @@ class se {
365
365
  return this[d]();
366
366
  }
367
367
  }
368
- class c {
368
+ class w {
369
369
  constructor(...e) {
370
370
  this.type = "Physical", e.length === 1 ? "Physical" in e[0] ? (this.x = e[0].Physical.x, this.y = e[0].Physical.y) : (this.x = e[0].x, this.y = e[0].y) : (this.x = e[0], this.y = e[1]);
371
371
  }
@@ -405,7 +405,7 @@ class _ {
405
405
  return this.position instanceof se ? this.position : this.position.toLogical(e);
406
406
  }
407
407
  toPhysical(e) {
408
- return this.position instanceof c ? this.position : this.position.toPhysical(e);
408
+ return this.position instanceof w ? this.position : this.position.toPhysical(e);
409
409
  }
410
410
  [d]() {
411
411
  return {
@@ -435,7 +435,7 @@ async function I(t, e, i) {
435
435
  return s("plugin:event|listen", {
436
436
  event: t,
437
437
  target: a,
438
- handler: xe(e)
438
+ handler: Oe(e)
439
439
  }).then((l) => async () => ae(t, l));
440
440
  }
441
441
  async function F(t, e, i) {
@@ -456,7 +456,7 @@ async function le(t, e, i) {
456
456
  payload: i
457
457
  });
458
458
  }
459
- class D extends Pe {
459
+ class A extends xe {
460
460
  /**
461
461
  * Creates an Image from a resource ID. For internal use only.
462
462
  *
@@ -468,10 +468,10 @@ class D extends Pe {
468
468
  /** Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height. */
469
469
  static async new(e, i, n) {
470
470
  return s("plugin:image|new", {
471
- rgba: P(e),
471
+ rgba: x(e),
472
472
  width: i,
473
473
  height: n
474
- }).then((a) => new D(a));
474
+ }).then((a) => new A(a));
475
475
  }
476
476
  /**
477
477
  * Creates a new image using the provided bytes by inferring the file format.
@@ -488,8 +488,8 @@ class D extends Pe {
488
488
  */
489
489
  static async fromBytes(e) {
490
490
  return s("plugin:image|from_bytes", {
491
- bytes: P(e)
492
- }).then((i) => new D(i));
491
+ bytes: x(e)
492
+ }).then((i) => new A(i));
493
493
  }
494
494
  /**
495
495
  * Creates a new image using the provided path.
@@ -504,7 +504,7 @@ class D extends Pe {
504
504
  * ```
505
505
  */
506
506
  static async fromPath(e) {
507
- return s("plugin:image|from_path", { path: e }).then((i) => new D(i));
507
+ return s("plugin:image|from_path", { path: e }).then((i) => new A(i));
508
508
  }
509
509
  /** Returns the RGBA data for this image, in row-major order from top to bottom. */
510
510
  async rgba() {
@@ -517,14 +517,14 @@ class D extends Pe {
517
517
  return s("plugin:image|size", { rid: this.rid });
518
518
  }
519
519
  }
520
- function P(t) {
521
- return t == null ? null : typeof t == "string" ? t : t instanceof D ? t.rid : t;
520
+ function x(t) {
521
+ return t == null ? null : typeof t == "string" ? t : t instanceof A ? t.rid : t;
522
522
  }
523
523
  var q;
524
524
  (function(t) {
525
525
  t[t.Critical = 1] = "Critical", t[t.Informational = 2] = "Informational";
526
526
  })(q || (q = {}));
527
- class Me {
527
+ class Pe {
528
528
  constructor(e) {
529
529
  this._preventDefault = !1, this.event = e.event, this.id = e.id;
530
530
  }
@@ -757,7 +757,7 @@ class k {
757
757
  async innerPosition() {
758
758
  return s("plugin:window|inner_position", {
759
759
  label: this.label
760
- }).then((e) => new c(e));
760
+ }).then((e) => new w(e));
761
761
  }
762
762
  /**
763
763
  * The position of the top-left hand corner of the window relative to the top-left hand corner of the desktop.
@@ -772,7 +772,7 @@ class k {
772
772
  async outerPosition() {
773
773
  return s("plugin:window|outer_position", {
774
774
  label: this.label
775
- }).then((e) => new c(e));
775
+ }).then((e) => new w(e));
776
776
  }
777
777
  /**
778
778
  * The physical size of the window's client area.
@@ -1625,7 +1625,7 @@ class k {
1625
1625
  async setIcon(e) {
1626
1626
  return s("plugin:window|set_icon", {
1627
1627
  label: this.label,
1628
- value: P(e)
1628
+ value: x(e)
1629
1629
  });
1630
1630
  }
1631
1631
  /**
@@ -1860,7 +1860,7 @@ class k {
1860
1860
  async setOverlayIcon(e) {
1861
1861
  return s("plugin:window|set_overlay_icon", {
1862
1862
  label: this.label,
1863
- value: e ? P(e) : void 0
1863
+ value: e ? x(e) : void 0
1864
1864
  });
1865
1865
  }
1866
1866
  /**
@@ -1972,7 +1972,7 @@ class k {
1972
1972
  */
1973
1973
  async onMoved(e) {
1974
1974
  return this.listen(o.WINDOW_MOVED, (i) => {
1975
- i.payload = new c(i.payload), e(i);
1975
+ i.payload = new w(i.payload), e(i);
1976
1976
  });
1977
1977
  }
1978
1978
  /**
@@ -1999,7 +1999,7 @@ class k {
1999
1999
  */
2000
2000
  async onCloseRequested(e) {
2001
2001
  return this.listen(o.WINDOW_CLOSE_REQUESTED, async (i) => {
2002
- const n = new Me(i);
2002
+ const n = new Pe(i);
2003
2003
  await e(n), n.isPreventDefault() || await this.destroy();
2004
2004
  });
2005
2005
  }
@@ -2035,7 +2035,7 @@ class k {
2035
2035
  payload: {
2036
2036
  type: "enter",
2037
2037
  paths: r.payload.paths,
2038
- position: new c(r.payload.position)
2038
+ position: new w(r.payload.position)
2039
2039
  }
2040
2040
  });
2041
2041
  }), n = await this.listen(o.DRAG_OVER, (r) => {
@@ -2043,7 +2043,7 @@ class k {
2043
2043
  ...r,
2044
2044
  payload: {
2045
2045
  type: "over",
2046
- position: new c(r.payload.position)
2046
+ position: new w(r.payload.position)
2047
2047
  }
2048
2048
  });
2049
2049
  }), a = await this.listen(o.DRAG_DROP, (r) => {
@@ -2052,7 +2052,7 @@ class k {
2052
2052
  payload: {
2053
2053
  type: "drop",
2054
2054
  paths: r.payload.paths,
2055
- position: new c(r.payload.position)
2055
+ position: new w(r.payload.position)
2056
2056
  }
2057
2057
  });
2058
2058
  }), l = await this.listen(o.DRAG_LEAVE, (r) => {
@@ -2138,14 +2138,14 @@ var V;
2138
2138
  (function(t) {
2139
2139
  t.Disabled = "disabled", t.Throttle = "throttle", t.Suspend = "suspend";
2140
2140
  })(V || (V = {}));
2141
- var j;
2141
+ var $;
2142
2142
  (function(t) {
2143
2143
  t.Default = "default", t.FluentOverlay = "fluentOverlay";
2144
- })(j || (j = {}));
2145
- var $;
2144
+ })($ || ($ = {}));
2145
+ var j;
2146
2146
  (function(t) {
2147
2147
  t.AppearanceBased = "appearanceBased", t.Light = "light", t.Dark = "dark", t.MediumLight = "mediumLight", t.UltraDark = "ultraDark", t.Titlebar = "titlebar", t.Selection = "selection", t.Menu = "menu", t.Popover = "popover", t.Sidebar = "sidebar", t.HeaderView = "headerView", t.Sheet = "sheet", t.WindowBackground = "windowBackground", t.HudWindow = "hudWindow", t.FullScreenUI = "fullScreenUI", t.Tooltip = "tooltip", t.ContentBackground = "contentBackground", t.UnderWindowBackground = "underWindowBackground", t.UnderPageBackground = "underPageBackground", t.Mica = "mica", t.Blur = "blur", t.Acrylic = "acrylic", t.Tabbed = "tabbed", t.TabbedDark = "tabbedDark", t.TabbedLight = "tabbedLight";
2148
- })($ || ($ = {}));
2148
+ })(j || (j = {}));
2149
2149
  var J;
2150
2150
  (function(t) {
2151
2151
  t.FollowsWindowActiveState = "followsWindowActiveState", t.Active = "active", t.Inactive = "inactive";
@@ -2154,10 +2154,10 @@ function Ie(t) {
2154
2154
  return t === null ? null : {
2155
2155
  name: t.name,
2156
2156
  scaleFactor: t.scaleFactor,
2157
- position: new c(t.position),
2157
+ position: new w(t.position),
2158
2158
  size: new y(t.size),
2159
2159
  workArea: {
2160
- position: new c(t.workArea.position),
2160
+ position: new w(t.workArea.position),
2161
2161
  size: new y(t.workArea.size)
2162
2162
  }
2163
2163
  };
@@ -2371,7 +2371,7 @@ class B {
2371
2371
  async position() {
2372
2372
  return s("plugin:webview|webview_position", {
2373
2373
  label: this.label
2374
- }).then((e) => new c(e));
2374
+ }).then((e) => new w(e));
2375
2375
  }
2376
2376
  /**
2377
2377
  * The physical size of the webview's client area.
@@ -2598,7 +2598,7 @@ class B {
2598
2598
  payload: {
2599
2599
  type: "enter",
2600
2600
  paths: r.payload.paths,
2601
- position: new c(r.payload.position)
2601
+ position: new w(r.payload.position)
2602
2602
  }
2603
2603
  });
2604
2604
  }), n = await this.listen(o.DRAG_OVER, (r) => {
@@ -2606,7 +2606,7 @@ class B {
2606
2606
  ...r,
2607
2607
  payload: {
2608
2608
  type: "over",
2609
- position: new c(r.payload.position)
2609
+ position: new w(r.payload.position)
2610
2610
  }
2611
2611
  });
2612
2612
  }), a = await this.listen(o.DRAG_DROP, (r) => {
@@ -2615,7 +2615,7 @@ class B {
2615
2615
  payload: {
2616
2616
  type: "drop",
2617
2617
  paths: r.payload.paths,
2618
- position: new c(r.payload.position)
2618
+ position: new w(r.payload.position)
2619
2619
  }
2620
2620
  });
2621
2621
  }), l = await this.listen(o.DRAG_LEAVE, (r) => {
@@ -2626,7 +2626,7 @@ class B {
2626
2626
  };
2627
2627
  }
2628
2628
  }
2629
- function x() {
2629
+ function O() {
2630
2630
  const t = ue();
2631
2631
  return new f(t.label, { skip: !0 });
2632
2632
  }
@@ -2686,7 +2686,7 @@ class f {
2686
2686
  * Get an instance of `Webview` for the current webview.
2687
2687
  */
2688
2688
  static getCurrent() {
2689
- return x();
2689
+ return O();
2690
2690
  }
2691
2691
  /**
2692
2692
  * Gets a list of instances of `Webview` for all available webviews.
@@ -2782,7 +2782,7 @@ function Ce(t, e) {
2782
2782
  });
2783
2783
  });
2784
2784
  }
2785
- const A = /* @__PURE__ */ new Map(), Le = (t) => {
2785
+ const D = /* @__PURE__ */ new Map(), Le = (t) => {
2786
2786
  if (!t || t.trim() === "") return !1;
2787
2787
  try {
2788
2788
  return !!(t.startsWith("/") || t.startsWith("http://") || t.startsWith("https://") || t.startsWith("tauri://"));
@@ -2833,7 +2833,7 @@ const A = /* @__PURE__ */ new Map(), Le = (t) => {
2833
2833
  };
2834
2834
  }
2835
2835
  }, Re = async (t) => {
2836
- const e = String(t.id), i = w.getState();
2836
+ const e = String(t.id), i = c.getState();
2837
2837
  if (i.isWindowActive(e)) {
2838
2838
  console.log(`Notice window already open for message: ${e}`);
2839
2839
  return;
@@ -2855,51 +2855,51 @@ const A = /* @__PURE__ */ new Map(), Le = (t) => {
2855
2855
  skipTaskbar: !1,
2856
2856
  alwaysOnTop: !0
2857
2857
  });
2858
- A.set(e, b), i.addActiveWindow(e), b.once("tauri://destroyed", async () => {
2859
- A.delete(e), i.removeActiveWindow(e), await i.markMessageAsShown(e), i.clearCurrent();
2858
+ D.set(e, b), i.addActiveWindow(e), b.once("tauri://destroyed", async () => {
2859
+ D.delete(e), i.removeActiveWindow(e), await i.markMessageAsShown(e), i.clearCurrent();
2860
2860
  }), console.log(`Created notice window: ${a}`);
2861
2861
  } catch (b) {
2862
2862
  console.error("Failed to create notice window:", b), i.removeActiveWindow(e), i.clearCurrent();
2863
2863
  }
2864
2864
  }, U = async (t) => {
2865
- const e = String(t), i = A.get(e), n = w.getState();
2865
+ const e = String(t), i = D.get(e), n = c.getState();
2866
2866
  if (i)
2867
2867
  try {
2868
- await i.close(), A.delete(e), n.removeActiveWindow(e), await n.markMessageAsShown(e), n.clearCurrent(), console.log(`Closed notice window: ${e}`);
2868
+ await i.close(), D.delete(e), n.removeActiveWindow(e), await n.markMessageAsShown(e), n.clearCurrent(), console.log(`Closed notice window: ${e}`);
2869
2869
  } catch (a) {
2870
2870
  console.error("Failed to close notice window:", a);
2871
2871
  }
2872
2872
  }, Te = async () => {
2873
- const t = Array.from(A.keys()).map(
2873
+ const t = Array.from(D.keys()).map(
2874
2874
  (e) => U(e)
2875
2875
  );
2876
2876
  await Promise.all(t);
2877
2877
  }, qe = () => {
2878
2878
  let t = null;
2879
- w.subscribe((e) => {
2879
+ c.subscribe((e) => {
2880
2880
  const i = e.currentMessage;
2881
2881
  i && i !== t ? (t = i, Re(i)) : i || (t = null);
2882
2882
  }), console.log("Notice window system initialized");
2883
- }, je = () => {
2884
- const t = w((i) => i.currentMessage);
2885
- return { closeNotice: M(async () => {
2883
+ }, $e = () => {
2884
+ const t = c((i) => i.currentMessage);
2885
+ return { closeNotice: P(async () => {
2886
2886
  t && await U(t.id);
2887
2887
  }, [t]) };
2888
- }, $e = () => {
2889
- const t = w((i) => i.hideMessage);
2890
- return { hideNotice: M(
2888
+ }, je = () => {
2889
+ const t = c((i) => i.hideMessage);
2890
+ return { hideNotice: P(
2891
2891
  async (i) => {
2892
2892
  await t(i), await U(i);
2893
2893
  },
2894
2894
  [t]
2895
2895
  ) };
2896
2896
  }, Je = () => {
2897
- const t = w((i) => i.clearOnLogout);
2898
- return { hideAllNotices: M(async () => {
2897
+ const t = c((i) => i.clearOnLogout);
2898
+ return { hideAllNotices: P(async () => {
2899
2899
  await Te(), await t();
2900
2900
  }, [t]) };
2901
2901
  }, Ze = () => {
2902
- const t = w(z.queueLength), e = w(z.currentMessage), i = w(z.isProcessing), n = w(z.queue);
2902
+ const t = c(z.queueLength), e = c(z.currentMessage), i = c(z.isProcessing), n = c(z.queue);
2903
2903
  return {
2904
2904
  queueLength: t,
2905
2905
  currentMessage: e,
@@ -2915,7 +2915,7 @@ const A = /* @__PURE__ */ new Map(), Le = (t) => {
2915
2915
  if (!p) {
2916
2916
  m("No message ID provided"), r(!1), setTimeout(async () => {
2917
2917
  try {
2918
- await x().close();
2918
+ await O().close();
2919
2919
  } catch (W) {
2920
2920
  console.error("Failed to close window:", W);
2921
2921
  }
@@ -2926,7 +2926,7 @@ const A = /* @__PURE__ */ new Map(), Le = (t) => {
2926
2926
  if (!C) {
2927
2927
  console.log(`Message ${p} not found in database, closing window`), m("Message not found"), r(!1), setTimeout(async () => {
2928
2928
  try {
2929
- await x().close();
2929
+ await O().close();
2930
2930
  } catch (W) {
2931
2931
  console.error("Failed to close window:", W);
2932
2932
  }
@@ -2937,7 +2937,7 @@ const A = /* @__PURE__ */ new Map(), Le = (t) => {
2937
2937
  } catch (b) {
2938
2938
  console.error("Failed to load message:", b), m("Failed to load message"), r(!1), setTimeout(async () => {
2939
2939
  try {
2940
- await x().close();
2940
+ await O().close();
2941
2941
  } catch (p) {
2942
2942
  console.error("Failed to close window:", p);
2943
2943
  }
@@ -2975,27 +2975,36 @@ const A = /* @__PURE__ */ new Map(), Le = (t) => {
2975
2975
  }, children: "Closing window..." });
2976
2976
  }, Ke = async () => {
2977
2977
  te(), qe();
2978
- const { initializeFromDatabase: t } = w.getState();
2978
+ const { initializeFromDatabase: t } = c.getState();
2979
2979
  await t(), console.log("Tauri Notice System initialized");
2980
+ }, Xe = async (t) => {
2981
+ await c.getState().deleteMessage(t);
2982
+ }, et = async (t) => {
2983
+ await c.getState().hideMessage(t);
2984
+ }, tt = async (t) => {
2985
+ await c.getState().markMessageAsShown(t);
2980
2986
  };
2981
2987
  export {
2982
2988
  Ye as NoticeLayout,
2983
2989
  Te as closeAllNoticeWindows,
2984
2990
  U as closeNoticeWindow,
2985
2991
  Re as createNoticeWindow,
2992
+ Xe as deleteMessageById,
2986
2993
  ie as getMessage,
2987
2994
  ee as getNoticeConfig,
2988
2995
  fe as getPendingMessages,
2996
+ et as hideMessageById,
2989
2997
  te as initializeDatabase,
2990
2998
  Ke as initializeNoticeSystem,
2991
2999
  qe as initializeNoticeWindowSystem,
3000
+ tt as markMessageAsShown,
2992
3001
  z as messageQueueSelectors,
2993
3002
  He as setNoticeConfig,
2994
- je as useCloseNotice,
3003
+ $e as useCloseNotice,
2995
3004
  Je as useHideAllNotices,
2996
- $e as useHideNotice,
3005
+ je as useHideNotice,
2997
3006
  Ze as useMessageQueue,
2998
- w as useMessageQueueStore,
3007
+ c as useMessageQueueStore,
2999
3008
  Ve as useNoticeWindow
3000
3009
  };
3001
3010
  //# sourceMappingURL=index.js.map