@things-factory/shell 5.0.0-zeta.2 → 5.0.0-zeta.20

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/client/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import 'broadcastchannel-polyfill'
2
- import './app/app'
2
+ import '@operato/shell/app.js'
3
3
 
4
4
  /* Export ENV */
5
5
  export const PROCESS = {
package/client/route.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export default function route(page) {
2
- import('./app/pages/page-404')
2
+ import('@operato/shell/page-404.js')
3
3
  return 'page404'
4
4
  }
package/client/store.js CHANGED
@@ -1,20 +1,12 @@
1
- import { createStore, compose, applyMiddleware, combineReducers } from 'redux'
2
- import thunk from 'redux-thunk'
3
- import { lazyReducerEnhancer } from 'pwa-helpers/lazy-reducer-enhancer.js'
1
+ import { configureStore } from 'redux';
4
2
 
5
- import app from './reducers/app.js'
6
- import route from './reducers/route.js'
3
+ import app from './reducers/app.js';
4
+ import route from './reducers/route.js';
7
5
 
8
- // Sets up a Chrome extension for time travel debugging.
9
- // See https://github.com/zalmoxisus/redux-devtools-extension for more information.
10
- const devCompose = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
11
-
12
- export const store = createStore(
13
- state => state,
14
- devCompose(lazyReducerEnhancer(combineReducers), applyMiddleware(thunk))
15
- )
6
+ export const store = configureStore({
7
+ devTools: process.env['NODE-ENV'] !== 'production'
8
+ })
16
9
 
17
- // Initially loaded reducers.
18
10
  store.addReducers({
19
11
  app,
20
12
  route
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/shell",
3
- "version": "5.0.0-zeta.2",
3
+ "version": "5.0.0-zeta.20",
4
4
  "description": "Core module for framework",
5
5
  "bin": {
6
6
  "things-factory": "bin/things-factory",
@@ -31,52 +31,54 @@
31
31
  "test": "NODE_ENV=test jest"
32
32
  },
33
33
  "dependencies": {
34
- "@apollo/client": "^3.5.10",
35
- "@graphql-tools/merge": "^8.2.3",
36
- "@graphql-tools/schema": "^8.3.2",
37
- "@graphql-tools/utils": "^8.6.2",
34
+ "@anchan828/typeorm-history": "^1.0.16",
35
+ "@apollo/client": "^3.6.9",
36
+ "@graphql-tools/merge": "^8.3.0",
37
+ "@graphql-tools/schema": "^8.5.0",
38
+ "@graphql-tools/utils": "^8.8.0",
38
39
  "@hatiolab/koa-webpack": "^6.0.0",
39
- "@hatiolab/things-scene": "^3.0.12",
40
- "@koa/cors": "^3.1.0",
41
- "@material/mwc-button": "^0.25.3",
42
- "@material/mwc-fab": "^0.25.3",
43
- "@material/mwc-icon": "^0.25.3",
44
- "@material/mwc-icon-button": "^0.25.3",
45
- "@material/mwc-slider": "^0.25.3",
46
- "@material/mwc-textfield": "^0.25.3",
47
- "@operato/board": "1.0.0-beta.30",
48
- "@operato/graphql": "1.0.0-beta.30",
49
- "@operato/help": "1.0.0-beta.30",
50
- "@operato/layout": "1.0.0-beta.30",
51
- "@operato/shell": "1.0.0-beta.30",
52
- "@operato/utils": "1.0.0-beta.30",
53
- "@things-factory/ejs-remote": "^5.0.0-zeta.2",
54
- "@things-factory/env": "^5.0.0-zeta.2",
55
- "@things-factory/styles": "^5.0.0-zeta.2",
56
- "@things-factory/utils": "^5.0.0-zeta.2",
40
+ "@hatiolab/things-scene": "^3.0.18",
41
+ "@koa/cors": "^3.3.0",
42
+ "@material/mwc-button": "^0.26.1",
43
+ "@material/mwc-fab": "^0.26.1",
44
+ "@material/mwc-icon": "^0.26.1",
45
+ "@material/mwc-icon-button": "^0.26.1",
46
+ "@material/mwc-slider": "^0.26.1",
47
+ "@material/mwc-textfield": "^0.26.1",
48
+ "@operato/board": "^1.0.0-beta.47",
49
+ "@operato/graphql": "^1.0.0-beta.47",
50
+ "@operato/help": "^1.0.0-beta.47",
51
+ "@operato/layout": "^1.0.0-beta.47",
52
+ "@operato/shell": "^1.0.0-beta.47",
53
+ "@operato/utils": "^1.0.0-beta.47",
54
+ "@things-factory/ejs-remote": "^5.0.0-zeta.20",
55
+ "@things-factory/env": "^5.0.0-zeta.20",
56
+ "@things-factory/styles": "^5.0.0-zeta.20",
57
+ "@things-factory/utils": "^5.0.0-zeta.20",
57
58
  "@webcomponents/webcomponentsjs": "^2.6.0",
58
59
  "@webpack-contrib/schema-utils": "^1.0.0-beta.0",
59
- "apollo-server-core": "^3.6.4",
60
- "apollo-server-koa": "^3.6.4",
61
- "apollo-server-types": "^3.5.1",
60
+ "apollo-server-core": "^3.9.0",
61
+ "apollo-server-koa": "^3.9.0",
62
+ "apollo-server-types": "^3.6.1",
62
63
  "apollo-upload-client": "^17.0.0",
63
64
  "args": "^5.0.0",
64
65
  "broadcastchannel-polyfill": "^1.0.1",
65
66
  "chalk": "^4.1.0",
66
67
  "class-validator": "^0.13.2",
67
- "core-js": "^3.16.0",
68
+ "core-js": "^3.23.3",
68
69
  "csvtojson": "^2.0.10",
69
70
  "debug": "^4.1.1",
70
71
  "firebase": "^8.0.1",
71
72
  "fs-extra": "^9.0.1",
72
73
  "glob": "^7.1.6",
73
- "graphql": "^15.7.2",
74
+ "graphql": "^15.8.0",
74
75
  "graphql-mqtt-subscriptions": "^1.2.0",
75
76
  "graphql-redis-subscriptions": "^2.4.2",
76
77
  "graphql-subscriptions": "^2.0.0",
77
78
  "graphql-tag": "^2.12.6",
78
79
  "graphql-upload": "^13.0.0",
79
- "haunted": "^4.8.2",
80
+ "graphql-ws": "^5.9.1",
81
+ "haunted": "^5.0.0",
80
82
  "html-webpack-plugin": "^5.5.0",
81
83
  "husky": "7.0.1",
82
84
  "imports-loader": "^3.0.0",
@@ -85,21 +87,21 @@
85
87
  "json-stringify-safe": "^5.0.1",
86
88
  "json5": "^2.2.0",
87
89
  "koa": "^2.13.4",
88
- "koa-bodyparser": "^4.2.0",
89
- "koa-ip": "^2.1.0",
90
+ "koa-bodyparser": "^4.3.0",
91
+ "koa-ip": "^2.1.2",
90
92
  "koa-router": "^7.4.0",
91
93
  "koa-send": "^5.0.0",
92
94
  "koa-static": "^5.0.0",
93
95
  "koa-unless": "^1.0.7",
94
96
  "koa2-connect-history-api-fallback": "^0.1.2",
95
- "lit": "^2.2.1",
97
+ "lit": "^2.2.7",
96
98
  "loader-utils": "^2.0.0",
97
- "lodash": "^4.17.15",
98
- "lodash-es": "^4.17.15",
99
- "mkdirp": "^1.0.3",
99
+ "lodash": "^4.17.21",
100
+ "lodash-es": "^4.17.21",
101
+ "mkdirp": "^1.0.4",
100
102
  "mqtt": "^4.3.4",
101
- "node-fetch": "^2.6.0",
102
- "nodemon": "^2.0.2",
103
+ "node-fetch": "^3.2.6",
104
+ "nodemon": "^2.0.19",
103
105
  "npm-license-crawler": "^0.2.1",
104
106
  "pluralize": "^8.0.0",
105
107
  "promises-all": "^1.0.0",
@@ -113,22 +115,20 @@
113
115
  "subscriptions-transport-ws": "^0.11.0",
114
116
  "sweetalert2": "^10.9.0",
115
117
  "type-graphql": "^1.2.0-rc.1",
116
- "typeorm": "^0.2.41",
118
+ "typeorm": "^0.2.45",
117
119
  "uuid": "^3.4.0",
118
120
  "web-animations-js": "^2.3.2",
119
- "web-push": "^3.4.5",
120
- "webfontloader": "^1.6.28"
121
+ "web-push": "^3.5.0",
122
+ "webfontloader": "^1.6.28",
123
+ "ws": "^8.8.0"
121
124
  },
122
125
  "optionalDependencies": {
123
- "better-sqlite3": "^7.1.2",
126
+ "better-sqlite3": "^7.5.3",
124
127
  "mssql": "^8.1.2",
125
128
  "mysql2": "^2.3.3",
126
- "oracledb": "^5.1.0",
127
- "pg": "^8.3.0",
128
- "sqlite3": "^5.0.0"
129
+ "oracledb": "^5.4.0",
130
+ "pg": "^8.7.3",
131
+ "sqlite3": "^5.0.8"
129
132
  },
130
- "resolutions": {
131
- "core-js": "^3.16.0"
132
- },
133
- "gitHead": "fe921b76f32ac48ceddf3c290110509bdb5750d6"
133
+ "gitHead": "34981af408c52ca2472fdbd70ea3b5fbe0ab4073"
134
134
  }
@@ -1,69 +0,0 @@
1
- import { css } from 'lit'
2
-
3
- export const AppStyle = css`
4
- :host {
5
- display: grid;
6
-
7
- grid-template-rows: var(--app-grid-template-rows, auto 1fr auto);
8
- grid-template-columns: var(--app-grid-template-columns, auto 1fr auto);
9
- grid-template-areas: var(--app-grid-template-area, 'header header header' 'nav main aside' 'nav footer aside');
10
- grid-gap: var(--app-grid-gap, 0em);
11
-
12
- max-width: 100vw;
13
- width: 100vw;
14
- height: 100vh;
15
- }
16
-
17
- ox-header-bar {
18
- grid-area: header;
19
- }
20
-
21
- ox-nav-bar {
22
- grid-area: nav;
23
- }
24
-
25
- main {
26
- grid-area: main;
27
-
28
- overflow: hidden;
29
-
30
- display: flex;
31
- flex-direction: row;
32
- }
33
-
34
- ox-aside-bar {
35
- grid-area: aside;
36
- }
37
-
38
- ox-footer-bar {
39
- grid-area: footer;
40
- }
41
-
42
- main * {
43
- flex: 1;
44
- }
45
-
46
- main *:not([active]) {
47
- display: none;
48
- }
49
-
50
- [hidden] {
51
- display: none;
52
- }
53
-
54
- ox-snack-bar {
55
- z-index: 1000;
56
- }
57
-
58
- /* Wide layout */
59
- @media (min-width: 460px) {
60
- }
61
-
62
- @media print {
63
- :host {
64
- width: 100%;
65
- height: 100%;
66
- min-height: 100vh;
67
- }
68
- }
69
- `
package/client/app/app.js DELETED
@@ -1,225 +0,0 @@
1
- import '@operato/layout'
2
-
3
- import { LitElement, html } from 'lit'
4
- import { UPDATE_ACTIVE_PAGE, UPDATE_CONTEXT_PATH, UPDATE_MODULES, navigateWithSilence, store } from '@operato/shell'
5
-
6
- import { AppStyle } from './app-style'
7
- import { ScrollbarStyles } from '@operato/styles'
8
- import { connect } from 'pwa-helpers/connect-mixin.js'
9
- import { getPathInfo } from '@operato/utils'
10
- import { installRouter } from 'pwa-helpers/router.js'
11
- import throttle from 'lodash-es/throttle'
12
-
13
- class ThingsApp extends connect(store)(LitElement) {
14
- static get properties() {
15
- return {
16
- _contextPath: String,
17
- _page: String,
18
- _pages: Object,
19
- _resourceId: String,
20
- _params: Object,
21
- _callbacks: Array,
22
- _activePage: Object,
23
- _context: Object,
24
- _modules: Array
25
- }
26
- }
27
-
28
- static get styles() {
29
- return [ScrollbarStyles, AppStyle]
30
- }
31
-
32
- render() {
33
- var params = this._params || {}
34
- var fullbleed = (this._context && this._context.fullbleed) || (params.fullbleed && params.fullbleed == 'Y')
35
- var widebleed = (this._context && this._context.widebleed) || (params.widebleed && params.widebleed == 'Y')
36
-
37
- return html`
38
- <ox-header-bar ?fullbleed=${fullbleed}></ox-header-bar>
39
-
40
- <ox-nav-bar ?fullbleed=${fullbleed || widebleed}></ox-nav-bar>
41
-
42
- <main></main>
43
-
44
- <ox-aside-bar ?fullbleed=${fullbleed || widebleed}></ox-aside-bar>
45
-
46
- <ox-footer-bar ?fullbleed=${fullbleed}></ox-footer-bar>
47
-
48
- <ox-snack-bar></ox-snack-bar>
49
- `
50
- }
51
-
52
- constructor() {
53
- super()
54
- }
55
-
56
- connectedCallback() {
57
- super.connectedCallback()
58
-
59
- window.addEventListener('resize', () => this.resized())
60
-
61
- /* 모듈 임포트를 동적으로 처리한다. */
62
- import(
63
- /* webpackPrefetch: true */
64
- /* webpackPreload: true */
65
- /* webpackChunkName: "modules" */
66
- '../module-importer.import'
67
- ).then(module => {
68
- var modules = module.modules
69
-
70
- /* lifecycle - bootstrapping */
71
- this.dispatchEvent(new Event('lifecycle-bootstrap-begin'))
72
- modules.forEach((m, idx) => {
73
- try {
74
- m.bootstrap && m.bootstrap()
75
- // console.info(`[${idx} BOOTSTRAPED - ${m.name}]`)
76
- } catch (e) {
77
- console.error(`[${idx} BOOTSTRAP ERROR -${m.name}]`, e)
78
- }
79
- })
80
- this.dispatchEvent(new Event('lifecycle-bootstrap-finish'))
81
-
82
- /* shouldUpdate를 활성화한다. */
83
- this._moduleInitialized = true
84
-
85
- /* modules를 store에 dispatch 함으로써, update를 invoke 시킨다. */
86
- store.dispatch({
87
- type: UPDATE_MODULES,
88
- modules
89
- })
90
-
91
- installRouter((location, e) => {
92
- var { contextPath } = getPathInfo(location.pathname)
93
-
94
- if (this._contextPath !== contextPath) {
95
- store.dispatch({
96
- type: UPDATE_CONTEXT_PATH,
97
- contextPath
98
- })
99
- }
100
-
101
- store.dispatch(navigateWithSilence(location))
102
- this._callbacks &&
103
- this._callbacks.forEach(callback => {
104
- try {
105
- callback.call(this, location, e)
106
- } catch (ex) {
107
- console.error(ex)
108
- }
109
- })
110
- })
111
- })
112
-
113
- this.setBase()
114
- }
115
-
116
- resized() {
117
- if (!this._throttledResize) {
118
- this._throttledResize = throttle(() => {
119
- const aside = this.renderRoot.querySelector('ox-aside-bar').clientWidth
120
- const nav = this.renderRoot.querySelector('ox-nav-bar').clientWidth
121
-
122
- this.style.setProperty(
123
- '--app-grid-template-columns',
124
- `auto minmax(calc(100vw - ${aside}px - ${nav}px), 1fr) auto`
125
- )
126
- }, 100)
127
- }
128
-
129
- this._throttledResize()
130
- }
131
-
132
- routeToPage() {
133
- let activePages = this.shadowRoot.querySelectorAll('main > .page[active]')
134
- activePages.forEach(page => {
135
- page.removeAttribute('active')
136
- })
137
-
138
- this._activePage = this.shadowRoot.querySelector(`main > .page[data-page=${this._page}]`)
139
-
140
- if (!this._activePage) {
141
- /* 해당 route에 연결된 page가 없는 경우에 main 섹션에 해당 element를 추가해준다. */
142
- var tagname = this._pages[this._page]
143
- if (tagname) {
144
- var main = this.shadowRoot.querySelector('main')
145
-
146
- var el = document.createElement(tagname)
147
- el.setAttribute('class', 'page')
148
- el.setAttribute('data-page', this._page)
149
-
150
- main.appendChild(el)
151
-
152
- this._activePage = el
153
- }
154
- }
155
-
156
- if (this._activePage) {
157
- this._activePage.setAttribute('active', true)
158
- this._activePage.setAttribute('context-path', this._contextPath)
159
- this._activePage.lifecycle = {
160
- ...(this._activePage.lifecycle || {}),
161
- active: true,
162
- params: this._params,
163
- resourceId: this._resourceId,
164
- page: this._page
165
- }
166
- }
167
-
168
- store.dispatch({
169
- type: UPDATE_ACTIVE_PAGE,
170
- activePage: this._activePage
171
- })
172
- }
173
-
174
- async updated(changedProps) {
175
- if (changedProps.has('_modules')) {
176
- this._readyPageList()
177
- }
178
-
179
- if (changedProps.has('_page') || changedProps.has('_resourceId') || changedProps.has('_params')) {
180
- this.routeToPage()
181
- }
182
-
183
- if (changedProps.has('_contextPath')) {
184
- this.setBase()
185
- }
186
-
187
- this.resized()
188
- }
189
-
190
- shouldUpdate() {
191
- return this._moduleInitialized
192
- }
193
-
194
- stateChanged(state) {
195
- this._page = state.route.page
196
- this._params = state.route.params
197
- this._resourceId = state.route.resourceId
198
- this._callbacks = state.route.callbacks
199
- this._context = state.route.context
200
- this._modules = state.app.modules
201
- this._contextPath = state.app.contextPath
202
- }
203
-
204
- _readyPageList() {
205
- var reversedModules = [...this._modules].reverse()
206
- this._pages = {}
207
-
208
- /* 모듈 참조 순서 역순으로 page를 추가한다. (for overidable) */
209
- reversedModules.forEach(m => {
210
- m.routes &&
211
- m.routes.forEach(route => {
212
- if (!this._pages[route.page]) {
213
- this._pages[route.page] = route.tagname
214
- }
215
- })
216
- })
217
- }
218
-
219
- setBase() {
220
- var base = document.querySelector('base')
221
- base.setAttribute('href', this._contextPath ? `${this._contextPath}/` : '/')
222
- }
223
- }
224
-
225
- window.customElements.define('things-app', ThingsApp)
@@ -1,59 +0,0 @@
1
- import { css, html } from 'lit'
2
-
3
- import { PageView } from '@operato/shell'
4
-
5
- class Page404 extends PageView {
6
- static get styles() {
7
- return css`
8
- :host {
9
- display: block;
10
- box-sizing: border-box;
11
-
12
- background-color: var(--main-section-background-color);
13
- --padding-wide: 15%;
14
- }
15
- section {
16
- padding: var(--padding-wide) 0 0 0;
17
- text-align: center;
18
- color: var(--secondary-color);
19
- }
20
- mwc-icon {
21
- --mdc-icon-size: 120px;
22
- color: var(--status-danger-color);
23
- text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.1);
24
- }
25
- h2 {
26
- margin: 0 auto;
27
- font-size: 2.5em;
28
- text-transform: capitalize;
29
- }
30
- @media only screen and (max-width: 460px) {
31
- mwc-icon {
32
- padding-top: 25%;
33
- --mdc-icon-size: 90px;
34
- }
35
- h2 {
36
- font-size: 2em;
37
- }
38
- }
39
- `
40
- }
41
-
42
- get context() {
43
- return {
44
- title: 'Page Not Found'
45
- }
46
- }
47
-
48
- render() {
49
- return html`
50
- <section>
51
- <mwc-icon>error_outline</mwc-icon>
52
- <h2>page not found!</h2>
53
- The page you requested cannot be found.
54
- </section>
55
- `
56
- }
57
- }
58
-
59
- customElements.define('page-404', Page404)
File without changes