@iyulab/router 0.5.2 โ†’ 0.6.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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 iyulab
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ MIT License
2
+
3
+ Copyright (c) 2025 iyulab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
package/README.md CHANGED
@@ -1,163 +1,149 @@
1
- # @iyulab/router
2
-
3
- A modern, lightweight client-side router for web applications with support for both Lit and React components.
4
-
5
- ## Features
6
-
7
- - ๐Ÿš€ **Modern URLPattern-based routing** - Uses native URLPattern API for powerful path matching
8
- - ๐Ÿ”ง **Unified Framework Support** - Works with both Lit and React components using render functions
9
- - ๐Ÿ“ฑ **Client-side Navigation** - History API integration with browser back/forward support
10
- - ๐ŸŽฏ **Nested Routing** - Support for deeply nested route hierarchies with index and path routes
11
- - ๐Ÿ”— **Smart Link Component** - Automatic external link detection and handling
12
- - ๐Ÿ“Š **Route Events** - Track navigation progress with route-begin, route-done, and route-error events
13
- - ๐ŸŽจ **Flexible Outlet System** - Unified rendering with renderContent method
14
- - ๐ŸŒ **Global Route Access** - Access current route information anywhere via `window.route`
15
- - ๐Ÿ”„ **Force Re-rendering** - Control component re-rendering on route changes
16
- - โš ๏ธ **Enhanced Error Handling** - Built-in ErrorPage component with improved styling
17
-
18
- ## Installation
19
-
20
- ```bash
21
- npm install @iyulab/router
22
- ```
23
-
24
- ## Quick Start
25
-
26
- ### Basic Setup
27
-
28
- ```typescript
29
- import { Router } from '@iyulab/router';
30
- import { html } from 'lit';
31
-
32
- const router = new Router({
33
- root: document.getElementById('app')!,
34
- basepath: '/app',
35
- routes: [
36
- {
37
- index: true,
38
- render: () => html`<home-page></home-page>`
39
- },
40
- {
41
- path: '/user/:id',
42
- render: (routeInfo) => html`<user-page .userId=${routeInfo.params.id}></user-page>`
43
- }
44
- ]
45
- });
46
-
47
- // Start routing
48
- router.go(window.location.href);
49
- ```
50
-
51
- ### Nested Routes
52
-
53
- ```typescript
54
- const routes = [
55
- {
56
- path: '/dashboard',
57
- render: () => html`<dashboard-layout><u-outlet></u-outlet></dashboard-layout>`,
58
- children: [
59
- {
60
- index: true, // Matches /dashboard exactly
61
- render: () => html`<dashboard-home></dashboard-home>`
62
- },
63
- {
64
- path: 'settings',
65
- render: () => html`<dashboard-settings></dashboard-settings>`
66
- }
67
- ]
68
- }
69
- ];
70
- ```
71
-
72
- ### Mixed Framework Support
73
-
74
- ```typescript
75
- import React from 'react';
76
-
77
- const routes = [
78
- // Lit component
79
- {
80
- path: '/lit-page',
81
- render: (routeInfo) => html`<my-lit-component .routeInfo=${routeInfo}></my-lit-component>`
82
- },
83
- // React component
84
- {
85
- path: '/react-page',
86
- render: (routeInfo) => React.createElement(MyReactComponent, { routeInfo })
87
- },
88
- // HTML element
89
- {
90
- path: '/element-page',
91
- render: (routeInfo) => {
92
- const element = document.createElement('my-element');
93
- element.data = routeInfo.params;
94
- return element;
95
- }
96
- }
97
- ];
98
- ```
99
-
100
- ## Usage Examples
101
-
102
- ### Using with Lit Components
103
-
104
- ```typescript
105
- import { LitElement, html } from 'lit';
106
- import { customElement } from 'lit/decorators.js';
107
-
108
- @customElement('app-root')
109
- export class AppRoot extends LitElement {
110
- render() {
111
- return html`
112
- <nav>
113
- <u-link href="/">Home</u-link>
114
- <u-link href="/about">About</u-link>
115
- <u-link href="/user/123">User Profile</u-link>
116
- </nav>
117
- <main>
118
- <u-outlet></u-outlet>
119
- </main>
120
- `;
121
- }
122
- }
123
- ```
124
-
125
- ### Using with React Components
126
-
127
- ```tsx
128
- import React from 'react';
129
- import { Outlet, Link } from '@iyulab/router';
130
-
131
- export function AppRoot() {
132
- return (
133
- <div>
134
- <nav>
135
- <Link href="/">Home</Link>
136
- <Link href="/about">About</Link>
137
- <Link href="/user/123">User Profile</Link>
138
- </nav>
139
- <main>
140
- <Outlet />
141
- </main>
142
- </div>
143
- );
144
- }
145
- ```
146
-
147
- ## Browser Support
148
-
149
- - **URLPattern API**: Required for routing functionality
150
- - **Modern browsers**: Chrome 95+, Firefox 106+, Safari 16.4+
151
- - **Polyfill**: Consider using [urlpattern-polyfill](https://www.npmjs.com/package/urlpattern-polyfill) for older browsers
152
-
153
- ## Contributing
154
-
155
- 1. Fork the repository
156
- 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
157
- 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
158
- 4. Push to the branch (`git push origin feature/amazing-feature`)
159
- 5. Open a Pull Request
160
-
161
- ## License
162
-
1
+ # @iyulab/router
2
+
3
+ A modern, lightweight client-side router for web applications with support for both Lit and React components.
4
+
5
+ ## Features
6
+
7
+ - ๐Ÿš€ **Modern URLPattern-based routing** - Uses native URLPattern API for powerful path matching
8
+ - ๐Ÿ”ง **Unified Framework Support** - Works with both Lit and React components using render functions
9
+ - ๐Ÿ“ฑ **Client-side Navigation** - History API integration with browser back/forward support
10
+ - ๐ŸŽฏ **Nested Routing** - Support for deeply nested route hierarchies with index and path routes
11
+ - ๐Ÿ”— **Smart Link Component** - Automatic external link detection and handling
12
+ - ๐Ÿ“Š **Route Events** - Track navigation progress with route-begin, route-done, and route-error events
13
+ - ๐ŸŽจ **Flexible Outlet System** - Unified rendering with renderContent method
14
+ - ๐ŸŒ **Global Route Access** - Access current route information anywhere via `window.route`
15
+ - ๐Ÿ”„ **Force Re-rendering** - Control component re-rendering on route changes
16
+ - โš ๏ธ **Enhanced Error Handling** - Built-in ErrorPage component with improved styling
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ npm install @iyulab/router
22
+ ```
23
+
24
+ ## Quick Start
25
+
26
+ ### Basic Setup
27
+
28
+ ```typescript
29
+ import { Router } from '@iyulab/router';
30
+ import { html } from 'lit';
31
+
32
+ const router = new Router({
33
+ root: document.getElementById('app')!,
34
+ basepath: '/app',
35
+ routes: [
36
+ {
37
+ index: true,
38
+ render: () => html`<home-page></home-page>`
39
+ },
40
+ {
41
+ path: '/user/:id',
42
+ render: (routeInfo) => html`<user-page .userId=${routeInfo.params.id}></user-page>`
43
+ }
44
+ ]
45
+ });
46
+
47
+ // Start routing
48
+ router.go(window.location.href);
49
+ ```
50
+
51
+ ### Nested Routes
52
+
53
+ ```typescript
54
+ const routes = [
55
+ {
56
+ path: '/dashboard',
57
+ render: () => html`<dashboard-layout><u-outlet></u-outlet></dashboard-layout>`,
58
+ children: [
59
+ {
60
+ index: true, // Matches /dashboard exactly
61
+ render: () => html`<dashboard-home></dashboard-home>`
62
+ },
63
+ {
64
+ path: 'settings',
65
+ render: () => html`<dashboard-settings></dashboard-settings>`
66
+ }
67
+ ]
68
+ }
69
+ ];
70
+ ```
71
+
72
+ ### Mixed Framework Support
73
+
74
+ ```typescript
75
+ import React from 'react';
76
+
77
+ const routes = [
78
+ // Lit component
79
+ {
80
+ path: '/lit-page',
81
+ render: (routeInfo) => html`<my-lit-component .routeInfo=${routeInfo}></my-lit-component>`
82
+ },
83
+ // React component
84
+ {
85
+ path: '/react-page',
86
+ render: (routeInfo) => React.createElement(MyReactComponent, { routeInfo })
87
+ },
88
+ // HTML element
89
+ {
90
+ path: '/element-page',
91
+ render: (routeInfo) => {
92
+ const element = document.createElement('my-element');
93
+ element.data = routeInfo.params;
94
+ return element;
95
+ }
96
+ }
97
+ ];
98
+ ```
99
+
100
+ ## Usage Examples
101
+
102
+ ### Using with Lit Components
103
+
104
+ ```typescript
105
+ import { LitElement, html } from 'lit';
106
+ import { customElement } from 'lit/decorators.js';
107
+
108
+ @customElement('app-root')
109
+ export class AppRoot extends LitElement {
110
+ render() {
111
+ return html`
112
+ <nav>
113
+ <u-link href="/">Home</u-link>
114
+ <u-link href="/about">About</u-link>
115
+ <u-link href="/user/123">User Profile</u-link>
116
+ </nav>
117
+ <main>
118
+ <u-outlet></u-outlet>
119
+ </main>
120
+ `;
121
+ }
122
+ }
123
+ ```
124
+
125
+ ### Using with React Components
126
+
127
+ ```tsx
128
+ import React from 'react';
129
+ import { UOutlet, ULink } from '@iyulab/router/react';
130
+
131
+ export function AppRoot() {
132
+ return (
133
+ <div>
134
+ <nav>
135
+ <ULink href="/">Home</ULink>
136
+ <ULink href="/about">About</ULink>
137
+ <ULink href="/user/123">User Profile</ULink>
138
+ </nav>
139
+ <main>
140
+ <UOutlet />
141
+ </main>
142
+ </div>
143
+ );
144
+ }
145
+ ```
146
+
147
+ ## License
148
+
163
149
  MIT License - see [LICENSE](LICENSE) file for details.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CSSResult } from 'lit';
2
2
  import { LitElement } from 'lit';
3
+ import { PropertyValues } from 'lit';
3
4
  import { ReactElement } from 'react';
4
- import { ReactWebComponent } from '@lit/react';
5
5
  import { TemplateResult } from 'lit';
6
6
  import { TemplateResult as TemplateResult_2 } from 'lit-html';
7
7
 
@@ -26,7 +26,6 @@ declare interface BaseRouteConfig {
26
26
  * - "/user/:id/:name?"
27
27
  * - "/user/:id/:name*"
28
28
  * - "/user/:id/:name+"
29
- * - "/user/:id/:name{1,3}"
30
29
  * @link
31
30
  * https://developer.mozilla.org/en-US/docs/Web/API/URLPattern
32
31
  */
@@ -56,6 +55,11 @@ declare interface BaseRouteConfig {
56
55
  * - true๋กœ ์„ค์ •ํ•˜๋ฉด ๊ธฐ์กด ๋ Œ๋”๋ง์„ ๋ฌด์‹œํ•˜๊ณ  ์ƒˆ๋กœ ๋ Œ๋”๋งํ•ฉ๋‹ˆ๋‹ค.
57
56
  */
58
57
  force?: boolean;
58
+ /**
59
+ * ๊ฒฝ๋กœ ๋งค์นญ์‹œ ๋Œ€์†Œ๋ฌธ์ž ๊ตฌ๋ถ„ ์—ฌ๋ถ€
60
+ * @default false
61
+ */
62
+ ignoreCase?: boolean;
59
63
  }
60
64
 
61
65
  /**
@@ -115,47 +119,6 @@ declare interface IndexRouteConfig extends BaseRouteConfig {
115
119
  index: true;
116
120
  }
117
121
 
118
- /**
119
- * - ํด๋ผ์ด์–ธํŠธ ๋ผ์šฐํŒ…์„ ์ง€์›ํ•˜๋Š” ๋งํฌ ์—˜๋ฆฌ๋จผํŠธ์ž…๋‹ˆ๋‹ค.
120
- * - ๋‚ด๋ถ€ ๋งํฌ๋Š” ํด๋ผ์ด์–ธํŠธ ๋ผ์šฐํŒ…์„ ์ˆ˜ํ–‰ํ•˜๊ณ , ์™ธ๋ถ€ ๋งํฌ๋Š” ์ƒˆ๋กœ์šด ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.
121
- * - ๋งˆ์šฐ์Šค ์ค‘๊ฐ„ ๋ฒ„ํŠผ ํด๋ฆญ ๋˜๋Š” Ctrl ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ์ƒˆ๋กœ์šด ํƒญ์—์„œ ์—ฝ๋‹ˆ๋‹ค.
122
- */
123
- export declare class Link extends LitElement {
124
- /** ์™ธ๋ถ€ ๋งํฌ ์—ฌ๋ถ€ */
125
- private isExternal;
126
- /** a ํƒœ๊ทธ์˜ href ์†์„ฑ ๋ฐ ์ƒˆ๋กœ์šด ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•  ๋•Œ ์‚ฌ์šฉ๋  ๋งํฌ์ž…๋‹ˆ๋‹ค. */
127
- anchorHref: string;
128
- /**
129
- * - ์†์„ฑ์„ ์ •์˜ํ•˜์ง€ ์•Š์œผ๋ฉด basepath๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.
130
- * - http ๋กœ ์‹œ์ž‘ํ•˜๋ฉด ์ƒˆ๋กœ์šด ํŽ˜์ด์ง€๋ฅผ ๋กœ๋“œํ•ฉ๋‹ˆ๋‹ค.
131
- * - ์ ˆ๋Œ€๊ฒฝ๋กœ์ผ ๊ฒฝ์šฐ basepath๋กœ ์‹œ์ž‘ํ•˜๋ฉด ํด๋ผ์ด์–ธํŠธ ๋ผ์šฐํŒ…์„ ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ ‡์ง€ ์•Š์œผ๋ฉด ์ƒˆ๋กœ์šด ํŽ˜์ด์ง€๋ฅผ ๋กœ๋“œํ•ฉ๋‹ˆ๋‹ค.
132
- * - ์ƒ๋Œ€๊ฒฝ๋กœ๋กœ ์‹œ์ž‘ํ•˜๋ฉด (ํ˜„์žฌ์˜ basepath + ์ƒ๋Œ€๊ฒฝ๋กœ)๋กœ ํด๋ผ์ด์–ธํŠธ ๋ผ์šฐํŒ…์„ ํ•ฉ๋‹ˆ๋‹ค.
133
- * - ?๋กœ ์‹œ์ž‘ํ•˜๋ฉด ํ˜„์žฌ ๊ฒฝ๋กœ์— ์ฟผ๋ฆฌ์ŠคํŠธ๋ง์„ ์ถ”๊ฐ€ํ•˜๊ณ , ํด๋ผ์ด์–ธํŠธ ๋ผ์šฐํŒ…์„ ํ•ฉ๋‹ˆ๋‹ค.
134
- * - #์œผ๋กœ ์‹œ์ž‘ํ•˜๋ฉด ํ˜„์žฌ ๊ฒฝ๋กœ์— ํ•ด์‹œ๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ , hashchange ์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ต๋‹ˆ๋‹ค.
135
- */
136
- href?: string;
137
- connectedCallback(): void;
138
- disconnectedCallback(): void;
139
- protected updated(changedProperties: any): Promise<void>;
140
- render(): TemplateResult_2<1>;
141
- /**
142
- * ๋งํฌ ์—˜๋ฆฌ๋จผํŠธ์˜ ๋งˆ์šฐ์Šค ์ด๋ฒคํŠธ ํ•ธ๋“ค๋Ÿฌ
143
- * - ์ƒˆ๋กœ์šด ํƒญ์—์„œ ์—ด๊ธฐ: ๋งˆ์šฐ์Šค ์ค‘๊ฐ„ ๋ฒ„ํŠผ ๋˜๋Š” Ctrl ํ‚ค๋ฅผ ๋ˆ„๋ฆ…๋‹ˆ๋‹ค.
144
- * - ์ƒˆ๋กœ์šด ํŽ˜์ด์ง€๋กœ ์ด๋™: http๋กœ ์‹œ์ž‘ํ•˜๊ฑฐ๋‚˜ ์ ˆ๋Œ€๊ฒฝ๋กœ์ผ ๊ฒฝ์šฐ ์ƒˆ๋กœ์šด ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.
145
- * - ํด๋ผ์ด์–ธํŠธ ๋ผ์šฐํŒ…: ์ƒ๋Œ€๊ฒฝ๋กœ๋กœ ์‹œ์ž‘ํ•˜๋ฉด ํด๋ผ์ด์–ธํŠธ ๋ผ์šฐํŒ…์„ ํ•ฉ๋‹ˆ๋‹ค.
146
- */
147
- private handleMouseDown;
148
- /** ํด๋ผ์ด์–ธํŠธ ๋ผ์šฐํŒ…์„ ์œ„ํ•ด popstate ์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ต๋‹ˆ๋‹ค. */
149
- private dispatchPopstate;
150
- /** ํด๋ผ์ด์–ธํŠธ ๋ผ์šฐํŒ…์„ ์œ„ํ•ด hashchange ์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ต๋‹ˆ๋‹ค. */
151
- private dispatchHashchange;
152
- /** ๊ธฐ๋ณธ a ํƒœ๊ทธ์˜ ํด๋ฆญ ์ด๋ฒคํŠธ๋ฅผ ๋ง‰์Šต๋‹ˆ๋‹ค. */
153
- private preventClickEvent;
154
- /** a ํƒœ๊ทธ์— ์ฃผ์ž…ํ•  href ๊ฐ’์„ ๊ณ„์‚ฐํ•ฉ๋‹ˆ๋‹ค. */
155
- private getAnchorHref;
156
- static styles: CSSResult;
157
- }
158
-
159
122
  declare interface NonIndexRouteConfig extends BaseRouteConfig {
160
123
  /**
161
124
  * ์ธ๋ฑ์Šค ๋ผ์šฐํŠธ๊ฐ€ ์•„๋‹˜์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค.
@@ -175,28 +138,6 @@ export declare class NotFoundError extends RouteError {
175
138
  constructor(path: string, original?: Error | any);
176
139
  }
177
140
 
178
- /**
179
- * ๋ผ์šฐํŠธ ์•„์›ƒ๋ › ์ปดํฌ๋„ŒํŠธ
180
- * ๋ผ์šฐํŠธ ์„ค์ •์— ๋”ฐ๋ผ LitElement ๋˜๋Š” React ์ปดํฌ๋„ŒํŠธ๋ฅผ ๋ Œ๋”๋งํ•ฉ๋‹ˆ๋‹ค.
181
- */
182
- export declare class Outlet extends LitElement {
183
- private routeId?;
184
- private container?;
185
- private content?;
186
- /** ์‰๋„์šฐ๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ , ์ง์ ‘ ๋ Œ๋”๋งํ•ฉ๋‹ˆ๋‹ค. */
187
- protected createRenderRoot(): this;
188
- render(): TemplateResult<1>;
189
- /**
190
- * render ํ•จ์ˆ˜์˜ ๊ฒฐ๊ณผ๋ฅผ ๋ Œ๋”๋งํ•ฉ๋‹ˆ๋‹ค.
191
- * - HTMLElement, ReactElement, TemplateResult๋ฅผ ๋ชจ๋‘ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
192
- */
193
- renderContent({ id, content, force }: RenderOption): Promise<HTMLDivElement>;
194
- /**
195
- * ๊ธฐ์กด DOM์„ ๋ผ์ดํ”„ ์‚ฌ์ดํด์— ๋งž๊ฒŒ ์ œ๊ฑฐํ•ฉ๋‹ˆ๋‹ค.
196
- */
197
- clear(): void;
198
- }
199
-
200
141
  /**
201
142
  * u-outlet ์š”์†Œ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์„ ๋•Œ ๋ฐœ์ƒํ•˜๋Š” ์—๋Ÿฌ
202
143
  */
@@ -356,7 +297,7 @@ export declare class RouteProgressEvent extends RouteEvent {
356
297
  }
357
298
 
358
299
  /**
359
- * `lit-element`์™€ `react-component` ๊ธฐ๋ฐ˜์˜ ํด๋ผ์ด์–ธํŠธ ์‚ฌ์ด๋“œ ๋ผ์šฐํ„ฐ
300
+ * `lit-element`, `react`๋ฅผ ์ง€์›ํ•˜๋Š” ํด๋ผ์ด์–ธํŠธ ์‚ฌ์ด๋“œ ๋ผ์šฐํ„ฐ
360
301
  */
361
302
  export declare class Router {
362
303
  private readonly _rootElement;
@@ -425,22 +366,75 @@ export declare interface RouterConfig {
425
366
  initialLoad?: boolean;
426
367
  }
427
368
 
428
- export declare const ULink: ReactWebComponent<Link, {}>;
369
+ /**
370
+ * - ํด๋ผ์ด์–ธํŠธ ๋ผ์šฐํŒ…์„ ์ง€์›ํ•˜๋Š” ๋งํฌ ์—˜๋ฆฌ๋จผํŠธ์ž…๋‹ˆ๋‹ค.
371
+ * - ๋‚ด๋ถ€ ๋งํฌ๋Š” ํด๋ผ์ด์–ธํŠธ ๋ผ์šฐํŒ…์„ ์ˆ˜ํ–‰ํ•˜๊ณ , ์™ธ๋ถ€ ๋งํฌ๋Š” ๋ธŒ๋ผ์šฐ์ € ๊ธฐ๋ณธ ๋„ค๋น„๊ฒŒ์ด์…˜์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
372
+ * - Ctrl/Meta/Shift/Alt, ์ค‘ํด๋ฆญ/์šฐํด๋ฆญ ๋“ฑ์€ ๋ธŒ๋ผ์šฐ์ € ๊ธฐ๋ณธ ๋™์ž‘(์ƒˆ ํƒญ, ์ปจํ…์ŠคํŠธ ๋ฉ”๋‰ด ๋“ฑ)์„ ๊ทธ๋Œ€๋กœ ์œ ์ง€ํ•ฉ๋‹ˆ๋‹ค.
373
+ */
374
+ export declare class ULink extends LitElement {
375
+ /** ์™ธ๋ถ€ ๋งํฌ ์—ฌ๋ถ€ */
376
+ private isExternal;
377
+ /** a ํƒœ๊ทธ์— ์ฃผ์ž…ํ•  href ๊ฐ’ */
378
+ computedHref: string;
379
+ /**
380
+ * a ํƒœ๊ทธ target์„ ์ง€์›ํ•˜๊ณ  ์‹ถ์œผ๋ฉด ์—ด์–ด๋‘๋Š”๊ฒŒ ์ข‹์Šต๋‹ˆ๋‹ค.
381
+ * - _blank ๋“ฑ์„ ์“ฐ๋ฉด ๋ฌด์กฐ๊ฑด ๋ธŒ๋ผ์šฐ์ € ๊ธฐ๋ณธ ๋™์ž‘์„ ๋”ฐ๋ฅด๋„๋ก ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
382
+ */
383
+ target?: string;
384
+ /**
385
+ * - ์†์„ฑ์„ ์ •์˜ํ•˜์ง€ ์•Š์œผ๋ฉด basepath๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.
386
+ * - http(s)๋กœ ์‹œ์ž‘ํ•˜๋ฉด ์™ธ๋ถ€ ๋งํฌ๋กœ ๊ฐ„์ฃผํ•˜๊ณ  ๋ธŒ๋ผ์šฐ์ € ๋„ค๋น„๊ฒŒ์ด์…˜์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
387
+ * - ์ ˆ๋Œ€๊ฒฝ๋กœ(/...)์ผ ๊ฒฝ์šฐ basepath๋กœ ์‹œ์ž‘ํ•˜๋ฉด SPA ๋ผ์šฐํŒ… ๋Œ€์ƒ์ด ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
388
+ * - ์ƒ๋Œ€๊ฒฝ๋กœ๋Š” (basepath + ์ƒ๋Œ€๊ฒฝ๋กœ)๋กœ SPA ๋ผ์šฐํŒ… ๋Œ€์ƒ์ด ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
389
+ * - ?๋กœ ์‹œ์ž‘ํ•˜๋ฉด ํ˜„์žฌ pathname์— ์ฟผ๋ฆฌ์ŠคํŠธ๋ง์„ ๋ถ™์—ฌ SPA ๋ผ์šฐํŒ…ํ•ฉ๋‹ˆ๋‹ค.
390
+ * - #์œผ๋กœ ์‹œ์ž‘ํ•˜๋ฉด ํ˜„์žฌ URL์— ํ•ด์‹œ๋งŒ ๋ฐ”๊พธ๊ณ (๋ธŒ๋ผ์šฐ์ € ๊ธฐ๋ณธ) ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค.
391
+ */
392
+ href?: string;
393
+ protected willUpdate(changedProperties: PropertyValues): void;
394
+ render(): TemplateResult_2<1>;
395
+ /** basepath๋ฅผ state์—์„œ ๊บผ๋‚ด๋Š” ํ—ฌํผ */
396
+ private getBasepath;
397
+ /** a ํƒœ๊ทธ์— ์ฃผ์ž…ํ•  href ๊ฐ’์„ ๊ณ„์‚ฐํ•ฉ๋‹ˆ๋‹ค. */
398
+ private computeHref;
399
+ /**
400
+ * ํด๋ฆญ ๊ฐ€๋กœ์ฑ„๊ธฐ ๊ทœ์น™
401
+ * - ์ขŒํด๋ฆญ(0) + ๋ณด์กฐํ‚ค ์—†์Œ(ctrl/meta/shift/alt ์—†์Œ) + target์ด _self์ผ ๋•Œ๋งŒ SPA ๋ผ์šฐํŒ… ๊ณ ๋ ค
402
+ * - ๊ทธ ์™ธ(์ค‘ํด๋ฆญ/์šฐํด๋ฆญ/๋ณด์กฐํ‚ค/target=_blank ๋“ฑ)๋Š” ๋ธŒ๋ผ์šฐ์ € ๊ธฐ๋ณธ ๋™์ž‘ ์œ ์ง€
403
+ */
404
+ private handleAnchorClick;
405
+ /** ํด๋ผ์ด์–ธํŠธ ๋ผ์šฐํŒ…์„ ์œ„ํ•ด popstate ์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ต๋‹ˆ๋‹ค. */
406
+ private dispatchPopstate;
407
+ static styles: CSSResult;
408
+ }
429
409
 
430
- export declare const UOutlet: ReactWebComponent<Outlet, {}>;
410
+ /**
411
+ * ๋ผ์šฐํŠธ ์„ค์ •์— ๋”ฐ๋ผ LitElement ๋˜๋Š” React ์ปดํฌ๋„ŒํŠธ๋ฅผ ๋ Œ๋”๋งํ•ฉ๋‹ˆ๋‹ค.
412
+ */
413
+ export declare class UOutlet extends LitElement {
414
+ private routeId?;
415
+ private container?;
416
+ private content?;
417
+ /** ์™ธ๋ถ€ ์Šคํƒ€์ผ์„ ์ ์šฉํ•˜๊ธฐ ์œ„ํ•ด ๋ผ์ดํŠธ ๋”์„์‚ฌ์šฉ ํ•ฉ๋‹ˆ๋‹ค. */
418
+ protected createRenderRoot(): this;
419
+ render(): TemplateResult<1>;
420
+ /**
421
+ * render ํ•จ์ˆ˜์˜ ๊ฒฐ๊ณผ๋ฅผ ๋ Œ๋”๋งํ•ฉ๋‹ˆ๋‹ค.
422
+ * - HTMLElement, ReactElement, TemplateResult๋ฅผ ๋ชจ๋‘ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
423
+ */
424
+ renderContent({ id, content, force }: RenderOption): Promise<HTMLDivElement>;
425
+ /**
426
+ * ๊ธฐ์กด DOM์„ ๋ผ์ดํ”„ ์‚ฌ์ดํด์— ๋งž๊ฒŒ ์ œ๊ฑฐํ•ฉ๋‹ˆ๋‹ค.
427
+ */
428
+ clear(): void;
429
+ }
431
430
 
432
431
  export { }
433
432
 
434
- declare global {
435
- interface WindowEventMap {
436
- 'route-begin': RouteBeginEvent;
437
- 'route-progress': RouteProgressEvent;
438
- 'route-done': RouteDoneEvent;
439
- 'route-error': RouteErrorEvent;
440
- }
441
-
442
- interface HTMLElementTagNameMap {
443
- 'u-link': Link;
444
- 'u-outlet': Outlet;
445
- }
433
+ declare global {
434
+ interface WindowEventMap {
435
+ 'route-begin': RouteBeginEvent;
436
+ 'route-progress': RouteProgressEvent;
437
+ 'route-done': RouteDoneEvent;
438
+ 'route-error': RouteErrorEvent;
439
+ }
446
440
  }