@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.
Files changed (29) hide show
  1. package/client/bootstrap.js +22 -26
  2. package/client/editors/things-editor-layout/things-card-layout.js +1 -1
  3. package/client/editors/things-editor-property.js +1 -546
  4. package/package.json +15 -14
  5. package/client/editors/paper-color-picker/paper-color-circle.js +0 -466
  6. package/client/editors/paper-color-picker/paper-color-input.js +0 -266
  7. package/client/editors/paper-color-picker/paper-color-picker.js +0 -584
  8. package/client/editors/things-editor-3dish.js +0 -164
  9. package/client/editors/things-editor-angle-input.js +0 -69
  10. package/client/editors/things-editor-attachment-selector.js +0 -110
  11. package/client/editors/things-editor-buttons-radio.js +0 -93
  12. package/client/editors/things-editor-code.js +0 -152
  13. package/client/editors/things-editor-color-stops.js +0 -499
  14. package/client/editors/things-editor-color-style.js +0 -345
  15. package/client/editors/things-editor-color.js +0 -313
  16. package/client/editors/things-editor-data.js +0 -152
  17. package/client/editors/things-editor-gradient.js +0 -335
  18. package/client/editors/things-editor-graphql.js +0 -173
  19. package/client/editors/things-editor-id.js +0 -85
  20. package/client/editors/things-editor-multiple-color.js +0 -132
  21. package/client/editors/things-editor-options.js +0 -156
  22. package/client/editors/things-editor-pattern.js +0 -161
  23. package/client/editors/things-editor-property-styles.js +0 -71
  24. package/client/editors/things-editor-range-input.js +0 -166
  25. package/client/editors/things-editor-script.js +0 -213
  26. package/client/editors/things-editor-stack.js +0 -107
  27. package/client/editors/things-editor-table.js +0 -376
  28. package/client/editors/things-editor-value-map.js +0 -290
  29. package/client/editors/things-editor-value-range.js +0 -292
