@things-factory/board-ui 4.0.11 → 4.0.16

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 (37) hide show
  1. package/client/index.js +0 -2
  2. package/client/pages/board-modeller-page.js +6 -75
  3. package/client/pages/board-player-page.js +1 -1
  4. package/client/pages/board-viewer-page.js +1 -1
  5. package/package.json +9 -10
  6. package/assets/images/icon-properties-ipattern.png +0 -0
  7. package/client/board-modeller/board-modeller.js +0 -237
  8. package/client/board-modeller/component-toolbar/component-menu.js +0 -153
  9. package/client/board-modeller/component-toolbar/component-toolbar.js +0 -193
  10. package/client/board-modeller/edit-toolbar-style.js +0 -228
  11. package/client/board-modeller/edit-toolbar.js +0 -637
  12. package/client/board-modeller/property-sidebar/abstract-property.js +0 -73
  13. package/client/board-modeller/property-sidebar/data-binding/data-binding-mapper.js +0 -366
  14. package/client/board-modeller/property-sidebar/data-binding/data-binding.js +0 -476
  15. package/client/board-modeller/property-sidebar/effects/effects-shared-style.js +0 -58
  16. package/client/board-modeller/property-sidebar/effects/effects.js +0 -64
  17. package/client/board-modeller/property-sidebar/effects/property-animation.js +0 -141
  18. package/client/board-modeller/property-sidebar/effects/property-animations.js +0 -92
  19. package/client/board-modeller/property-sidebar/effects/property-event-hover.js +0 -144
  20. package/client/board-modeller/property-sidebar/effects/property-event-tap.js +0 -146
  21. package/client/board-modeller/property-sidebar/effects/property-event.js +0 -72
  22. package/client/board-modeller/property-sidebar/effects/property-shadow.js +0 -122
  23. package/client/board-modeller/property-sidebar/effects/value-converter.js +0 -26
  24. package/client/board-modeller/property-sidebar/inspector/inspector.js +0 -338
  25. package/client/board-modeller/property-sidebar/property-shared-style.js +0 -132
  26. package/client/board-modeller/property-sidebar/property-sidebar.js +0 -324
  27. package/client/board-modeller/property-sidebar/shapes/box-padding-editor-styles.js +0 -94
  28. package/client/board-modeller/property-sidebar/shapes/shapes.js +0 -421
  29. package/client/board-modeller/property-sidebar/specifics/specific-properties-builder.js +0 -149
  30. package/client/board-modeller/property-sidebar/specifics/specifics.js +0 -248
  31. package/client/board-modeller/property-sidebar/styles/styles.js +0 -591
  32. package/client/board-modeller/scene-viewer/confidential-overlay.js +0 -18
  33. package/client/board-modeller/scene-viewer/things-scene-handler.js +0 -50
  34. package/client/board-modeller/scene-viewer/things-scene-layer.js +0 -52
  35. package/client/board-modeller/scene-viewer/things-scene-player.js +0 -115
  36. package/client/board-modeller/scene-viewer/things-scene-property.js +0 -25
  37. package/client/board-modeller/scene-viewer/things-scene-viewer.js +0 -312
package/client/index.js CHANGED
@@ -1,7 +1,5 @@
1
1
  export * from './actions/board'
2
2
 
3
- export * from './board-modeller/board-modeller'
4
- export * from './board-modeller/edit-toolbar'
5
3
  export * from './board-provider'
6
4
  export * from './viewparts/board-selector'
7
5
  export * from './viewparts/board-creation-card'
@@ -1,19 +1,15 @@
1
- import '../board-modeller/board-modeller'
2
- import '../board-modeller/edit-toolbar'
3
1
  import './things-scene-components.import'
2
+ import '@operato/board/dist/src/ox-board-modeller.js'
4
3
 
5
- import { PageView, client, store } from '@things-factory/shell'
4
+ import { PageView, client, gqlContext, store } from '@things-factory/shell'
6
5
  import { css, html } from 'lit-element'
7
- import { isMacOS, togglefullscreen } from '@things-factory/utils'
8
6
 
