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.
package/build/uil.js CHANGED
@@ -12,7 +12,7 @@
12
12
  /**
13
13
  * @author lth / https://github.com/lo-th
14
14
  */
15
- const REVISION = '4.2.6'; // INTENAL FUNCTION
15
+ const REVISION = '4.2.8'; // INTENAL FUNCTION
16
16
 
17
17
  const R = {
18
18
  ui: [],
@@ -23,11 +23,13 @@
23
23
  current: -1,
24
24
  needReZone: true,
25
25
  needResize: false,
26
+ forceZone: false,
26
27
  isEventsInit: false,
27
28
  isLeave: false,
28
29
  downTime: 0,
29
30
  prevTime: 0,
30
- prevDefault: ['contextmenu', 'wheel'],
31
+ //prevDefault: ['contextmenu', 'wheel'],
32
+ prevDefault: ['contextmenu'],
31
33
  pointerEvent: ['pointerdown', 'pointermove', 'pointerup'],
32
34
  eventOut: ['pointercancel', 'pointerout', 'pointerleave'],
33
35
  xmlserializer: null,
@@ -165,7 +167,7 @@
165
167
  //if(!event.type) return;
166
168
  if (R.prevDefault.indexOf(event.type) !== -1) event.preventDefault();
167
169
  if (R.needResize) R.resize();
168
- R.findZone();
170
+ R.findZone(R.forceZone);
169
171
  let e = R.e;
170
172
  let leave = false;
171
173
  if (event.type === 'keydown') R.keydown(event);
@@ -207,6 +209,7 @@
207
209
  }
208
210
 
209
211
  R.prevTime = R.downTime;
212
+ R.forceZone = false;
210
213
  } // for imput
211
214
 
212
215
 
@@ -319,7 +322,7 @@
319
322
  }
320
323
  } else {
321
324
  px = 0;
322
- u.zone.x = zone.x;
325
+ u.zone.x = zone.x + u.dx;
323
326
  u.zone.y = py;
324
327
  py += u.h + m;
325
328
  height += u.h + m;
@@ -356,9 +359,11 @@
356
359
  onZone: function (o, x, y) {
357
360
  if (x === undefined || y === undefined) return false;
358
361
  let z = o.zone;
359
- let mx = x - z.x;
362
+ let mx = x - z.x; // - o.dx;
363
+
360
364
  let my = y - z.y; //if( this.marginDiv ) e.clientY -= this.margin * 0.5
361
365
  //if( o.group && o.group.marginDiv ) my += o.group.margin * 0.5
366
+ //if( o.group !== null ) mx -= o.dx
362
367
 
363
368
  let over = mx >= 0 && my >= 0 && mx <= z.w && my <= z.h; //if( o.marginDiv ) my -= o.margin * 0.5
364
369
 
@@ -1531,6 +1536,14 @@
1531
1536
  t[1] = "<path id='logoin' fill='" + color + "' stroke='none' d='" + T.logo_neo + "'/>";
1532
1537
  break;
1533
1538
 
1539
+ case 'phy':
1540
+ t[1] = "<path id='logoin' stroke='" + color + "' stroke-width='49' stroke-linejoin='round' stroke-linecap='butt' fill='none' d='" + T.logo_phy + "'/>";
1541
+ break;
1542
+
1543
+ case 'config':
1544
+ t[1] = "<path id='logoin' stroke='" + color + "' stroke-width='49' stroke-linejoin='round' stroke-linecap='butt' fill='none' d='" + T.logo_config + "'/>";
1545
+ break;
1546
+
1534
1547
  case 'github':
1535
1548
  t[1] = "<path id='logoin' fill='" + color + "' stroke='none' d='" + T.logo_github + "'/>";
1536
1549
  break;
@@ -1564,6 +1577,15 @@
1564
1577
  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
1565
1578
  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
1566
1579
  `,
1580
+ logo_phy: `
1581
+ 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
1582
+ 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
1583
+ `,
1584
+ logo_config: `
1585
+ 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
1586
+ 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
1587
+ Q 154.55 192 128 192 M 128 64 Q 154.55 64 173.25 82.75
1588
+ `,
1567
1589
  logo_donate: `
1568
1590
  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
1569
1591
  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
@@ -1691,7 +1713,7 @@
1691
1713
 
1692
1714
  static async load(o = {}) {
1693
1715
  if (typeof window.showOpenFilePicker !== 'function') {
1694
- window.showOpenFilePicker = this.showOpenFilePickerPolyfill;
1716
+ window.showOpenFilePicker = Files.showOpenFilePickerPolyfill;
1695
1717
  }
1696
1718
 
1697
1719
  try {
@@ -1701,7 +1723,7 @@
1701
1723
  multiple: false //startIn:'./assets'
1702
1724
 
1703
1725
  };
1704
- options.types = this.autoTypes(type); // create a new handle
1726
+ options.types = Files.autoTypes(type); // create a new handle
1705
1727
 
1706
1728
  const handle = await window.showOpenFilePicker(options);
1707
1729
  const file = await handle[0].getFile(); //let content = await file.text()
@@ -1739,7 +1761,7 @@
1739
1761
  };
1740
1762
  } catch (e) {
1741
1763
  console.log(e);
1742
- if (o.callback) o.callback(null);
1764
+ if (o.always && o.callback) o.callback(null);
1743
1765
  }
1744
1766
  }
