uil 4.0.4 → 4.0.9

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
  }
@@ -2616,6 +2727,7 @@
2616
2727
  this.h = o.h || this.w + 10;
2617
2728
  this.top = 0;
2618
2729
  this.c[0].style.width = this.w + 'px';
2730
+ this.c[0].style.display = 'block';
2619
2731
 
2620
2732
  if (this.c[1] !== undefined) {
2621
2733
  this.c[1].style.width = '100%';
@@ -2798,9 +2910,9 @@
2798
2910
  this.s[2].top = 'auto';
2799
2911
  this.s[2].bottom = '2px';
2800
2912
  } //this.c[0].style.textAlign = 'center';
2801
- //this.c[0].style.flex = '1 0 auto'
2802
2913
 
2803
2914
 
2915
+ this.c[0].style.display = 'block';
2804
2916
  this.c[3] = this.getColorRing();
2805
2917
  this.c[3].style.visibility = 'hidden';
2806
2918
  this.hsl = null;
@@ -3600,11 +3712,11 @@
3600
3712
  super(o);
3601
3713
  this.isGroup = true;
3602
3714
  this.ADD = o.add;
3603
- this.uis = [];
3604
- this.isEmpty = true;
3605
3715
  this.autoHeight = true;
3716
+ this.uis = [];
3606
3717
  this.current = -1;
3607
- this.targetIn = null;
3718
+ this.proto = null;
3719
+ this.isEmpty = true;
3608
3720
  this.decal = 0;
3609
3721
  this.baseH = this.h;
3610
3722
  let fltop = Math.floor(this.h * 0.5) - 6;
@@ -3640,17 +3752,10 @@
3640
3752
  s[1].lineHeight = this.h - 4;
3641
3753
  s[1].color = this.colors.text;
3642
3754
  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
-
3755
+ if (this.radius !== 0) s[0].borderRadius = this.radius + 'px';
3651
3756
  this.init();
3652
3757
  this.setBG(o.bg);
3653
- if (o.open !== undefined) this.open(); //s[0].background = this.bg;
3758
+ if (o.open !== undefined) this.open();
3654
3759
  }
3655
3760
 
3656
3761
  testZone(e) {
@@ -3664,12 +3769,16 @@
3664
3769
  }
3665
3770
 
3666
3771
  clearTarget() {
3667
- if (this.current === -1) return false; // if(!this.targetIn ) return;
3772
+ if (this.current === -1) return false;
3668
3773
 
3669
- this.targetIn.uiout();
3670
- this.targetIn.reset();
3774
+ if (this.proto.s) {
3775
+ // if no s target is delete !!
3776
+ this.proto.uiout();
3777
+ this.proto.reset();
3778
+ }
3779
+
3780
+ this.proto = null;
3671
3781
  this.current = -1;
3672
- this.targetIn = null;
3673
3782
  this.cursor();
3674
3783
  return true;
3675
3784
  }
@@ -3684,7 +3793,7 @@
3684
3793
  handleEvent(e) {
3685
3794
  let type = e.type;
3686
3795
  let change = false;
3687
- let targetChange = false;
3796
+ let protoChange = false;
3688
3797
  let name = this.testZone(e);
3689
3798
  if (!name) return;
3690
3799
 
@@ -3692,8 +3801,7 @@
3692
3801
  case 'content':
3693
3802
  this.cursor();
3694
3803
  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
-
3804
+ if (this.proto) protoChange = this.proto.handleEvent(e);
3697
3805
  if (!Roots.lock) this.getNext(e, change);
3698
3806
  break;
3699
3807
 
@@ -3708,7 +3816,7 @@
3708
3816
  }
3709
3817
 
3710
3818
  if (this.isDown) change = true;
3711
- if (targetChange) change = true;
3819
+ if (protoChange) change = true;
3712
3820
  return change;
3713
3821
  }
3714
3822
 
@@ -3721,30 +3829,11 @@
3721
3829
  }
3722
3830
 
3723
3831
  if (next !== -1) {
3724
- this.targetIn = this.uis[this.current];
3725
- this.targetIn.uiover();
3832
+ this.proto = this.uis[this.current];
3833
+ this.proto.uiover();
3726
3834
  }
3727
3835
  } // ----------------------
3728
3836
 
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
3837
 
3749
3838
  setBG(bg) {
3750
3839
  if (bg !== undefined) this.colors.background = bg;
@@ -3775,12 +3864,10 @@
3775
3864
  a[2].main = this.main;
3776
3865
  a[2].group = this;
3777
3866
  }
