uil 4.2.2 → 4.2.3

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- <p align="center"><a href="http://lo-th.github.io/uil/"><img src="http://lo-th.github.io/uil/examples/assets/uil.jpg"/></a><br>UIL v4.2.0</p>
1
+ <p align="center"><a href="http://lo-th.github.io/uil/"><img src="http://lo-th.github.io/uil/examples/assets/uil.jpg"/></a><br>UIL v4.2.3</p>
2
2
 
3
3
  uil.js is a lightweight ui for javascript with a complete 3d display support.<br>
4
4
  totally customizable, only 6 events, auto resize<br>
package/build/uil.js CHANGED
@@ -723,8 +723,8 @@
723
723
  }
724
724
 
725
725
  if (o.fontSelect) color.textSelect = o.fontSelect;
726
- if (o.groupBorder) color.gborder = o.groupBorder;
727
- if (o.transparent) o.bg = 'none'; //if( o.bg ) color.background = color.backgroundOver = o.bg
726
+ if (o.groupBorder) color.gborder = o.groupBorder; //if( o.transparent ) o.bg = 'none'
727
+ //if( o.bg ) color.background = color.backgroundOver = o.bg
728
728
 
729
729
  if (o.bgOver) color.backgroundOver = o.bgOver;
730
730
 
@@ -743,18 +743,15 @@
743
743
  sx: 3,
744
744
  sy: 3,
745
745
  content: 'none',
746
- background: 'rgba(50,50,50,0.3)',
747
- backgroundOver: 'rgba(50,50,50,0.4)',
746
+ background: 'rgba(50,50,50,0.15)',
747
+ backgroundOver: 'rgba(50,50,50,0.3)',
748
748
  title: '#CCC',
749
749
  titleoff: '#BBB',
750
750
  text: '#DDD',
751
751
  textOver: '#EEE',
752
752
  textSelect: '#FFF',
753
- //inputBg: 'rgba(0,0,0,0.25)',
754
- //itemBg:'rgba(0,0,0,0.25)',
755
753
  back: 'rgba(0,0,0,0.2)',
756
754
  backoff: 'rgba(0,0,0,0.3)',
757
- //inputOver: 'rgba(0,0,0,0.2)',
758
755
  // input and button border
759
756
  border: '#4c4c4c',
760
757
  borderSize: 1,
@@ -772,19 +769,14 @@
772
769
  fontShadow: 'none',
773
770
  //'#000',
774
771
  fontSize: 12,
775
- radius: 3,
772
+ radius: 4,
776
773
  hide: 'rgba(0,0,0,0)'
777
774
  },
778
775
  // style css
779
776
  css: {
780
- //unselect: '-o-user-select:none; -ms-user-select:none; -khtml-user-select:none; -webkit-user-select:none; -moz-user-select:none;',
781
777
  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;',
782
- button: 'display:flex; justify-content:center; align-items:center; text-align:center;',
783
- middle: 'display:flex; align-items:center;'
784
- /*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;',
785
- 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+';',
786
- item: T.css.txt + 'position:relative; background:rgba(0,0,0,0.2); margin-bottom:1px;',*/
787
-
778
+ button: 'display:flex; align-items:center; justify-content:center; text-align:center;',
779
+ middle: 'display:flex; align-items:center; justify-content:left; text-align:left; flex-direction: row-reverse;'
788
780
  },
789
781
  // svg path
790
782
  svgs: {
@@ -842,15 +834,13 @@
842
834
 
843
835
  if (isNaN(size)) {
844
836
  if (size.search('em') === -1) size += 'px';
845
- } else size += 'px';
837
+ } else size += 'px'; //let align = 'display:flex; justify-content:left; align-items:center; text-align:left;'
846
838
 
