@operato/property-panel 9.2.1 → 10.0.0-beta.1

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 (77) hide show
  1. package/dist/src/index.d.ts +1 -0
  2. package/dist/src/index.js +1 -0
  3. package/dist/src/index.js.map +1 -1
  4. package/dist/src/ox-property-panel.d.ts +8 -0
  5. package/dist/src/ox-property-panel.js +44 -3
  6. package/dist/src/ox-property-panel.js.map +1 -1
  7. package/dist/src/property-panel/abstract-property.js +1 -0
  8. package/dist/src/property-panel/abstract-property.js.map +1 -1
  9. package/dist/src/property-panel/data-binding/data-binding-mapper.js +1 -1
  10. package/dist/src/property-panel/data-binding/data-binding-mapper.js.map +1 -1
  11. package/dist/src/property-panel/data-binding/data-binding.js.map +1 -1
  12. package/dist/src/property-panel/effects/property-animation.js +1 -1
  13. package/dist/src/property-panel/effects/property-animation.js.map +1 -1
  14. package/dist/src/property-panel/effects/property-event-hover.d.ts +1 -1
  15. package/dist/src/property-panel/effects/property-event-hover.js +3 -3
  16. package/dist/src/property-panel/effects/property-event-hover.js.map +1 -1
  17. package/dist/src/property-panel/effects/property-event-tap.js +4 -4
  18. package/dist/src/property-panel/effects/property-event-tap.js.map +1 -1
  19. package/dist/src/property-panel/inspector/inspector.js +6 -6
  20. package/dist/src/property-panel/inspector/inspector.js.map +1 -1
  21. package/dist/src/property-panel/shapes/shapes.d.ts +0 -2
  22. package/dist/src/property-panel/shapes/shapes.js +5 -44
  23. package/dist/src/property-panel/shapes/shapes.js.map +1 -1
  24. package/dist/src/property-panel/threed/property-material3d.d.ts +27 -0
  25. package/dist/src/property-panel/threed/property-material3d.js +189 -0
  26. package/dist/src/property-panel/threed/property-material3d.js.map +1 -0
  27. package/dist/src/property-panel/threed/property-scene3d.d.ts +26 -0
  28. package/dist/src/property-panel/threed/property-scene3d.js +314 -0
  29. package/dist/src/property-panel/threed/property-scene3d.js.map +1 -0
  30. package/dist/src/property-panel/threed/threed.d.ts +17 -0
  31. package/dist/src/property-panel/threed/threed.js +98 -0
  32. package/dist/src/property-panel/threed/threed.js.map +1 -0
  33. package/dist/src/types.d.ts +1 -1
  34. package/dist/src/types.js.map +1 -1
  35. package/dist/tsconfig.tsbuildinfo +1 -1
  36. package/package.json +13 -9
  37. package/.editorconfig +0 -29
  38. package/.storybook/main.js +0 -5
  39. package/.storybook/preview.js +0 -52
  40. package/.storybook/server.mjs +0 -8
  41. package/demo/index.html +0 -30
  42. package/dist/stories/index.stories.d.ts +0 -22
  43. package/dist/stories/index.stories.js +0 -121
  44. package/dist/stories/index.stories.js.map +0 -1
  45. package/src/graphql/board.ts +0 -144
  46. package/src/graphql/data-subscription.ts +0 -30
  47. package/src/graphql/favorite-board.ts +0 -25
  48. package/src/graphql/group.ts +0 -138
  49. package/src/graphql/index.ts +0 -4
  50. package/src/graphql/play-group.ts +0 -225
  51. package/src/graphql/scenario.ts +0 -79
  52. package/src/index.ts +0 -8
  53. package/src/ox-property-panel.ts +0 -347
  54. package/src/property-panel/abstract-property.ts +0 -65
  55. package/src/property-panel/data-binding/data-binding-mapper.ts +0 -408
  56. package/src/property-panel/data-binding/data-binding-value-map.ts +0 -19
  57. package/src/property-panel/data-binding/data-binding-value-range.ts +0 -19
  58. package/src/property-panel/data-binding/data-binding.ts +0 -470
  59. package/src/property-panel/effects/effects.ts +0 -77
  60. package/src/property-panel/effects/property-animation.ts +0 -155
  61. package/src/property-panel/effects/property-animations.ts +0 -73
  62. package/src/property-panel/effects/property-event-hover-emphasize.ts +0 -74
  63. package/src/property-panel/effects/property-event-hover.ts +0 -255
  64. package/src/property-panel/effects/property-event-tap.ts +0 -269
  65. package/src/property-panel/effects/property-event.ts +0 -73
  66. package/src/property-panel/effects/property-shadow.ts +0 -77
  67. package/src/property-panel/effects/value-converter.ts +0 -17
  68. package/src/property-panel/inspector/inspector.ts +0 -376
  69. package/src/property-panel/shapes/shapes.ts +0 -379
  70. package/src/property-panel/specifics/specific-properties-builder.ts +0 -160
  71. package/src/property-panel/specifics/specifics.ts +0 -81
  72. package/src/property-panel/styles/styles.ts +0 -285
  73. package/src/types.ts +0 -63
  74. package/stories/index.stories.ts +0 -134
  75. package/tsconfig.json +0 -26
  76. package/web-dev-server.config.mjs +0 -27
  77. package/web-test-runner.config.mjs +0 -41
