@operato/shell 1.0.7 → 1.0.8

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.
Files changed (46) hide show
  1. package/package.json +7 -4
  2. package/src/actions/const.ts +8 -0
  3. package/src/actions/index.ts +1 -0
  4. package/src/actions/route.ts +1 -9
  5. package/src/app/app.ts +1 -2
  6. package/src/app/pages/page-view.ts +1 -1
  7. package/src/object-store.ts +173 -0
  8. package/src/reducers/route.ts +1 -1
  9. package/src/store.ts +2 -2
  10. package/dist/src/actions/app.d.ts +0 -11
  11. package/dist/src/actions/app.js +0 -12
  12. package/dist/src/actions/app.js.map +0 -1
  13. package/dist/src/actions/index.d.ts +0 -2
  14. package/dist/src/actions/index.js +0 -3
  15. package/dist/src/actions/index.js.map +0 -1
  16. package/dist/src/actions/route.d.ts +0 -26
  17. package/dist/src/actions/route.js +0 -82
  18. package/dist/src/actions/route.js.map +0 -1
  19. package/dist/src/app/app-style.d.ts +0 -1
  20. package/dist/src/app/app-style.js +0 -69
  21. package/dist/src/app/app-style.js.map +0 -1
  22. package/dist/src/app/app.d.ts +0 -1
  23. package/dist/src/app/app.js +0 -194
  24. package/dist/src/app/app.js.map +0 -1
  25. package/dist/src/app/pages/page-404.d.ts +0 -8
  26. package/dist/src/app/pages/page-404.js +0 -57
  27. package/dist/src/app/pages/page-404.js.map +0 -1
  28. package/dist/src/app/pages/page-view.d.ts +0 -16
  29. package/dist/src/app/pages/page-view.js +0 -131
  30. package/dist/src/app/pages/page-view.js.map +0 -1
  31. package/dist/src/entries/public/home.d.ts +0 -17
  32. package/dist/src/entries/public/home.js +0 -87
  33. package/dist/src/entries/public/home.js.map +0 -1
  34. package/dist/src/index.d.ts +0 -3
  35. package/dist/src/index.js.map +0 -1
  36. package/dist/src/module-importer.import +0 -0
  37. package/dist/src/reducers/app.d.ts +0 -36
  38. package/dist/src/reducers/app.js +0 -36
  39. package/dist/src/reducers/app.js.map +0 -1
  40. package/dist/src/reducers/route.d.ts +0 -16
  41. package/dist/src/reducers/route.js +0 -57
  42. package/dist/src/reducers/route.js.map +0 -1
  43. package/dist/src/store.d.ts +0 -6
  44. package/dist/src/store.js +0 -15
  45. package/dist/src/store.js.map +0 -1
  46. package/dist/tsconfig.tsbuildinfo +0 -1
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "WebApplication architecturing shell following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "heartyoh",
6
- "version": "1.0.7",
6
+ "version": "1.0.8",
7
7
  "main": "dist/src/index.js",
8
8
  "module": "dist/src/index.js",
9
9
  "exports": {
@@ -11,7 +11,8 @@
11
11
  "./app.js": "./dist/src/app/app.js",
12
12
  "./app-style.js": "./dist/src/app/app-style.js",
13
13
  "./page-view.js": "./dist/src/app/pages/page-view.js",
14
- "./page-404.js": "./dist/src/app/pages/page-404.js"
14
+ "./page-404.js": "./dist/src/app/pages/page-404.js",
15
+ "./object-store.js": "./dist/src/object-store.js"
15
16
  },
16
17
  "typesVersions": {
17
18
  "*": {
@@ -26,6 +27,9 @@
26
27
  ],
27
28
  "page-404.js": [
28
29
  "dist/src/app/pages/page-404.d.ts"
30
+ ],
31
+ "object-store.js": [
32
+ "dist/src/object-store.d.ts"
29
33
  ]
30
34
  }
31
35
  },
@@ -95,6 +99,5 @@
95
99
  "eslint --fix",
96
100
  "prettier --write"
97
101
  ]
98
- },
99
- "gitHead": "24e241b4f2d4cde785816ea5241f110ffb7a692c"
102
+ }
100
103
  }
