lexgui 0.1.14 → 0.1.16

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
@@ -2709,7 +2709,7 @@ ul.lexassetscontent {
2709
2709
  .lexcodeeditor {
2710
2710
  outline: none;
2711
2711
  overflow: hidden;
2712
- width: calc(100% );
2712
+ width: calc(100%);
2713
2713
  -webkit-user-select: none; /* Safari 3.1+ */
2714
2714
  -moz-user-select: none; /* Firefox 2+ */
2715
2715
  -ms-user-select: none; /* IE 10+ */
@@ -2730,9 +2730,9 @@ ul.lexassetscontent {
2730
2730
 
2731
2731
  .lexcodegutter {
2732
2732
  width: 32px;
2733
- height: calc(100% - 69px); /* 6px of the vertical scrollbar */
2733
+ height: calc(100% - 70px);
2734
2734
  background-color: var(--global-branch-darker);
2735
- margin-top: 25px;
2735
+ margin-top: 24px;
2736
2736
  text-align: center;
2737
2737
  overflow: hidden;
2738
2738
  -webkit-user-select: none; /* Safari 3.1+ */
@@ -2753,19 +2753,29 @@ ul.lexassetscontent {
2753
2753
  line-height: 22px;
2754
2754
  }
2755
2755
 
2756
- .lexcodeeditor .code {
2757
- height: calc(100% - 30px);
2758
- cursor: text;
2759
- font-size: 16px;
2760
- overflow: scroll;
2756
+ .lexcodeeditor .codetabsarea {
2761
2757
  background-color: var(--global-branch-darker);
2762
- padding-right: 6px;
2763
2758
  }
2764
2759
 
2765
- .lexcodeeditor .code.dragging {
2760
+ .lexcodeeditor .codetabsarea.with-vscrollbar {
2761
+ width: calc( 100% - 10px ) !important;
2762
+ }
2763
+
2764
+ .lexcodeeditor .codetabsarea.with-hscrollbar {
2765
+ height: calc( 100% - 40px ) !important;
2766
+ }
2767
+
2768
+ .lexcodeeditor .codetabsarea.dragging {
2766
2769
  background-color: var(--global-color-secondary);
2767
2770
  }
2768
2771
 
2772
+ .lexcodeeditor .code {
2773
+ cursor: text;
2774
+ font-size: 16px;
2775
+ overflow: hidden;
2776
+ padding-right: 6px;
2777
+ }
2778
+
2769
2779
  .codechar {
2770
2780
  font-size: 16px;
2771
2781
  font-family: 'Inconsolata', monospace;
@@ -2797,6 +2807,7 @@ ul.lexassetscontent {
2797
2807
  -webkit-tap-highlight-color: transparent;
2798
2808
  z-index: 0 !important;
2799
2809
  pointer-events: none;
2810
+ height: 16px;
2800
2811
  }
2801
2812
 
2802
2813
  .lexcodeeditor span {
@@ -2852,6 +2863,56 @@ ul.lexassetscontent {
2852
2863
  height: 18px;
2853
2864
  }
2854
2865
 
2866
+ .lexcodescrollbar {
2867
+ position: absolute;
2868
+ background-color: var(--global-branch-darker);
2869
+ filter: brightness(0.9);
2870
+ box-sizing: border-box;
2871
+ margin: 0;
2872
+ padding: 0;
2873
+ margin-top: 26px;
2874
+ z-index: 1 !important;
2875
+ right: 0px;
2876
+ width: 10px;
2877
+ height: calc(100% - 62px);
2878
+ }
2879
+
2880
+ .lexcodescrollbar.horizontal {
2881
+ position: absolute;
2882
+ background-color: var(--global-branch-darker);
2883
+ filter: brightness(0.9);
2884
+ box-sizing: border-box;
2885
+ margin: 0;
2886
+ padding: 0;
2887
+ z-index: 1 !important;
2888
+ bottom: 36px;
2889
+ right: 10px;
2890
+ width: calc( 100% - 40px );
2891
+ height: 10px;
2892
+ }
2893
+
2894
+ .lexcodescrollbar.scrollbar-unused {
2895
+ display: none;
2896
+ }
2897
+
2898
+ .lexcodescrollbar div { /* thumb */
2899
+ background-color: #bbbbbb57 !important;
2900
+ box-sizing: border-box;
2901
+ margin: 0;
2902
+ padding: 0;
2903
+ border-right: none;
2904
+ position: absolute;
2905
+ z-index: 0 !important;
2906
+ top: 0px;
2907
+ width: 10px;
2908
+ height: 10px;
2909
+ transition: linear 0.1s background-color;
2910
+ }
2911
+
2912
+ .lexcodescrollbar div:hover { /* thumb */
2913
+ background-color: #bbbbbb8c !important;
2914
+ }
2915
+
2855
2916
  .lexcodeeditor .lexcodeselection {
2856
2917
  -webkit-text-size-adjust: 100%;
2857
2918
  font-family: monospace;
@@ -2862,6 +2923,7 @@ ul.lexassetscontent {
2862
2923
  margin: 0;
2863
2924
  padding: 0;
2864
2925
  border-right: none;
2926
+ border-radius: 1px;
2865
2927
  position: absolute;
2866
2928
  z-index: 0 !important;
2867
2929
  left: 0px;
@@ -2931,7 +2993,7 @@ ul.lexassetscontent {
2931
2993
  color: #95a0e1;
2932
2994
  }
2933
2995
 
2934
- .cm-str.javascript { color: #d0774e; } /* string */
2996
+ .cm-str.javascript { color: #ca7d59; } /* string */
2935
2997
  .cm-kwd.javascript { color: #218cce; } /* keyword */
2936
2998
  .cm-com.javascript { color: #5cab5a; } /* comment */
2937
2999
  .cm-typ.javascript { color: #36c0b0; } /* type */
@@ -2941,7 +3003,7 @@ ul.lexassetscontent {
2941
3003
  .cm-sym.javascript { color: #e7ded2; } /* symbol */
2942
3004
  .cm-mtd.javascript { color: #e0cc68 } /* method */
2943
3005
 
2944
- .cm-str.cpp { color: #d0774e; } /* string */
3006
+ .cm-str.cpp { color: #ca7d59; } /* string */
2945
3007
  .cm-kwd.cpp { color: #218cce; } /* keyword */
2946
3008
  .cm-com.cpp { color: #5cab5a; } /* comment */
2947
3009
  .cm-typ.cpp { color: #36c0b0; } /* type */
@@ -2949,10 +3011,10 @@ ul.lexassetscontent {
2949
3011
  .cm-bln.cpp { color: #d44141; } /* builtin */
2950
3012
  .cm-dec.cpp { color: #2ddf53; } /* decimal */
2951
3013
  .cm-sym.cpp { color: #e7ded2; } /* symbol */
2952
- .cm-mtd.cpp { color: #7493d6 } /* method */
3014
+ .cm-mtd.cpp { color: #7a9ae0 } /* method */
2953
3015
  .cm-ppc.cpp { color: #969696 } /* preprocessor */
2954
3016
 
2955
- .cm-str.css { color: #d0774e; } /* string */
3017
+ .cm-str.css { color: #ca7d59; } /* string */
2956
3018
  .cm-kwd.css { color: #e8be53; } /* keyword */
2957
3019
  .cm-com.css { color: #5cab5a; } /* comment */
2958
3020
  .cm-typ.css { color: #b7c3ec; } /* type */
@@ -2962,7 +3024,7 @@ ul.lexassetscontent {
2962
3024
  .cm-sym.css { color: #f9d620; } /* symbol */
2963
3025
  .cm-mtd.css { color: #e0cc68; } /* method */
2964
3026
 
2965
- .cm-str.json { color: #d0774e; } /* string */
3027
+ .cm-str.json { color: #ca7d59; } /* string */
2966
3028
  .cm-kwd.json { color: inherit; } /* keyword */
2967
3029
  .cm-com.json { color: inherit; } /* comment */
2968
3030
  .cm-typ.json { color: inherit; } /* type */
@@ -2972,7 +3034,7 @@ ul.lexassetscontent {
2972
3034
  .cm-sym.json { color: #cf6dcf; } /* symbol */
2973
3035
  .cm-mtd.json { color: inherit; } /* method */
2974
3036
 
2975
- .cm-str.glsl { color: #d0774e; } /* string */
3037
+ .cm-str.glsl { color: #ca7d59; } /* string */
2976
3038
  .cm-kwd.glsl { color: #2194ce; } /* keyword */
2977
3039
  .cm-com.glsl { color: #5cab5a; } /* comment */
2978
3040
  .cm-typ.glsl { color: #36c0b0; } /* type */
@@ -2982,7 +3044,7 @@ ul.lexassetscontent {
2982
3044
  .cm-sym.glsl { color: #f9cb20; } /* symbol */
2983
3045
  .cm-mtd.glsl { color: #e0cc68; } /* method */
2984
3046
 
2985
- .cm-str.wgsl { color: #d0774e; } /* string */
3047
+ .cm-str.wgsl { color: #ca7d59; } /* string */
2986
3048
  .cm-kwd.wgsl { color: #2194ce; } /* keyword */
2987
3049
  .cm-com.wgsl { color: #5cab5a; } /* comment */
2988
3050
  .cm-typ.wgsl { color: #36c0b0; } /* type */
@@ -2992,7 +3054,7 @@ ul.lexassetscontent {
2992
3054
  .cm-sym.wgsl { color: #f9cb20; } /* symbol */
2993
3055
  .cm-mtd.wgsl { color: #e0cc68; } /* method */
2994
3056
 
2995
- .cm-str.python { color: #d0774e; } /* string */
3057
+ .cm-str.python { color: #ca7d59; } /* string */
2996
3058
  .cm-kwd.python { color: #218cce; } /* keyword */
2997
3059
  .cm-com.python { color: #5cab5a; } /* comment */
2998
3060
  .cm-typ.python { color: #36c0b0; } /* type */
@@ -3002,6 +3064,16 @@ ul.lexassetscontent {
3002
3064
  .cm-sym.python { color: #e7ded2; } /* symbol */
3003
3065
  .cm-mtd.python { color: #e0cc68 } /* method */
3004
3066
 
3067
+ .cm-str.batch { color: #ca7d59; } /* string */
3068
+ .cm-kwd.batch { color: #218cce; } /* keyword */
3069
+ .cm-com.batch { color: #5cab5a; } /* comment */
3070
+ .cm-typ.batch { color: #36c0b0; } /* type */
3071
+ .cm-std.batch { color: #cf6dcf; } /* statements & declarations */
3072
+ .cm-bln.batch { color: inherit; } /* builtin */
3073
+ .cm-dec.batch { color: #b1ce9b; } /* decimal */
3074
+ .cm-sym.batch { color: #dfd85e; } /* symbol */
3075
+ .cm-mtd.batch { color: inherit } /* method */
3076
+
3005
3077
  /* plain color */
3006
3078
  .cm-str.plaintext, .cm-kwd.plaintext, .cm-com.plaintext, .cm-typ.plaintext, .cm-std.plaintext,
3007
3079
  .cm-bln.plaintext, .cm-dec.plaintext, .cm-sym.plaintext, .cm-mtd.plaintext { color: inherit; }
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.14",
15
+ version: "0.1.16",
16
16
  ready: false,
17
17
  components: [], // specific pre-build components
18
18
  signals: {} // events and triggers
@@ -33,7 +33,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
33
33
 
34
34
  function getExtension(s)
35
35
  {
36
- return s.split('.').pop();
36
+ return s.includes('.') ? s.split('.').pop() : null;
37
37
  }
38
38
 
39
39
  LX.getExtension = getExtension;
@@ -343,7 +343,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
343
343
  const instances = LX.CodeEditor.getInstances();
344
344
  if(!instances.length) return;
345
345
 
346
- const languages = instances[0].languages;
346
+ const languages = Object.keys( instances[0].languages );
347
347
 
348
348
  for( let l of languages ) {
349
349
 
@@ -5046,50 +5046,45 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
5046
5046
  if(!name) {
5047
5047
  throw("Set Widget Name!");
5048
5048
  }
5049
-
5049
+
5050
5050
  let widget = this.create_widget(name, Widget.FILE, options);
5051
5051
  let element = widget.domEl;
5052
-
5052
+
5053
5053
  let local = options.local ?? true;
5054
5054
  let type = options.type ?? 'text';
5055
5055
  let read = options.read ?? true;
5056
-
5056
+
5057
5057
  // Create hidden input
5058
5058
  let input = document.createElement('input');
5059
5059
  input.style.width = "calc( 100% - " + LX.DEFAULT_NAME_WIDTH + " - 10%)";
5060
5060
  input.type = 'file';
5061
5061
  if(options.placeholder)
5062
5062
  input.placeholder = options.placeholder;
5063
-
5063
+
5064
5064
  input.addEventListener('change', function(e) {
5065
5065
  const files = e.target.files;
5066
- if(!files.length) return;
5067
- if(read) {
5066
+ if( !files.length ) return;
5067
+ if(read)
5068
+ {
5068
5069
  const reader = new FileReader();
5069
-
5070
- if(type === 'text') {
5071
- reader.readAsText(files[0]);
5072
- }else if(type === 'buffer') {
5073
- reader.readAsArrayBuffer(files[0])
5074
- }else if(type === 'bin') {
5075
- reader.readAsBinaryString(files[0])
5076
- }else if(type === 'url') {
5077
- reader.readAsDataURL(files[0])
5078
- }
5079
-
5080
- reader.onload = (e) => { callback.call(this, e.target.result) } ;
5070
+
5071
+ if(type === 'text') reader.readAsText(files[0]);
5072
+ else if(type === 'buffer') reader.readAsArrayBuffer(files[0]);
5073
+ else if(type === 'bin') reader.readAsBinaryString(files[0]);
5074
+ else if(type === 'url') reader.readAsDataURL(files[0]);
5075
+
5076
+ reader.onload = (e) => { callback.call( this, e.target.result, files[0] ) } ;
5081
5077
  }
5082
- else
5083
- callback(files[0]);
5078
+ else callback(files[0]);
5084
5079
 
5085
5080
  });
5086
-
5081
+
5087
5082
  element.appendChild(input);
5088
-
5083
+
5089
5084
  this.queue( element );
5090
5085
 
5091
- if(local) {
5092
-
5086
+ if( local )
5087
+ {
5093
5088
  this.addButton(null, "<a style='margin-top: 0px;' class='fa-solid fa-gear'></a>", () => {
5094
5089
 
5095
5090
  new Dialog("Load Settings", p => {
@@ -5099,9 +5094,9 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
5099
5094
 
5100
5095
  }, { className: "micro", skipInlineCount: true });
5101
5096
  }
5102
-
5097
+
5103
5098
  this.clearQueue();
5104
-
5099
+
5105
5100
  return widget;
5106
5101
  }
5107
5102
 
@@ -7282,6 +7277,12 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
7282
7277
  }
7283
7278
  });
7284
7279
 
7280
+ Object.defineProperty(String.prototype, 'lastChar', {
7281
+ get: function() { return this[ this.length - 1 ]; },
7282
+ enumerable: true,
7283
+ configurable: true
7284
+ });
7285
+
7285
7286
  Element.prototype.insertChildAtIndex = function(child, index = Infinity) {
7286
7287
  if (index >= this.children.length) this.appendChild(child);
7287
7288
  else this.insertBefore(child, this.children[index]);
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  var LX = {
11
- version: "0.1.14",
11
+ version: "0.1.16",
12
12
  ready: false,
13
13
  components: [], // specific pre-build components
14
14
  signals: {} // events and triggers
@@ -29,7 +29,7 @@ LX.has = has;
29
29
 
30
30
  function getExtension(s)
31
31
  {
32
- return s.split('.').pop();
32
+ return s.includes('.') ? s.split('.').pop() : null;
33
33
  }
34
34
 
35
35
  LX.getExtension = getExtension;
@@ -339,7 +339,7 @@ function create_global_searchbar( root ) {
339
339
  const instances = LX.CodeEditor.getInstances();
340
340
  if(!instances.length) return;
341
341
 
342
- const languages = instances[0].languages;
342
+ const languages = Object.keys( instances[0].languages );
343
343
 
344
344
  for( let l of languages ) {
345
345
 
@@ -5059,24 +5059,19 @@ class Panel {
5059
5059
 
5060
5060
  input.addEventListener('change', function(e) {
5061
5061
  const files = e.target.files;
5062
- if(!files.length) return;
5063
- if(read) {
5062
+ if( !files.length ) return;
5063
+ if(read)
5064
+ {
5064
5065
  const reader = new FileReader();
5065
5066
 
5066
- if(type === 'text') {
5067
- reader.readAsText(files[0]);
5068
- }else if(type === 'buffer') {
5069
- reader.readAsArrayBuffer(files[0])
5070
- }else if(type === 'bin') {
5071
- reader.readAsBinaryString(files[0])
5072
- }else if(type === 'url') {
5073
- reader.readAsDataURL(files[0])
5074
- }
5067
+ if(type === 'text') reader.readAsText(files[0]);
5068
+ else if(type === 'buffer') reader.readAsArrayBuffer(files[0]);
5069
+ else if(type === 'bin') reader.readAsBinaryString(files[0]);
5070
+ else if(type === 'url') reader.readAsDataURL(files[0]);
5075
5071
 
5076
- reader.onload = (e) => { callback.call(this, e.target.result) } ;
5072
+ reader.onload = (e) => { callback.call( this, e.target.result, files[0] ) } ;
5077
5073
  }
5078
- else
5079
- callback(files[0]);
5074
+ else callback(files[0]);
5080
5075
 
5081
5076
  });
5082
5077
 
@@ -5084,8 +5079,8 @@ class Panel {
5084
5079
 
5085
5080
  this.queue( element );
5086
5081
 
5087
- if(local) {
5088
-
5082
+ if( local )
5083
+ {
5089
5084
  this.addButton(null, "<a style='margin-top: 0px;' class='fa-solid fa-gear'></a>", () => {
5090
5085
 
5091
5086
  new Dialog("Load Settings", p => {
@@ -7279,6 +7274,12 @@ Object.assign(LX, {
7279
7274
  }
7280
7275
  });
7281
7276
 
7277
+ Object.defineProperty(String.prototype, 'lastChar', {
7278
+ get: function() { return this[ this.length - 1 ]; },
7279
+ enumerable: true,
7280
+ configurable: true
7281
+ });
7282
+
7282
7283
  Element.prototype.insertChildAtIndex = function(child, index = Infinity) {
7283
7284
  if (index >= this.children.length) this.appendChild(child);
7284
7285
  else this.insertBefore(child, this.children[index]);
package/demo.js CHANGED
@@ -693,9 +693,6 @@ function fillBottomPanel( panel ) {
693
693
  panel.addText("Serial number", "194E283DD", (value, event) => {
694
694
  console.log(value);
695
695
  });
696
-
697
- panel.addNumber( "Decimal Point", 1, null, { min: 0, max: 2, step: 0.001 } )
698
-
699
696
  panel.addTextArea("Notes", "", (value, event) => {
700
697
  console.log(value);
701
698
  }, { placeholder: 'Some notes...' });
@@ -47,11 +47,20 @@
47
47
  // disable_edition: true
48
48
  });
49
49
 
50
- editor.loadFile( "../data/test.json" );
51
- editor.loadFile( "../data/style.css" );
52
- editor.loadFile( "../data/script.js" );
53
- editor.loadFile( "../data/engine.cpp" );
50
+ // editor.loadFile( "../data/test.json" );
51
+ // editor.loadFile( "../data/style.css" );
52
+ // editor.loadFile( "../data/script.js" );
53
+ // editor.loadFile( "../data/engine.cpp" );
54
+ editor.loadFile( "../demo.js" );
54
55
 
56
+ // var button = document.createElement('button');
57
+ // button.value = "CLICK ME";
58
+ // button.style.width = "100px";
59
+ // button.style.height = "100px";
60
+ // button.style.position = "absolute";
61
+ // button.onclick = editor.processLines.bind(editor);
62
+ // document.body.appendChild( button );
63
+
55
64
  var ctx = canvas.getContext("2d");
56
65
  ctx.fillStyle = "#b7a9b1";
57
66
  ctx.font = "48px Monospace";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lexgui",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "JS library to create web graphical user interfaces",
5
5
  "type": "module",
6
6
  "main": "./build/lexgui.js",