@@ -1,73 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import '@operato/help/ox-title-with-help.js'
6
-
7
- import { html, LitElement } from 'lit'
8
- import { property } from 'lit/decorators.js'
9
-
10
- import { Properties, Scene } from '@hatiolab/things-scene'
11
- import { ScopedElementsMixin } from '@open-wc/scoped-elements'
12
- import { PropertyGridStyles } from '@operato/styles/property-grid-styles.js'
13
-
14
- import { PropertyEventHover } from './property-event-hover.js'
15
- import { PropertyEventTap } from './property-event-tap.js'
16
- import { convert } from './value-converter.js'
17
-
18
- export class PropertyEvent extends ScopedElementsMixin(LitElement) {
19
- static styles = [PropertyGridStyles]
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
- static get scopedElements() {
29
- return {
30
- 'property-event-hover': PropertyEventHover,
31
- 'property-event-tap': PropertyEventTap
32
- }
33
- }
34
-
35
- render() {
36
- const value = this.value || {}
37
-
38
- return html`
39
- <fieldset>
40
- <legend>
41
- <ox-title-with-help msgid="label.hover-event" topic="board-modeller/effects/hover-event"></ox-title-with-help>
42
- </legend>
43
-
44
- <property-event-hover value-key="hover" .scene=${this.scene} .value=${value.hover || {}}>
45
- </property-event-hover>
46
- </fieldset>
47
-
48
- <fieldset>
49
- <legend>
50
- <ox-title-with-help msgid="label.tap-event" topic="board-modeller/effects/tap-event"></ox-title-with-help>
51
- </legend>
52
-
53
- <property-event-tap value-key="tap" .scene=${this.scene} .value=${value.tap || {}}> </property-event-tap>
54
- </fieldset>
55
- `
56
- }
57
-
58
- onValueChange(e: Event) {
59
- var element = e.target as HTMLElement
60
- var key = element.getAttribute('value-key')
61
-
62
- if (!key) {
63
- return
64
- }
65
-
66
- this.value = {
67
- ...this.value,
68
- [key]: convert(element)
69
- }
70
-
71
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
72
- }
73
- }
@@ -1,77 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import '@operato/i18n/ox-i18n.js'
6
- import '@operato/input/ox-input-color.js'
7
-
8
- import { css, html, LitElement } from 'lit'
9
- import { property } from 'lit/decorators.js'
10
-
11
- import { Properties } from '@hatiolab/things-scene'
12
- import { PropertyGridStyles } from '@operato/styles/property-grid-styles.js'
13
-
14
- import { convert } from './value-converter.js'
15
-
16
- /**
17
- * 컴포넌트의 그림자 속성을 편집하는 element
18
- *
19
- * Example:
20
- * <property-shadow
21
- * @change="${e => { this.shadow = e.target.value }}"
22
- * value="${this.shadow}"
23
- * ></property-shadow>
24
- */
25
-
26
- export class PropertyShadow extends LitElement {
27
- static styles = [
28
- PropertyGridStyles,
29
- css`
30
- :host {
31
- display: flex;
32
- }
33
- `
34
- ]
35
-
36
- @property({ type: Object }) value?: Properties
37
-
38
- firstUpdated() {
39
- this.renderRoot.addEventListener('change', this.onValueChange.bind(this))
40
- }
41
-
42
- render() {
43
- const value = this.value || {}
44
-
45
- return html`
46
- <div class="property-grid">
47
- <label> <ox-i18n msgid="label.shadowOffsetX">offset-X</ox-i18n> </label>
48
- <input type="number" value-key="left" .value=${value.left} />
49
-
50
- <label> <ox-i18n msgid="label.shadowOffsetY">offset-Y</ox-i18n> </label>
51
- <input type="number" value-key="top" .value=${value.top} />
52
-
53
- <label> <ox-i18n msgid="label.shadowSize">Size</ox-i18n> </label>
54
- <input type="number" value-key="blurSize" .value=${value.blurSize} />
55
-
56
- <label class="icon-only-label color"><md-icon>format_color_fill</md-icon></label>
57
- <ox-input-color value-key="color" .value=${value.color}> </ox-input-color>
58
- </div>
59
- `
60
- }
61
-
62
- onValueChange(e: Event) {
63
- var element = e.target as HTMLElement
64
- var key = element.getAttribute('value-key')
65
-
66
- if (!key) {
67
- return
68
- }
69
-
70
- this.value = {
71
- ...this.value,
72
- [key]: convert(element)
73
- }
74
-
75
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
76
- }
77
- }
@@ -1,17 +0,0 @@
1
- export function convert(element: any) {
2
- switch (element.tagName) {
3
- case 'INPUT':
4
- switch (element.type) {
5
- case 'checkbox':
6
- return element.checked
7
- case 'number':
8
- return Number(element.value) || 0
9
- case 'text':
10
- return String(element.value)
11
- }
12
- break
13
-
14
- default:
15
- return element.value
16
- }
17
- }
@@ -1,376 +0,0 @@
1
- import '@operato/input/ox-input-search.js'
2
-
3
- import { css, html, unsafeCSS, LitElement, PropertyValues, TemplateResult } from 'lit'
4
- import { property, state } from 'lit/decorators.js'
5
-
6
- // TODO test Sortable
7
- // import Sortable from 'sortablejs'
8
- import { i18next } from '@operato/i18n'
9
-
10
- import { Component, Container, Scene } from '@hatiolab/things-scene'
11
- import { InspectorStyles } from '@operato/styles/inspector-styles.js'
12
-
13
- export class SceneInspector extends LitElement {
14
- static styles = [
15
- InspectorStyles,
16
- css`
17
- :host {
18
- display: flex;
19
- flex-direction: column;
20
-
21
- color: var(--scene-inspector-color);
22
- }
23
-
24
- ox-input-search {
25
- --input-search-padding: 3px;
26
- --input-search-focus-border-bottom: none;
27
- --input-search-font: normal 16px var(--theme-font);
28
-
29
- border-radius: 999px;
30
- box-sizing: border-box;
31
- border: 1px solid var(--md-sys-color-on-secondary-container);
32
- padding: 0 10px;
33
- margin: 5px;
34
- }
35
-
36
- div[result] {
37
- flex: 1;
38
-
39
- display: flex;
40
- flex-direction: column;
41
-
42
- overflow-y: auto;
43
- }
44
-
45
- .component {
46
- display: block;
47
- overflow: hidden;
48
- border-bottom: 1px solid rgba(0, 0, 0, 0.05);
49
- font-size: 14px;
50
- }
51
-
52
- .component[selected] {
53
- background-color: var(--scene-inspector-selected-background-color);
54
- border-top: var(--scene-inspector-selected-border);
55
- border-bottom: var(--scene-inspector-selected-border);
56
- }
57
- [selected] .type {
58
- font-weight: bold;
59
- }
60
-
61
- span,
62
- i {
63
- display: inline-block;
64
- }
65
-
66
- span.type {
67
- text-overflow: ellipses;
68
- }
69
-
70
- span.name {
71
- background-color: var(--scene-inspector-name-background-color);
72
- border-radius: var(--border-radius);
73
- padding: 0 4px;
74
- color: #fff;
75
- font-size: 0.8em;
76
- }
77
-
78
- .eye {
79
- margin: 0 0 0 5px;
80
- vertical-align: middle;
81
- opacity: 0.7;
82
- font-size: 1.1em;
83
- color: var(--scene-inspector-eye-icon-color);
84
- }
85
-
86
- pre {
87
- display: inline;
88
- }
89
- `
90
- ]
91
-
92
- @property({ type: Object }) scene?: Scene
93
-
94
- @state() private searchText: string = ''
95
-
96
- private _extendedMap: any
97
- private show: boolean = false
98
- private count: number = -1
99
-
100
- disconnectScene(scene?: Scene) {
101
- if (scene) {
102
- scene.off('selected', undefined, this)
103
- scene.off('execute', undefined, this)
104
- scene.off('undo', undefined, this)
105
- scene.off('redo', undefined, this)
106
- }
107
- }
108
-
109
- disconnectedCallback() {
110
- super.disconnectedCallback()
111
-
112
- this.disconnectScene(this.scene)
113
- delete this._extendedMap
114
- }
115
-
116
- render() {
117
- this.count = 0
118
-
119
- return html`
120
- <ox-input-search
121
- .placeholder=${i18next.t('text.search with type, id or tag')}
122
- autofocus
123
- @change=${(e: Event) => (this.searchText = ((e.target as HTMLInputElement).value || '').toLowerCase())}
124
- ></ox-input-search>
125
-
126
- <div result>${!this.scene ? html`` : this.renderComponent(this.scene.root, 0)}</div>
127
- `
128
- }
129
-
130
- firstUpdated() {
131
- dispatchEvent(new Event('resize'))
132
-
133
- this.renderRoot.addEventListener('click', this._onclick.bind(this) as EventListener)
134
- this.renderRoot.addEventListener('dblclick', this._ondblclick.bind(this) as EventListener)
135
- }
136
-
137
- refresh() {
138
- let selected = this.scene?.selected || []
139
-
140
- selected.forEach(component => {
141
- let parent = component.parent
142
- while (parent && !this.extendedMap.get(parent)) {
143
- this.extendedMap.set(parent, true)
144
- parent = parent.parent
145
- }
146
- })
147
-
148
- this.requestUpdate()
149
- }
150
-
151
- updated(change: PropertyValues<this>) {
152
- if (change.has('scene')) {
153
- let oldScene = change.get('scene') as Scene
154
-
155
- if (oldScene) {
156
- this.disconnectScene(oldScene)
157
- delete this._extendedMap
158
- }
159
-
160
- if (this.scene && this.scene.root) {
161
- this.scene.on('selected', this.refresh, this)
162
- this.scene.on('execute', this.refresh, this)
163
- this.scene.on('undo', this.refresh, this)
164
- this.scene.on('redo', this.refresh, this)
165
-
166
- this.refresh()
167
- }
168
- }
169
-
170
- // TODO test Sortable
171
- // this.updateComplete.then(() => {
172
- // this.renderRoot.querySelectorAll('[sortable]').forEach(sortable => {
173
- // new Sortable(sortable as HTMLElement, this.sortableConfig)
174
- // })
175
- // })
176
- }
177
-
178
- // TODO test Sortable
179
- // sortableConfig: Sortable.Options = {
180
- // group: 'inspector',
181
- // animation: 150,
182
- // draggable: '.component',
183
- // swapThreshold: 1,
184
- // onSort: this.onSort.bind(this)
185
- // }
186
-
187
- // TODO test Sortable
188
- // onSort(e: Sortable.SortableEvent) {
189
- // if (!this.scene) return
190
-
191
- // var component = (e.item as HTMLElement & { component: Component }).component
192
- // var to_container = (e.to as HTMLElement & { component: Component }).component as Container
193
- // var to_index = e.newIndex! - 1
194
-
195
- // this.scene.move(component, to_container, to_index)
196
-
197
- // this.show = false
198
- // this.updateComplete.then(() => {
199
- // this.show = true
200
- // })
201
- // }
202
-
203
- _onclick(e: MouseEvent) {
204
- e.stopPropagation()
205
-
206
- var targetElement = e.target as HTMLElement & { component: Component }
207
- var classList = targetElement.classList
208
- var component
209
-
210
- while (!component && targetElement) {
211
- component = targetElement.component
212
-
213
- if (component) break
214
-
215
- targetElement = targetElement.parentNode as HTMLElement & { component: Component }
216
-
217
- if (!targetElement || targetElement === this.renderRoot) break
218
- }
219
-
220
- if (component) {
221
- if (classList.contains('eye')) {
222
- this.toggleHidden(component)
223
- } else if (classList.contains('extended') || classList.contains('collapsed')) {
224
- this.toggleExtended(component)
225
- }
226
-
227
- this.selectComponent(component, e.shiftKey)
228
- } else {
229
- if (classList.contains('inspector')) {
230
- this.show = !this.show
231
- this.style.height = this.show ? '100%' : ''
232
- }
233
- }
234
-
235
- this.requestUpdate()
236
- }
237
-
238
- _ondblclick(e: MouseEvent) {
239
- e.stopPropagation()
240
-
241
- var targetElement = e.target as HTMLElement & { component: Component }
242
- var component
243
-
244
- while (!component && targetElement) {
245
- component = targetElement.component
246
-
247
- if (component) break
248
-
249
- targetElement = targetElement.parentNode as HTMLElement & { component: Component }
250
-
251
- if (!targetElement || targetElement === this.renderRoot) break
252
- }
253
-
254
- if (component && component.isContainer()) {
255
- this.toggleExtended(component)
256
- }
257
-
258
- this.requestUpdate()
259
- }
260
-
261
- get extendedMap() {
262
- if (!this._extendedMap) {
263
- this._extendedMap = new WeakMap()
264
- }
265
-
266
- return this._extendedMap
267
- }
268
-
269
- getNodeHandleClass(component: Component) {
270
- if (component.isContainer() && (component as Container).components.length > 0) {
271
- return !!this.extendedMap.get(component) ? 'extended' : 'collapsed'
272
- } else {
273
- return 'collapsespace'
274
- }
275
- }
276
-
277
- isExtended(component: Component) {
278
- return !!this.extendedMap.get(component)
279
- }
280
-
281
- toggleExtended(component: Component) {
282
- var extended = this.isExtended(component)
283
-
284
- if (extended) {
285
- this.extendedMap.delete(component)
286
- } else {
287
- this.extendedMap.set(component, !extended)
288
- }
289
-
290
- this.requestUpdate()
291
- }
292
-
293
- toggleHidden(component: Component) {
294
- component.set('hidden', !component.hidden)
295
-
296
- this.requestUpdate()
297
- }
298
-
299
- selectComponent(component: Component, append: boolean = false) {
300
- const selected = this.scene!.selected
301
-
302
- if (append) {
303
- const idx = selected.findIndex(s => s === component)
304
- if (idx != -1) {
305
- selected.splice(idx, 1)
306
- this.scene!.selected = [...selected]
307
- } else {
308
- this.scene!.selected = [...selected, component]
309
- }
310
- } else {
311
- this.scene!.selected = [component]
312
- }
313
-
314
- component.trigger('reactionreset')
315
- component.trigger('reaction')
316
-
317
- this.requestUpdate()
318
- }
319
-
320
- shouldBeShown(component: Component, counting: boolean = false): boolean {
321
- const { type, name, id, tag } = component.state
322
- const found =
323
- !this.searchText || `${type} ${name || ''} ${id || ''} ${tag || ''}`.toLowerCase().search(this.searchText) > -1
324
-
325
- if (counting && found) {
326
- this.count++
327
- }
328
-
329
- const foundChildren = ((component as Container).components || []).filter((child: Component) =>
330
- this.shouldBeShown(child, counting)
331
- ).length
332
-
333
- return !!(found || foundChildren > 0)
334
- }
335
-
336
- renderComponent(component: Component, depth: number): TemplateResult {
337
- if (!component) {
338
- return html``
339
- }
340
-
341
- if (!this.shouldBeShown(component, depth == 0)) {
342
- return html``
343
- }
344
-
345
- const children = (component.isContainer() && (component as Container).components) || []
346
- const extended = this.isExtended(component) ? children.filter(child => this.shouldBeShown(child)) : []
347
- const { type, id, tag, class: clazz } = component.state
348
-
349
- const name = (id ? `#${id}` : '') + (tag ? `@${tag}` : '') + (clazz ? `.(${clazz})` : '')
350
-
351
- return html`
352
- <div
353
- class="component"
354
- ?selected=${(this.scene?.selected || []).indexOf(component) > -1}
355
- .component=${component}
356
- ?sortable=${component.isContainer()}
357
- >
358
- <span>
359
- ${depth > 0
360
- ? html`
361
- <md-icon class="eye">${component.get('hidden') ? 'visibility_off' : 'visibility'}</md-icon>
362
- <pre>${' '.repeat(depth)}</pre>
363
- `
364
- : html` <pre>${' '.repeat(depth + 2)}</pre> `}
365
-
366
- <span class=${this.getNodeHandleClass(component)}> </span>
367
-
368
- <span class="type">${depth == 0 ? html`ROOT(count: ${this.count})` : type}</span>
369
- ${name ? html` <span class="name">${name}</span> ` : html``}
370
- </span>
371
-
372
- ${extended.map(child => this.renderComponent(child, depth + 1))}
373
- </div>
374
- `
375
- }
376
- }