@@ -0,0 +1,8 @@
1
+ export const UPDATE_PAGE = 'UPDATE_PAGE'
2
+ export const UPDATE_CONTEXT = 'UPDATE_CONTEXT'
3
+ export const UPDATE_ACTIVE_PAGE = 'UPDATE_ACTIVE_PAGE'
4
+
5
+ export const REGISTER_NAVIGATION_CALLBACK = 'REGISTER_NAVIGATION_CALLBACK'
6
+ export const UNREGISTER_NAVIGATION_CALLBACK = 'UNREGISTER_NAVIGATION_CALLBACK'
7
+
8
+ export const HOMEPAGE = ''
@@ -1,2 +1,3 @@
1
1
  export * from './app'
2
2
  export * from './route'
3
+ export * from './const'
@@ -1,16 +1,8 @@
1
1
  import { getPathInfo } from '@operato/utils'
2
2
 
3
+ import { HOMEPAGE, UPDATE_PAGE } from '../actions/const'
3
4
  import { store } from '../store'
4
5
 
5
- export const UPDATE_PAGE = 'UPDATE_PAGE'
6
- export const UPDATE_CONTEXT = 'UPDATE_CONTEXT'
7
- export const UPDATE_ACTIVE_PAGE = 'UPDATE_ACTIVE_PAGE'
8
-
9
- export const REGISTER_NAVIGATION_CALLBACK = 'REGISTER_NAVIGATION_CALLBACK'
10
- export const UNREGISTER_NAVIGATION_CALLBACK = 'UNREGISTER_NAVIGATION_CALLBACK'
11
-
12
- export const HOMEPAGE = ''
13
-
14
6
  /**
15
7
  * 페이지를 이동하는 방법으로는 다음 두가지가 있다.
16
8
  * 1. page link를 사용하는 방법 <a href='page'>goto page</a>
package/src/app/app.ts CHANGED
@@ -6,8 +6,7 @@ import { installRouter } from 'pwa-helpers/router.js'
6
6
  import { ScrollbarStyles } from '@operato/styles'
7
7
  import { getPathInfo } from '@operato/utils'
8
8
 
9
- import { UPDATE_CONTEXT_PATH, UPDATE_MODULES } from '../actions/app'
10
- import { navigateWithSilence, UPDATE_ACTIVE_PAGE } from '../actions/route'
9
+ import { navigateWithSilence, UPDATE_ACTIVE_PAGE, UPDATE_CONTEXT_PATH, UPDATE_MODULES } from '../actions'
11
10
  import { store } from '../store'
12
11
  import { AppStyle } from './app-style'
13
12
 
@@ -2,7 +2,7 @@ import { LitElement, PropertyValues } from 'lit'
2
2
  import { property } from 'lit/decorators.js'
3
3
  import isEqual from 'lodash-es/isEqual'
4
4
 
5
- import { UPDATE_CONTEXT } from '../../actions/route'
5
+ import { UPDATE_CONTEXT } from '../../actions/const'
6
6
  import { store } from '../../store'
7
7
 
8
8
  function diff(after: any, before: any): any {
@@ -0,0 +1,173 @@
1
+ /*
2
+ * [ Caution ]
3
+ * Since this module is being used by a service worker, be very careful about adding imports or using functions for browsers.
4
+ */
5
+
6
+ type OxObjectStore = {
7
+ add: (value: any, key?: IDBValidKey | undefined) => IDBValidKey
8
+ delete: (query: IDBValidKey | IDBKeyRange) => undefined
9
+ clear: () => undefined
10
+ get: (query: IDBValidKey | IDBKeyRange) => any
11
+ getAll: (query?: IDBValidKey | IDBKeyRange | null | undefined, count?: number | undefined) => any[]
12
+ getAllKeys: (query?: IDBValidKey | IDBKeyRange | null | undefined, count?: number | undefined) => IDBValidKey[]
13
+ count: (query?: IDBValidKey | IDBKeyRange | undefined) => number
14
+ put: (value: any, key?: IDBValidKey | undefined) => IDBValidKey
15
+ openCursor: (
16
+ query?: IDBValidKey | IDBKeyRange | null | undefined,
17
+ direction?: IDBCursorDirection | undefined
18
+ ) => IDBCursorWithValue | null
19
+ openKeyCursor: (
20
+ query?: IDBValidKey | IDBKeyRange | null | undefined,
21
+ direction?: IDBCursorDirection | undefined
22
+ ) => IDBCursor | null
23
+ limit: (limit?: number) => undefined
24
+ }
25
+
26
+ /* promise queue */
27
+ class Queue {
28
+ private static queue: {
29
+ promise: Promise<IDBDatabase>
30
+ resolve: (db: IDBDatabase) => void
31
+ reject: (reason?: any) => void
32
+ }[] = []
33
+
34
+ private static workingOnPromise: boolean = false
35
+
36
+ static enqueue(promise: Promise<any>) {
37
+ return new Promise((resolve, reject) => {
38
+ this.queue.push({
39
+ promise,
40
+ resolve,
41
+ reject
42
+ })
43
+ this.dequeue()
44
+ })
45
+ }
46
+
47
+ static dequeue() {
48
+ if (this.workingOnPromise) {
49
+ return false
50
+ }
51
+ const item = this.queue.shift()
52
+ if (!item) {
53
+ return false
54
+ }
55
+ try {
56
+ this.workingOnPromise = true
57
+ item.promise
58
+ .then(value => {
59
+ this.workingOnPromise = false
60
+ item.resolve(value)
61
+ this.dequeue()
62
+ })
63
+ .catch(err => {
64
+ this.workingOnPromise = false
65
+ item.reject(err)
66
+ this.dequeue()
67
+ })
68
+ } catch (err) {
69
+ this.workingOnPromise = false
70
+ item.reject(err)
71
+ this.dequeue()
72
+ }
73
+ return true
74
+ }
75
+ }
76
+
77
+ function getStore(storeName: string): OxObjectStore {
78
+ return [
79
+ 'add',
80
+ 'delete',
81
+ 'clear',
82
+ 'get',
83
+ 'getAll',
84
+ 'getAllKeys',
85
+ 'count',
86
+ 'put',
87
+ 'openCursor',
88
+ 'openKeyCursor'
89
+ ].reduce(
90
+ (sum, m) => {
91
+ sum[m] = async (...params: any) => {
92
+ const db = (await getIndexDB()) as IDBDatabase
93
+
94
+ const transaction = db.transaction(storeName, 'readwrite')
95
+ const store = transaction.objectStore(storeName)
96
+ const method: (...p: any) => any = (store as any)[m]
97
+ const request = method.apply(store, params)
98
+
99
+ return await new Promise((resolve, reject) => {
100
+ request.onsuccess = (event: Event) => {
101
+ resolve((event.target as IDBRequest)?.result)
102
+ }
103
+
104
+ request.onerror = (event: Event) => {
105
+ reject(event)
106
+ }
107
+ })
108
+ }
109
+
110
+ return sum
111
+ },
112
+ {
113
+ async limit(this: OxObjectStore, limit = 50) {
114
+ const keys = (await this.getAllKeys()).slice(0, -limit)
115
+ for (let i = 0; i < keys.length; i++) {
116
+ await this.delete(keys[i])
117
+ }
118
+ }
119
+ } as any
120
+ )
121
+ }
122
+
123
+ function getIndexedDB(): IDBFactory {
124
+ if (typeof window !== 'undefined') {
125
+ return window.indexedDB
126
+ } else {
127
+ return self.indexedDB
128
+ }
129
+ }
130
+
131
+ var db: IDBDatabase
132
+
133
+ function getIndexDB() {
134
+ if (db) {
135
+ return db
136
+ }
137
+
138
+ return Queue.enqueue(
139
+ new Promise(function (resolve, reject) {
140
+ const indexedDB = getIndexedDB()
141
+
142
+ if (!indexedDB) {
143
+ reject('this browser does not support indexedDB')
144
+ }
145
+ const request = indexedDB.open('things-factory-database')
146
+
147
+ request.onerror = function (event) {
148
+ console.log("Why didn't you allow my web app to use IndexedDB?!")
149
+ reject(event)
150
+ }
151
+
152
+ request.onupgradeneeded = function (event: IDBVersionChangeEvent) {
153
+ var db: IDBDatabase = (event.target as IDBRequest)?.result
154
+
155
+ var store = db.createObjectStore('notifications', { keyPath: 'id', autoIncrement: true })
156
+ store.createIndex('notification_id_unqiue', 'id', { unique: true })
157
+
158
+ var store = db.createObjectStore('client_settings', { keyPath: 'key', autoIncrement: true })
159
+ store.createIndex('client_setting_key_unqiue', 'key', { unique: true })
160
+ }
161
+
162
+ request.onsuccess = function (event) {
163
+ console.log('IndexedDB opened successfully')
164
+ db = request.result
165
+ resolve(db)
166
+ }
167
+ })
168
+ )
169
+ }
170
+
171
+ /* ready indexedDB Stores */
172
+ export const clientSettingStore: OxObjectStore = getStore('client_settings')
173
+ export const notificationStore: OxObjectStore = getStore('notifications')
@@ -7,7 +7,7 @@ import {
7
7
  UPDATE_ACTIVE_PAGE,
8
8
  UPDATE_CONTEXT,
9
9
  UPDATE_PAGE
10
- } from '../actions/route.js'
10
+ } from '../actions/const'
11
11
 
