@operato/property-panel 9.0.0-beta.14

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 (156) hide show
  1. package/.editorconfig +29 -0
  2. package/.storybook/main.js +5 -0
  3. package/.storybook/preview.js +52 -0
  4. package/.storybook/server.mjs +8 -0
  5. package/CHANGELOG.md +11 -0
  6. package/LICENSE +21 -0
  7. package/README.md +76 -0
  8. package/demo/index.html +30 -0
  9. package/dist/src/graphql/board.d.ts +6 -0
  10. package/dist/src/graphql/board.js +130 -0
  11. package/dist/src/graphql/board.js.map +1 -0
  12. package/dist/src/graphql/data-subscription.d.ts +5 -0
  13. package/dist/src/graphql/data-subscription.js +24 -0
  14. package/dist/src/graphql/data-subscription.js.map +1 -0
  15. package/dist/src/graphql/favorite-board.d.ts +1 -0
  16. package/dist/src/graphql/favorite-board.js +23 -0
  17. package/dist/src/graphql/favorite-board.js.map +1 -0
  18. package/dist/src/graphql/group.d.ts +7 -0
  19. package/dist/src/graphql/group.js +125 -0
  20. package/dist/src/graphql/group.js.map +1 -0
  21. package/dist/src/graphql/index.d.ts +4 -0
  22. package/dist/src/graphql/index.js +5 -0
  23. package/dist/src/graphql/index.js.map +1 -0
  24. package/dist/src/graphql/play-group.d.ts +13 -0
  25. package/dist/src/graphql/play-group.js +205 -0
  26. package/dist/src/graphql/play-group.js.map +1 -0
  27. package/dist/src/graphql/scenario.d.ts +6 -0
  28. package/dist/src/graphql/scenario.js +69 -0
  29. package/dist/src/graphql/scenario.js.map +1 -0
  30. package/dist/src/index.d.ts +7 -0
  31. package/dist/src/index.js +8 -0
  32. package/dist/src/index.js.map +1 -0
  33. package/dist/src/ox-property-panel.d.ts +46 -0
  34. package/dist/src/ox-property-panel.js +346 -0
  35. package/dist/src/ox-property-panel.js.map +1 -0
  36. package/dist/src/property-panel/abstract-property.d.ts +10 -0
  37. package/dist/src/property-panel/abstract-property.js +53 -0
  38. package/dist/src/property-panel/abstract-property.js.map +1 -0
  39. package/dist/src/property-panel/data-binding/data-binding-mapper.d.ts +58 -0
  40. package/dist/src/property-panel/data-binding/data-binding-mapper.js +380 -0
  41. package/dist/src/property-panel/data-binding/data-binding-mapper.js.map +1 -0
  42. package/dist/src/property-panel/data-binding/data-binding-value-map.d.ts +6 -0
  43. package/dist/src/property-panel/data-binding/data-binding-value-map.js +20 -0
  44. package/dist/src/property-panel/data-binding/data-binding-value-map.js.map +1 -0
  45. package/dist/src/property-panel/data-binding/data-binding-value-range.d.ts +6 -0
  46. package/dist/src/property-panel/data-binding/data-binding-value-range.js +20 -0
  47. package/dist/src/property-panel/data-binding/data-binding-value-range.js.map +1 -0
  48. package/dist/src/property-panel/data-binding/data-binding.d.ts +44 -0
  49. package/dist/src/property-panel/data-binding/data-binding.js +442 -0
  50. package/dist/src/property-panel/data-binding/data-binding.js.map +1 -0
  51. package/dist/src/property-panel/effects/effects.d.ts +24 -0
  52. package/dist/src/property-panel/effects/effects.js +72 -0
  53. package/dist/src/property-panel/effects/effects.js.map +1 -0
  54. package/dist/src/property-panel/effects/property-animation.d.ts +23 -0
  55. package/dist/src/property-panel/effects/property-animation.js +147 -0
  56. package/dist/src/property-panel/effects/property-animation.js.map +1 -0
  57. package/dist/src/property-panel/effects/property-animations.d.ts +22 -0
  58. package/dist/src/property-panel/effects/property-animations.js +70 -0
  59. package/dist/src/property-panel/effects/property-animations.js.map +1 -0
  60. package/dist/src/property-panel/effects/property-event-hover.d.ts +21 -0
  61. package/dist/src/property-panel/effects/property-event-hover.js +193 -0
  62. package/dist/src/property-panel/effects/property-event-hover.js.map +1 -0
  63. package/dist/src/property-panel/effects/property-event-tap.d.ts +36 -0
  64. package/dist/src/property-panel/effects/property-event-tap.js +262 -0
  65. package/dist/src/property-panel/effects/property-event-tap.js.map +1 -0
  66. package/dist/src/property-panel/effects/property-event.d.ts +22 -0
  67. package/dist/src/property-panel/effects/property-event.js +64 -0
  68. package/dist/src/property-panel/effects/property-event.js.map +1 -0
  69. package/dist/src/property-panel/effects/property-shadow.d.ts +23 -0
  70. package/dist/src/property-panel/effects/property-shadow.js +66 -0
  71. package/dist/src/property-panel/effects/property-shadow.js.map +1 -0
  72. package/dist/src/property-panel/effects/value-converter.d.ts +1 -0
  73. package/dist/src/property-panel/effects/value-converter.js +17 -0
  74. package/dist/src/property-panel/effects/value-converter.js.map +1 -0
  75. package/dist/src/property-panel/inspector/inspector.d.ts +27 -0
  76. package/dist/src/property-panel/inspector/inspector.js +357 -0
  77. package/dist/src/property-panel/inspector/inspector.js.map +1 -0
  78. package/dist/src/property-panel/shapes/shapes.d.ts +26 -0
  79. package/dist/src/property-panel/shapes/shapes.js +312 -0
  80. package/dist/src/property-panel/shapes/shapes.js.map +1 -0
  81. package/dist/src/property-panel/specifics/specific-properties-builder.d.ts +16 -0
  82. package/dist/src/property-panel/specifics/specific-properties-builder.js +138 -0
  83. package/dist/src/property-panel/specifics/specific-properties-builder.js.map +1 -0
  84. package/dist/src/property-panel/specifics/specifics.d.ts +25 -0
  85. package/dist/src/property-panel/specifics/specifics.js +84 -0
  86. package/dist/src/property-panel/specifics/specifics.js.map +1 -0
  87. package/dist/src/property-panel/styles/styles.d.ts +23 -0
  88. package/dist/src/property-panel/styles/styles.js +269 -0
  89. package/dist/src/property-panel/styles/styles.js.map +1 -0
  90. package/dist/src/types.d.ts +43 -0
  91. package/dist/src/types.js +2 -0
  92. package/dist/src/types.js.map +1 -0
  93. package/dist/stories/index.stories.d.ts +22 -0
  94. package/dist/stories/index.stories.js +121 -0
  95. package/dist/stories/index.stories.js.map +1 -0
  96. package/dist/stories/input-table-property.stories.d.ts +21 -0
  97. package/dist/stories/input-table-property.stories.js +84 -0
  98. package/dist/stories/input-table-property.stories.js.map +1 -0
  99. package/dist/test/ox-property-panel.test.d.ts +1 -0
  100. package/dist/test/ox-property-panel.test.js +24 -0
  101. package/dist/test/ox-property-panel.test.js.map +1 -0
  102. package/dist/tsconfig.tsbuildinfo +1 -0
  103. package/package.json +108 -0
  104. package/src/graphql/board.ts +144 -0
  105. package/src/graphql/data-subscription.ts +30 -0
  106. package/src/graphql/favorite-board.ts +25 -0
  107. package/src/graphql/group.ts +138 -0
  108. package/src/graphql/index.ts +4 -0
  109. package/src/graphql/play-group.ts +225 -0
  110. package/src/graphql/scenario.ts +79 -0
  111. package/src/index.ts +8 -0
  112. package/src/ox-property-panel.ts +347 -0
  113. package/src/property-panel/abstract-property.ts +67 -0
  114. package/src/property-panel/data-binding/data-binding-mapper.ts +412 -0
  115. package/src/property-panel/data-binding/data-binding-value-map.ts +19 -0
  116. package/src/property-panel/data-binding/data-binding-value-range.ts +19 -0
  117. package/src/property-panel/data-binding/data-binding.ts +464 -0
  118. package/src/property-panel/effects/effects.ts +77 -0
  119. package/src/property-panel/effects/property-animation.ts +155 -0
  120. package/src/property-panel/effects/property-animations.ts +74 -0
  121. package/src/property-panel/effects/property-event-hover.ts +212 -0
  122. package/src/property-panel/effects/property-event-tap.ts +269 -0
  123. package/src/property-panel/effects/property-event.ts +73 -0
  124. package/src/property-panel/effects/property-shadow.ts +77 -0
  125. package/src/property-panel/effects/value-converter.ts +17 -0
  126. package/src/property-panel/inspector/inspector.ts +407 -0
  127. package/src/property-panel/shapes/shapes.ts +321 -0
  128. package/src/property-panel/specifics/specific-properties-builder.ts +152 -0
  129. package/src/property-panel/specifics/specifics.ts +81 -0
  130. package/src/property-panel/styles/styles.ts +287 -0
  131. package/src/types.ts +63 -0
  132. package/stories/index.stories.ts +134 -0
  133. package/stories/input-table-property.stories.ts +96 -0
  134. package/test/ox-property-panel.test.ts +32 -0
  135. package/themes/app-theme.css +138 -0
  136. package/themes/calendar-theme.css +61 -0
  137. package/themes/dark.css +51 -0
  138. package/themes/grist-theme.css +175 -0
  139. package/themes/help-theme.css +57 -0
  140. package/themes/layout-theme.css +94 -0
  141. package/themes/light.css +51 -0
  142. package/themes/material-theme.css +23 -0
  143. package/themes/md-typescale-styles.css +100 -0
  144. package/themes/oops-theme.css +22 -0
  145. package/themes/report-theme.css +47 -0
  146. package/themes/spacing.css +23 -0
  147. package/themes/state-color.css +6 -0
  148. package/themes/tooltip-theme.css +11 -0
  149. package/translations/en.json +723 -0
  150. package/translations/ja.json +727 -0
  151. package/translations/ko.json +727 -0
  152. package/translations/ms.json +609 -0
  153. package/translations/zh.json +726 -0
  154. package/tsconfig.json +25 -0
  155. package/web-dev-server.config.mjs +27 -0
  156. package/web-test-runner.config.mjs +41 -0
