@iyulab/modern-app 0.56.1 → 0.56.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.56.2] - 2026-10-17
4
+
5
+ ### Fixed
6
+
7
+ - The unsaved-changes guard still asks when its dialog cannot load — a deployment replaced the hashed chunk while a tab
8
+ with an edited form stayed open, or the network is gone. The import failure reached the router as «the guard threw»,
9
+ so the screen stayed and every navigation was silently blocked; it now asks the same question with `window.confirm`
10
+ (and warns). The dialog module also loads when the first screen registers a check, not at the moment of asking.
11
+
3
12
  ## [0.56.1] - 2026-10-17
4
13
 
5
14
  ### Fixed
package/dist/unsaved.js CHANGED
@@ -4,7 +4,7 @@ var t = /* @__PURE__ */ new Set(), n = (e) => {
4
4
  i() && (e.preventDefault(), e.returnValue = "");
5
5
  };
6
6
  function r(e) {
7
- return t.size === 0 && typeof window < "u" && window.addEventListener("beforeunload", n), t.add(e), () => {
7
+ return t.size === 0 && typeof window < "u" && (window.addEventListener("beforeunload", n), s().catch(() => {})), t.add(e), () => {
8
8
  t.delete(e) && t.size === 0 && typeof window < "u" && window.removeEventListener("beforeunload", n);
9
9
  };
10
10
  }
@@ -17,18 +17,29 @@ function i() {
17
17
  return !1;
18
18
  }
19
19
  async function a(t) {
20
- let n = e(), { Dialog: r } = await import("@iyulab/components/dist/utilities/Dialog.js");
21
- return r.confirm(t?.message ?? n.discardMessage, {
22
- title: t?.title ?? n.discardTitle,
20
+ let n = e(), r = t?.title ?? n.discardTitle, i = t?.message ?? n.discardMessage, a;
21
+ try {
22
+ ({Dialog: a} = await s());
23
+ } catch (e) {
24
+ return console.warn("[@iyulab/modern-app] the discard-changes dialog could not load — asking with window.confirm instead:", e), typeof window < "u" && typeof window.confirm == "function" && window.confirm(`${r}\n\n${i}`);
25
+ }
26
+ return a.confirm(i, {
27
+ title: r,
23
28
  confirmLabel: t?.confirmLabel ?? n.discardConfirm,
24
29
  cancelLabel: t?.cancelLabel ?? n.discardCancel,
25
30
  confirmColor: "danger"
26
31
  });
27
32
  }
28
- function o(e) {
33
+ var o;
34
+ function s() {
35
+ return o ??= import("@iyulab/components/dist/utilities/Dialog.js").catch((e) => {
36
+ throw o = void 0, e;
37
+ }), o;
38
+ }
39
+ function c(e) {
29
40
  return !i() || a();
30
41
  }
31
- var s = class {
42
+ var l = class {
32
43
  constructor(e, t) {
33
44
  this.isDirty = t, this.clean = !1, this.check = () => !this.clean && this.isDirty(), e.addController(this);
34
45
  }
@@ -46,4 +57,4 @@ var s = class {
46
57
  }
47
58
  };
48
59
  //#endregion
49
- export { s as UnsavedChangesController, a as confirmDiscardChanges, i as hasUnsavedChanges, r as trackUnsavedChanges, o as unsavedChangesGuard };
60
+ export { l as UnsavedChangesController, a as confirmDiscardChanges, i as hasUnsavedChanges, r as trackUnsavedChanges, c as unsavedChangesGuard };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iyulab/modern-app",
3
3
  "description": "web-framework by iyulab based on lit-element",
4
- "version": "0.56.1",
4
+ "version": "0.56.2",
5
5
  "keywords": [
6
6
  "iyulab",
7
7
  "web-framework",