uil 4.0.3 → 4.0.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
@@ -305,7 +305,9 @@
305
305
  u.zone.x = zone.x + px;
306
306
  u.zone.y = py;
307
307
  tw = R.getWidth(u);
308
- if (tw) u.zone.w = u.w = tw; //console.log( u.name, u.zone.w, u.w, zone )
308
+ if (tw) u.zone.w = u.w = tw; // focrce width if content is canvas
309
+ else if (u.fw) u.zone.w = u.w = u.fw; //console.log( u.name, u.zone.w, u.w, zone, tw )
310
+ //console.log( tw )
309
311
 
310
312
  px += u.zone.w;
311
313
 
@@ -359,7 +361,8 @@
359
361
  return over;
360
362
  },
361
363
  getWidth: function (o) {
362
- return o.getDom().offsetWidth; //let r = o.getDom().getBoundingClientRect();
364
+ //return o.getDom().offsetWidth
365
+ return o.getDom().clientWidth; //let r = o.getDom().getBoundingClientRect();
363
366
  //return (r.width)
364
367
  //return Math.floor(r.width)
365
368
  },
@@ -1499,6 +1502,10 @@
1499
1502
  t[1] = "<path id='logoin' fill='" + color + "' stroke='none' d='" + T.logoFill_d + "'/>";
1500
1503
  break;
1501
1504
 
1505
+ case 'donate':
1506
+ t[1] = "<path id='logoin' fill='" + color + "' stroke='none' d='" + T.logo_donate + "'/>";
1507
+ break;
1508
+
1502
1509
  case 'neo':
1503
1510
  t[1] = "<path id='logoin' fill='" + color + "' stroke='none' d='" + T.logo_neo + "'/>";
1504
1511
  break;
@@ -1535,11 +1542,217 @@
1535
1542
  186.75 221 202.95 204.85 219 188.8 219 166 L 219 52 M 194 52 L 181 52 181 166 Q 181 173 176.05 178 171.05 183 164 183 157 183 152 178 147 173 147 166 L 147 90 Q 147
1536
1543
  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
1537
1544
  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