@@ -0,0 +1,346 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { __decorate } from "tslib";
5
+ import '@material/web/icon/icon.js';
6
+ import { css, html, LitElement } from 'lit';
7
+ import { customElement, property } from 'lit/decorators.js';
8
+ import deepClone from 'lodash-es/cloneDeep.js';
9
+ import { ScopedElementsMixin } from '@open-wc/scoped-elements';
10
+ import { ScrollbarStyles } from '@operato/styles';
11
+ import { PropertyDataBinding } from './property-panel/data-binding/data-binding.js';
12
+ import { PropertyEffects } from './property-panel/effects/effects.js';
13
+ import { SceneInspector } from './property-panel/inspector/inspector.js';
14
+ import { PropertyShapes } from './property-panel/shapes/shapes.js';
15
+ // import { PropertySpecific } from './property-panel/specifics/specifics.js'
16
+ import { PropertyStyles } from './property-panel/styles/styles.js';
17
+ let OxPropertyPanel = class OxPropertyPanel extends ScopedElementsMixin(LitElement) {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.scene = null;
21
+ this.bounds = {};
22
+ this.model = {};
23
+ this.selected = [];
24
+ this.tabName = 'shape';
25
+ this.collapsed = false;
26
+ this.fonts = [];
27
+ this.propertyEditor = [];
28
+ this.propertyTarget = null;
29
+ }
30
+ firstUpdated() {
31
+ this.renderRoot.addEventListener('property-change', this.onPropertyChanged.bind(this));
32
+ this.renderRoot.addEventListener('bounds-change', this.onBoundsChanged.bind(this));
33
+ }
34
+ updated(change) {
35
+ change.has('scene') && this.onSceneChanged();
36
+ change.has('selected') && this.onSelectedChanged(this.selected);
37
+ change.has('collapsed') && this.onCollapsed(this.collapsed);
38
+ }
39
+ static get scopedElements() {
40
+ return {
41
+ 'property-shape': PropertyShapes,
42
+ 'property-style': PropertyStyles,
43
+ 'property-effect': PropertyEffects,
44
+ // 'property-specific': PropertySpecific,
45
+ 'property-data-binding': PropertyDataBinding,
46
+ 'scene-inspector': SceneInspector
47
+ };
48
+ }
49
+ render() {
50
+ var tabName = this.tabName ? this.tabName : 'shape';
51
+ return html `
52
+ <div
53
+ tab
54
+ @click=${(e) => {
55
+ this.tabName = e.target.getAttribute('name');
56
+ }}
57
+ >
58
+ <md-icon name="shape" ?selected=${tabName == 'shape'}>format_shapes</md-icon>
59
+ <md-icon name="style" ?selected=${tabName == 'style'}>palette</md-icon>
60
+ <md-icon name="effect" ?selected=${tabName == 'effect'}>movie_filter</md-icon>
61
+ <md-icon name="specific" ?selected=${tabName == 'specific'}>tune</md-icon>
62
+ <md-icon name="data-binding" ?selected=${tabName == 'data-binding'}>share</md-icon>
63
+ <md-icon name="inspector" ?selected=${tabName == 'inspector'}>visibility</md-icon>
64
+ </div>
65
+
66
+ <div content>
67
+ ${html `
68
+ ${{
69
+ shape: html `
70
+ <property-shape
71
+ .value=${this.model}
72
+ .bounds=${this.bounds}
73
+ .selected=${this.selected}
74
+ ?active=${tabName == 'shape'}
75
+ ?is-line=${this.isLine(this.selected)}
76
+ >
77
+ </property-shape>
78
+ `,
79
+ style: html `
80
+ <property-style
81
+ .value=${this.model}
82
+ .selected=${this.selected}
83
+ .fonts=${this.fonts}
84
+ ?active=${tabName == 'style'}
85
+ >
86
+ </property-style>
87
+ `,
88
+ effect: html `
89
+ <property-effect .value=${this.model} .scene=${this.scene} ?active=${tabName == 'effect'}>
90
+ </property-effect>
91
+ `,
92
+ specific: html `
93
+ <property-specific
94
+ .value=${this.model}
95
+ .scene=${this.scene}
96
+ .selected=${this.selected}
97
+ .props=${this.specificProps}
98
+ .propertyEditor=${this.propertyEditor}
99
+ ?active=${tabName == 'specific'}
100
+ >
101
+ </property-specific>
102
+ `,
103
+ 'data-binding': html `
104
+ <property-data-binding .scene=${this.scene} .value=${this.model} ?active=${tabName == 'data-binding'}>
105
+ </property-data-binding>
106
+ `,
107
+ inspector: html `
108
+ <scene-inspector .scene=${this.scene} ?active=${tabName == 'inspector'}></scene-inspector>
109
+ `
110
+ }[this.tabName]}
111
+ `}
112
+ </div>
113
+ `;
114
+ }
115
+ onPropertyChanged(e) {
116
+ var detail = e.detail;
117
+ if (this.propertyTarget) {
118
+ /* 단일 컴포넌트의 경우에 적용 */
119
+ this.scene && this.scene.undoableChange(() => this.propertyTarget.set(detail));
120
+ }
121
+ else {
122
+ /* 여러 컴포넌트의 경우에 적용 */
123
+ this.scene && this.scene.undoableChange(() => this.selected.forEach(component => component.set(detail)));
124
+ }
125
+ }
126
+ onBoundsChanged(e) {
127
+ var detail = e.detail;
128
+ if (!this.scene) {
129
+ return;
130
+ }
131
+ if (this.propertyTarget) {
132
+ /* 단일 컴포넌트의 경우에 적용 */
133
+ this.scene.undoableChange(() => {
134
+ this.propertyTarget.bounds = {
135
+ ...this.propertyTarget.bounds,
136
+ ...detail
137
+ };
138
+ });
139
+ }
140
+ else {
141
+ /* 여러 컴포넌트의 경우에 적용 */
142
+ this.scene.undoableChange(() => {
143
+ this.selected.forEach(component => {
144
+ component.bounds = {
145
+ ...component.bounds,
146
+ ...detail
147
+ };
148
+ });
149
+ });
150
+ }
151
+ }
152
+ onChangedByScene() {
153
+ if (this.propertyTarget) {
154
+ this.model = {
155
+ ...this.propertyTarget.model
156
+ };
157
+ this.setBounds(this.propertyTarget.bounds);
158
+ }
159
+ }
160
+ setPropertyTargetAsDefault() {
161
+ if (!this.scene) {
162
+ this.setPropertyTarget(null);
163
+ this.specificProps = [];
164
+ this.model = null;
165
+ this.bounds = {};
166
+ }
167
+ else {
168
+ this.scene.select('model-layer');
169
+ }
170
+ }
171
+ onCollapsed(collapsed) {
172
+ !collapsed && (this.style.display = '');
173
+ this.animate(collapsed
174
+ ? [
175
+ { transform: 'translateX(0)', opacity: 1, easing: 'ease-in' },
176
+ { transform: 'translateX(100%)', opacity: 1 }
177
+ ]
178
+ : [
179
+ { transform: 'translateX(100%)', opacity: 1 },
180
+ { transform: 'translateX(0)', opacity: 1, easing: 'ease-out' }
181
+ ], {
182
+ duration: 500
183
+ }).onfinish = () => {
184
+ collapsed && (this.style.display = 'none');
185
+ dispatchEvent(new Event('resize'));
186
+ };
187
+ }
188
+ async onSceneChanged() {
189
+ await this.updateComplete;
190
+ if (this.scene)
191
+ this.selected = this.scene.select('model-layer');
192
+ }
193
+ async onSelectedChanged(after) {
194
+ await this.updateComplete;
195
+ if (after.length == 1) {
196
+ this.setPropertyTarget(after[0]);
197
+ // 컴포넌트 특성 속성(specific properties)을 먼저 바꾸고, 모델을 바꾸어준다.
198
+ // 컴포넌트 속성에 따라 UI 컴포넌트가 준비되고, 이후에 모델값을 보여주도록 하기 위해서이다.
199
+ this.specificProps = deepClone(this.propertyTarget.nature.properties);
200
+ this.model = {
201
+ ...this.propertyTarget.model
202
+ };
203
+ this.setBounds(this.propertyTarget.bounds);
204
+ }
205
+ else if (after.length == 0) {
206
+ // 선택이 안된 경우
207
+ this.setPropertyTargetAsDefault();
208
+ }
209
+ else {
210
+ // 다중 선택된 경우
211
+ var type = after[0].model.type;
212
+ for (let i = 1; i < after.length; i++) {
213
+ if (after[i].model.type != type) {
214
+ type = undefined;
215
+ break;
216
+ }
217
+ }
218
+ this.setPropertyTarget(null);
219
+ if (type)
220
+ this.specificProps = deepClone(after[0].nature.properties);
221
+ else
222
+ this.specificProps = null;
223
+ this.model = {
224
+ type: type,
225
+ alpha: 1
226
+ };
227
+ this.bounds = {};
228
+ }
229
+ }
230
+ setPropertyTarget(newTarget) {
231
+ var oldTarget = this.propertyTarget;
232
+ if (oldTarget) {
233
+ oldTarget.off('change', this.onChangedByScene, this);
234
+ }
235
+ if (newTarget) {
236
+ newTarget.on('change', this.onChangedByScene, this);
237
+ }
238
+ this.propertyTarget = newTarget;
239
+ }
240
+ setBounds(bounds) {
241
+ this.bounds = {
242
+ left: bounds.left,
243
+ top: bounds.top,
244
+ width: Math.round(bounds.width),
245
+ height: Math.round(bounds.height)
246
+ };
247
+ }
248
+ isLine(selected) {
249
+ var isLine = false;
250
+ for (var i = 0; i < selected.length; i++) {
251
+ var comp = selected[i];
252
+ if (!comp.isLine || !comp.isLine()) {
253
+ isLine = false;
254
+ return isLine;
255
+ }
256
+ isLine = true;
257
+ }
258
+ return isLine;
259
+ }
260
+ };
261
+ OxPropertyPanel.styles = [
262
+ ScrollbarStyles,
263
+ css `
264
+ :host {
265
+ border-left: 1px solid var(--md-sys-color-border, #ccc);
266
+ width: 270px;
267
+ display: flex;
268
+ flex-direction: column;
269
+ background-color: var(--property-sidebar-background-color, var(--md-sys-color-secondary-container));
270
+ color: var(--property-sidebar-color, var(--md-sys-color-on-secondary-container));
271
+ user-select: none;
272
+
273
+ --input-padding: var(--spacing-small);
274
+ --label-font: var(--property-sidebar-fieldset-label, roboto);
275
+ }
276
+
277
+ [tab] {
278
+ display: flex;
279
+ background-color: rgba(0, 0, 0, 0.08);
280
+ opacity: 0.85;
281
+ }
282
+
283
+ [tab] md-icon {
284
+ flex: 1;
285
+
286
+ display: flex;
287
+ align-items: center;
288
+ justify-content: center;
289
+
290
+ color: var(--property-sidebar-tab-icon-color);
291
+ height: 40px;
292
+ }
293
+
294
+ [tab] [selected] {
295
+ background-color: var(--property-sidebar-background-color, var(--md-sys-color-secondary-container));
296
+ border-left: 1px solid rgba(255, 255, 255, 0.5);
297
+ border-right: 1px solid rgba(0, 0, 0, 0.15);
298
+ opacity: 1;
299
+ }
300
+
301
+ [content] {
302
+ flex: 1;
303
+
304
+ overflow: hidden;
305
+ overflow-y: auto;
306
+
307
+ --md-icon-size: 22px;
308
+ }
309
+
310
+ [content] > :not([active]) {
311
+ display: none;
312
+ }
313
+ `
314
+ ];
315
+ __decorate([
316
+ property({ type: Object })
317
+ ], OxPropertyPanel.prototype, "scene", void 0);
318
+ __decorate([
319
+ property({ type: Object })
320
+ ], OxPropertyPanel.prototype, "bounds", void 0);
321
+ __decorate([
322
+ property({ type: Object })
323
+ ], OxPropertyPanel.prototype, "model", void 0);
324
+ __decorate([
325
+ property({ type: Array })
326
+ ], OxPropertyPanel.prototype, "selected", void 0);
327
+ __decorate([
328
+ property({ type: Array })
329
+ ], OxPropertyPanel.prototype, "specificProps", void 0);
330
+ __decorate([
331
+ property({ type: String })
332
+ ], OxPropertyPanel.prototype, "tabName", void 0);
333
+ __decorate([
334
+ property({ type: Boolean })
335
+ ], OxPropertyPanel.prototype, "collapsed", void 0);
336
+ __decorate([
337
+ property({ type: Array })
338
+ ], OxPropertyPanel.prototype, "fonts", void 0);
339
+ __decorate([
340
+ property({ type: Array })
341
+ ], OxPropertyPanel.prototype, "propertyEditor", void 0);
342
+ OxPropertyPanel = __decorate([
343
+ customElement('ox-property-panel')
344
+ ], OxPropertyPanel);
345
+ export { OxPropertyPanel };
346
+ //# sourceMappingURL=ox-property-panel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-property-panel.js","sourceRoot":"","sources":["../../src/ox-property-panel.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,SAAS,MAAM,wBAAwB,CAAA;AAG9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAA;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAA;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,m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Ae;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAoU3B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/web/icon/icon.js'\n\nimport { css, html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport deepClone from 'lodash-es/cloneDeep.js'\n\nimport { BOUNDS, Component, Model, Scene } from '@hatiolab/things-scene'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { ScrollbarStyles } from '@operato/styles'\n\nimport { PropertyDataBinding } from './property-panel/data-binding/data-binding.js'\nimport { PropertyEffects } from './property-panel/effects/effects.js'\nimport { SceneInspector } from './property-panel/inspector/inspector.js'\nimport { PropertyShapes } from './property-panel/shapes/shapes.js'\n// import { PropertySpecific } from './property-panel/specifics/specifics.js'\nimport { PropertyStyles } from './property-panel/styles/styles.js'\n\n@customElement('ox-property-panel')\nexport class OxPropertyPanel extends ScopedElementsMixin(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n border-left: 1px solid var(--md-sys-color-border, #ccc);\n width: 270px;\n display: flex;\n flex-direction: column;\n background-color: var(--property-sidebar-background-color, var(--md-sys-color-secondary-container));\n color: var(--property-sidebar-color, var(--md-sys-color-on-secondary-container));\n user-select: none;\n\n --input-padding: var(--spacing-small);\n --label-font: var(--property-sidebar-fieldset-label, roboto);\n }\n\n [tab] {\n display: flex;\n background-color: rgba(0, 0, 0, 0.08);\n opacity: 0.85;\n }\n\n [tab] md-icon {\n flex: 1;\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n color: var(--property-sidebar-tab-icon-color);\n height: 40px;\n }\n\n [tab] [selected] {\n background-color: var(--property-sidebar-background-color, var(--md-sys-color-secondary-container));\n border-left: 1px solid rgba(255, 255, 255, 0.5);\n border-right: 1px solid rgba(0, 0, 0, 0.15);\n opacity: 1;\n }\n\n [content] {\n flex: 1;\n\n overflow: hidden;\n overflow-y: auto;\n\n --md-icon-size: 22px;\n }\n\n [content] > :not([active]) {\n display: none;\n }\n `\n ]\n\n @property({ type: Object }) scene: Scene | null = null\n @property({ type: Object }) bounds: any = {}\n @property({ type: Object }) model: Model | null = {}\n @property({ type: Array }) selected: Component[] = []\n @property({ type: Array }) specificProps: any\n @property({ type: String }) tabName: string | null = 'shape'\n @property({ type: Boolean }) collapsed: boolean = false\n @property({ type: Array }) fonts: any[] = []\n @property({ type: Array }) propertyEditor: any[] = []\n\n propertyTarget: Component | null = null\n\n firstUpdated() {\n this.renderRoot.addEventListener('property-change', this.onPropertyChanged.bind(this) as EventListener)\n this.renderRoot.addEventListener('bounds-change', this.onBoundsChanged.bind(this) as EventListener)\n }\n\n updated(change: PropertyValues<this>) {\n change.has('scene') && this.onSceneChanged()\n change.has('selected') && this.onSelectedChanged(this.selected)\n change.has('collapsed') && this.onCollapsed(this.collapsed)\n }\n\n static get scopedElements() {\n return {\n 'property-shape': PropertyShapes,\n 'property-style': PropertyStyles,\n 'property-effect': PropertyEffects,\n // 'property-specific': PropertySpecific,\n 'property-data-binding': PropertyDataBinding,\n 'scene-inspector': SceneInspector\n }\n }\n\n render() {\n var tabName = this.tabName ? this.tabName : 'shape'\n\n return html`\n <div\n tab\n @click=${(e: MouseEvent) => {\n this.tabName = (e.target as HTMLElement).getAttribute('name')\n }}\n >\n <md-icon name=\"shape\" ?selected=${tabName == 'shape'}>format_shapes</md-icon>\n <md-icon name=\"style\" ?selected=${tabName == 'style'}>palette</md-icon>\n <md-icon name=\"effect\" ?selected=${tabName == 'effect'}>movie_filter</md-icon>\n <md-icon name=\"specific\" ?selected=${tabName == 'specific'}>tune</md-icon>\n <md-icon name=\"data-binding\" ?selected=${tabName == 'data-binding'}>share</md-icon>\n <md-icon name=\"inspector\" ?selected=${tabName == 'inspector'}>visibility</md-icon>\n </div>\n\n <div content>\n ${html`\n ${{\n shape: html`\n <property-shape\n .value=${this.model}\n .bounds=${this.bounds}\n .selected=${this.selected}\n ?active=${tabName == 'shape'}\n ?is-line=${this.isLine(this.selected)}\n >\n </property-shape>\n `,\n style: html`\n <property-style\n .value=${this.model}\n .selected=${this.selected}\n .fonts=${this.fonts}\n ?active=${tabName == 'style'}\n >\n </property-style>\n `,\n effect: html`\n <property-effect .value=${this.model} .scene=${this.scene} ?active=${tabName == 'effect'}>\n </property-effect>\n `,\n specific: html`\n <property-specific\n .value=${this.model}\n .scene=${this.scene}\n .selected=${this.selected}\n .props=${this.specificProps}\n .propertyEditor=${this.propertyEditor}\n ?active=${tabName == 'specific'}\n >\n </property-specific>\n `,\n 'data-binding': html`\n <property-data-binding .scene=${this.scene} .value=${this.model} ?active=${tabName == 'data-binding'}>\n </property-data-binding>\n `,\n inspector: html`\n <scene-inspector .scene=${this.scene} ?active=${tabName == 'inspector'}></scene-inspector>\n `\n }[this.tabName!]}\n `}\n </div>\n `\n }\n\n private onPropertyChanged(e: CustomEvent) {\n var detail = e.detail\n\n if (this.propertyTarget) {\n /* 단일 컴포넌트의 경우에 적용 */\n this.scene && this.scene.undoableChange(() => this.propertyTarget!.set(detail))\n } else {\n /* 여러 컴포넌트의 경우에 적용 */\n this.scene && this.scene.undoableChange(() => this.selected.forEach(component => component.set(detail)))\n }\n }\n\n private onBoundsChanged(e: CustomEvent) {\n var detail = e.detail\n\n if (!this.scene) {\n return\n }\n\n if (this.propertyTarget) {\n /* 단일 컴포넌트의 경우에 적용 */\n this.scene.undoableChange(() => {\n this.propertyTarget!.bounds = {\n ...this.propertyTarget!.bounds,\n ...detail\n }\n })\n } else {\n /* 여러 컴포넌트의 경우에 적용 */\n this.scene.undoableChange(() => {\n this.selected.forEach(component => {\n component.bounds = {\n ...component.bounds,\n ...detail\n }\n })\n })\n }\n }\n\n private onChangedByScene() {\n if (this.propertyTarget) {\n this.model = {\n ...this.propertyTarget.model\n }\n this.setBounds(this.propertyTarget.bounds)\n }\n }\n\n private setPropertyTargetAsDefault() {\n if (!this.scene) {\n this.setPropertyTarget(null)\n this.specificProps = []\n this.model = null\n this.bounds = {}\n } else {\n this.scene.select('model-layer')\n }\n }\n\n private onCollapsed(collapsed: boolean) {\n !collapsed && (this.style.display = '')\n\n this.animate(\n collapsed\n ? [\n { transform: 'translateX(0)', opacity: 1, easing: 'ease-in' },\n { transform: 'translateX(100%)', opacity: 1 }\n ]\n : [\n { transform: 'translateX(100%)', opacity: 1 },\n { transform: 'translateX(0)', opacity: 1, easing: 'ease-out' }\n ],\n {\n duration: 500\n }\n ).onfinish = () => {\n collapsed && (this.style.display = 'none')\n dispatchEvent(new Event('resize'))\n }\n }\n\n private async onSceneChanged() {\n await this.updateComplete\n\n if (this.scene) this.selected = this.scene.select('model-layer')\n }\n\n private async onSelectedChanged(after: Component[]) {\n await this.updateComplete\n\n if (after.length == 1) {\n this.setPropertyTarget(after[0])\n // 컴포넌트 특성 속성(specific properties)을 먼저 바꾸고, 모델을 바꾸어준다.\n // 컴포넌트 속성에 따라 UI 컴포넌트가 준비되고, 이후에 모델값을 보여주도록 하기 위해서이다.\n this.specificProps = deepClone(this.propertyTarget!.nature.properties)\n this.model = {\n ...this.propertyTarget!.model\n }\n this.setBounds(this.propertyTarget!.bounds)\n } else if (after.length == 0) {\n // 선택이 안된 경우\n\n this.setPropertyTargetAsDefault()\n } else {\n // 다중 선택된 경우\n\n var type = after[0].model.type\n for (let i = 1; i < after.length; i++) {\n if (after[i].model.type != type) {\n type = undefined\n break\n }\n }\n\n this.setPropertyTarget(null)\n\n if (type) this.specificProps = deepClone(after[0].nature.properties)\n else this.specificProps = null\n\n this.model = {\n type: type,\n alpha: 1\n }\n this.bounds = {}\n }\n }\n\n private setPropertyTarget(newTarget: Component | null) {\n var oldTarget = this.propertyTarget\n\n if (oldTarget) {\n oldTarget.off('change', this.onChangedByScene, this)\n }\n if (newTarget) {\n newTarget.on('change', this.onChangedByScene, this)\n }\n\n this.propertyTarget = newTarget\n }\n\n private setBounds(bounds: BOUNDS) {\n this.bounds = {\n left: bounds.left,\n top: bounds.top,\n width: Math.round(bounds.width),\n height: Math.round(bounds.height)\n }\n }\n\n private isLine(selected: Component[]) {\n var isLine = false\n\n for (var i = 0; i < selected.length; i++) {\n var comp = selected[i]\n\n if (!comp.isLine || !comp.isLine()) {\n isLine = false\n return isLine\n }\n\n isLine = true\n }\n\n return isLine\n }\n}\n"]}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { LitElement } from 'lit';
5
+ export declare class AbstractProperty extends LitElement {
6
+ firstUpdated(): void;
7
+ protected onValueChange(e: Event): void;
8
+ protected getValueFromEventTarget(element: HTMLElement): any;
9
+ protected onAfterValueChange(key: string, value: any): void;
10
+ }
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { LitElement } from 'lit';
5
+ export class AbstractProperty extends LitElement {
6
+ firstUpdated() {
7
+ this.renderRoot.addEventListener('change', this.onValueChange.bind(this));
8
+ }
9
+ onValueChange(e) {
10
+ var element = e.target;
11
+ var key = element.getAttribute('value-key');
12
+ if (!key) {
13
+ return;
14
+ }
15
+ var value = this.getValueFromEventTarget(element);
16
+ this.onAfterValueChange(key, value);
17
+ }
18
+ getValueFromEventTarget(element) {
19
+ var value;
20
+ switch (element.tagName) {
21
+ case 'INPUT':
22
+ switch (element.type) {
23
+ case 'checkbox':
24
+ value = element.checked;
25
+ break;
26
+ case 'number':
27
+ value = Number(element.valueAsNumber);
28
+ break;
29
+ case 'text':
30
+ value = String(element.value);
31
+ }
32
+ break;
33
+ case 'MD-ICON':
34
+ value = element.hasAttribute('active');
35
+ break;
36
+ default:
37
+ value = element.value;
38
+ break;
39
+ }
40
+ return value;
41
+ }
42
+ onAfterValueChange(key, value) {
43
+ console.log('property change', key, value);
44
+ this.dispatchEvent(new CustomEvent('property-change', {
45
+ bubbles: true,
46
+ composed: true,
47
+ detail: {
48
+ [key]: value
49
+ }
50
+ }));
51
+ }
52
+ }
53
+ //# sourceMappingURL=abstract-property.js.map
@@ -0,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AC,KAAK,CAAA;gBAC9B,MAAK;QACT,CAAC;QAED,OAAO,KAAK,CAAA;IACd,CAAC;IAES,kBAAkB,CAAC,GAAW,EAAE,KAAU;QAClD,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;QAE1C,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,iBAAiB,EAAE;YACjC,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE;gBACN,CAAC,GAAG,CAAC,EAAE,KAAK;aACb;SACF,CAAC,CACH,CAAA;IACH,CAAC;CACF","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { LitElement } from 'lit'\n\nexport class AbstractProperty extends LitElement {\n firstUpdated() {\n this.renderRoot.addEventListener('change', this.onValueChange.bind(this))\n }\n\n protected onValueChange(e: Event) {\n var element = e.target as HTMLElement\n var key = element.getAttribute('value-key')\n\n if (!key) {\n return\n }\n\n var value = this.getValueFromEventTarget(element)\n\n this.onAfterValueChange(key, value)\n }\n\n protected getValueFromEventTarget(element: HTMLElement) {\n var value\n\n switch (element.tagName) {\n case 'INPUT':\n switch ((element as any).type) {\n case 'checkbox':\n value = (element as any).checked\n break\n case 'number':\n value = Number((element as any).valueAsNumber)\n break\n case 'text':\n value = String((element as any).value)\n }\n break\n\n case 'MD-ICON':\n value = (element as any).hasAttribute('active')\n break\n\n default:\n value = (element as any).value\n break\n }\n\n return value\n }\n\n protected onAfterValueChange(key: string, value: any) {\n console.log('property change', key, value)\n\n this.dispatchEvent(\n new CustomEvent('property-change', {\n bubbles: true,\n composed: true,\n detail: {\n [key]: value\n }\n })\n )\n }\n}\n"]}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import '@operato/input/ox-buttons-radio.js';
5
+ import '@operato/input/ox-input-code.js';
6
+ import '@operato/i18n/ox-i18n.js';
7
+ import '@operato/help/ox-help-icon.js';
8
+ import './data-binding-value-map.js';
9
+ import './data-binding-value-range.js';
10
+ import { LitElement, PropertyValues } from 'lit';
11
+ import { Properties, Scene } from '@hatiolab/things-scene';
12
+ export type Rule = {
13
+ map?: Properties;
14
+ range?: Properties[];
15
+ eval?: string;
16
+ } | any;
17
+ export type Mapping = {
18
+ source?: string;
19
+ rule: 'map' | 'range' | 'eval' | 'value';
20
+ accessor?: string;
21
+ target?: string;
22
+ property?: string;
23
+ param?: Rule;
24
+ ndnsp?: boolean;
25
+ partial?: boolean;
26
+ };
27
+ /**
28
+ element for mapping data value editing
29
+
30
+ Example:
31
+
32
+ <data-binding-mapper mapping=${mapping}>
33
+ </data-binding-mapper>
34
+ */
35
+ export declare class DataBindingMapper extends LitElement {
36
+ static styles: import("lit").CSSResult[];
37
+ mapping: Mapping;
38
+ rule: Rule;
39
+ properties: Properties[];
40
+ scene?: Scene;
41
+ _valueTypes: any;
42
+ _componentIds: {
43
+ value: string;
44
+ description: string;
45
+ }[];
46
+ editor: HTMLInputElement;
47
+ source: HTMLInputElement;
48
+ target: HTMLInputElement;
49
+ firstUpdated(): void;
50
+ updated(changes: PropertyValues<this>): void;
51
+ findComponentIds(): void;
52
+ render(): import("lit-html").TemplateResult<1>;
53
+ _valuetype(property: string): any;
54
+ private _keep_saved_rule_params;
55
+ _onChangedMapping(): Promise<void>;
56
+ _onChangeRule(e: Event): void;
57
+ _onChange(e: Event): void;
58
+ }