@iyulab/modern-app 0.56.1 → 0.57.0

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/App.js +1 -2
  3. package/dist/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/decorate.js +1 -2
  4. package/dist/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/decorateMetadata.js +1 -2
  5. package/dist/components/ActionBar.js +3 -4
  6. package/dist/components/ActionBar.styles.js +1 -2
  7. package/dist/components/EmptyState.js +3 -4
  8. package/dist/components/EmptyState.styles.js +1 -2
  9. package/dist/components/GroupBox.js +3 -4
  10. package/dist/components/GroupBox.styles.js +1 -2
  11. package/dist/components/InfoField.d.ts +5 -0
  12. package/dist/components/InfoField.js +25 -19
  13. package/dist/components/InfoField.styles.js +20 -2
  14. package/dist/components/InfoSection.js +3 -4
  15. package/dist/components/InfoSection.styles.js +1 -2
  16. package/dist/components/MasterDetailLayout.js +3 -4
  17. package/dist/components/MasterDetailLayout.styles.js +1 -2
  18. package/dist/components/PageHeader.js +3 -4
  19. package/dist/components/PageHeader.styles.js +1 -2
  20. package/dist/components/SidebarButton.js +3 -4
  21. package/dist/components/SidebarButton.styles.js +1 -2
  22. package/dist/components/SidebarGroup.d.ts +9 -0
  23. package/dist/components/SidebarGroup.js +17 -14
  24. package/dist/components/SidebarGroup.styles.js +1 -2
  25. package/dist/components/SidebarLink.d.ts +6 -0
  26. package/dist/components/SidebarLink.js +16 -14
  27. package/dist/components/SidebarLink.styles.js +1 -2
  28. package/dist/components/SidebarSection.js +3 -4
  29. package/dist/components/SidebarSection.styles.js +1 -2
  30. package/dist/components/Timeline.js +2 -3
  31. package/dist/components/Timeline.styles.js +1 -2
  32. package/dist/components/TimelineItem.js +3 -4
  33. package/dist/components/TimelineItem.styles.js +1 -2
  34. package/dist/components/Wizard.js +3 -4
  35. package/dist/components/Wizard.styles.js +1 -2
  36. package/dist/defaultFallback.js +1 -2
  37. package/dist/index.d.ts +1 -1
  38. package/dist/index.js +1 -2
  39. package/dist/internals/ScreenObserver.js +1 -2
  40. package/dist/internals/StyledElement.js +3 -4
  41. package/dist/internals/locale.js +1 -2
  42. package/dist/internals/nav-icon.js +1 -2
  43. package/dist/internals/slotted.js +1 -2
  44. package/dist/layouts/SidebarLayout.d.ts +10 -0
  45. package/dist/layouts/SidebarLayout.js +27 -9
  46. package/dist/layouts/SidebarLayout.styles.js +31 -7
  47. package/dist/layouts/SidebarLayout.types.d.ts +16 -2
  48. package/dist/layouts/filterSidebarItems.js +1 -2
  49. package/dist/react.js +1 -2
  50. package/dist/translate.js +0 -1
  51. package/dist/unsaved.js +19 -9
  52. package/package.json +1 -1
  53. package/skills/modern-app/references/components/info-field.md +22 -0
  54. package/skills/modern-app/references/layout.md +5 -2
package/dist/unsaved.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { getLocaleStrings as e } from "./internals/locale.js";
2
- //#region src/unsaved.ts
2
+ // src/unsaved.ts
3
3
  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
  }
@@ -45,5 +56,4 @@ var s = class {
45
56
  this.release?.(), this.release = void 0;
46
57
  }
47
58
  };
48
- //#endregion
49
- export { s as UnsavedChangesController, a as confirmDiscardChanges, i as hasUnsavedChanges, r as trackUnsavedChanges, o as unsavedChangesGuard };
59
+ 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.57.0",
5
5
  "keywords": [
6
6
  "iyulab",
7
7
  "web-framework",
@@ -105,6 +105,27 @@ the `trend-icon` slot:
105
105
  </u-info-section>
106
106
  ```
107
107
 
108
+ A small picture beside the figure — a trend sparkline, a progress ring — goes in the `visual` slot. It sits at the end
109
+ of the value line, aligned to the figure's baseline edge, and takes no room when empty. The field does not draw the
110
+ picture: it gives it a place. Mark a decorative picture `aria-hidden="true"`; give one that carries information its own
111
+ name (`role="img"` and `aria-label`) (`0.57.0~`):
112
+
113
+ ```html
114
+ <u-info-field appearance="tile" size="xl" label="Received today" .value=${48} trend="up" .trendLabel=${'+6 vs yesterday'}>
115
+ <svg slot="visual" aria-hidden="true" width="96" height="32" viewBox="0 0 96 32">
116
+ <polyline points="0,24 19,20 38,22 57,14 76,16 95,8" fill="none" stroke="currentColor" stroke-width="2" />
117
+ </svg>
118
+ </u-info-field>
119
+ ```
120
+
121
+ ## Slots
122
+
123
+ | Slot | Description |
124
+ |------|-------------|
125
+ | (default) | The value, in place of the string `value` (the slot wins) |
126
+ | `trend-icon` | A status mark at the start of the trend line, drawn when there is a trend line |
127
+ | `visual` | A small picture at the end of the value line (sparkline, ring) — empty takes no room |
128
+
108
129
  ## CSS Parts
109
130
 
110
131
  | Part | Description |
@@ -112,6 +133,7 @@ the `trend-icon` slot:
112
133
  | `label` · `value` · `trend` | The label, the value, and the (optional) trend indicator |
113
134
  | `unit` | The unit, inside `value` (only when `unit` is set and the value is not blank) |
114
135
  | `description` | The supporting line (when `description` is set, or the value is blank and `blankReason` is set) |
136
+ | `visual` | The box holding the `visual` slot (not drawn when the slot is empty) |
115
137
 
116
138
  ## CSS Custom Properties
117
139
 
@@ -6,12 +6,15 @@
6
6
  interface SidebarLayoutConfig {
7
7
  type: 'sidebar';
8
8
 
9
- /** Icon name (string) | image ({ src, alt?, href? }) | custom render function. Click navigates to `/` by default, or `href` if given (image variant). */
10
- logo?: string | { src: string; alt?: string; href?: string } | ((state: SidebarState) => TemplateResult<1> | HTMLElement | string);
9
+ /** Icon name (string) | icon from a registered library ({ icon, lib? }) | image ({ src, alt?, href? }) | custom render function. Click navigates to `/` by default, or `href` if given (image variant). */
10
+ logo?: string | { icon: string; lib?: string } | { src: string; alt?: string; href?: string } | ((state: SidebarState) => TemplateResult<1> | HTMLElement | string);
11
11
 
12
12
  /** Application title displayed beside the logo. */
13
13
  title?: string;
14
14
 
15
+ /** One line under the title — what the app is. Shown in the expanded sidebar header only (hidden with the title when slim; the mobile header keeps one line). */
16
+ subtitle?: string;
17
+
15
18
  /** Main (top) navigation items. */
16
19
  main?: SidebarItem[];
17
20