@operato/shell 2.0.0-alpha.0 → 2.0.0-alpha.100
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 +248 -0
- package/demo/index.html +14 -3
- package/dist/src/actions/busy.js.map +1 -1
- package/dist/src/actions/route.d.ts +27 -4
- package/dist/src/actions/route.js +35 -6
- package/dist/src/actions/route.js.map +1 -1
- package/dist/src/app/app-style.js +12 -4
- package/dist/src/app/app-style.js.map +1 -1
- package/dist/src/app/app.d.ts +10 -5
- package/dist/src/app/app.js +27 -15
- package/dist/src/app/app.js.map +1 -1
- package/dist/src/app/pages/page-404.d.ts +1 -1
- package/dist/src/app/pages/page-404.js +5 -5
- package/dist/src/app/pages/page-404.js.map +1 -1
- package/dist/src/app/pages/page-view.d.ts +58 -0
- package/dist/src/app/pages/page-view.js +52 -1
- package/dist/src/app/pages/page-view.js.map +1 -1
- package/dist/src/custom-alert.d.ts +23 -0
- package/dist/src/custom-alert.js +26 -0
- package/dist/src/custom-alert.js.map +1 -0
- package/dist/src/entries/public/home.d.ts +2 -3
- package/dist/src/entries/public/home.js +17 -16
- package/dist/src/entries/public/home.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/store.js +8 -0
- package/dist/src/store.js.map +1 -1
- package/dist/stories/app.stories.d.ts +22 -0
- package/dist/stories/app.stories.js +38 -0
- package/dist/stories/app.stories.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +19 -19
- package/src/actions/busy.ts +1 -1
- package/src/actions/route.ts +35 -6
- package/src/app/app-style.ts +12 -4
- package/src/app/app.ts +49 -16
- package/src/app/pages/page-404.ts +5 -5
- package/src/app/pages/page-view.ts +63 -1
- package/src/custom-alert.ts +43 -0
- package/src/entries/public/home.ts +17 -16
- package/src/index.ts +1 -0
- package/src/store.ts +9 -0
- package/stories/app.stories.ts +51 -0
- package/themes/app-theme.css +145 -0
- package/yarn-error.log +4 -5
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,254 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [2.0.0-alpha.100](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.99...v2.0.0-alpha.100) (2024-04-21)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @operato/shell
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
## [2.0.0-alpha.99](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.98...v2.0.0-alpha.99) (2024-04-21)
|
15
|
+
|
16
|
+
**Note:** Version bump only for package @operato/shell
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
## [2.0.0-alpha.98](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.97...v2.0.0-alpha.98) (2024-04-21)
|
23
|
+
|
24
|
+
**Note:** Version bump only for package @operato/shell
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
## [2.0.0-alpha.94](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.93...v2.0.0-alpha.94) (2024-04-20)
|
31
|
+
|
32
|
+
**Note:** Version bump only for package @operato/shell
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
## [2.0.0-alpha.92](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.91...v2.0.0-alpha.92) (2024-04-19)
|
39
|
+
|
40
|
+
**Note:** Version bump only for package @operato/shell
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
## [2.0.0-alpha.90](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.89...v2.0.0-alpha.90) (2024-04-18)
|
47
|
+
|
48
|
+
**Note:** Version bump only for package @operato/shell
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
## [2.0.0-alpha.89](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.88...v2.0.0-alpha.89) (2024-04-18)
|
55
|
+
|
56
|
+
**Note:** Version bump only for package @operato/shell
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
## [2.0.0-alpha.87](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.86...v2.0.0-alpha.87) (2024-04-17)
|
63
|
+
|
64
|
+
**Note:** Version bump only for package @operato/shell
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
## [2.0.0-alpha.85](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.84...v2.0.0-alpha.85) (2024-04-16)
|
71
|
+
|
72
|
+
**Note:** Version bump only for package @operato/shell
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
## [2.0.0-alpha.82](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.81...v2.0.0-alpha.82) (2024-04-15)
|
79
|
+
|
80
|
+
**Note:** Version bump only for package @operato/shell
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
## [2.0.0-alpha.81](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.80...v2.0.0-alpha.81) (2024-04-15)
|
87
|
+
|
88
|
+
**Note:** Version bump only for package @operato/shell
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
## [2.0.0-alpha.80](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.79...v2.0.0-alpha.80) (2024-04-15)
|
95
|
+
|
96
|
+
**Note:** Version bump only for package @operato/shell
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
## [2.0.0-alpha.77](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.76...v2.0.0-alpha.77) (2024-04-14)
|
103
|
+
|
104
|
+
|
105
|
+
### :bug: Bug Fix
|
106
|
+
|
107
|
+
* add @webcomponents/scoped-custom-element-registry for storybook ([1f4264b](https://github.com/hatiolab/operato/commit/1f4264bd8384d8256437dfc838d22d64ec9a452d))
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
## [2.0.0-alpha.68](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.67...v2.0.0-alpha.68) (2024-04-13)
|
112
|
+
|
113
|
+
|
114
|
+
### :bug: Bug Fix
|
115
|
+
|
116
|
+
* mwc=>md for context ([2bc13f2](https://github.com/hatiolab/operato/commit/2bc13f285f257782f73e5d7b5d1ddd197df85393))
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
## [2.0.0-alpha.63](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.62...v2.0.0-alpha.63) (2024-04-12)
|
121
|
+
|
122
|
+
|
123
|
+
### :bug: Bug Fix
|
124
|
+
|
125
|
+
* escape page deactivation fault ([7c16838](https://github.com/hatiolab/operato/commit/7c16838a84a59780c53b6ad6f3e6f4a5d36ecfeb))
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
## [2.0.0-alpha.62](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.61...v2.0.0-alpha.62) (2024-04-12)
|
130
|
+
|
131
|
+
**Note:** Version bump only for package @operato/shell
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
## [2.0.0-alpha.57](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.56...v2.0.0-alpha.57) (2024-04-07)
|
138
|
+
|
139
|
+
**Note:** Version bump only for package @operato/shell
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
**Note:** Version bump only for package @operato/shell
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
## [2.0.0-alpha.52](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.51...v2.0.0-alpha.52) (2024-03-29)
|
154
|
+
|
155
|
+
|
156
|
+
### :bug: Bug Fix
|
157
|
+
|
158
|
+
* custom-alert in @operato/shell ([e628af8](https://github.com/hatiolab/operato/commit/e628af8d923de49960bfbcd04452b428105c0bc8))
|
159
|
+
* renovation CustomAlert ([757f04f](https://github.com/hatiolab/operato/commit/757f04f44bdb50e087ecacdbf217f3d3b20e922c))
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
## [2.0.0-alpha.51](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.50...v2.0.0-alpha.51) (2024-03-29)
|
164
|
+
|
165
|
+
|
166
|
+
### :bug: Bug Fix
|
167
|
+
|
168
|
+
* upgrade lit ([e661c33](https://github.com/hatiolab/operato/commit/e661c333d2bb97f784b5ac2c0e365714ee5e80ff))
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
## [2.0.0-alpha.47](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.46...v2.0.0-alpha.47) (2024-03-27)
|
173
|
+
|
174
|
+
|
175
|
+
### :bug: Bug Fix
|
176
|
+
|
177
|
+
* storybook 실행 환경 ([6a2940f](https://github.com/hatiolab/operato/commit/6a2940fb89dc26566acdce7cf1781a71cbad61c5))
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
## [2.0.0-alpha.46](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.45...v2.0.0-alpha.46) (2024-03-26)
|
182
|
+
|
183
|
+
|
184
|
+
### :bug: Bug Fix
|
185
|
+
|
186
|
+
* modules change가 두번 발생하는 문제 ([b2e621a](https://github.com/hatiolab/operato/commit/b2e621a0b94c5e2feccf840cd73444bc9a87af73))
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
## [2.0.0-alpha.43](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.42...v2.0.0-alpha.43) (2024-03-24)
|
191
|
+
|
192
|
+
|
193
|
+
### :rocket: New Features
|
194
|
+
|
195
|
+
* 모듈의 동적 라우팅 구성을 지원함 ([3b812a4](https://github.com/hatiolab/operato/commit/3b812a460e81b3ce7c8da8900a6378aff1484444))
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
## [2.0.0-alpha.37](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.36...v2.0.0-alpha.37) (2024-03-18)
|
200
|
+
|
201
|
+
|
202
|
+
### :bug: Bug Fix
|
203
|
+
|
204
|
+
* add module.bootstrap() definition ([68fc95c](https://github.com/hatiolab/operato/commit/68fc95cfa86d9fd6e315e4a75361c283533aee7a))
|
205
|
+
* add module.route() definition ([9b069f5](https://github.com/hatiolab/operato/commit/9b069f5ff08e5e58a7b0a34ecfd202407ff21494))
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
## [2.0.0-alpha.35](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.34...v2.0.0-alpha.35) (2024-03-13)
|
210
|
+
|
211
|
+
**Note:** Version bump only for package @operato/shell
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
## [2.0.0-alpha.28](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.27...v2.0.0-alpha.28) (2024-02-20)
|
218
|
+
|
219
|
+
|
220
|
+
### :bug: Bug Fix
|
221
|
+
|
222
|
+
* upgrade devDependencies for webcomponents ([1489b8b](https://github.com/hatiolab/operato/commit/1489b8b790d9bcee779a070a630697f25c01728f))
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
## [2.0.0-alpha.21](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.20...v2.0.0-alpha.21) (2024-02-09)
|
227
|
+
|
228
|
+
|
229
|
+
### :bug: Bug Fix
|
230
|
+
|
231
|
+
* delete unused ([e623ae4](https://github.com/hatiolab/operato/commit/e623ae42aef83ee130c9c681b5f95bc324ba16e7))
|
232
|
+
* print-friendly ([e9a3eba](https://github.com/hatiolab/operato/commit/e9a3eba4550772e5d0bd0cbce31c5740568a2459))
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
## [2.0.0-alpha.17](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.16...v2.0.0-alpha.17) (2024-02-04)
|
237
|
+
|
238
|
+
|
239
|
+
### :bug: Bug Fix
|
240
|
+
|
241
|
+
* styling for printing ([c8557a6](https://github.com/hatiolab/operato/commit/c8557a69880bafe5a6a152b07b367946e584c6fb))
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
## [2.0.0-alpha.8](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.7...v2.0.0-alpha.8) (2024-01-20)
|
246
|
+
|
247
|
+
|
248
|
+
### :bug: Bug Fix
|
249
|
+
|
250
|
+
* comment for libraries ([bdf20d0](https://github.com/hatiolab/operato/commit/bdf20d057819187106b4a9e37d25c2c1f7febb39))
|
251
|
+
|
252
|
+
|
253
|
+
|
6
254
|
## [2.0.0-alpha.0](https://github.com/hatiolab/operato/compare/v1.13.1...v2.0.0-alpha.0) (2024-01-05)
|
7
255
|
|
8
256
|
**Note:** Version bump only for package @operato/shell
|
package/demo/index.html
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
<!
|
1
|
+
<!doctype html>
|
2
2
|
<html lang="en-GB">
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8" />
|
@@ -16,14 +16,25 @@
|
|
16
16
|
}
|
17
17
|
</style>
|
18
18
|
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet" />
|
19
|
-
<link
|
19
|
+
<link
|
20
|
+
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
|
21
|
+
rel="stylesheet"
|
22
|
+
/>
|
23
|
+
<link
|
24
|
+
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
|
25
|
+
rel="stylesheet"
|
26
|
+
/>
|
27
|
+
<link
|
28
|
+
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
|
29
|
+
rel="stylesheet"
|
30
|
+
/>
|
20
31
|
</head>
|
21
32
|
<body>
|
22
33
|
<div id="demo"></div>
|
23
34
|
|
24
35
|
<script type="module">
|
25
36
|
import { html, render } from 'lit'
|
26
|
-
import '@material/
|
37
|
+
import '@material/web/icon/icon.js'
|
27
38
|
|
28
39
|
const parent = document.querySelector('#demo')
|
29
40
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"busy.js","sourceRoot":"","sources":["../../../src/actions/busy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,
|
1
|
+
{"version":3,"file":"busy.js","sourceRoot":"","sources":["../../../src/actions/busy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAG,MAAM,kBAAkB,CAAA;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAEhC,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAA;AAExC,+BAA+B,CAAC,CAAC,KAAa,EAAE,EAAE;IAChD,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC,CAAQ,CAAC,CAAA;AAC/C,CAAC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,QAAa,EAAE,EAAE;IAC7D,QAAQ,CAAC;QACP,IAAI,EAAE,WAAW;QACjB,IAAI;KACL,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { setActiveRequestCounterCallback } from '@operato/graphql'\nimport { store } from '../store'\n\nexport const UPDATE_BUSY = 'UPDATE_BUSY'\n\nsetActiveRequestCounterCallback((count: number) => {\n store.dispatch(updateBusy(count != 0) as any)\n})\n\nexport const updateBusy = (busy: boolean) => (dispatch: any) => {\n dispatch({\n type: UPDATE_BUSY,\n busy\n })\n}\n"]}
|
@@ -1,20 +1,43 @@
|
|
1
1
|
/**
|
2
|
+
* Navigate to a page using one of two methods:
|
3
|
+
* 1. Using a page link: <a href='page'>goto page</a> (equivalent to route(page))
|
4
|
+
* 2. Using the navigate('page') function.
|
5
|
+
*
|
2
6
|
* 페이지를 이동하는 방법으로는 다음 두가지가 있다.
|
3
7
|
* 1. page link를 사용하는 방법 <a href='page'>goto page</a>
|
4
8
|
* 이 방법은 route(page)와 동일하다.
|
5
9
|
* 2. navigate('page')를 사용하는 방법
|
6
10
|
*
|
7
|
-
* @param
|
11
|
+
* @param location - The path of the page to navigate to.
|
12
|
+
* @param replace - Optional. If true, replaces the current page in the browser's history.
|
8
13
|
*/
|
9
14
|
export declare const navigate: (location: string, replace?: boolean) => void;
|
15
|
+
/**
|
16
|
+
* Navigate to a page with optional query parameters, and dispatch a Redux action to load the page.
|
17
|
+
*
|
18
|
+
* @param pathInfo - Object containing pathname, search, and optional params.
|
19
|
+
* @param dispatch - Redux dispatch function.
|
20
|
+
*/
|
10
21
|
export declare const navigateWithSilence: ({ pathname: path, search, params }: {
|
11
22
|
pathname: string;
|
12
|
-
search?: string
|
23
|
+
search?: string;
|
13
24
|
params?: {
|
14
25
|
[key: string]: any;
|
15
|
-
}
|
26
|
+
};
|
16
27
|
}) => (dispatch: any) => void;
|
28
|
+
/**
|
29
|
+
* Load a page by dispatching a Redux action, and handle page navigation if necessary.
|
30
|
+
*
|
31
|
+
* @param page - The page to load.
|
32
|
+
* @param id - The associated resource ID.
|
33
|
+
* @param params - Additional parameters to pass to the page.
|
34
|
+
*/
|
17
35
|
export declare const loadPage: (page: string, id: string, params: {
|
18
36
|
[key: string]: any;
|
19
|
-
}) => (dispatch: any) => void
|
37
|
+
}) => (dispatch: any) => Promise<void>;
|
38
|
+
/**
|
39
|
+
* Route to a given URL by creating a link element and triggering a click event.
|
40
|
+
*
|
41
|
+
* @param url - The URL to route to.
|
42
|
+
*/
|
20
43
|
export declare const route: (url: string) => void;
|
@@ -2,12 +2,17 @@ import { getPathInfo } from '@operato/utils';
|
|
2
2
|
import { HOMEPAGE, UPDATE_PAGE } from '../actions/const';
|
3
3
|
import { store } from '../store';
|
4
4
|
/**
|
5
|
+
* Navigate to a page using one of two methods:
|
6
|
+
* 1. Using a page link: <a href='page'>goto page</a> (equivalent to route(page))
|
7
|
+
* 2. Using the navigate('page') function.
|
8
|
+
*
|
5
9
|
* 페이지를 이동하는 방법으로는 다음 두가지가 있다.
|
6
10
|
* 1. page link를 사용하는 방법 <a href='page'>goto page</a>
|
7
11
|
* 이 방법은 route(page)와 동일하다.
|
8
12
|
* 2. navigate('page')를 사용하는 방법
|
9
13
|
*
|
10
|
-
* @param
|
14
|
+
* @param location - The path of the page to navigate to.
|
15
|
+
* @param replace - Optional. If true, replaces the current page in the browser's history.
|
11
16
|
*/
|
12
17
|
export const navigate = (location, replace) => {
|
13
18
|
if (replace)
|
@@ -16,6 +21,12 @@ export const navigate = (location, replace) => {
|
|
16
21
|
history.pushState({}, '', location);
|
17
22
|
window.dispatchEvent(new Event('popstate'));
|
18
23
|
};
|
24
|
+
/**
|
25
|
+
* Navigate to a page with optional query parameters, and dispatch a Redux action to load the page.
|
26
|
+
*
|
27
|
+
* @param pathInfo - Object containing pathname, search, and optional params.
|
28
|
+
* @param dispatch - Redux dispatch function.
|
29
|
+
*/
|
19
30
|
export const navigateWithSilence = ({ pathname: path, search, params }) => (dispatch) => {
|
20
31
|
const { path: pathname } = getPathInfo(path);
|
21
32
|
const reg = /\/([^\/]+)\/*([^\/]*)/;
|
@@ -33,7 +44,13 @@ export const navigateWithSilence = ({ pathname: path, search, params }) => (disp
|
|
33
44
|
// you can do here
|
34
45
|
dispatch(loadPage(page, id, params));
|
35
46
|
};
|
36
|
-
|
47
|
+
/**
|
48
|
+
* Preload a page by performing any necessary preprocessing before loading.
|
49
|
+
*
|
50
|
+
* @param page - The page to preload.
|
51
|
+
* @returns - The new page path or routing result after preprocessing.
|
52
|
+
*/
|
53
|
+
const _preLoadPage = async (page) => {
|
37
54
|
/*
|
38
55
|
* _preLoadPage 에서는 page를 load하기 전처리를 수행한다.
|
39
56
|
* 예를 들면, page dynamic import 또는 page re-routing
|
@@ -43,16 +60,23 @@ const _preLoadPage = (page) => {
|
|
43
60
|
var modules = state.app.modules;
|
44
61
|
if (modules) {
|
45
62
|
for (let i = modules.length - 1; i >= 0; i--) {
|
46
|
-
let
|
47
|
-
let _page =
|
63
|
+
let module = modules[i];
|
64
|
+
let _page = module.route && (await module.route(page, module));
|
48
65
|
if (_page) {
|
49
66
|
return _page;
|
50
67
|
}
|
51
68
|
}
|
52
69
|
}
|
53
70
|
};
|
54
|
-
|
55
|
-
|
71
|
+
/**
|
72
|
+
* Load a page by dispatching a Redux action, and handle page navigation if necessary.
|
73
|
+
*
|
74
|
+
* @param page - The page to load.
|
75
|
+
* @param id - The associated resource ID.
|
76
|
+
* @param params - Additional parameters to pass to the page.
|
77
|
+
*/
|
78
|
+
export const loadPage = (page, id, params) => async (dispatch) => {
|
79
|
+
var newPage = await _preLoadPage(page);
|
56
80
|
if (page !== newPage && newPage.indexOf('/') == 0) {
|
57
81
|
dispatch(navigateWithSilence({
|
58
82
|
pathname: id ? `${newPage}/${id}` : newPage,
|
@@ -67,6 +91,11 @@ export const loadPage = (page, id, params) => (dispatch) => {
|
|
67
91
|
params
|
68
92
|
});
|
69
93
|
};
|
94
|
+
/**
|
95
|
+
* Route to a given URL by creating a link element and triggering a click event.
|
96
|
+
*
|
97
|
+
* @param url - The URL to route to.
|
98
|
+
*/
|
70
99
|
export const route = (url) => {
|
71
100
|
const link = document.createElement('a');
|
72
101
|
link.setAttribute('href', url);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../src/actions/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAEhC
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../src/actions/route.ts"],"names":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,GAAG,OAAO,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO;YAC3C,MAAM;SACP,CAAC,CACH,CAAA;QACD,OAAM;IACR,CAAC;IAED,QAAQ,CAAC;QACP,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,OAAO;QACb,UAAU,EAAE,EAAE;QACd,MAAM;KACP,CAAC,CAAA;AACJ,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,GAAW,EAAE,EAAE;IACnC,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;IAExC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAE9B,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;IAC/B,IAAI,CAAC,KAAK,EAAE,CAAA;IACZ,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;AACjC,CAAC,CAAA","sourcesContent":["import { getPathInfo } from '@operato/utils'\n\nimport { HOMEPAGE, UPDATE_PAGE } from '../actions/const'\nimport { store } from '../store'\n\n/**\n * Navigate to a page using one of two methods:\n * 1. Using a page link: <a href='page'>goto page</a> (equivalent to route(page))\n * 2. Using the navigate('page') function.\n *\n * 페이지를 이동하는 방법으로는 다음 두가지가 있다.\n * 1. page link를 사용하는 방법 <a href='page'>goto page</a>\n * 이 방법은 route(page)와 동일하다.\n * 2. navigate('page')를 사용하는 방법\n *\n * @param location - The path of the page to navigate to.\n * @param replace - Optional. If true, replaces the current page in the browser's history.\n */\nexport const navigate = (location: string, replace?: boolean) => {\n if (replace) history.replaceState(history.state, '', location)\n else history.pushState({}, '', location)\n\n window.dispatchEvent(new Event('popstate'))\n}\n\n/**\n * Navigate to a page with optional query parameters, and dispatch a Redux action to load the page.\n *\n * @param pathInfo - Object containing pathname, search, and optional params.\n * @param dispatch - Redux dispatch function.\n */\nexport const navigateWithSilence =\n ({ pathname: path, search, params }: { pathname: string; search?: string; params?: { [key: string]: any } }) =>\n (dispatch: any) => {\n const { path: pathname } = getPathInfo(path)\n\n const reg = /\\/([^\\/]+)\\/*([^\\/]*)/\n const decodePath = decodeURIComponent(pathname!)\n const matchReturn = decodePath.match(reg) || []\n const page = matchReturn[1] || HOMEPAGE\n const id = matchReturn[2]\n\n if (!params) {\n params = {}\n\n new URLSearchParams(search).forEach((value, key) => {\n params![key] = value\n })\n }\n\n // Any other info you might want to extract from the path (like page type),\n // you can do here\n dispatch(loadPage(page, id, params))\n }\n\n/**\n * Preload a page by performing any necessary preprocessing before loading.\n *\n * @param page - The page to preload.\n * @returns - The new page path or routing result after preprocessing.\n */\nconst _preLoadPage = async (page: any) => {\n /*\n * _preLoadPage 에서는 page를 load하기 전처리를 수행한다.\n * 예를 들면, page dynamic import 또는 page re-routing\n */\n var state: any = store.getState()\n\n /* override 기능을 위해서 dependency 관계의 역순으로 route를 실행한다. */\n var modules = state.app.modules\n if (modules) {\n for (let i = modules.length - 1; i >= 0; i--) {\n let module = modules[i]\n let _page = module.route && (await module.route(page, module))\n if (_page) {\n return _page\n }\n }\n }\n}\n\n/**\n * Load a page by dispatching a Redux action, and handle page navigation if necessary.\n *\n * @param page - The page to load.\n * @param id - The associated resource ID.\n * @param params - Additional parameters to pass to the page.\n */\nexport const loadPage = (page: string, id: string, params: { [key: string]: any }) => async (dispatch: any) => {\n var newPage = await _preLoadPage(page)\n\n if (page !== newPage && newPage.indexOf('/') == 0) {\n dispatch(\n navigateWithSilence({\n pathname: id ? `${newPage}/${id}` : newPage,\n params\n })\n )\n return\n }\n\n dispatch({\n type: UPDATE_PAGE,\n page: newPage,\n resourceId: id,\n params\n })\n}\n\n/**\n * Route to a given URL by creating a link element and triggering a click event.\n *\n * @param url - The URL to route to.\n */\nexport const route = (url: string) => {\n const link = document.createElement('a')\n\n link.setAttribute('href', url)\n\n document.body.appendChild(link)\n link.click()\n document.body.removeChild(link)\n}\n"]}
|
@@ -62,16 +62,24 @@ export const AppStyle = css `
|
|
62
62
|
z-index: 1000;
|
63
63
|
}
|
64
64
|
|
65
|
-
/* Wide layout */
|
66
|
-
@media (min-width: 460px) {
|
67
|
-
}
|
68
|
-
|
69
65
|
@media print {
|
70
66
|
:host {
|
71
67
|
width: 100%;
|
72
68
|
height: 100%;
|
73
69
|
min-height: 100vh;
|
74
70
|
min-height: 100dvh;
|
71
|
+
|
72
|
+
max-width: unset;
|
73
|
+
width: unset;
|
74
|
+
height: unset;
|
75
|
+
height: unset;
|
76
|
+
}
|
77
|
+
|
78
|
+
main {
|
79
|
+
/* important for printing!!! */
|
80
|
+
display: block;
|
81
|
+
flex: unset;
|
82
|
+
overflow: visible;
|
75
83
|
}
|
76
84
|
|
77
85
|
ox-page-header-bar {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"app-style.js","sourceRoot":"","sources":["../../../src/app/app-style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,CAAA
|
1
|
+
{"version":3,"file":"app-style.js","sourceRoot":"","sources":["../../../src/app/app-style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+G1B,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport const AppStyle = css`\n :host {\n display: grid;\n\n grid-template-rows: var(--app-grid-template-rows, auto 1fr auto);\n grid-template-columns: var(--app-grid-template-columns, auto 1fr auto);\n grid-template-areas: var(--app-grid-template-area, 'header header header' 'nav main aside' 'nav footer aside');\n grid-gap: var(--app-grid-gap, 0em);\n\n max-width: 100vw;\n width: 100vw;\n height: 100vh;\n height: 100dvh;\n }\n\n ox-header-bar {\n grid-area: header;\n }\n\n ox-nav-bar {\n grid-area: nav;\n }\n\n div {\n grid-area: main;\n\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n main {\n flex: 1;\n\n display: flex;\n flex-direction: row;\n overflow: hidden;\n }\n\n ox-aside-bar {\n grid-area: aside;\n }\n\n ox-footer-bar {\n grid-area: footer;\n }\n\n main > * {\n flex: 1;\n }\n\n main > *:not([active]) {\n display: none;\n }\n\n [hidden] {\n display: none;\n }\n\n ox-snack-bar {\n z-index: 1000;\n }\n\n @media print {\n :host {\n width: 100%;\n height: 100%;\n min-height: 100vh;\n min-height: 100dvh;\n\n max-width: unset;\n width: unset;\n height: unset;\n height: unset;\n }\n\n main {\n /* important for printing!!! */\n display: block;\n flex: unset;\n overflow: visible;\n }\n\n ox-page-header-bar {\n display: none;\n }\n\n ox-page-footer-bar {\n display: none;\n }\n\n ox-header-bar {\n display: none;\n }\n\n ox-nav-bar {\n display: none;\n }\n\n ox-aside-bar {\n display: none;\n }\n\n ox-footer-bar {\n display: none;\n }\n\n ox-snack-bar {\n display: none;\n }\n }\n`\n"]}
|
package/dist/src/app/app.d.ts
CHANGED
@@ -16,9 +16,14 @@ export declare class ThingsApp extends ThingsApp_base {
|
|
16
16
|
static styles: import("lit").CSSResult[];
|
17
17
|
static moduleInitialized: MODULES_STATE;
|
18
18
|
static modules: Array<any>;
|
19
|
-
static
|
19
|
+
static pagesResolver: (value: {
|
20
20
|
[path: string]: string;
|
21
|
-
}
|
21
|
+
} | PromiseLike<{
|
22
|
+
[path: string]: string;
|
23
|
+
}>) => void;
|
24
|
+
static pages: Promise<{
|
25
|
+
[path: string]: string;
|
26
|
+
}>;
|
22
27
|
static callbacks: Array<any>;
|
23
28
|
static contextPath?: string;
|
24
29
|
contextPathPrefix?: string;
|
@@ -30,14 +35,14 @@ export declare class ThingsApp extends ThingsApp_base {
|
|
30
35
|
contextPath?: string;
|
31
36
|
modules: Array<any>;
|
32
37
|
private main;
|
33
|
-
render(): import("lit").TemplateResult<1>;
|
38
|
+
render(): import("lit-html").TemplateResult<1>;
|
34
39
|
connectedCallback(): void;
|
35
40
|
disconnectedCallback(): void;
|
36
|
-
routeToPage(): void
|
41
|
+
routeToPage(): Promise<void>;
|
37
42
|
updated(changes: PropertyValues<this>): Promise<void>;
|
38
43
|
shouldUpdate(): boolean;
|
39
44
|
stateChanged(state: any): void;
|
40
|
-
static registerPages(): void
|
45
|
+
static registerPages(): Promise<void>;
|
41
46
|
setBase(): void;
|
42
47
|
}
|
43
48
|
export {};
|
package/dist/src/app/app.js
CHANGED
@@ -62,7 +62,7 @@ let ThingsApp = ThingsApp_1 = class ThingsApp extends connect(store)(LitElement)
|
|
62
62
|
/* lifecycle - bootstrapping */
|
63
63
|
modules.forEach(async (m, idx) => {
|
64
64
|
try {
|
65
|
-
m.bootstrap && (await m.bootstrap());
|
65
|
+
m.bootstrap && (await m.bootstrap(m));
|
66
66
|
}
|
67
67
|
catch (e) {
|
68
68
|
console.error(`[${idx} BOOTSTRAP ERROR -${m.name}]`, e);
|
@@ -80,7 +80,11 @@ let ThingsApp = ThingsApp_1 = class ThingsApp extends connect(store)(LitElement)
|
|
80
80
|
var { pathname } = location;
|
81
81
|
var { contextPath } = getPathInfo(pathname);
|
82
82
|
/* 페이지를 나가기 전에 옮기지 않도록 개입할 기회를 준다 */
|
83
|
-
if (lastPathName &&
|
83
|
+
if (lastPathName &&
|
84
|
+
lastPathName != pathname &&
|
85
|
+
this.activePage &&
|
86
|
+
this.activePage.canDeactivate &&
|
87
|
+
!(await this.activePage.canDeactivate())) {
|
84
88
|
history.back();
|
85
89
|
return;
|
86
90
|
}
|
@@ -107,7 +111,7 @@ let ThingsApp = ThingsApp_1 = class ThingsApp extends connect(store)(LitElement)
|
|
107
111
|
disconnectedCallback() {
|
108
112
|
super.disconnectedCallback();
|
109
113
|
}
|
110
|
-
routeToPage() {
|
114
|
+
async routeToPage() {
|
111
115
|
const activePages = this.renderRoot.querySelectorAll('main > .page[active]');
|
112
116
|
activePages.forEach(page => {
|
113
117
|
page.removeAttribute('active');
|
@@ -115,7 +119,7 @@ let ThingsApp = ThingsApp_1 = class ThingsApp extends connect(store)(LitElement)
|
|
115
119
|
this.activePage = this.renderRoot.querySelector(`main > .page[data-page=${this.page}]`);
|
116
120
|
if (!this.activePage) {
|
117
121
|
/* 해당 route에 연결된 page가 없는 경우에 main 섹션에 해당 element를 추가해준다. */
|
118
|
-
const tagname = ThingsApp_1.pages[this.page];
|
122
|
+
const tagname = (await ThingsApp_1.pages)[this.page];
|
119
123
|
if (tagname) {
|
120
124
|
const el = document.createElement(tagname);
|
121
125
|
el.setAttribute('class', 'page');
|
@@ -166,18 +170,27 @@ let ThingsApp = ThingsApp_1 = class ThingsApp extends connect(store)(LitElement)
|
|
166
170
|
ThingsApp_1.contextPath = this.contextPath = state.app.contextPath;
|
167
171
|
ThingsApp_1.callbacks = state.route.callbacks;
|
168
172
|
}
|
169
|
-
static registerPages() {
|
173
|
+
static async registerPages() {
|
174
|
+
ThingsApp_1.pages = new Promise(resolve => (ThingsApp_1.pagesResolver = resolve));
|
170
175
|
var reversedModules = [...ThingsApp_1.modules].reverse();
|
171
|
-
|
176
|
+
const pages = {};
|
172
177
|
/* 모듈 참조 순서 역순으로 page를 추가한다. (for overidable) */
|
173
|
-
|
174
|
-
m.routes
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
178
|
+
for (const m of reversedModules) {
|
179
|
+
if (!m.routes) {
|
180
|
+
continue;
|
181
|
+
}
|
182
|
+
/*
|
183
|
+
각 모듈의 routes가 모두 완성될 때까지 ThingsApp.pages 구성을 지연한다.
|
184
|
+
각 모듈의 routes를 동적으로도 구성할 수 있도록 하기 위해서이다.
|
185
|
+
*/
|
186
|
+
const routes = await m.routes;
|
187
|
+
routes.forEach((route) => {
|
188
|
+
if (!pages[route.page]) {
|
189
|
+
pages[route.page] = route.tagname;
|
190
|
+
}
|
191
|
+
});
|
192
|
+
}
|
193
|
+
ThingsApp_1.pagesResolver(pages);
|
181
194
|
}
|
182
195
|
setBase() {
|
183
196
|
const base = document.querySelector('base');
|
@@ -187,7 +200,6 @@ let ThingsApp = ThingsApp_1 = class ThingsApp extends connect(store)(LitElement)
|
|
187
200
|
ThingsApp.styles = [ScrollbarStyles, AppStyle];
|
188
201
|
ThingsApp.moduleInitialized = MODULES_STATE.NOT_INITIALIZED;
|
189
202
|
ThingsApp.modules = [];
|
190
|
-
ThingsApp.pages = {};
|
191
203
|
ThingsApp.callbacks = [];
|
192
204
|
__decorate([
|
193
205
|
property({ type: String, attribute: 'context-path-prefix' })
|