1745
1767
 
@@ -1766,11 +1788,11 @@
1766
1788
 
1767
1789
 
1768
1790
  static async save(o = {}) {
1769
- this.usePoly = false;
1791
+ let usePoly = false;
1770
1792
 
1771
1793
  if (typeof window.showSaveFilePicker !== 'function') {
1772
- window.showSaveFilePicker = this.showSaveFilePickerPolyfill;
1773
- this.usePoly = true;
1794
+ window.showSaveFilePicker = Files.showSaveFilePickerPolyfill;
1795
+ usePoly = true;
1774
1796
  }
1775
1797
 
1776
1798
  try {
@@ -1779,12 +1801,12 @@
1779
1801
  suggestedName: o.name || 'hello',
1780
1802
  data: o.data || ''
1781
1803
  };
1782
- options.types = this.autoTypes(type);
1804
+ options.types = Files.autoTypes(type);
1783
1805
  options.finalType = Object.keys(options.types[0].accept)[0];
1784
1806
  options.suggestedName += options.types[0].accept[options.finalType][0]; // create a new handle
1785
1807
 
1786
1808
  const handle = await window.showSaveFilePicker(options);
1787
- if (this.usePoly) return; // create a FileSystemWritableFileStream to write to
1809
+ if (usePoly) return; // create a FileSystemWritableFileStream to write to
1788
1810
 
1789
1811
  const file = await handle.createWritable();
1790
1812
  let blob = new Blob([options.data], {
@@ -1950,6 +1972,7 @@
1950
1972
  this.isListen = false;
1951
1973
  this.top = 0;
1952
1974
  this.ytop = 0;
1975
+ this.dx = o.dx || 0;
1953
1976
  this.isSelectable = o.selectable !== undefined ? o.selectable : false;
1954
1977
  this.unselectable = o.unselect !== undefined ? o.unselect : this.isSelectable;
1955
1978
  this.ontop = o.ontop ? o.ontop : false; // 'beforebegin' 'afterbegin' 'beforeend' 'afterend'
@@ -2525,8 +2548,7 @@
2525
2548
  mode(over) {
2526
2549
  let change = false;
2527
2550
  let cc = this.colors,
2528
- s,
2529
- s2,
2551
+ s = this.s,
2530
2552
  n,
2531
2553
  v = this.value;
2532
2554
  if (over) n = v ? 4 : 3;else n = v ? 2 : 1;
@@ -2535,58 +2557,57 @@
2535
2557
  this.stat = n;
2536
2558
 
2537
2559
  if (this.model !== 0) {
2538
- s = this.s[2];
2539
-
2540
2560
  switch (n) {
2541
2561
  case 1:
2542
- s.color = cc.text;
2543
- s.background = cc.button;
2562
+ s[2].color = cc.text;
2563
+ s[2].background = cc.button;
2544
2564
  break;
2545
2565
 
2546
2566
  case 2:
2547
- s.color = cc.textSelect;
2548
- s.background = cc.select;
2567
+ s[2].color = cc.textSelect;
2568
+ s[2].background = cc.select;
2549
2569
  break;
2550
2570
 
2551
2571
  case 3:
2552
- s.color = cc.textOver;
2553
- s.background = cc.overoff;
2572
+ s[2].color = cc.textOver;
2573
+ s[2].background = cc.overoff;
2554
2574
  break;
2555
2575
 
2556
2576
  case 4:
2557
- s.color = cc.textOver;
2558
- s.background = cc.over;
2577
+ s[2].color = cc.textOver;
2578
+ s[2].background = cc.over;
2559
2579
  break;
2560
2580
  }
2561
2581
 
2562
2582
  this.c[2].innerHTML = v ? this.onName : this.name;
2563
2583
  } else {
2564
- s = this.s[2];
2565
- s2 = this.s[3];
2566
-
2567
2584
  switch (n) {
2568
2585
  case 1:
2569
- s.background = s.borderColor = cc.back;
2570
- s2.background = cc.button;
2586
+ s[2].background = s[2].borderColor = cc.backoff;
2587
+ s[3].background = cc.button;
2571
2588
  break;
2589
+ // off out
2572
2590
 
2573
2591
  case 2:
2574
- s.background = s.borderColor = cc.select;
2575
- s2.background = cc.button;
2592
+ s[2].background = s[2].borderColor = cc.back;
2593
+ s[3].background = cc.textOver;
2576
2594
  break;
2595
+ // on over
2577
2596
 
2578
2597
  case 3:
2579
- s.background = s.borderColor = cc.back;
2580
- s2.background = cc.overoff;
2598
+ s[2].background = s[2].borderColor = cc.back;
2599
+ s[3].background = cc.overoff;
2581
2600
  break;
2601
+ // off over
2582
2602
 
2583
2603
  case 4:
2584
- s.background = s.borderColor = cc.select;
2585
- s2.background = cc.over;
2604
+ s[2].background = s[2].borderColor = cc.backoff;
2605
+ s[3].background = cc.textSelect;
2586
2606
  break;
2607
+ // on out
2587
2608
  }
2588
2609
 
2589
- this.s[3].marginLeft = v ? '17px' : '2px';
2610
+ s[3].marginLeft = v ? '17px' : '2px';
2590
2611
  this.c[1].textContent = v ? this.onName : this.name;
2591
2612
  }
2592
2613
 
@@ -2789,6 +2810,10 @@
2789
2810
  this.c[n].textContent = string;
2790
2811
  }
2791
2812
 
2813
+ switchValues(n, string) {
2814
+ this.c[n + 2].innerHTML = this.values[n] = string;
2815
+ }
2816
+
2792
2817
  icon(string, y = 0, n = 2) {
2793
2818
  //if(y) this.s[n].margin = ( y ) +'px 0px';
2794
2819
  this.s[n].padding = y + 'px 0px';
@@ -3837,7 +3862,8 @@
3837
3862
  this.current = -1;
3838
3863
  this.proto = null;
3839
3864
  this.isEmpty = true;
3840
- this.decal = o.group ? 8 : 0;
3865
+ this.decal = o.group ? 8 : 0; //this.dd = o.group ? o.group.decal + 8 : 0
3866
+
3841
3867
  this.baseH = this.h;
3842
3868
  let fltop = Math.floor(this.h * 0.5) - 3;
3843
3869
  const cc = this.colors;
@@ -3990,8 +4016,21 @@
3990
4016
  }
3991
4017
  }
3992
4018
 
3993
- let u = this.ADD.apply(this, a); //u.margin += this.margin
4019
+ let u = this.ADD.apply(this, a);
4020
+
4021
+ if (u.isGroup) {
4022
+ //o.add = add;
4023
+ u.dx = 8;
4024
+ } //u.dx += 4
4025
+ //console.log(this.decal)
4026
+ //u.zone.d -= 8
4027
+
4028
+
4029
+ Roots.forceZone = true; //u.margin += this.margin
3994
4030
  //console.log( u.margin )
4031
+ //Roots.needReZone = true
4032
+ //Roots.resize()
4033
+ //console.log(Roots.needResize)
3995
4034
 
3996
4035
  this.uis.push(u);
3997
4036
  this.isEmpty = false;
@@ -4073,7 +4112,8 @@
4073
4112
  s[1].borderBottom = cc.borderSize + 'px solid rgba(0,0,0,0)';
4074
4113
  }
4075
4114
 
4076
- this.parentHeight();
4115
+ this.parentHeight(); //Roots.isLeave = true
4116
+ //Roots.needResize = true
4077
4117
  }
