@operato/property-panel 9.0.0-beta.22 → 9.0.0-beta.28

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 (26) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/src/property-panel/data-binding/data-binding-mapper.js +2 -2
  3. package/dist/src/property-panel/data-binding/data-binding-mapper.js.map +1 -1
  4. package/dist/src/property-panel/effects/property-animation.js +1 -1
  5. package/dist/src/property-panel/effects/property-animation.js.map +1 -1
  6. package/dist/src/property-panel/effects/property-event-hover.d.ts +1 -1
  7. package/dist/src/property-panel/effects/property-event-hover.js +1 -1
  8. package/dist/src/property-panel/effects/property-event-hover.js.map +1 -1
  9. package/dist/src/property-panel/effects/property-event-tap.js +1 -1
  10. package/dist/src/property-panel/effects/property-event-tap.js.map +1 -1
  11. package/dist/src/property-panel/specifics/specific-properties-builder.d.ts +8 -5
  12. package/dist/src/property-panel/specifics/specific-properties-builder.js +16 -10
  13. package/dist/src/property-panel/specifics/specific-properties-builder.js.map +1 -1
  14. package/dist/src/property-panel/specifics/types.d.ts +21 -0
  15. package/dist/src/property-panel/specifics/types.js +2 -0
  16. package/dist/src/property-panel/specifics/types.js.map +1 -0
  17. package/dist/src/property-panel/styles/styles.js +13 -13
  18. package/dist/src/property-panel/styles/styles.js.map +1 -1
  19. package/dist/tsconfig.tsbuildinfo +1 -1
  20. package/package.json +5 -5
  21. package/src/property-panel/data-binding/data-binding-mapper.ts +2 -2
  22. package/src/property-panel/effects/property-animation.ts +1 -1
  23. package/src/property-panel/effects/property-event-hover.ts +1 -1
  24. package/src/property-panel/effects/property-event-tap.ts +1 -1
  25. package/src/property-panel/specifics/specific-properties-builder.ts +23 -15
  26. package/src/property-panel/styles/styles.ts +13 -13
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@operato/property-panel",
3
3
  "description": "Webcomponent property-panel following open-wc recommendations",
4
4
  "author": "heartyoh",
5
- "version": "9.0.0-beta.22",
5
+ "version": "9.0.0-beta.28",
6
6
  "type": "module",
7
7
  "main": "dist/src/index.js",
8
8
  "module": "dist/src/index.js",
@@ -63,10 +63,10 @@
63
63
  },
64
64
  "dependencies": {
65
65
  "@material/web": "^2.0.0",
66
- "@operato/attachment": "^9.0.0-beta.21",
66
+ "@operato/attachment": "^9.0.0-beta.28",
67
67
  "@operato/i18n": "^9.0.0-beta.20",
68
- "@operato/input": "^9.0.0-beta.21",
69
- "@operato/styles": "^9.0.0-beta.21",
68
+ "@operato/input": "^9.0.0-beta.28",
69
+ "@operato/styles": "^9.0.0-beta.28",
70
70
  "@operato/utils": "^9.0.0-beta.20",
71
71
  "lit": "^3.1.2"
72
72
  },
@@ -104,5 +104,5 @@
104
104
  "prettier --write"
105
105
  ]
106
106
  },
107
- "gitHead": "633906ba9b2e209fc2880445fd4ac2b80ab486c5"
107
+ "gitHead": "ddb7c9c9f18b08fdec009cbffdea291031d05c0e"
108
108
  }
