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
@@ -1,91 +1,181 @@
1
- import { Tools } from '../core/Tools';
2
- import { Proto } from '../core/Proto';
1
+ import { Proto } from '../core/Proto.js';
3
2
 
4
- function TextInput( o ){
3
+ export class TextInput extends Proto {
5
4
 
6
- Proto.call( this, o );
5
+ constructor( o = {} ) {
7
6
 
8
- this.value = o.value || '';
9
- this.allway = o.allway || false;
7
+ super( o );
10
8
 
11
- this.c[2] = Tools.dom( 'div', Tools.css.txtselect );
12
- this.c[2].name = 'input';
13
- //this.c[2].style.color = ;
14
- this.c[2].textContent = this.value;
9
+ this.cmode = 0;
15
10
 
16
- this.c[2].events = [ 'mousedown', 'keydown', 'keyup', 'blur', 'focus' ];
11
+ this.value = o.value || '';
12
+ this.placeHolder = o.placeHolder || '';
17
13
 
18
- this.init();
14
+ this.allway = o.allway || false;
15
+ this.editable = o.edit !== undefined ? o.edit : true;
19
16
 
20
- };
17
+ this.isDown = false;
21
18
 
22
- TextInput.prototype = Object.create( Proto.prototype );
23
- TextInput.prototype.constructor = TextInput;
19
+ let cc = this.colors
24
20
 
25
- TextInput.prototype.handleEvent = function( e ) {
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;
26
65
 
27
- switch( e.type ) {
28
- case 'mousedown': this.down( e ); break;
29
- case 'blur': this.blur( e ); break;
30
- case 'focus': this.focus( e ); break
31
- case 'keydown': this.keydown( e ); break;
32
- case 'keyup': this.keyup( e ); break;
33
66
  }
34
67
 
35
- };
68
+ mousedown ( e ) {
36
69
 
37
- TextInput.prototype.down = function( e ){
70
+ if(!this.editable) return;
38
71
 
39
- e.target.contentEditable = true;
40
- e.target.focus();
41
- e.target.style.cursor = 'auto';
72
+ let name = this.testZone( e );
42
73
 
43
- };
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
+ }
44
83
 
45
- TextInput.prototype.blur = function( e ){
84
+ mousemove ( e ) {
46
85
 
47
- e.target.style.borderColor = Tools.colors.border;
48
- e.target.contentEditable = false;
86
+ if(!this.editable) return;
49
87
 
50
- };
88
+ let name = this.testZone( e );
51
89
 
52
- TextInput.prototype.focus = function( e ){
90
+ //let l = this.local;
91
+ //if( l.x === -1 && l.y === -1 ){ return;}
53
92
 
54
- e.target.style.borderColor = Tools.colors.borderSelect;
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
+ }
55
106
 
56
- };
107
+ update ( ) {
57
108
 
58
- TextInput.prototype.keydown = function( e ){
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
59
135
 
60
- e.stopPropagation();
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;
61
158
 
62
- if( e.keyCode === 13 ){
63
- e.preventDefault();
64
- this.value = e.target.textContent;
65
- e.target.blur();
66
159
  this.send();
160
+
67
161
  }
68
162
 
69
- };
163
+ // ----------------------
164
+ // REZISE
165
+ // ----------------------
70
166
 
71
- TextInput.prototype.keyup = function( e ){
72
-
73
- e.stopPropagation();
167
+ rSize () {
74
168
 
75
- this.value = e.target.textContent;
76
- if( this.allway ) this.send();
77
-
78
- };
169
+ super.rSize();
170
+
171
+ let s = this.s;
172
+ s[2].left = this.sa + 'px';
173
+ s[2].width = this.sb + 'px';
79
174
 
80
- TextInput.prototype.rSize = function(){
175
+ s[5].left = this.sa + 'px';
176
+ s[5].width = this.sb + 'px';
177
+
178
+ }
81
179
 
82
- Proto.prototype.rSize.call( this );
83
- this.s[2].color = this.fontColor;
84
- this.s[2].left = this.sa + 'px';
85
- this.s[2].width = this.sb + 'px';
86
- this.s[2].height = this.h -4 + 'px';
87
- this.s[2].lineHeight = this.h - 8 + 'px';
88
-
89
- };
90
180
 
91
- export { TextInput };
181
+ }
@@ -1,52 +1,61 @@
1
- import { Tools } from '../core/Tools';
2
- import { Proto } from '../core/Proto';
1
+ import { Proto } from '../core/Proto.js';
3
2
 
4
- function Title ( o ){
5
-
6
- Proto.call( this, o );
7
3
 
8
- //var id = o.id || 0;
9
- var prefix = o.prefix || '';
4
+ export class Title extends Proto {
10
5
 
11
- this.c[2] = Tools.dom( 'div', Tools.css.txt + 'text-align:right; width:60px; line-height:'+ (this.h-8) + 'px; color:' + this.fontColor );
6
+ constructor( o = {} ) {
12
7
 
13
- if( this.h === 31 ){
8
+ super( o );
14
9
 
15
- this.s[0].height = this.h + 'px';
16
- this.s[1].top = 8 + 'px';
17
- this.c[2].style.top = 8 + 'px';
10
+ let prefix = o.prefix || '';
18
11
 
19
- }
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';
20
19
 
21
- this.c[1].textContent = this.txt.substring(0,1).toUpperCase() + this.txt.substring(1).replace("-", " ");
22
- this.c[2].textContent = prefix;
20
+ }
23
21
 
24
- this.init();
22
+ let s = this.s;
25
23
 
26
- };
24
+ s[1].justifyContent = o.align || 'left';
25
+ //s[1].textAlign = o.align || 'left';
26
+ s[1].fontWeight = o.fontWeight || 'bold';
27
27
 
28
- Title.prototype = Object.create( Proto.prototype );
29
- Title.prototype.constructor = Title;
30
28
 
29
+ this.c[1].textContent = this.txt.substring(0,1).toUpperCase() + this.txt.substring(1).replace("-", " ");
30
+ this.c[2].textContent = prefix;
31
31
 
32
- Title.prototype.rSize = function(){
32
+ this.init();
33
33
 
34
- Proto.prototype.rSize.call( this );
35
- this.s[1].width = this.width-50 + 'px';
36
- this.s[2].left = this.width-(50+26) + 'px';
34
+ }
37
35
 
38
- };
36
+ text( txt ) {
39
37
 
40
- Title.prototype.text = function(txt){
38
+ this.c[1].textContent = txt;
41
39
 
42
- this.c[1].textContent = txt;
40
+ }
43
41
 
44
- };
42
+ text2( txt ) {
45
43
 
46
- Title.prototype.text2 = function(txt){
44
+ this.c[2].textContent = txt;
47
45
 
48
- this.c[2].textContent = txt;
46
+ }
49
47
 
50
- };
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
+ }
51
60
 
52
- export { Title };
61
+ }