4078
4118
 
4079
4119
  close() {
@@ -6271,8 +6311,23 @@
6271
6311
  class Grid extends Proto {
6272
6312
  constructor(o = {}) {
6273
6313
  super(o);
6274
- this.values = o.values || [];
6275
- if (typeof this.values === 'string') this.values = [this.values];
6314
+ /*this.values = o.values || [];
6315
+ if( typeof this.values === 'string' ) this.values = [ this.values ];*/
6316
+
6317
+ this.values = [];
6318
+
6319
+ if (o.values) {
6320
+ if (o.values instanceof Array) {
6321
+ this.values = o.values;
6322
+ } else if (o.values instanceof String) {
6323
+ this.values = [o.values];
6324
+ } else if (o.values instanceof Object) {
6325
+ this.refObject = o.values;
6326
+
6327
+ for (let g in this.refObject) this.values.push(g);
6328
+ }
6329
+ }
6330
+
6276
6331
  this.lng = this.values.length;
6277
6332
  this.value = o.value || null;
6278
6333
  let cc = this.colors;
@@ -6739,7 +6794,10 @@
6739
6794
  }
6740
6795
 
6741
6796
  let name = type.toLowerCase();
6742
- if (name === 'group') o.add = add;
6797
+
6798
+ if (name === 'group') {
6799
+ o.add = add; //o.dx = 8
6800
+ }
6743
6801
 
6744
6802
  switch (name) {
6745
6803
  case 'bool':