@operato/board 1.0.0-alpha.6 → 1.0.0-beta.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +401 -0
  2. package/dist/src/graphql/data-subscription.d.ts +7 -0
  3. package/dist/src/graphql/data-subscription.js +24 -0
  4. package/dist/src/graphql/data-subscription.js.map +1 -0
  5. package/dist/src/modeller/property-sidebar/abstract-property.js +0 -3
  6. package/dist/src/modeller/property-sidebar/abstract-property.js.map +1 -1
  7. package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.d.ts +2 -2
  8. package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.js +7 -7
  9. package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.js.map +1 -1
  10. package/dist/src/modeller/property-sidebar/data-binding/data-binding.js +5 -2
  11. package/dist/src/modeller/property-sidebar/data-binding/data-binding.js.map +1 -1
  12. package/dist/src/modeller/property-sidebar/effects/effects-shared-style.js +2 -2
  13. package/dist/src/modeller/property-sidebar/effects/effects-shared-style.js.map +1 -1
  14. package/dist/src/modeller/property-sidebar/effects/property-shadow.d.ts +1 -1
  15. package/dist/src/modeller/property-sidebar/effects/property-shadow.js +4 -4
  16. package/dist/src/modeller/property-sidebar/effects/property-shadow.js.map +1 -1
  17. package/dist/src/modeller/property-sidebar/effects/value-converter.js +0 -2
  18. package/dist/src/modeller/property-sidebar/effects/value-converter.js.map +1 -1
  19. package/dist/src/modeller/property-sidebar/inspector/inspector.d.ts +1 -1
  20. package/dist/src/modeller/property-sidebar/property-shared-style.js +1 -1
  21. package/dist/src/modeller/property-sidebar/property-shared-style.js.map +1 -1
  22. package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.d.ts +1 -1
  23. package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.js +2 -2
  24. package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.js.map +1 -1
  25. package/dist/src/modeller/property-sidebar/styles/styles.d.ts +3 -3
  26. package/dist/src/modeller/property-sidebar/styles/styles.js +8 -10
  27. package/dist/src/modeller/property-sidebar/styles/styles.js.map +1 -1
  28. package/dist/src/ox-board-modeller.d.ts +2 -2
  29. package/dist/src/ox-board-modeller.js +5 -5
  30. package/dist/src/ox-board-modeller.js.map +1 -1
  31. package/dist/src/ox-board-viewer.d.ts +3 -1
  32. package/dist/src/ox-board-viewer.js +16 -3
  33. package/dist/src/ox-board-viewer.js.map +1 -1
  34. package/dist/tsconfig.tsbuildinfo +1 -1
  35. package/package.json +15 -14
  36. package/src/graphql/data-subscription.ts +30 -0
  37. package/src/modeller/property-sidebar/abstract-property.ts +0 -4
  38. package/src/modeller/property-sidebar/data-binding/data-binding-mapper.ts +8 -9
  39. package/src/modeller/property-sidebar/data-binding/data-binding.ts +7 -5
  40. package/src/modeller/property-sidebar/effects/effects-shared-style.ts +2 -2
  41. package/src/modeller/property-sidebar/effects/property-shadow.ts +4 -5
  42. package/src/modeller/property-sidebar/effects/value-converter.ts +0 -3
  43. package/src/modeller/property-sidebar/property-shared-style.ts +1 -1
  44. package/src/modeller/property-sidebar/specifics/specific-properties-builder.ts +3 -3
  45. package/src/modeller/property-sidebar/styles/styles.ts +9 -12
  46. package/src/ox-board-modeller.ts +6 -7
  47. package/src/ox-board-viewer.ts +21 -7
  48. package/yarn-error.log +0 -16185
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operato/board",
3
- "version": "1.0.0-alpha.6",
3
+ "version": "1.0.0-beta.0",
4
4
  "description": "Webcomponent for board following open-wc recommendations",
5
5
  "author": "heartyoh",
6
6
  "license": "MIT",
@@ -49,28 +49,29 @@
49
49
  "storybook:build": "tsc && npm run analyze -- --exclude dist && build-storybook"
50
50
  },