3778
- } //let n = add.apply( this, a );
3779
-
3867
+ }
3780
3868
 
3781
3869
  let u = this.ADD.apply(this, a);
3782
- this.uis.push(u); //this.calc()
3783
-
3870
+ this.uis.push(u);
3784
3871
  this.isEmpty = false;
3785
3872
  return u;
3786
3873
  } // remove one node
@@ -3794,7 +3881,7 @@
3794
3881
  dispose() {
3795
3882
  this.clear();
3796
3883
  if (this.isUI) this.main.calc();
3797
- super.dispose(); //Proto.prototype.clear.call( this );
3884
+ super.dispose();
3798
3885
  }
3799
3886
 
3800
3887
  clear() {
@@ -3851,9 +3938,7 @@
3851
3938
 
3852
3939
  calcUis() {
3853
3940
  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;
3941
+ this.s[0].height = this.h + 'px';
3857
3942
  }
3858
3943
 
3859
3944
  parentHeight(t) {
@@ -3862,16 +3947,6 @@
3862
3947
 
3863
3948
  calc(y) {
3864
3949
  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
3950
  if (this.isUI) this.main.calc();else this.calcUis();
3876
3951
  this.s[0].height = this.h + 'px';
3877
3952
  }
@@ -3882,8 +3957,7 @@
3882
3957
  while (i--) {
3883
3958
  this.uis[i].setSize(this.w);
3884
3959
  this.uis[i].rSize();
3885
- } //this.calc()
3886
-
3960
+ }
3887
3961
  }
3888
3962
 
