uil 4.0.5 → 4.1.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.
package/build/uil.js CHANGED
@@ -1502,6 +1502,10 @@
1502
1502
  t[1] = "<path id='logoin' fill='" + color + "' stroke='none' d='" + T.logoFill_d + "'/>";
1503
1503
  break;
1504
1504
 
1505
+ case 'donate':
1506
+ t[1] = "<path id='logoin' fill='" + color + "' stroke='none' d='" + T.logo_donate + "'/>";
1507
+ break;
1508
+
1505
1509
  case 'neo':
1506
1510
  t[1] = "<path id='logoin' fill='" + color + "' stroke='none' d='" + T.logo_neo + "'/>";
1507
1511
  break;
@@ -1538,11 +1542,225 @@
1538
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
1539
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
1540
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
1541
1561
  `
1542
1562
  };
1543
1563
  T.setText();
1544
1564
  const Tools = T;
1545
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 'svg':
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
+ switch (type) {
1647
+ case 'image':
1648
+ let img = new Image();
1649
+
1650
+ img.onload = function () {
1651
+ if (o.callback) o.callback(img, fname);
1652
+ };
1653
+
1654
+ img.src = content;
1655
+ break;
1656
+
1657
+ case 'json':
1658
+ if (o.callback) o.callback(JSON.parse(content), fname);
1659
+ break;
1660
+
1661
+ default:
1662
+ if (o.callback) o.callback(content, fname);
1663
+ break;
1664
+ }
1665
+ };
1666
+ } catch (e) {
1667
+ console.log(e);
1668
+ }
1669
+ }
1670
+
1671
+ static showOpenFilePickerPolyfill(options) {
1672
+ return new Promise(resolve => {
1673
+ const input = document.createElement("input");
1674
+ input.type = "file";
1675
+ input.multiple = options.multiple;
1676
+ input.accept = options.types.map(type => type.accept).flatMap(inst => Object.keys(inst).flatMap(key => inst[key])).join(",");
1677
+ input.addEventListener("change", () => {
1678
+ resolve([...input.files].map(file => {
1679
+ return {
1680
+ getFile: async () => new Promise(resolve => {
1681
+ resolve(file);
1682
+ })
1683
+ };
1684
+ }));
1685
+ });
1686
+ input.click();
1687
+ });
1688
+ } //-----------------------------
1689
+ // SAVE
1690
+ //-----------------------------
1691
+
1692
+
1693
+ static async save(o = {}) {
1694
+ this.usePoly = false;
1695
+
1696
+ if (typeof window.showSaveFilePicker !== 'function') {
1697
+ window.showSaveFilePicker = this.showSaveFilePickerPolyfill;
1698
+ this.usePoly = true;
1699
+ }
1700
+
1701
+ try {
1702
+ let type = o.type || '';
1703
+ const options = {
1704
+ suggestedName: o.name || 'hello',
1705
+ data: o.data || ''
1706
+ };
1707
+ options.types = this.autoTypes(type);
1708
+ options.finalType = Object.keys(options.types[0].accept)[0];
1709
+ options.suggestedName += options.types[0].accept[options.finalType][0]; // create a new handle
1710
+
1711
+ const handle = await window.showSaveFilePicker(options);
1712
+ if (this.usePoly) return; // create a FileSystemWritableFileStream to write to
1713
+
1714
+ const file = await handle.createWritable();
1715
+ let blob = new Blob([options.data], {
1716
+ type: options.finalType
1717
+ }); // write our file
1718
+
1719
+ await file.write(blob); // close the file and write the contents to disk.
1720
+
1721
+ await file.close();
1722
+ } catch (e) {
1723
+ console.log(e);
1724
+ }
1725
+ }
1726
+
1727
+ static showSaveFilePickerPolyfill(options) {
1728
+ return new Promise(resolve => {
1729
+ const a = document.createElement("a");
1730
+ a.download = options.suggestedName || "my-file.txt";
1731
+ let blob = new Blob([options.data], {
1732
+ type: options.finalType
1733
+ });
1734
+ a.href = URL.createObjectURL(blob);
1735
+ a.addEventListener("click", () => {
1736
+ resolve(setTimeout(() => URL.revokeObjectURL(a.href), 1000));
1737
+ });
1738
+ a.click();
1739
+ });
1740
+ } //-----------------------------
1741
+ // FOLDER not possible in poly
1742
+ //-----------------------------
1743
+
1744
+
1745
+ static async getFolder() {
1746
+ try {
1747
+ const handle = await window.showDirectoryPicker();
1748
+ const files = [];
1749
+
1750
+ for await (const entry of handle.values()) {
1751
+ const file = await entry.getFile();
1752
+ files.push(file);
1753
+ }
1754
+
1755
+ console.log(files);
1756
+ return files;
1757
+ } catch (e) {
1758
+ console.log(e);
1759
+ }
1760
+ }
1761
+
1762
+ }
1763
+
1546
1764
  class V2 {
1547
1765
  constructor(x = 0, y = 0) {
1548
1766
  this.x = x;
@@ -1654,9 +1872,7 @@
1654
1872
  this.main = o.main || null;
1655
1873
  this.isUI = o.isUI || false;
1656
1874
  this.group = o.group || null;
1657
- this.isListen = false; //this.parentGroup = null;
1658
- //if( o.select !== undefined ) o.selectable = o.select
1659
-
1875
+ this.isListen = false;
1660
1876
  this.isSelectable = o.selectable !== undefined ? o.selectable : false;
1661
1877
  this.unselectable = o.unselect !== undefined ? o.unselect : this.isSelectable;
1662
1878
  this.ontop = o.ontop ? o.ontop : false; // 'beforebegin' 'afterbegin' 'beforeend' 'afterend'
@@ -1682,11 +1898,6 @@
1682
1898
  if (!this.isSpace) this.h = this.h < 11 ? 11 : this.h;else this.lock = true; // decale for canvas only
1683
1899
 
1684
1900
  this.fw = o.fw || 0;
1685
- /*this.dc = 0
1686
- if(this.isUI){
1687
- if( this.main.isCanvasOnly && this.fw) this.dc = (this.main.zone.w - this.w)*0.5
1688
- }*/
1689
-
1690
1901
  this.autoWidth = o.auto || true; // auto width or flex
1691
1902
 
1692
1903
  this.isOpen = false; // open statu
@@ -1733,13 +1944,10 @@
1733
1944
 
1734
1945
  this.c = []; // style
1735
1946
 
1736
- 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;
1737
- //this.c[0] = Tools.dom( 'div', 'order: 1;' ); //
1738
-
1947
+ this.s = [];
1739
1948
  this.useFlex = this.isUI ? this.main.useFlex : false;
1740
- let flexible = this.useFlex ? 'disply:flex; justify-content:center; align-items:center; text-align:center; flex: 1 100%;' : 'float:left;';
1741
- 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;');
1742
-
1949
+ let flexible = this.useFlex ? 'display:flex; justify-content:center; align-items:center; text-align:center; flex: 1 100%;' : 'float:left;';
1950
+ this.c[0] = Tools.dom('div', this.css.basic + flexible + 'position:relative; height:20px;');
1743
1951
  this.s[0] = this.c[0].style; // bottom margin
1744
1952
 
1745
1953
  this.margin = o.margin || 1;
@@ -2102,14 +2310,7 @@
2102
2310
 
2103
2311
  keyup(e) {
2104
2312
  return false;
2105
- }
2106
- /*dragstart ( e ) { return false; }
2107
- dragover ( e ) { return false; }
2108
- dragenter ( e ) { return false; }
2109
- dragleave ( e ) { return false; }
2110
- dragend ( e ) { return false; }
2111
- drop ( e ) { return false; }*/
2112
- // ----------------------
2313
+ } // ----------------------
2113
2314
  // object referency
2114
2315
  // ----------------------
2115
2316
 
@@ -2119,9 +2320,8 @@
2119
2320
  this.val = val;
2120
2321
  }
2121
2322
 
2122
- display(v) {
2123
- v = v || false;
2124
- this.s[0].visibility = v ? 'visible' : 'hidden'; //this.s[0].display = v ? (this.useFlex? 'flex':'block') : 'none'
2323
+ display(v = false) {
2324
+ this.s[0].visibility = v ? 'visible' : 'hidden';
2125
2325
  } // ----------------------
2126
2326
  // resize height
2127
2327
  // ----------------------
@@ -2323,15 +2523,15 @@
2323
2523
  this.values = o.value || this.txt;
2324
2524
  if (o.values) this.values = o.values;
2325
2525
  this.onName = o.onName || null;
2326
- this.on = false;
2327
- this.customSize = o.forceWidth || -1;
2526
+ this.on = false; // force button width
2527
+
2528
+ this.bw = o.forceWidth || 0;
2529
+ if (o.bw) this.bw = o.bw;
2530
+ this.space = o.space || 3;
2328
2531
  if (typeof this.values === 'string') this.values = [this.values];
2329
2532
  this.isDown = false;
2330
2533
  this.neverlock = true;
2331
- this.isLoadButton = o.loader || false;
2332
- this.isDragButton = o.drag || false;
2333
2534
  this.res = 0;
2334
- if (this.isDragButton) this.isLoadButton = true;
2335
2535
  this.lng = this.values.length;
2336
2536
  this.tmp = [];
2337
2537
  this.stat = [];
@@ -2348,22 +2548,14 @@
2348
2548
  this.stat[i] = sel ? 3 : 1;
2349
2549
  }
2350
2550
 
2351
- if (!o.value || !o.values) {
2352
- if (this.c[1] !== undefined) this.c[1].textContent = '';
2353
- this.p = o.p !== undefined ? o.p : 0;
2354
- } else {
2355
- if (!this.txt) this.p = 0;
2356
- } //
2357
-
2358
-
2359
- if (this.isLoadButton) this.initLoader();
2360
-
2361
- if (this.isDragButton) {
2362
- this.lng++;
2363
- this.initDrager();
2364
- } //if( this.onName !== '' ) this.values[0] = this.on;
2365
-
2551
+ if (!o.value && !o.values) {
2552
+ if (this.c[1] !== undefined) {
2553
+ this.c[1].textContent = '';
2554
+ this.txt = '';
2555
+ }
2556
+ }
2366
2557
 
2558
+ if (!this.txt) this.p = 0;
2367
2559
  this.init();
2368
2560
  }
2369
2561
 
@@ -2395,7 +2587,7 @@
2395
2587
  if (this.res !== -1) {
2396
2588
  if (this.value === this.values[this.res] && this.unselectable) this.value = '';else this.value = this.values[this.res];
2397
2589
  if (this.onName !== null) this.onOff();
2398
- if (!this.isLoadButton) this.send();
2590
+ this.send();
2399
2591
  }
2400
2592
 
2401
2593
  return this.mousemove(e);
@@ -2447,6 +2639,7 @@
2447
2639
  }
2448
2640
 
2449
2641
  mode(n, id) {
2642
+ //if(!this.s) return false
2450
2643
  let change = false;
2451
2644
  let cc = this.colors,
2452
2645
  s = this.s;
@@ -2488,81 +2681,6 @@
2488
2681
  this.res = -1;
2489
2682
  this.cursor();
2490
2683
  return this.modes();
2491
- } // ----------------------
2492
-
2493
-
2494
- dragover(e) {
2495
- e.preventDefault();
2496
- this.s[4].borderColor = this.colors.select;
2497
- this.s[4].color = this.colors.select;
2498
- }
2499
-
2500
- dragend(e) {
2501
- e.preventDefault();
2502
- this.s[4].borderColor = this.color.text;
2503
- this.s[4].color = this.color.text;
2504
- }
2505
-
2506
- drop(e) {
2507
- e.preventDefault();
2508
- this.dragend(e);
2509
- this.fileSelect(e.dataTransfer.files[0]);
2510
- }
2511
-
2512
- initDrager() {
2513
- 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;
2514
-
2515
- this.c[4].textContent = 'DRAG';
2516
- this.c[4].addEventListener('dragover', function (e) {
2517
- this.dragover(e);
2518
- }.bind(this), false);
2519
- this.c[4].addEventListener('dragend', function (e) {
2520
- this.dragend(e);
2521
- }.bind(this), false);
2522
- this.c[4].addEventListener('dragleave', function (e) {
2523
- this.dragend(e);
2524
- }.bind(this), false);
2525
- this.c[4].addEventListener('drop', function (e) {
2526
- this.drop(e);
2527
- }.bind(this), false); //this.c[2].events = [ ];
2528
- //this.c[4].events = [ 'dragover', 'dragend', 'dragleave', 'drop' ];
2529
- }
2530
-
2531
- initLoader() {
2532
- this.c[3] = this.dom('input', this.css.basic + 'top:0px; opacity:0; height:' + this.h + 'px; pointer-events:auto; cursor:pointer;'); //
2533
-
2534
- this.c[3].name = 'loader';
2535
- this.c[3].type = "file";
2536
- this.c[3].addEventListener('change', function (e) {
2537
- this.fileSelect(e.target.files[0]);
2538
- }.bind(this), false); //this.c[3].addEventListener( 'mousedown', function(e){ }.bind(this), false );
2539
- //this.c[2].events = [ ];
2540
- //this.c[3].events = [ 'change', 'mouseover', 'mousedown', 'mouseup', 'mouseout' ];
2541
- //this.hide = document.createElement('input');
2542
- }
2543
-
2544
- fileSelect(file) {
2545
- let dataUrl = ['png', 'jpg', 'mp4', 'webm', 'ogg'];
2546
- let dataBuf = ['sea', 'z', 'hex', 'bvh', 'BVH', 'glb']; //if( ! e.target.files ) return;
2547
- //let file = e.target.files[0];
2548
- //this.c[3].type = "null";
2549
- // console.log( this.c[4] )
2550
-
2551
- if (file === undefined) return;
2552
- let reader = new FileReader();
2553
- let fname = file.name;
2554
- let type = fname.substring(fname.lastIndexOf('.') + 1, fname.length);
2555
- if (dataUrl.indexOf(type) !== -1) reader.readAsDataURL(file);else if (dataBuf.indexOf(type) !== -1) reader.readAsArrayBuffer(file); //reader.readAsArrayBuffer( file );
2556
- else reader.readAsText(file); // if( type === 'png' || type === 'jpg' || type === 'mp4' || type === 'webm' || type === 'ogg' ) reader.readAsDataURL( file );
2557
- //else if( type === 'z' ) reader.readAsBinaryString( file );
2558
- //else if( type === 'sea' || type === 'bvh' || type === 'BVH' || type === 'z') reader.readAsArrayBuffer( file );
2559
- //else if( ) reader.readAsArrayBuffer( file );
2560
- //else reader.readAsText( file );
2561
-
2562
- reader.onload = function (e) {
2563
- if (this.callback) this.callback(e.target.result, fname, type); //this.c[3].type = "file";
2564
- //this.send( e.target.result );
2565
- }.bind(this);
2566
2684
  }
2567
2685
 
2568
2686
  label(string, n) {
@@ -2583,11 +2701,12 @@
2583
2701
  let w = this.sb;
2584
2702
  let d = this.sa;
2585
2703
  let i = this.lng;
2586
- let dc = 3;
2704
+ let dc = this.space;
2587
2705
  let size = Math.floor((w - dc * (i - 1)) / i);
2588
2706
 
2589
- if (this.customSize !== -1) {
2590
- size = this.customSize; // d = (this.s-size)*0.5
2707
+ if (this.bw) {
2708
+ size = this.bw < size ? this.bw : size;
2709
+ d = Math.floor((this.w - (size * i + dc * (i - 1))) * 0.5);
2591
2710
  }
2592
2711
 
2593
2712
  while (i--) {
@@ -2596,16 +2715,6 @@
2596
2715
  s[i + 2].left = this.tmp[i][0] + 'px';
2597
2716
  s[i + 2].width = this.tmp[i][1] + 'px';
2598
2717
  }
2599
-
2600
- if (this.isDragButton) {
2601
- s[4].left = d + size + dc + 'px';
2602
- s[4].width = size + 'px';
2603
- }
2604
-
2605
- if (this.isLoadButton) {
2606
- s[3].left = d + 'px';
2607
- s[3].width = size + 'px';
2608
- }
2609
2718
  }
2610
2719
 
2611
2720
  }
@@ -2626,6 +2735,7 @@
2626
2735
  this.h = o.h || this.w + 10;
2627
2736
  this.top = 0;
2628
2737
  this.c[0].style.width = this.w + 'px';
2738
+ this.c[0].style.display = 'block';
2629
2739
 
2630
2740
  if (this.c[1] !== undefined) {
2631
2741
  this.c[1].style.width = '100%';
@@ -2808,9 +2918,9 @@
2808
2918
  this.s[2].top = 'auto';
2809
2919
  this.s[2].bottom = '2px';
2810
2920
  } //this.c[0].style.textAlign = 'center';
2811
- //this.c[0].style.flex = '1 0 auto'
2812
2921
 
2813
2922
 
2923
+ this.c[0].style.display = 'block';
2814
2924
  this.c[3] = this.getColorRing();
2815
2925
  this.c[3].style.visibility = 'hidden';
2816
2926
  this.hsl = null;
@@ -3610,11 +3720,11 @@
3610
3720
  super(o);
3611
3721
  this.isGroup = true;
3612
3722
  this.ADD = o.add;
3613
- this.uis = [];
3614
- this.isEmpty = true;
3615
3723
  this.autoHeight = true;
3724
+ this.uis = [];
3616
3725
  this.current = -1;
3617
- this.targetIn = null;
3726
+ this.proto = null;
3727
+ this.isEmpty = true;
3618
3728
  this.decal = 0;
3619
3729
  this.baseH = this.h;
3620
3730
  let fltop = Math.floor(this.h * 0.5) - 6;
@@ -3650,17 +3760,10 @@
3650
3760
  s[1].lineHeight = this.h - 4;
3651
3761
  s[1].color = this.colors.text;
3652
3762
  s[1].fontWeight = 'bold';
3653
- if (this.radius !== 0) s[0].borderRadius = this.radius + 'px'; //if( o.border ) s[0].border = '1px solid ' + o.border;
3654
-
3655
- /*if(this.decal){
3656
- s[0].boxSizing = 'border-box';
3657
- s[0].backgroundClip = 'border-box';
3658
- s[0].border = (this.decal/3)+'px solid ' + o.group.colors.background;
3659
- }*/
3660
-
3763
+ if (this.radius !== 0) s[0].borderRadius = this.radius + 'px';
3661
3764
  this.init();
3662
3765
  this.setBG(o.bg);
3663
- if (o.open !== undefined) this.open(); //s[0].background = this.bg;
3766
+ if (o.open !== undefined) this.open();
3664
3767
  }
3665
3768
 
3666
3769
  testZone(e) {
@@ -3674,12 +3777,16 @@
3674
3777
  }
3675
3778
 
3676
3779
  clearTarget() {
3677
- if (this.current === -1) return false; // if(!this.targetIn ) return;
3780
+ if (this.current === -1) return false;
3678
3781
 
3679
- this.targetIn.uiout();
3680
- this.targetIn.reset();
3782
+ if (this.proto.s) {
3783
+ // if no s target is delete !!
3784
+ this.proto.uiout();
3785
+ this.proto.reset();
3786
+ }
3787
+
3788
+ this.proto = null;
3681
3789
  this.current = -1;
3682
- this.targetIn = null;
3683
3790
  this.cursor();
3684
3791
  return true;
3685
3792
  }
@@ -3694,7 +3801,7 @@
3694
3801
  handleEvent(e) {
3695
3802
  let type = e.type;
3696
3803
  let change = false;
3697
- let targetChange = false;
3804
+ let protoChange = false;
3698
3805
  let name = this.testZone(e);
3699
3806
  if (!name) return;
3700
3807
 
@@ -3702,8 +3809,7 @@
3702
3809
  case 'content':
3703
3810
  this.cursor();
3704
3811
  if (Roots.isMobile && type === 'mousedown') this.getNext(e, change);
3705
- if (this.targetIn) targetChange = this.targetIn.handleEvent(e); //if( type === 'mousemove' ) change = this.styles('def');
3706
-
3812
+ if (this.proto) protoChange = this.proto.handleEvent(e);
3707
3813
  if (!Roots.lock) this.getNext(e, change);
3708
3814
  break;
3709
3815
 
@@ -3718,7 +3824,7 @@
3718
3824
  }
3719
3825
 
3720
3826
  if (this.isDown) change = true;
3721
- if (targetChange) change = true;
3827
+ if (protoChange) change = true;
3722
3828
  return change;
3723
3829
  }
3724
3830
 
@@ -3731,30 +3837,11 @@
3731
3837
  }
3732
3838
 
3733
3839
  if (next !== -1) {
3734
- this.targetIn = this.uis[this.current];
3735
- this.targetIn.uiover();
3840
+ this.proto = this.uis[this.current];
3841
+ this.proto.uiover();
3736
3842
  }
3737
3843
  } // ----------------------
3738
3844
 
3739
- /*calcH () {
3740
- let lng = this.uis.length, i, u, h=0, px=0, tmph=0;
3741
- for( i = 0; i < lng; i++){
3742
- u = this.uis[i];
3743
- if( !u.autoWidth ){
3744
- if(px===0) h += u.h+1;
3745
- else {
3746
- if(tmph<u.h) h += u.h-tmph;
3747
- }
3748
- tmph = u.h;
3749
- //tmph = tmph < u.h ? u.h : tmph;
3750
- px += u.w;
3751
- if( px+u.w > this.w ) px = 0;
3752
- }
3753
- else h += u.h+1;
3754
- }
3755
- return h;
3756
- }*/
3757
-
3758
3845
 
3759
3846
  setBG(bg) {
3760
3847
  if (bg !== undefined) this.colors.background = bg;
@@ -3785,12 +3872,10 @@
3785
3872
  a[2].main = this.main;
3786
3873
  a[2].group = this;
3787
3874
  }
3788
- } //let n = add.apply( this, a );
3789
-
3875
+ }
3790
3876
 
3791
3877
  let u = this.ADD.apply(this, a);
3792
- this.uis.push(u); //this.calc()
3793
-
3878
+ this.uis.push(u);
3794
3879
  this.isEmpty = false;
3795
3880
  return u;
3796
3881
  } // remove one node
@@ -3804,7 +3889,7 @@
3804
3889
  dispose() {
3805
3890
  this.clear();
3806
3891
  if (this.isUI) this.main.calc();
3807
- super.dispose(); //Proto.prototype.clear.call( this );
3892
+ super.dispose();
3808
3893
  }
3809
3894
 
3810
3895
  clear() {
@@ -3861,9 +3946,7 @@
3861
3946
 
3862
3947
  calcUis() {
3863
3948
  if (!this.isOpen) this.h = this.baseH;else this.h = Roots.calcUis(this.uis, this.zone, this.zone.y + this.baseH) + this.baseH;
3864
- this.s[0].height = this.h + 'px'; //console.log('G', this.h)
3865
- //if( !this.isOpen ) return;
3866
- //this.h = Roots.calcUis( this.uis, this.zone, this.zone.y + this.baseH )+this.baseH;
3949
+ this.s[0].height = this.h + 'px';
3867
3950
  }
3868
3951
 
3869
3952
  parentHeight(t) {
@@ -3872,16 +3955,6 @@
3872
3955
 
3873
3956
  calc(y) {
3874
3957
  if (!this.isOpen) return;
3875
- /*
3876
- if( y !== undefined ){
3877
- this.h += y;
3878
- if( this.isUI ) this.main.calc( y );
3879
- } else {
3880
- this.h = this.calcH() + this.baseH;
3881
- }
3882
- this.s[0].height = this.h + 'px';*/
3883
- // if(this.isOpen)
3884
-
3885
3958
  if (this.isUI) this.main.calc();else this.calcUis();
3886
3959
  this.s[0].height = this.h + 'px';
3887
3960
  }
@@ -3892,8 +3965,7 @@
3892
3965
  while (i--) {
3893
3966
  this.uis[i].setSize(this.w);
3894
3967
  this.uis[i].rSize();
3895
- } //this.calc()
3896
-
3968
+ }
3897
3969
  }
3898
3970
 
3899
3971
  rSize() {
@@ -3920,7 +3992,8 @@
3920
3992
  this.multiplicator = o.multiplicator || 1;
3921
3993
  this.pos = new V2();
3922
3994
  this.tmp = new V2();
3923
- this.interval = null; //this.radius = this.w * 0.5;
3995
+ this.interval = null;
3996
+ this.c[0].style.display = 'block'; //this.radius = this.w * 0.5;
3924
3997
  //this.distance = this.radius*0.25;
3925
3998
 
3926
3999
  this.distance = this.diam * 0.5 * 0.25;
@@ -4108,6 +4181,7 @@
4108
4181
  this.h = o.h || this.w + 10;
4109
4182
  this.top = 0;
4110
4183
  this.c[0].style.width = this.w + 'px';
4184
+ this.c[0].style.display = 'block';
4111
4185
 
4112
4186
  if (this.c[1] !== undefined) {
4113
4187
  this.c[1].style.width = '100%';
@@ -6187,6 +6261,7 @@
6187
6261
  this.range = (this.max - this.min) * 0.5;
6188
6262
  this.cmode = 0; //console.log(this.range)
6189
6263
 
6264
+ this.c[0].style.display = 'block';
6190
6265
  this.precision = o.precision === undefined ? 2 : o.precision;
6191
6266
  /*this.bounds = {};
6192
6267
  this.bounds.x1 = o.x1 || -1;
@@ -6374,8 +6449,7 @@
6374
6449
  // like dat gui
6375
6450
  ref = true;
6376
6451
  if (a[2] === undefined) [].push.call(a, {});
6377
- type = a[2].type ? a[2].type : 'slide'; //autoType.apply( this, a );
6378
-
6452
+ type = a[2].type ? a[2].type : autoType(a[0][a[1]], a[2]);
6379
6453
  o = a[2];
6380
6454
  o.name = a[1];
6381
6455
 
@@ -6389,6 +6463,7 @@
6389
6463
 
6390
6464
  switch (name) {
6391
6465
  case 'bool':
6466
+ case 'boolean':
6392
6467
  n = new Bool(o);
6393
6468
  break;
6394
6469
 
@@ -6479,6 +6554,19 @@
6479
6554
  return n;
6480
6555
  }
6481
6556
  };
6557
+ const autoType = function (v, o) {
6558
+ let type = 'slide';
6559
+ if (typeof v === 'boolean') type = 'bool';else if (typeof v === 'string') {
6560
+ if (v.substring(0, 1) === '#') type = 'color';else type = 'string';
6561
+ } else if (typeof v === 'number') {
6562
+ if (o.ctype) type = 'color';else type = 'slide';
6563
+ } else if (typeof v === 'array' && v instanceof Array) {
6564
+ if (typeof v[0] === 'number') type = 'number';else if (typeof v[0] === 'string') type = 'list';
6565
+ } else if (typeof v === 'object' && v instanceof Object) {
6566
+ if (v.x !== undefined) type = 'number';else type = 'list';
6567
+ }
6568
+ return type;
6569
+ };
6482
6570
 
6483
6571
  /**
6484
6572
  * @author lth / https://github.com/lo-th
@@ -6491,8 +6579,7 @@
6491
6579
 
6492
6580
  this.canvas = null;
6493
6581
  this.screen = null;
6494
- this.plane = o.plane || null;
6495
- this.isEmpty = true; // color
6582
+ this.plane = o.plane || null; // color
6496
6583
 
6497
6584
  if (o.config) o.colors = o.config;
6498
6585
  if (o.colors) this.setConfig(o.colors);else this.colors = Tools.defineColor(o); // style
@@ -6540,7 +6627,8 @@
6540
6627
  this.isScroll = false;
6541
6628
  this.uis = [];
6542
6629
  this.current = -1;
6543
- this.target = null;
6630
+ this.proto = null;
6631
+ this.isEmpty = true;
6544
6632
  this.decal = 0;
6545
6633
  this.ratio = 1;
6546
6634
  this.oy = 0;
@@ -6659,7 +6747,11 @@
6659
6747
  }
6660
6748
 
6661
6749
  hide(b) {
6662
- this.content.style.display = b ? 'none' : 'block';
6750
+ this.content.style.visibility = b ? 'hidden' : 'visible';
6751
+ }
6752
+
6753
+ display(v = false) {
6754
+ this.content.style.visibility = v ? 'visible' : 'hidden';
6663
6755
  }
6664
6756
 
6665
6757
  onChange(f) {
@@ -6714,11 +6806,15 @@
6714
6806
 
6715
6807
 
6716
6808
  clearTarget() {
6717
- if (this.current === -1) return false; //if(!this.target) return;
6809
+ if (this.current === -1) return false;
6718
6810
 
6719
- this.target.uiout();
6720
- this.target.reset();
6721
- this.target = null;
6811
+ if (this.proto.s) {
6812
+ // if no s target is delete !!
6813
+ this.proto.uiout();
6814
+ this.proto.reset();
6815
+ }
6816
+
6817
+ this.proto = null;
6722
6818
  this.current = -1; ///console.log(this.isDown)//if(this.isDown)Roots.clearInput();
6723
6819
 
6724
6820
  Roots.cursor();
@@ -6744,7 +6840,7 @@
6744
6840
  handleEvent(e) {
6745
6841
  let type = e.type;
6746
6842
  let change = false;
6747
- let targetChange = false;
6843
+ let protoChange = false;
6748
6844
  let name = this.testZone(e);
6749
6845
  if (type === 'mouseup' && this.isDown) this.isDown = false;
6750
6846
  if (type === 'mousedown' && !this.isDown) this.isDown = true;
@@ -6760,9 +6856,9 @@
6760
6856
  case 'content':
6761
6857
  e.clientY = this.isScroll ? e.clientY + this.decal : e.clientY;
6762
6858
  if (Roots.isMobile && type === 'mousedown') this.getNext(e, change);
6763
- if (this.target) targetChange = this.target.handleEvent(e);
6859
+ if (this.proto) protoChange = this.proto.handleEvent(e);
6764
6860
  if (type === 'mousemove') change = this.mode('def');
6765
- if (type === 'wheel' && !targetChange && this.isScroll) change = this.onWheel(e);
6861
+ if (type === 'wheel' && !protoChange && this.isScroll) change = this.onWheel(e);
6766
6862
 
6767
6863
  if (!Roots.lock) {
6768
6864
  this.getNext(e, change);
@@ -6795,7 +6891,7 @@
6795
6891
  }
6796
6892
 
6797
6893
  if (this.isDown) change = true;
6798
- if (targetChange) change = true;
6894
+ if (protoChange) change = true;
6799
6895
  if (type === 'keyup') change = true;
6800
6896
  if (type === 'keydown') change = true;
6801
6897
  if (change) this.draw();
@@ -6811,8 +6907,8 @@
6811
6907
  }
6812
6908
 
6813
6909
  if (next !== -1) {
6814
- this.target = this.uis[this.current];
6815
- this.target.uiover();
6910
+ this.proto = this.uis[this.current];
6911
+ this.proto.uiover();
6816
6912
  }
6817
6913
  }
6818
6914
 
@@ -6854,36 +6950,19 @@
6854
6950
  main: this
6855
6951
  });else {
6856
6952
  a[2].isUI = true;
6857
- a[2].main = this;
6858
- ontop = a[1].ontop ? a[1].ontop : false;
6953
+ a[2].main = this; //ontop = a[1].ontop ? a[1].ontop : false;
6954
+
6955
+ ontop = a[2].ontop ? a[2].ontop : false;
6859
6956
  }
6860
6957
  }
6861
6958
 
6862
6959
  let u = add.apply(this, a);
6863
6960
  if (u === null) return;
6864
6961
  if (ontop) this.uis.unshift(u);else this.uis.push(u);
6865
- /*if( !u.autoWidth ){
6866
- let y = u.c[0].getBoundingClientRect().top;
6867
- if( this.prevY !== y ){
6868
- this.calc( u.h + 1 );
6869
- this.prevY = y;
6870
- }
6871
- }else{
6872
- this.prevY = 0;//-1;
6873
- this.calc( u.h + 1 );
6874
- }*/
6875
-
6876
6962
  this.calc();
6877
6963
  this.isEmpty = false;
6878
6964
  return u;
6879
- }
6880
- /*applyCalc () {
6881
- //console.log(this.uis.length, this.tmpH )
6882
- this.calc( this.tmpH );
6883
- //this.tmpH = 0;
6884
- this.tmpAdd = null;
6885
- }*/
6886
- // remove one node
6965
+ } // remove one node
6887
6966
 
6888
6967
 
6889
6968
  remove(n) {
@@ -6911,14 +6990,11 @@
6911
6990
  while (i--) {
6912
6991
  item = this.uis.pop();
6913
6992
  this.inner.removeChild(item.c[0]);
6914
- item.dispose(); //this.uis[i].clear()
6993
+ item.dispose();
6915
6994
  }
6916
6995
 
6917
6996
  this.uis = [];
6918
- this.isEmpty = true; //this.zone = { x:0, y:0, w:this.size.w, h:0 };
6919
- //this.setWidth()
6920
- //Roots.listens = [];
6921
-
6997
+ this.isEmpty = true;
6922
6998
  this.calc();
6923
6999
  }
6924
7000
 
@@ -6974,8 +7050,7 @@
6974
7050
  this.total = this.h;
6975
7051
  this.maxView = this.maxHeight;
6976
7052
  this.ratio = this.maxView / this.total;
6977
- this.sh = this.maxView * this.ratio; //if( this.sh < 20 ) this.sh = 20;
6978
-
7053
+ this.sh = this.maxView * this.ratio;
6979
7054
  this.range = this.maxView - this.sh;
6980
7055
  this.oy = Tools.clamp(this.oy, 0, this.range);
6981
7056
  this.scrollBG.style.height = this.maxView + 'px';
@@ -7018,23 +7093,19 @@
7018
7093
  let diff = this.h - this.maxHeight;
7019
7094
 
7020
7095
  if (diff > 1) {
7021
- //this.h > this.maxHeight ){
7022
7096
  this.isScroll = true;
7023
7097
  this.zone.h = this.maxHeight + this.bh;
7024
7098
  } else {
7025
7099
  this.zone.h = this.h + this.bh;
7026
7100
  }
7027
- } //if( this.forceHeight ) this.zone.h = this.forceHeight
7028
-
7101
+ }
7029
7102
 
7030
7103
  this.upScroll(this.isScroll);
7031
7104
  this.innerContent.style.height = this.zone.h - this.bh + 'px';
7032
7105
  this.content.style.height = this.zone.h + 'px';
7033
7106
  this.bottom.style.top = this.zone.h - this.bh + 'px';
7034
- if (this.forceHeight && this.lockHeight) this.content.style.height = this.forceHeight + 'px'; //console.log( this.zone, this.bh )
7035
- //if( this.isOpen ) this.calcUis()
7036
-
7037
- if (this.isCanvas) this.draw(true); //else if( !this.transition ) this.rezone()
7107
+ if (this.forceHeight && this.lockHeight) this.content.style.height = this.forceHeight + 'px';
7108
+ if (this.isCanvas) this.draw(true);
7038
7109
  }
7039
7110
 
7040
7111
  rezone() {
@@ -7043,14 +7114,10 @@
7043
7114
 
7044
7115
  setWidth(w) {
7045
7116
  if (w) this.zone.w = w;
7046
- this.zone.w = Math.floor(this.zone.w); //console.log( this.zone.w )
7047
-
7117
+ this.zone.w = Math.floor(this.zone.w);
7048
7118
  this.content.style.width = this.zone.w + 'px';
7049
7119
  if (this.isCenter) this.content.style.marginLeft = -Math.floor(this.zone.w * 0.5) + 'px';
7050
- this.setItemWidth(this.zone.w - this.sw); //this.setHeight();
7051
- //this.calc()
7052
- //if( this.isCanvasOnly ) Roots.needReZone = true;
7053
- //Roots.resize();
7120
+ this.setItemWidth(this.zone.w - this.sw);
7054
7121
  }
7055
7122
 
7056
7123
  setItemWidth(w) {
@@ -7064,8 +7131,9 @@
7064
7131
 
7065
7132
  }
7066
7133
 
7067
- const REVISION = '4.0.5';
7134
+ const REVISION = '4.1.0';
7068
7135
 
7136
+ exports.Files = Files;
7069
7137
  exports.Gui = Gui;
7070
7138
  exports.Proto = Proto;
7071
7139
  exports.REVISION = REVISION;