@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.
- package/CHANGELOG.md +38 -0
- package/dist/App.js +1 -2
- package/dist/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/decorate.js +1 -2
- package/dist/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/decorateMetadata.js +1 -2
- package/dist/components/ActionBar.js +3 -4
- package/dist/components/ActionBar.styles.js +1 -2
- package/dist/components/EmptyState.js +3 -4
- package/dist/components/EmptyState.styles.js +1 -2
- package/dist/components/GroupBox.js +3 -4
- package/dist/components/GroupBox.styles.js +1 -2
- package/dist/components/InfoField.d.ts +5 -0
- package/dist/components/InfoField.js +25 -19
- package/dist/components/InfoField.styles.js +20 -2
- package/dist/components/InfoSection.js +3 -4
- package/dist/components/InfoSection.styles.js +1 -2
- package/dist/components/MasterDetailLayout.js +3 -4
- package/dist/components/MasterDetailLayout.styles.js +1 -2
- package/dist/components/PageHeader.js +3 -4
- package/dist/components/PageHeader.styles.js +1 -2
- package/dist/components/SidebarButton.js +3 -4
- package/dist/components/SidebarButton.styles.js +1 -2
- package/dist/components/SidebarGroup.d.ts +9 -0
- package/dist/components/SidebarGroup.js +17 -14
- package/dist/components/SidebarGroup.styles.js +1 -2
- package/dist/components/SidebarLink.d.ts +6 -0
- package/dist/components/SidebarLink.js +16 -14
- package/dist/components/SidebarLink.styles.js +1 -2
- package/dist/components/SidebarSection.js +3 -4
- package/dist/components/SidebarSection.styles.js +1 -2
- package/dist/components/Timeline.js +2 -3
- package/dist/components/Timeline.styles.js +1 -2
- package/dist/components/TimelineItem.js +3 -4
- package/dist/components/TimelineItem.styles.js +1 -2
- package/dist/components/Wizard.js +3 -4
- package/dist/components/Wizard.styles.js +1 -2
- package/dist/defaultFallback.js +1 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -2
- package/dist/internals/ScreenObserver.js +1 -2
- package/dist/internals/StyledElement.js +3 -4
- package/dist/internals/locale.js +1 -2
- package/dist/internals/nav-icon.js +1 -2
- package/dist/internals/slotted.js +1 -2
- package/dist/layouts/SidebarLayout.d.ts +10 -0
- package/dist/layouts/SidebarLayout.js +27 -9
- package/dist/layouts/SidebarLayout.styles.js +31 -7
- package/dist/layouts/SidebarLayout.types.d.ts +16 -2
- package/dist/layouts/filterSidebarItems.js +1 -2
- package/dist/react.js +1 -2
- package/dist/translate.js +0 -1
- package/dist/unsaved.js +19 -9
- package/package.json +1 -1
- package/skills/modern-app/references/components/info-field.md +22 -0
- 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
|
-
|
|
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(),
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
@@ -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
|
|