1545
+ `,
1546
+ logo_donate: `
1547
+ 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
1548
+ 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
1549
+ 112.75 111 117.45 L 102.7 169.95 Q 102.45 173.8 105.5 173.85 L 128.95 173.85 Q 132.2 174.2 133.35 169.65 L 138.3 139.95 Q 139.75 135.6 143.1 135.5 146.6 135.75 150.6 135.65
1550
+ 154.55 135.5 157.35 135.1 160.15 134.7 166.75 132.35 181.35 127.4 187.9 111.2 194.25 95.75 189.5 81.95 186.75 74.85 179.8 71.5 M 103.5 209.9 Q 103.5 202.85 99.7 198.85 95.95
1551
+ 194.75 89.4 194.75 82.8 194.75 79.05 198.85 75.3 202.9 75.3 209.9 75.3 216.85 79.05 220.95 82.8 225.05 89.4 225.05 95.95 225.05 99.7 221 103.5 216.95 103.5 209.9 M 95.45 205.5
1552
+ Q 95.95 207.3 95.95 209.9 95.95 212.65 95.45 214.35 94.95 216 94 217.3 93.1 218.45 91.9 219 90.7 219.55 89.4 219.55 88.15 219.55 86.95 219.05 85.75 218.55 84.8 217.3 83.9 216.15
1553
+ 83.4 214.35 82.85 212.6 82.85 209.9 82.85 207.3 83.4 205.45 83.95 203.55 84.85 202.45 85.9 201.2 86.95 200.75 88.05 200.25 89.4 200.25 90.7 200.25 91.85 200.8 93.05 201.3 94 202.5
1554
+ 94.9 203.65 95.45 205.5 M 153.3 195.35 L 145.3 195.35 135.5 224.45 142.8 224.45 144.6 218.5 153.75 218.5 155.6 224.45 163.1 224.45 153.3 195.35 M 152.15 213.25 L 146.25 213.25
1555
+ 149.2 203.65 152.15 213.25 M 116.75 195.35 L 107.8 195.35 107.8 224.45 114.5 224.45 114.5 204.2 125.7 224.45 132.75 224.45 132.75 195.35 126.05 195.35 126.05 212.05 116.75 195.35 M
1556
+ 66.5 197.65 Q 64.15 196.15 61.45 195.75 58.8 195.35 55.75 195.35 L 46.7 195.35 46.7 224.45 55.8 224.45 Q 58.8 224.45 61.5 224.05 64.15 223.6 66.4 222.15 69.15 220.45 70.9 217.2
1557
+ 72.7 214 72.7 209.95 72.7 205.7 71 202.6 69.35 199.5 66.5 197.65 M 64.2 205 Q 65.2 207 65.2 209.9 65.2 212.75 64.25 214.75 63.3 216.75 61.5 217.85 60 218.85 58.3 218.9 56.6 219
1558
+ 54.15 219 L 54 219 54 200.8 54.15 200.8 Q 56.4 200.8 58.05 200.9 59.7 200.95 61.15 201.75 63.2 202.95 64.2 205 M 210.2 195.35 L 190.5 195.35 190.5 224.45 210.2 224.45 210.2 218.9
1559
+ 197.75 218.9 197.75 211.55 209.2 211.55 209.2 206 197.75 206 197.75 200.9 210.2 200.9 210.2 195.35 M 187.5 195.35 L 163 195.35 163 200.9 171.6 200.9 171.6 224.45 178.9 224.45 178.9
1560
+ 200.9 187.5 200.9 187.5 195.35 Z
1538
1561
  `
1539
1562
  };
1540
1563
  T.setText();
1541
1564
  const Tools = T;
1542
1565
 
1566
+ ///https://wicg.github.io/file-system-access/#api-filesystemfilehandle-getfile
1567
+ class Files {
1568
+ //-----------------------------
1569
+ // FILE TYPE
1570
+ //-----------------------------
1571
+ static autoTypes(type) {
1572
+ let t = [];
1573
+
1574
+ switch (type) {
1575
+ case 'json':
1576
+ t = [{
1577
+ accept: {
1578
+ 'image/svg+xml': '.svg'
1579
+ }
1580
+ }];
1581
+ break;
1582
+
1583
+ case 'text':
1584
+ t = [{
1585
+ description: 'Text Files',
1586
+ accept: {
1587
+ 'text/plain': ['.txt', '.text'],
1588
+ 'text/html': ['.html', '.htm']
1589
+ }
1590
+ }];
1591
+ break;
1592
+
1593
+ case 'json':
1594
+ t = [{
1595
+ description: 'JSON Files',
1596
+ accept: {
1597
+ 'text/plain': ['.json']
1598
+ }
1599
+ }];
1600
+ break;
1601
+
1602
+ case 'image':
1603
+ t = [{
1604
+ description: 'Images',
1605
+ accept: {
1606
+ 'image/*': ['.png', '.gif', '.jpeg', '.jpg']
1607
+ }
1608
+ }];
1609
+ break;
1610
+ }
1611
+
1612
+ return t;
1613
+ } //-----------------------------
1614
+ // LOAD
1615
+ //-----------------------------
1616
+
1617
+
1618
+ static async load(o = {}) {
1619
+ if (typeof window.showOpenFilePicker !== 'function') {
1620
+ window.showOpenFilePicker = this.showOpenFilePickerPolyfill;
1621
+ }
1622
+
1623
+ try {
1624
+ let type = o.type || '';
1625
+ const options = {
1626
+ excludeAcceptAllOption: type ? true : false,
1627
+ multiple: false //startIn:'./assets'
1628
+
1629
+ };
1630
+ options.types = this.autoTypes(type); // create a new handle
1631
+
1632
+ const handle = await window.showOpenFilePicker(options);
1633
+ const file = await handle[0].getFile(); //let content = await file.text()
1634
+
1635
+ if (!file) return null;
1636
+ let fname = file.name;
1637
+ let ftype = fname.substring(fname.lastIndexOf('.') + 1, fname.length);
1638
+ const dataUrl = ['png', 'jpg', 'jpeg', 'mp4', 'webm', 'ogg', 'mp3'];
1639
+ const dataBuf = ['sea', 'z', 'hex', 'bvh', 'BVH', 'glb', 'gltf'];
1640
+ const reader = new FileReader();
1641
+ if (dataUrl.indexOf(ftype) !== -1) reader.readAsDataURL(file);else if (dataBuf.indexOf(ftype) !== -1) reader.readAsArrayBuffer(file);else reader.readAsText(file);
1642
+
1643
+ reader.onload = function (e) {
1644
+ let content = e.target.result;
1645
+
1646
+ if (type === 'image') {
1647
+ var img = new Image();
1648
+
1649
+ img.onload = function () {
1650
+ if (o.callback) o.callback(img, fname);
1651
+ };
1652
+
1653
+ img.src = content;
1654
+ } else {
1655
+ if (o.callback) o.callback(content, fname);
1656
+ }
1657
+ };
1658
+ } catch (e) {
1659
+ console.log(e);
1660
+ }
1661
+ }
1662
+
1663
+ static showOpenFilePickerPolyfill(options) {
1664
+ return new Promise(resolve => {
1665
+ const input = document.createElement("input");
1666
+ input.type = "file";
1667
+ input.multiple = options.multiple;
1668
+ input.accept = options.types.map(type => type.accept).flatMap(inst => Object.keys(inst).flatMap(key => inst[key])).join(",");
1669
+ input.addEventListener("change", () => {
1670
+ resolve([...input.files].map(file => {
1671
+ return {
1672
+ getFile: async () => new Promise(resolve => {
1673
+ resolve(file);
1674
+ })
1675
+ };
1676
+ }));
1677
+ });
1678
+ input.click();
1679
+ });
1680
+ } //-----------------------------
1681
+ // SAVE
1682
+ //-----------------------------
1683
+
1684
+
1685
+ static async save(o = {}) {
1686
+ this.usePoly = false;
1687
+
1688
+ if (typeof window.showSaveFilePicker !== 'function') {
1689
+ window.showSaveFilePicker = this.showSaveFilePickerPolyfill;
1690
+ this.usePoly = true;
1691
+ }
1692
+
1693
+ try {
1694
+ let type = o.type || '';
1695
+ const options = {
1696
+ suggestedName: o.name || 'hello',
1697
+ data: o.data || ''
1698
+ };
1699
+ options.types = this.autoTypes(type);
1700
+ options.finalType = Object.keys(options.types[0].accept)[0];
1701
+ options.suggestedName += options.types[0].accept[options.finalType][0]; // create a new handle
1702
+
1703
+ const handle = await window.showSaveFilePicker(options);
1704
+ if (this.usePoly) return; // create a FileSystemWritableFileStream to write to
1705
+
1706
+ const file = await handle.createWritable();
1707
+ let blob = new Blob([options.data], {
1708
+ type: option.finalType
1709
+ }); // write our file
1710
+
1711
+ await file.write(blob); // close the file and write the contents to disk.
1712
+
1713
+ await file.close();
1714
+ } catch (e) {
1715
+ console.log(e);
1716
+ }
1717
+ }
1718
+
1719
+ static showSaveFilePickerPolyfill(options) {
1720
+ return new Promise(resolve => {
1721
+ const a = document.createElement("a");
1722
+ a.download = options.suggestedName || "my-file.txt";
1723
+ let blob = new Blob([options.data], {
1724
+ type: options.finalType
1725
+ });
1726
+ a.href = URL.createObjectURL(blob);
1727
+ a.addEventListener("click", () => {
1728
+ resolve(setTimeout(() => URL.revokeObjectURL(a.href), 1000));
1729
+ });
1730
+ a.click();
1731
+ });
1732
+ } //-----------------------------
1733
+ // FOLDER not possible in poly
1734
+ //-----------------------------
1735
+
1736
+
1737
+ static async getFolder() {
1738
+ try {
1739
+ const handle = await window.showDirectoryPicker();
1740
+ const files = [];
1741
+
1742
+ for await (const entry of handle.values()) {
1743
+ const file = await entry.getFile();
1744
+ files.push(file);
1745
+ }
1746
+
1747
+ console.log(files);
1748
+ return files;
1749
+ } catch (e) {
1750
+ console.log(e);
1751
+ }
1752
+ }
1753
+
1754
+ }
1755
+
1543
1756
  class V2 {
1544
1757
  constructor(x = 0, y = 0) {
1545
1758
  this.x = x;
@@ -1651,9 +1864,7 @@
1651
1864
  this.main = o.main || null;
1652
1865
  this.isUI = o.isUI || false;
1653
1866
  this.group = o.group || null;
1654
- this.isListen = false; //this.parentGroup = null;
1655
- //if( o.select !== undefined ) o.selectable = o.select
1656
-
1867
+ this.isListen = false;
1657
1868
  this.isSelectable = o.selectable !== undefined ? o.selectable : false;
1658
1869
  this.unselectable = o.unselect !== undefined ? o.unselect : this.isSelectable;
1659
1870
  this.ontop = o.ontop ? o.ontop : false; // 'beforebegin' 'afterbegin' 'beforeend' 'afterend'
@@ -1676,7 +1887,9 @@
1676
1887
  if (o.w !== undefined) this.w = o.w;
1677
1888
  this.h = this.isUI ? this.main.size.h : Tools.size.h;
1678
1889
  if (o.h !== undefined) this.h = o.h;
1679
- if (!this.isSpace) this.h = this.h < 11 ? 11 : this.h;else this.lock = true;
1890
+ if (!this.isSpace) this.h = this.h < 11 ? 11 : this.h;else this.lock = true; // decale for canvas only
1891
+
1892
+ this.fw = o.fw || 0;
1680
1893
  this.autoWidth = o.auto || true; // auto width or flex
1681
1894
 
1682
1895
  this.isOpen = false; // open statu
@@ -1723,13 +1936,10 @@
1723
1936
 
1724
1937
  this.c = []; // style
1725
1938
 
1726
- this.s = []; //this.c[0] = Tools.dom( 'div', this.css.basic + this.css.button +'align-self:stretch; position:relative; height:20px; overflow:hidden;'); //float:left;
1727
- //this.c[0] = Tools.dom( 'div', 'order: 1;' ); //
1728
-
1939
+ this.s = [];
1729
1940
  this.useFlex = this.isUI ? this.main.useFlex : false;
1730
- let flexible = this.useFlex ? 'disply:flex; justify-content:center; align-items:center; text-align:center; flex: 1 100%;' : 'float:left;';
1731
- this.c[0] = Tools.dom('div', this.css.basic + flexible + 'position:relative; height:20px;'); //this.c[0] = Tools.dom( 'div', this.css.basic +'position:relative; height:20px; align-self: auto;');
1732
-
1941
+ let flexible = this.useFlex ? 'display:flex; justify-content:center; align-items:center; text-align:center; flex: 1 100%;' : 'float:left;';
1942
+ this.c[0] = Tools.dom('div', this.css.basic + flexible + 'position:relative; height:20px;');
1733
1943
  this.s[0] = this.c[0].style; // bottom margin
1734
1944
 
1735
1945
  this.margin = o.margin || 1;
@@ -2092,14 +2302,7 @@
2092
2302
 
2093
2303
  keyup(e) {
2094
2304
  return false;
2095
- }
2096
- /*dragstart ( e ) { return false; }
2097
- dragover ( e ) { return false; }
2098
- dragenter ( e ) { return false; }
2099
- dragleave ( e ) { return false; }
2100
- dragend ( e ) { return false; }
2101
- drop ( e ) { return false; }*/
2102
- // ----------------------
2305
+ } // ----------------------
2103
2306
  // object referency
2104
2307
  // ----------------------
2105
2308
 
@@ -2109,9 +2312,8 @@
2109
2312
  this.val = val;
2110
2313
  }
2111
2314
 
2112
- display(v) {
2113
- v = v || false;
2114
- this.s[0].visibility = v ? 'visible' : 'hidden'; //this.s[0].display = v ? (this.useFlex? 'flex':'block') : 'none'
2315
+ display(v = false) {
2316
+ this.s[0].visibility = v ? 'visible' : 'hidden';
2115
2317
  } // ----------------------
2116
2318
  // resize height
2117
2319
  // ----------------------
@@ -2313,15 +2515,15 @@
2313
2515
  this.values = o.value || this.txt;
2314
2516
  if (o.values) this.values = o.values;
2315
2517
  this.onName = o.onName || null;
2316
- this.on = false;
2317
- this.customSize = o.forceWidth || -1;
2518
+ this.on = false; // force button width
2519
+
2520
+ this.bw = o.forceWidth || 0;
2521
+ if (o.bw) this.bw = o.bw;
2522
+ this.space = o.space || 3;
2318
2523
  if (typeof this.values === 'string') this.values = [this.values];
2319
2524
  this.isDown = false;
2320
2525
  this.neverlock = true;
2321
- this.isLoadButton = o.loader || false;
2322
- this.isDragButton = o.drag || false;
2323
2526
  this.res = 0;
2324
- if (this.isDragButton) this.isLoadButton = true;
2325
2527
  this.lng = this.values.length;
2326
2528
  this.tmp = [];
2327
2529
  this.stat = [];
@@ -2338,22 +2540,14 @@
2338
2540
  this.stat[i] = sel ? 3 : 1;
2339
2541
  }
2340
2542
 
2341
- if (!o.value || !o.values) {
2342
- if (this.c[1] !== undefined) this.c[1].textContent = '';
2343
- this.p = o.p !== undefined ? o.p : 0;
2344
- } else {
2345
- if (!this.txt) this.p = 0;
2346
- } //
2347
-
2348
-
2349
- if (this.isLoadButton) this.initLoader();
2350
-
2351
- if (this.isDragButton) {
2352
- this.lng++;
2353
- this.initDrager();
2354
- } //if( this.onName !== '' ) this.values[0] = this.on;
2355
-
2543
+ if (!o.value && !o.values) {
2544
+ if (this.c[1] !== undefined) {
2545
+ this.c[1].textContent = '';
2546
+ this.txt = '';
2547
+ }
2548
+ }
2356
2549
 
2550
+ if (!this.txt) this.p = 0;
2357
2551
  this.init();
2358
2552
  }
2359
2553
 
@@ -2385,7 +2579,7 @@
2385
2579
  if (this.res !== -1) {
2386
2580
  if (this.value === this.values[this.res] && this.unselectable) this.value = '';else this.value = this.values[this.res];
2387
2581
  if (this.onName !== null) this.onOff();
2388
- if (!this.isLoadButton) this.send();
2582
+ this.send();
2389
2583
  }
2390
2584
 
2391
2585
  return this.mousemove(e);
@@ -2437,6 +2631,7 @@
2437
2631
  }
2438
2632
 
2439
2633
  mode(n, id) {
2634
+ //if(!this.s) return false
2440
2635
  let change = false;
2441
2636
  let cc = this.colors,
2442
2637
  s = this.s;
@@ -2478,81 +2673,6 @@
2478
2673
  this.res = -1;
2479
2674
  this.cursor();
2480
2675
  return this.modes();
2481
- } // ----------------------
2482
-
2483
-
2484
- dragover(e) {
2485
- e.preventDefault();
2486
- this.s[4].borderColor = this.colors.select;
2487
- this.s[4].color = this.colors.select;
2488
- }
2489
-
2490
- dragend(e) {
2491
- e.preventDefault();
2492
- this.s[4].borderColor = this.color.text;
2493
- this.s[4].color = this.color.text;
2494
- }
2495
-
2496
- drop(e) {
2497
- e.preventDefault();
2498
- this.dragend(e);
2499
- this.fileSelect(e.dataTransfer.files[0]);
2500
- }
2501
-
2502
- initDrager() {
2503
- this.c[4] = this.dom('div', this.css.txt + ' text-align:center; line-height:' + (this.h - 8) + 'px; border:1px dashed ' + this.color.text + '; top:2px; height:' + (this.h - 4) + 'px; border-radius:' + this.radius + 'px; pointer-events:auto;'); // cursor:default;
2504
-
2505
- this.c[4].textContent = 'DRAG';
2506
- this.c[4].addEventListener('dragover', function (e) {
2507
- this.dragover(e);
2508
- }.bind(this), false);
2509
- this.c[4].addEventListener('dragend', function (e) {
2510
- this.dragend(e);
2511
- }.bind(this), false);
2512
- this.c[4].addEventListener('dragleave', function (e) {
2513
- this.dragend(e);
2514
- }.bind(this), false);
2515
- this.c[4].addEventListener('drop', function (e) {
2516
- this.drop(e);
2517
- }.bind(this), false); //this.c[2].events = [ ];
2518
- //this.c[4].events = [ 'dragover', 'dragend', 'dragleave', 'drop' ];
2519
- }
2520
-
2521
- initLoader() {
2522
- this.c[3] = this.dom('input', this.css.basic + 'top:0px; opacity:0; height:' + this.h + 'px; pointer-events:auto; cursor:pointer;'); //
2523
-
2524
- this.c[3].name = 'loader';
2525
- this.c[3].type = "file";
2526
- this.c[3].addEventListener('change', function (e) {
2527
- this.fileSelect(e.target.files[0]);
2528
- }.bind(this), false); //this.c[3].addEventListener( 'mousedown', function(e){ }.bind(this), false );
2529
- //this.c[2].events = [ ];
2530
- //this.c[3].events = [ 'change', 'mouseover', 'mousedown', 'mouseup', 'mouseout' ];
2531
- //this.hide = document.createElement('input');
2532
- }
2533
-
2534
- fileSelect(file) {
2535
- let dataUrl = ['png', 'jpg', 'mp4', 'webm', 'ogg'];
2536
- let dataBuf = ['sea', 'z', 'hex', 'bvh', 'BVH', 'glb']; //if( ! e.target.files ) return;
2537
- //let file = e.target.files[0];
2538
- //this.c[3].type = "null";
2539
- // console.log( this.c[4] )
2540
-
2541
- if (file === undefined) return;
2542
- let reader = new FileReader();
2543
- let fname = file.name;
2544
- let type = fname.substring(fname.lastIndexOf('.') + 1, fname.length);
2545
- if (dataUrl.indexOf(type) !== -1) reader.readAsDataURL(file);else if (dataBuf.indexOf(type) !== -1) reader.readAsArrayBuffer(file); //reader.readAsArrayBuffer( file );
2546
- else reader.readAsText(file); // if( type === 'png' || type === 'jpg' || type === 'mp4' || type === 'webm' || type === 'ogg' ) reader.readAsDataURL( file );
2547
- //else if( type === 'z' ) reader.readAsBinaryString( file );
2548
- //else if( type === 'sea' || type === 'bvh' || type === 'BVH' || type === 'z') reader.readAsArrayBuffer( file );
2549
- //else if( ) reader.readAsArrayBuffer( file );
2550
- //else reader.readAsText( file );
2551
-
2552
- reader.onload = function (e) {
2553
- if (this.callback) this.callback(e.target.result, fname, type); //this.c[3].type = "file";
2554
- //this.send( e.target.result );
2555
- }.bind(this);
2556
2676
  }
2557
2677
 
2558
2678
  label(string, n) {
@@ -2573,11 +2693,12 @@
2573
2693
  let w = this.sb;
2574
2694
  let d = this.sa;
2575
2695
  let i = this.lng;
2576
- let dc = 3;
2696
+ let dc = this.space;
2577
2697
  let size = Math.floor((w - dc * (i - 1)) / i);
2578
2698
 
2579
- if (this.customSize !== -1) {
2580
- size = this.customSize; // d = (this.s-size)*0.5
2699
+ if (this.bw) {
2700
+ size = this.bw < size ? this.bw : size;
2701
+ d = Math.floor((this.w - (size * i + dc * (i - 1))) * 0.5);
2581
2702
  }
2582
2703
 
2583
2704
  while (i--) {
@@ -2586,16 +2707,6 @@
2586
2707
  s[i + 2].left = this.tmp[i][0] + 'px';
2587
2708
  s[i + 2].width = this.tmp[i][1] + 'px';
2588
2709
  }
2589
-
2590
- if (this.isDragButton) {
2591
- s[4].left = d + size + dc + 'px';
2592
- s[4].width = size + 'px';
2593
- }
2594
-
2595
- if (this.isLoadButton) {
2596
- s[3].left = d + 'px';
2597
- s[3].width = size + 'px';
2598
- }
2599
2710
  }
2600
2711
 
2601
2712
  }
@@ -2798,9 +2909,9 @@
2798
2909
  this.s[2].top = 'auto';
2799
2910
  this.s[2].bottom = '2px';
2800
2911
  } //this.c[0].style.textAlign = 'center';
2801
- //this.c[0].style.flex = '1 0 auto'
2802
2912
 
2803
2913
 
2914
+ this.c[0].style.display = 'block';
2804
2915
  this.c[3] = this.getColorRing();
2805
2916
  this.c[3].style.visibility = 'hidden';
2806
2917
  this.hsl = null;
@@ -3600,11 +3711,11 @@
3600
3711
  super(o);
3601
3712
  this.isGroup = true;
3602
3713
  this.ADD = o.add;
3603
- this.uis = [];
3604
- this.isEmpty = true;
3605
3714
  this.autoHeight = true;
3715
+ this.uis = [];
3606
3716
  this.current = -1;
3607
- this.targetIn = null;
3717
+ this.proto = null;
3718
+ this.isEmpty = true;
3608
3719
  this.decal = 0;
3609
3720
  this.baseH = this.h;
3610
3721
  let fltop = Math.floor(this.h * 0.5) - 6;
@@ -3640,17 +3751,10 @@
3640
3751
  s[1].lineHeight = this.h - 4;
3641
3752
  s[1].color = this.colors.text;
3642
3753
  s[1].fontWeight = 'bold';
3643
- if (this.radius !== 0) s[0].borderRadius = this.radius + 'px'; //if( o.border ) s[0].border = '1px solid ' + o.border;
3644
-
3645
- /*if(this.decal){
3646
- s[0].boxSizing = 'border-box';
3647
- s[0].backgroundClip = 'border-box';
3648
- s[0].border = (this.decal/3)+'px solid ' + o.group.colors.background;
3649
- }*/
3650
-
3754
+ if (this.radius !== 0) s[0].borderRadius = this.radius + 'px';
3651
3755
  this.init();
3652
3756
  this.setBG(o.bg);
3653
- if (o.open !== undefined) this.open(); //s[0].background = this.bg;
3757
+ if (o.open !== undefined) this.open();
3654
3758
  }
3655
3759
 
3656
3760
  testZone(e) {
@@ -3664,12 +3768,16 @@
3664
3768
  }
3665
3769
 
3666
3770
  clearTarget() {
3667
- if (this.current === -1) return false; // if(!this.targetIn ) return;
3771
+ if (this.current === -1) return false;
3668
3772
 
3669
- this.targetIn.uiout();
3670
- this.targetIn.reset();
3773
+ if (this.proto.s) {
3774
+ // if no s target is delete !!
3775
+ this.proto.uiout();
3776
+ this.proto.reset();
3777
+ }
3778
+
3779
+ this.proto = null;
3671
3780
  this.current = -1;
3672
- this.targetIn = null;
3673
3781
  this.cursor();
3674
3782
  return true;
3675
3783
  }
@@ -3684,7 +3792,7 @@
3684
3792
  handleEvent(e) {
3685
3793
  let type = e.type;
3686
3794
  let change = false;
3687
- let targetChange = false;
3795
+ let protoChange = false;
3688
3796
  let name = this.testZone(e);
3689
3797
  if (!name) return;
3690
3798
 
@@ -3692,8 +3800,7 @@
3692
3800
  case 'content':
3693
3801
  this.cursor();
3694
3802
  if (Roots.isMobile && type === 'mousedown') this.getNext(e, change);
3695
- if (this.targetIn) targetChange = this.targetIn.handleEvent(e); //if( type === 'mousemove' ) change = this.styles('def');
3696
-
3803
+ if (this.proto) protoChange = this.proto.handleEvent(e);
3697
3804
  if (!Roots.lock) this.getNext(e, change);
3698
3805
  break;
3699
3806
 
@@ -3708,7 +3815,7 @@
3708
3815
  }
3709
3816
 
3710
3817
  if (this.isDown) change = true;
3711
- if (targetChange) change = true;
3818
+ if (protoChange) change = true;
3712
3819
  return change;
3713
3820
  }
3714
3821
 
@@ -3721,30 +3828,11 @@
3721
3828
  }
3722
3829
 
3723
3830
  if (next !== -1) {
3724
- this.targetIn = this.uis[this.current];
3725
- this.targetIn.uiover();
3831
+ this.proto = this.uis[this.current];
3832
+ this.proto.uiover();
3726
3833
  }
3727
3834
  } // ----------------------
3728
3835
 
3729
- /*calcH () {
3730
- let lng = this.uis.length, i, u, h=0, px=0, tmph=0;
3731
- for( i = 0; i < lng; i++){
3732
- u = this.uis[i];
3733
- if( !u.autoWidth ){
3734
- if(px===0) h += u.h+1;
3735
- else {
3736
- if(tmph<u.h) h += u.h-tmph;
3737
- }
3738
- tmph = u.h;
3739
- //tmph = tmph < u.h ? u.h : tmph;
3740
- px += u.w;
3741
- if( px+u.w > this.w ) px = 0;
3742
- }
3743
- else h += u.h+1;
3744
- }
3745
- return h;
3746
- }*/
3747
-
3748
3836
 
3749
3837
  setBG(bg) {
3750
3838
  if (bg !== undefined) this.colors.background = bg;
@@ -3775,12 +3863,10 @@
3775
3863
  a[2].main = this.main;
3776
3864
  a[2].group = this;
3777
3865
  }
3778
- } //let n = add.apply( this, a );
3779
-
3866
+ }
3780
3867
 
3781
3868
  let u = this.ADD.apply(this, a);
3782
- this.uis.push(u); //this.calc()
3783
-
3869
+ this.uis.push(u);
3784
3870
  this.isEmpty = false;
3785
3871
  return u;
3786
3872
  } // remove one node
@@ -3794,7 +3880,7 @@
3794
3880
  dispose() {
3795
3881
  this.clear();
3796
3882
  if (this.isUI) this.main.calc();
3797
- super.dispose(); //Proto.prototype.clear.call( this );
3883
+ super.dispose();
3798
3884
  }
3799
3885
 
3800
3886
  clear() {
@@ -3851,9 +3937,7 @@
3851
3937
 
3852
3938
  calcUis() {
3853
3939
  if (!this.isOpen) this.h = this.baseH;else this.h = Roots.calcUis(this.uis, this.zone, this.zone.y + this.baseH) + this.baseH;
3854
- this.s[0].height = this.h + 'px'; //console.log('G', this.h)
3855
- //if( !this.isOpen ) return;
3856
- //this.h = Roots.calcUis( this.uis, this.zone, this.zone.y + this.baseH )+this.baseH;
3940
+ this.s[0].height = this.h + 'px';
3857
3941
  }
3858
3942
 
3859
3943
  parentHeight(t) {
@@ -3862,16 +3946,6 @@
3862
3946
 
3863
3947
  calc(y) {
3864
3948
  if (!this.isOpen) return;
3865
- /*
3866
- if( y !== undefined ){
3867
- this.h += y;
3868
- if( this.isUI ) this.main.calc( y );
3869
- } else {
3870
- this.h = this.calcH() + this.baseH;
3871
- }
3872
- this.s[0].height = this.h + 'px';*/
3873
- // if(this.isOpen)
3874
-
3875
3949
  if (this.isUI) this.main.calc();else this.calcUis();
3876
3950
  this.s[0].height = this.h + 'px';
3877
3951
  }
@@ -3882,8 +3956,7 @@
3882
3956
  while (i--) {
3883
3957
  this.uis[i].setSize(this.w);
3884
3958
  this.uis[i].rSize();
3885
- } //this.calc()
3886
-
3959
+ }
3887
3960
  }
3888
3961
 
3889
3962
  rSize() {
@@ -6364,8 +6437,7 @@
6364
6437
  // like dat gui
6365
6438
  ref = true;
6366
6439
  if (a[2] === undefined) [].push.call(a, {});
6367
- type = a[2].type ? a[2].type : 'slide'; //autoType.apply( this, a );
6368
-
6440
+ type = a[2].type ? a[2].type : autoType(a[0][a[1]], a[2]);
6369
6441
  o = a[2];
6370
6442
  o.name = a[1];
6371
6443
 
@@ -6379,6 +6451,7 @@
6379
6451
 
6380
6452
  switch (name) {
6381
6453
  case 'bool':
6454
+ case 'boolean':
6382
6455
  n = new Bool(o);
6383
6456
  break;
6384
6457
 
@@ -6469,6 +6542,19 @@
6469
6542
  return n;
6470
6543
  }
6471
6544
  };
6545
+ const autoType = function (v, o) {
6546
+ let type = 'slide';
6547
+ if (typeof v === 'boolean') type = 'bool';else if (typeof v === 'string') {
6548
+ if (v.substring(0, 1) === '#') type = 'color';else type = 'string';
6549
+ } else if (typeof v === 'number') {
6550
+ if (o.ctype) type = 'color';else type = 'slide';
6551
+ } else if (typeof v === 'array' && v instanceof Array) {
6552
+ if (typeof v[0] === 'number') type = 'number';else if (typeof v[0] === 'string') type = 'list';
6553
+ } else if (typeof v === 'object' && v instanceof Object) {
6554
+ if (v.x !== undefined) type = 'number';else type = 'list';
6555
+ }
6556
+ return type;
6557
+ };
6472
6558
 
6473
6559
  /**
6474
6560
  * @author lth / https://github.com/lo-th
@@ -6481,8 +6567,7 @@
6481
6567
 
6482
6568
  this.canvas = null;
6483
6569
  this.screen = null;
6484
- this.plane = o.plane || null;
6485
- this.isEmpty = true; // color
6570
+ this.plane = o.plane || null; // color
6486
6571
 
6487
6572
  if (o.config) o.colors = o.config;
6488
6573
  if (o.colors) this.setConfig(o.colors);else this.colors = Tools.defineColor(o); // style
@@ -6530,7 +6615,8 @@
6530
6615
  this.isScroll = false;
6531
6616
  this.uis = [];
6532
6617
  this.current = -1;
6533
- this.target = null;
6618
+ this.proto = null;
6619
+ this.isEmpty = true;
6534
6620
  this.decal = 0;
6535
6621
  this.ratio = 1;
6536
6622
  this.oy = 0;
@@ -6573,6 +6659,8 @@
6573
6659
  if (!this.isCanvasOnly) {
6574
6660
  this.content.style.pointerEvents = 'auto';
6575
6661
  } else {
6662
+ this.content.style.left = '0px';
6663
+ this.content.style.right = 'auto';
6576
6664
  o.transition = 0;
6577
6665
  } // height transition
6578
6666
 
@@ -6607,7 +6695,7 @@
6607
6695
  makeCanvas() {
6608
6696
  this.canvas = document.createElementNS('http://www.w3.org/1999/xhtml', "canvas");
6609
6697
  this.canvas.width = this.zone.w;
6610
- this.canvas.height = this.forceHeight ? this.forceHeight : this.zone.h;
6698
+ this.canvas.height = this.forceHeight ? this.forceHeight : this.zone.h; //console.log( this.canvas.width, this.canvas.height )
6611
6699
  }
6612
6700
 
6613
6701
  draw(force) {
@@ -6647,7 +6735,11 @@
6647
6735
  }
6648
6736
 
6649
6737
  hide(b) {
6650
- this.content.style.display = b ? 'none' : 'block';
6738
+ this.content.style.visibility = b ? 'hidden' : 'visible';
6739
+ }
6740
+
6741
+ display(v = false) {
6742
+ this.content.style.visibility = v ? 'visible' : 'hidden';
6651
6743
  }
6652
6744
 
6653
6745
  onChange(f) {
@@ -6702,11 +6794,15 @@
6702
6794
 
6703
6795
 
6704
6796
  clearTarget() {
6705
- if (this.current === -1) return false; //if(!this.target) return;
6797
+ if (this.current === -1) return false;
6706
6798
 
6707
- this.target.uiout();
6708
- this.target.reset();
6709
- this.target = null;
6799
+ if (this.proto.s) {
6800
+ // if no s target is delete !!
6801
+ this.proto.uiout();
6802
+ this.proto.reset();
6803
+ }
6804
+
6805
+ this.proto = null;
6710
6806
  this.current = -1; ///console.log(this.isDown)//if(this.isDown)Roots.clearInput();
6711
6807
 
6712
6808
  Roots.cursor();
@@ -6732,7 +6828,7 @@
6732
6828
  handleEvent(e) {
6733
6829
  let type = e.type;
6734
6830
  let change = false;
6735
- let targetChange = false;
6831
+ let protoChange = false;
6736
6832
  let name = this.testZone(e);
6737
6833
  if (type === 'mouseup' && this.isDown) this.isDown = false;
6738
6834
  if (type === 'mousedown' && !this.isDown) this.isDown = true;
@@ -6748,9 +6844,9 @@
6748
6844
  case 'content':
6749
6845
  e.clientY = this.isScroll ? e.clientY + this.decal : e.clientY;
6750
6846
  if (Roots.isMobile && type === 'mousedown') this.getNext(e, change);
6751
- if (this.target) targetChange = this.target.handleEvent(e);
6847
+ if (this.proto) protoChange = this.proto.handleEvent(e);
6752
6848
  if (type === 'mousemove') change = this.mode('def');
6753
- if (type === 'wheel' && !targetChange && this.isScroll) change = this.onWheel(e);
6849
+ if (type === 'wheel' && !protoChange && this.isScroll) change = this.onWheel(e);
6754
6850
 
6755
6851
  if (!Roots.lock) {
6756
6852
  this.getNext(e, change);
@@ -6783,7 +6879,7 @@
6783
6879
  }
6784
6880
 
6785
6881
  if (this.isDown) change = true;
6786
- if (targetChange) change = true;
6882
+ if (protoChange) change = true;
6787
6883
  if (type === 'keyup') change = true;
6788
6884
  if (type === 'keydown') change = true;
6789
6885
  if (change) this.draw();
@@ -6799,8 +6895,8 @@
6799
6895
  }
6800
6896
 
6801
6897
  if (next !== -1) {
6802
- this.target = this.uis[this.current];
6803
- this.target.uiover();
6898
+ this.proto = this.uis[this.current];
6899
+ this.proto.uiover();
6804
6900
  }
6805
6901
  }
6806
6902
 
@@ -6842,40 +6938,23 @@
6842
6938
  main: this
6843
6939
  });else {
6844
6940
  a[2].isUI = true;
6845
- a[2].main = this;
6846
- ontop = a[1].ontop ? a[1].ontop : false;
6941
+ a[2].main = this; //ontop = a[1].ontop ? a[1].ontop : false;
6942
+
6943
+ ontop = a[2].ontop ? a[2].ontop : false;
6847
6944
  }
6848
6945
  }
6849
6946
 
6850
6947
  let u = add.apply(this, a);
6851
6948
  if (u === null) return;
6852
6949
  if (ontop) this.uis.unshift(u);else this.uis.push(u);
6853
- /*if( !u.autoWidth ){
6854
- let y = u.c[0].getBoundingClientRect().top;
6855
- if( this.prevY !== y ){
6856
- this.calc( u.h + 1 );
6857
- this.prevY = y;
6858
- }
6859
- }else{
6860
- this.prevY = 0;//-1;
6861
- this.calc( u.h + 1 );
6862
- }*/
6863
-
6864
6950
  this.calc();
6865
6951
  this.isEmpty = false;
6866
6952
  return u;
6867
- }
6868
- /*applyCalc () {
6869
- //console.log(this.uis.length, this.tmpH )
6870
- this.calc( this.tmpH );
6871
- //this.tmpH = 0;
6872
- this.tmpAdd = null;
6873
- }*/
6874
- // remove one node
6953
+ } // remove one node
6875
6954
 
6876
6955
 
6877
6956
  remove(n) {
6878
- if (n.clear) n.clear();
6957
+ if (n.dispose) n.dispose();
6879
6958
  } // call after uis clear
6880
6959
 
6881
6960
 
@@ -6899,14 +6978,11 @@
6899
6978
  while (i--) {
6900
6979
  item = this.uis.pop();
6901
6980
  this.inner.removeChild(item.c[0]);
6902
- item.dispose(); //this.uis[i].clear()
6981
+ item.dispose();
6903
6982
  }
6904
6983
 
6905
6984
  this.uis = [];
6906
- this.isEmpty = true; //this.zone = { x:0, y:0, w:this.size.w, h:0 };
6907
- //this.setWidth()
6908
- //Roots.listens = [];
6909
-
6985
+ this.isEmpty = true;
6910
6986
  this.calc();
6911
6987
  }
6912
6988
 
@@ -6962,8 +7038,7 @@
6962
7038
  this.total = this.h;
6963
7039
  this.maxView = this.maxHeight;
6964
7040
  this.ratio = this.maxView / this.total;
6965
- this.sh = this.maxView * this.ratio; //if( this.sh < 20 ) this.sh = 20;
6966
-
7041
+ this.sh = this.maxView * this.ratio;
6967
7042
  this.range = this.maxView - this.sh;
6968
7043
  this.oy = Tools.clamp(this.oy, 0, this.range);
6969
7044
  this.scrollBG.style.height = this.maxView + 'px';
@@ -7006,7 +7081,6 @@
7006
7081
  let diff = this.h - this.maxHeight;
7007
7082
 
7008
7083
  if (diff > 1) {
7009
- //this.h > this.maxHeight ){
7010
7084
  this.isScroll = true;
7011
7085
  this.zone.h = this.maxHeight + this.bh;
7012
7086
  } else {
@@ -7018,9 +7092,8 @@
7018
7092
  this.innerContent.style.height = this.zone.h - this.bh + 'px';
7019
7093
  this.content.style.height = this.zone.h + 'px';
7020
7094
  this.bottom.style.top = this.zone.h - this.bh + 'px';
7021
- if (this.forceHeight && this.lockHeight) this.content.style.height = this.forceHeight + 'px'; //if( this.isOpen ) this.calcUis()
7022
-
7023
- if (this.isCanvas) this.draw(true); //else if( !this.transition ) this.rezone()
7095
+ if (this.forceHeight && this.lockHeight) this.content.style.height = this.forceHeight + 'px';
7096
+ if (this.isCanvas) this.draw(true);
7024
7097
  }
7025
7098
 
7026
7099
  rezone() {
@@ -7029,14 +7102,10 @@
7029
7102
 
7030
7103
  setWidth(w) {
7031
7104
  if (w) this.zone.w = w;
7032
- this.zone.w = Math.floor(this.zone.w); //console.log( this.zone.w )
7033
-
7105
+ this.zone.w = Math.floor(this.zone.w);
7034
7106
  this.content.style.width = this.zone.w + 'px';
7035
7107
  if (this.isCenter) this.content.style.marginLeft = -Math.floor(this.zone.w * 0.5) + 'px';
7036
- this.setItemWidth(this.zone.w - this.sw); //this.setHeight();
7037
- //this.calc()
7038
- //if( this.isCanvasOnly ) Roots.needReZone = true;
7039
- //Roots.resize();
7108
+ this.setItemWidth(this.zone.w - this.sw);
7040
7109
  }
7041
7110
 
7042
7111
  setItemWidth(w) {
@@ -7050,8 +7119,9 @@
7050
7119
 
7051
7120
  }
7052
7121
 
7053
- const REVISION = '4.0.3';
7122
+ const REVISION = '4.0.8';
7054
7123
 
7124
+ exports.Files = Files;
7055
7125
  exports.Gui = Gui;
7056
7126
  exports.Proto = Proto;
7057
7127
  exports.REVISION = REVISION;