uil 1.0.1 → 4.0.0

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 (45) hide show
  1. package/README.md +57 -0
  2. package/build/uil.js +7040 -4199
  3. package/build/uil.min.js +6 -4
  4. package/build/uil.module.js +7200 -2761
  5. package/examples/js/BufferGeometryUtils.js +921 -0
  6. package/examples/js/SimplexNoise.js +324 -0
  7. package/examples/js/controls/OrbitControls.js +1215 -0
  8. package/examples/js/controls/OrbitControls_.js +1042 -0
  9. package/examples/js/libs/sea3d.min.js +373 -0
  10. package/examples/js/libs/three.min.js +6 -0
  11. package/examples/js/math.js +447 -0
  12. package/examples/js/objects/Landscape.js +778 -0
  13. package/examples/js/objects/Lensflare.js +372 -0
  14. package/examples/js/objects/SuperSky.js +297 -0
  15. package/examples/js/objects/Water.js +329 -0
  16. package/package.json +56 -54
  17. package/src/Uil.js +2 -17
  18. package/src/Uil_dev.js +15 -0
  19. package/src/core/Gui.js +601 -299
  20. package/src/core/Proto.js +490 -220
  21. package/src/core/Roots.js +864 -0
  22. package/src/core/Tools.js +591 -140
  23. package/src/core/V2.js +131 -0
  24. package/src/core/add.js +52 -57
  25. package/src/proto/Bool.js +117 -52
  26. package/src/proto/Button.js +286 -146
  27. package/src/proto/Circular.js +162 -130
  28. package/src/proto/Color.js +331 -289
  29. package/src/proto/Empty.js +15 -0
  30. package/src/proto/Fps.js +232 -159
  31. package/src/proto/Graph.js +310 -0
  32. package/src/proto/Grid.js +297 -0
  33. package/src/proto/Group.js +334 -160
  34. package/src/proto/Item.js +120 -0
  35. package/src/proto/Joystick.js +159 -185
  36. package/src/proto/Knob.js +210 -91
  37. package/src/proto/List.js +661 -249
  38. package/src/proto/Numeric.js +329 -162
  39. package/src/proto/Pad2D.js +268 -0
  40. package/src/proto/Rubric.js +0 -0
  41. package/src/proto/Select.js +178 -0
  42. package/src/proto/Selector.js +13 -0
  43. package/src/proto/Slide.js +191 -185
  44. package/src/proto/TextInput.js +149 -59
  45. package/src/proto/Title.js +40 -31
package/src/core/Tools.js CHANGED
@@ -1,91 +1,297 @@
1
1
  /**
2
- * @author lo-th / https://github.com/lo-th
2
+ * @author lth / https://github.com/lo-th
3
3
  */
4
4
 
