@operato/board 0.2.44 → 0.2.48

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 (145) hide show
  1. package/@types/global/index.d.ts +1 -0
  2. package/CHANGELOG.md +57 -0
  3. package/assets/images/components/no-image.png +0 -0
  4. package/custom-elements.json +4272 -174
  5. package/demo/index-modeller.html +101 -0
  6. package/demo/index.html +3 -3
  7. package/dist/src/index.d.ts +1 -0
  8. package/dist/src/index.js +1 -0
  9. package/dist/src/index.js.map +1 -1
  10. package/dist/src/modeller/component-toolbar/component-detail.d.ts +4 -0
  11. package/dist/src/modeller/component-toolbar/component-detail.js +56 -0
  12. package/dist/src/modeller/component-toolbar/component-detail.js.map +1 -0
  13. package/dist/src/modeller/component-toolbar/component-menu.d.ts +4 -0
  14. package/dist/src/modeller/component-toolbar/component-menu.js +194 -0
  15. package/dist/src/modeller/component-toolbar/component-menu.js.map +1 -0
  16. package/dist/src/modeller/component-toolbar/component-toolbar.d.ts +4 -0
  17. package/dist/src/modeller/component-toolbar/component-toolbar.js +170 -0
  18. package/dist/src/modeller/component-toolbar/component-toolbar.js.map +1 -0
  19. package/dist/src/modeller/edit-toolbar-style.d.ts +4 -0
  20. package/dist/src/modeller/edit-toolbar-style.js +227 -0
  21. package/dist/src/modeller/edit-toolbar-style.js.map +1 -0
  22. package/dist/src/modeller/edit-toolbar.d.ts +61 -0
  23. package/dist/src/modeller/edit-toolbar.js +644 -0
  24. package/dist/src/modeller/edit-toolbar.js.map +1 -0
  25. package/dist/src/modeller/property-sidebar/abstract-property.d.ts +10 -0
  26. package/dist/src/modeller/property-sidebar/abstract-property.js +58 -0
  27. package/dist/src/modeller/property-sidebar/abstract-property.js.map +1 -0
  28. package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.d.ts +48 -0
  29. package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.js +351 -0
  30. package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.js.map +1 -0
  31. package/dist/src/modeller/property-sidebar/data-binding/data-binding.d.ts +8 -0
  32. package/dist/src/modeller/property-sidebar/data-binding/data-binding.js +432 -0
  33. package/dist/src/modeller/property-sidebar/data-binding/data-binding.js.map +1 -0
  34. package/dist/src/modeller/property-sidebar/effects/effects-shared-style.d.ts +4 -0
  35. package/dist/src/modeller/property-sidebar/effects/effects-shared-style.js +57 -0
  36. package/dist/src/modeller/property-sidebar/effects/effects-shared-style.js.map +1 -0
  37. package/dist/src/modeller/property-sidebar/effects/effects.d.ts +6 -0
  38. package/dist/src/modeller/property-sidebar/effects/effects.js +55 -0
  39. package/dist/src/modeller/property-sidebar/effects/effects.js.map +1 -0
  40. package/dist/src/modeller/property-sidebar/effects/property-animation.d.ts +22 -0
  41. package/dist/src/modeller/property-sidebar/effects/property-animation.js +127 -0
  42. package/dist/src/modeller/property-sidebar/effects/property-animation.js.map +1 -0
  43. package/dist/src/modeller/property-sidebar/effects/property-animations.d.ts +5 -0
  44. package/dist/src/modeller/property-sidebar/effects/property-animations.js +83 -0
  45. package/dist/src/modeller/property-sidebar/effects/property-animations.js.map +1 -0
  46. package/dist/src/modeller/property-sidebar/effects/property-event-hover.d.ts +4 -0
  47. package/dist/src/modeller/property-sidebar/effects/property-event-hover.js +124 -0
  48. package/dist/src/modeller/property-sidebar/effects/property-event-hover.js.map +1 -0
  49. package/dist/src/modeller/property-sidebar/effects/property-event-tap.d.ts +4 -0
  50. package/dist/src/modeller/property-sidebar/effects/property-event-tap.js +120 -0
  51. package/dist/src/modeller/property-sidebar/effects/property-event-tap.js.map +1 -0
  52. package/dist/src/modeller/property-sidebar/effects/property-event.d.ts +5 -0
  53. package/dist/src/modeller/property-sidebar/effects/property-event.js +59 -0
  54. package/dist/src/modeller/property-sidebar/effects/property-event.js.map +1 -0
  55. package/dist/src/modeller/property-sidebar/effects/property-shadow.d.ts +22 -0
  56. package/dist/src/modeller/property-sidebar/effects/property-shadow.js +106 -0
  57. package/dist/src/modeller/property-sidebar/effects/property-shadow.js.map +1 -0
  58. package/dist/src/modeller/property-sidebar/effects/value-converter.d.ts +1 -0
  59. package/dist/src/modeller/property-sidebar/effects/value-converter.js +23 -0
  60. package/dist/src/modeller/property-sidebar/effects/value-converter.js.map +1 -0
  61. package/dist/src/modeller/property-sidebar/inspector/inspector.d.ts +24 -0
  62. package/dist/src/modeller/property-sidebar/inspector/inspector.js +290 -0
  63. package/dist/src/modeller/property-sidebar/inspector/inspector.js.map +1 -0
  64. package/dist/src/modeller/property-sidebar/property-shared-style.d.ts +4 -0
  65. package/dist/src/modeller/property-sidebar/property-shared-style.js +131 -0
  66. package/dist/src/modeller/property-sidebar/property-shared-style.js.map +1 -0
  67. package/dist/src/modeller/property-sidebar/property-sidebar.d.ts +10 -0
  68. package/dist/src/modeller/property-sidebar/property-sidebar.js +313 -0
  69. package/dist/src/modeller/property-sidebar/property-sidebar.js.map +1 -0
  70. package/dist/src/modeller/property-sidebar/shapes/box-padding-editor-styles.d.ts +1 -0
  71. package/dist/src/modeller/property-sidebar/shapes/box-padding-editor-styles.js +94 -0
  72. package/dist/src/modeller/property-sidebar/shapes/box-padding-editor-styles.js.map +1 -0
  73. package/dist/src/modeller/property-sidebar/shapes/shapes.d.ts +6 -0
  74. package/dist/src/modeller/property-sidebar/shapes/shapes.js +406 -0
  75. package/dist/src/modeller/property-sidebar/shapes/shapes.js.map +1 -0
  76. package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.d.ts +4 -0
  77. package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.js +127 -0
  78. package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.js.map +1 -0
  79. package/dist/src/modeller/property-sidebar/specifics/specifics.d.ts +5 -0
  80. package/dist/src/modeller/property-sidebar/specifics/specifics.js +78 -0
  81. package/dist/src/modeller/property-sidebar/specifics/specifics.js.map +1 -0
  82. package/dist/src/modeller/property-sidebar/styles/styles.d.ts +8 -0
  83. package/dist/src/modeller/property-sidebar/styles/styles.js +562 -0
  84. package/dist/src/modeller/property-sidebar/styles/styles.js.map +1 -0
  85. package/dist/src/modeller/scene-viewer/confidential-overlay.d.ts +4 -0
  86. package/dist/src/modeller/scene-viewer/confidential-overlay.js +14 -0
  87. package/dist/src/modeller/scene-viewer/confidential-overlay.js.map +1 -0
  88. package/dist/src/modeller/scene-viewer/ox-scene-handler.d.ts +11 -0
  89. package/dist/src/modeller/scene-viewer/ox-scene-handler.js +36 -0
  90. package/dist/src/modeller/scene-viewer/ox-scene-handler.js.map +1 -0
  91. package/dist/src/modeller/scene-viewer/ox-scene-layer.d.ts +10 -0
  92. package/dist/src/modeller/scene-viewer/ox-scene-layer.js +42 -0
  93. package/dist/src/modeller/scene-viewer/ox-scene-layer.js.map +1 -0
  94. package/dist/src/modeller/scene-viewer/ox-scene-player.d.ts +1 -0
  95. package/dist/src/modeller/scene-viewer/ox-scene-player.js +99 -0
  96. package/dist/src/modeller/scene-viewer/ox-scene-player.js.map +1 -0
  97. package/dist/src/modeller/scene-viewer/ox-scene-property.d.ts +6 -0
  98. package/dist/src/modeller/scene-viewer/ox-scene-property.js +19 -0
  99. package/dist/src/modeller/scene-viewer/ox-scene-property.js.map +1 -0
  100. package/dist/src/modeller/scene-viewer/ox-scene-viewer.d.ts +39 -0
  101. package/dist/src/modeller/scene-viewer/ox-scene-viewer.js +245 -0
  102. package/dist/src/modeller/scene-viewer/ox-scene-viewer.js.map +1 -0
  103. package/dist/src/ox-board-modeller.d.ts +13 -4
  104. package/dist/src/ox-board-modeller.js +130 -40
  105. package/dist/src/ox-board-modeller.js.map +1 -1
  106. package/dist/src/types.d.ts +12 -0
  107. package/dist/src/types.js +2 -0
  108. package/dist/src/types.js.map +1 -0
  109. package/dist/tsconfig.tsbuildinfo +1 -1
  110. package/package.json +26 -5
  111. package/src/index.ts +1 -0
  112. package/src/modeller/component-toolbar/component-detail.ts +53 -0
  113. package/src/modeller/component-toolbar/component-menu.ts +190 -0
  114. package/src/modeller/component-toolbar/component-toolbar.ts +161 -0
  115. package/src/modeller/edit-toolbar-style.ts +228 -0
  116. package/src/modeller/edit-toolbar.ts +640 -0
  117. package/src/modeller/property-sidebar/abstract-property.ts +73 -0
  118. package/src/modeller/property-sidebar/data-binding/data-binding-mapper.ts +371 -0
  119. package/src/modeller/property-sidebar/data-binding/data-binding.ts +449 -0
  120. package/src/modeller/property-sidebar/effects/effects-shared-style.ts +58 -0
  121. package/src/modeller/property-sidebar/effects/effects.ts +57 -0
  122. package/src/modeller/property-sidebar/effects/property-animation.ts +133 -0
  123. package/src/modeller/property-sidebar/effects/property-animations.ts +84 -0
  124. package/src/modeller/property-sidebar/effects/property-event-hover.ts +133 -0
  125. package/src/modeller/property-sidebar/effects/property-event-tap.ts +129 -0
  126. package/src/modeller/property-sidebar/effects/property-event.ts +65 -0
  127. package/src/modeller/property-sidebar/effects/property-shadow.ts +114 -0
  128. package/src/modeller/property-sidebar/effects/value-converter.ts +26 -0
  129. package/src/modeller/property-sidebar/inspector/inspector.ts +327 -0
  130. package/src/modeller/property-sidebar/property-shared-style.ts +132 -0
  131. package/src/modeller/property-sidebar/property-sidebar.ts +308 -0
  132. package/src/modeller/property-sidebar/shapes/box-padding-editor-styles.ts +94 -0
  133. package/src/modeller/property-sidebar/shapes/shapes.ts +409 -0
  134. package/src/modeller/property-sidebar/specifics/specific-properties-builder.ts +135 -0
  135. package/src/modeller/property-sidebar/specifics/specifics.ts +72 -0
  136. package/src/modeller/property-sidebar/styles/styles.ts +578 -0
  137. package/src/modeller/scene-viewer/confidential-overlay.ts +18 -0
  138. package/src/modeller/scene-viewer/ox-scene-handler.ts +40 -0
  139. package/src/modeller/scene-viewer/ox-scene-layer.ts +42 -0
  140. package/src/modeller/scene-viewer/ox-scene-player.ts +104 -0
  141. package/src/modeller/scene-viewer/ox-scene-property.ts +10 -0
  142. package/src/modeller/scene-viewer/ox-scene-viewer.ts +248 -0
  143. package/src/ox-board-modeller.ts +138 -42
  144. package/src/types.ts +26 -0
  145. package/yarn-error.log +18355 -0