847
- let align = 'display:flex; justify-content:left; align-items:center; text-align:left;';
848
- T.css.txt = T.css.basic + align + ' font-family:' + font + '; font-weight:' + weight + '; font-size:' + size + '; color:' + cc.text + '; padding:0px 8px; left:0; top:2px; height:16px; width:100px; overflow:hidden; white-space: nowrap; letter-spacing: normal;';
849
- if (shadow !== 'none') T.css.txt += ' text-shadow: 1px 1px 1px ' + shadow + ';';
850
- T.css.txtselect = T.css.txt + 'padding:0px 4px; border:1px dashed ' + cc.border + ';'; //T.css.item = T.css.txt + ' position:relative; margin-bottom:1px; '//display:block; padding:4px 4px;';//
851
839
 
852
- T.css.item = T.css.txt + ' position:relative; margin-bottom:1px; display:block; padding:2px 4px;'; //
853
- //console.log( T.css.txt )
840
+ T.css.txt = T.css.basic + T.css.middle + ' font-family:' + font + '; font-weight:' + weight + '; font-size:' + size + '; color:' + cc.text + '; padding:0px 8px; left:0; top:2px; height:16px; width:100px; overflow:hidden; white-space: nowrap; letter-spacing: normal;';
841
+ if (shadow !== 'none') T.css.txt += ' text-shadow: 1px 1px 1px ' + shadow + ';';
842
+ T.css.txtselect = T.css.txt + 'padding:0px 4px; border:1px dashed ' + cc.border + ';';
843
+ T.css.item = T.css.txt + 'padding:0px 4px; position:relative; margin-bottom:1px; ';
854
844
  },
855
845
  // note
856
846
  //https://developer.mozilla.org/fr/docs/Web/CSS/css_flexible_box_layout/aligning_items_in_a_flex_container
@@ -3815,61 +3805,45 @@
3815
3805
  this.baseH = this.h;
3816
3806
  let fltop = Math.floor(this.h * 0.5) - 3;
3817
3807
  const cc = this.colors;
3818
- this.isLine = o.line !== undefined ? o.line : false;
3819
3808
  this.useFlex = true;
3820
3809
  let flexible = this.useFlex ? 'display:flex; flex-flow: row wrap;' : '';
3821
- this.c[2] = this.dom('div', this.css.basic + flexible + 'width:100%; left:0; height:auto; overflow:hidden; top:' + (this.h - 1) + 'px');
3810
+ this.c[2] = this.dom('div', this.css.basic + flexible + 'width:100%; left:0; height:auto; overflow:hidden; top:' + this.h + 'px');
3822
3811
  this.c[3] = this.dom('path', this.css.basic + 'position:absolute; width:6px; height:6px; left:0; top:' + fltop + 'px;', {
3823
3812
  d: this.svgs.g1,
3824
3813
  fill: cc.text,
3825
3814
  stroke: 'none'
3826
- }); //this.c[3] = this.dom( 'path', this.css.basic + 'position:absolute; width:10px; height:10px; left:0; top:'+fltop+'px;', { d:this.svgs.group, fill:cc.text, stroke:'none'})
3827
- //this.c[3] = this.dom( 'path', this.css.basic + 'position:absolute; width:10px; height:10px; left:0; top:'+fltop+'px;', { d:this.svgs.group, fill:cc.text, stroke:'none'})
3828
- //this.c[4] = this.dom( 'path', this.css.basic + 'position:absolute; width:10px; height:10px; left:'+(this.decal-1)+'px; top:'+fltop+'px;', { d:this.svgs.arrow, fill:cc.text, stroke:'none'})
3829
- // bottom line
3830
-
3831
- if (this.isLine) this.c[5] = this.dom('div', this.css.basic + 'background:rgba(255, 255, 255, 0.2); width:100%; left:0; height:1px; bottom:0px'); //else this.c[5] = this.dom( 'div', this.css.basic + 'width:100%; left:0; height:auto; top:'+(this.h-1)+'px')
3832
-
3833
- let s = this.s;
3834
- s[0].height = this.h + 'px';
3815
+ });
3816
+ this.s;
3835
3817
  this.c[1].name = 'group';
