@things-factory/modeller-ui 5.0.0-alpha.5 → 5.0.0-alpha.6
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.
- package/client/bootstrap.js +22 -26
- package/client/editors/things-editor-layout/things-card-layout.js +1 -1
- package/client/editors/things-editor-property.js +1 -546
- package/package.json +15 -14
- package/client/editors/paper-color-picker/paper-color-circle.js +0 -466
- package/client/editors/paper-color-picker/paper-color-input.js +0 -266
- package/client/editors/paper-color-picker/paper-color-picker.js +0 -584
- package/client/editors/things-editor-3dish.js +0 -164
- package/client/editors/things-editor-angle-input.js +0 -69
- package/client/editors/things-editor-attachment-selector.js +0 -110
- package/client/editors/things-editor-buttons-radio.js +0 -93
- package/client/editors/things-editor-code.js +0 -152
- package/client/editors/things-editor-color-stops.js +0 -499
- package/client/editors/things-editor-color-style.js +0 -345
- package/client/editors/things-editor-color.js +0 -313
- package/client/editors/things-editor-data.js +0 -152
- package/client/editors/things-editor-gradient.js +0 -335
- package/client/editors/things-editor-graphql.js +0 -173
- package/client/editors/things-editor-id.js +0 -85
- package/client/editors/things-editor-multiple-color.js +0 -132
- package/client/editors/things-editor-options.js +0 -156
- package/client/editors/things-editor-pattern.js +0 -161
- package/client/editors/things-editor-property-styles.js +0 -71
- package/client/editors/things-editor-range-input.js +0 -166
- package/client/editors/things-editor-script.js +0 -213
- package/client/editors/things-editor-stack.js +0 -107
- package/client/editors/things-editor-table.js +0 -376
- package/client/editors/things-editor-value-map.js +0 -290
- package/client/editors/things-editor-value-range.js +0 -292
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import '@operato/i18n/ox-i18n.js'
|
|
6
|
-
import './things-editor-color'
|
|
7
|
-
import './things-editor-gradient'
|
|
8
|
-
import './things-editor-pattern'
|
|
9
|
-
|
|
10
|
-
import { css, html, LitElement } from 'lit'
|
|
11
|
-
|
|
12
|
-
export default class ThingsEditorColorStyle extends LitElement {
|
|
13
|
-
static get is() {
|
|
14
|
-
return 'things-editor-color-style'
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
static get properties() {
|
|
18
|
-
return {
|
|
19
|
-
value: Object,
|
|
20
|
-
fillType: String,
|
|
21
|
-
solid: String,
|
|
22
|
-
gradient: Object,
|
|
23
|
-
pattern: Object
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
static get styles() {
|
|
28
|
-
return [
|
|
29
|
-
css`
|
|
30
|
-
:host {
|
|
31
|
-
display: flex;
|
|
32
|
-
flex-direction: column;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
[fill-type] {
|
|
36
|
-
display: flex;
|
|
37
|
-
margin: 0 0 14px 0;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
[fill-type] * {
|
|
41
|
-
flex: auto;
|
|
42
|
-
margin: 0;
|
|
43
|
-
text-align: left;
|
|
44
|
-
align-self: center;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.grid-10 {
|
|
48
|
-
display: grid;
|
|
49
|
-
|
|
50
|
-
grid-template-columns: repeat(10, 1fr);
|
|
51
|
-
grid-gap: 5px;
|
|
52
|
-
grid-auto-rows: minmax(24px, auto);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.grid-10 > things-editor-color {
|
|
56
|
-
grid-column: span 4;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.grid-10 > .icon-only-label {
|
|
60
|
-
grid-column: span 1;
|
|
61
|
-
|
|
62
|
-
background: url(/assets/images/icon-properties-label.png) no-repeat;
|
|
63
|
-
float: left;
|
|
64
|
-
margin: 0;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.icon-only-label.color {
|
|
68
|
-
background-position: 70% -498px;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
[editors] > :not([active]) {
|
|
72
|
-
display: none;
|
|
73
|
-
}
|
|
74
|
-
`
|
|
75
|
-
]
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
updated(change) {
|
|
79
|
-
change.has('value') && this._onChangedValue(this.value)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
render() {
|
|
83
|
-
return html`
|
|
84
|
-
<div @change=${e => this._onChangedFillType(e)} fill-type>
|
|
85
|
-
<input
|
|
86
|
-
type="radio"
|
|
87
|
-
id="fill-type-no"
|
|
88
|
-
name="fill-type"
|
|
89
|
-
value="no"
|
|
90
|
-
.checked=${!this.fillType || this.fillType == 'no'}
|
|
91
|
-
/>
|
|
92
|
-
<label for="fill-type-no"><ox-i18n msgid="label.no-fill">no fill</ox-i18n></label>
|
|
93
|
-
<input type="radio" id="fill-type-solid" name="fill-type" value="solid" .checked=${this.fillType == 'solid'} />
|
|
94
|
-
<label for="fill-type-solid"><ox-i18n msgid="label.solid">solid</ox-i18n></label>
|
|
95
|
-
<input
|
|
96
|
-
type="radio"
|
|
97
|
-
id="fill-type-gradient"
|
|
98
|
-
name="fill-type"
|
|
99
|
-
value="gradient"
|
|
100
|
-
.checked=${this.fillType == 'gradient'}
|
|
101
|
-
/>
|
|
102
|
-
<label for="fill-type-gradient"><ox-i18n msgid="label.gradient">gradient</ox-i18n></label>
|
|
103
|
-
<input
|
|
104
|
-
type="radio"
|
|
105
|
-
id="fill-type-pattern"
|
|
106
|
-
name="fill-type"
|
|
107
|
-
value="pattern"
|
|
108
|
-
.checked=${this.fillType == 'pattern'}
|
|
109
|
-
/>
|
|
110
|
-
<label for="fill-type-pattern"><ox-i18n msgid="label.pattern">pattern</ox-i18n></label>
|
|
111
|
-
</div>
|
|
112
|
-
|
|
113
|
-
<div editors>
|
|
114
|
-
<div ?active=${this.fillType == 'no'}></div>
|
|
115
|
-
|
|
116
|
-
<div class="grid-10" ?active=${this.fillType == 'solid'}>
|
|
117
|
-
<label class="icon-only-label color"></label>
|
|
118
|
-
<things-editor-color @change=${e => this._onChangedSolid(e)} .value=${this.solid}> </things-editor-color>
|
|
119
|
-
</div>
|
|
120
|
-
|
|
121
|
-
<div ?active=${this.fillType == 'gradient'}>
|
|
122
|
-
<things-editor-gradient @change=${e => this._onChandedGradient(e)} .value=${this.gradient}>
|
|
123
|
-
</things-editor-gradient>
|
|
124
|
-
</div>
|
|
125
|
-
|
|
126
|
-
<div ?active=${this.fillType == 'pattern'}>
|
|
127
|
-
<things-editor-pattern @change=${e => this._onChangedPattern(e)} .value=${this.pattern}>
|
|
128
|
-
</things-editor-pattern>
|
|
129
|
-
</div>
|
|
130
|
-
</div>
|
|
131
|
-
`
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
async _onChangedValue(value) {
|
|
135
|
-
/*
|
|
136
|
-
* this._block_reset의 역할은 내부 사용자 인터렉션에 의한 value의 변경시에는 각 type별 이전값을 유지하기 위함이다.
|
|
137
|
-
*/
|
|
138
|
-
await this.renderComplete
|
|
139
|
-
|
|
140
|
-
/* 설정 값에 따라서, 멤버 속성을 설정한다. */
|
|
141
|
-
if (!value) {
|
|
142
|
-
this.fillType = 'no'
|
|
143
|
-
|
|
144
|
-
if (!this._block_reset) {
|
|
145
|
-
this.solid = null
|
|
146
|
-
this.gradient = null
|
|
147
|
-
this.pattern = null
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
this._block_reset = false
|
|
151
|
-
return
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
switch (typeof value) {
|
|
155
|
-
case 'string':
|
|
156
|
-
this.fillType = 'solid'
|
|
157
|
-
this.solid = value
|
|
158
|
-
|
|
159
|
-
if (!this._block_reset) {
|
|
160
|
-
this.gradient = null
|
|
161
|
-
this.pattern = null
|
|
162
|
-
}
|
|
163
|
-
break
|
|
164
|
-
case 'object':
|
|
165
|
-
this.fillType = value.type
|
|
166
|
-
|
|
167
|
-
if (value.type === 'gradient') {
|
|
168
|
-
this.gradient = {
|
|
169
|
-
type: value.gradientType || 'linear',
|
|
170
|
-
colorStops: value.colorStops || [
|
|
171
|
-
{
|
|
172
|
-
position: 0,
|
|
173
|
-
color: this.solid || '#000000'
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
position: 1,
|
|
177
|
-
color: this.solid || '#FFFFFF'
|
|
178
|
-
}
|
|
179
|
-
],
|
|
180
|
-
rotation: parseFloat(value.rotation) || 0,
|
|
181
|
-
center: value.center
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
if (!this._block_reset) {
|
|
185
|
-
this.pattern = null
|
|
186
|
-
this.solid = null
|
|
187
|
-
}
|
|
188
|
-
} else if (value.type === 'pattern') {
|
|
189
|
-
this.pattern = {
|
|
190
|
-
image: value.image,
|
|
191
|
-
offsetX: parseInt(value.offsetX) || 0,
|
|
192
|
-
offsetY: parseInt(value.offsetY) || 0,
|
|
193
|
-
width: parseInt(value.width),
|
|
194
|
-
height: parseInt(value.height),
|
|
195
|
-
align: value.align,
|
|
196
|
-
fitPattern: value.fitPattern
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (!this._block_reset) {
|
|
200
|
-
this.gradient = null
|
|
201
|
-
this.solid = null
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
break
|
|
206
|
-
default:
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
this._block_reset = false
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
_onChangedFillType(e) {
|
|
213
|
-
this.fillType = e.target.value
|
|
214
|
-
|
|
215
|
-
switch (this.fillType) {
|
|
216
|
-
case 'gradient':
|
|
217
|
-
if (!this.gradient) {
|
|
218
|
-
this.gradient = {
|
|
219
|
-
type: 'linear',
|
|
220
|
-
colorStops: [
|
|
221
|
-
{
|
|
222
|
-
position: 0,
|
|
223
|
-
color: this.solid || '#000000'
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
position: 1,
|
|
227
|
-
color: this.solid || '#FFFFFF'
|
|
228
|
-
}
|
|
229
|
-
],
|
|
230
|
-
rotation: 0,
|
|
231
|
-
center: 'center'
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
this.value = {
|
|
236
|
-
type: 'gradient',
|
|
237
|
-
gradientType: this.gradient.type || 'linear',
|
|
238
|
-
colorStops: this.gradient.colorStops || [
|
|
239
|
-
{
|
|
240
|
-
position: 0,
|
|
241
|
-
color: this.solid || '#000000'
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
position: 1,
|
|
245
|
-
color: this.solid || '#FFFFFF'
|
|
246
|
-
}
|
|
247
|
-
],
|
|
248
|
-
rotation: parseFloat(this.gradient.rotation) || 0,
|
|
249
|
-
center: this.gradient.center
|
|
250
|
-
}
|
|
251
|
-
break
|
|
252
|
-
|
|
253
|
-
case 'pattern':
|
|
254
|
-
if (!this.pattern) this.pattern = {}
|
|
255
|
-
|
|
256
|
-
this.value = {
|
|
257
|
-
type: 'pattern',
|
|
258
|
-
image: this.pattern.image,
|
|
259
|
-
offsetX: parseInt(this.pattern.offsetX) || 0,
|
|
260
|
-
offsetY: parseInt(this.pattern.offsetY) || 0,
|
|
261
|
-
width: parseInt(this.pattern.width),
|
|
262
|
-
height: parseInt(this.pattern.height),
|
|
263
|
-
align: this.pattern.align,
|
|
264
|
-
fitPattern: this.pattern.fitPattern
|
|
265
|
-
}
|
|
266
|
-
break
|
|
267
|
-
|
|
268
|
-
case 'solid':
|
|
269
|
-
if (!this.solid) this.solid = '#fff'
|
|
270
|
-
this.value = this.solid
|
|
271
|
-
break
|
|
272
|
-
|
|
273
|
-
case 'no':
|
|
274
|
-
this.value = ''
|
|
275
|
-
break
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
this._block_reset = true
|
|
279
|
-
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
_onChangedSolid(e) {
|
|
283
|
-
if (this.fillType !== 'solid') return
|
|
284
|
-
|
|
285
|
-
this.solid = e.target.value
|
|
286
|
-
|
|
287
|
-
this.value = this.solid
|
|
288
|
-
|
|
289
|
-
this._block_reset = true
|
|
290
|
-
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
_onChandedGradient(e) {
|
|
294
|
-
/*
|
|
295
|
-
* TODO Gradient의 rotation은 symmetry 기능 등으로 외부에서 변경될 수도 있다.
|
|
296
|
-
* 이 점을 감안해서, 외부 변경에 대한 대응을 해야 한다.
|
|
297
|
-
*/
|
|
298
|
-
|
|
299
|
-
if (this.fillType !== 'gradient') return
|
|
300
|
-
|
|
301
|
-
this.gradient = e.target.value
|
|
302
|
-
|
|
303
|
-
this.value = {
|
|
304
|
-
type: 'gradient',
|
|
305
|
-
gradientType: this.gradient.type || 'linear',
|
|
306
|
-
colorStops: this.gradient.colorStops || [
|
|
307
|
-
{
|
|
308
|
-
position: 0,
|
|
309
|
-
color: this.solid || '#000000'
|
|
310
|
-
},
|
|
311
|
-
{
|
|
312
|
-
position: 1,
|
|
313
|
-
color: this.solid || '#FFFFFF'
|
|
314
|
-
}
|
|
315
|
-
],
|
|
316
|
-
rotation: parseFloat(this.gradient.rotation) || 0,
|
|
317
|
-
center: this.gradient.center
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
this._block_reset = true
|
|
321
|
-
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
_onChangedPattern(e) {
|
|
325
|
-
if (this.fillType !== 'pattern') return
|
|
326
|
-
|
|
327
|
-
this.pattern = e.target.value
|
|
328
|
-
|
|
329
|
-
this.value = {
|
|
330
|
-
type: 'pattern',
|
|
331
|
-
image: this.pattern.image,
|
|
332
|
-
offsetX: parseInt(this.pattern.offsetX) || 0,
|
|
333
|
-
offsetY: parseInt(this.pattern.offsetY) || 0,
|
|
334
|
-
width: parseInt(this.pattern.width),
|
|
335
|
-
height: parseInt(this.pattern.height),
|
|
336
|
-
align: this.pattern.align,
|
|
337
|
-
fitPattern: this.pattern.fitPattern
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
this._block_reset = true
|
|
341
|
-
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
customElements.define(ThingsEditorColorStyle.is, ThingsEditorColorStyle)
|
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { LitElement, html, css } from 'lit'
|
|
6
|
-
|
|
7
|
-
import './paper-color-picker/paper-color-picker'
|
|
8
|
-
import tinycolor from 'tinycolor2'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
색상을 입력하는데 사용되는 입력 컴포넌트이다.
|
|
12
|
-
화면상에는 두개의 입력 필드가 보이며, 하나는 색상값을 키보드로 직접 입력하는 입력 픽드이며,
|
|
13
|
-
다른 하나는 마우스로 클릭하여 컬러 파레트를 팝업 시키는 입력 필드이다.
|
|
14
|
-
컬러 파레트를 팝업시키는 입력필드는 현재 입력된 색상으로 표시된다.
|
|
15
|
-
|
|
16
|
-
색상값을 직접 입력하는 필드에서는 'white', 'red', 'yellow' 등 색상의미 단어를 사용할 수도 있고,
|
|
17
|
-
#fff, #123456 와 같이 스타일에서 지정하는 방식의 3자리 및 6자리 숫자 표현도 가능하다.
|
|
18
|
-
컬러 파레트를 팝업시키는 입력 필드에서 색상을 지정하게되면, 모두 6자리 숫자 표현방식만을 사용한다.
|
|
19
|
-
|
|
20
|
-
의미 단어를 지원하는 색상은 다음과 같다.
|
|
21
|
-
|
|
22
|
-
aliceblue : #f0f8ff<br>
|
|
23
|
-
antiquewhite : #faebd7<br>
|
|
24
|
-
aqua : #00ffff<br>
|
|
25
|
-
aquamarine : #7fffd4<br>
|
|
26
|
-
azure : #f0ffff<br>
|
|
27
|
-
beige : #f5f5dc<br>
|
|
28
|
-
bisque : #ffe4c4<br>
|
|
29
|
-
black : #000000<br>
|
|
30
|
-
blanchedalmond : #ffebcd<br>
|
|
31
|
-
blue : #0000ff<br>
|
|
32
|
-
blueviolet : #8a2be2<br>
|
|
33
|
-
brown : #a52a2a<br>
|
|
34
|
-
burlywood : #deb887<br>
|
|
35
|
-
cadetblue : #5f9ea0<br>
|
|
36
|
-
chartreuse : #7fff00<br>
|
|
37
|
-
chocolate : #d2691e<br>
|
|
38
|
-
coral : #ff7f50<br>
|
|
39
|
-
cornflowerblue : #6495ed<br>
|
|
40
|
-
cornsilk : #fff8dc<br>
|
|
41
|
-
crimson : #dc143c<br>
|
|
42
|
-
cyan : #00ffff<br>
|
|
43
|
-
darkblue : #00008b<br>
|
|
44
|
-
darkcyan : #008b8b<br>
|
|
45
|
-
darkgoldenrod : #b8860b<br>
|
|
46
|
-
darkgray : #a9a9a9<br>
|
|
47
|
-
darkgreen : #006400<br>
|
|
48
|
-
darkkhaki : #bdb76b<br>
|
|
49
|
-
darkmagenta : #8b008b<br>
|
|
50
|
-
darkolivegreen : #556b2f<br>
|
|
51
|
-
darkorange : #ff8c00<br>
|
|
52
|
-
darkorchid : #9932cc<br>
|
|
53
|
-
darkred : #8b0000<br>
|
|
54
|
-
darksalmon : #e9967a<br>
|
|
55
|
-
darkseagreen : #8fbc8f<br>
|
|
56
|
-
darkslateblue : #483d8b<br>
|
|
57
|
-
darkslategray : #2f4f4f<br>
|
|
58
|
-
darkturquoise : #00ced1<br>
|
|
59
|
-
darkviolet : #9400d3<br>
|
|
60
|
-
deeppink : #ff1493<br>
|
|
61
|
-
deepskyblue : #00bfff<br>
|
|
62
|
-
dimgray : #696969<br>
|
|
63
|
-
dodgerblue : #1e90ff<br>
|
|
64
|
-
firebrick : #b22222<br>
|
|
65
|
-
floralwhite : #fffaf0<br>
|
|
66
|
-
forestgreen : #228b22<br>
|
|
67
|
-
fuchsia : #ff00ff<br>
|
|
68
|
-
gainsboro : #dcdcdc<br>
|
|
69
|
-
ghostwhite : #f8f8ff<br>
|
|
70
|
-
gold : #ffd700<br>
|
|
71
|
-
goldenrod : #daa520<br>
|
|
72
|
-
gray : #808080<br>
|
|
73
|
-
green : #008000<br>
|
|
74
|
-
greenyellow : #adff2f<br>
|
|
75
|
-
honeydew : #f0fff0<br>
|
|
76
|
-
hotpink : #ff69b4<br>
|
|
77
|
-
indianred : #cd5c5c<br>
|
|
78
|
-
indigo : #4b0082<br>
|
|
79
|
-
ivory : #fffff0<br>
|
|
80
|
-
khaki : #f0e68c<br>
|
|
81
|
-
lavender : #e6e6fa<br>
|
|
82
|
-
lavenderblush : #fff0f5<br>
|
|
83
|
-
lawngreen : #7cfc00<br>
|
|
84
|
-
lemonchiffon : #fffacd<br>
|
|
85
|
-
lightblue : #add8e6<br>
|
|
86
|
-
lightcoral : #f08080<br>
|
|
87
|
-
lightcyan : #e0ffff<br>
|
|
88
|
-
lightgoldenrodyellow : #fafad2<br>
|
|
89
|
-
lightgrey : #d3d3d3<br>
|
|
90
|
-
lightgreen : #90ee90<br>
|
|
91
|
-
lightpink : #ffb6c1<br>
|
|
92
|
-
lightsalmon : #ffa07a<br>
|
|
93
|
-
lightseagreen : #20b2aa<br>
|
|
94
|
-
lightskyblue : #87cefa<br>
|
|
95
|
-
lightslategray : #778899<br>
|
|
96
|
-
lightsteelblue : #b0c4de<br>
|
|
97
|
-
lightyellow : #ffffe0<br>
|
|
98
|
-
lime : #00ff00<br>
|
|
99
|
-
limegreen : #32cd32<br>
|
|
100
|
-
linen : #faf0e6<br>
|
|
101
|
-
magenta : #ff00ff<br>
|
|
102
|
-
maroon : #800000<br>
|
|
103
|
-
mediumaquamarine : #66cdaa<br>
|
|
104
|
-
mediumblue : #0000cd<br>
|
|
105
|
-
mediumorchid : #ba55d3<br>
|
|
106
|
-
mediumpurple : #9370d8<br>
|
|
107
|
-
mediumseagreen : #3cb371<br>
|
|
108
|
-
mediumslateblue : #7b68ee<br>
|
|
109
|
-
mediumspringgreen : #00fa9a<br>
|
|
110
|
-
mediumturquoise : #48d1cc<br>
|
|
111
|
-
mediumvioletred : #c71585<br>
|
|
112
|
-
midnightblue : #191970<br>
|
|
113
|
-
mintcream : #f5fffa<br>
|
|
114
|
-
mistyrose : #ffe4e1<br>
|
|
115
|
-
moccasin : #ffe4b5<br>
|
|
116
|
-
navajowhite : #ffdead<br>
|
|
117
|
-
navy : #000080<br>
|
|
118
|
-
oldlace : #fdf5e6<br>
|
|
119
|
-
olive : #808000<br>
|
|
120
|
-
olivedrab : #6b8e23<br>
|
|
121
|
-
orange : #ffa500<br>
|
|
122
|
-
orangered : #ff4500<br>
|
|
123
|
-
orchid : #da70d6<br>
|
|
124
|
-
palegoldenrod : #eee8aa<br>
|
|
125
|
-
palegreen : #98fb98<br>
|
|
126
|
-
paleturquoise : #afeeee<br>
|
|
127
|
-
palevioletred : #d87093<br>
|
|
128
|
-
papayawhip : #ffefd5<br>
|
|
129
|
-
peachpuff : #ffdab9<br>
|
|
130
|
-
peru : #cd853f<br>
|
|
131
|
-
pink : #ffc0cb<br>
|
|
132
|
-
plum : #dda0dd<br>
|
|
133
|
-
powderblue : #b0e0e6<br>
|
|
134
|
-
purple : #800080<br>
|
|
135
|
-
red : #ff0000<br>
|
|
136
|
-
rosybrown : #bc8f8f<br>
|
|
137
|
-
royalblue : #4169e1<br>
|
|
138
|
-
saddlebrown : #8b4513<br>
|
|
139
|
-
salmon : #fa8072<br>
|
|
140
|
-
sandybrown : #f4a460<br>
|
|
141
|
-
seagreen : #2e8b57<br>
|
|
142
|
-
seashell : #fff5ee<br>
|
|
143
|
-
sienna : #a0522d<br>
|
|
144
|
-
silver : #c0c0c0<br>
|
|
145
|
-
skyblue : #87ceeb<br>
|
|
146
|
-
slateblue : #6a5acd<br>
|
|
147
|
-
slategray : #708090<br>
|
|
148
|
-
snow : #fffafa<br>
|
|
149
|
-
springgreen : #00ff7f<br>
|
|
150
|
-
steelblue : #4682b4<br>
|
|
151
|
-
tan : #d2b48c<br>
|
|
152
|
-
teal : #008080<br>
|
|
153
|
-
thistle : #d8bfd8<br>
|
|
154
|
-
tomato : #ff6347<br>
|
|
155
|
-
turquoise : #40e0d0<br>
|
|
156
|
-
violet : #ee82ee<br>
|
|
157
|
-
wheat : #f5deb3<br>
|
|
158
|
-
white : #ffffff<br>
|
|
159
|
-
whitesmoke : #f5f5f5<br>
|
|
160
|
-
yellow : #ffff00<br>
|
|
161
|
-
yellowgreen : #9acd32<br>
|
|
162
|
-
|
|
163
|
-
Example:
|
|
164
|
-
|
|
165
|
-
<things-editor-color .value=${color}>
|
|
166
|
-
</things-editor-color>
|
|
167
|
-
*/
|
|
168
|
-
class ThingsEditorColor extends LitElement {
|
|
169
|
-
static get is() {
|
|
170
|
-
return 'things-editor-color'
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
static get properties() {
|
|
174
|
-
return {
|
|
175
|
-
value: String,
|
|
176
|
-
properties: Object
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
static get styles() {
|
|
181
|
-
return [
|
|
182
|
-
css`
|
|
183
|
-
:host {
|
|
184
|
-
position: relative;
|
|
185
|
-
display: inline-flex;
|
|
186
|
-
align-items: center;
|
|
187
|
-
justify-content: flex-end;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
input[type='text'] {
|
|
191
|
-
padding-right: 24px;
|
|
192
|
-
width: 100%;
|
|
193
|
-
height: 100%;
|
|
194
|
-
box-sizing: border-box;
|
|
195
|
-
border: 1px solid rgba(0, 0, 0, 0.2);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
a {
|
|
199
|
-
-webkit-appearance: none;
|
|
200
|
-
display: flex;
|
|
201
|
-
position: absolute;
|
|
202
|
-
width: 24px;
|
|
203
|
-
height: 100%;
|
|
204
|
-
box-sizing: border-box;
|
|
205
|
-
align-items: center;
|
|
206
|
-
justify-content: center;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
span {
|
|
210
|
-
width: 18px;
|
|
211
|
-
height: 100%;
|
|
212
|
-
max-height: 18px;
|
|
213
|
-
border-radius: 10%;
|
|
214
|
-
border: 1px solid #eee;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
span.transparent {
|
|
218
|
-
background-color: #fefefe;
|
|
219
|
-
background-image: linear-gradient(45deg, #cbcbcb 25%, transparent 25%, transparent 75%, #cbcbcb 75%, #cbcbcb),
|
|
220
|
-
linear-gradient(45deg, #cbcbcb 25%, transparent 25%, transparent 75%, #cbcbcb 75%, #cbcbcb);
|
|
221
|
-
background-position: 0 0, 9px 9px;
|
|
222
|
-
background-size: 18px 18px;
|
|
223
|
-
}
|
|
224
|
-
`
|
|
225
|
-
]
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
render() {
|
|
229
|
-
return html`
|
|
230
|
-
<input
|
|
231
|
-
id="text"
|
|
232
|
-
type="text"
|
|
233
|
-
.value=${this.value || ''}
|
|
234
|
-
@change=${e => this._onInputChanged(e)}
|
|
235
|
-
.placeholder=${this.getAttribute('placeholder') || ''}
|
|
236
|
-
/>
|
|
237
|
-
|
|
238
|
-
<a @click=${e => this.showPicker(e)}>
|
|
239
|
-
<span id="color-thumbnail" .style="background-color:${this._thumbnail()}" class=${this._thumbnail()}> </span>
|
|
240
|
-
</a>
|
|
241
|
-
`
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
set colorString(colorString) {
|
|
245
|
-
var color = tinycolor(colorString)
|
|
246
|
-
var { withoutAlpha, valueType } = this.properties || {}
|
|
247
|
-
|
|
248
|
-
if (color.isValid()) {
|
|
249
|
-
if (valueType == 'hex' || withoutAlpha) this.value = color.toHexString()
|
|
250
|
-
else this.value = color.toString()
|
|
251
|
-
|
|
252
|
-
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
_thumbnail() {
|
|
257
|
-
return tinycolor(this.value || 'transparent').toString()
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
_onInputChanged(e) {
|
|
261
|
-
e.stopPropagation()
|
|
262
|
-
this.value = e.target.value
|
|
263
|
-
|
|
264
|
-
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* 외부에서 호출 가능한 메쏘드임.
|
|
269
|
-
*/
|
|
270
|
-
showPicker() {
|
|
271
|
-
var { withoutAlpha } = this.properties || {}
|
|
272
|
-
|
|
273
|
-
var color = tinycolor(this.value)
|
|
274
|
-
|
|
275
|
-
var picker = document.createElement('paper-color-picker')
|
|
276
|
-
picker.shape = 'huebox'
|
|
277
|
-
picker.color = color
|
|
278
|
-
picker.colorAsString = color.toString()
|
|
279
|
-
if (!withoutAlpha) {
|
|
280
|
-
picker.allowAlpha = true
|
|
281
|
-
picker.alwaysShowAlpha = true
|
|
282
|
-
}
|
|
283
|
-
picker.type = 'hsl'
|
|
284
|
-
|
|
285
|
-
if (color.isValid()) {
|
|
286
|
-
let rgb = color.toRgb()
|
|
287
|
-
let alpha = color.getAlpha()
|
|
288
|
-
|
|
289
|
-
picker._initialAlphaValueHack = alpha
|
|
290
|
-
|
|
291
|
-
picker.set('immediateColor.red', rgb.r)
|
|
292
|
-
picker.set('immediateColor.green', rgb.g)
|
|
293
|
-
picker.set('immediateColor.blue', rgb.b)
|
|
294
|
-
|
|
295
|
-
if (alpha != undefined) picker.set('immediateColor.alpha', alpha)
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
document.body.appendChild(picker)
|
|
299
|
-
|
|
300
|
-
var _ = e => {
|
|
301
|
-
if (!e?.detail?.confirmed) return
|
|
302
|
-
|
|
303
|
-
if (picker.colorAsString) this.colorString = picker.colorAsString
|
|
304
|
-
picker.removeEventListener('iron-overlay-closed', _)
|
|
305
|
-
picker.parentNode.removeChild(picker)
|
|
306
|
-
}
|
|
307
|
-
picker.addEventListener('iron-overlay-closed', _)
|
|
308
|
-
|
|
309
|
-
setTimeout(() => picker.open())
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
customElements.define(ThingsEditorColor.is, ThingsEditorColor)
|