@iyulab/modern-app 0.18.16 → 0.18.18

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,33 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.18.18] - 2026-09-04
4
+
5
+ ### Fixed
6
+
7
+ - **The React JSX declaration for `<u-info-field>`'s `value` prop was narrowed to
8
+ `string`, while the component's own class field type (`unknown`) and documented
9
+ behavior explicitly accept `null` and numbers.** TypeScript-strict consumers hit
10
+ `TS2322` passing a nullable or numeric value — a very common shape for
11
+ API-sourced data — even though rendering already coerces whatever is passed via
12
+ `String()`/the format helpers. Widened the JSX type to `unknown` to match. Added
13
+ a compile-only regression fixture (`tests/types/react-consumption.tsx`) covering
14
+ the `string | null` and `number | undefined` shapes that previously failed.
15
+
16
+ ## [0.18.17] - 2026-09-03
17
+
18
+ ### Fixed
19
+
20
+ - **`AppConfig.auth` (the boot-time auth gate) and its `AuthGateConfig`/`AuthGateContext`
21
+ types were entirely undocumented in both reference docs** — the feature has a full worked
22
+ example in the README but no type reference anywhere a consumer would look one up. Also
23
+ documented `app.user` (the authenticated-user getter), and added `enter`/`initialLoad`/
24
+ `useIntercept` — three more real `AppConfig` fields missing specifically from
25
+ `skills/modern-app/references/api.md`.
26
+ - **`FallbackRouteConfig.title` was dropped by `0.18.13`**, which only touched the `render`
27
+ callback's context type and didn't notice it removed the field. Restored in both docs.
28
+ Found by a new internal tool (`type-doc-check.js`) that diffs hand-copied TS interface doc
29
+ snippets against source.
30
+
3
31
  ## [0.18.16] - 2026-09-03
4
32
 
5
33
  ### Fixed
@@ -98,7 +98,9 @@ declare module 'react' {
98
98
  interface IntrinsicElements {
99
99
  'u-info-field': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
100
100
  label?: string;
101
- value?: string;
101
+ /** 클래스 필드와 동일하게 `unknown` — 렌더 로직이 `String(value)`/포맷터로 무엇이
102
+ * 오든 처리하므로 `null`·숫자를 그대로 넘길 수 있다(위 클래스 필드 JSDoc 참조). */
103
+ value?: unknown;
102
104
  blank?: string;
103
105
  numeric?: boolean;
104
106
  format?: InfoFieldFormat;
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.18.16",
4
+ "version": "0.18.18",
5
5
  "keywords": [
6
6
  "iyulab",
7
7
  "web-framework",
@@ -19,6 +19,18 @@ interface AppConfig {
19
19
  /** Fallback rendered on 404 or unhandled errors. */
20
20
  fallback?: FallbackRouteConfig;
21
21
 
22
+ /**
23
+ * Global auth/authorization guard, called before every navigation.
24
+ * `string` = redirect, `false` = cancel (403), `true`/undefined = proceed.
25
+ */
26
+ enter?: (ctx: RouteContext) => Promise<string | boolean> | string | boolean;
27
+
28
+ /** Auto-navigate to the current URL on load. Default: true */
29
+ initialLoad?: boolean;
30
+
31
+ /** Intercept `<a>` tag clicks for client-side routing. Default: true */
32
+ useIntercept?: boolean;
33
+
22
34
  /** Layout configuration. Currently only 'sidebar' is supported. */
23
35
  layout: LayoutConfig;
24
36
 
@@ -27,6 +39,12 @@ interface AppConfig {
27
39
 
28
40
  /** i18next options plus optional plugins array. Omit to skip i18n. */
29
41
  i18n?: I18nInitOptions;
42
+
43
+ /**
44
+ * Boot-time auth gate. When set, resolves the session via `me()` before the app shell
45
+ * is built. Omit for full backward compatibility (no gate). See `AuthGateConfig` below.
46
+ */
47
+ auth?: AuthGateConfig;
30
48
  }
31
49
  ```
32
50
 
@@ -162,6 +180,9 @@ interface RouteContext {
162
180
 
163
181
  ```typescript
164
182
  interface FallbackRouteConfig {
183
+ /** Sets `document.title` when the fallback renders. */
184
+ title?: string;
185
+
165
186
  render: (context: RouteContext & { error: RouteError }) => RenderResult | Promise<RenderResult>;
166
187
  }
167
188
  ```
@@ -196,6 +217,37 @@ interface NotificationOptions {
196
217
 
197
218
  ---
198
219
 
220
+ ## `AuthGateConfig` / `AuthGateContext`
221
+
222
+ The framework owns only the orchestration (check → branch → reload) — session lookup/login itself
223
+ (HTTP), the user/permission shape, and mid-session 401 handling belong to the app (or
224
+ `@iyulab/enterprise`'s `createAuthClient`/`createODataService`).
225
+
226
+ ```typescript
227
+ interface AuthGateConfig {
228
+ /** Resolve the current session. Return a value for authenticated, `null`/`undefined` for not. */
229
+ me: () => Promise<unknown | null | undefined> | unknown | null | undefined;
230
+
231
+ /**
232
+ * Renders login UI into `context.root` when unauthenticated. Call `context.onSuccess()` on
233
+ * success. Return a cleanup function to have it called on app load/`unload`.
234
+ */
235
+ renderLogin: (context: AuthGateContext) => (() => void) | void;
236
+
237
+ /** Called once authenticated, right before the app shell is built. */
238
+ onAuthenticated?: (user: unknown) => void | Promise<void>;
239
+ }
240
+
241
+ interface AuthGateContext {
242
+ /** Root element to render the login UI into (same as `AppConfig.root`, default `document.body`). */
243
+ root: Element;
244
+ /** Call on successful login — the app (re)loads and the shell appears. */
245
+ onSuccess: () => void;
246
+ }
247
+ ```
248
+
249
+ ---
250
+
199
251
  ## `app` singleton methods
200
252
 
201
253
  | Method | Signature | Description |
@@ -216,5 +268,6 @@ interface NotificationOptions {
216
268
  | `config` | `AppConfig \| undefined` | Current config passed to `load()` |
217
269
  | `router` | `Router \| undefined` | Underlying `@iyulab/router` instance |
218
270
  | `screen` | `ScreenSize \| undefined` | Current responsive screen size |
271
+ | `user` | `unknown` | Authenticated user when the `auth` boot gate is used; `undefined` if unauthenticated or unused |
219
272
  | `theme` | `Theme` (static) | Theme utility (`get`, `set`, `isInitialized`) |
220
273
  | `i18n` | `i18next` | Raw i18next instance |