3836
-
3837
- if (cc.groups !== 'none') {
3838
- s[1].background = cc.groups;
3839
- s[1].border = cc.borderSize + 'px solid ' + cc.border;
3840
- s[1].borderRadius = this.radius + 'px'; //s[5].border = '2px solid ' + '#000'
3841
- //s[1].marginRight = 10+'px';
3842
- } //this.c[1].innerHTML = this.dd + this.name
3843
- //s[1].padding = '0px ' + (10+this.decal)+'px';
3844
-
3845
-
3846
- s[1].lineHeight = this.h - 4;
3847
- s[1].color = cc.text; //s[1].fontWeight = 'bold';
3848
-
3849
3818
  this.init();
3850
-
3851
- if (this.radius !== 0) {
3852
- //s[0].borderRadius = this.radius+'px'
3853
- s[1].borderRadius = this.radius + 'px';
3854
- s[2].borderRadius = this.radius + 'px';
3855
- } //s[1].paddingLeft = (10+this.decal)+'px'
3856
-
3857
-
3858
3819
  this.setBG(o.bg);
3859
3820
  if (o.open) this.open();
3860
3821
  }
3861
3822
 
3862
3823
  setBG(bg) {
3863
- this.colors;
3864
- const s = this.s; //if( bg !== undefined ) this.colors.background = bg
3865
- //this.c[0].style.background = this.colors.background;
3824
+ const cc = this.colors;
3825
+ const s = this.s;
3826
+ if (bg !== undefined) cc.groups = bg;
3827
+ if (cc.groups === 'none') cc.groups = cc.background;
3828
+ cc.background = 'none';
3829
+ s[0].background = 'none';
3830
+ s[1].background = cc.groups;
3831
+ s[2].background = cc.groups;
3866
3832
 
3867
- s[1].background = bg; //this.colors.background
3833
+ if (cc.gborder !== 'none') {
3834
+ s[1].border = cc.borderSize + 'px solid ' + cc.gborder;
3835
+ }
3868
3836
 
3869
- s[2].background = bg; //s[5].border = '1px solid ' + '#000'
3870
- // s[5].background = '#000'
3837
+ if (this.radius !== 0) {
3838
+ s[1].borderRadius = this.radius + 'px';
3839
+ s[2].borderRadius = this.radius + 'px';
3840
+ }
3841
+ /*let i = this.uis.length;
3842
+ while(i--){
3843
+ this.uis[i].setBG( 'none' );
3844
+ //this.uis[i].setBG( this.colors.background );
3845
+ }*/
3871
3846
 
3872
- this.uis.length;
3873
3847
  }
3874
3848
 
