lexgui 0.1.18 → 0.1.20

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/lexgui.css CHANGED
@@ -1,4 +1,3 @@
1
- @import url('https://fonts.googleapis.com/css2?family=Inconsolata:wght@400&display=swap');
2
1
  @import url('https://fonts.googleapis.com/css2?family=Noto+Sans:wght@300;400;500;600;700;800;900&display=swap');
3
2
  @import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@700&display=swap');
4
3
 
@@ -17,12 +16,15 @@
17
16
  --global-text-primary: #f4f4ffe6;
18
17
  --global-text-secondary: #c6c6cfd9;
19
18
  --global-dark-background: #14161a;
20
- --global-blur-background: #292b2da9;
19
+ --global-blur-background: #28292ba9;
21
20
  --transition-time: 1000;
22
21
  }
23
22
 
24
23
  /* Some global colors */
25
24
  .orange { color: orange }
25
+ .gray { color: gray }
26
+ .dodgerblue { color: dodgerblue }
27
+ .lightblue { color: rgb(90, 168, 247) }
26
28
 
27
29
  ::-webkit-scrollbar {
28
30
  height: 3px;
@@ -129,7 +131,7 @@ body.nocursor * {
129
131
  background-color: var(--global-blur-background);
130
132
  -webkit-backdrop-filter: blur(12px);
131
133
  backdrop-filter: blur(12px);
132
- border-radius: 12px;
134
+ border-radius: 8px;
133
135
  border: 1px solid #d0d0ec6b;
134
136
  width: 30%;
135
137
  top: 15%;
@@ -187,6 +189,26 @@ body.nocursor * {
187
189
  float: left;
188
190
  }
189
191
 
192
+ #global_search .searchitembox .searchitem i {
193
+ width: 12px;
194
+ font-size: 11px;
195
+ margin-right: 4px;
196
+ margin-top: -2px;
197
+ vertical-align: middle;
198
+ }
199
+
200
+ #global_search .searchitembox .searchitem img {
201
+ width: 12px;
202
+ margin-right: 4px;
203
+ margin-top: -2px;
204
+ vertical-align: middle;
205
+ }
206
+
207
+ #global_search .searchitembox .searchitem .lang-ext {
208
+ color: #676e75;
209
+ font-size: 12px;
210
+ }
211
+
190
212
  #global_search .searchitembox .searchitem.last {
191
213
  border-bottom-left-radius: 6px;
192
214
  border-bottom-right-radius: 6px;