9
7
  import { ADD_BOARD_COMPONENTS } from '../actions/board'
10
8
  import { OxPropertyEditor } from '@operato/property-editor'
11
9
  import components from './things-scene-components-with-tools.import'
12
10
  import { connect } from 'pwa-helpers/connect-mixin.js'
13
11
  import gql from 'graphql-tag'
14
- import { gqlContext } from '@things-factory/shell'
15
12
  import { provider } from '../board-provider'
16
- import { saveAs } from 'file-saver'
17
13
 
18
14
  const NOOP = () => {}
19
15
 
@@ -62,7 +58,6 @@ export class BoardModellerPage extends connect(store)(PageView) {
62
58
  baseUrl: String,
63
59
  selected: Array,
64
60
  mode: Number,
65
- // provider: Object,
66
61
  hideProperty: Boolean,
67
62
  overlay: String,
68
63
  scene: Object,
@@ -127,12 +122,8 @@ export class BoardModellerPage extends connect(store)(PageView) {
127
122
  }
128
123
  }
129
124
 
130
- get editToolbar() {
131
- return this.renderRoot.querySelector('#edittoolbar')
132
- }
133
-
134
125
  get modeller() {
135
- return this.renderRoot.querySelector('board-modeller')
126
+ return this.renderRoot.querySelector('ox-board-modeller')
136
127
  }
137
128
 