3875
3849
  testZone(e) {
@@ -4025,11 +3999,12 @@
4025
3999
 
4026
4000
  open() {
4027
4001
  super.open();
4028
- this.setSvg(this.c[3], 'd', this.svgs.g2); //this.setSvg( this.c[4], 'd', this.svgs.arrowDown )
4029
-
4002
+ this.setSvg(this.c[3], 'd', this.svgs.g2);
4030
4003
  this.rSizeContent();
4031
4004
  this.h - this.baseH;
4032
4005
  const s = this.s;
4006
+ const cc = this.colors;
4007
+ s[2].top = this.h - 1 + 'px';
4033
4008
 
4034
4009
  if (this.radius) {
4035
4010
  s[1].borderRadius = '0px';
@@ -4040,17 +4015,31 @@
4040
4015
  s[2].borderBottomRightRadius = this.radius + 'px';
4041
4016
  }
4042
4017
 
4018
+ if (cc.gborder !== 'none') {
4019
+ s[2].border = cc.borderSize + 'px solid ' + cc.gborder;
4020
+ s[2].borderTop = 'none';
4021
+ s[1].borderBottom = cc.borderSize + 'px solid rgba(0,0,0,0)';
4022
+ }
4023
+
4043
4024
  this.parentHeight();
4044
4025
  }
4045
4026
 
4046
4027
  close() {
4047
4028
  super.close();
4048
4029
  this.h - this.baseH;
4049
- this.setSvg(this.c[3], 'd', this.svgs.g1); //this.setSvg( this.c[4], 'd', this.svgs.arrow )
4050
-
4030
+ this.setSvg(this.c[3], 'd', this.svgs.g1);
4051
4031
  this.h = this.baseH;
4052
4032
  const s = this.s;
4053
- s[0].height = this.h + 'px';
4033
+ const cc = this.colors;
4034
+ s[0].height = this.h + 'px'; //s[1].height = (this.h-2) + 'px'
4035
+
4036
+ s[2].top = this.h + 'px';
4037
+
4038
+ if (cc.gborder !== 'none') {
4039
+ s[2].border = 'none';
4040
+ s[1].border = cc.borderSize + 'px solid ' + cc.gborder;
4041
+ }
4042
+
4054
4043
  if (this.radius) s[1].borderRadius = this.radius + 'px';
4055
4044
  this.parentHeight();
4056
4045
  }
@@ -4086,9 +4075,7 @@
4086
4075
  s[3].left = this.sa + this.sb - 6 + 'px'; //s[1].width = this.isbgGroup ? (this.w-5) + 'px' : this.w + 'px'
4087
4076
 
4088
4077
  s[1].width = this.w + 'px';
4089
- s[2].width = this.w + 'px'; //s[1].width = (this.w - this.decal) + 'px'
4090
- //s[2].width = (this.w - this.decal) + 'px'
4091
-
4078
+ s[2].width = this.w + 'px';
4092
4079
  s[1].left = this.decal + 'px';
4093
4080
  s[2].left = this.decal + 'px';
4094
4081
  if (this.isOpen) this.rSizeContent();
@@ -4509,9 +4496,9 @@
4509
4496
  this.isWithImage = this.path !== '' ? true : false;
4510
4497
  this.preLoadComplete = false;
4511
4498
  this.tmpImage = {};
4512
- this.tmpUrl = []; //this.autoHeight = false;
4513
-
4514
- let align = o.align || 'center'; // scroll size
4499
+ this.tmpUrl = [];
4500
+ this.m = o.m !== undefined ? o.m : 5;
4501
+ let align = o.align || 'left'; // scroll size
4515
4502
 
4516
4503
  let ss = o.scrollSize || 10;
4517
4504
  this.ss = ss + 1;
@@ -4526,7 +4513,7 @@
4526
4513
  let fltop = Math.floor(this.h * 0.5) - 3;
4527
4514
  let cc = this.colors;
4528
4515
  this.c[2] = this.dom('div', this.css.basic + 'top:0; display:none; border-radius:' + this.radius + 'px;');
4529
- this.c[3] = this.dom('div', this.css.item + 'position:absolute; text-align:' + align + '; line-height:' + (this.h - 4) + 'px; top:1px; background:' + cc.button + '; height:' + (this.h - 2) + 'px; border:1px solid ' + cc.border + '; border-radius:' + this.radius + 'px;');
4516
+ this.c[3] = this.dom('div', this.css.item + 'padding:0px ' + this.m + 'px; margin-bottom:0px; position:absolute; justify-content:' + align + '; text-align:' + align + '; line-height:' + (this.h - 4) + 'px; top:1px; background:' + cc.button + '; height:' + (this.h - 2) + 'px; border:1px solid ' + cc.border + '; border-radius:' + this.radius + 'px;');
4530
4517
  this.c[4] = this.dom('path', this.css.basic + 'position:absolute; width:6px; height:6px; top:' + fltop + 'px;', {
4531
4518
  d: this.svgs.g1,
4532
4519
  fill: cc.text,
@@ -4541,7 +4528,7 @@
4541
4528
  if (o.list) {
4542
4529
  if (o.list instanceof Array) {
4543
4530
  this.list = o.list;
4544
- } else {
4531
+ } else if (o.list instanceof Object) {
4545
4532
  this.refObject = o.list;
4546
4533
 
4547
4534
  for (let g in this.refObject) this.list.push(g);
@@ -4551,7 +4538,8 @@
4551
4538
  this.items = [];
4552
4539
  this.prevName = '';
4553
4540
  this.baseH = this.h;
4554
- this.itemHeight = o.itemHeight || this.h - 3; // force full list
4541
+ this.itemHeight = o.itemHeight || this.h; //(this.h-3);
4542
+ // force full list
4555
4543
 
4556
4544
  this.full = o.full || false;
4557
4545
  this.py = 0;
@@ -4566,8 +4554,7 @@
4566
4554
  if (this.up) {
4567
4555
  this.c[2].style.top = 'auto';
4568
4556
  this.c[3].style.top = 'auto';
4569
- this.c[4].style.top = 'auto'; //this.c[5].style.top = 'auto';
4570
-
4557
+ this.c[4].style.top = 'auto';
4571
4558
  this.c[2].style.bottom = this.h - 2 + 'px';
4572
4559
  this.c[3].style.bottom = '1px';
4573
4560
  this.c[4].style.bottom = fltop + 'px';
@@ -4611,12 +4598,7 @@
4611
4598
  this.setList(this.list);
4612
4599
  this.init();
4613
4600
  if (this.isOpenOnStart) this.open(true);
4614
- }
4615
- /*send ( v ) {
4616
- super.send( v );
4617
- //Proto.prototype.send.call( this, v );
4618
- }*/
4619
- // image list
4601
+ } // image list
4620
4602
 
4621
4603
 
4622
4604
  preloadImage() {
@@ -4773,10 +4755,9 @@
4773
4755
  // is item
4774
4756
  if (this.current) {
4775
4757
  this.value = this.list[this.current.id];
4776
- if (this.isSelectable) this.selected(); //this.value = this.refObject !== null ? this.refObject[this.list[this.current.id]] : this.list[this.current.id]
4777
- //this.value = this.current.textContent;
4758
+ if (this.isSelectable) this.selected(); //this.send( this.refObject !== null ? this.refObject[ this.list[this.current.id]] : this.value );
4778
4759
 
4779
- this.send(this.refObject !== null ? this.refObject[this.list[this.current.id]] : this.value);
4760
+ this.send(this.value);
4780
4761
 
4781
4762
  if (!this.listOnly) {
4782
4763
  this.close();
@@ -4927,7 +4908,7 @@
4927
4908
 
4928
4909
  for (let i = 0; i < this.length; i++) {
4929
4910
  n = this.list[i];
4930
- item = this.dom('div', this.css.item + 'width:' + this.ww + 'px; height:' + this.itemHeight + 'px; line-height:' + (this.itemHeight - 5) + 'px; color:' + this.colors.text + '; background:' + this.colors.back + ';');
4911
+ item = this.dom('div', this.css.item + 'padding:0px ' + (this.m + 1) + 'px; width:' + this.ww + 'px; height:' + this.itemHeight + 'px; line-height:' + (this.itemHeight - 2) + 'px; color:' + this.colors.text + '; background:' + this.colors.back + ';');
4931
4912
  item.name = 'item' + i;
4932
4913
  item.id = i;
4933
4914
  item.select = false;
@@ -4940,15 +4921,18 @@
4940
4921
 
4941
4922
  if (this.miniCanvas) {
4942
4923
  let c = new Image();
4943
- c.src = this.tmpCanvas.toDataURL();
4924
+ c.src = this.tmpCanvas.toDataURL(); //item.style.marginLeft = (this.imageSize[0]+8)+'px'
4925
+
4944
4926
  /*let c = document.createElement('canvas')
4945
4927
  c.width = this.imageSize[0]
4946
4928
  c.height = this.imageSize[1]
4947
4929
  let ctx = c.getContext("2d")
4948
4930
  ctx.fillStyle = this.canvasBg
4949
4931
  ctx.fillRect(0, 0, this.imageSize[0], this.imageSize[1])*/
4932
+ //c.style.cssText = 'position:relative; pointer-events:none; display:inline-block; float:left; margin-left:0px; margin-right:5px; top:2px'
4933
+ // c.style.cssText =' flex-shrink: 0;'
4950
4934
 
4951
- c.style.cssText = 'position:relative; pointer-events:none; display:inline-block; float:left; margin-left:0px; margin-right:5px; top:2px'; //c.style.cssText = 'display:flex; align-content: flex-start; flex-wrap: wrap;'
4935
+ c.style.cssText = 'margin-right:4px;'; //c.style.cssText = 'display:flex; align-content: flex-start; flex-wrap: wrap;'
4952
4936
  //item.style.float = 'right'
4953
4937
 
4954
4938
  item.appendChild(c);
@@ -5014,8 +4998,10 @@
5014
4998
  this.canvas = document.createElement('canvas');
5015
4999
  this.canvas.width = this.imageSize[0];
5016
5000
  this.canvas.height = this.imageSize[1];
5017
- this.canvas.style.cssText = 'position:absolute; top:0px; left:0px;';
5001
+ this.canvas.style.cssText = 'margin-right:4px;';
5018
5002
  this.ctx = this.canvas.getContext("2d");
5003
+ this.c[3].style.textAlign = 'left';
5004
+ this.c[3].style.justifyContent = 'left';
5019
5005
  this.c[3].appendChild(this.canvas);
5020
5006
  }
5021
5007
 
@@ -5028,11 +5014,10 @@
5028
5014
  this.canvas = document.createElement('canvas');
5029
5015
  this.canvas.width = this.imageSize[0];
5030
5016
  this.canvas.height = this.imageSize[1];
5031
- (this.h - this.imageSize[1]) * 0.5;
5032
- this.canvas.style.cssText = 'position:relative; pointer-events:none; display:inline-block; float:left; margin-left:0px; margin-right:5px; top:2px'; //this.canvas.style.cssText = 'position:absolute; top:'+h+'px; left:5px;'
5033
-
5017
+ this.canvas.style.cssText = 'margin-right:4px;';
5034
5018
  this.ctx = this.canvas.getContext("2d");
5035
5019
  this.c[3].style.textAlign = 'left';
5020
+ this.c[3].style.justifyContent = 'left';
5036
5021
  this.c[3].appendChild(this.canvas);
5037
5022
  }
5038
5023
 
@@ -6044,8 +6029,7 @@
6044
6029
 
6045
6030
  mousemove(e) {
6046
6031
  let up = false;
6047
- let name = this.testZone(e); //let sel = false;
6048
- //console.log(name)
6032
+ let name = this.testZone(e);
6049
6033
 
6050
6034
  if (name === 'over') {
6051
6035
  this.cursor('pointer');
@@ -6078,7 +6062,7 @@
6078
6062
 
6079
6063
  if (this.img !== null) {
6080
6064
  if (this.objectLink !== null) this.objectLink[this.val] = v;
6081
- if (this.callback) this.callback(v, this.img, this.name);
6065
+ if (this.callback) this.callback(this.value, this.img, this.name);
6082
6066
  }
6083
6067
  }
6084
6068
 
@@ -6094,12 +6078,6 @@
6094
6078
  let cc = this.colors;
6095
6079
 
6096
6080
  if (this.stat !== n) {
6097
- /*if( n===1 ) this.isActif = false
6098
- if( n===3 ){
6099
- if( !this.isActif ){ this.isActif = true; n=4; this.onActif( this ); }
6100
- else { this.isActif = false; }
6101
- }
6102
- if( n===2 && this.isActif ) n = 4;*/
6103
6081
  this.stat = n;
6104
6082
 
6105
6083
  switch (n) {
@@ -6736,7 +6714,7 @@
6736
6714
  o = a[2];
6737
6715
  o.name = a[1];
6738
6716
 
6739
- if (type === 'list') {
6717
+ if (type === 'list' && !o.list) {
6740
6718
  o.list = a[0][a[1]];
6741
6719
  } else o.value = a[0][a[1]];
6742
6720
  }
@@ -7423,7 +7401,7 @@
7423
7401
 
7424
7402
  }
7425
7403
 
7426
- const REVISION = '4.2.2';
7404
+ const REVISION = '4.2.3';
7427
7405
 
7428
7406
  exports.Files = Files;
7429
7407
  exports.Gui = Gui;