uil 4.2.6 → 4.2.8

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.
@@ -7,7 +7,7 @@
7
7
  * @author lth / https://github.com/lo-th
8
8
  */
9
9
 
10
- const REVISION = '4.2.6';
10
+ const REVISION = '4.2.8';
11
11
 
12
12
  // INTENAL FUNCTION
13
13
 
@@ -24,13 +24,15 @@ const R = {
24
24
 
25
25
  needReZone: true,
26
26
  needResize:false,
27
+ forceZone:false,
27
28
  isEventsInit: false,
28
29
  isLeave:false,
29
30
 
30
31
  downTime:0,
31
32
  prevTime:0,
32
33
 
33
- prevDefault: ['contextmenu', 'wheel'],
34
+ //prevDefault: ['contextmenu', 'wheel'],
35
+ prevDefault: ['contextmenu'],
34
36
  pointerEvent: ['pointerdown', 'pointermove', 'pointerup'],
35
37
  eventOut: ['pointercancel', 'pointerout', 'pointerleave'],
36
38
 
@@ -229,7 +231,7 @@ const R = {
229
231
 
230
232
  if( R.needResize ) R.resize();
231
233
 
232
- R.findZone();
234
+ R.findZone(R.forceZone);
233
235
 
234
236
  let e = R.e;
235
237
  let leave = false;
@@ -274,6 +276,7 @@ const R = {
274
276
  if( time < 200 ) { R.selectAll(); return false }
275
277
 
276
278
  R.prevTime = R.downTime;
279
+ R.forceZone = false;
277
280
  }
278
281
 
279
282
  // for imput
@@ -416,11 +419,10 @@ const R = {
416
419
 
417
420
  px = 0;
418
421
 
419
- u.zone.x = zone.x;
422
+ u.zone.x = zone.x+u.dx;
420
423
  u.zone.y = py;
421
424
  py += u.h + m;
422
425
 
423
-
424
426
  height += u.h + m;
425
427
 
426
428
  }
@@ -464,6 +466,7 @@ const R = {
464
466
 
465
467
  R.needReZone = false;
466
468
 
469
+
467
470
  },
468
471
 
469
472
  onZone: function ( o, x, y ) {
@@ -471,11 +474,12 @@ const R = {
471
474
  if( x === undefined || y === undefined ) return false;
472
475
 
473
476
  let z = o.zone;
474
- let mx = x - z.x;
477
+ let mx = x - z.x;// - o.dx;
475
478
  let my = y - z.y;
476
479
 
477
480
  //if( this.marginDiv ) e.clientY -= this.margin * 0.5
478
481
  //if( o.group && o.group.marginDiv ) my += o.group.margin * 0.5
482
+ //if( o.group !== null ) mx -= o.dx
479
483
 
480
484
  let over = ( mx >= 0 ) && ( my >= 0 ) && ( mx <= z.w ) && ( my <= z.h );
481
485
 
@@ -1683,6 +1687,12 @@ const T = {
1683
1687
  case 'neo':
1684
1688
  t[1]="<path id='logoin' fill='"+color+"' stroke='none' d='"+T.logo_neo+"'/>";
1685
1689
  break;
1690
+ case 'phy':
1691
+ t[1]="<path id='logoin' stroke='"+color+"' stroke-width='49' stroke-linejoin='round' stroke-linecap='butt' fill='none' d='"+T.logo_phy+"'/>";
1692
+ break;
1693
+ case 'config':
1694
+ t[1]="<path id='logoin' stroke='"+color+"' stroke-width='49' stroke-linejoin='round' stroke-linecap='butt' fill='none' d='"+T.logo_config+"'/>";
1695
+ break;
1686
1696
  case 'github':
1687
1697
  t[1]="<path id='logoin' fill='"+color+"' stroke='none' d='"+T.logo_github+"'/>";
1688
1698
  break;
@@ -1719,6 +1729,17 @@ const T = {
1719
1729
  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
1720
1730
  `,
1721
1731
 
1732
+ logo_phy:`
1733
+ M 103.55 37.95 L 127.95 37.95 Q 162.35 37.95 186.5 55 210.9 72.35 210.9 96.5 210.9 120.65 186.5 137.7 162.35 155 127.95 155 L 127.95 237.95 M 127.95 155
1734
+ Q 93.55 155 69.15 137.7 45 120.65 45 96.5 45 72.35 69.15 55 70.9 53.8 72.85 52.85 M 127.95 155 L 127.95 37.95
1735
+ `,
1736
+
1737
+ logo_config:`
1738
+ M 204.35 51.65 L 173.25 82.75 Q 192 101.5 192 128 L 236 128 M 192 128 Q 192 154.55 173.25 173.25 L 204.4 204.4 M 51.65 51.65 L 82.75 82.75 Q 101.5 64 128 64
1739
+ L 128 20 M 51.6 204.4 L 82.75 173.25 Q 64 154.55 64 128 L 20 128 M 128 236 L 128 192 Q 101.5 192 82.75 173.25 M 64 128 Q 64 101.5 82.75 82.75 M 173.25 173.25
1740
+ Q 154.55 192 128 192 M 128 64 Q 154.55 64 173.25 82.75
1741
+ `,
1742
+
1722
1743
  logo_donate:`
1723
1744
  M 171.3 80.3 Q 179.5 62.15 171.3 45.8 164.1 32.5 141.35 30.1 L 94.35 30.1 Q 89.35 30.4 88.3 35.15 L 70.5 148.05 Q 70.2 152.5 73.7 152.6 L 100.95 152.6 107 111.6 Q 108.75
1724
1745
  106.55 112.6 106.45 130.45 108.05 145.3 103.9 163.35 98.75 171.3 80.3 M 179.8 71.5 Q 178.6 79.75 174.9 87.85 168.45 102.9 151.9 109.15 140.65 113.95 117.55 113 113.15
@@ -1768,7 +1789,7 @@ class Files {
1768
1789
  case 'mp4':
1769
1790
  t = [ { accept: { 'video/mp4': '.mp4'} }, ];
1770
1791
  break;
1771
- case 'bin':case 'hex':
1792
+ case 'bin': case 'hex':
1772
1793
  t = [ { description: 'Binary Files', accept: { 'application/octet-stream': ['.bin', '.hex'] } }, ];
1773
1794
  break;
1774
1795
  case 'text':
@@ -1801,7 +1822,7 @@ class Files {
1801
1822
  static async load( o = {} ) {
1802
1823
 
1803
1824
  if (typeof window.showOpenFilePicker !== 'function') {
1804
- window.showOpenFilePicker = this.showOpenFilePickerPolyfill;
1825
+ window.showOpenFilePicker = Files.showOpenFilePickerPolyfill;
1805
1826
  }
1806
1827
 
1807
1828
  try {
@@ -1814,7 +1835,7 @@ class Files {
1814
1835
  //startIn:'./assets'
1815
1836
  };
1816
1837
 
1817
- options.types = this.autoTypes( type );
1838
+ options.types = Files.autoTypes( type );
1818
1839
 
1819
1840
  // create a new handle
1820
1841
  const handle = await window.showOpenFilePicker( options );
@@ -1859,7 +1880,7 @@ class Files {
1859
1880
  } catch(e) {
1860
1881
 
1861
1882
  console.log(e);
1862
- if( o.callback ) o.callback( null );
1883
+ if( o.always && o.callback ) o.callback( null );
1863
1884
 
1864
1885
  }
1865
1886
 
@@ -1899,11 +1920,11 @@ class Files {
1899
1920
 
1900
1921
  static async save( o = {} ) {
1901
1922
 
1902
- this.usePoly = false;
1923
+ let usePoly = false;
1903
1924
 
1904
1925
  if (typeof window.showSaveFilePicker !== 'function') {
1905
- window.showSaveFilePicker = this.showSaveFilePickerPolyfill;
1906
- this.usePoly = true;
1926
+ window.showSaveFilePicker = Files.showSaveFilePickerPolyfill;
1927
+ usePoly = true;
1907
1928
  }
1908
1929
 
1909
1930
  try {
@@ -1915,16 +1936,15 @@ class Files {
1915
1936
  data: o.data || ''
1916
1937
  };
1917
1938
 
1918
-
1919
- options.types = this.autoTypes( type );
1920
- options.finalType = Object.keys(options.types[0].accept )[0];
1939
+ options.types = Files.autoTypes( type );
1940
+ options.finalType = Object.keys( options.types[0].accept )[0];
1921
1941
  options.suggestedName += options.types[0].accept[options.finalType][0];
1922
1942
 
1923
1943
 
1924
1944
  // create a new handle
1925
1945
  const handle = await window.showSaveFilePicker( options );
1926
1946
 
1927
- if( this.usePoly ) return
1947
+ if( usePoly ) return
1928
1948
 
1929
1949
  // create a FileSystemWritableFileStream to write to
1930
1950
  const file = await handle.createWritable();
@@ -2160,6 +2180,8 @@ class Proto {
2160
2180
  this.top = 0;
2161
2181
  this.ytop = 0;
2162
2182
 
2183
+ this.dx = o.dx || 0;
2184
+
2163
2185
  this.isSelectable = o.selectable !== undefined ? o.selectable : false;
2164
2186
  this.unselectable = o.unselect !== undefined ? o.unselect : this.isSelectable;
2165
2187
 
@@ -2363,9 +2385,6 @@ class Proto {
2363
2385
 
2364
2386
  }
2365
2387
 
2366
-
2367
-
2368
-
2369
2388
  }
2370
2389
 
2371
2390
  addTransition(){
@@ -2882,7 +2901,7 @@ class Bool extends Proto {
2882
2901
  mode ( over ) {
2883
2902
 
2884
2903
  let change = false;
2885
- let cc = this.colors, s, s2, n, v = this.value;
2904
+ let cc = this.colors, s = this.s, n, v = this.value;
2886
2905
 
2887
2906
  if( over ) n = v ? 4 : 3;
2888
2907
  else n = v ? 2 : 1;
@@ -2893,14 +2912,12 @@ class Bool extends Proto {
2893
2912
 
2894
2913
  if( this.model !== 0 ){
2895
2914
 
2896
- s = this.s[2];
2897
-
2898
2915
  switch( n ){
2899
2916
 
2900
- case 1: s.color = cc.text; s.background = cc.button; break;
2901
- case 2: s.color = cc.textSelect; s.background = cc.select; break;
2902
- case 3: s.color = cc.textOver; s.background = cc.overoff; break;
2903
- case 4: s.color = cc.textOver; s.background = cc.over; break;
2917
+ case 1: s[2].color = cc.text; s[2].background = cc.button; break;
2918
+ case 2: s[2].color = cc.textSelect; s[2].background = cc.select; break;
2919
+ case 3: s[2].color = cc.textOver; s[2].background = cc.overoff; break;
2920
+ case 4: s[2].color = cc.textOver; s[2].background = cc.over; break;
2904
2921
 
2905
2922
  }
2906
2923
 
@@ -2908,19 +2925,16 @@ class Bool extends Proto {
2908
2925
 
2909
2926
  } else {
2910
2927
 
2911
- s = this.s[2];
2912
- s2 = this.s[3];
2913
-
2914
2928
  switch( n ){
2915
2929
 
2916
- case 1: s.background = s.borderColor = cc.back; s2.background = cc.button; break;
2917
- case 2: s.background = s.borderColor = cc.select; s2.background = cc.button; break;
2918
- case 3: s.background = s.borderColor = cc.back; s2.background = cc.overoff; break;
2919
- case 4: s.background = s.borderColor = cc.select; s2.background = cc.over; break;
2930
+ case 1: s[2].background = s[2].borderColor = cc.backoff; s[3].background = cc.button; break;// off out
2931
+ case 2: s[2].background = s[2].borderColor = cc.back; s[3].background = cc.textOver; break;// on over
2932
+ case 3: s[2].background = s[2].borderColor = cc.back; s[3].background = cc.overoff; break;// off over
2933
+ case 4: s[2].background = s[2].borderColor = cc.backoff; s[3].background = cc.textSelect; break;// on out
2920
2934
 
2921
2935
  }
2922
2936
 
2923
- this.s[3].marginLeft = v ? '17px' : '2px';
2937
+ s[3].marginLeft = v ? '17px' : '2px';
2924
2938
  this.c[1].textContent = v ? this.onName : this.name;
2925
2939
 
2926
2940
  }
@@ -3159,6 +3173,10 @@ class Button extends Proto {
3159
3173
 
3160
3174
  }
3161
3175
 
3176
+ switchValues( n, string ){
3177
+ this.c[n+2].innerHTML = this.values[n] = string;
3178
+ }
3179
+
3162
3180
  icon ( string, y = 0, n = 2 ) {
3163
3181
 
3164
3182
  //if(y) this.s[n].margin = ( y ) +'px 0px';
@@ -4509,6 +4527,7 @@ class Group extends Proto {
4509
4527
  this.isEmpty = true;
4510
4528
 
4511
4529
  this.decal = o.group ? 8 : 0;
4530
+ //this.dd = o.group ? o.group.decal + 8 : 0
4512
4531
 
4513
4532
  this.baseH = this.h;
4514
4533
 
@@ -4700,9 +4719,23 @@ class Group extends Proto {
4700
4719
  }
4701
4720
 
4702
4721
  let u = this.ADD.apply( this, a );
4722
+
4723
+ if( u.isGroup ){
4724
+ //o.add = add;
4725
+ u.dx = 8;
4726
+ }
4727
+
4728
+ //u.dx += 4
4729
+ //console.log(this.decal)
4730
+ //u.zone.d -= 8
4731
+ Roots.forceZone = true;
4703
4732
  //u.margin += this.margin
4704
4733
 
4705
4734
  //console.log( u.margin )
4735
+ //Roots.needReZone = true
4736
+
4737
+ //Roots.resize()
4738
+ //console.log(Roots.needResize)
4706
4739
 
4707
4740
  this.uis.push( u );
4708
4741
 
@@ -4816,6 +4849,9 @@ class Group extends Proto {
4816
4849
 
4817
4850
  this.parentHeight();
4818
4851
 
4852
+ //Roots.isLeave = true
4853
+ //Roots.needResize = true
4854
+
4819
4855
  }
4820
4856
 
4821
4857
  close () {
@@ -7532,14 +7568,32 @@ class Grid extends Proto {
7532
7568
 
7533
7569
  super( o );
7534
7570
 
7535
- this.values = o.values || [];
7571
+ /*this.values = o.values || [];
7572
+
7573
+ if( typeof this.values === 'string' ) this.values = [ this.values ];*/
7574
+
7575
+ this.values = [];
7576
+
7577
+ if( o.values ){
7578
+ if( o.values instanceof Array ){
7579
+ this.values = o.values;
7580
+ } else if( o.values instanceof String ){
7581
+ this.values = [ o.values ];
7582
+ } else if( o.values instanceof Object ){
7583
+ this.refObject = o.values;
7584
+ for( let g in this.refObject ) this.values.push( g );
7585
+ }
7586
+ }
7536
7587
 
7537
- if( typeof this.values === 'string' ) this.values = [ this.values ];
7538
7588
  this.lng = this.values.length;
7539
7589
 
7590
+
7591
+
7540
7592
  this.value = o.value || null;
7541
7593
 
7542
7594
 
7595
+
7596
+
7543
7597
  let cc = this.colors;
7544
7598
 
7545
7599
 
@@ -8125,11 +8179,12 @@ const add = function () {
8125
8179
 
8126
8180
  }
8127
8181
 
8128
-
8129
-
8130
8182
  let name = type.toLowerCase();
8131
8183
 
8132
- if( name === 'group' ) o.add = add;
8184
+ if( name === 'group' ){
8185
+ o.add = add;
8186
+ //o.dx = 8
8187
+ }
8133
8188
 
8134
8189
  switch( name ){
8135
8190
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uil",
3
- "version": "4.2.6",
3
+ "version": "4.2.8",
4
4
  "description": "JavaScript gui library",
5
5
  "main": "build/uil.js",
6
6
  "repository": "lo-th/uil",