3889
3963
  rSize() {
@@ -3910,7 +3984,8 @@
3910
3984
  this.multiplicator = o.multiplicator || 1;
3911
3985
  this.pos = new V2();
3912
3986
  this.tmp = new V2();
3913
- this.interval = null; //this.radius = this.w * 0.5;
3987
+ this.interval = null;
3988
+ this.c[0].style.display = 'block'; //this.radius = this.w * 0.5;
3914
3989
  //this.distance = this.radius*0.25;
3915
3990
 
3916
3991
  this.distance = this.diam * 0.5 * 0.25;
@@ -4098,6 +4173,7 @@
4098
4173
  this.h = o.h || this.w + 10;
4099
4174
  this.top = 0;
4100
4175
  this.c[0].style.width = this.w + 'px';
4176
+ this.c[0].style.display = 'block';
4101
4177
 
4102
4178
  if (this.c[1] !== undefined) {
4103
4179
  this.c[1].style.width = '100%';
@@ -6177,6 +6253,7 @@
6177
6253
  this.range = (this.max - this.min) * 0.5;
6178
6254
  this.cmode = 0; //console.log(this.range)
6179
6255
 
6256
+ this.c[0].style.display = 'block';
6180
6257
  this.precision = o.precision === undefined ? 2 : o.precision;
6181
6258
  /*this.bounds = {};
6182
6259
  this.bounds.x1 = o.x1 || -1;
@@ -6364,8 +6441,7 @@
6364
6441
  // like dat gui
6365
6442
  ref = true;
6366
6443
  if (a[2] === undefined) [].push.call(a, {});
6367
- type = a[2].type ? a[2].type : 'slide'; //autoType.apply( this, a );
6368
-
6444
+ type = a[2].type ? a[2].type : autoType(a[0][a[1]], a[2]);
6369
6445
  o = a[2];
6370
6446
  o.name = a[1];
6371
6447
 
@@ -6379,6 +6455,7 @@
6379
6455
 
6380
6456
  switch (name) {
6381
6457
  case 'bool':
6458
+ case 'boolean':
6382
6459
  n = new Bool(o);
6383
6460
  break;
6384
6461
 
@@ -6469,6 +6546,19 @@
6469
6546
  return n;
6470
6547
  }
6471
6548
  };
6549
+ const autoType = function (v, o) {
6550
+ let type = 'slide';
6551
+ if (typeof v === 'boolean') type = 'bool';else if (typeof v === 'string') {
6552
+ if (v.substring(0, 1) === '#') type = 'color';else type = 'string';
6553
+ } else if (typeof v === 'number') {
6554
+ if (o.ctype) type = 'color';else type = 'slide';
6555
+ } else if (typeof v === 'array' && v instanceof Array) {
6556
+ if (typeof v[0] === 'number') type = 'number';else if (typeof v[0] === 'string') type = 'list';
6557
+ } else if (typeof v === 'object' && v instanceof Object) {
6558
+ if (v.x !== undefined) type = 'number';else type = 'list';
6559
+ }
6560
+ return type;
6561
+ };
6472
6562
 
6473
6563
  /**
6474
6564
  * @author lth / https://github.com/lo-th
@@ -6481,8 +6571,7 @@
6481
6571
 
6482
6572
  this.canvas = null;
6483
6573
  this.screen = null;
6484
- this.plane = o.plane || null;
6485
- this.isEmpty = true; // color
6574
+ this.plane = o.plane || null; // color
6486
6575
 
6487
6576
  if (o.config) o.colors = o.config;
6488
6577
  if (o.colors) this.setConfig(o.colors);else this.colors = Tools.defineColor(o); // style
@@ -6530,7 +6619,8 @@
6530
6619
  this.isScroll = false;
6531
6620
  this.uis = [];
6532
6621
  this.current = -1;
6533
- this.target = null;
6622
+ this.proto = null;
6623
+ this.isEmpty = true;
6534
6624
  this.decal = 0;
6535
6625
  this.ratio = 1;
6536
6626
  this.oy = 0;
@@ -6573,6 +6663,8 @@
6573
6663
  if (!this.isCanvasOnly) {
6574
6664
  this.content.style.pointerEvents = 'auto';
6575
6665
  } else {
6666
+ this.content.style.left = '0px';
6667
+ this.content.style.right = 'auto';
6576
6668
  o.transition = 0;
6577
6669
  } // height transition
6578
6670
 
@@ -6607,7 +6699,7 @@
6607
6699
  makeCanvas() {
6608
6700
  this.canvas = document.createElementNS('http://www.w3.org/1999/xhtml', "canvas");
6609
6701
  this.canvas.width = this.zone.w;
6610
- this.canvas.height = this.forceHeight ? this.forceHeight : this.zone.h;
6702
+ this.canvas.height = this.forceHeight ? this.forceHeight : this.zone.h; //console.log( this.canvas.width, this.canvas.height )
6611
6703
  }
6612
6704
 
6613
6705
  draw(force) {
@@ -6647,7 +6739,11 @@
6647
6739
  }
6648
6740
 
6649
6741
  hide(b) {
6650
- this.content.style.display = b ? 'none' : 'block';
6742
+ this.content.style.visibility = b ? 'hidden' : 'visible';
6743
+ }
6744
+
6745
+ display(v = false) {
6746
+ this.content.style.visibility = v ? 'visible' : 'hidden';
6651
6747
  }
6652
6748
 
6653
6749
  onChange(f) {
@@ -6702,11 +6798,15 @@
6702
6798
 
6703
6799
 
6704
6800
  clearTarget() {
6705
- if (this.current === -1) return false; //if(!this.target) return;
6801
+ if (this.current === -1) return false;
6706
6802
 
6707
- this.target.uiout();
6708
- this.target.reset();
6709
- this.target = null;
6803
+ if (this.proto.s) {
6804
+ // if no s target is delete !!
6805
+ this.proto.uiout();
6806
+ this.proto.reset();
6807
+ }
6808
+
6809
+ this.proto = null;
6710
6810
  this.current = -1; ///console.log(this.isDown)//if(this.isDown)Roots.clearInput();
6711
6811
 
6712
6812
  Roots.cursor();
@@ -6732,7 +6832,7 @@
6732
6832
  handleEvent(e) {
6733
6833
  let type = e.type;
6734
6834
  let change = false;
6735
- let targetChange = false;
6835
+ let protoChange = false;
6736
6836
  let name = this.testZone(e);
6737
6837
  if (type === 'mouseup' && this.isDown) this.isDown = false;
6738
6838
  if (type === 'mousedown' && !this.isDown) this.isDown = true;
@@ -6748,9 +6848,9 @@
6748
6848
  case 'content':
6749
6849
  e.clientY = this.isScroll ? e.clientY + this.decal : e.clientY;
6750
6850
  if (Roots.isMobile && type === 'mousedown') this.getNext(e, change);
6751
- if (this.target) targetChange = this.target.handleEvent(e);
6851
+ if (this.proto) protoChange = this.proto.handleEvent(e);
6752
6852
  if (type === 'mousemove') change = this.mode('def');
6753
- if (type === 'wheel' && !targetChange && this.isScroll) change = this.onWheel(e);
6853
+ if (type === 'wheel' && !protoChange && this.isScroll) change = this.onWheel(e);
6754
6854
 
6755
6855
  if (!Roots.lock) {
6756
6856
  this.getNext(e, change);
@@ -6783,7 +6883,7 @@
6783
6883
  }
6784
6884
 
6785
6885
  if (this.isDown) change = true;
6786
- if (targetChange) change = true;
6886
+ if (protoChange) change = true;
6787
6887
  if (type === 'keyup') change = true;
6788
6888
  if (type === 'keydown') change = true;
6789
6889
  if (change) this.draw();
@@ -6799,8 +6899,8 @@
6799
6899
  }
6800
6900
 
6801
6901
  if (next !== -1) {
6802
- this.target = this.uis[this.current];
6803
- this.target.uiover();
6902
+ this.proto = this.uis[this.current];
6903
+ this.proto.uiover();
6804
6904
  }
6805
6905
  }
6806
6906
 
@@ -6842,36 +6942,19 @@
6842
6942
  main: this
6843
6943
  });else {
6844
6944
  a[2].isUI = true;
6845
- a[2].main = this;
6846
- ontop = a[1].ontop ? a[1].ontop : false;
6945
+ a[2].main = this; //ontop = a[1].ontop ? a[1].ontop : false;
6946
+
6947
+ ontop = a[2].ontop ? a[2].ontop : false;
6847
6948
  }
6848
6949
  }
6849
6950
 
6850
6951
  let u = add.apply(this, a);
6851
6952
  if (u === null) return;
6852
6953
  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
6954
  this.calc();
6865
6955
  this.isEmpty = false;
6866
6956
  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
6957
+ } // remove one node
6875
6958
 
6876
6959
 
6877
6960
  remove(n) {
@@ -6899,14 +6982,11 @@
6899
6982
  while (i--) {
6900
6983
  item = this.uis.pop();
6901
6984
  this.inner.removeChild(item.c[0]);
6902
- item.dispose(); //this.uis[i].clear()
6985
+ item.dispose();
6903
6986
  }
6904
6987
 
6905
6988
  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
-
6989
+ this.isEmpty = true;
6910
6990
  this.calc();
6911
6991
  }
6912
6992
 
@@ -6962,8 +7042,7 @@
6962
7042
  this.total = this.h;
6963
7043
  this.maxView = this.maxHeight;
6964
7044
  this.ratio = this.maxView / this.total;
6965
- this.sh = this.maxView * this.ratio; //if( this.sh < 20 ) this.sh = 20;
6966
-
7045
+ this.sh = this.maxView * this.ratio;
6967
7046
  this.range = this.maxView - this.sh;
6968
7047
  this.oy = Tools.clamp(this.oy, 0, this.range);
6969
7048
  this.scrollBG.style.height = this.maxView + 'px';
@@ -7006,7 +7085,6 @@
7006
7085
  let diff = this.h - this.maxHeight;
7007
7086
 
7008
7087
  if (diff > 1) {
7009
- //this.h > this.maxHeight ){
7010
7088
  this.isScroll = true;
7011
7089
  this.zone.h = this.maxHeight + this.bh;
7012
7090
  } else {
@@ -7018,9 +7096,8 @@
7018
7096
  this.innerContent.style.height = this.zone.h - this.bh + 'px';
7019
7097
  this.content.style.height = this.zone.h + 'px';
7020
7098
  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()
7099
+ if (this.forceHeight && this.lockHeight) this.content.style.height = this.forceHeight + 'px';
7100
+ if (this.isCanvas) this.draw(true);
7024
7101
  }
7025
7102
 
7026
7103
  rezone() {
@@ -7029,14 +7106,10 @@
7029
7106
 
7030
7107
  setWidth(w) {
7031
7108
  if (w) this.zone.w = w;
7032
- this.zone.w = Math.floor(this.zone.w); //console.log( this.zone.w )
7033
-
7109
+ this.zone.w = Math.floor(this.zone.w);
7034
7110
  this.content.style.width = this.zone.w + 'px';
7035
7111
  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();
7112
+ this.setItemWidth(this.zone.w - this.sw);
7040
7113
  }
7041
7114
 
7042
7115
  setItemWidth(w) {
@@ -7050,8 +7123,9 @@
7050
7123
 
7051
7124
  }
7052
7125
 
7053
- const REVISION = '4.0.4';
7126
+ const REVISION = '4.0.9';
7054
7127
 
7128
+ exports.Files = Files;
7055
7129
  exports.Gui = Gui;
7056
7130
  exports.Proto = Proto;
7057
7131
  exports.REVISION = REVISION;