@iyulab/router 0.11.3 → 0.11.5

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,32 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.11.5] - 2026-09-10
4
+
5
+ ### Fixed
6
+
7
+ - **`u-error-page`'s three colour hooks were documented as having no default.** They were
8
+ described as falling back to the inherited colour, when the host block in fact declares a
9
+ concrete colour for each — `--error-icon-color` `#4a5568` (dark `#a0aec0`),
10
+ `--error-code-color` `#1a202c` (dark `#f7fafc`), `--error-message-color` `#718096`
11
+ (dark `#cbd5e0`). A consumer reading the old text would expect the page to pick up the
12
+ surrounding colour and find that it does not. The documentation now also states the
13
+ consequence those literals carry: this page does not follow the host application's design
14
+ tokens, and replacing it wholesale is what `fallback.render` is for. No behaviour changed.
15
+
16
+ ## [0.11.4] - 2026-09-01
17
+
18
+ ### Fixed
19
+
20
+ - **Three error messages gave no way to act on the failure.** `UOutlet.render()`
21
+ threw a generic "not supported content type" without saying what type it
22
+ actually received or what's supported; `getRoutes()` threw a garbled,
23
+ comma-spliced message that leaked an internal function name
24
+ (`setRoutes`) instead of the actual `path` value; and a route whose
25
+ `render()` returned a non-renderable value threw "Failed to load content
26
+ for the route." with no route path or id to identify which route failed.
27
+ All three now interpolate the actual value/route and name the expected
28
+ shape.
29
+
3
30
  ## [0.11.3] - 2026-08-31
4
31
 
5
32
  ### Fixed
@@ -9,9 +9,13 @@ import { TemplateResult } from 'lit-html';
9
9
  * 아니다. 다만 라우팅 실패 시 실제 DOM에 렌더되므로, 기본 화면의 색만 가볍게
10
10
  * 맞추고 싶은 소비자를 위해 세 색상 훅을 남겨 둔다(전체 교체는 `fallback.render`).
11
11
  *
12
- * @cssprop --error-icon-color - 아이콘 색. 기본값 없음(미지정 시 상속된 색 사용)
13
- * @cssprop --error-code-color - 에러 코드 텍스트 색. 기본값 없음(미지정 시 상속된 색 사용)
14
- * @cssprop --error-message-color - 에러 메시지 텍스트 색. 기본값 없음(미지정 시 상속된 색 사용)
12
+ * @cssprop --error-icon-color - 아이콘 색. 기본값 `#4a5568`(다크 `#a0aec0`)
13
+ * @cssprop --error-code-color - 에러 코드 텍스트 색. 기본값 `#1a202c`(다크 `#f7fafc`)
14
+ * @cssprop --error-message-color - 에러 메시지 텍스트 색. 기본값 `#718096`(다크 `#cbd5e0`)
15
+ *
16
+ * ⚠세 값은 아래 `static styles` 의 `:host` 에서 **구체적인 색으로 선언된다** — 지정하지
17
+ * 않으면 주변 색을 상속하는 것이 아니라 위 기본값이 적용된다. 리터럴이므로 이 페이지는
18
+ * 호스트 앱의 디자인 토큰을 따르지 않는다.
15
19
  */
16
20
  export declare class UErrorPage extends LitElement {
17
21
  constructor(error?: RouteError);
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as isExternalUrl, i as absolutePath, n as __decorate, o as parseUrl, r as __decorateMetadata, s as UOutlet, t as ULink } from "./share-iJLbxFbJ.js";
1
+ import { a as isExternalUrl, i as absolutePath, n as __decorate, o as parseUrl, r as __decorateMetadata, s as UOutlet, t as ULink } from "./share-DyVUteH9.js";
2
2
  import { LitElement, css, html } from "lit";
3
3
  import { customElement, property } from "lit/decorators.js";
4
4
  //#region src/types/RouteError.ts
@@ -343,7 +343,7 @@ function getRoutes(routes, pathname) {
343
343
  }
344
344
  if (route.path instanceof URLPattern) {
345
345
  if (route.path.test({ pathname })) return [route];
346
- } else throw new Error("Route path must be an instance of URLPattern, Something wrong in setRoutes function.");
346
+ } else throw new Error(`Route "path" must be a URLPattern, but got ${JSON.stringify(route.path)}. Routes passed to the Router must go through its normal config flow (new Router({ routes: [...] })), which normalizes string paths into URLPattern before matching — a route object was matched before that step ran.`);
347
347
  }
348
348
  return [];
349
349
  }
