uil 4.0.0 → 4.0.4

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 (46) hide show
  1. package/README.md +5 -1
  2. package/build/uil.js +33 -45
  3. package/build/uil.min.js +1 -1
  4. package/build/uil.module.js +45 -58
  5. package/package.json +6 -10
  6. package/examples/js/BufferGeometryUtils.js +0 -921
  7. package/examples/js/SimplexNoise.js +0 -324
  8. package/examples/js/controls/OrbitControls.js +0 -1215
  9. package/examples/js/controls/OrbitControls_.js +0 -1042
  10. package/examples/js/libs/sea3d.min.js +0 -373
  11. package/examples/js/libs/three.min.js +0 -6
  12. package/examples/js/math.js +0 -447
  13. package/examples/js/objects/Landscape.js +0 -778
  14. package/examples/js/objects/Lensflare.js +0 -372
  15. package/examples/js/objects/SuperSky.js +0 -297
  16. package/examples/js/objects/Water.js +0 -329
  17. package/src/Uil.js +0 -6
  18. package/src/Uil_dev.js +0 -15
  19. package/src/core/Gui.js +0 -807
  20. package/src/core/Proto.js +0 -679
  21. package/src/core/Roots.js +0 -864
  22. package/src/core/Tools.js +0 -830
  23. package/src/core/V2.js +0 -131
  24. package/src/core/add.js +0 -85
  25. package/src/polyfills.js +0 -85
  26. package/src/proto/Bool.js +0 -147
  27. package/src/proto/Button.js +0 -357
  28. package/src/proto/Circular.js +0 -230
  29. package/src/proto/Color.js +0 -411
  30. package/src/proto/Empty.js +0 -15
  31. package/src/proto/Fps.js +0 -327
  32. package/src/proto/Graph.js +0 -310
  33. package/src/proto/Grid.js +0 -297
  34. package/src/proto/Group.js +0 -430
  35. package/src/proto/Item.js +0 -120
  36. package/src/proto/Joystick.js +0 -241
  37. package/src/proto/Knob.js +0 -262
  38. package/src/proto/List.js +0 -789
  39. package/src/proto/Numeric.js +0 -417
  40. package/src/proto/Pad2D.js +0 -268
  41. package/src/proto/Rubric.js +0 -0
  42. package/src/proto/Select.js +0 -178
  43. package/src/proto/Selector.js +0 -13
  44. package/src/proto/Slide.js +0 -267
  45. package/src/proto/TextInput.js +0 -181
  46. package/src/proto/Title.js +0 -61