5
- var Tools = {
5
+ import { Roots } from './Roots.js';
6
6
 
7
- main: null,
7
+ const T = {
8
+
9
+ transition: 0.2,
8
10
 
9
- doc: document,
10
11
  frag: document.createDocumentFragment(),
11
12
 
12
- isLoop: false,
13
- listens: [],
13
+ colorRing: null,
14
+ joystick_0: null,
15
+ joystick_1: null,
16
+ circular: null,
17
+ knob: null,
18
+ pad2d: null,
14
19
 
15
20
  svgns: "http://www.w3.org/2000/svg",
21
+ links: "http://www.w3.org/1999/xlink",
16
22
  htmls: "http://www.w3.org/1999/xhtml",
17
23
 
18
24
  DOM_SIZE: [ 'height', 'width', 'top', 'left', 'bottom', 'right', 'margin-left', 'margin-right', 'margin-top', 'margin-bottom'],
19
- SVG_TYPE_D: [ 'pattern', 'defs', 'transform', 'stop', 'animate', 'radialGradient', 'linearGradient', 'animateMotion' ],
20
- SVG_TYPE_G: [ 'rect', 'circle', 'path', 'polygon', 'text', 'g', 'line', 'foreignObject' ],
25
+ SVG_TYPE_D: [ 'pattern', 'defs', 'transform', 'stop', 'animate', 'radialGradient', 'linearGradient', 'animateMotion', 'use', 'filter', 'feColorMatrix' ],
26
+ SVG_TYPE_G: [ 'svg', 'rect', 'circle', 'path', 'polygon', 'text', 'g', 'line', 'foreignObject' ],
21
27
 
22
- size: {
23
-
24
- w: 240,
25
- h: 20,
26
- p: 30,
27
- s: 20,
28
+ PI: Math.PI,
29
+ TwoPI: Math.PI*2,
30
+ pi90: Math.PI * 0.5,
31
+ pi60: Math.PI/3,
32
+
33
+ torad: Math.PI / 180,
34
+ todeg: 180 / Math.PI,
35
+
36
+ clamp: function (v, min, max) {
37
+
38
+ v = v < min ? min : v;
39
+ v = v > max ? max : v;
40
+ return v;
28
41
 
29
42
  },
30
43
 
31
- // colors
44
+ size: { w: 240, h: 20, p: 30, s: 8 },
45
+
46
+ // ----------------------
47
+ // COLOR
48
+ // ----------------------
49
+
50
+ defineColor: function( o, cc = T.colors ) {
51
+
52
+ let color = { ...cc }
53
+
54
+ let textChange = ['fontFamily', 'fontWeight', 'fontShadow', 'fontSize' ]
55
+ let changeText = false
56
+
57
+ if( o.font ) o.fontFamily = o.font
58
+ if( o.shadow ) o.fontShadow = o.shadow
59
+ if( o.weight ) o.fontWeight = o.weight
60
+
61
+ if( o.fontColor ) o.text = o.fontColor
62
+ if( o.color ) o.text = o.color
63
+
64
+ if( o.text ){
65
+ color.text = o.text
66
+ if( !o.fontColor && !o.color ){
67
+ color.title = T.ColorLuma( o.text, -0.25 )
68
+ color.titleoff = T.ColorLuma( o.text, -0.5 )
69
+ }
70
+ color.textOver = T.ColorLuma( o.text, 0.25 )
71
+ color.textSelect = T.ColorLuma( o.text, 0.5 )
72
+ }
73
+
74
+ if( o.button ){
75
+ color.button = o.button
76
+ color.border = T.ColorLuma( o.button, 0.1 )
77
+ color.overoff = T.ColorLuma( o.button, 0.2 )
78
+ }
79
+
80
+ if( o.select ){
81
+ color.select = o.select
82
+ color.over = T.ColorLuma( o.select, -0.1 )
83
+ }
84
+
85
+ if( o.itemBg ) o.back = o.itemBg
86
+
87
+ if( o.back ){
88
+ color.back = o.back
89
+ color.backoff = T.ColorLuma( o.back, -0.1 )
90
+ }
91
+
92
+ if( o.fontSelect ) color.textSelect = o.fontSelect
93
+ if( o.groupBorder ) color.gborder = o.groupBorder
94
+
95
+ if( o.transparent ) o.bg = 'none'
96
+ if( o.bg ) color.background = color.backgroundOver = o.bg
97
+ if( o.bgOver ) color.backgroundOver = o.bgOver
98
+
99
+ for( let m in color ){
100
+ if(o[m]) color[m] = o[m]
101
+ }
102
+
103
+ for( let m in o ){
104
+ if( textChange.indexOf(m) !== -1 ) changeText = true
105
+ }
106
+
107
+ if( changeText ) T.defineText( color )
108
+
109
+ return color
110
+
111
+ },
32
112
 
33
113
  colors: {
34
114
 
35
- text : '#C0C0C0',
36
- background: 'rgba(44,44,44,0.3)',
115
+ content:'none',
116
+ background: 'rgba(50,50,50,0.3)',
117
+ backgroundOver: 'rgba(50,50,50,0.4)',
118
+
119
+ title : '#CCC',
120
+ titleoff : '#BBB',
121
+ text : '#DDD',
122
+ textOver : '#EEE',
123
+ textSelect : '#FFF',
124
+
125
+ //inputBg: 'rgba(0,0,0,0.25)',
126
+ //itemBg:'rgba(0,0,0,0.25)',
37
127
 
38
- border : '#4f4f4f',
39
- borderSelect : '#308AFF',
128
+ back:'rgba(0,0,0,0.2)',
129
+ backoff:'rgba(0,0,0,0.3)',
130
+ //inputOver: 'rgba(0,0,0,0.2)',
40
131
 
41
- button : '#404040',
42
- boolbg : '#181818',
132
+ // input and button border
133
+ border : '#4c4c4c',
134
+ borderSize : 1,
135
+ gborder : 'none',
43
136
 
137
+ button : '#3c3c3c',
138
+ overoff : '#5c5c5c',
139
+ over : '#024699',
44
140
  select : '#308AFF',
45
- moving : '#03afff',
46
- down : '#024699',
141
+ action: '#FF3300',
142
+
143
+
144
+ //fontFamily: 'Tahoma',
145
+ fontFamily: 'Consolas,monaco,monospace',
146
+ fontWeight: 'normal',
147
+ fontShadow: '#000',
148
+ fontSize:12,
149
+
47
150
 
48
- stroke: '#606060',//'rgba(120,120,120,0.6)',
49
- scroll: '#333333',
151
+ radius:4,
152
+ hide: 'rgba(0,0,0,0)',
50
153
 
51
154
  },
52
155
 
53
156
  // style css
54
157
 
55
158
  css : {
56
- basic: '-o-user-select:none; -ms-user-select:none; -khtml-user-select:none; -webkit-user-select:none; -moz-user-select:none;' + 'position:absolute; pointer-events:none; box-sizing:border-box; margin:0; padding:0; border:none; overflow:hidden; background:none;',
159
+
160
+ //unselect: '-o-user-select:none; -ms-user-select:none; -khtml-user-select:none; -webkit-user-select:none; -moz-user-select:none;',
161
+ basic: 'position:absolute; pointer-events:none; box-sizing:border-box; margin:0; padding:0; overflow:hidden; ' + '-o-user-select:none; -ms-user-select:none; -khtml-user-select:none; -webkit-user-select:none; -moz-user-select:none;',
162
+ button:'display:flex; justify-content:center; align-items:center; text-align:center;',
163
+
164
+ /*txt: T.css.basic + 'font-family:'+ T.colors.fontFamily +'; font-size:'+T.colors.fontSize+'px; color:'+T.colors.text+'; padding:2px 10px; left:0; top:2px; height:16px; width:100px; overflow:hidden; white-space: nowrap;',
165
+ txtselect: T.css.txt + 'display:flex; justify-content:left; align-items:center; text-align:left;' +'padding:2px 5px; border:1px dashed ' + T.colors.border + '; background:'+ T.colors.txtselectbg+';',
166
+ item: T.css.txt + 'position:relative; background:rgba(0,0,0,0.2); margin-bottom:1px;',*/
57
167
  },
58
168
 
59
169
  // svg path
60
170
 
61
- GPATH: 'M 7 7 L 7 8 8 8 8 7 7 7 M 5 7 L 5 8 6 8 6 7 5 7 M 3 7 L 3 8 4 8 4 7 3 7 M 7 5 L 7 6 8 6 8 5 7 5 M 6 6 L 6 5 5 5 5 6 6 6 M 7 3 L 7 4 8 4 8 3 7 3 M 6 4 L 6 3 5 3 5 4 6 4 M 3 5 L 3 6 4 6 4 5 3 5 M 3 3 L 3 4 4 4 4 3 3 3 Z',
171
+ svgs: {
172
+
173
+ group:'M 7 7 L 7 8 8 8 8 7 7 7 M 5 7 L 5 8 6 8 6 7 5 7 M 3 7 L 3 8 4 8 4 7 3 7 M 7 5 L 7 6 8 6 8 5 7 5 M 6 6 L 6 5 5 5 5 6 6 6 M 7 3 L 7 4 8 4 8 3 7 3 M 6 4 L 6 3 5 3 5 4 6 4 M 3 5 L 3 6 4 6 4 5 3 5 M 3 3 L 3 4 4 4 4 3 3 3 Z',
174
+ arrow:'M 3 8 L 8 5 3 2 3 8 Z',
175
+ arrowDown:'M 5 8 L 8 3 2 3 5 8 Z',
176
+ arrowUp:'M 5 2 L 2 7 8 7 5 2 Z',
177
+
178
+ solid:'M 13 10 L 13 1 4 1 1 4 1 13 10 13 13 10 M 11 3 L 11 9 9 11 3 11 3 5 5 3 11 3 Z',
179
+ body:'M 13 10 L 13 1 4 1 1 4 1 13 10 13 13 10 M 11 3 L 11 9 9 11 3 11 3 5 5 3 11 3 M 5 4 L 4 5 4 10 9 10 10 9 10 4 5 4 Z',
180
+ vehicle:'M 13 6 L 11 1 3 1 1 6 1 13 3 13 3 11 11 11 11 13 13 13 13 6 M 2.4 6 L 4 2 10 2 11.6 6 2.4 6 M 12 8 L 12 10 10 10 10 8 12 8 M 4 8 L 4 10 2 10 2 8 4 8 Z',
181
+ articulation:'M 13 9 L 12 9 9 2 9 1 5 1 5 2 2 9 1 9 1 13 5 13 5 9 4 9 6 5 8 5 10 9 9 9 9 13 13 13 13 9 Z',
182
+ character:'M 13 4 L 12 3 9 4 5 4 2 3 1 4 5 6 5 8 4 13 6 13 7 9 8 13 10 13 9 8 9 6 13 4 M 6 1 L 6 3 8 3 8 1 6 1 Z',
183
+ terrain:'M 13 8 L 12 7 Q 9.06 -3.67 5.95 4.85 4.04 3.27 2 7 L 1 8 7 13 13 8 M 3 8 Q 3.78 5.420 5.4 6.6 5.20 7.25 5 8 L 7 8 Q 8.39 -0.16 11 8 L 7 11 3 8 Z',
184
+ joint:'M 7.7 7.7 Q 8 7.45 8 7 8 6.6 7.7 6.3 7.45 6 7 6 6.6 6 6.3 6.3 6 6.6 6 7 6 7.45 6.3 7.7 6.6 8 7 8 7.45 8 7.7 7.7 M 3.35 8.65 L 1 11 3 13 5.35 10.65 Q 6.1 11 7 11 8.28 11 9.25 10.25 L 7.8 8.8 Q 7.45 9 7 9 6.15 9 5.55 8.4 5 7.85 5 7 5 6.54 5.15 6.15 L 3.7 4.7 Q 3 5.712 3 7 3 7.9 3.35 8.65 M 10.25 9.25 Q 11 8.28 11 7 11 6.1 10.65 5.35 L 13 3 11 1 8.65 3.35 Q 7.9 3 7 3 5.7 3 4.7 3.7 L 6.15 5.15 Q 6.54 5 7 5 7.85 5 8.4 5.55 9 6.15 9 7 9 7.45 8.8 7.8 L 10.25 9.25 Z',
185
+ ray:'M 9 11 L 5 11 5 12 9 12 9 11 M 12 5 L 11 5 11 9 12 9 12 5 M 11.5 10 Q 10.9 10 10.45 10.45 10 10.9 10 11.5 10 12.2 10.45 12.55 10.9 13 11.5 13 12.2 13 12.55 12.55 13 12.2 13 11.5 13 10.9 12.55 10.45 12.2 10 11.5 10 M 9 10 L 10 9 2 1 1 2 9 10 Z',
186
+ collision:'M 11 12 L 13 10 10 7 13 4 11 2 7.5 5.5 9 7 7.5 8.5 11 12 M 3 2 L 1 4 4 7 1 10 3 12 8 7 3 2 Z',
187
+ map:'M 13 1 L 1 1 1 13 13 13 13 1 M 12 2 L 12 7 7 7 7 12 2 12 2 7 7 7 7 2 12 2 Z',
188
+ material:'M 13 1 L 1 1 1 13 13 13 13 1 M 12 2 L 12 7 7 7 7 12 2 12 2 7 7 7 7 2 12 2 Z',
189
+ texture:'M 13 4 L 13 1 1 1 1 4 5 4 5 13 9 13 9 4 13 4 Z',
190
+ object:'M 10 1 L 7 4 4 1 1 1 1 13 4 13 4 5 7 8 10 5 10 13 13 13 13 1 10 1 Z',
191
+ none:'M 9 5 L 5 5 5 9 9 9 9 5 Z',
192
+ cursor:'M 4 7 L 1 10 1 12 2 13 4 13 7 10 9 14 14 0 0 5 4 7 Z',
193
+
194
+ },
195
+
196
+
197
+ getImput: function(){
198
+
199
+ return Roots.input ? true : false
200
+
201
+ },
202
+
203
+ setStyle : function ( data ){
204
+
205
+ for ( var o in data ){
206
+ if( T.colors[o] ) T.colors[o] = data[o];
207
+ }
208
+
209
+ T.setText();
210
+
211
+ },
62
212
 
63
- setText : function( size, color, font ){
213
+ // ----------------------
214
+ // custom text
215
+ // ----------------------
64
216
 
65
- size = size || 11;
66
- color = color || '#CCC';
67
- font = font || '"Consolas", "Lucida Console", Monaco, monospace';
217
+ defineText: function( o ){
68
218
 
69
- Tools.css.txt = Tools.css.basic + 'font-family:'+font+'; font-size:'+size+'px; color:'+color+'; padding:2px 10px; left:0; top:2px; height:16px; width:100px; overflow:hidden; white-space: nowrap;';
70
- Tools.css.txtedit = Tools.css.txt + 'pointer-events:auto; padding:2px 5px; outline:none; -webkit-appearance:none; -moz-appearance:none; border:1px dashed #4f4f4f; -ms-user-select:element;'
71
- Tools.css.txtselect = Tools.css.txt + 'pointer-events:auto; padding:2px 5px; outline:none; -webkit-appearance:none; -moz-appearance:none; border:1px dashed ' + Tools.colors.border+'; -ms-user-select:element;';
72
- Tools.css.txtnumber = Tools.css.txt + 'letter-spacing:-1px; padding:2px 5px;';
73
- Tools.css.item = Tools.css.txt + 'position:relative; background:rgba(0,0,0,0.2); margin-bottom:1px; pointer-events:auto; cursor:pointer;';
219
+ T.setText( o.fontSize, o.text, o.fontFamily, o.fontShadow, o.fontWeight )
74
220
 
75
221
  },
76
222
 
77
- setSvg: function( dom, type, value, id ){
223
+ setText: function( size, color, font, shadow, weight ){
224
+
225
+ let cc = T.colors;
226
+
227
+ if( font === undefined ) font = cc.fontFamily
228
+ if( size === undefined ) size = cc.fontSize
229
+ if( shadow === undefined ) shadow = cc.fontShadow
230
+ if( weight === undefined ) weight = cc.fontWeight
231
+ if( color === undefined ) color = cc.text
232
+
233
+
234
+ let align = 'display:flex; justify-content:left; align-items:center; text-align:left;'
235
+
236
+ T.css.txt = T.css.basic + align + 'font-family:'+ font +'; font-weight:'+weight+'; font-size:'+size+'px; color:'+cc.text+'; padding:0px 10px; left:0; top:2px; height:16px; width:100px; overflow:hidden; white-space: nowrap;';
237
+ if( shadow !== 'none' ) T.css.txt += ' text-shadow: 1px 1px 1px '+shadow+';';
238
+
239
+ T.css.txtselect = T.css.txt + 'padding:0px 4px; border:1px dashed ' + cc.border + ';';
240
+ //T.css.item = T.css.txt + ' position:relative; margin-bottom:1px; '//display:block; padding:4px 4px;';//
241
+ T.css.item = T.css.txt + ' position:relative; margin-bottom:1px; display:block; padding:2px 4px;';//
242
+
243
+ },
244
+
245
+
246
+ // note
247
+
248
+ //https://developer.mozilla.org/fr/docs/Web/CSS/css_flexible_box_layout/aligning_items_in_a_flex_container
249
+
250
+ /*cloneColor: function () {
251
+
252
+ let cc = Object.assign({}, T.colors );
253
+ return cc;
254
+
255
+ },*/
256
+
257
+ // intern function
258
+
259
+ cloneCss: function () {
260
+
261
+ //let cc = Object.assign({}, T.css );
262
+ return { ...T.css };
263
+
264
+ },
265
+
266
+ clone: function ( o ) {
267
+
268
+ return o.cloneNode( true );
269
+
270
+ },
271
+
272
+ setSvg: function( dom, type, value, id, id2 ){
78
273
 
79
274
  if( id === -1 ) dom.setAttributeNS( null, type, value );
275
+ else if( id2 !== undefined ) dom.childNodes[ id || 0 ].childNodes[ id2 || 0 ].setAttributeNS( null, type, value );
80
276
  else dom.childNodes[ id || 0 ].setAttributeNS( null, type, value );
81
277
 
82
278
  },
83
279
 
280
+ setCss: function( dom, css ){
281
+
282
+ for( let r in css ){
283
+ if( T.DOM_SIZE.indexOf(r) !== -1 ) dom.style[r] = css[r] + 'px';
284
+ else dom.style[r] = css[r];
285
+ }
286
+
287
+ },
288
+
84
289
  set: function( g, o ){
85
290
 
86
- for( var att in o ){
291
+ for( let att in o ){
87
292
  if( att === 'txt' ) g.textContent = o[ att ];
88
- g.setAttributeNS( null, att, o[ att ] );
293
+ if( att === 'link' ) g.setAttributeNS( T.links, 'xlink:href', o[ att ] );
294
+ else g.setAttributeNS( null, att, o[ att ] );
89
295
  }
90
296
 
91
297
  },
@@ -101,28 +307,33 @@ var Tools = {
101
307
 
102
308
  },
103
309
 
104
- /*setDom : function( dom, type, value ){
310
+ dom : function ( type, css, obj, dom, id ) {
105
311
 
106
- var ext = Tools.DOM_SIZE.indexOf(type) !== -1 ? 'px' : '';
107
- dom.style[type] = value + ext;
312
+ type = type || 'div';
108
313
 
109
- },*/
314
+ if( T.SVG_TYPE_D.indexOf(type) !== -1 || T.SVG_TYPE_G.indexOf(type) !== -1 ){ // is svg element
110
315
 
111
- dom : function ( type, css, obj, dom, id ) {
316
+ if( type ==='svg' ){
112
317
 
113
- type = type || 'div';
318
+ dom = document.createElementNS( T.svgns, 'svg' );
319
+ T.set( dom, obj );
114
320
 
115
- if( Tools.SVG_TYPE_D.indexOf(type) !== -1 || Tools.SVG_TYPE_G.indexOf(type) !== -1 ){ // is svg element
321
+ /* } else if ( type === 'use' ) {
116
322
 
117
- // create new svg if not def
118
- if( dom === undefined ) dom = Tools.doc.createElementNS( Tools.svgns, 'svg' );
323
+ dom = document.createElementNS( T.svgns, 'use' );
324
+ T.set( dom, obj );
325
+ */
326
+ } else {
327
+ // create new svg if not def
328
+ if( dom === undefined ) dom = document.createElementNS( T.svgns, 'svg' );
329
+ T.addAttributes( dom, type, obj, id );
119
330
 
120
- Tools.addAttributes( dom, type, obj, id );
331
+ }
121
332
 
122
333
  } else { // is html element
123
334
 
124
- if( dom === undefined ) dom = Tools.doc.createElementNS( Tools.htmls, type );
125
- else dom = dom.appendChild( Tools.doc.createElementNS( Tools.htmls, type ) );
335
+ if( dom === undefined ) dom = document.createElementNS( T.htmls, type );
336
+ else dom = dom.appendChild( document.createElementNS( T.htmls, type ) );
126
337
 
127
338
  }
128
339
 
@@ -135,19 +346,19 @@ var Tools = {
135
346
 
136
347
  addAttributes : function( dom, type, o, id ){
137
348
 
138
- var g = Tools.doc.createElementNS( Tools.svgns, type );
139
- Tools.set( g, o );
140
- Tools.get( dom, id ).appendChild( g );
141
- if( Tools.SVG_TYPE_G.indexOf(type) !== -1 ) g.style.pointerEvents = 'none';
349
+ let g = document.createElementNS( T.svgns, type );
350
+ T.set( g, o );
351
+ T.get( dom, id ).appendChild( g );
352
+ if( T.SVG_TYPE_G.indexOf(type) !== -1 ) g.style.pointerEvents = 'none';
142
353
  return g;
143
354
 
144
355
  },
145
356
 
146
357
  clear : function( dom ){
147
358
 
148
- Tools.purge( dom );
359
+ T.purge( dom );
149
360
  while (dom.firstChild) {
150
- if ( dom.firstChild.firstChild ) Tools.clear( dom.firstChild );
361
+ if ( dom.firstChild.firstChild ) T.clear( dom.firstChild );
151
362
  dom.removeChild( dom.firstChild );
152
363
  }
153
364
 
@@ -155,7 +366,7 @@ var Tools = {
155
366
 
156
367
  purge : function ( dom ) {
157
368
 
158
- var a = dom.attributes, i, n;
369
+ let a = dom.attributes, i, n;
159
370
  if (a) {
160
371
  i = a.length;
161
372
  while(i--){
@@ -167,72 +378,71 @@ var Tools = {
167
378
  if (a) {
168
379
  i = a.length;
169
380
  while(i--){
170
- Tools.purge( dom.childNodes[i] );
381
+ T.purge( dom.childNodes[i] );
171
382
  }
172
383
  }
173
384
 
174
385
  },
175
386
 
387
+ // ----------------------
388
+ // SVG Effects function
389
+ // ----------------------
176
390
 
391
+ addSVGGlowEffect: function () {
177
392
 
178
- // LOOP
179
-
180
- loop : function(){
181
-
182
- if( Tools.isLoop ) requestAnimationFrame( Tools.loop );
183
- Tools.update();
184
-
185
- },
186
-
187
- update : function(){
188
-
189
- var i = Tools.listens.length;
190
- while(i--) Tools.listens[i].listening();
393
+ if ( document.getElementById( 'UILGlow') !== null ) return;
191
394
 
192
- },
395
+ let svgFilter = T.initUILEffects();
193
396
 
194
- removeListen : function ( proto ){
397
+ let filter = T.addAttributes( svgFilter, 'filter', { id: 'UILGlow', x: '-20%', y: '-20%', width: '140%', height: '140%' } );
398
+ T.addAttributes( filter, 'feGaussianBlur', { in: 'SourceGraphic', stdDeviation: '3', result: 'uilBlur' } );
399
+ let feMerge = T.addAttributes( filter, 'feMerge', { } );
400
+
401
+ for( let i = 0; i <= 3; i++ ) {
195
402
 
196
- var id = Tools.listens.indexOf( proto );
197
- Tools.listens.splice(id, 1);
403
+ T.addAttributes( feMerge, 'feMergeNode', { in: 'uilBlur' } );
404
+
405
+ }
198
406
 
199
- if( Tools.listens.length === 0 ) Tools.isLoop = false;
407
+ T.addAttributes( feMerge, 'feMergeNode', { in: 'SourceGraphic' } );
200
408
 
201
409
  },
202
410
 
203
- addListen : function ( proto ){
411
+ initUILEffects: function () {
204
412
 
205
- var id = Tools.listens.indexOf( proto );
206
-
207
- if( id !== -1 ) return;
208
-
209
- Tools.listens.push( proto );
210
-
211
- if( !Tools.isLoop ){
212
- Tools.isLoop = true;
213
- Tools.loop();
413
+ let svgFilter = document.getElementById( 'UILSVGEffects');
414
+
415
+ if ( svgFilter === null ) {
416
+
417
+ svgFilter = T.dom( 'svg', undefined , { id: 'UILSVGEffects', width: '0', height: '0' } );
418
+ document.body.appendChild( svgFilter );
419
+
214
420
  }
215
421
 
422
+ return svgFilter;
423
+
216
424
  },
217
425
 
218
426
  // ----------------------
219
427
  // Color function
220
428
  // ----------------------
221
429
 
222
- ColorLuma : function ( hex, lum ) {
430
+ ColorLuma : function ( hex, l ) {
431
+
432
+ if( hex === 'n' ) hex = '#000';
223
433
 
224
434
  // validate hex string
225
435
  hex = String(hex).replace(/[^0-9a-f]/gi, '');
226
436
  if (hex.length < 6) {
227
437
  hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];
228
438
  }
229
- lum = lum || 0;
439
+ l = l || 0;
230
440
 
231
441
  // convert to decimal and change luminosity
232
- var rgb = "#", c, i;
442
+ let rgb = "#", c, i;
233
443
  for (i = 0; i < 3; i++) {
234
444
  c = parseInt(hex.substr(i*2,2), 16);
235
- c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16);
445
+ c = Math.round(Math.min(Math.max(0, c + (c * l)), 255)).toString(16);
236
446
  rgb += ("00"+c).substr(c.length);
237
447
  }
238
448
 
@@ -240,53 +450,82 @@ var Tools = {
240
450
 
241
451
  },
242
452
 
243
- findDeepInver: function( rgb ){
453
+ findDeepInver: function ( c ) {
244
454
 
245
- return (rgb[0] * 0.3 + rgb[1] * .59 + rgb[2] * .11) <= 0.6;
455
+ return (c[0] * 0.3 + c[1] * .59 + c[2] * .11) <= 0.6;
246
456
 
247
457
  },
248
458
 
459
+ lerpColor: function( c1, c2, factor ) {
460
+ let newColor = {};
461
+ for ( let i = 0; i < 3; i++ ) {
462
+ newColor[i] = c1[ i ] + ( c2[ i ] - c1[ i ] ) * factor;
463
+ }
464
+ return newColor;
465
+ },
249
466
 
250
- hexToHtml: function(v){
467
+ hexToHtml: function ( v ) {
251
468
  v = v === undefined ? 0x000000 : v;
252
469
  return "#" + ("000000" + v.toString(16)).substr(-6);
253
470
 
254
471
  },
255
472
 
256
- htmlToHex: function(v){
473
+ htmlToHex: function ( v ) {
257
474
 
258
475
  return v.toUpperCase().replace("#", "0x");
259
476
 
260
477
  },
261
478
 
262
- u255: function(color, i){
479
+ u255: function (c, i) {
263
480
 
264
- return parseInt(color.substring(i, i + 2), 16) / 255;
481
+ return parseInt(c.substring(i, i + 2), 16) / 255;
265
482
 
266
483
  },
267
484
 
268
- u16: function( color, i ){
485
+ u16: function ( c, i ) {
269
486
 
270
- return parseInt(color.substring(i, i + 1), 16) / 15;
487
+ return parseInt(c.substring(i, i + 1), 16) / 15;
271
488
 
272
489
  },
273
490
 
274
- unpack: function( color ){
491
+ unpack: function( c ){
275
492
 
276
- if (color.length == 7) return [ Tools.u255(color, 1), Tools.u255(color, 3), Tools.u255(color, 5) ];
277
- else if (color.length == 4) return [ Tools.u16(color,1), Tools.u16(color,2), Tools.u16(color,3) ];
493
+ if (c.length == 7) return [ T.u255(c, 1), T.u255(c, 3), T.u255(c, 5) ];
494
+ else if (c.length == 4) return [ T.u16(c,1), T.u16(c,2), T.u16(c,3) ];
495
+
496
+ },
278
497
 
498
+ p255: function ( c ) {
499
+ let h = Math.round( ( c * 255 ) ).toString( 16 );
500
+ if ( h.length < 2 ) h = '0' + h;
501
+ return h;
279
502
  },
280
503
 
281
- htmlRgb: function( rgb ){
504
+ pack: function ( c ) {
282
505
 
283
- return 'rgb(' + Math.round(rgb[0] * 255) + ','+ Math.round(rgb[1] * 255) + ','+ Math.round(rgb[2] * 255) + ')';
506
+ return '#' + T.p255( c[ 0 ] ) + T.p255( c[ 1 ] ) + T.p255( c[ 2 ] );
284
507
 
285
508
  },
286
509
 
287
- rgbToHex : function( rgb ){
510
+ htmlRgb: function( c ){
288
511
 
289
- return '#' + ( '000000' + ( ( rgb[0] * 255 ) << 16 ^ ( rgb[1] * 255 ) << 8 ^ ( rgb[2] * 255 ) << 0 ).toString( 16 ) ).slice( - 6 );
512
+ return 'rgb(' + Math.round(c[0] * 255) + ','+ Math.round(c[1] * 255) + ','+ Math.round(c[2] * 255) + ')';
513
+
514
+ },
515
+
516
+ pad: function( n ){
517
+ if(n.length == 1)n = '0' + n;
518
+ return n;
519
+ },
520
+
521
+ rgbToHex : function( c ){
522
+
523
+ let r = Math.round(c[0] * 255).toString(16);
524
+ let g = Math.round(c[1] * 255).toString(16);
525
+ let b = Math.round(c[2] * 255).toString(16);
526
+ return '#' + T.pad(r) + T.pad(g) + T.pad(b);
527
+
528
+ // return '#' + ( '000000' + ( ( c[0] * 255 ) << 16 ^ ( c[1] * 255 ) << 8 ^ ( c[2] * 255 ) << 0 ).toString( 16 ) ).slice( - 6 );
290
529
 
291
530
  },
292
531
 
@@ -301,9 +540,9 @@ var Tools = {
301
540
 
302
541
  },
303
542
 
304
- rgbToHsl: function(rgb){
543
+ rgbToHsl: function ( c ) {
305
544
 
306
- var r = rgb[0], g = rgb[1], b = rgb[2], min = Math.min(r, g, b), max = Math.max(r, g, b), delta = max - min, h = 0, s = 0, l = (min + max) / 2;
545
+ let r = c[0], g = c[1], b = c[2], min = Math.min(r, g, b), max = Math.max(r, g, b), delta = max - min, h = 0, s = 0, l = (min + max) / 2;
307
546
  if (l > 0 && l < 1) s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l));
308
547
  if (delta > 0) {
309
548
  if (max == r && max != g) h += (g - b) / delta;
@@ -315,65 +554,277 @@ var Tools = {
315
554
 
316
555
  },
317
556
 
318
- hslToRgb: function( hsl ){
557
+ hslToRgb: function ( c ) {
319
558
 
320
- var p, q, h = hsl[0], s = hsl[1], l = hsl[2];
559
+ let p, q, h = c[0], s = c[1], l = c[2];
321
560
 
322
561
  if ( s === 0 ) return [ l, l, l ];
323
562
  else {
324
563
  q = l <= 0.5 ? l * (s + 1) : l + s - ( l * s );
325
564
  p = l * 2 - q;
326
- return [ Tools.hueToRgb(p, q, h + 0.33333), Tools.hueToRgb(p, q, h), Tools.hueToRgb(p, q, h - 0.33333) ];
565
+ return [ T.hueToRgb(p, q, h + 0.33333), T.hueToRgb(p, q, h), T.hueToRgb(p, q, h - 0.33333) ];
327
566
  }
328
567
 
329
568
  },
330
569
 
331
- // svg to canvas test
570
+ // ----------------------
571
+ // SVG MODEL
572
+ // ----------------------
332
573
 
333
- toCanvas: function( canvas, content, w, h ){
574
+ makeGradiant: function ( type, settings, parent, colors ) {
334
575
 
335
- var ctx = canvas.getContext("2d");
576
+ T.dom( type, null, settings, parent, 0 );
336
577
 
337
- var dcopy = null;
578
+ let n = parent.childNodes[0].childNodes.length - 1, c;
338
579
 
339
- if( typeof content === 'string' ){
580
+ for( let i = 0; i < colors.length; i++ ){
340
581
 
341
- dcopy = Tools.dom( 'iframe', 'position:abolute; left:0; top:0; width:'+w+'px; height:'+h+'px;' );
342
- dcopy.src = content;
582
+ c = colors[i];
583
+ //T.dom( 'stop', null, { offset:c[0]+'%', style:'stop-color:'+c[1]+'; stop-opacity:'+c[2]+';' }, parent, [0,n] );
584
+ T.dom( 'stop', null, { offset:c[0]+'%', 'stop-color':c[1], 'stop-opacity':c[2] }, parent, [0,n] );
343
585
 
344
- }else{
345
- dcopy = content.cloneNode(true);
346
- dcopy.style.left = 0;
347
586
  }
348
587
 
349
- var svg = Tools.dom( 'foreignObject', 'position:abolute; left:0; top:0;', { width:w, height:h });
588
+ },
589
+
590
+ /*makeGraph: function () {
591
+
592
+ let w = 128;
593
+ let radius = 34;
594
+ let svg = T.dom( 'svg', T.css.basic , { viewBox:'0 0 '+w+' '+w, width:w, height:w, preserveAspectRatio:'none' } );
595
+ T.dom( 'path', '', { d:'', stroke:T.colors.text, 'stroke-width':4, fill:'none', 'stroke-linecap':'butt' }, svg );//0
596
+ //T.dom( 'rect', '', { x:10, y:10, width:108, height:108, stroke:'rgba(0,0,0,0.3)', 'stroke-width':2 , fill:'none'}, svg );//1
597
+ //T.dom( 'circle', '', { cx:64, cy:64, r:radius, fill:T.colors.button, stroke:'rgba(0,0,0,0.3)', 'stroke-width':8 }, svg );//0
598
+
599
+ //T.dom( 'circle', '', { cx:64, cy:64, r:radius+7, stroke:'rgba(0,0,0,0.3)', 'stroke-width':7 , fill:'none'}, svg );//2
600
+ //T.dom( 'path', '', { d:'', stroke:'rgba(255,255,255,0.3)', 'stroke-width':2, fill:'none', 'stroke-linecap':'round', 'stroke-opacity':0.5 }, svg );//3
601
+ T.graph = svg;
602
+
603
+ },*/
604
+
605
+ makePad: function ( model ) {
606
+
607
+ let ww = 256
608
+ let svg = T.dom( 'svg', T.css.basic + 'position:relative;', { viewBox:'0 0 '+ww+' '+ww, width:ww, height:ww, preserveAspectRatio:'none' } );
609
+ let w = 200;
610
+ let d = (ww-w)*0.5, m = 20;
611
+ Tools.dom( 'rect', '', { x: d, y: d, width: w, height: w, fill:T.colors.back }, svg ); // 0
612
+ Tools.dom( 'rect', '', { x: d+m*0.5, y: d+m*0.5, width: w - m , height: w - m, fill:T.colors.button }, svg ); // 1
613
+ // Pointer
614
+ Tools.dom( 'line', '', { x1: d+(m*0.5), y1: ww *0.5, x2: d+(w-m*0.5), y2: ww * 0.5, stroke:T.colors.back, 'stroke-width': 2 }, svg ); // 2
615
+ Tools.dom( 'line', '', { x1: ww * 0.5, x2: ww * 0.5, y1: d+(m*0.5), y2: d+(w-m*0.5), stroke:T.colors.back, 'stroke-width': 2 }, svg ); // 3
616
+ Tools.dom( 'circle', '', { cx: ww * 0.5, cy: ww * 0.5, r:5, stroke: T.colors.text, 'stroke-width': 5, fill:'none' }, svg ); // 4
617
+ T.pad2d = svg;
618
+
619
+ },
620
+
621
+ makeKnob: function ( model ) {
622
+
623
+ let w = 128;
624
+ let radius = 34;
625
+ let svg = T.dom( 'svg', T.css.basic + 'position:relative;', { viewBox:'0 0 '+w+' '+w, width:w, height:w, preserveAspectRatio:'none' } );
626
+ T.dom( 'circle', '', { cx:64, cy:64, r:radius, fill:T.colors.button, stroke:'rgba(0,0,0,0.3)', 'stroke-width':8 }, svg );//0
627
+ T.dom( 'path', '', { d:'', stroke:T.colors.text, 'stroke-width':4, fill:'none', 'stroke-linecap':'round' }, svg );//1
628
+ T.dom( 'circle', '', { cx:64, cy:64, r:radius+7, stroke:'rgba(0,0,0,0.1)', 'stroke-width':7 , fill:'none'}, svg );//2
629
+ T.dom( 'path', '', { d:'', stroke:'rgba(255,255,255,0.3)', 'stroke-width':2, fill:'none', 'stroke-linecap':'round', 'stroke-opacity':0.5 }, svg );//3
630
+ T.knob = svg;
631
+
632
+ },
633
+
634
+ makeCircular: function ( model ) {
635
+
636
+ let w = 128;
637
+ let radius = 40;
638
+ let svg = T.dom( 'svg', T.css.basic + 'position:relative;', { viewBox:'0 0 '+w+' '+w, width:w, height:w, preserveAspectRatio:'none' } );
639
+ T.dom( 'circle', '', { cx:64, cy:64, r:radius, stroke:'rgba(0,0,0,0.1)', 'stroke-width':10, fill:'none' }, svg );//0
640
+ T.dom( 'path', '', { d:'', stroke:T.colors.text, 'stroke-width':7, fill:'none', 'stroke-linecap':'butt' }, svg );//1
641
+ T.circular = svg;
642
+
643
+ },
644
+
645
+ makeJoystick: function ( model ) {
646
+
647
+ //+' background:#f00;'
648
+
649
+ let w = 128, ccc;
650
+ let radius = Math.floor((w-30)*0.5);
651
+ let innerRadius = Math.floor(radius*0.6);
652
+ let svg = T.dom( 'svg', T.css.basic + 'position:relative;', { viewBox:'0 0 '+w+' '+w, width:w, height:w, preserveAspectRatio:'none' } );
653
+ T.dom( 'defs', null, {}, svg );
654
+ T.dom( 'g', null, {}, svg );
655
+
656
+ if( model === 0 ){
350
657
 
351
- svg.childNodes[0].appendChild( dcopy );
352
658
 
353
- svg.setAttribute("version", "1.1");
354
- svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg' );
355
- svg.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
356
659
 
357
- svg.setAttribute('width', w );
358
- svg.setAttribute('height', h );
359
- svg.childNodes[0].setAttribute('width', '100%' );
360
- svg.childNodes[0].setAttribute('height', '100%' );
660
+ // gradian background
661
+ ccc = [ [40, 'rgb(0,0,0)', 0.3], [80, 'rgb(0,0,0)', 0], [90, 'rgb(50,50,50)', 0.4], [100, 'rgb(50,50,50)', 0] ];
662
+ T.makeGradiant( 'radialGradient', { id:'grad', cx:'50%', cy:'50%', r:'50%', fx:'50%', fy:'50%' }, svg, ccc );
663
+
664
+ // gradian shadow
665
+ ccc = [ [60, 'rgb(0,0,0)', 0.5], [100, 'rgb(0,0,0)', 0] ];
666
+ T.makeGradiant( 'radialGradient', { id:'gradS', cx:'50%', cy:'50%', r:'50%', fx:'50%', fy:'50%' }, svg, ccc );
667
+
668
+ // gradian stick
669
+ let cc0 = ['rgb(40,40,40)', 'rgb(48,48,48)', 'rgb(30,30,30)'];
670
+ let cc1 = ['rgb(1,90,197)', 'rgb(3,95,207)', 'rgb(0,65,167)'];
671
+
672
+ ccc = [ [30, cc0[0], 1], [60, cc0[1], 1], [80, cc0[1], 1], [100, cc0[2], 1] ];
673
+ T.makeGradiant( 'radialGradient', { id:'gradIn', cx:'50%', cy:'50%', r:'50%', fx:'50%', fy:'50%' }, svg, ccc );
674
+
675
+ ccc = [ [30, cc1[0], 1], [60, cc1[1], 1], [80, cc1[1], 1], [100, cc1[2], 1] ];
676
+ T.makeGradiant( 'radialGradient', { id:'gradIn2', cx:'50%', cy:'50%', r:'50%', fx:'50%', fy:'50%' }, svg, ccc );
677
+
678
+ // graph
679
+
680
+ T.dom( 'circle', '', { cx:64, cy:64, r:radius, fill:'url(#grad)' }, svg );//2
681
+ T.dom( 'circle', '', { cx:64+5, cy:64+10, r:innerRadius+10, fill:'url(#gradS)' }, svg );//3
682
+ T.dom( 'circle', '', { cx:64, cy:64, r:innerRadius, fill:'url(#gradIn)' }, svg );//4
683
+
684
+ T.joystick_0 = svg;
685
+
686
+ } else {
687
+ // gradian shadow
688
+ ccc = [ [69, 'rgb(0,0,0)', 0],[70, 'rgb(0,0,0)', 0.3], [100, 'rgb(0,0,0)', 0] ];
689
+ T.makeGradiant( 'radialGradient', { id:'gradX', cx:'50%', cy:'50%', r:'50%', fx:'50%', fy:'50%' }, svg, ccc );
690
+
691
+ T.dom( 'circle', '', { cx:64, cy:64, r:radius, fill:'none', stroke:'rgba(100,100,100,0.25)', 'stroke-width':'4' }, svg );//2
692
+ T.dom( 'circle', '', { cx:64, cy:64, r:innerRadius+14, fill:'url(#gradX)' }, svg );//3
693
+ T.dom( 'circle', '', { cx:64, cy:64, r:innerRadius, fill:'none', stroke:'rgb(100,100,100)', 'stroke-width':'4' }, svg );//4
694
+
695
+ T.joystick_1 = svg;
696
+ }
361
697
 
362
- var data = 'data:image/svg+xml;base64,'+ window.btoa((new XMLSerializer).serializeToString(svg));
363
- dcopy = null;
364
698
 
365
- var img = new Image();
366
- img.src = data;
367
699
 
368
- setTimeout(function() {
369
- ctx.clearRect( 0, 0, w, h );
370
- ctx.drawImage( img, 0, 0, w, h, 0, 0, w, h );
371
- }, 0);
700
+ },
701
+
702
+ makeColorRing: function () {
703
+
704
+ let w = 256;
705
+ let svg = T.dom( 'svg', T.css.basic + 'position:relative;', { viewBox:'0 0 '+w+' '+w, width:w, height:w, preserveAspectRatio:'none' } );
706
+ T.dom( 'defs', null, {}, svg );
707
+ T.dom( 'g', null, {}, svg );
708
+
709
+ let s = 30;//stroke
710
+ let r =( w-s )*0.5;
711
+ let mid = w*0.5;
712
+ let n = 24, nudge = 8 / r / n * Math.PI, a1 = 0, d1;
713
+ let am, tan, d2, a2, ar, i, j, path, ccc;
714
+ let color = [];
715
+
716
+ for ( i = 0; i <= n; ++i) {
717
+
718
+ d2 = i / n;
719
+ a2 = d2 * T.TwoPI;
720
+ am = (a1 + a2) * 0.5;
721
+ tan = 1 / Math.cos((a2 - a1) * 0.5);
722
+
723
+ ar = [
724
+ Math.sin(a1), -Math.cos(a1),
725
+ Math.sin(am) * tan, -Math.cos(am) * tan,
726
+ Math.sin(a2), -Math.cos(a2)
727
+ ];
728
+
729
+ color[1] = T.rgbToHex( T.hslToRgb([d2, 1, 0.5]) );
730
+
731
+ if (i > 0) {
732
+
733
+ j = 6;
734
+ while(j--){
735
+ ar[j] = ((ar[j]*r)+mid).toFixed(2);
736
+ }
737
+
738
+ path = ' M' + ar[0] + ' ' + ar[1] + ' Q' + ar[2] + ' ' + ar[3] + ' ' + ar[4] + ' ' + ar[5];
739
+
740
+ ccc = [ [0,color[0],1], [100,color[1],1] ];
741
+ T.makeGradiant( 'linearGradient', { id:'G'+i, x1:ar[0], y1:ar[1], x2:ar[4], y2:ar[5], gradientUnits:"userSpaceOnUse" }, svg, ccc );
742
+
743
+ T.dom( 'path', '', { d:path, 'stroke-width':s, stroke:'url(#G'+i+')', 'stroke-linecap':"butt" }, svg, 1 );
744
+
745
+ }
746
+ a1 = a2 - nudge;
747
+ color[0] = color[1];
748
+ d1 = d2;
749
+ }
750
+
751
+ let br = (128 - s ) + 2;
752
+ let bw = 60;
753
+
754
+ let tw = 84.90;
755
+
756
+ // black / white
757
+ ccc = [ [0, '#FFFFFF', 1], [50, '#FFFFFF', 0], [50, '#000000', 0], [100, '#000000', 1] ];
758
+ T.makeGradiant( 'linearGradient', { id:'GL0', x1:0, y1:mid-tw, x2:0, y2:mid+tw, gradientUnits:"userSpaceOnUse" }, svg, ccc );
759
+
760
+ ccc = [ [0, '#7f7f7f', 1], [50, '#7f7f7f', 0.5], [100, '#7f7f7f', 0] ];
761
+ T.makeGradiant( 'linearGradient', { id:'GL1', x1:mid-49.05, y1:0, x2:mid+98, y2:0, gradientUnits:"userSpaceOnUse" }, svg, ccc );
762
+
763
+ T.dom( 'g', null, { 'transform-origin': '128px 128px', 'transform':'rotate(0)' }, svg );//2
764
+ T.dom( 'polygon', '', { points:'78.95 43.1 78.95 212.85 226 128', fill:'red' }, svg, 2 );// 2,0
765
+ T.dom( 'polygon', '', { points:'78.95 43.1 78.95 212.85 226 128', fill:'url(#GL1)','stroke-width':1, stroke:'url(#GL1)' }, svg, 2 );//2,1
766
+ T.dom( 'polygon', '', { points:'78.95 43.1 78.95 212.85 226 128', fill:'url(#GL0)','stroke-width':1, stroke:'url(#GL0)' }, svg, 2 );//2,2
767
+ T.dom( 'path', '', { d:'M 255.75 136.5 Q 256 132.3 256 128 256 123.7 255.75 119.5 L 241 128 255.75 136.5 Z', fill:'none','stroke-width':2, stroke:'#000' }, svg, 2 );//2,3
768
+ //T.dom( 'circle', '', { cx:128+113, cy:128, r:6, 'stroke-width':3, stroke:'#000', fill:'none' }, svg, 2 );//2.3
769
+
770
+ T.dom( 'circle', '', { cx:128, cy:128, r:6, 'stroke-width':2, stroke:'#000', fill:'none' }, svg );//3
771
+
772
+ T.colorRing = svg;
372
773
 
373
774
  },
374
775
 
776
+ icon: function ( type, color, w ){
777
+
778
+ w = w || 40;
779
+ //color = color || '#DEDEDE';
780
+ let viewBox = '0 0 256 256';
781
+ //let viewBox = '0 0 '+ w +' '+ w;
782
+ let t = ["<svg xmlns='"+T.svgns+"' version='1.1' xmlns:xlink='"+T.htmls+"' style='pointer-events:none;' preserveAspectRatio='xMinYMax meet' x='0px' y='0px' width='"+w+"px' height='"+w+"px' viewBox='"+viewBox+"'><g>"];
783
+ switch(type){
784
+ case 'logo':
785
+ t[1]="<path id='logoin' fill='"+color+"' stroke='none' d='"+T.logoFill_d+"'/>";
786
+ break;
787
+ case 'neo':
788
+ t[1]="<path id='logoin' fill='"+color+"' stroke='none' d='"+T.logo_neo+"'/>";
789
+ break;
790
+ case 'github':
791
+ t[1]="<path id='logoin' fill='"+color+"' stroke='none' d='"+T.logo_github+"'/>";
792
+ break;
793
+ case 'save':
794
+ t[1]="<path stroke='"+color+"' stroke-width='4' stroke-linejoin='round' stroke-linecap='round' fill='none' d='M 26.125 17 L 20 22.95 14.05 17 M 20 9.95 L 20 22.95'/><path stroke='"+color;
795
+ t[1]+="' stroke-width='2.5' stroke-linejoin='round' stroke-linecap='round' fill='none' d='M 32.6 23 L 32.6 25.5 Q 32.6 28.5 29.6 28.5 L 10.6 28.5 Q 7.6 28.5 7.6 25.5 L 7.6 23'/>";
796
+ break;
797
+ }
798
+ t[2] = "</g></svg>";
799
+ return t.join("\n");
800
+
801
+ },
802
+
803
+ logoFill_d:`
804
+ M 171 150.75 L 171 33.25 155.5 33.25 155.5 150.75 Q 155.5 162.2 147.45 170.2 139.45 178.25 128 178.25 116.6 178.25 108.55 170.2 100.5 162.2 100.5 150.75
805
+ L 100.5 33.25 85 33.25 85 150.75 Q 85 168.65 97.55 181.15 110.15 193.75 128 193.75 145.9 193.75 158.4 181.15 171 168.65 171 150.75
806
+ M 200 33.25 L 184 33.25 184 150.8 Q 184 174.1 167.6 190.4 151.3 206.8 128 206.8 104.75 206.8 88.3 190.4 72 174.1 72 150.8 L 72 33.25 56 33.25 56 150.75
807
+ Q 56 180.55 77.05 201.6 98.2 222.75 128 222.75 157.8 222.75 178.9 201.6 200 180.55 200 150.75 L 200 33.25 Z
808
+ `,
809
+
810
+ logo_github:`
811
+ M 180.5 70 Q 186.3 82.4 181.55 96.55 196.5 111.5 189.7 140.65 183.65 168.35 146 172.7 152.5 178.7 152.55 185.9 L 152.55 218.15 Q 152.84 224.56 159.15 223.3
812
+ 159.21 223.3 159.25 223.3 181.14 216.25 198.7 198.7 228 169.4 228 128 228 86.6 198.7 57.3 169.4 28 128 28 86.6 28 57.3 57.3 28 86.6 28 128 28 169.4 57.3 198.7 74.85
813
+ 216.25 96.75 223.3 96.78 223.3 96.8 223.3 103.16 224.54 103.45 218.15 L 103.45 200 Q 82.97 203.1 75.1 196.35 69.85 191.65 68.4 185.45 64.27 177.055 59.4 174.15 49.20
814
+ 166.87 60.8 167.8 69.85 169.61 75.7 180 81.13 188.09 90 188.55 98.18 188.86 103.45 185.9 103.49 178.67 110 172.7 72.33 168.33 66.3 140.65 59.48 111.49 74.45 96.55 69.7
815
+ 82.41 75.5 70 84.87 68.74 103.15 80 115.125 76.635 128 76.85 140.85 76.65 152.85 80 171.1 68.75 180.5 70 Z
816
+ `,
817
+
818
+ logo_neo:`
819
+ M 219 52 L 206 52 206 166 Q 206 183.4 193.75 195.65 181.4 208 164 208 146.6 208 134.35 195.65 122 183.4 122 166 L 122 90 Q 122 77.6 113.15 68.85 104.4 60 92 60 79.55
820
+ 60 70.75 68.85 62 77.6 62 90 L 62 204 75 204 75 90 Q 75 83 79.95 78 84.95 73 92 73 99 73 104 78 109 83 109 90 L 109 166 Q 109 188.8 125.15 204.85 141.2 221 164 221
821
+ 186.75 221 202.95 204.85 219 188.8 219 166 L 219 52 M 194 52 L 181 52 181 166 Q 181 173 176.05 178 171.05 183 164 183 157 183 152 178 147 173 147 166 L 147 90 Q 147
822
+ 67.2 130.85 51.15 114.8 35 92 35 69.25 35 53.05 51.15 37 67.2 37 90 L 37 204 50 204 50 90 Q 50 72.6 62.25 60.35 74.6 48 92 48 109.4 48 121.65 60.35 134 72.6 134 90 L
823
+ 134 166 Q 134 178.4 142.85 187.15 151.6 196 164 196 176.45 196 185.25 187.15 194 178.4 194 166 L 194 52 Z
824
+ `,
825
+
375
826
  }
376
827
 
377
- Tools.setText();
828
+ T.setText();
378
829
 
379
- export { Tools };
830
+ export const Tools = T;