@@ -0,0 +1,449 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+
5
+ import './data-binding-mapper'
6
+ import '@material/mwc-icon'
7
+ import '@things-factory/help'
8
+ import '@operato/input/dist/src/ox-buttons-radio.js'
9
+ import '@operato/input/dist/src/ox-input-data'
10
+
11
+ import { Properties, Scene } from '@hatiolab/things-scene'
12
+ import { PropertyValues, css, html } from 'lit'
13
+ import { customElement, property, query, state } from 'lit/decorators'
14
+
15
+ import { AbstractProperty } from '../abstract-property'
16
+ import { PropertySharedStyle } from '../property-shared-style'
17
+
18
+ var clipboard = '{}'
19
+
20
+ const PROPS = [
21
+ '',
22
+ 'text',
23
+ ['fillStyle', 'fill style'],
24
+ ['strokeStyle', 'stroke style'],
25
+ ['fontColor', 'font color'],
26
+ 'value',
27
+ 'data',
28
+ 'source',
29
+ 'hidden',
30
+ 'started',
31
+ 'play',
32
+ ['ref', 'reference'],
33
+ 'options',
34
+ 'rotate',
35
+ 'scale',
36
+ 'translate',
37
+ 'dimension',
38
+ 'location',
39
+ 'accessor'
40
+ ].map(prop => {
41
+ return typeof prop == 'string' ? { name: prop, label: prop } : { name: prop[0], label: prop[1] }
42
+ })
43
+
44
+ @customElement('property-data-binding')
45
+ class PropertyDataBinding extends AbstractProperty {
46
+ static styles = [
47
+ PropertySharedStyle,
48
+ css`
49
+ #tab-header {
50
+ display: flex;
51
+ align-items: center;
52
+ justify-content: space-between;
53
+ }
54
+
55
+ #tab-header > mwc-icon {
56
+ padding: 0;
57
+ margin: 0;
58
+ width: 25px;
59
+ height: 25px;
60
+ font-size: x-large;
61
+ border-bottom: 1px solid rgba(0, 0, 0, 0.2);
62
+ }
63
+
64
+ fieldset[collapsable] legend {
65
+ box-sizing: border-box;
66
+ width: 100%;
67
+ }
68
+
69
+ fieldset[collapsable] legend mwc-icon {
70
+ float: right;
71
+ font-size: medium;
72
+ margin: 0;
73
+ }
74
+
75
+ fieldset[collapsable][collapsed] > :not(legend) {
76
+ display: none;
77
+ }
78
+
79
+ ox-buttons-radio {
80
+ flex: 1;
81
+ height: 25px;
82
+ border: 1px solid rgba(0, 0, 0, 0.2);
83
+ border-width: 1px 1px 0 1px;
84
+ text-align: center;
85
+
86
+ display: flex;
87
+ padding: 0;
88
+ box-sizing: border-box;
89
+
90
+ width: 0; /* limit width */
91
+ overflow-x: hidden;
92
+ }
93
+
94
+ ox-buttons-radio > div {
95
+ background-color: rgba(0, 0, 0, 0.2);
96
+ border: 1px solid rgba(0, 0, 0, 0.07);
97
+ border-width: 0 0 2px 0;
98
+ padding: 0;
99
+ color: #fff;
100
+ font-size: 13px;
101
+ max-width: 25px;
102
+ min-width: 25px;
103
+ }
104
+
105
+ ox-buttons-radio > div[disabled] {
106
+ background-color: rgba(0, 0, 0, 0.1);
107
+ }
108
+
109
+ ox-buttons-radio > div[active] {
110
+ border-color: rgb(242, 71, 28);
111
+ }
112
+
113
+ ox-buttons-radio > div.iron-selected {
114
+ background-color: rgba(255, 255, 255, 0.5);
115
+ color: #585858;
116
+ }
117
+
118
+ div[binding] {
119
+ display: flex;
120
+ flex-direction: row-reverse;
121
+ background-color: rgba(255, 255, 255, 0.5);
122
+ overflow: hidden;
123
+ border-style: solid;
124
+ border-color: rgba(0, 0, 0, 0.2);
125
+ border-image: initial;
126
+ border-width: 0px 1px;
127
+ padding: 7px 5px 2px 5px;
128
+ }
129
+
130
+ mwc-icon {
131
+ margin-left: 5px;
132
+ color: var(--secondary-color);
133
+ opacity: 0.8;
134
+ cursor: pointer;
135
+ --mdc-icon-size: 18px;
136
+ }
137
+
138
+ mwc-icon:hover {
139
+ color: var(--primary-color);
140
+ opacity: 1;
141
+ }
142
+
143
+ mwc-icon[disabled] {
144
+ color: rgba(0, 0, 0, 0.1);
145
+ }
146
+
147
+ data-binding-mapper {
148
+ --things-select: {
149
+ min-width: 50%;
150
+ margin-bottom: 10px;
151
+ padding: 3px 20px 2px 5px;
152
+ -webkit-border-radius: 4px;
153
+ -moz-border-radius: 4px;
154
+ border-radius: 4px;
155
+ border: 1px solid rgba(0, 0, 0, 0.15);
156
+ font-size: 15px;
157
+ font-weight: 300;
158
+ -webkit-appearance: none;
159
+ }
160
+ }
161
+ `
162
+ ]
163
+
164
+ @property({ type: Object }) value?: Properties
165
+ @property({ type: Object }) scene?: Scene
166
+
167
+ @state() mappingIndex: number = 0
168
+ @state() _afterRender?: Function | null
169
+ @state() _dataExpanded: boolean = false
170
+
171
+ @query('#tabs') tabs!: HTMLElement
172
+ @query('#tab-nav-left-button') tabNavLeftButton!: HTMLElement
173
+ @query('#tab-nav-right-button') tabNavRightButton!: HTMLElement
174
+
175
+ private mapping: Properties = {}
176
+
177
+ get mappings() {
178
+ return this.value?.mappings || []
179
+ }
180
+
181
+ firstUpdated() {
182
+ this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
183
+
184
+ this.tabContainer.addEventListener('scroll', () => {
185
+ this._onTabScroll()
186
+ })
187
+ }
188
+
189
+ updated(changes: PropertyValues<this>) {
190
+ if (changes.has('value')) {
191
+ this._onValueChanged()
192
+ }
193
+ }
194
+
195
+ render() {
196
+ const value = this.value || {
197
+ mappings: []
198
+ }
199
+
200
+ return html`
201
+ <fieldset>
202
+ <legend>
203
+ <title-with-help topic="board-modeller/data-binding" msgid="label.identifier">identifier</title-with-help>
204
+ </legend>
205
+ <div class="property-grid">
206
+ <label> <i18n-msg msgid="label.id">ID</i18n-msg> </label>
207
+ <input value-key="id" .value=${value.id || ''} />
208
+
209
+ <label> <i18n-msg msgid="label.class">Class</i18n-msg> </label>
210
+ <input value-key="class" .value=${value.class || ''} />
211
+
212
+ <label> <i18n-msg msgid="label.template-prefix">Template Prefix</i18n-msg> </label>
213
+ <input value-key="templatePrefix" .value=${value.templatePrefix || ''} />
214
+
215
+ <div class="checkbox-row">
216
+ <input id="checkbox-ndns" type="checkbox" value-key="ndns" .checked=${value.ndns} />
217
+ <label for="checkbox-ndns"> <i18n-msg msgid="label.ndns">No Data No Show</i18n-msg> </label>
218
+ </div>
219
+
220
+ <div class="checkbox-row">
221
+ <input id="checkbox-sensitive" type="checkbox" value-key="sensitive" .checked=${value.sensitive} />
222
+ <label for="checkbox-sensitive">
223
+ <i18n-msg msgid="label.intent-sensitive">Intent Sensitive</i18n-msg>
224
+ </label>
225
+ </div>
226
+ </div>
227
+ </fieldset>
228
+
229
+ <fieldset collapsable ?collapsed=${!this._dataExpanded}>
230
+ <legend>
231
+ <i18n-msg msgid="label.initial-data">initial value</i18n-msg>
232
+ <mwc-icon
233
+ @click=${() => {
234
+ this._dataExpanded = !this._dataExpanded
235
+ }}
236
+ >${this._dataExpanded ? 'expand_less' : 'expand_more'}</mwc-icon
237
+ >
238
+ </legend>
239
+ <ox-input-data value-key="data" .value=${value.data}> </ox-input-data>
240
+ </fieldset>
241
+
242
+ <fieldset>
243
+ <legend><i18n-msg msgid="label.data-spread">Data Spread</i18n-msg></legend>
244
+ <div id="tab-header">
245
+ <mwc-icon
246
+ id="tab-nav-left-button"
247
+ @click=${() => {
248
+ this._onTabScrollNavLeft()
249
+ }}
250
+ disabled
251
+ >chevron_left</mwc-icon
252
+ >
253
+
254
+ <ox-buttons-radio
255
+ id="tabs"
256
+ .value=${String(this.mappingIndex)}
257
+ @change=${(e: Event) => {
258
+ e.stopPropagation()
259
+ this._setMappingIndex((e.target as any).value)
260
+ }}
261
+ >
262
+ ${this.mappings.map((m: string, i: number) => html` <div data-value=${i} data-mapping>${i + 1}</div> `)}
263
+ <div data-value=${this.mappings.length} data-mapping disabled>${this.mappings.length + 1}</div>
264
+ </ox-buttons-radio>
265
+
266
+ <mwc-icon
267
+ id="tab-nav-right-button"
268
+ @click=${(e: Event) => {
269
+ this._onTabScrollNavRight()
270
+ }}
271
+ disabled
272
+ >chevron_right</mwc-icon
273
+ >
274
+ </div>
275
+
276
+ <div binding>
277
+ <mwc-icon style="font-size:19px" @click=${() => this._clearDataBindingMapper()} title="delete"
278
+ >delete_forever</mwc-icon
279
+ >
280
+ <mwc-icon @click=${() => this._pasteDataBindingMapper()} title="past">content_paste</mwc-icon>
281
+ <mwc-icon style="font-size:17px" @click=${() => this._copyDataBindingMapper()} title="copy"
282
+ >content_copy</mwc-icon
283
+ >
284
+ </div>
285
+
286
+ <data-binding-mapper
287
+ @value-change=${(e: CustomEvent) => this._onMappingChanged(e)}
288
+ .scene=${this.scene}
289
+ .mapping=${(value.mappings && value.mappings[this.mappingIndex]) || {}}
290
+ .properties=${PROPS}
291
+ >
292
+ </data-binding-mapper>
293
+ </fieldset>
294
+ `
295
+ }
296
+
297
+ _setMappingIndex(idx: number) {
298
+ this.mappingIndex = isNaN(Number(idx)) ? 0 : Number(idx)
299
+
300
+ this._onTabScroll()
301
+ }
302
+
303
+ _clearDataBindingMapper() {
304
+ var mappings = [...(this.value?.mappings || [])]
305
+ mappings.splice(this.mappingIndex, 1)
306
+ this._onAfterValueChange(
307
+ 'mappings',
308
+ mappings.filter(m => !!m)
309
+ )
310
+ }
311
+
312
+ _copyDataBindingMapper() {
313
+ clipboard = JSON.stringify(this.mappings[this.mappingIndex])
314
+ }
315
+
316
+ async _pasteDataBindingMapper() {
317
+ var index = this.mappingIndex
318
+ var mappings = [...(this.value?.mappings || [])]
319
+ mappings[this.mappingIndex] = JSON.parse(clipboard)
320
+
321
+ this._onAfterValueChange('mappings', mappings)
322
+
323
+ setTimeout(() => {
324
+ this._setMappingIndex(index)
325
+ }, 100)
326
+ }
327
+
328
+ async _onValueChanged() {
329
+ await this.updateComplete
330
+
331
+ if (this._afterRender) {
332
+ this._afterRender()
333
+ } else {
334
+ this._setMappingIndex(0)
335
+ }
336
+
337
+ this._afterRender = null
338
+ }
339
+
340
+ _onValueChange(e: Event) {
341
+ var element = e.target as HTMLElement
342
+ var key = element.getAttribute('value-key')
343
+
344
+ var value = this._getValueFromEventTarget(element)
345
+
346
+ if (!key) {
347
+ return
348
+ }
349
+
350
+ this.value = {
351
+ ...this.value,
352
+ [key]: value
353
+ }
354
+
355
+ this._onAfterValueChange(key, value)
356
+ }
357
+
358
+ get tabContainer() {
359
+ return this.tabs
360
+ }
361
+
362
+ async _onMappingChanged(e: CustomEvent) {
363
+ var mapping = (e.target as any).mapping
364
+
365
+ /* data spread target의 변경이 있는 경우, target 컴포넌트들의 태그를 블링크 시킨다 */
366
+ if (mapping && mapping.target) {
367
+ this.scene &&
368
+ this.scene.findAll(mapping.target, this.scene.selected && this.scene.selected[0]).forEach((c, i) => {
369
+ if (i == 0) c.trigger('tagreset')
370
+ c.trigger('tag', {})
371
+ })
372
+ }
373
+
374
+ /* mapping의 모든 속성이 편집되면, 모델에 반영한다. */
375
+ var mappings = [...(this.value?.mappings || [])]
376
+
377
+ if (mapping.target && mapping.property && mapping.rule) {
378
+ mappings[this.mappingIndex] = mapping
379
+
380
+ var mappingIdx = this.mappingIndex
381
+ this._afterRender = () => {
382
+ this._setMappingIndex(mappingIdx)
383
+ this.tabContainer.scrollLeft = this.tabContainer.scrollWidth
384
+ }
385
+
386
+ this.dispatchEvent(
387
+ new CustomEvent('property-change', {
388
+ bubbles: true,
389
+ composed: true,
390
+ detail: {
391
+ mappings: mappings.filter(m => !!m)
392
+ }
393
+ })
394
+ )
395
+
396
+ await this.requestUpdate()
397
+ } else if (!mapping.target && !mapping.property) {
398
+ // accessor를 입력중인 경우 tabIndex Change 방지
399
+ if (e.detail && e.detail.changed && !e.detail.changed.accessor) {
400
+ mappings[this.mappingIndex] = null
401
+ var nextMappingIdx = Math.max(this.mappingIndex - 1, 0)
402
+ this._afterRender = () => {
403
+ this._setMappingIndex(nextMappingIdx)
404
+ }
405
+ this.dispatchEvent(
406
+ new CustomEvent('property-change', {
407
+ bubbles: true,
408
+ composed: true,
409
+ detail: {
410
+ mappings: mappings.filter(m => !!m)
411
+ }
412
+ })
413
+ )
414
+ }
415
+ }
416
+ }
417
+
418
+ _onTabScroll() {
419
+ if (this.tabContainer.clientWidth == this.tabContainer.scrollWidth) {
420
+ this.tabNavLeftButton.setAttribute('disabled', '')
421
+ this.tabNavRightButton.setAttribute('disabled', '')
422
+ }
423
+ // left-end
424
+ else if (this.tabContainer.scrollLeft == 0) {
425
+ this.tabNavLeftButton.setAttribute('disabled', '')
426
+ this.tabNavRightButton.removeAttribute('disabled')
427
+ }
428
+ // right-end
429
+ else if (this.tabContainer.scrollLeft + this.tabContainer.clientWidth >= this.tabContainer.scrollWidth) {
430
+ this.tabNavLeftButton.removeAttribute('disabled')
431
+ this.tabNavRightButton.setAttribute('disabled', '')
432
+ } else {
433
+ this.tabNavLeftButton.removeAttribute('disabled')
434
+ this.tabNavRightButton.removeAttribute('disabled')
435
+ }
436
+ }
437
+
438
+ _onTabScrollNavLeft() {
439
+ this.tabContainer.style.scrollBehavior = 'smooth'
440
+ this.tabContainer.scrollLeft -= this.tabContainer.clientWidth
441
+ this.tabContainer.style.scrollBehavior = 'auto'
442
+ }
443
+
444
+ _onTabScrollNavRight() {
445
+ this.tabContainer.style.scrollBehavior = 'smooth'
446
+ this.tabContainer.scrollLeft += this.tabContainer.clientWidth
447
+ this.tabContainer.style.scrollBehavior = 'auto'
448
+ }
449
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+
5
+ import { css } from 'lit'
6
+
7
+ export const EffectsSharedStyle = css`
8
+ :host {
9
+ display: grid;
10
+ grid-template-columns: repeat(10, 1fr);
11
+ grid-gap: 5px;
12
+ grid-auto-rows: minmax(24px, auto);
13
+
14
+ align-items: center;
15
+ }
16
+
17
+ * {
18
+ align-self: stretch;
19
+ }
20
+
21
+ label {
22
+ grid-column: span 3;
23
+ text-align: right;
24
+ text-transform: capitalize;
25
+
26
+ align-self: center;
27
+ }
28
+
29
+ input,
30
+ select,
31
+ ox-input-angle,
32
+ things-editor-color,
33
+ [custom-editor] {
34
+ grid-column: span 7;
35
+ }
36
+
37
+ input,
38
+ select,
39
+ ox-input-angle input,
40
+ things-editor-color input,
41
+ [custom-editor] input {
42
+ border: var(--property-sidebar-fieldset-border);
43
+ }
44
+
45
+ input[type='checkbox'] {
46
+ grid-column: 4 / 5;
47
+ align-self: center;
48
+ }
49
+
50
+ label.checkbox-label {
51
+ grid-column: span 6;
52
+ text-align: left;
53
+ }
54
+
55
+ [fullwidth] {
56
+ grid-column: 1 / -1;
57
+ }
58
+ `
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+
5
+ import './property-animations'
6
+ import './property-event'
7
+ import './property-shadow'
8
+
9
+ import { html } from 'lit'
10
+ import { customElement, property } from 'lit/decorators'
11
+
12
+ import { Properties, Scene } from '@hatiolab/things-scene'
13
+
14
+ import { AbstractProperty } from '../abstract-property'
15
+ import { PropertySharedStyle } from '../property-shared-style'
16
+
17
+ @customElement('property-effect')
18
+ class PropertyEffects extends AbstractProperty {
19
+ static styles = [PropertySharedStyle]
20
+
21
+ @property({ type: Object }) value?: Properties
22
+ @property({ type: Object }) scene?: Scene
23
+
24
+ firstUpdated() {
25
+ this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
26
+ }
27
+
28
+ render() {
29
+ const value = this.value || {}
30
+
31
+ return html`
32
+ <fieldset>
33
+ <legend>
34
+ <title-with-help topic="board-modeller/effects/shadow" msgid="label.shadow">shadow</title-with-help>
35
+ </legend>
36
+
37
+ <property-shadow value-key="shadow" .value=${value.shadow || {}}> </property-shadow>
38
+ </fieldset>
39
+
40
+ <fieldset>
41
+ <legend>
42
+ <title-with-help topic="board-modeller/effects/retention" msgid="label.retention">retention</title-with-help>
43
+ </legend>
44
+
45
+ <div class="property-grid">
46
+ <label> <i18n-msg msgid="label.retention">retention</i18n-msg> </label>
47
+ <input type="number" value-key="retention" .value=${value.retention} placeholder="ms" />
48
+ </div>
49
+ </fieldset>
50
+
51
+ <property-animations value-key="animation" .scene=${this.scene} .value=${value.animation || {}}>
52
+ </property-animations>
53
+
54
+ <property-event value-key="event" .scene=${this.scene} .value=${value.event || {}}> </property-event>
55
+ `
56
+ }
57
+ }
@@ -0,0 +1,133 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+
5
+ import '@operato/input/dist/src/ox-input-angle'
6
+
7
+ import { html, LitElement } from 'lit'
8
+ import { customElement, property } from 'lit/decorators'
9
+
10
+ import { Properties, Scene } from '@hatiolab/things-scene'
11
+
12
+ import { EffectsSharedStyle } from './effects-shared-style'
13
+ import { convert } from './value-converter'
14
+
15
+ /**
16
+ * 컴포넌트의 animation 속성을 편집하는 element
17
+
18
+ Example:
19
+
20
+ <property-animation .value=${animation}>
21
+ </property-animation>
22
+ */
23
+
24
+ @customElement('property-animation')
25
+ export default class PropertyAnimation extends LitElement {
26
+ static styles = [EffectsSharedStyle]
27
+
28
+ @property({ type: Object }) value?: Properties
29
+ @property({ type: Object }) scene?: Scene
30
+
31
+ firstUpdated() {
32
+ this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
33
+ }
34
+
35
+ render() {
36
+ const value = this.value || {}
37
+
38
+ return html`
39
+ <label>Animation Type</label>
40
+ <select value-key="type" .value=${value.type}>
41
+ <option value="">None</option>
42
+ <option value="rotation">Rotation</option>
43
+ <option value="vibration">Vibration</option>
44
+ <option value="heartbeat">Heartbeat</option>
45
+ <option value="moving">Moving</option>
46
+ <option value="fade">Fade</option>
47
+ <option value="outline">Outline</option>
48
+ </select>
49
+
50
+ <label> <i18n-msg msgid="label.waiting-time">waiting time</i18n-msg> </label>
51
+ <input type="number" value-key="delay" .value=${value.delay} placeholder="ms" />
52
+
53
+ <label> <i18n-msg msgid="label.duration">duration</i18n-msg> </label>
54
+ <input type="number" value-key="duration" .value=${value.duration} placeholder="ms" />
55
+
56
+ ${value.type == 'rotation' || value.type == 'vibration'
57
+ ? html`
58
+ <label> <i18n-msg msgid="label.theta">theta</i18n-msg> </label>
59
+ <ox-input-angle value-key="theta" .radian=${value.theta}> </ox-input-angle>
60
+ `
61
+ : html``}
62
+ ${value.type == 'heartbeat'
63
+ ? html`
64
+ <label> <i18n-msg msgid="label.scale">scale</i18n-msg> </label>
65
+ <input type="number" value-key="scale" .value=${value.scale} />
66
+ `
67
+ : html``}
68
+ ${value.type == 'moving'
69
+ ? html`
70
+ <label> <i18n-msg msgid="label.x-axes">X-axes</i18n-msg> </label>
71
+ <input type="number" value-key="x" .value=${value.x} />
72
+
73
+ <label> <i18n-msg msgid="label.y-axes">Y-axes</i18n-msg> </label>
74
+ <input type="number" value-key="y" .value=${value.y} />
75
+ `
76
+ : html``}
77
+ ${value.type == 'fade'
78
+ ? html`
79
+ <label> <i18n-msg msgid="label.start-alpha">start alpha</i18n-msg> </label>
80
+ <input type="number" value-key="startAlpha" .value=${value.startAlpha} />
81
+
82
+ <label> <i18n-msg msgid="label.end-alpha">end alpha</i18n-msg> </label>
83
+ <input type="number" value-key="endAlpha" .value=${value.endAlpha} />
84
+ `
85
+ : html``}
86
+ ${value.type == 'outline'
87
+ ? html`
88
+ <label> <i18n-msg msgid="label.target">target</i18n-msg> </label>
89
+ <input value-key="rideOn" .value=${value.rideOn || ''} list="target-list" />
90
+ <datalist id="target-list">
91
+ ${this.scene!.ids.map(info => info.key).map(id => html` <option value=${id}></option> `)}
92
+ </datalist>
93
+ `
94
+ : html``}
95
+
96
+ <input id="checkbox-repeat" value-key="repeat" type="checkbox" .checked=${value.repeat} />
97
+ <label for="checkbox-repeat" class="checkbox-label"> <i18n-msg msgid="label.repeat">repeat</i18n-msg> </label>
98
+
99
+ <label>delta</label>
100
+ <select value-key="delta" .value=${value.delta}>
101
+ <option value="linear">linear</option>
102
+ <option value="quad">quad</option>
103
+ <option value="circ">circ</option>
104
+ <option value="back">back</option>
105
+ <option value="bounce">bounce</option>
106
+ <option value="elastic">elastic</option>
107
+ </select>
108
+
109
+ <label>ease</label>
110
+ <select value-key="ease" .value=${value.ease}>
111
+ <option value="in">in</option>
112
+ <option value="out">out</option>
113
+ <option value="inout">inout</option>
114
+ </select>
115
+ `
116
+ }
117
+
118
+ _onValueChange(e: Event) {
119
+ var element = e.target as HTMLElement
120
+ var key = element.getAttribute('value-key')
121
+
122
+ if (!key) {
123
+ return
124
+ }
125
+
126
+ this.value = {
127
+ ...this.value,
128
+ [key]: convert(element)
129
+ }
130
+
131
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
132
+ }
133
+ }