138
129
  async refresh() {
@@ -201,12 +192,10 @@ export class BoardModellerPage extends connect(store)(PageView) {
201
192
  pageUpdated(changes, lifecycle) {
202
193
  if (this.active) {
203
194
  this.boardId = lifecycle.resourceId
204
- this.bindShortcutEvent()
205
195
  } else {
206
196
  this.boardId = null
207
197
  this.model = null
208
- this.modeller.close()
209
- this.unbindShortcutEvent()
198
+ this.modeller?.close()
210
199
  }
211
200
  }
212
201
 
@@ -230,20 +219,7 @@ export class BoardModellerPage extends connect(store)(PageView) {
230
219
  ></oops-note>
231
220
  `
232
221
  : html`
233
- <edit-toolbar
234
- id="edittoolbar"
235
- .scene=${this.scene}
236
- .board=${this.board}
237
- .selected=${this.selected}
238
- @hide-property-changed=${e => (this.hideProperty = e.detail.value)}
239
- @open-preview=${e => this.onOpenPreview(e)}
240
- @download-model=${e => this.onDownloadModel(e)}
241
- @modeller-fullscreen=${e => this.onFullscreen(e)}
242
- >
243
- ${this.renderBrandingZone()}
244
- </edit-toolbar>
245
-
246
- <board-modeller
222
+ <ox-board-modeller
247
223
  .mode=${this.mode}
248
224
  @mode-changed=${e => {
249
225
  this.mode = e.detail.value
@@ -267,33 +243,13 @@ export class BoardModellerPage extends connect(store)(PageView) {
267
243
  .fonts=${this.fonts}
268
244
  .hideProperty=${this.hideProperty}
269
245
  >
270
- </board-modeller>
246
+ </ox-board-modeller>
271
247
  <oops-spinner ?show=${this._showSpinner}></oops-spinner>
272
248
  `
273
249
 
274
250
  return html``
275
251
  }
276
252
 
277
- renderBrandingZone() {
278
- return html``
279
- }
280
-
281
- onOpenPreview() {
282
- this.modeller.preview()
283
- }
284
-
285
- onDownloadModel() {
286
- if (!this.scene) return
287
-
288
- var model = JSON.stringify(this.model, null, 2)
289
- var filename = (this.boardName || 'NONAME') + '-' + Date.now() + '.json'
290
- saveAs(new Blob([model], { type: 'application/octet-stream' }), filename)
291
- }
292
-
293
- onFullscreen() {
294
- togglefullscreen(this)
295
- }
296
-
297
253
  async updateBoard() {
298
254
  try {
299
255
  this._showSpinner = true
@@ -344,31 +300,6 @@ export class BoardModellerPage extends connect(store)(PageView) {
344
300
  async saveBoard() {
345
301
  await this.updateBoard()
346
302
  }
347
-
348
- bindShortcutEvent() {
349
- var isMac = isMacOS()
350
-
351
- // TODO: Global Hotkey에 대한 정의를 edit-toolbar에서 가져올 수 있도록 수정해야 함.
352
- const GLOBAL_HOTKEYS = ['Digit1', 'Digit2', 'F11', 'KeyD', 'KeyP', 'KeyS']
353
-
354
- this._shortcutHandler = e => {
355
- var tagName = e.composedPath()[0].tagName
356
- var isInput = tagName.isContentEditable || tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA'
357
- var isGlobalHotkey = GLOBAL_HOTKEYS.includes(e.code)
358
-
359
- if (!isGlobalHotkey && isInput) return
360
- if (!this.editToolbar.onShortcut(e, isMac)) this.modeller.onShortcut(e, isMac)
361
- }
362
-
363
- document.addEventListener('keydown', this._shortcutHandler)
364
- }
365
-
366
- unbindShortcutEvent() {
367
- if (this._shortcutHandler) {
368
- document.removeEventListener('keydown', this._shortcutHandler)
369
- delete this._shortcutHandler
370
- }
371
- }
372
303
  }
373
304
 
374
305
  customElements.define('board-modeller-page', BoardModellerPage)
@@ -1,5 +1,5 @@
1
1
  import './things-scene-components.import'
2
- import '@operato/board' // ox-board-player
2
+ import '@operato/board/dist/src/ox-board-player.js'
3
3
 
4
4
  import { PageView, client, store } from '@things-factory/shell'
5
5
  import { css, html } from 'lit-element'
@@ -1,5 +1,5 @@
1
1
  import './things-scene-components.import'
2
- import '@operato/board' // ox-board-viewer
2
+ import '@operato/board/dist/src/ox-board-viewer.js'
3
3
 
4
4
  import { PageView, client, gqlContext, store } from '@things-factory/shell'
5
5
  import { css, html } from 'lit-element'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/board-ui",
3
- "version": "4.0.11",
3
+ "version": "4.0.16",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -26,25 +26,24 @@
26
26
  "dependencies": {
27
27
  "@material/mwc-list": "^0.25.3",
28
28
  "@material/mwc-select": "^0.25.3",
29
- "@operato/board": "^0.2.35",
29
+ "@operato/board": "^0.2.47",
30
+ "@operato/popup": "^0.2.47",
30
31
  "@polymer/iron-icon": "^3.0.1",
31
32
  "@polymer/iron-icons": "^3.0.1",
32
33
  "@polymer/paper-button": "^3.0.1",
33
- "@polymer/paper-dialog": "^3.0.1",
34
- "@polymer/paper-dialog-scrollable": "^3.0.1",
35
34
  "@polymer/paper-dropdown-menu": "^3.0.1",
36
35
  "@polymer/paper-icon-button": "^3.0.2",
37
36
  "@polymer/paper-item": "^3.0.1",
38
37
  "@polymer/paper-listbox": "^3.0.1",
39
38
  "@polymer/paper-menu-button": "^3.0.1",
40
39
  "@polymer/paper-slider": "^3.0.1",
41
- "@things-factory/barcode-base": "^4.0.11",
42
- "@things-factory/grist-ui": "^4.0.11",
43
- "@things-factory/help": "^4.0.11",
44
- "@things-factory/i18n-base": "^4.0.11",
45
- "@things-factory/modeller-ui": "^4.0.11",
40
+ "@things-factory/barcode-base": "^4.0.16",
41
+ "@things-factory/grist-ui": "^4.0.16",
42
+ "@things-factory/help": "^4.0.16",
43
+ "@things-factory/i18n-base": "^4.0.16",
44
+ "@things-factory/modeller-ui": "^4.0.16",
46
45
  "file-saver": "^2.0.2",
47
46
  "sortablejs": "^1.10.2"
48
47
  },
49
- "gitHead": "47745d8cdbe99f11d8d69bbcab3901c9771525a0"
48
+ "gitHead": "5a56e53e09d5b0a47b7446dbb2fa696232ad5414"
50
49
  }
@@ -1,237 +0,0 @@
1
- import '@material/mwc-fab'
2
- import '@operato/board' // ox-board-viewer
3
- import '@polymer/paper-dialog/paper-dialog'
4
- import './scene-viewer/things-scene-viewer'
5
- import './component-toolbar/component-toolbar'
6
- import './property-sidebar/property-sidebar'
7
-
8
- import { LitElement, css, html } from 'lit-element'
9
-
10
- export class BoardModeller extends LitElement {
11
- constructor() {
12
- super()
13
-
14
- this.boardName = ''
15
- this.model = null
16
- this.baseUrl = ''
17
- this.selected = []
18
- this.mode = 1
19
- this.provider = null
20
- this.hideProperty = false
21
- this.overlay = null
22
- this.scene = null
23
- this.componentGroupList = []
24
- this.fonts = []
25
- this.propertyEditor = []
26
-
27
- document.addEventListener('get-all-scene-component-ids', e => {
28
- var { component, callback } = e.detail
29
-
30
- if (!this.scene) return
31
-
32
- var ids
33
- if (component) ids = this.scene.findAll(component).map(c => c.model.id)
34
- else ids = this.scene.ids.map(({ key, value }) => key)
35
-
36
- ids = ids.filter(id => !!id).sort()
37
- callback(ids)
38
- })
39
- }
40
-
41
- static get properties() {
42
- return {
43
- boardName: String,
44
- model: Object,
45
- baseUrl: String,
46
- selected: Array,
47
- mode: Number,
48
- provider: Object,
49
- hideProperty: Boolean,
50
- overlay: String,
51
- scene: Object,
52
- componentGroupList: Array,
53
- fonts: Array,
54
- propertyEditor: Array
55
- }
56
- }
57
-
58
- static get styles() {
59
- return [
60
- css`
61
- :host {
62
- display: flex;
63
- flex-direction: row;
64
- height: 100%;
65
- overflow: hidden;
66
- }
67
-
68
- #scene-wrap {
69
- flex: 1;
70
- position: relative;
71
-
72
- display: flex;
73
- flex-direction: row;
74
- }
75
-
76
- things-scene-viewer {
77
- flex: 1;
78
- width: 100%;
79
- height: 100%;
80
- }
81
-
82
- mwc-fab {
83
- position: absolute;
84
- right: 15px;
85
- bottom: 15px;
86
- }
87
- `
88
- ]
89
- }
90
-
91
- render() {
92
- return html`
93
- <component-toolbar
94
- .scene=${this.scene}
95
- .mode=${this.mode}
96
- @mode-changed=${e => {
97
- this.mode = e.detail.value
98
- }}
99
- .componentGroupList=${this.componentGroupList}
100
- .group=${this.group}
101
- >
102
- </component-toolbar>
103
-
104
- <div id="scene-wrap">
105
- <things-scene-viewer
106
- id="scene"
107
- .scene=${this.scene}
108
- @scene-changed=${e => {
109
- this.scene = e.detail.value
110
- }}
111
- .model=${this.model}
112
- .selected=${this.selected}
113
- @selected-changed=${e => {
114
- this.selected = e.detail.value
115
- }}
116
- .mode=${this.mode}
117
- @mode-changed=${e => {
118
- this.mode = e.detail.value
119
- }}
120
- fit="ratio"
121
- .baseUrl=${this.baseUrl}
122
- @contextmenu=${e => this.onContextMenu(e)}
123
- .provider=${this.provider}
124
- name="modeller"
125
- >
126
- <things-scene-layer type="selection-layer"></things-scene-layer>
127
- <things-scene-layer type="modeling-layer"></things-scene-layer>
128
- <things-scene-layer type="guide-layer">
129
- <things-scene-property name="ruler" value="disabled"></things-scene-property>
130
- </things-scene-layer>
131
- <things-scene-layer type="shift-layer">
132
- <things-scene-property name="text" value="${this.overlay}"></things-scene-property>
133
- <things-scene-property name="alpha" value="0.3"></things-scene-property>
134
- <things-scene-property name="fontFamily" value="arial"></things-scene-property>
135
- <things-scene-property name="fontSize" value="30" type="number"></things-scene-property>
136
- <things-scene-property name="fontColor" value="navy"></things-scene-property>
137
- <things-scene-property name="textBaseline" value="top"></things-scene-property>
138
- <things-scene-property name="textAlign" value="left"></things-scene-property>
139
- <things-scene-property name="paddingTop" value="50" type="number"></things-scene-property>
140
- <things-scene-property name="paddingLeft" value="50" type="number"></things-scene-property>
141
- </things-scene-layer>
142
- <things-scene-layer type="tag-layer"></things-scene-layer>
143
- <things-scene-handler type="text-editor"></things-scene-handler>
144
- <things-scene-handler type="move-handler"></things-scene-handler>
145
- </things-scene-viewer>
146
-
147
- <mwc-fab icon="save" @click=${e => this.onTapSave(e)} title="save"> </mwc-fab>
148
- </div>
149
-
150
- <property-sidebar
151
- .scene=${this.scene}
152
- .selected=${this.selected}
153
- .collapsed=${this.hideProperty}
154
- .fonts=${this.fonts}
155
- .propertyEditor=${this.propertyEditor}
156
- >
157
- </property-sidebar>
158
- `
159
- }
160
-
161
- close() {
162
- this.model = null
163
- this.requestUpdate()
164
- }
165
-
166
- get modellingContainer() {
167
- return this.renderRoot.getElementById('scene-wrap')
168
- }
169
-
170
- onShortcut(e, MacOS) {
171
- if (MacOS) var ctrlKey = e.metaKey
172
- else var ctrlKey = e.ctrlKey
173
-
174
- switch (e.code) {
175
- case 'KeyS':
176
- if (ctrlKey) {
177
- this.onTapSave()
178
- e.preventDefault()
179
- }
180
- break
181
- }
182
- }
183
-
184
- preview() {
185
- this.previewModel = this.scene?.model ? JSON.parse(JSON.stringify(this.scene.model)) : null
186
-
187
- /*
188
- * paper-dialog appears behind backdrop when inside a <app-header-layout ..
189
- * https://github.com/PolymerElements/paper-dialog/issues/152
190
- **/
191
-
192
- var preview = document.createElement('ox-board-viewer')
193
-
194
- preview.style.width = '100%'
195
- preview.style.height = '100%'
196
- preview.style.margin = '0'
197
- preview.style.padding = '0'
198
- preview.style.flex = 1
199
- preview.provider = this.provider
200
- preview.board = {
201
- id: 'preview',
202
- model: this.previewModel
203
- }
204
- preview.baseUrl = this.baseUrl
205
-
206
- var dialog = document.createElement('paper-dialog')
207
-
208
- dialog.style.width = '100%'
209
- dialog.style.height = '100%'
210
- dialog.style.display = 'flex'
211
- dialog.style['flex-direction'] = 'column'
212
- dialog.setAttribute('with-backdrop', true)
213
- dialog.setAttribute('auto-fit-on-attach', true)
214
- dialog.setAttribute('always-on-top', true)
215
- dialog.addEventListener('iron-overlay-closed', () => {
216
- preview.board = null
217
- dialog.parentNode.removeChild(dialog)
218
- })
219
-
220
- dialog.appendChild(preview)
221
- document.body.appendChild(dialog)
222
-
223
- dialog.open()
224
-
225
- requestAnimationFrame(() => {
226
- dispatchEvent(new Event('resize'))
227
- })
228
- }
229
-
230
- onTapSave() {
231
- this.dispatchEvent(new CustomEvent('save-model', { bubbles: true, composed: true, detail: { model: this.model } }))
232
- }
233
-
234
- onContextMenu() {}
235
- }
236
-
237
- customElements.define('board-modeller', BoardModeller)
@@ -1,153 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import { LitElement, html, css } from 'lit-element'
6
-
7
- import { deepClone } from '@things-factory/utils'
8
- import { ScrollbarStyles } from '@things-factory/styles'
9
-
10
- import noImage from '../../../assets/images/components/no-image.png'
11
-
12
- class ComponentMenu extends LitElement {
13
- static get styles() {
14
- return [
15
- ScrollbarStyles,
16
- css`
17
- :host {
18
- display: flex;
19
- flex-direction: column;
20
- align-content: stretch;
21
-
22
- background-color: var(--component-menu-background-color);
23
- margin: 0px;
24
- padding: 0px;
25
-
26
- width: 180px;
27
- height: 100%;
28
-
29
- overflow: hidden;
30
-
31
- border: 2px solid var(--component-menu-border-color);
32
- box-sizing: border-box;
33
-
34
- position: absolute;
35
- top: 0px;
36
-
37
- z-index: 1;
38
- }
39
-
40
- h2 {
41
- background-color: var(--component-menu-border-color);
42
- padding: 1px 5px;
43
- margin: 0;
44
- font: var(--component-menu-title);
45
- color: #fff;
46
- text-transform: capitalize;
47
- }
48
-
49
- [templates] {
50
- flex: 1;
51
-
52
- display: block;
53
- margin: 0;
54
- padding: 0;
55
- overflow-y: auto;
56
-
57
- background-color: var(--component-menu-background-color);
58
- }
59
-
60
- [template] {
61
- display: flex;
62
- align-items: center;
63
- min-height: var(--component-menu-item-icon-size);
64
- padding: 0 5px 0 0;
65
- border-bottom: 1px solid rgba(0, 0, 0, 0.1);
66
- font-size: 11px;
67
- color: var(--component-menu-item-color);
68
- }
69
-
70
- [template]:hover,
71
- [template]:focus {
72
- color: var(--component-menu-item-hover-color);
73
- font-weight: bold;
74
- cursor: pointer;
75
- }
76
-
77
- [template] img {
78
- margin: 5px;
79
- width: var(--component-menu-item-icon-size);
80
- height: var(--component-menu-item-icon-size);
81
- }
82
- `
83
- ]
84
- }
85
-
86
- static get properties() {
87
- return {
88
- groups: Object,
89
- scene: Object,
90
- group: String,
91
- templates: Array
92
- }
93
- }
94
-
95
- render() {
96
- return this.group
97
- ? html`
98
- <h2 onclick=${e => e.stopPropagation()}>${this.group} list</h2>
99
-
100
- <div templates>
101
- ${(this.templates || []).map(
102
- template => html`
103
- <div @click=${this.onClickTemplate} data-type=${template.type} template>
104
- <img src=${this.templateIcon(template)} />${template.type}
105
- </div>
106
- `
107
- )}
108
- </div>
109
- `
110
- : html``
111
- }
112
-
113
- updated(changes) {
114
- if (changes.has('group')) {
115
- if (!this.group) {
116
- this.style.display = 'none'
117
- this.templates = []
118
- } else {
119
- this.style.display = 'flex'
120
- this.templates = this.groups.find(g => g.name === this.group).templates
121
- }
122
- }
123
- }
124
-
125
- onClickTemplate(e) {
126
- var item = e.target
127
-
128
- while (!(item !== this) || !item || !item.hasAttribute || !item.hasAttribute('data-type')) {
129
- item = item.parentElement
130
- }
131
-
132
- var type = item.getAttribute('data-type')
133
-
134
- if (!type) {
135
- return
136
- }
137
-
138
- var group = this.groups.find(g => g.name == this.group)
139
-
140
- if (this.scene && group) {
141
- var template = group.templates.find(template => template.type == type)
142
- template && this.scene.add(deepClone(template.model), { cx: 200, cy: 200 })
143
- }
144
-
145
- this.group = null
146
- }
147
-
148
- templateIcon(template) {
149
- return template.icon || noImage
150
- }
151
- }
152
-
153
- customElements.define('component-menu', ComponentMenu)