51
51
  "dependencies": {
52
- "@operato/data-grist": "^1.0.0-alpha.6",
53
- "@operato/graphql": "^1.0.0-alpha.6",
54
- "@operato/i18n": "^1.0.0-alpha.6",
55
- "@operato/input": "^1.0.0-alpha.6",
56
- "@operato/markdown": "^1.0.0-alpha.6",
57
- "@operato/popup": "^1.0.0-alpha.6",
58
- "@operato/property-editor": "^1.0.0-alpha.6",
59
- "@operato/styles": "^1.0.0-alpha.6",
60
- "@operato/utils": "^1.0.0-alpha.6",
52
+ "@operato/app": "^1.0.0-beta.0",
53
+ "@operato/data-grist": "^1.0.0-beta.0",
54
+ "@operato/font": "^1.0.0-beta.0",
55
+ "@operato/graphql": "^1.0.0-beta.0",
56
+ "@operato/i18n": "^1.0.0-beta.0",
57
+ "@operato/input": "^1.0.0-beta.0",
58
+ "@operato/markdown": "^1.0.0-beta.0",
59
+ "@operato/popup": "^1.0.0-beta.0",
60
+ "@operato/property-editor": "^1.0.0-beta.0",
61
+ "@operato/styles": "^1.0.0-beta.0",
62
+ "@operato/utils": "^1.0.0-beta.0",
61
63
  "@polymer/paper-dropdown-menu": "^3.2.0",
62
- "@things-factory/modeller-ui": "^5.0.0-alpha.3",
63
64
  "@types/file-saver": "^2.0.4",
64
65
  "@types/sortablejs": "^1.10.7",
65
66
  "file-saver": "^2.0.5",
66
- "lit": "^2.2.0",
67
+ "lit": "^2.2.1",
67
68
  "lodash-es": "^4.17.21",
68
69
  "sortablejs": "^1.14.0"
69
70
  },
70
71
  "devDependencies": {
71
72
  "@custom-elements-manifest/analyzer": "^0.4.17",
72
73
  "@hatiolab/prettier-config": "^1.0.0",
73
- "@hatiolab/things-scene": "^2.7.34",
74
+ "@hatiolab/things-scene": "^2.8.1",
74
75
  "@material/mwc-fab": "^0.25.3",
75
76
  "@material/mwc-icon": "^0.25.3",
76
77
  "@open-wc/eslint-config": "^4.3.0",
@@ -106,5 +107,5 @@
106
107
  "prettier --write"
107
108
  ]
108
109
  },
109
- "gitHead": "10e76a7dff381643b2f2ff3bb57d59f93f752a2b"
110
+ "gitHead": "06b7a224872643b4dfdd95efc83770ce96057bdf"
110
111
  }