12
12
  const APP_TITLE_EL = document.querySelector('meta[name="application-name"]') as HTMLMetaElement
13
13
 
package/src/store.ts CHANGED
@@ -2,8 +2,8 @@ import { lazyReducerEnhancer, LazyStore } from 'pwa-helpers/lazy-reducer-enhance
2
2
  import { Action, applyMiddleware, combineReducers, compose, createStore, Store } from 'redux'
3
3
  import thunk from 'redux-thunk'
4
4
 
5
- import app from './reducers/app.js'
6
- import route from './reducers/route.js'
5
+ import app from './reducers/app'
6
+ import route from './reducers/route'
7
7
 
8
8
  declare global {
9
9
  var __REDUX_DEVTOOLS_EXTENSION_COMPOSE__: any
@@ -1,11 +0,0 @@
1
- export declare const UPDATE_MODULES = "UPDATE_MODULES";
2
- export declare const UPDATE_BASE_URL = "UPDATE_BASE_URL";
3
- export declare const UPDATE_CONTEXT_PATH = "UPDATE_CONTEXT_PATH";
4
- export declare const SET_DOMAINS = "SET-DOMAINS";
5
- export declare const updateDomains: (domains: {
6
- name: string;
7
- subdomain: string;
8
- }[], domain: {
9
- name: string;
10
- subdomain: string;
11
- }) => (dispatch: any) => void;
@@ -1,12 +0,0 @@
1
- export const UPDATE_MODULES = 'UPDATE_MODULES';
2
- export const UPDATE_BASE_URL = 'UPDATE_BASE_URL';
3
- export const UPDATE_CONTEXT_PATH = 'UPDATE_CONTEXT_PATH';
4
- export const SET_DOMAINS = 'SET-DOMAINS';
5
- export const updateDomains = (domains, domain) => (dispatch) => {
6
- dispatch({
7
- type: SET_DOMAINS,
8
- domains,
9
- domain
10
- });
11
- };
12
- //# sourceMappingURL=app.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/actions/app.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAgB,CAAA;AAC9C,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAA;AAChD,MAAM,CAAC,MAAM,mBAAmB,GAAG,qBAAqB,CAAA;AACxD,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAA;AAExC,MAAM,CAAC,MAAM,aAAa,GACxB,CACE,OAGG,EACH,MAGC,EACD,EAAE,CACJ,CAAC,QAAa,EAAE,EAAE;IAChB,QAAQ,CAAC;QACP,IAAI,EAAE,WAAW;QACjB,OAAO;QACP,MAAM;KACP,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["export const UPDATE_MODULES = 'UPDATE_MODULES'\nexport const UPDATE_BASE_URL = 'UPDATE_BASE_URL'\nexport const UPDATE_CONTEXT_PATH = 'UPDATE_CONTEXT_PATH'\nexport const SET_DOMAINS = 'SET-DOMAINS'\n\nexport const updateDomains =\n (\n domains: {\n name: string\n subdomain: string\n }[],\n domain: {\n name: string\n subdomain: string\n }\n ) =>\n (dispatch: any) => {\n dispatch({\n type: SET_DOMAINS,\n domains,\n domain\n })\n }\n"]}
@@ -1,2 +0,0 @@
1
- export * from './app';
2
- export * from './route';
@@ -1,3 +0,0 @@
1
- export * from './app';
2
- export * from './route';
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/actions/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA;AACrB,cAAc,SAAS,CAAA","sourcesContent":["export * from './app'\nexport * from './route'\n"]}
@@ -1,26 +0,0 @@
1
- export declare const UPDATE_PAGE = "UPDATE_PAGE";
2
- export declare const UPDATE_CONTEXT = "UPDATE_CONTEXT";
3
- export declare const UPDATE_ACTIVE_PAGE = "UPDATE_ACTIVE_PAGE";
4
- export declare const REGISTER_NAVIGATION_CALLBACK = "REGISTER_NAVIGATION_CALLBACK";
5
- export declare const UNREGISTER_NAVIGATION_CALLBACK = "UNREGISTER_NAVIGATION_CALLBACK";
6
- export declare const HOMEPAGE = "";
7
- /**
8
- * 페이지를 이동하는 방법으로는 다음 두가지가 있다.
9
- * 1. page link를 사용하는 방법 <a href='page'>goto page</a>
10
- * 이 방법은 route(page)와 동일하다.
11
- * 2. navigate('page')를 사용하는 방법
12
- *
13
- * @param string page
14
- */
15
- export declare const navigate: (location: string, replace?: boolean) => void;
16
- export declare const navigateWithSilence: ({ pathname: path, search, params }: {
17
- pathname: string;
18
- search?: string | undefined;
19
- params?: {
20
- [key: string]: any;
21
- } | undefined;
22
- }) => (dispatch: any) => void;
23
- export declare const loadPage: (page: string, id: string, params: {
24
- [key: string]: any;
25
- }) => (dispatch: any) => void;
26
- export declare const route: (url: string) => void;
@@ -1,82 +0,0 @@
1
- import { getPathInfo } from '@operato/utils';
2
- import { store } from '../store';
3
- export const UPDATE_PAGE = 'UPDATE_PAGE';
4
- export const UPDATE_CONTEXT = 'UPDATE_CONTEXT';
5
- export const UPDATE_ACTIVE_PAGE = 'UPDATE_ACTIVE_PAGE';
6
- export const REGISTER_NAVIGATION_CALLBACK = 'REGISTER_NAVIGATION_CALLBACK';
7
- export const UNREGISTER_NAVIGATION_CALLBACK = 'UNREGISTER_NAVIGATION_CALLBACK';
8
- export const HOMEPAGE = '';
9
- /**
10
- * 페이지를 이동하는 방법으로는 다음 두가지가 있다.
11
- * 1. page link를 사용하는 방법 <a href='page'>goto page</a>
12
- * 이 방법은 route(page)와 동일하다.
13
- * 2. navigate('page')를 사용하는 방법
14
- *
15
- * @param string page
16
- */
17
- export const navigate = (location, replace) => {
18
- if (replace)
19
- history.replaceState(history.state, '', location);
20
- else
21
- history.pushState({}, '', location);
22
- window.dispatchEvent(new Event('popstate'));
23
- };
24
- export const navigateWithSilence = ({ pathname: path, search, params }) => (dispatch) => {
25
- const { path: pathname } = getPathInfo(path);
26
- const reg = /\/([^\/]+)\/*([^\/]*)/;
27
- const decodePath = decodeURIComponent(pathname);
28
- const matchReturn = decodePath.match(reg) || [];
29
- const page = matchReturn[1] || HOMEPAGE;
30
- const id = matchReturn[2];
31
- if (!params) {
32
- params = {};
33
- new URLSearchParams(search).forEach((value, key) => {
34
- params[key] = value;
35
- });
36
- }
37
- // Any other info you might want to extract from the path (like page type),
38
- // you can do here
39
- dispatch(loadPage(page, id, params));
40
- };
41
- const _preLoadPage = (page) => {
42
- /*
43
- * _preLoadPage 에서는 page를 load하기 전처리를 수행한다.
44
- * 예를 들면, page dynamic import 또는 page re-routing
45
- */
46
- var state = store.getState();
47
- /* override 기능을 위해서 dependency 관계의 역순으로 route를 실행한다. */
48
- var modules = state.app.modules;
49
- if (modules) {
50
- for (let i = modules.length - 1; i >= 0; i--) {
51
- let factoryModule = modules[i];
52
- let _page = factoryModule.route && factoryModule.route(page);
53
- if (_page) {
54
- return _page;
55
- }
56
- }
57
- }
58
- };
59
- export const loadPage = (page, id, params) => (dispatch) => {
60
- var newPage = _preLoadPage(page);
61
- if (page !== newPage && newPage.indexOf('/') == 0) {
62
- dispatch(navigateWithSilence({
63
- pathname: newPage,
64
- params
65
- }));
66
- return;
67
- }
68
- dispatch({
69
- type: UPDATE_PAGE,
70
- page: newPage,
71
- resourceId: id,
72
- params
73
- });
74
- };
75
- export const route = (url) => {
76
- const link = document.createElement('a');
77
- link.setAttribute('href', url);
78
- document.body.appendChild(link);
79
- link.click();
80
- document.body.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GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;IAEhC,IAAI,IAAI,KAAK,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QACjD,QAAQ,CACN,mBAAmB,CAAC;YAClB,QAAQ,EAAE,OAAO;YACjB,MAAM;SACP,CAAC,CACH,CAAA;QACD,OAAM;KACP;IAED,QAAQ,CAAC;QACP,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,OAAO;QACb,UAAU,EAAE,EAAE;QACd,MAAM;KACP,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,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 { store } from '../store'\n\nexport const UPDATE_PAGE = 'UPDATE_PAGE'\nexport const UPDATE_CONTEXT = 'UPDATE_CONTEXT'\nexport const UPDATE_ACTIVE_PAGE = 'UPDATE_ACTIVE_PAGE'\n\nexport const REGISTER_NAVIGATION_CALLBACK = 'REGISTER_NAVIGATION_CALLBACK'\nexport const UNREGISTER_NAVIGATION_CALLBACK = 'UNREGISTER_NAVIGATION_CALLBACK'\n\nexport const HOMEPAGE = ''\n\n/**\n * 페이지를 이동하는 방법으로는 다음 두가지가 있다.\n * 1. page link를 사용하는 방법 <a href='page'>goto page</a>\n * 이 방법은 route(page)와 동일하다.\n * 2. navigate('page')를 사용하는 방법\n *\n * @param string page\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\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\nconst _preLoadPage = (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 factoryModule = modules[i]\n let _page = factoryModule.route && factoryModule.route(page)\n if (_page) {\n return _page\n }\n }\n }\n}\n\nexport const loadPage = (page: string, id: string, params: { [key: string]: any }) => (dispatch: any) => {\n var newPage = _preLoadPage(page)\n\n if (page !== newPage && newPage.indexOf('/') == 0) {\n dispatch(\n navigateWithSilence({\n pathname: 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\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"]}
@@ -1 +0,0 @@
1
- export declare const AppStyle: import("lit").CSSResult;
@@ -1,69 +0,0 @@
1
- import { css } from 'lit';
2
- export const AppStyle = css `
3
- :host {
4
- display: grid;
5
-
6
- grid-template-rows: var(--app-grid-template-rows, auto 1fr auto);
7
- grid-template-columns: var(--app-grid-template-columns, auto 1fr auto);
8
- grid-template-areas: var(--app-grid-template-area, 'header header header' 'nav main aside' 'nav footer aside');
9
- grid-gap: var(--app-grid-gap, 0em);
10
-
11
- max-width: 100vw;
12
- width: 100vw;
13
- height: 100vh;
14
- }
15
-
16
- ox-header-bar {
17
- grid-area: header;
18
- }
19
-
20
- ox-nav-bar {
21
- grid-area: nav;
22
- }
23
-
24
- main {
25
- grid-area: main;
26
-
27
- overflow: hidden;
28
-
29
- display: flex;
30
- flex-direction: row;
31
- }
32
-
33
- ox-aside-bar {
34
- grid-area: aside;
35
- }
36
-
37
- ox-footer-bar {
38
- grid-area: footer;
39
- }
40
-
41
- main > * {
42
- flex: 1;
43
- }
44
-
45
- main > *:not([active]) {
46
- display: none;
47
- }
48
-
49
- [hidden] {
50
- display: none;
51
- }
52
-
53
- ox-snack-bar {
54
- z-index: 1000;
55
- }
56
-
57
- /* Wide layout */
58
- @media (min-width: 460px) {
59
- }
60
-
61
- @media print {
62
- :host {
63
- width: 100%;
64
- height: 100%;
65
- min-height: 100vh;
66
- }
67
- }
68
- `;
69
- //# sourceMappingURL=app-style.js.map
@@ -1 +0,0 @@
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkE1B,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 }\n\n ox-header-bar {\n grid-area: header;\n }\n\n ox-nav-bar {\n grid-area: nav;\n }\n\n main {\n grid-area: main;\n\n overflow: hidden;\n\n display: flex;\n flex-direction: row;\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 /* Wide layout */\n @media (min-width: 460px) {\n }\n\n @media print {\n :host {\n width: 100%;\n height: 100%;\n min-height: 100vh;\n }\n }\n`\n"]}
@@ -1 +0,0 @@
1
- export {};