@@ -219,7 +219,7 @@ export class DataBindingMapper extends LitElement {
219
219
  <div data-value="eval"><ox-i18n msgid="label.eval"></ox-i18n></div>
220
220
  </ox-buttons-radio>
221
221
 
222
- <div class="property-full-bleed" rule-editors ?hidden=${mapping.rule == 'value'}>
222
+ <div class="fullwidth" rule-editors ?hidden=${mapping.rule == 'value'}>
223
223
  <data-binding-value-map
224
224
  value-key="map"
225
225
  .value=${this.rule.map || {}}
@@ -237,7 +237,7 @@ export class DataBindingMapper extends LitElement {
237
237
  </data-binding-value-range>
238
238
 
239
239
  <ox-input-code
240
- class="property-full-bleed"
240
+ class="fullwidth"
241
241
  value-key="eval"
242
242
  id="eval-editor"
243
243
  .value=${this.rule.eval || ''}
@@ -44,7 +44,7 @@ export class PropertyAnimation extends LitElement {
44
44
 
45
45
  return html`
46
46
  <div class="property-grid">
47
- <label>Animation Type</label>
47
+ <label>Animation</label>
48
48
  <select value-key="type" .value=${value.type}>
49
49
  <option value="">None</option>
50
50
  <option value="rotation">Rotation</option>
@@ -121,7 +121,7 @@ export class PropertyEventHover extends LitElement {
121
121
  ? html`
122
122
  <label> <ox-i18n msgid="label.value">value</ox-i18n> </label>
123
123
  <ox-input-data
124
- class="custom-editor property-full-bleed"
124
+ class="custom-editor fullwidth"
125
125
  value-key="value"
126
126
  .value=${value}
127
127
  fullwidth
@@ -146,7 +146,7 @@ export class PropertyEventTap extends LitElement {
146
146
  ? html`
147
147
  <label> <ox-i18n msgid="label.value">value</ox-i18n> </label>
148
148
  <ox-input-data
149
- class="custom-editor property-full-bleed"
149
+ class="custom-editor fullwidth"
150
150
  value-key="value"
151
151
  .value=${value}
152
152
  fullwidth
@@ -7,8 +7,7 @@ import '@operato/app/property-editor.js' /* for registering property editors */
7
7
  import { html, LitElement, PropertyValues } from 'lit'
8
8
  import { property } from 'lit/decorators.js'
9
9
 
10
- import { Properties } from '@hatiolab/things-scene'
11
- import { OxPropertyEditor, PropertySpec } from '@operato/property-editor'
10
+ import { CSSStyles, OxPropertyEditor, PropertySpec } from '@operato/property-editor'
12
11
 
13
12
  /**
14
13
  모든 에디터들은 change 이벤트를 지원해야 한다. 또한, 모든 에디터들은 value속성에 값을 가져야 한다.
@@ -58,8 +57,8 @@ function convertValue(type: string, value: any) {
58
57
  }
59
58
 
60
59
  export class SpecificPropertiesBuilder extends LitElement {
61
- @property({ type: Object }) value: any
62
- @property({ type: Array }) props: any[] = []
60
+ @property({ type: Object }) value: { [name: string]: any } = {}
61
+ @property({ type: Array }) props?: PropertySpec[]
63
62
  @property({ type: Object }) propertyEditor: any
64
63
 
65
64
  render() {
@@ -71,21 +70,24 @@ export class SpecificPropertiesBuilder extends LitElement {
71
70
  }
72
71
 
73
72
  updated(changes: PropertyValues<this>) {
74
- changes.has('props') && this._onPropsChanged(this.props)
75
- changes.has('value') && this._setValues()
73
+ changes.has('props') && this.onPropsChanged(this.props || [])
74
+ changes.has('value') && this.setValues()
76
75
  }
77
76
 
78
- _onPropsChanged(props: any[]) {
77
+ private onPropsChanged(props: PropertySpec[]) {
78
+ const specs = this.props || []
79
+
79
80
  this.textContent = ''
80
- ;(props || []).forEach((spec: PropertySpec) => {
81
- const { label, type, placeholder, name, observe, property, editor, quantifier, defaultValue, disabled } = spec
81
+ specs.forEach((spec: PropertySpec) => {
82
+ const { label, type, placeholder, name, observe, property, editor, quantifier, defaultValue, disabled, styles } =
83
+ spec
82
84
 
83
- let elementType = OxPropertyEditor.getEditor(type)
85
+ const elementType = OxPropertyEditor.getEditor(type)
84
86
  if (!elementType) {
85
87
  console.warn('Property Editor not defined', type)
86
88
  return
87
89
  }
88
- let element = document.createElement(elementType) as OxPropertyEditor
90
+ const element = document.createElement(elementType) as OxPropertyEditor
89
91
 
90
92
  element.label = label
91
93
  element.type = type
@@ -103,13 +105,19 @@ export class SpecificPropertiesBuilder extends LitElement {
103
105
  element.setAttribute('property-editor', 'true')
104
106
  element.disabled = disabled
105
107
 
108
+ if (styles) {
109
+ Object.keys(styles).forEach((key: string) => {
110
+ element.style[key as keyof CSSStyles] = styles[key as keyof CSSStyles]
111
+ })
112
+ }
113
+
106
114
  this.appendChild(element)
107
115
  })
108
116
  }
109
117
 
110
- _setValues() {
118
+ private setValues() {
111
119
  this.value &&
112
- Array.from(this.querySelectorAll('[name]')).forEach((prop: Properties) => {
120
+ Array.from(this.querySelectorAll('[name]')).forEach((prop: { [name: string]: any }) => {
113
121
  let name = prop.getAttribute('name')
114
122
  if (!name) {
115
123
  return
@@ -123,7 +131,7 @@ export class SpecificPropertiesBuilder extends LitElement {
123
131
  })
124
132
  }
125
133
 
126
- onValueChanged(e: Event) {
134
+ private onValueChanged(e: Event) {
127
135
  e.stopPropagation()
128
136
  var target = e.target as Element
129
137
 
@@ -137,7 +145,7 @@ export class SpecificPropertiesBuilder extends LitElement {
137
145
  this.value[name] = prop.value
138
146
 
139
147
  prop.observe(prop.value)
140
- this._setValues()
148
+ this.setValues()
141
149
 
142
150
  this.dispatchEvent(
143
151
  new CustomEvent('property-change', {
@@ -119,19 +119,19 @@ export class PropertyStyles extends AbstractProperty {
119
119
 
120
120
  <ox-font-selector class="custom-editor" value-key="fontFamily" .value=${fontFamily}></ox-font-selector>
121
121
 
122
- <label class="property-onethird-label icon-only-label"><md-icon>format_size</md-icon></label>
123
- <input type="number" value-key="fontSize" .value=${fontSize} class="property-onethird-input" />
122
+ <label class="onethird-label icon-only-label"><md-icon>format_size</md-icon></label>
123
+ <input type="number" value-key="fontSize" .value=${fontSize} class="onethird-editor" />
124
124
 
125
- <label class="property-onethird-label icon-only-label"><md-icon>format_line_spacing</md-icon></label>
126
- <input type="number" value-key="lineHeight" .value=${lineHeight} class="property-onethird-input" />
125
+ <label class="onethird-label icon-only-label"><md-icon>format_line_spacing</md-icon></label>
126
+ <input type="number" value-key="lineHeight" .value=${lineHeight} class="onethird-editor" />
127
127
 
128
- <label class="property-onethird-label icon-only-label"><md-icon>format_letter_spacing</md-icon></label>
129
- <input type="number" value-key="letterSpacing" .value=${letterSpacing} class="property-onethird-input" />
128
+ <label class="onethird-label icon-only-label"><md-icon>format_letter_spacing</md-icon></label>
129
+ <input type="number" value-key="letterSpacing" .value=${letterSpacing} class="onethird-editor" />
130
130
 
131
- <label class="property-twothird-label icon-only-label"><md-icon>format_color_text</md-icon></label>
132
- <ox-input-color value-key="fontColor" .value=${fontColor} class="property-twothird-input"> </ox-input-color>
131
+ <label class="twothird-label icon-only-label"><md-icon>format_color_text</md-icon></label>
132
+ <ox-input-color value-key="fontColor" .value=${fontColor} class="twothird-editor"> </ox-input-color>
133
133
 
134
- <div class="property-onethird-full btn-group" @click=${this.onButtonGroupClick}>
134
+ <div class="onethird-full btn-group" @click=${this.onButtonGroupClick}>
135
135
  <md-icon value-key="bold" ?active=${bold}>format_bold</md-icon>
136
136
  <md-icon value-key="italic" ?active=${italic}>format_italic</md-icon>
137
137
  </div>
@@ -154,11 +154,11 @@ export class PropertyStyles extends AbstractProperty {
154
154
  </legend>
155
155
 
156
156
  <div class="property-grid">
157
- <label class="property-half-label icon-only-label"><md-icon>line_weight</md-icon></label>
158
- <input type="number" value-key="lineWidth" .value=${lineWidth} class="property-half-input" />
157
+ <label class="half-label icon-only-label"><md-icon>line_weight</md-icon></label>
158
+ <input type="number" value-key="lineWidth" .value=${lineWidth} class="half-editor" />
159
159
 
160
- <label class="property-half-label icon-only-label"><md-icon>border_color</md-icon></label>
161
- <ox-input-color value-key="strokeStyle" .value=${strokeStyle} class="property-half-input"> </ox-input-color>
160
+ <label class="half-label icon-only-label"><md-icon>border_color</md-icon></label>
161
+ <ox-input-color value-key="strokeStyle" .value=${strokeStyle} class="half-editor"> </ox-input-color>
162
162
 
163
163
  <label>
164
164
  <ox-i18n msgid="label.line-type">line type</ox-i18n>