@@ -0,0 +1,30 @@
1
+ import { Component, DataSubscriptionProvider } from '@hatiolab/things-scene'
2
+
3
+ import gql from 'graphql-tag'
4
+ import { subscribe } from '@operato/graphql'
5
+
6
+ export class DataSubscriptionProviderImpl implements DataSubscriptionProvider {
7
+ async subscribe(tag: string, component: Component) {
8
+ return await subscribe(
9
+ {
10
+ query: gql`
11
+ subscription {
12
+ data(tag: "${tag}") {
13
+ tag
14
+ data
15
+ }
16
+ }
17
+ `
18
+ },
19
+ {
20
+ next: async ({ data }: { data: any }) => {
21
+ if (data) {
22
+ component.data = data.data.data
23
+ }
24
+ }
25
+ }
26
+ )
27
+ }
28
+
29
+ dispose() {}
30
+ }
@@ -26,10 +26,6 @@ export class AbstractProperty extends LitElement {
26
26
  var value
27
27
 
28
28
  switch (element.tagName) {
29
- case 'THINGS-EDITOR-ANGLE-INPUT':
30
- value = Number((element as any).radian) || 0
31
- break
32
-
33
29
  case 'INPUT':
34
30
  switch ((element as any).type) {
35
31
  case 'checkbox':
@@ -2,16 +2,15 @@
2
2
  * @license Copyright © HatioLab Inc. All rights reserved.
3
3
  */
4
4
 
5
- import '@things-factory/modeller-ui/client/editors/things-editor-value-map'
6
- import '@things-factory/modeller-ui/client/editors/things-editor-value-range'
5
+ import '@operato/input/ox-input-value-map.js'
6
+ import '@operato/input/ox-input-value-ranges.js'
7
7
  import '@operato/input/ox-buttons-radio.js'
8
8
  import '@operato/input/ox-input-code.js'
9
9
  import '@operato/i18n/ox-i18n.js'
10
10
 
11
- import { css, html, LitElement, PropertyValues } from 'lit'
12
- import { customElement, property, query, state } from 'lit/decorators.js'
13
-
11
+ import { LitElement, PropertyValues, css, html } from 'lit'
14
12
  import { Properties, Scene } from '@hatiolab/things-scene'
13
+ import { customElement, property, query, state } from 'lit/decorators.js'
15
14
 
16
15
  export type Rule =
17
16
  | {
@@ -220,21 +219,21 @@ export default class DataBindingMapper extends LitElement {
220
219
  </ox-buttons-radio>
221
220
 
222
221
  <div rule-editors class="content" ?hidden=${mapping.rule == 'value'}>
223
- <things-editor-value-map
222
+ <ox-input-value-map
224
223
  value-key="map"
225
224
  .value=${this.rule.map || {}}
226
225
  .valuetype=${this._valuetype(mapping.property!)}
227
226
  ?active=${mapping.rule == 'map'}
228
227
  >
229
- </things-editor-value-map>
228
+ </ox-input-value-map>
230
229
 
231
- <things-editor-value-range
230
+ <ox-input-value-ranges
232
231
  value-key="range"
233
232
  .value=${this.rule.range || []}
234
233
  .valuetype=${this._valuetype(mapping.property!)}
235
234
  ?active=${mapping.rule == 'range'}
236
235
  >
237
- </things-editor-value-range>
236
+ </ox-input-value-ranges>
238
237
 
239
238
  <ox-input-code
240
239
  value-key="eval"
@@ -9,10 +9,9 @@ import '@operato/input/ox-buttons-radio.js'
9
9
  import '@operato/input/ox-input-data.js'
10
10
  import '@operato/i18n/ox-i18n.js'
11
11
 
12
- import { css, html, PropertyValues } from 'lit'
13
- import { customElement, property, query, state } from 'lit/decorators.js'
14
-
15
12
  import { Properties, Scene } from '@hatiolab/things-scene'
13
+ import { PropertyValues, css, html } from 'lit'
14
+ import { customElement, property, query, state } from 'lit/decorators.js'
16
15
 
17
16
  import { AbstractProperty } from '../abstract-property'
18
17
  import { PropertySharedStyle } from '../property-shared-style'
@@ -213,6 +212,9 @@ class PropertyDataBinding extends AbstractProperty {
213
212
  <label> <ox-i18n msgid="label.class">Class</ox-i18n> </label>
214
213
  <input value-key="class" .value=${value.class || ''} />
215
214
 
215
+ <label> <ox-i18n msgid="label.tag">Tag</ox-i18n> </label>
216
+ <input value-key="tag" .value=${value.tag || ''} />
217
+
216
218
  <label> <ox-i18n msgid="label.template-prefix">Template Prefix</ox-i18n> </label>
217
219
  <input value-key="templatePrefix" .value=${value.templatePrefix || ''} />
218
220
 
@@ -370,8 +372,8 @@ class PropertyDataBinding extends AbstractProperty {
370
372
  if (mapping && mapping.target) {
371
373
  this.scene &&
372
374
  this.scene.findAll(mapping.target, this.scene.selected && this.scene.selected[0]).forEach((c, i) => {
373
- if (i == 0) c.trigger('tagreset')
374
- c.trigger('tag', {})
375
+ if (i == 0) c.trigger('decotagreset')
376
+ c.trigger('decotag', {})
375
377
  })
376
378
  }
377
379
 
@@ -29,7 +29,7 @@ export const EffectsSharedStyle = css`
29
29
  input,
30
30
  select,
31
31
  ox-input-angle,
32
- things-editor-color,
32
+ ox-input-color,
33
33
  [custom-editor] {
34
34
  grid-column: span 7;
35
35
  }
@@ -37,7 +37,7 @@ export const EffectsSharedStyle = css`
37
37
  input,
38
38
  select,
39
39
  ox-input-angle input,
40
- things-editor-color input,
40
+ ox-input-color input,
41
41
  [custom-editor] input {
42
42
  border: var(--property-sidebar-fieldset-border);
43
43
  }
@@ -2,14 +2,13 @@
2
2
  * @license Copyright © HatioLab Inc. All rights reserved.
3
3
  */
4
4
 
5
- import '@things-factory/modeller-ui/client/editors/things-editor-color'
6
5
  import '@operato/i18n/ox-i18n.js'
6
+ import '@operato/input/ox-input-color.js'
7
7
 
8
- import { css, html, LitElement } from 'lit'
8
+ import { LitElement, css, html } from 'lit'
9
9
  import { customElement, property } from 'lit/decorators.js'
10
10
 
11
11
  import { Properties } from '@hatiolab/things-scene'
12
-
13
12
  import { convert } from './value-converter'
14
13
 
15
14
  /**
@@ -48,7 +47,7 @@ export default class PropertyShadow extends LitElement {
48
47
  }
49
48
 
50
49
  input[type='number'],
51
- things-editor-color {
50
+ ox-input-color {
52
51
  grid-column: span 7;
53
52
  }
54
53
  input[type='number'] {
@@ -93,7 +92,7 @@ export default class PropertyShadow extends LitElement {
93
92
 
94
93
  <label class="icon-only-label color"></label>
95
94
 
96
- <things-editor-color value-key="color" .value=${value.color}> </things-editor-color>
95
+ <ox-input-color value-key="color" .value=${value.color}> </ox-input-color>
97
96
  `
98
97
  }
99
98
 
@@ -1,8 +1,5 @@
1
1
  export function convert(element: any) {
2
2
  switch (element.tagName) {
3
- case 'THINGS-EDITOR-ANGLE-INPUT':
4
- return Number(element.radian) || 0
5
-
6
3
  case 'INPUT':
7
4
  switch (element.type) {
8
5
  case 'checkbox':
@@ -52,7 +52,7 @@ export const PropertySharedStyle = css`
52
52
  .property-grid > select,
53
53
  .property-grid > ox-input-angle,
54
54
  .property-grid > ox-buttons-radio,
55
- .property-grid > things-editor-color,
55
+ .property-grid > ox-input-color,
56
56
  [custom-editor] {
57
57
  grid-column: span 7;
58
58
  align-self: stretch;
@@ -2,13 +2,13 @@
2
2
  * @license Copyright © HatioLab Inc. All rights reserved.
3
3
  */
4
4
 
5
- import '@things-factory/modeller-ui/client/editors/things-editor-property'
5
+ import '@operato/app/property-editor.js' /* for registering property editors */
6
6
 
7
- import { html, LitElement, PropertyValues } from 'lit'
7
+ import { LitElement, PropertyValues, html } from 'lit'
8
8
  import { customElement, property } from 'lit/decorators.js'
9
9
 
10
- import { Properties } from '@hatiolab/things-scene'
11
10
  import { OxPropertyEditor } from '@operato/property-editor'
11
+ import { Properties } from '@hatiolab/things-scene'
12
12
 
13
13
  /**
14
14
  모든 에디터들은 change 이벤트를 지원해야 한다. 또한, 모든 에디터들은 value속성에 값을 가져야 한다.
@@ -4,17 +4,16 @@
4
4
 
5
5
  import '@polymer/paper-dropdown-menu/paper-dropdown-menu'
6
6
  import '@operato/help/ox-title-with-help.js'
7
- import '@things-factory/modeller-ui/client/editors/things-editor-color'
8
- import '@things-factory/modeller-ui/client/editors/things-editor-color-style'
9
- import '@things-factory/modeller-ui/client/editors/things-editor-font-selector'
7
+ import '@operato/input/ox-input-color.js'
8
+ import '@operato/app/input/ox-input-fill-style.js'
9
+ import '@operato/font/ox-font-selector.js'
10
10
  import '@operato/i18n/ox-i18n.js'
11
11
 
12
12
  import { css, html } from 'lit'
13
13
  import { customElement, property } from 'lit/decorators.js'
14
14
 
15
- import { Component } from '@hatiolab/things-scene'
16
-
17
15
  import { AbstractProperty } from '../abstract-property'
16
+ import { Component } from '@hatiolab/things-scene'
18
17
  import { PropertySharedStyle } from '../property-shared-style'
19
18
 
20
19
  @customElement('property-style')
@@ -374,12 +373,12 @@ class PropertyStyles extends AbstractProperty {
374
373
  <ox-i18n msgid="label.font-family">Font Family</ox-i18n>
375
374
  </label>
376
375
 
377
- <things-editor-font-selector
376
+ <ox-font-selector
378
377
  value-key="fontFamily"
379
378
  .value=${fontFamily}
380
379
  class="property-full-input"
381
380
  custom-editor
382
- ></things-editor-font-selector>
381
+ ></ox-font-selector>
383
382
 
384
383
  <label class="property-half-label icon-only-label font-size"></label>
385
384
  <input type="number" value-key="fontSize" .value=${fontSize} class="property-half-input" />
@@ -388,8 +387,7 @@ class PropertyStyles extends AbstractProperty {
388
387
  <input type="number" value-key="lineHeight" .value=${lineHeight} class="property-half-input" />
389
388
 
390
389
  <label class="property-half-label icon-only-label color"></label>
391
- <things-editor-color value-key="fontColor" .value=${fontColor} class="property-half-input">
392
- </things-editor-color>
390
+ <ox-input-color value-key="fontColor" .value=${fontColor} class="property-half-input"> </ox-input-color>
393
391
 
394
392
  <label class="property-half-label"></label>
395
393
  <div class="property-half-input btn-group">
@@ -406,7 +404,7 @@ class PropertyStyles extends AbstractProperty {
406
404
  >
407
405
  </legend>
408
406
 
409
- <things-editor-color-style value-key="fillStyle" .value=${fillStyle}> </things-editor-color-style>
407
+ <ox-input-fill-style value-key="fillStyle" .value=${fillStyle}> </ox-input-fill-style>
410
408
  </fieldset>
411
409
 
412
410
  <fieldset>
@@ -419,8 +417,7 @@ class PropertyStyles extends AbstractProperty {
419
417
  <input type="number" value-key="lineWidth" .value=${lineWidth} class="property-half-input" />
420
418
 
421
419
  <label class="property-half-label icon-only-label color"></label>
422
- <things-editor-color value-key="strokeStyle" .value=${strokeStyle} class="property-half-input">
423
- </things-editor-color>
420
+ <ox-input-color value-key="strokeStyle" .value=${strokeStyle} class="property-half-input"> </ox-input-color>
424
421
 
425
422
  <label class="property-full-label">
426
423
  <ox-i18n msgid="label.line-type">line type</ox-i18n>
@@ -6,16 +6,15 @@ import './modeller/edit-toolbar'
6
6
  import '@hatiolab/things-scene'
7
7
  import './ox-board-viewer'
8
8
 
9
- import { saveAs } from 'file-saver'
10
- import { css, html, LitElement } from 'lit'
9
+ import { ComponentGroup, ComponentTemplate } from './types'
10
+ import { LitElement, css, html } from 'lit'
11
+ import { SCENE_MODE, Scene } from '@hatiolab/things-scene'
11
12
  import { customElement, property, query } from 'lit/decorators.js'
12
-
13
- import { Scene, SCENE_MODE } from '@hatiolab/things-scene'
14
- import { OxPopup } from '@operato/popup'
15
13
  import { isMacOS, togglefullscreen } from '@operato/utils'
16
14
 
17
15
  import { EditToolbar } from './modeller/edit-toolbar'
18
- import { ComponentGroup, ComponentTemplate } from './types'
16
+ import { OxPopup } from '@operato/popup'
17
+ import { saveAs } from 'file-saver'
19
18
 
20
19
  const MACOS = isMacOS()
21
20
 
@@ -256,7 +255,7 @@ export class BoardModeller extends LitElement {
256
255
  <ox-scene-property name="paddingTop" value="50" type="number"></ox-scene-property>
257
256
  <ox-scene-property name="paddingLeft" value="50" type="number"></ox-scene-property>
258
257
  </ox-scene-layer>
259
- <ox-scene-layer type="tag-layer"></ox-scene-layer>
258
+ <ox-scene-layer type="decotag-layer"></ox-scene-layer>
260
259
  <ox-scene-handler type="text-editor"></ox-scene-handler>
261
260
  <ox-scene-handler type="move-handler"></ox-scene-handler>
262
261
  </ox-scene-viewer>
@@ -2,10 +2,12 @@ import '@material/mwc-fab'
2
2
  import '@material/mwc-icon'
3
3
 
4
4
  import { LitElement, PropertyValues, css, html } from 'lit'
5
- import { SCENE_MODE, create } from '@hatiolab/things-scene'
5
+ import { ReferenceProvider, SCENE_MODE, create } from '@hatiolab/things-scene'
6
6
  import { customElement, property, query, state } from 'lit/decorators.js'
7
7
  import { isIOS, togglefullscreen } from '@operato/utils'
8
8
 
9
+ import { DataSubscriptionProviderImpl } from './graphql/data-subscription'
10
+
9
11
  @customElement('ox-board-viewer')
10
12
  export class BoardViewer extends LitElement {
11
13
  static styles = css`
@@ -96,7 +98,7 @@ export class BoardViewer extends LitElement {
96
98
 
97
99
  @property({ type: String }) baseUrl: string = ''
98
100
  @property({ type: Object }) board: any = {}
99
- @property({ type: Object }) provider: any = null
101
+ @property({ type: Object }) provider: ReferenceProvider | null = null
100
102
  @property({ type: Object }) data: any
101
103
 
102
104
  @property({ type: Boolean, reflect: true, attribute: 'hide-fullscreen' }) hideFullscreen = false
@@ -196,7 +198,11 @@ export class BoardViewer extends LitElement {
196
198
  this.closeScene()
197
199
 
198
200
  if (this.board && this.board.id) {
199
- this.initScene()
201
+ if (this.board.model) {
202
+ this.initScene()
203
+ } else {
204
+ this.initSceneAsync()
205
+ }
200
206
  }
201
207
  }
202
208
 
@@ -205,6 +211,13 @@ export class BoardViewer extends LitElement {
205
211
  }
206
212
  }
207
213
 
214
+ async initSceneAsync() {
215
+ if (!this.board || !this.board.id) return
216
+
217
+ this._scene = await this.provider!.get(this.board.id, true)
218
+ this.setupScene(this._scene)
219
+ }
220
+
208
221
  initScene() {
209
222
  if (!this.board || !this.board.id) return
210
223
 
@@ -213,14 +226,15 @@ export class BoardViewer extends LitElement {
213
226
  ...this.board.model
214
227
  },
215
228
  mode: SCENE_MODE.VIEW,
216
- refProvider: this.provider
229
+ refProvider: this.provider!,
230
+ dataSubscriptionProvider: new DataSubscriptionProviderImpl()
217
231
  })
218
232
 
219
233
  if (this.baseUrl) {
220
234
  this._scene.baseUrl = this.baseUrl
221
235
  }
222
236
 
223
- this.provider.add(this.board.id, this._scene)
237
+ this.provider!.add(this.board.id, this._scene)
224
238
 
225
239
  this.setupScene(this._scene)
226
240
  }
@@ -254,7 +268,7 @@ export class BoardViewer extends LitElement {
254
268
  /* scene의 기존 target을 보관한다. */
255
269
  this._oldtarget = this._scene.target
256
270
 
257
- this._scene.fit(this.board.model.fitMode)
271
+ this._scene.fit(this._scene.fitMode)
258
272
  this._scene.target = this._target
259
273
 
260
274
  if (this.data) {
@@ -270,7 +284,7 @@ export class BoardViewer extends LitElement {
270
284
  if (!boardId) return
271
285
 
272
286
  try {
273
- var scene = await this.provider.get(boardId, true)
287
+ var scene = await this.provider!.get(boardId, true)
274
288
 
275
289
  if (scene === this._scene) {
276
290
  scene.release()