@@ -729,7 +751,7 @@ body.nocursor * {
729
751
  display: grid;
730
752
  align-content: center;
731
753
  background-color: var(--global-button-color);
732
- border-radius: 8px;
754
+ border-radius: 6px;
733
755
  border: none;
734
756
  margin-top: 2px;
735
757
  height: 22px !important;
@@ -1248,7 +1270,7 @@ input[type="range"] {
1248
1270
  margin-top: -4px;
1249
1271
  width: 8px;
1250
1272
  height: 8px;
1251
- border-radius: 8px;
1273
+ border-radius: 6px;
1252
1274
  background: #c9c7de;
1253
1275
  cursor: pointer;
1254
1276
  }
@@ -1257,7 +1279,7 @@ input[type="range"] {
1257
1279
  margin-top: -8px;
1258
1280
  width: 8px;
1259
1281
  height: 8px;
1260
- border-radius: 8px;
1282
+ border-radius: 6px;
1261
1283
  background: #a19dc9;
1262
1284
  cursor: pointer;
1263
1285
  }
@@ -1412,6 +1434,22 @@ input[type="range"] {
1412
1434
  user-select: none; /* Standard syntax */
1413
1435
  }
1414
1436
 
1437
+ .lextree .lextreeitem img {
1438
+ width: 12px;
1439
+ height: 12px;
1440
+ margin-right: 4px;
1441
+ vertical-align: middle;
1442
+ margin-top: -1px;
1443
+ }
1444
+
1445
+ .lextree .lextreeitem .tree-item-icon {
1446
+ width: 12px;
1447
+ height: 12px;
1448
+ margin-right: 4px;
1449
+ vertical-align: middle;
1450
+ margin-top: -1px;
1451
+ }
1452
+
1415
1453
  .lextree .lextreeitem.draggingover {
1416
1454
  background: #7b8ae27b;
1417
1455
  }
@@ -1700,7 +1738,7 @@ meter::-webkit-meter-even-less-good-value {
1700
1738
  background-color: var(--global-color-secondary);
1701
1739
  margin-top: 10px;
1702
1740
  margin-bottom: 8px;
1703
- border-radius: 10px;
1741
+ border-radius: 8px;
1704
1742
  padding-left: 4px;
1705
1743
  padding-right: 4px;
1706
1744
  }
@@ -2697,9 +2735,11 @@ ul.lexassetscontent {
2697
2735
  }
2698
2736
 
2699
2737
  .codebasearea .lexareatab i {
2738
+ width: 12px;
2700
2739
  font-size: 10px;
2701
2740
  margin-right: 4px;
2702
2741
  vertical-align: middle;
2742
+ margin-top: -3px;
2703
2743
  }
2704
2744
 
2705
2745
  .codebasearea .lexareatab img {
@@ -2707,6 +2747,7 @@ ul.lexassetscontent {
2707
2747
  height: 12px;
2708
2748
  margin-right: 4px;
2709
2749
  vertical-align: middle;
2750
+ margin-top: -2px;
2710
2751
  }
2711
2752
 
2712
2753
  .lexcodeeditor ::-webkit-scrollbar {
@@ -2774,14 +2815,21 @@ ul.lexassetscontent {
2774
2815
 
2775
2816
  .lexcodeeditor .code {
2776
2817
  cursor: text;
2777
- font-size: 16px;
2818
+ font-family: "CommitMono", monospace;
2819
+ -webkit-font-smoothing: antialiased;
2820
+ -moz-osx-font-smoothing: grayscale;
2821
+ font-feature-settings: "ss04", "ss05";
2822
+ font-size: 0.8rem;
2778
2823
  padding-right: 6px;
2779
2824
  position: relative;
2780
2825
  }
2781
2826
 
2782
2827
  .codechar {
2783
- font-size: 16px;
2784
- font-family: 'Inconsolata', monospace;
2828
+ font-family: "CommitMono", monospace;
2829
+ -webkit-font-smoothing: antialiased;
2830
+ -moz-osx-font-smoothing: grayscale;
2831
+ font-feature-settings: "ss04", "ss05";
2832
+ font-size: 0.8rem;
2785
2833
  position: absolute;
2786
2834
  top: 0;
2787
2835
  left: 0;
@@ -2796,9 +2844,6 @@ ul.lexassetscontent {
2796
2844
  border-radius: 0;
2797
2845
  border-width: 0;
2798
2846
  background: transparent;
2799
- font-family: 'Inconsolata', monospace;
2800
- font-size: inherit;
2801
- font-weight: bold;
2802
2847
  margin: 0px 0px;
2803
2848
  white-space: pre;
2804
2849
  word-wrap: normal;
@@ -2812,7 +2857,7 @@ ul.lexassetscontent {
2812
2857
  }
2813
2858
 
2814
2859
  .lexcodeeditor pre.active-line {
2815
- background-color: var(--global-blur-background);
2860
+ background-color: #333437a9;
2816
2861
  }
2817
2862
 
2818
2863
  .lexcodeeditor span {
@@ -2830,10 +2875,11 @@ ul.lexassetscontent {
2830
2875
  }
2831
2876
 
2832
2877
  pre .line-gutter {
2833
- color: #888;
2878
+ color: #8a8b97;
2834
2879
  width: 48px;
2835
2880
  height: 20px;
2836
2881
  font-size: 14px;
2882
+ font-weight: 400;
2837
2883
  line-height: 20px;
2838
2884
  text-align: center;
2839
2885
  -webkit-user-select: none; /* Safari 3.1+ */
@@ -2866,7 +2912,6 @@ pre .line-gutter {
2866
2912
  .lexcodeeditor .cursors .cursor {
2867
2913
  -webkit-text-size-adjust: 100%;
2868
2914
  font-family: monospace;
2869
- color: #AAA !important;
2870
2915
  font-size: 16px;
2871
2916
  cursor: text;
2872
2917
  box-sizing: border-box;
@@ -2875,7 +2920,7 @@ pre .line-gutter {
2875
2920
  border-right: none;
2876
2921
  width: 0;
2877
2922
  position: absolute;
2878
- border-left: 3px solid #c5c5c5d6 !important;
2923
+ border-left: 3px solid #fff !important;
2879
2924
  z-index: 0 !important;
2880
2925
  left: 0px;
2881
2926
  top: 0px;
@@ -2943,9 +2988,8 @@ pre .line-gutter {
2943
2988
  top: 0px;
2944
2989
  width: 100px;
2945
2990
  height: 20px;
2946
- margin-top: -2px;
2947
2991
  background-color: var(--global-selected);
2948
- opacity: 0.3;
2992
+ opacity: 0.4;
2949
2993
  }
2950
2994
 
2951
2995
  .lexcodeeditor .autocomplete {
@@ -3067,6 +3111,16 @@ pre .line-gutter {
3067
3111
  .cm-sym.wgsl { color: #f9cb20; } /* symbol */
3068
3112
  .cm-mtd.wgsl { color: #e0cc68; } /* method */
3069
3113
 
3114
+ .cm-str.rust { color: #ca7d59; } /* string */
3115
+ .cm-kwd.rust { color: #218cce; } /* keyword */
3116
+ .cm-com.rust { color: #5cab5a; } /* comment */
3117
+ .cm-typ.rust { color: #36c0b0; } /* type */
3118
+ .cm-std.rust { color: #cf6dcf; } /* statements & declarations */
3119
+ .cm-bln.rust { color: inherit; } /* builtin */
3120
+ .cm-dec.rust { color: #b1ce9b; } /* decimal */
3121
+ .cm-sym.rust { color: #e7ded2; } /* symbol */
3122
+ .cm-mtd.rust { color: #e0cc68 } /* method */
3123
+
3070
3124
  .cm-str.python { color: #ca7d59; } /* string */
3071
3125
  .cm-kwd.python { color: #218cce; } /* keyword */
3072
3126
  .cm-com.python { color: #5cab5a; } /* comment */
package/build/lexgui.js CHANGED
@@ -12,7 +12,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
12
12
  */
13
13
 
14
14
  var LX = global.LX = {
15
- version: "0.1.18",
15
+ version: "0.1.20",
16
16
  ready: false,
17
17
  components: [], // specific pre-build components
18
18
  signals: {} // events and triggers
@@ -24,6 +24,13 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
24
24
  function clamp (num, min, max) { return Math.min(Math.max(num, min), max) }
25
25
  function round(num, n) { return +num.toFixed(n); }
26
26
 
27
+ function getSupportedDOMName( string )
28
+ {
29
+ return string.replace(/\s/g, '').replaceAll('@', '_').replaceAll('+', '_plus_').replaceAll('.', '');
30
+ }
31
+
32
+ LX.getSupportedDOMName = getSupportedDOMName;
33
+
27
34
  function has( component_name )
28
35
  {
29
36
  return (LX.components.indexOf( component_name ) > -1);
@@ -258,7 +265,16 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
258
265
  e.stopPropagation();
259
266
  global_search.classList.toggle('hidden');
260
267
  global_search.querySelector('input').focus();
261
- add_elements(undefined);
268
+ add_elements( undefined );
269
+ }
270
+ else
271
+ {
272
+ for( let c of LX.components )
273
+ if( LX[c].prototype.onKeyPressed )
274
+ {
275
+ const instances = LX.CodeEditor.getInstances();
276
+ for( let i of instances ) i.onKeyPressed( e );
277
+ }
262
278
  }
263
279
  });
264
280
 
@@ -342,18 +358,24 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
342
358
  {
343
359
  const instances = LX.CodeEditor.getInstances();
344
360
  if(!instances.length) return;
345
-
346
- const languages = Object.keys( instances[0].languages );
347
-
348
- for( let l of languages ) {
349
-
350
- const key = "Set language: " + l;
351
- if( key.toLowerCase().includes(filter) ) {
352
- add_element(key, () => {
361
+
362
+ const languages = instances[ 0 ].languages;
363
+
364
+ for( let l of Object.keys( languages ) ) {
365
+
366
+ const key = "Language: " + l;
367
+ const icon = instances[ 0 ]._getFileIcon( null, languages[ l ].ext );
368
+
369
+ let value = icon.includes( 'fa-' ) ? "<i class='" + icon + "'></i>" :
370
+ "<img src='" + ( "https://raw.githubusercontent.com/jxarco/lexgui.js/master/" + icon ) + "'>";
371
+
372
+ value += key + " <span class='lang-ext'>(" + languages[ l ].ext + ")</span>";
373
+ if( key.toLowerCase().includes( filter ) ) {
374
+ add_element( value, () => {
353
375
  for( let i of instances ) {
354
376
  i._changeLanguage( l );
355
377
  }
356
- }, "", {});
378
+ }, "", {} );
357
379
  }
358
380
  }
359
381
  }
@@ -1355,14 +1377,14 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
1355
1377
 
1356
1378
  _moveSplit( dt, force_animation = false, force_width = 0 ) {
1357
1379
 
1358
- if(!this.type)
1359
- throw("No split area");
1380
+ if( !this.type )
1381
+ throw( "No split area" );
1360
1382
 
1361
- if(dt === undefined) // splitbar didn't move!
1383
+ if( dt === undefined ) // Splitbar didn't move!
1362
1384
  return;
1363
1385
 
1364
- var a1 = this.sections[0];
1365
- var a2 = this.sections[1];
1386
+ var a1 = this.sections[ 0 ];
1387
+ var a2 = this.sections[ 1 ];
1366
1388
  var splitinfo = " - "+ LX.DEFAULT_SPLITBAR_SIZE + "px";
1367
1389
 
1368
1390
  let transition = null;
@@ -1371,29 +1393,30 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
1371
1393
  // Remove transitions for this change..
1372
1394
  transition = a1.root.style.transition;
1373
1395
  a1.root.style.transition = a2.root.style.transition = "none";
1374
- flushCss(a1.root);
1375
- flushCss(a2.root);
1396
+ flushCss( a1.root );
1397
+ flushCss( a2.root );
1376
1398
  }
1377
1399
 
1378
- if(this.type == "horizontal") {
1379
-
1380
- var size = Math.max(a2.root.offsetWidth + dt, parseInt(a2.minWidth));
1400
+ if( this.type == "horizontal" )
1401
+ {
1402
+ var size = Math.max( a2.root.offsetWidth + dt, parseInt( a2.minWidth ) );
1381
1403
  if( force_width ) size = force_width;
1382
- a1.root.style.width = "-moz-calc( 100% - " + size + "px " + splitinfo + " )";
1383
- a1.root.style.width = "-webkit-calc( 100% - " + size + "px " + splitinfo + " )";
1384
- a1.root.style.width = "calc( 100% - " + size + "px " + splitinfo + " )";
1385
- a1.root.style.minWidth = a1.minWidth + "px";
1386
- a2.root.style.width = size + "px"; //other split
1404
+ a1.root.style.width = "-moz-calc( 100% - " + size + "px " + splitinfo + " )";
1405
+ a1.root.style.width = "-webkit-calc( 100% - " + size + "px " + splitinfo + " )";
1406
+ a1.root.style.width = "calc( 100% - " + size + "px " + splitinfo + " )";
1407
+ a1.root.style.minWidth = parseInt( a1.minWidth ) + "px";
1408
+ a2.root.style.width = size + "px";
1409
+ if( a1.maxWidth != Infinity ) a2.root.style.minWidth = "calc( 100% - " + parseInt( a1.maxWidth ) + "px" + " )";
1387
1410
  }
1388
- else {
1389
-
1411
+ else
1412
+ {
1390
1413
  var size = Math.max((a2.root.offsetHeight + dt) + a2.offset, parseInt(a2.minHeight));
1391
1414
  if( force_width ) size = force_width;
1392
- a1.root.style.height = "-moz-calc( 100% - " + size + "px " + splitinfo + " )";
1393
- a1.root.style.height = "-webkit-calc( 100% - " + size + "px " + splitinfo + " )";
1394
- a1.root.style.height = "calc( 100% - " + size + "px " + splitinfo + " )";
1415
+ a1.root.style.height = "-moz-calc( 100% - " + size + "px " + splitinfo + " )";
1416
+ a1.root.style.height = "-webkit-calc( 100% - " + size + "px " + splitinfo + " )";
1417
+ a1.root.style.height = "calc( 100% - " + size + "px " + splitinfo + " )";
1395
1418
  a1.root.style.minHeight = a1.minHeight + "px";
1396
- a2.root.style.height = ( size - a2.offset ) + "px"; //other split
1419
+ a2.root.style.height = ( size - a2.offset ) + "px";
1397
1420
  }
1398
1421
 
1399
1422
  if( !force_animation )
@@ -1598,15 +1621,22 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
1598
1621
  this.area.root.classList.toggle('folded', !this.folded);
1599
1622
  }
1600
1623
 
1601
- if(options.onSelect) options.onSelect(e, tabEl.dataset.name);
1624
+ if(options.onSelect)
1625
+ options.onSelect(e, tabEl.dataset.name);
1626
+ });
1627
+
1628
+ tabEl.addEventListener("contextmenu", e => {
1629
+ e.preventDefault();
1630
+ e.stopPropagation();
1631
+
1632
+ if(options.onContextMenu)
1633
+ options.onContextMenu( e, tabEl.dataset.name );
1602
1634
  });
1603
1635
 
1604
1636
  tabEl.addEventListener("mouseup", e => {
1605
1637
  e.preventDefault();
1606
1638
  e.stopPropagation();
1607
- if(e.button == 1 ) {
1608
- if(this.onclose)
1609
- this.onclose( tabEl.dataset["name"] );
1639
+ if( e.button == 1 ) {
1610
1640
  this.delete( tabEl.dataset["name"] );
1611
1641
  }
1612
1642
  });
@@ -1617,7 +1647,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
1617
1647
  e.preventDefault();
1618
1648
  return;
1619
1649
  }
1620
- e.dataTransfer.setData("source", e.target.id);
1650
+ e.dataTransfer.setData( "source", e.target.id );
1621
1651
  });
1622
1652
 
1623
1653
  // Attach content
@@ -1646,6 +1676,9 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
1646
1676
  if(!tabEl || tabEl.fixed)
1647
1677
  return;
1648
1678
 
1679
+ if( this.onclose )
1680
+ this.onclose( name );
1681
+
1649
1682
  // Delete tab element
1650
1683
  this.tabDOMs[ name ].remove();
1651
1684
  delete this.tabDOMs[ name ];
@@ -2144,8 +2177,8 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
2144
2177
 
2145
2178
  set( value ) {
2146
2179
 
2147
- if(this.onSetValue)
2148
- this.onSetValue(value);
2180
+ if( this.onSetValue )
2181
+ this.onSetValue( value );
2149
2182
  }
2150
2183
 
2151
2184
  oncontextmenu(e) {
@@ -2388,22 +2421,33 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
2388
2421
 
2389
2422
  let item = document.createElement('li');
2390
2423
  item.className = "lextreeitem " + "datalevel" + level + (is_parent ? " parent" : "") + (is_selected ? " selected" : "");
2391
- item.id = node.id;
2424
+ item.id = LX.getSupportedDOMName( node.id );
2392
2425
  item.tabIndex = "0";
2393
2426
 
2394
2427
  // Select hierarchy icon
2395
- let icon = "fa-solid fa-square"; // Default: no childs
2428
+ let icon = (this.options.skip_default_icon ?? true) ? "" : "fa-solid fa-square"; // Default: no childs
2396
2429
  if( is_parent ) icon = node.closed ? "fa-solid fa-caret-right" : "fa-solid fa-caret-down";
2397
2430
  item.innerHTML = "<a class='" + icon + " hierarchy'></a>";
2398
2431
 
2399
2432
  // Add display icon
2400
2433
  icon = node.icon;
2401
- if( icon ) item.innerHTML += "<a class='" + icon + "'></a>";
2434
+
2435
+ // Process icon
2436
+ if( node.icon )
2437
+ {
2438
+ if( node.icon.includes( 'fa-' ) ) // It's fontawesome icon...
2439
+ item.innerHTML += "<a class='" + node.icon + " tree-item-icon'></a>";
2440
+ else // an image..
2441
+ {
2442
+ const rootPath = "https://raw.githubusercontent.com/jxarco/lexgui.js/master/";
2443
+ item.innerHTML += "<img src='" + ( rootPath + node.icon ) + "'>";
2444
+ }
2445
+ }
2402
2446
 
2403
2447
  item.innerHTML += (node.rename ? "" : node.id);
2404
2448
 
2405
2449
  item.setAttribute('draggable', true);
2406
- item.style.paddingLeft = ((is_parent ? 0 : 3 ) + (3 + (level+1) * 25)) + "px";
2450
+ item.style.paddingLeft = ((is_parent ? 0 : 3 ) + (3 + (level+1) * 15)) + "px";
2407
2451
  list.appendChild(item);
2408
2452
 
2409
2453
  // Callbacks
@@ -2445,16 +2489,19 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
2445
2489
  }
2446
2490
  });
2447
2491
 
2448
- if( this.options.rename ?? true )
2449
- item.addEventListener("dblclick", function() {
2492
+ item.addEventListener("dblclick", function() {
2493
+ if( that.options.rename ?? true )
2494
+ {
2450
2495
  // Trigger rename
2451
2496
  node.rename = true;
2452
2497
  that.refresh();
2453
- if(that.onevent) {
2454
- const event = new TreeEvent(TreeEvent.NODE_DBLCLICKED, node);
2455
- that.onevent( event );
2456
- }
2457
- });
2498
+ }
2499
+ if( that.onevent )
2500
+ {
2501
+ const event = new TreeEvent(TreeEvent.NODE_DBLCLICKED, node);
2502
+ that.onevent( event );
2503
+ }
2504
+ });
2458
2505
 
2459
2506
  item.addEventListener("contextmenu", e => {
2460
2507
  e.preventDefault();
@@ -2492,7 +2539,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
2492
2539
  else if( e.key == "ArrowUp" || e.key == "ArrowDown" ) // Unique or zero selected
2493
2540
  {
2494
2541
  var selected = this.selected.length > 1 ? (e.key == "ArrowUp" ? this.selected.shift() : this.selected.pop()) : this.selected[0];
2495
- var el = this.domEl.querySelector("#" + selected.id);
2542
+ var el = this.domEl.querySelector("#" + LX.getSupportedDOMName( selected.id ) );
2496
2543
  var sibling = e.key == "ArrowUp" ? el.previousSibling : el.nextSibling;
2497
2544
  if( sibling ) sibling.click();
2498
2545
  }
@@ -2520,7 +2567,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
2520
2567
  that.onevent( event );
2521
2568
  }
2522
2569
 
2523
- node.id = this.value;
2570
+ node.id = LX.getSupportedDOMName( this.value );
2524
2571
  delete node.rename;
2525
2572
  that.frefresh( node.id );
2526
2573
  list.querySelector("#" + this.value).classList.add('selected');
@@ -2671,21 +2718,21 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
2671
2718
  }
2672
2719
  }
2673
2720
 
2674
- refresh(newData, selectedId) {
2721
+ refresh( newData, selectedId ) {
2675
2722
  this.data = newData ?? this.data;
2676
- this.domEl.querySelector("ul").innerHTML = "";
2723
+ this.domEl.querySelector( "ul" ).innerHTML = "";
2677
2724
  this._create_item( null, this.data, 0, selectedId );
2678
2725
  }
2679
-
2726
+
2680
2727
  /* Refreshes the tree and focuses current element */
2681
2728
  frefresh( id ) {
2682
2729
  this.refresh();
2683
- var el = this.domEl.querySelector("#" + id);
2684
- if(el) el.focus();
2730
+ var el = this.domEl.querySelector( "#" + id );
2731
+ if( el ) el.focus();
2685
2732
  }
2686
-
2687
- select(id) {
2688
- this.refresh(null, id);
2733
+
2734
+ select( id ) {
2735
+ this.refresh( null, id );
2689
2736
  }
2690
2737
  }
2691
2738
 
@@ -3517,6 +3564,15 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
3517
3564
  addButton( name, value, callback, options = {} ) {
3518
3565
 
3519
3566
  let widget = this.create_widget(name, Widget.BUTTON, options);
3567
+ widget.onGetValue = () => {
3568
+ return wValue.innerText;
3569
+ };
3570
+ widget.onSetValue = (new_value) => {
3571
+ wValue.innerHTML = "<span>" +
3572
+ (options.icon ? "<a class='" + options.icon + "'></a>" :
3573
+ ( options.img ? "<img src='" + options.img + "'>" : (new_value || ""))) + "</span>";
3574
+ };
3575
+
3520
3576
  let element = widget.domEl;
3521
3577
 
3522
3578
  var wValue = document.createElement('button');
@@ -5852,7 +5908,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
5852
5908
  const hasSubmenu = o[ k ].length;
5853
5909
  let entry = document.createElement('div');
5854
5910
  entry.className = "lexcontextmenuentry" + (o[ 'className' ] ? " " + o[ 'className' ] : "" );
5855
- entry.id = o.id ?? ("eId" + this._getSupportedDOMName( k ));
5911
+ entry.id = o.id ?? ("eId" + getSupportedDOMName( k ));
5856
5912
  entry.innerHTML = "";
5857
5913
  const icon = o[ 'icon' ];
5858
5914
  if(icon) {
@@ -5999,7 +6055,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
5999
6055
  for( let item of this.items )
6000
6056
  {
6001
6057
  let key = Object.keys(item)[0];
6002
- let pKey = "eId" + this._getSupportedDOMName( key );
6058
+ let pKey = "eId" + getSupportedDOMName( key );
6003
6059
 
6004
6060
  // Item already created
6005
6061
  const id = "#" + (item.id ?? pKey);
@@ -6015,10 +6071,6 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
6015
6071
 
6016
6072
  this.colors[ token ] = color;
6017
6073
  }
6018
-
6019
- _getSupportedDOMName( key ) {
6020
- return key.replace(/\s/g, '').replaceAll('@', '_').replaceAll('+', '_plus_');
6021
- }
6022
6074
  };
6023
6075
 
6024
6076
  LX.ContextMenu = ContextMenu;