@iyulab/modern-app 0.27.0 → 0.28.1

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,49 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.28.1] - 2026-09-24
4
+
5
+ ### Fixed
6
+
7
+ - **No logo, no logo element.** With no `logo` configured, the shell rendered an empty `u-icon` as
8
+ a placeholder. Even at zero width it took one gap in the header, indenting the title; with
9
+ `@iyulab/components` 1.46.0, where icons reserve their box before loading, it became an
10
+ invisible 24px box. It is gone — update both together if you do not configure a logo.
11
+ - `u-sidebar-link` now defines the `<u-link>` it renders instead of relying on the shell having
12
+ loaded the router first.
13
+
14
+ ## [0.28.0] - 2026-09-24
15
+
16
+ ### Added
17
+
18
+ - **`slot="notice"` on `u-sidebar-layout` — a place for app-level notices.** A connection-lost
19
+ banner or a new-version notice belongs to the shell, not to one screen; a screen that places its
20
+ own fixed banner collides with the next notice someone adds. Slotted notices stack at the top of
21
+ the route content, in flow (they scroll away with the content instead of holding a strip of a
22
+ small screen, and never cover it), each at the full content width. The stack takes no space
23
+ while empty and goes inert with the route content while the overlay is open. New `notices` part.
24
+
25
+ ### Changed
26
+
27
+ - **The shell now owns the overlay's keyboard contract.** It already made route content `inert`
28
+ while the overlay is open — and the control that opened the overlay lives in that content, so
29
+ its focus fell to `<body>` the moment the panel appeared. Every consumer re-implemented the same
30
+ three steps; the shell now does them:
31
+ - **focus moves into the panel** when it opens — an `[autofocus]` element, else the first input
32
+ control, else the close button. If you already moved focus into the panel, it stays there.
33
+ - **focus returns to the opening control** when it closes, if focus fell to `<body>`; if you
34
+ moved it elsewhere on purpose, that stands. With no opening control, it goes to `part="main"`.
35
+ - **Escape inside the panel fires `overlay-close`**, the same event as the close button — you
36
+ still empty the slot. An Escape already consumed inside the panel (an open list or popover)
37
+ closes only that layer.
38
+ Existing consumer code that does any of this itself keeps working: the shell steps aside when
39
+ focus is already where it would put it, and emptying the slot twice is harmless.
40
+ - Requires `@iyulab/components` 1.45.2 or later (`u-button.focus()`).
41
+
42
+ ### Fixed
43
+
44
+ - A route transition that completes while the overlay is open no longer pulls focus out of the
45
+ panel onto the (inert) route's scroll container.
46
+
3
47
  ## [0.27.0] - 2026-09-24
4
48
 
5
49
  ### Added
@@ -3,6 +3,7 @@ import t from "../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorate.js
3
3
  import { StyledElement as n } from "../internals/StyledElement.js";
4
4
  import { DEFAULT_NAV_ICON as r } from "../internals/nav-icon.js";
5
5
  import { styles as i } from "./SidebarLink.styles.js";
6
+ import "@iyulab/router";
6
7
  import { html as a, nothing as o } from "lit";
7
8
  import { customElement as s, property as c } from "lit/decorators.js";
8
9
  import "@iyulab/components/dist/components/icon/UIcon.js";