@@ -510,7 +510,7 @@ var Router = class {
510
510
  let content;
511
511
  try {
512
512
  content = await route.render(context);
513
- if (content === false || content === void 0 || content === null) throw new Error("Failed to load content for the route.");
513
+ if (content === false || content === void 0 || content === null) throw new Error(`Route render() returned ${content === false ? "false" : String(content)} for "${context.pathname}"${route.id ? ` (route id: "${route.id}")` : ""} — a route's render() must return an HTMLElement, a Lit TemplateResult, or a React element.`);
514
514
  } catch (e) {
515
515
  throw new ContentLoadError(e);
516
516
  }
package/dist/react.js CHANGED
@@ -1,4 +1,4 @@
1
- import { s as UOutlet$1, t as ULink$1 } from "./share-iJLbxFbJ.js";
1
+ import { s as UOutlet$1, t as ULink$1 } from "./share-DyVUteH9.js";
2
2
  import React from "react";
3
3
  import { createComponent } from "@lit/react";
4
4
  //#region src/react.ts
@@ -23,7 +23,10 @@ var UOutlet = class extends HTMLElement {
23
23
  const { createRoot } = await import("react-dom/client");
24
24
  this.root = createRoot(this);
25
25
  this.root.render(value);
26
- } else throw new Error("not supported content type for Outlet rendering.");
26
+ } else {
27
+ const receivedType = value?.constructor?.name ?? typeof value;
28
+ throw new Error(`Unsupported content type for Outlet rendering: received ${receivedType}. Expected an HTMLElement, a Lit TemplateResult, or a React element.`);
29
+ }
27
30
  }
28
31
  /**
29
32
  * 기존 DOM을 삭제하여, 초기 상태로 되돌립니다.
@@ -1023,12 +1026,12 @@ function catchBasepath(basepath) {
1023
1026
  return basepath;
1024
1027
  }
1025
1028
  //#endregion
1026
- //#region \0@oxc-project+runtime@0.147.0/helpers/esm/decorateMetadata.js
1029
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorateMetadata.js
1027
1030
  function __decorateMetadata(k, v) {
1028
1031
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1029
1032
  }
1030
1033
  //#endregion
1031
- //#region \0@oxc-project+runtime@0.147.0/helpers/esm/decorate.js
1034
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
1032
1035
  function __decorate(decorators, target, key, desc) {
1033
1036
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1034
1037
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iyulab/router",
3
- "version": "0.11.3",
3
+ "version": "0.11.5",
4
4
  "description": "A modern client-side router for web applications with support for Lit and React components",
5
5
  "keywords": [
6
6
  "lit",
@@ -47,7 +47,7 @@
47
47
  }
48
48
  },
49
49
  "scripts": {
50
- "preversion": "node ../../scripts/preversion-check.mjs",
50
+ "preversion": "node -e \"if(require('fs').existsSync('../../scripts/preversion-check.mjs'))require('child_process').execFileSync('node',['../../scripts/preversion-check.mjs'],{stdio:'inherit'})\"",
51
51
  "test": "vitest run",
52
52
  "build": "npm run typecheck && vite build",
53
53
  "test:watch": "vitest",
@@ -75,7 +75,7 @@
75
75
  "@types/react": "^19.2.17",
76
76
  "@types/react-dom": "^19.2.3",
77
77
  "happy-dom": "^20.10.6",
78
- "typescript": "^5.9.3",
78
+ "typescript": "^6.0.2",
79
79
  "vite": "^8.1.4",
80
80
  "vite-plugin-dts": "^5.0.3",
81
81
  "vitest": "^4.1.10"
@@ -49,11 +49,16 @@ A parent route must render `<u-outlet>` to host child route content.
49
49
  custom properties are available to lightly restyle it without replacing
50
50
  `fallback.render` entirely:
51
51
 
52
- | Custom Property | Description | Default |
53
- | --- | --- | --- |
54
- | `--error-icon-color` | Icon color | none inherits the ambient text color |
55
- | `--error-code-color` | Error code text color | none inherits the ambient text color |
56
- | `--error-message-color` | Error message text color | none inherits the ambient text color |
52
+ | Custom Property | Description | Default (light) | Default (dark) |
53
+ | --- | --- | --- | --- |
54
+ | `--error-icon-color` | Icon color | `#4a5568` | `#a0aec0` |
55
+ | `--error-code-color` | Error code text color | `#1a202c` | `#f7fafc` |
56
+ | `--error-message-color` | Error message text color | `#718096` | `#cbd5e0` |
57
+
58
+ The defaults are concrete colors set on `:host`, not inherited — the dark column applies
59
+ under `prefers-color-scheme: dark`. Because they are literals rather than design tokens,
60
+ this page does not follow a host application's theme; set the three properties (or supply
61
+ your own `fallback.render`) if it has to.
57
62
 
58
63
  ```css
59
64
  u-error-page {