@@ -1,178 +0,0 @@
1
- import { Proto } from '../core/Proto.js';
2
-
3
- export class Select extends Proto {
4
-
5
- constructor( o = {} ) {
6
-
7
- super( o );
8
-
9
- this.value = o.value || '';
10
-
11
- this.isDown = false;
12
-
13
- this.onActif = o.onActif || function(){};
14
-
15
- let prefix = o.prefix || '';
16
-
17
- this.c[2] = this.dom( 'div', this.css.txt + this.css.button + ' top:1px; background:'+this.colors.button+'; height:'+(this.h-2)+'px; border:'+this.colors.buttonBorder+'; border-radius:15px; width:30px; left:10px;' );
18
- this.c[2].style.color = this.fontColor;
19
-
20
- this.c[3] = this.dom( 'div', this.css.txtselect + 'height:' + (this.h-4) + 'px; background:' + this.colors.inputBg + '; borderColor:' + this.colors.inputBorder+'; border-radius:'+this.radius+'px;' );
21
- this.c[3].textContent = this.value;
22
-
23
- let fltop = Math.floor(this.h*0.5)-7;
24
- this.c[4] = this.dom( 'path', this.css.basic + 'position:absolute; width:14px; height:14px; left:5px; top:'+fltop+'px;', { d:this.svgs[ 'cursor' ], fill:this.fontColor, stroke:'none'});
25
-
26
- this.stat = 1;
27
- this.isActif = false;
28
-
29
- this.init();
30
-
31
- }
32
-
33
- testZone ( e ) {
34
-
35
- let l = this.local;
36
- if( l.x === -1 && l.y === -1 ) return '';
37
- if( l.x > this.sa && l.x < this.sa+30 ) return 'over';
38
- return '0'
39
-
40
- }
41
-
42
- // ----------------------
43
- // EVENTS
44
- // ----------------------
45
-
46
- mouseup ( e ) {
47
-
48
- if( this.isDown ){
49
- //this.value = false;
50
- this.isDown = false;
51
- //this.send();
52
- return this.mousemove( e );
53
- }
54
-
55
- return false;
56
-
57
- }
58
-
59
- mousedown ( e ) {
60
-
61
- let name = this.testZone( e );
62
-
63
- if( !name ) return false;
64
-
65
- this.isDown = true;
66
- //this.value = this.values[ name-2 ];
67
- //this.send();
68
- return this.mousemove( e );
69
-
70
- }
71
-
72
- mousemove ( e ) {
73
-
74
- let up = false;
75
-
76
- let name = this.testZone( e );
77
- //let sel = false;
78
-
79
-
80
-
81
- //console.log(name)
82
-
83
- if( name === 'over' ){
84
- this.cursor('pointer');
85
- up = this.mode( this.isDown ? 3 : 2 );
86
- } else {
87
- up = this.reset();
88
- }
89
-
90
- return up;
91
-
92
- }
93
-
94
- // ----------------------
95
-
96
- apply ( v ) {
97
-
98
- v = v || '';
99
-
100
- if( v !== this.value ) {
101
- this.value = v;
102
- this.c[3].textContent = this.value;
103
- this.send();
104
- }
105
-
106
- this.mode(1);
107
-
108
- }
109
-
110
- update () {
111
-
112
- this.mode( 3 );
113
-
114
- }
115
-
116
- mode ( n ) {
117
-
118
- let change = false
119
- let cc = this.colors
120
-
121
- if( this.stat !== n ){
122
-
123
- if( n===1 ) this.isActif = false;;
124
-
125
- if( n===3 ){
126
- if( !this.isActif ){ this.isActif = true; n=4; this.onActif( this ); }
127
- else { this.isActif = false; }
128
- }
129
-
130
- if( n===2 && this.isActif ) n = 4;
131
-
132
- this.stat = n
133
-
134
- switch( n ){
135
-
136
- case 1: this.s[ 2 ].color = cc.text; this.s[ 2 ].background = cc.button; break; // base
137
- case 2: this.s[ 2 ].color = cc.textOver; this.s[ 2 ].background = cc.over; break; // over
138
- case 3: this.s[ 2 ].color = cc.textSelect; this.s[ 2 ].background = cc.select; break; // down
139
- case 4: this.s[ 2 ].color = cc.textSelect; this.s[ 2 ].background = cc.action; break; // actif
140
-
141
- }
142
-
143
- change = true;
144
-
145
- }
146
-
147
- return change;
148
-
149
-
150
-
151
- }
152
-
153
- reset () {
154
-
155
- this.cursor();
156
- return this.mode( this.isActif ? 4 : 1 );
157
-
158
- }
159
-
160
- text ( txt ) {
161
-
162
- this.c[3].textContent = txt;
163
-
164
- }
165
-
166
- rSize () {
167
-
168
- super.rSize();
169
-
170
- let s = this.s;
171
- s[2].left = this.sa + 'px';
172
- s[3].left = (this.sa + 40) + 'px';
173
- s[3].width = (this.sb - 40) + 'px';
174
- s[4].left = (this.sa+8) + 'px';
175
-
176
- }
177
-
178
- }
@@ -1,13 +0,0 @@
1
- //import { Proto } from '../core/Proto.js';
2
- import { Button } from './Button.js';
3
-
4
- export class Selector extends Button {
5
-
6
- constructor( o = {} ) {
7
-
8
- if( o.selectable === undefined ) o.selectable = true
9
- super( o );
10
-
11
- }
12
-
13
- }
@@ -1,267 +0,0 @@
1
- import { Proto } from '../core/Proto.js';
2
-
3
-
4
- export class Slide extends Proto {
5
-
6
- constructor( o = {} ) {
7
-
8
- super( o );
9
-
10
- this.setTypeNumber( o );
11
-
12
-
13
- this.model = o.stype || 0;
14
- if( o.mode !== undefined ) this.model = o.mode;
15
-
16
- //this.defaultBorderColor = this.colors.hide;
17
-
18
- this.isDown = false;
19
- this.isOver = false;
20
- this.allway = o.allway || false;
21
-
22
- this.isDeg = o.isDeg || false;
23
- this.isCyclic = o.cyclic || false;
24
-
25
- this.firstImput = false;
26
-
27
- let cc = this.colors
28
-
29
- //this.c[2] = this.dom( 'div', this.css.txtselect + 'letter-spacing:-1px; text-align:right; width:47px; border:1px dashed '+this.defaultBorderColor+'; color:'+ this.colors.text );
30
- //this.c[2] = this.dom( 'div', this.css.txtselect + 'text-align:right; width:47px; border:1px dashed '+this.defaultBorderColor+'; color:'+ this.colors.text );
31
- this.c[2] = this.dom( 'div', this.css.txtselect + 'border:none; background:none; width:47px; color:'+ cc.text +';' );
32
- //this.c[2] = this.dom( 'div', this.css.txtselect + 'letter-spacing:-1px; text-align:right; width:47px; color:'+ this.colors.text );
33
- this.c[3] = this.dom( 'div', this.css.basic + ' top:0; height:'+this.h+'px;' );
34
- this.c[4] = this.dom( 'div', this.css.basic + 'background:'+cc.back+'; top:2px; height:'+(this.h-4)+'px;' );
35
- this.c[5] = this.dom( 'div', this.css.basic + 'left:4px; top:5px; height:'+(this.h-10)+'px; background:' + cc.text +';' );
36
-
37
- this.c[2].isNum = true;
38
- //this.c[2].style.height = (this.h-4) + 'px';
39
- //this.c[2].style.lineHeight = (this.h-8) + 'px';
40
- this.c[2].style.height = (this.h-2) + 'px';
41
- this.c[2].style.lineHeight = (this.h-10) + 'px';
42
-
43
- if(this.model !== 0){
44
-
45
- let h1 = 4, h2 = 8, ww = this.h-4, ra = 20;
46
-
47
- if( this.model === 2 ){
48
- h1 = 4;//2
49
- h2 = 8;
50
- ra = 2;
51
- ww = (this.h-4)*0.5
52
- }
53
-
54
- if(this.model === 3) this.c[5].style.visible = 'none';
55
-
56
- this.c[4].style.borderRadius = h1 + 'px';
57
- this.c[4].style.height = h2 + 'px';
58
- this.c[4].style.top = (this.h*0.5) - h1 + 'px';
59
- this.c[5].style.borderRadius = (h1*0.5) + 'px';
60
- this.c[5].style.height = h1 + 'px';
61
- this.c[5].style.top = (this.h*0.5)-(h1*0.5) + 'px';
62
-
63
- this.c[6] = this.dom( 'div', this.css.basic + 'border-radius:'+ra+'px; margin-left:'+(-ww*0.5)+'px; border:1px solid '+cc.border+'; background:'+cc.button+'; left:4px; top:2px; height:'+(this.h-4)+'px; width:'+ww+'px;' );
64
- }
65
-
66
- this.init();
67
-
68
- }
69
-
70
- testZone ( e ) {
71
-
72
- let l = this.local;
73
- if( l.x === -1 && l.y === -1 ) return '';
74
-
75
- if( l.x >= this.txl ) return 'text';
76
- else if( l.x >= this.sa ) return 'scroll';
77
- else return '';
78
-
79
- }
80
-
81
- // ----------------------
82
- // EVENTS
83
- // ----------------------
84
-
85
- mouseup ( e ) {
86
-
87
- if( this.isDown ) this.isDown = false;
88
-
89
- }
90
-
91
- mousedown ( e ) {
92
-
93
- let name = this.testZone( e );
94
-
95
- if( !name ) return false;
96
-
97
- if( name === 'scroll' ){
98
- this.isDown = true;
99
- this.old = this.value;
100
- this.mousemove( e );
101
-
102
- }
103
-
104
- /*if( name === 'text' ){
105
- this.setInput( this.c[2], function(){ this.validate() }.bind(this) );
106
- }*/
107
-
108
- return true;
109
-
110
- }
111
-
112
- mousemove ( e ) {
113
-
114
- let nup = false;
115
-
116
- let name = this.testZone( e );
117
-
118
- if( name === 'scroll' ) {
119
- this.mode(1);
120
- this.cursor('w-resize');
121
- //} else if(name === 'text'){
122
- //this.cursor('pointer');
123
- } else {
124
- this.cursor();
125
- }
126
-
127
- if( this.isDown ){
128
-
129
- let n = ((( e.clientX - (this.zone.x+this.sa) - 3 ) / this.ww ) * this.range + this.min ) - this.old;
130
- if(n >= this.step || n <= this.step){
131
- n = Math.floor( n / this.step );
132
- this.value = this.numValue( this.old + ( n * this.step ) );
133
- this.update( true );
134
- this.old = this.value;
135
- }
136
- nup = true;
137
- }
138
-
139
- return nup;
140
-
141
- }
142
-
143
- wheel ( e ) {
144
-
145
- let name = this.testZone( e );
146
-
147
- if( name === 'scroll' ) {
148
-
149
- let v = this.value - this.step * e.delta;
150
-
151
- if ( v > this.max ) {
152
- v = this.isCyclic ? this.min : this.max;
153
- } else if ( v < this.min ) {
154
- v = this.isCyclic ? this.max : this.min;
155
- }
156
-
157
- this.setValue(v);
158
- this.old = v;
159
- this.update( true );
160
-
161
- return true;
162
-
163
- }
164
-
165
- return false;
166
-
167
- }
168
-
169
- //keydown: function ( e ) { return true; },
170
-
171
- // ----------------------
172
-
173
- validate () {
174
-
175
- let n = this.c[2].textContent;
176
-
177
- if(!isNaN( n )){
178
- this.value = this.numValue( n );
179
- this.update(true);
180
- }
181
-
182
- else this.c[2].textContent = this.value + (this.isDeg ? '°':'');
183
-
184
- }
185
-
186
-
187
- reset () {
188
-
189
- //this.clearInput();
190
- this.isDown = false;
191
- this.mode(0);
192
-
193
- }
194
-
195
- mode ( mode ) {
196
-
197
- let s = this.s;
198
- let cc = this.colors
199
-
200
- switch(mode){
201
- case 0: // base
202
- // s[2].border = '1px solid ' + this.colors.hide;
203
- s[2].color = cc.text;
204
- s[4].background = cc.back;
205
- s[5].background = cc.text;
206
- break;
207
- case 1: // scroll over
208
- //s[2].border = '1px dashed ' + this.colors.hide;
209
- s[2].color = cc.textOver;
210
- s[4].background = cc.back;
211
- s[5].background = cc.textOver;
212
- break;
213
- /* case 2:
214
- s[2].border = '1px solid ' + this.colors.borderSelect;
215
- break;
216
- case 3:
217
- s[2].border = '1px dashed ' + this.colors.text;//this.colors.borderSelect;
218
- break;
219
- case 4:
220
- s[2].border = '1px dashed ' + this.colors.hide;
221
- break;*/
222
-
223
-
224
- }
225
- }
226
-
227
- update ( up ) {
228
-
229
- let ww = Math.floor( this.ww * (( this.value - this.min ) / this.range ));
230
-
231
- if(this.model !== 3) this.s[5].width = ww + 'px';
232
- if(this.s[6]) this.s[6].left = ( this.sa + ww + 3 ) + 'px';
233
- this.c[2].textContent = this.value + (this.isDeg ? '°':'');
234
-
235
- if( up ) this.send();
236
-
237
- }
238
-
239
- rSize () {
240
-
241
- super.rSize();
242
-
243
- let w = this.sb - this.sc;
244
- this.ww = w - 6;
245
-
246
- let tx = this.sc;
247
- if(this.isUI || !this.simple) tx = this.sc+10;
248
- this.txl = this.w - tx + 2;
249
-
250
- //let ty = Math.floor(this.h * 0.5) - 8;
251
-
252
- let s = this.s;
253
-
254
- s[2].width = (this.sc -6 )+ 'px';
255
- s[2].left = (this.txl +4) + 'px';
256
- //s[2].top = ty + 'px';
257
- s[3].left = this.sa + 'px';
258
- s[3].width = w + 'px';
259
- s[4].left = this.sa + 'px';
260
- s[4].width = w + 'px';
261
- s[5].left = (this.sa + 3) + 'px';
262
-
263
- this.update();
264
-
265
- }
266
-
267
- }
@@ -1,181 +0,0 @@
1
- import { Proto } from '../core/Proto.js';
2
-
3
- export class TextInput extends Proto {
4
-
5
- constructor( o = {} ) {
6
-
7
- super( o );
8
-
9
- this.cmode = 0;
10
-
11
- this.value = o.value || '';
12
- this.placeHolder = o.placeHolder || '';
13
-
14
- this.allway = o.allway || false;
15
- this.editable = o.edit !== undefined ? o.edit : true;
16
-
17
- this.isDown = false;
18
-
19
- let cc = this.colors
20
-
21
- // text
22
- this.c[2] = this.dom( 'div', this.css.txtselect + 'height:' + (this.h-4) + 'px; color:' + cc.text + '; background:' + cc.back + '; borderColor:' + cc.border+'; border-radius:'+this.radius+'px;' );
23
- this.c[2].textContent = this.value;
24
-
25
- // selection
26
- this.c[3] = this.dom( 'div', this.css.txtselect + 'position:absolute; top:4px; height:' + (this.h-8) + 'px; padding:0px 0px; width:0px; color:' + cc.textSelect + '; background:' + cc.select + '; border:none; border-radius:0px;');
27
-
28
- // cursor
29
- this.c[4] = this.dom( 'div', this.css.basic + 'top:4px; height:' + (this.h-8) + 'px; width:0px; background:'+cc.text+';' );
30
-
31
- // fake
32
- this.c[5] = this.dom( 'div', this.css.txtselect + 'height:' + (this.h-4) + 'px; justify-content: center; font-style: italic; color:'+cc.border+';' );
33
- if( this.value === '' ) this.c[5].textContent = this.placeHolder;
34
-
35
-
36
-
37
-
38
- this.init();
39
-
40
- }
41
-
42
- testZone ( e ) {
43
-
44
- let l = this.local;
45
- if( l.x === -1 && l.y === -1 ) return '';
46
- if( l.x >= this.sa ) return 'text';
47
- return '';
48
-
49
- }
50
-
51
- // ----------------------
52
- // EVENTS
53
- // ----------------------
54
-
55
- mouseup ( e ) {
56
-
57
- if(!this.editable) return;
58
-
59
- if( this.isDown ){
60
- this.isDown = false;
61
- return this.mousemove( e );
62
- }
63
-
64
- return false;
65
-
66
- }
67
-
68
- mousedown ( e ) {
69
-
70
- if(!this.editable) return;
71
-
72
- let name = this.testZone( e );
73
-
74
- if( !this.isDown ){
75
- this.isDown = true;
76
- if( name === 'text' ) this.setInput( this.c[2] );
77
- return this.mousemove( e );
78
- }
79
-
80
- return false;
81
-
82
- }
83
-
84
- mousemove ( e ) {
85
-
86
- if(!this.editable) return;
87
-
88
- let name = this.testZone( e );
89
-
90
- //let l = this.local;
91
- //if( l.x === -1 && l.y === -1 ){ return;}
92
-
93
- //if( l.x >= this.sa ) this.cursor('text');
94
- //else this.cursor();
95
-
96
- let x = 0;
97
-
98
- if( name === 'text' ) this.cursor('text');
99
- else this.cursor();
100
-
101
- if( this.isDown ) x = e.clientX - this.zone.x;
102
-
103
- return this.upInput( x - this.sa -3, this.isDown );
104
-
105
- }
106
-
107
- update ( ) {
108
-
109
- this.c[2].textContent = this.value;
110
-
111
- }
112
-
113
- // ----------------------
114
-
115
- reset () {
116
-
117
- this.cursor();
118
-
119
- }
120
-
121
- // ----------------------
122
- // INPUT
123
- // ----------------------
124
-
125
- select ( c, e, w, t ) {
126
-
127
- let s = this.s;
128
- let d = this.sa + 5;
129
- s[4].width = '1px';
130
- s[4].left = ( d + e ) + 'px';
131
-
132
- s[3].left = ( d + e ) + 'px';
133
- s[3].width = w + 'px';
134
- this.c[3].innerHTML = t
135
-
136
- }
137
-
138
- unselect () {
139
-
140
- let s = this.s;
141
- if(!s) return;
142
- s[3].width = 0 + 'px';
143
- this.c[3].innerHTML = 't'
144
- s[4].width = 0 + 'px';
145
-
146
- }
147
-
148
- validate ( force ) {
149
-
150
- if( this.allway ) force = true;
151
-
152
- this.value = this.c[2].textContent;
153
-
154
- if(this.value !== '') this.c[5].textContent = '';
155
- else this.c[5].textContent = this.placeHolder;
156
-
157
- if( !force ) return;
158
-
159
- this.send();
160
-
161
- }
162
-
163
- // ----------------------
164
- // REZISE
165
- // ----------------------
166
-
167
- rSize () {
168
-
169
- super.rSize();
170
-
171
- let s = this.s;
172
- s[2].left = this.sa + 'px';
173
- s[2].width = this.sb + 'px';
174
-
175
- s[5].left = this.sa + 'px';
176
- s[5].width = this.sb + 'px';
177
-
178
- }
179
-
180
-
181
- }
@@ -1,61 +0,0 @@
1
- import { Proto } from '../core/Proto.js';
2
-
3
-
4
- export class Title extends Proto {
5
-
6
- constructor( o = {} ) {
7
-
8
- super( o );
9
-
10
- let prefix = o.prefix || '';
11
-
12
- this.c[2] = this.dom( 'div', this.css.txt + 'justify-content:right; width:60px; line-height:'+ (this.h-8) + 'px; color:' + this.colors.text );
13
-
14
- if( this.h === 31 ){
15
-
16
- this.s[0].height = this.h + 'px';
17
- this.s[1].top = 8 + 'px';
18
- this.c[2].style.top = 8 + 'px';
19
-
20
- }
21
-
22
- let s = this.s;
23
-
24
- s[1].justifyContent = o.align || 'left';
25
- //s[1].textAlign = o.align || 'left';
26
- s[1].fontWeight = o.fontWeight || 'bold';
27
-
28
-
29
- this.c[1].textContent = this.txt.substring(0,1).toUpperCase() + this.txt.substring(1).replace("-", " ");
30
- this.c[2].textContent = prefix;
31
-
32
- this.init();
33
-
34
- }
35
-
36
- text( txt ) {
37
-
38
- this.c[1].textContent = txt;
39
-
40
- }
41
-
42
- text2( txt ) {
43
-
44
- this.c[2].textContent = txt;
45
-
46
- }
47
-
48
- rSize() {
49
-
50
- super.rSize();
51
- this.s[1].width = this.w + 'px'; //- 50 + 'px';
52
- this.s[2].left = this.w + 'px';//- ( 50 + 26 ) + 'px';
53
-
54
- }
55
-
56
- setColor( c ) {
57
- this.s[1].color = c
58
- this.s[2].color = c
59
- }
60
-
61
- }