@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 +20 -20
- package/README.md +148 -162
- package/dist/index.d.ts +74 -80
- package/dist/index.js +105 -352
- package/dist/react.d.ts +89 -0
- package/dist/react.js +44 -0
- package/dist/share-ZrQFmsur.js +253 -0
- package/package.json +55 -51
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 {
|
|
130
|
-
|
|
131
|
-
export function AppRoot() {
|
|
132
|
-
return (
|
|
133
|
-
<div>
|
|
134
|
-
<nav>
|
|
135
|
-
<
|
|
136
|
-
<
|
|
137
|
-
<
|
|
138
|
-
</nav>
|
|
139
|
-
<main>
|
|
140
|
-
<
|
|
141
|
-
</main>
|
|
142
|
-
</div>
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
##
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
}
|