@@ -14,6 +14,14 @@ export declare class SidebarLayout extends StyledElement<SidebarParts> {
14
14
  progressBarEl: UProgressBar;
15
15
  /** overlay 슬롯 배정 상태 — CSS `:has()`로는 알 수 없다(`internals/slotted.ts` 참조). */
16
16
  private hasOverlay;
17
+ /** notice 슬롯 배정 상태 — 비었으면 스택 자체가 자리를 차지하지 않는다. */
18
+ private hasNotice;
19
+ /**
20
+ * 오버레이를 연 컨트롤 — 닫힐 때 포커스를 되돌릴 곳.
21
+ * ★슬롯 배정 «시점» 에 잡는다. 렌더가 본문에 `inert` 를 걸면 그 컨트롤이 쥐던 포커스는
22
+ * `<body>` 로 떨어지므로, `updated()` 에서 읽으면 이미 늦다.
23
+ */
24
+ private overlayTrigger;
17
25
  /**
18
26
  * `:state(overlay)`를 싣는 자리. `MasterDetailLayout`과 동일 패턴.
19
27
  * ⚠생성자에서 한 번만 붙인다 — `attachInternals()`는 같은 인스턴스에 두 번 부르면
@@ -93,6 +101,29 @@ export declare class SidebarLayout extends StyledElement<SidebarParts> {
93
101
  /** 라우트 에러 핸들러 */
94
102
  private handleRouteError;
95
103
  private handleOverlaySlotChange;
104
+ private handleNoticeSlotChange;
105
+ /** 오버레이 패널에 배정된 요소들 */
106
+ private overlayPanels;
107
+ /**
108
+ * 열린 패널로 포커스를 옮긴다 — 순서는 `UOverlayElement` 와 같다:
109
+ * `[autofocus]` → 첫 입력 컨트롤 → (없으면) 셸의 닫기 버튼.
110
+ * 닫기 버튼으로 떨어지는 것은 의도다 — 포커스가 `<body>` 에 남는 것보다 항상 낫고,
111
+ * 셸이 늘 가진 유일한 컨트롤이다. 소비자가 이미 패널 안으로 옮겨 두었으면 건드리지 않는다.
112
+ */
113
+ private focusOverlay;
114
+ /**
115
+ * 닫힌 뒤 포커스를 연 컨트롤로 되돌린다. 포커스가 `<body>` 로 떨어졌을 때만 —
116
+ * 소비자가 닫으며 다른 곳으로 옮겼다면 그것을 존중한다.
117
+ * 연 컨트롤이 없으면(프로그램이 연 경우) 메인 스크롤러로 — 라우트 완료 때와 같은 자리다.
118
+ */
119
+ private restoreOverlayFocus;
120
+ /**
121
+ * 패널 안의 Escape 는 닫기 버튼과 같은 `overlay-close` 를 낸다.
122
+ * window 버블 단계에서 받는다 — 패널 안의 목록·팝오버가 자기 층을 닫으며 먹은 키
123
+ * (`defaultPrevented`)는 그 층의 몫이다. 한 번의 Escape 는 한 층만 닫는다.
124
+ * 경로에 패널이 없으면(사이드바, 패널 위에 띄운 대화상자) 받지 않는다.
125
+ */
126
+ private handleOverlayEscape;
96
127
  private handleOverlayClose;
97
128
  /** .main 키보드 스크롤 핸들러 (WCAG 2.1 SC 2.1.1) */
98
129
  private _handleMainKeydown;
@@ -39,12 +39,25 @@ function T(e, t) {
39
39
  }
40
40
  return !0;
41
41
  }