@@ -1,266 +0,0 @@
1
- import { html } from '@polymer/polymer/polymer-element'
2
-
3
- import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn'
4
- import '@polymer/iron-form-element-behavior/iron-form-element-behavior'
5
- import '@polymer/paper-input/paper-input-container'
6
- import './paper-color-picker'
7
- /**
8
- This component contains 3 elements:
9
-
10
- - `<paper-color-circle>` : An element drawing a color space onto a canvas
11
- - `<paper-color-picker>` : An element containing a material design picker dialog for colors
12
- - `<paper-color-input>` : An element that displays an input that allows changing of the color through a color picker dialog.
13
-
14
- Shape and colour spaces
15
- ---
16
- There are three different main configurations all 3 elements allow: `circle`, `square`
17
- or `huebox`. This is called the `[shape]` of the color circle. Additionally in the case of `circle` and `square` it can
18
- be specified whether the colours should be generated from the `hsv` or `hsl` colour space.
19
-
20
- <paper-color-input shape="square" type="hsl"></paper-color-input>
21
-
22
-
23
- @demo demo/index.html
24
- */
25
- Polymer({
26
- is: 'paper-color-input',
27
- _template: html`
28
- <style>
29
- :host {
30
- }
31
-
32
- #colorPreview {
33
- height: 16px;
34
- width: 16px;
35
- border: 1px solid rgba(0, 0, 0, 0.1);
36
- border-radius: 1px;
37
- margin: 2px;
38
- position: relative;
39
- background-image: linear-gradient(to right, #ffffff 1%, #ffffff 50%, #eee 50%, #eee 100%),
40
- linear-gradient(to right, #eee 1%, #eee 50%, #ffffff 50%, #ffffff 100%);
41
- background-size: 16px 8px, 16px 8px;
42
- background-repeat: repeat-x, repeat;
43
- }
44
-
45
- #color {
46
- position: absolute;
47
- left: 0px;
48
- top: 0px;
49
- right: 0px;
50
- bottom: 0px;
51
- }
52
-
53
- #noColor {
54
- width: 22.6px;
55
- height: 1px;
56
- border-top: 1px solid rgba(0, 0, 0, 0.1);
57
- transform-origin: 0px 0px;
58
- transform: translateY(15.5px) rotate(-45deg);
59
- }
60
-
61
- #input {
62
- cursor: pointer;
63
- }
64
-
65
- span.dark {
66
- font-size: 10px;
67
- color: rgba(0, 0, 0, 0.8);
68
- font-family: monospace;
69
- }
70
-
71
- span.light {
72
- font-size: 10px;
73
- font-family: monospace;
74
- color: rgba(0, 0, 0, 0.3);
75
- }
76
- </style>
77
- <paper-input-container id="input" always-float-label="{{_isValueDefined(value.*)}}">
78
- <label slot="label">{{label}}</label>
79
- <div class="paper-input-input" slot="input">
80
- <span>{{colorName}}</span>&nbsp;
81
- <!--
82
- -->
83
- <template is="dom-if" if="{{withDescription}}">
84
- <!--
85
- -->
86
- <span class="light"
87
- >rgb
88
- <template is="dom-if" if="{{allowAlpha}}"
89
- >a</template
90
- >(</span
91
- >
92
- <span class="dark">{{value.red}}</span> <span class="light">, </span>
93
- <span class="dark">{{value.green}}</span> <span class="light">, </span>
94
- <span class="dark">{{value.blue}}</span>
95
- <template is="dom-if" if="{{allowAlpha}}">
96
- <span class="light">, </span> <span class="dark">{{value.alpha}}</span>
97
- </template>
98
- <span class="light">)</span>
99
- </template>
100
- </div>
101
- <div id="colorPreview" slot="suffix">
102
- <div id="color" style$="{{_computeBackgroundColor(value.*)}}"></div>
103
- <div id="noColor" hidden="{{_isValueDefined(value.*)}}"></div>
104
- </div>
105
- </paper-input-container>
106
-
107
- <paper-color-picker
108
- id="picker"
109
- color="{{value}}"
110
- color-as-string="{{colorName}}"
111
- shape="{{shape}}"
112
- type="{{type}}"
113
- allow-alpha="{{allowAlpha}}"
114
- always-show-alpha="{{alwaysShowAlpha}}"
115
- ></paper-color-picker>
116
- `,
117
- properties: {
118
- /**
119
- * The currently picked color. This is an object with a `red`, `green` and `blue` property.
120
- *
121
- * @attribute label
122
- * @type String
123
- * @default ''
124
- */
125
- value: {
126
- type: Object,
127
- notify: true
128
- },
129
- valueAsHex: {
130
- type: String,
131
- notify: true,
132
- observer: '_setValueFromHex'
133
- },
134
- /**
135
- * The label for this input.
136
- *
137
- * @attribute label
138
- * @type String
139
- * @default ''
140
- */
141
- label: {
142
- type: String,
143
- value: ''
144
- },
145
- /**
146
- * The name of the colour as shown in the input field
147
- *
148
- * @attribute color-name
149
- * @type String
150
- * @default ''
151
- */
152
- colorName: String,
153
- /**
154
- * *square*, *circle* or *huebox*
155
- *
156
- * @attribute shape
157
- * @type string
158
- * @default 'circle'
159
- */
160
- shape: {
161
- type: String,
162
- value: 'circle',
163
- notify: true
164
- },
165
- /**
166
- * *hsv* or *hsl*
167
- *
168
- * @attribute type
169
- * @type string
170
- * @default 'hsv'
171
- */
172
- type: {
173
- type: String,
174
- value: 'hsv',
175
- notify: true
176
- },
177
- /**
178
- * Whether to allow changing the transparency of the picked color
179
- */
180
- allowAlpha: Boolean,
181
- /**
182
- * Whether to show the color also as a string
183
- */
184
- withDescription: Boolean,
185
- /**
186
- * Show alpha slider always instead of only in the advanced settings
187
- */
188
- alwaysShowAlpha: Boolean
189
- },
190
- behaviors: [
191
- /* Polymer.IronFormElementBehavior */
192
- // disabled till https://github.com/Polymer/polymer/issues/3167 gets fixed
193
- ],
194
- observers: ['_setValueAsHexFromValue(value.*)'],
195
- listeners: {
196
- 'input.tap': 'openColorPicker'
197
- },
198
- // Element Lifecycle
199
- ready: function() {
200
- if (this._isValueDefined()) {
201
- this.$.picker.set('immediateColor', this.value)
202
- var listenOnce
203
- this.$.picker.addEventListener(
204
- 'immediate-color-as-string-changed',
205
- (listenOnce = function() {
206
- //this.colorName = this.$.picker.immediateColorAsString;
207
- this.$.picker.setColor()
208
- this.$.picker.removeEventListener('immediate-color-as-string-changed', listenOnce)
209
- }.bind(this))
210
- )
211
- }
212
- },
213
- openColorPicker: function() {
214
- this.$.picker.open()
215
- },
216
- _computeBackgroundColor: function() {
217
- if (!this._isValueDefined()) {
218
- return 'background: white'
219
- }
220
- if (typeof this.value.alpha === 'undefined') {
221
- this.value.alpha = 1
222
- }
223
- return (
224
- 'background: rgba(' +
225
- this.value.red +
226
- ', ' +
227
- this.value.green +
228
- ',' +
229
- this.value.blue +
230
- ', ' +
231
- this.value.alpha +
232
- ')'
233
- )
234
- },
235
- _isValueDefined: function() {
236
- return this.value.red >= 0 && this.value.green >= 0 && this.value.blue >= 0
237
- },
238
- _setValueAsHexFromValue: function() {
239
- if (this._isValueDefined()) {
240
- var hex = '#'
241
- var value = this.value
242
- ;['red', 'green', 'blue'].forEach(function(c) {
243
- var h = value[c].toString(16)
244
- l = h.length
245
- hex += l < 2 ? '0' : ''
246
- hex += l < 1 ? '0' : ''
247
- hex += h
248
- })
249
- this.set('valueAsHex', hex)
250
- }
251
- },
252
- _setValueFromHex: function() {
253
- var hex = this.valueAsHex
254
- var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i
255
- var hex = hex.replace(shorthandRegex, function(m, r, g, b) {
256
- return r + r + g + g + b + b
257
- })
258
- var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)
259
- if (typeof this.value === 'undefined') {
260
- this.set('value', {})
261
- }
262
- this.set('value.red', parseInt(result[1], 16))
263
- this.set('value.green', parseInt(result[2], 16))
264
- this.set('value.blue', parseInt(result[3], 16))
265
- }
266
- })