42
- var E = class extends i {
42
+ function E() {
43
+ let e = document.activeElement;
44
+ for (; e?.shadowRoot?.activeElement;) e = e.shadowRoot.activeElement;
45
+ return e;
46
+ }
47
+ function D(e, t) {
48
+ let n = t;
49
+ for (; n;) {
50
+ if (n === e) return !0;
51
+ n = n.parentNode ?? n.host ?? null;
52
+ }
53
+ return !1;
54
+ }
55
+ var O = class extends i {
43
56
  static {
44
57
  b = this;
45
58
  }
46
59
  constructor(...t) {
47
- super(...t), this.state = "default", this.locale = "", this.hasOverlay = !1, this.internals = typeof this.attachInternals == "function" ? this.attachInternals() : void 0, this.context = null, this.unsizedWarnKey = `unsized:${++S}`, this.isMatchedLink = (e) => !this.context || !e ? !1 : (e = typeof e == "string" ? new URLPattern(e, window.location.origin) : e, e.test(this.context.path, window.location.origin)), this.handleToggleButtonClick = () => {
60
+ super(...t), this.state = "default", this.locale = "", this.hasOverlay = !1, this.hasNotice = !1, this.overlayTrigger = null, this.internals = typeof this.attachInternals == "function" ? this.attachInternals() : void 0, this.context = null, this.unsizedWarnKey = `unsized:${++S}`, this.isMatchedLink = (e) => !this.context || !e ? !1 : (e = typeof e == "string" ? new URLPattern(e, window.location.origin) : e, e.test(this.context.path, window.location.origin)), this.handleToggleButtonClick = () => {
48
61
  let t = this.screenSize ?? e.screen ?? "large";
49
62
  t === "large" ? this.state = this.state === "default" ? "slim" : "default" : t === "medium" ? this.state = this.state === "slim" ? "modal" : "slim" : t === "small" ? this.state = this.state === "mobile" ? "mobile-open" : "mobile" : console.warn("Unknown screen size:", t);
50
63
  }, this.handleBackdropClick = () => {
@@ -58,13 +71,24 @@ var E = class extends i {
58
71
  this.progressBarEl.removeAttribute("visible");
59
72
  }, 300);
60
73
  let t = this.shadowRoot?.querySelector(".main");
61
- t && (this.config?.scrollBehavior?.(e.context, t), t.focus({ preventScroll: !0 }));
74
+ t && (this.config?.scrollBehavior?.(e.context, t), this.hasOverlay || t.focus({ preventScroll: !0 }));
62
75
  }, this.handleRouteError = (e) => {
63
76
  this.progressBarEl.status = "error", this.progressBarEl.value = 100, setTimeout(() => {
64
77
  this.progressBarEl.removeAttribute("visible"), this.progressBarEl.status = "default";
65
78
  }, 300);
66
79
  }, this.handleOverlaySlotChange = (e) => {
67
- this.hasOverlay = o(e.target);
80
+ let t = o(e.target);
81
+ if (t && !this.hasOverlay) {
82
+ let e = E();
83
+ this.overlayTrigger = e && e !== document.body ? e : null;
84
+ }
85
+ this.hasOverlay = t;
86
+ }, this.handleNoticeSlotChange = (e) => {
87
+ this.hasNotice = o(e.target);
88
+ }, this.handleOverlayEscape = (e) => {
89
+ if (e.key !== "Escape" || e.defaultPrevented || e.isComposing || !this.hasOverlay) return;
90
+ let t = this.shadowRoot?.querySelector(".overlay");
91
+ t && e.composedPath().includes(t) && (e.preventDefault(), this.handleOverlayClose());
68
92
  }, this.handleOverlayClose = () => {
69
93
  this.fire("overlay-close", { cancelable: !1 });
70
94
  }, this._handleMainKeydown = (e) => {
@@ -111,13 +135,13 @@ var E = class extends i {
111
135
  super.connectedCallback(), window.addEventListener("route-begin", this.handleRouteBegin), window.addEventListener("route-done", this.handleRouteDone), window.addEventListener("route-progress", this.handleRouteProgress), window.addEventListener("route-error", this.handleRouteError), window.addEventListener("screen-resize", this.handleScreenResize);
112
136
  }
113
137
  disconnectedCallback() {
114
- window.removeEventListener("route-begin", this.handleRouteBegin), window.removeEventListener("route-done", this.handleRouteDone), window.removeEventListener("route-progress", this.handleRouteProgress), window.removeEventListener("route-error", this.handleRouteError), window.removeEventListener("screen-resize", this.handleScreenResize), super.disconnectedCallback();
138
+ window.removeEventListener("route-begin", this.handleRouteBegin), window.removeEventListener("route-done", this.handleRouteDone), window.removeEventListener("route-progress", this.handleRouteProgress), window.removeEventListener("route-error", this.handleRouteError), window.removeEventListener("screen-resize", this.handleScreenResize), window.removeEventListener("keydown", this.handleOverlayEscape), super.disconnectedCallback();
115
139
  }
116
140
  willUpdate(e) {
117
141
  super.willUpdate(e), e.has("config") && (this.styles = this.config?.styles);
118
142
  }
119
143
  updated(e) {
120
- super.updated(e), e.has("hasOverlay") && this.internals?.states?.[this.hasOverlay ? "add" : "delete"]("overlay");
144
+ super.updated(e), e.has("hasOverlay") && (this.internals?.states?.[this.hasOverlay ? "add" : "delete"]("overlay"), this.hasOverlay ? (window.addEventListener("keydown", this.handleOverlayEscape), this.focusOverlay()) : e.get("hasOverlay") === !0 && (window.removeEventListener("keydown", this.handleOverlayEscape), this.restoreOverlayFocus()));
121
145
  }
122
146
  firstUpdated(e) {
123
147
  super.firstUpdated(e), this.warnIfUnsized();
@@ -183,6 +207,9 @@ var E = class extends i {
183
207
  <u-progress-bar part="progress"></u-progress-bar>
184
208
 
185
209
  <div class="main-content" part="main-content" ?inert=${this.hasOverlay}>
210
+ <div class="notices ${this.hasNotice ? "" : "empty"}" part="notices">
211
+ <slot name="notice" @slotchange=${this.handleNoticeSlotChange}></slot>
212
+ </div>
186
213
  <slot></slot>
187
214
  </div>
188
215
  </div>
@@ -284,7 +311,7 @@ var E = class extends i {
284
311
  .fallback=${s}
285
312
  ></u-icon>
286
313
  </u-link>
287
- ` : l`<u-icon class="logo"></u-icon>`;
314
+ ` : u;
288
315
  if (typeof e == "function") {
289
316
  let n = e(this.state);
290
317
  return l`
@@ -304,10 +331,32 @@ var E = class extends i {
304
331
  </u-link>
305
332
  `;
306
333
  }
334
+ overlayPanels() {
335
+ return (this.shadowRoot?.querySelector("slot[name=\"overlay\"]"))?.assignedElements({ flatten: !0 }) ?? [];
336
+ }
337
+ focusOverlay() {
338
+ let e = this.overlayPanels(), t = E();
339
+ if (t && e.some((e) => D(e, t))) return;
340
+ let n = (t) => {
341
+ for (let n of e) {
342
+ if (n.matches(t)) return n;
343
+ let e = n.querySelector(t);
344
+ if (e) return e;
345
+ }
346
+ return null;
347
+ };
348
+ (n("[autofocus]") ?? n("input, select, textarea, u-input, u-textarea, u-select, u-checkbox, u-radio, u-switch, u-slider") ?? this.shadowRoot?.querySelector(".overlay-close"))?.focus();
349
+ }
350
+ restoreOverlayFocus() {
351
+ let e = this.overlayTrigger;
352
+ this.overlayTrigger = null;
353
+ let t = E();
354
+ t && t !== document.body || (e?.isConnected ? e.focus() : this.mainElement?.focus({ preventScroll: !0 }));
355
+ }
307
356
  };
308
357
  r([f({
309
358
  type: String,
310
359
  reflect: !0
311
- }), n("design:type", Object)], E.prototype, "state", void 0), r([f({ type: Object }), n("design:type", Object)], E.prototype, "config", void 0), r([f({ type: String }), n("design:type", Object)], E.prototype, "locale", void 0), r([p("u-progress-bar"), n("design:type", y === void 0 ? Object : y)], E.prototype, "progressBarEl", void 0), r([m(), n("design:type", Object)], E.prototype, "hasOverlay", void 0), r([m(), n("design:type", Object)], E.prototype, "context", void 0), E = b = r([d("u-sidebar-layout")], E);
360
+ }), n("design:type", Object)], O.prototype, "state", void 0), r([f({ type: Object }), n("design:type", Object)], O.prototype, "config", void 0), r([f({ type: String }), n("design:type", Object)], O.prototype, "locale", void 0), r([p("u-progress-bar"), n("design:type", y === void 0 ? Object : y)], O.prototype, "progressBarEl", void 0), r([m(), n("design:type", Object)], O.prototype, "hasOverlay", void 0), r([m(), n("design:type", Object)], O.prototype, "hasNotice", void 0), r([m(), n("design:type", Object)], O.prototype, "context", void 0), O = b = r([d("u-sidebar-layout")], O);
312
361
  //#endregion
313
- export { E as SidebarLayout };
362
+ export { O as SidebarLayout };
@@ -211,6 +211,31 @@ var t = e`
211
211
  height: 100%;
212
212
  }
213
213
 
214
+ /*
215
+ * 앱 수준 공지 스택 — 한 화면이 아니라 셸에 속한다.
216
+ * 본문 맨 위 «흐름 안»에 둔다. 세 대안을 소비자가 먼저 실측해 기각했다:
217
+ * · fixed → 본문을 덮는다.
218
+ * · 셸 바깥 흐름 → 셸 높이에 더해져 이중 스크롤.
219
+ * · .main 안 sticky → 좁은 화면에서 공지 둘이 상시 3할을 점유한다. 배너는
220
+ * «막지 않는 것»이 값이라 상시 점유가 그 값을 깎는다.
221
+ * .main-content 안에 있으므로 오버레이가 열리면 본문과 함께 inert 가 된다.
222
+ * 폭은 스택이 정한다 — 공지(u-alert)는 자기 폭이 fit-content 라 문구 길이대로
223
+ * 들쭉날쭉해진다. 배치 컨테이너의 결정이다.
224
+ */
225
+ .notices {
226
+ display: flex;
227
+ flex-direction: column;
228
+ gap: var(--u-space-sm, 8px);
229
+ margin-bottom: var(--u-space-lg, 16px);
230
+ }
231
+ .notices.empty {
232
+ display: none;
233
+ }
234
+ slot[name="notice"]::slotted(*) {
235
+ width: 100%;
236
+ box-sizing: border-box;
237
+ }
238
+
214
239
  /*
215
240
  * 오버레이가 열린 동안 «본문 영역»을 스태킹 컨텍스트로 만든다.
216
241
  *
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.27.0",
4
+ "version": "0.28.1",
5
5
  "keywords": [
6
6
  "iyulab",
7
7
  "web-framework",
@@ -64,7 +64,7 @@
64
64
  "lit": "^3.3.3"
65
65
  },
66
66
  "peerDependencies": {
67
- "@iyulab/components": ">=1.45.0",
67
+ "@iyulab/components": ">=1.45.2",
68
68
  "@lit/react": ">=1.0.8",
69
69
  "react": ">=18.0.0"
70
70
  },
@@ -89,6 +89,6 @@
89
89
  "vite": "^8.1.4",
90
90
  "vite-plugin-dts": "^5.0.3",
91
91
  "vitest": "^5.0.0",
92
- "@iyulab/components": ">=1.42.0"
92
+ "@iyulab/components": ">=1.45.2"
93
93
  }
94
94
  }
@@ -264,6 +264,7 @@ Parts available for `styles` overrides on the root layout:
264
264
  | `progress` | Top progress bar |
265
265
  | `overlay` | Route-independent overlay panel above `main` |
266
266
  | `overlay-close` | Overlay's close button |
267
+ | `notices` | Stack of app-level notices at the top of the route content (`slot="notice"`) |
267
268
 
268
269
  ---
269
270
 
@@ -350,9 +351,9 @@ from either re-implementing what the shell already does, or dropping what it doe
350
351
  | Making route content non-interactive | shell | `inert` on `part="main-content"`, which propagates through the slot into your route content |
351
352
  | A close affordance | shell | `part="overlay-close"`, firing the non-cancelable `overlay-close` event |
352
353
  | Keeping the route mounted underneath | shell | the overlay is independent of routing |
353
- | **Moving focus into the panel when it opens** | **consumer** | focus the panel or its first control yourself |
354
- | **Restoring focus when it closes** | **consumer** | remember the trigger and re-focus it |
355
- | **Escape to close** | **consumer** | the shell binds no key; listen for it and empty the slot |
354
+ | Moving focus into the panel when it opens | shell | an `[autofocus]` element in your panel, else its first input control, else `part="overlay-close"`. If you already moved focus into the panel, the shell leaves it there |
355
+ | Restoring focus when it closes | shell | back to the control that held focus when the panel opened — only if focus fell to `<body>`; if you moved it somewhere on purpose, that stands. With no such control (opened from code), focus goes to `part="main"` |
356
+ | Escape to close | shell | Escape inside the panel fires the same `overlay-close` as the button — you still empty the slot. An Escape already consumed inside the panel (an open list or popover calling `preventDefault()`) closes only that layer |
356
357
  | **A backdrop / dimmed scrim** | **consumer** | the panel is opaque and full-bleed by design; add a scrim inside your panel if you want one |
357
358
  | **Announcing the panel to assistive tech** | **consumer** | put `role`/`aria-label` (or `aria-modal`, if you have made it modal) on *your* panel — the shell does not know what it holds |
358
359
 
@@ -371,6 +372,29 @@ No `overlayBreakpoint`/responsive toggle exists here — unlike `u-master-detail
371
372
  overlay is always an overlay, never a side-by-side pane. Use `u-master-detail-layout` instead
372
373
  when you want the panel to sit *beside* content on wide screens.
373
374
 
375
+
376
+ ## App-level notices
377
+
378
+ App-level notices — the server is unreachable, a new version is ready — belong to the shell, not to
379
+ one screen: a screen that places its own fixed banner collides with the next notice someone adds.
380
+ Put them in `slot="notice"`; the shell stacks them at the top of the route content.
381
+
382
+ ```html
383
+ <u-sidebar-layout>
384
+ <u-alert slot="notice" status="warning" open>Server unreachable — retrying.</u-alert>
385
+ <u-alert slot="notice" status="info" open closable>A new version is ready.</u-alert>
386
+ </u-sidebar-layout>
387
+ ```
388
+
389
+ - **In flow, above the route content.** Notices scroll away with the content rather than holding a
390
+ strip of a small screen, and they never cover it. A banner's value is that it does not block;
391
+ a permanently pinned stack would eat into that on a phone.
392
+ - **Full width.** Each notice takes the width of the content box, whatever its text length.
393
+ - **Empty takes no space** — the stack has no margin while nothing is slotted.
394
+ - **Inert with the route content** while the overlay is open.
395
+ - Which surface a notice is (toast, banner or modal) is decided by *who ends it* — a notice the time
396
+ ends is a toast (`app.success`), not a slotted banner.
397
+
374
398
  ## Responsive behaviour
375
399
 
376
400
  | Screen width | Sidebar state |