lexgui 0.1.23 → 0.1.25

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
@@ -5,6 +5,7 @@
5
5
  --global-font: 'Noto Sans', sans-serif; /*'Rubik', sans-serif; */
6
6
  --global-selected: #3e57e4;
7
7
  --global-selected-light: #7b8ae2;
8
+ --global-selected-dark: #344bccb7;
8
9
  --global-color-primary: #232323;
9
10
  --global-color-secondary: #343434;
10
11
  --global-color-terciary: #444;
@@ -1786,10 +1787,10 @@ meter::-webkit-meter-even-less-good-value {
1786
1787
  z-index: 102;
1787
1788
  position: absolute;
1788
1789
  padding-right: 20px;
1789
- border-bottom-left-radius: 6px;
1790
- border-bottom-right-radius: 6px;
1791
- box-shadow: 0 0 6px black !important;
1790
+ border-radius: 4px;
1791
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.63) !important;
1792
1792
  background-color: var(--global-blur-background);
1793
+ border: 1px solid #91909036;
1793
1794
  }
1794
1795
 
1795
1796
  .lexcontextmenubox:before {
@@ -1802,13 +1803,14 @@ meter::-webkit-meter-even-less-good-value {
1802
1803
  -webkit-backdrop-filter: blur(10px);
1803
1804
  backdrop-filter: blur(10px);
1804
1805
  z-index:-1;
1806
+ border-radius: 4px;
1805
1807
  }
1806
1808
 
1807
1809
  .lexcontextmenubox .lexcontextmenuentry {
1808
1810
  width: 100%;
1809
1811
  color: #c0c4cbe3;
1810
1812
  padding: 3px;
1811
- padding-left: 8px;
1813
+ padding-left: 10px;
1812
1814
  padding-right: 10px;
1813
1815
  padding-bottom: 4px;
1814
1816
  cursor: pointer;
@@ -1816,7 +1818,16 @@ meter::-webkit-meter-even-less-good-value {
1816
1818
  -moz-user-select: none;
1817
1819
  -ms-user-select: none;
1818
1820
  user-select: none;
1819
- border-left: 2px solid var(--global-selected-light);
1821
+ }
1822
+
1823
+ .lexcontextmenubox .lexcontextmenuentry:first-child {
1824
+ border-top-left-radius: 4px;
1825
+ border-top-right-radius: 4px;
1826
+ }
1827
+
1828
+ .lexcontextmenubox .lexcontextmenuentry:last-child {
1829
+ border-bottom-left-radius: 4px;
1830
+ border-bottom-right-radius: 4px;
1820
1831
  }
1821
1832
 
1822
1833
  .lexcontextmenubox .lexcontextmenuentry.cmtitle {
@@ -1848,17 +1859,17 @@ meter::-webkit-meter-even-less-good-value {
1848
1859
  float: right;
1849
1860
  margin-right: 0px;
1850
1861
  margin-top: 10px;
1851
- font-size: 11px;
1862
+ font-size: 10px;
1852
1863
  }
1853
1864
 
1854
1865
  /* submenu specified arrow */
1855
1866
  .lexcontextmenubox .lexcontextmenuentry a.fa-xs {
1856
1867
  float: right;
1857
- margin-top: -7px;
1868
+ margin-top: -8px;
1858
1869
  }
1859
1870
 
1860
1871
  .lexcontextmenubox .lexcontextmenuentry:hover:not(.cmtitle) {
1861
- background-color: var(--global-selected);
1872
+ background-color: var(--global-selected-dark);
1862
1873
  color: #f5f5f5;
1863
1874
  }
1864
1875
 
@@ -2950,7 +2961,8 @@ pre .line-gutter {
2950
2961
  height: var(--code-editor-row-height);
2951
2962
  position: absolute;
2952
2963
  border-left: 3px solid #fff !important;
2953
- z-index: 0 !important;
2964
+ z-index: 1 !important;
2965
+ opacity: 0.6;
2954
2966
  left: 0px;
2955
2967
  top: 0px;
2956
2968
  }
@@ -3113,7 +3125,7 @@ pre .line-gutter {
3113
3125
 
3114
3126
  /* Common */
3115
3127
  .cm-str { color: #ca7d59; } /* string */
3116
- .cm-std { color: #cf6dcf; } /* statements & declarations */
3128
+ .cm-std { color: #d181d1; } /* statements & declarations */
3117
3129
  .cm-kwd { color: #2194ce; } /* keyword */
3118
3130
  .cm-com { color: #5cab5a; } /* comment */
3119
3131
 
@@ -3140,16 +3152,16 @@ pre .line-gutter {
3140
3152
  .cm-sym.json { color: #cf6dcf; } /* symbol */
3141
3153
 
3142
3154
  .cm-typ.glsl { color: #36c0b0; } /* type */
3143
- .cm-bln.glsl { color: #cfc159; } /* builtin */
3144
3155
  .cm-dec.glsl { color: #b1ce9b; } /* decimal */
3145
3156
  .cm-sym.glsl { color: #f9cb20; } /* symbol */
3146
3157
  .cm-mtd.glsl { color: #e0cc68; } /* method */
3147
3158
 
3148
3159
  .cm-typ.wgsl { color: #36c0b0; } /* type */
3149
- .cm-bln.wgsl { color: #cfc159; } /* builtin */
3150
3160
  .cm-dec.wgsl { color: #b1ce9b; } /* decimal */
3161
+ .cm-mtd.wgsl { color: #dfe093; } /* method */
3151
3162
  .cm-sym.wgsl { color: #f9cb20; } /* symbol */
3152
- .cm-mtd.wgsl { color: #e0cc68; } /* method */
3163
+ .cm-ppc.wgsl { color: #99caf1; } /* preprocessor */
3164
+
3153
3165
 
3154
3166
  .cm-typ.rust { color: #36c0b0; } /* type */
3155
3167
  .cm-dec.rust { color: #b1ce9b; } /* decimal */
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.23",
15
+ version: "0.1.25",
16
16
  ready: false,
17
17
  components: [], // specific pre-build components
18
18
  signals: {} // events and triggers
@@ -2179,6 +2179,8 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
2179
2179
 
2180
2180
  if( this.onSetValue )
2181
2181
  this.onSetValue( value );
2182
+
2183
+ console.warn("Can't set value of " + this.typeName());
2182
2184
  }
2183
2185
 
2184
2186
  oncontextmenu(e) {
@@ -3029,6 +3031,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
3029
3031
  let domName = document.createElement('div');
3030
3032
  domName.className = "lexwidgetname";
3031
3033
  domName.innerHTML = name || "";
3034
+ domName.title = options.title ?? domName.innerHTML;
3032
3035
  domName.style.width = options.nameWidth || LX.DEFAULT_NAME_WIDTH;
3033
3036
  element.appendChild(domName);
3034
3037
  element.domName = domName;
@@ -4288,47 +4291,70 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
4288
4291
 
4289
4292
  addList( name, values, value, callback, options = {} ) {
4290
4293
 
4291
- let widget = this.create_widget(name, Widget.LIST, options);
4292
- let element = widget.domEl;
4293
-
4294
- // Show list
4295
-
4296
- let list_container = document.createElement('div');
4297
- list_container.className = "lexlist";
4298
- list_container.style.width = "calc( 100% - " + LX.DEFAULT_NAME_WIDTH + ")";
4299
-
4300
- for( let i = 0; i < values.length; ++i )
4301
- {
4302
- let icon = null;
4303
- let item_value = values[i];
4304
-
4305
- if( item_value.constructor === Array )
4294
+ let widget = this.create_widget( name, Widget.LIST, options );
4295
+
4296
+ widget.onGetValue = () => {
4297
+ return value;
4298
+ };
4299
+
4300
+ widget.onSetValue = ( newValue ) => {
4301
+ listContainer.querySelectorAll( '.lexlistitem' ).forEach( e => e.classList.remove( 'selected' ) );
4302
+ const idx = values.indexOf( newValue );
4303
+ if( idx == -1 ) return;
4304
+ listContainer.children[ idx ].classList.toggle( 'selected' );
4305
+ value = newValue;
4306
+ this._trigger( new IEvent( name, newValue ), callback );
4307
+ };
4308
+
4309
+ widget.updateValues = ( newValues ) => {
4310
+
4311
+ values = newValues;
4312
+ listContainer.innerHTML = "";
4313
+
4314
+ for( let i = 0; i < values.length; ++i )
4306
4315
  {
4307
- icon = item_value[1];
4308
- item_value = item_value[0];
4316
+ let icon = null;
4317
+ let itemValue = values[ i ];
4318
+
4319
+ if( itemValue.constructor === Array )
4320
+ {
4321
+ icon = itemValue[ 1 ];
4322
+ itemValue = itemValue[ 0 ];
4323
+ }
4324
+
4325
+ let listElement = document.createElement( 'div' );
4326
+ listElement.className = "lexlistitem" + ( value == itemValue ? " selected" : "" );
4327
+ listElement.innerHTML = "<span>" + itemValue + "</span>" + ( icon ? "<a class='" + icon + "'></a>" : "" );
4328
+
4329
+ listElement.addEventListener( 'click', e => {
4330
+ listContainer.querySelectorAll( '.lexlistitem' ).forEach( e => e.classList.remove( 'selected' ) );
4331
+ listElement.classList.toggle( 'selected' );
4332
+ value = itemValue;
4333
+ this._trigger( new IEvent( name, itemValue, e ), callback );
4334
+ });
4335
+
4336
+ listContainer.appendChild( listElement );
4309
4337
  }
4310
-
4311
- let list_item = document.createElement('div');
4312
- list_item.className = "lexlistitem" + (value == item_value ? " selected" : "");
4313
- list_item.innerHTML = "<span>" + item_value + "</span>" + (icon ? "<a class='" + icon + "'></a>" : "");
4314
-
4315
- list_item.addEventListener('click', (e) => {
4316
- list_container.querySelectorAll('.lexlistitem').forEach( e => e.classList.remove('selected'));
4317
- list_item.classList.toggle( 'selected' );
4318
- this._trigger( new IEvent(name, item_value, e), callback );
4319
- });
4320
-
4321
- list_container.appendChild(list_item);
4322
- }
4323
-
4338
+ };
4339
+
4340
+ let element = widget.domEl;
4341
+
4342
+ // Show list
4343
+
4344
+ let listContainer = document.createElement( 'div' );
4345
+ listContainer.className = "lexlist";
4346
+ listContainer.style.width = "calc( 100% - " + LX.DEFAULT_NAME_WIDTH + ")";
4347
+
4348
+ widget.updateValues( values );
4349
+
4324
4350
  // Remove branch padding and margins
4325
- if(!widget.name) {
4351
+ if( !widget.name ) {
4326
4352
  element.className += " noname";
4327
- list_container.style.width = "100%";
4353
+ listContainer.style.width = "100%";
4328
4354
  }
4329
-
4330
- element.appendChild(list_container);
4331
-
4355
+
4356
+ element.appendChild( listContainer );
4357
+
4332
4358
  return widget;
4333
4359
  }
4334
4360
 
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  var LX = {
11
- version: "0.1.23",
11
+ version: "0.1.25",
12
12
  ready: false,
13
13
  components: [], // specific pre-build components
14
14
  signals: {} // events and triggers
@@ -2175,6 +2175,8 @@ class Widget {
2175
2175
 
2176
2176
  if( this.onSetValue )
2177
2177
  this.onSetValue( value );
2178
+
2179
+ console.warn("Can't set value of " + this.typeName());
2178
2180
  }
2179
2181
 
2180
2182
  oncontextmenu(e) {
@@ -3025,6 +3027,7 @@ class Panel {
3025
3027
  let domName = document.createElement('div');
3026
3028
  domName.className = "lexwidgetname";
3027
3029
  domName.innerHTML = name || "";
3030
+ domName.title = options.title ?? domName.innerHTML;
3028
3031
  domName.style.width = options.nameWidth || LX.DEFAULT_NAME_WIDTH;
3029
3032
  element.appendChild(domName);
3030
3033
  element.domName = domName;
@@ -4284,46 +4287,69 @@ class Panel {
4284
4287
 
4285
4288
  addList( name, values, value, callback, options = {} ) {
4286
4289
 
4287
- let widget = this.create_widget(name, Widget.LIST, options);
4288
- let element = widget.domEl;
4290
+ let widget = this.create_widget( name, Widget.LIST, options );
4289
4291
 
4290
- // Show list
4292
+ widget.onGetValue = () => {
4293
+ return value;
4294
+ };
4291
4295
 
4292
- let list_container = document.createElement('div');
4293
- list_container.className = "lexlist";
4294
- list_container.style.width = "calc( 100% - " + LX.DEFAULT_NAME_WIDTH + ")";
4296
+ widget.onSetValue = ( newValue ) => {
4297
+ listContainer.querySelectorAll( '.lexlistitem' ).forEach( e => e.classList.remove( 'selected' ) );
4298
+ const idx = values.indexOf( newValue );
4299
+ if( idx == -1 ) return;
4300
+ listContainer.children[ idx ].classList.toggle( 'selected' );
4301
+ value = newValue;
4302
+ this._trigger( new IEvent( name, newValue ), callback );
4303
+ };
4295
4304
 
4296
- for( let i = 0; i < values.length; ++i )
4297
- {
4298
- let icon = null;
4299
- let item_value = values[i];
4305
+ widget.updateValues = ( newValues ) => {
4300
4306
 
4301
- if( item_value.constructor === Array )
4307
+ values = newValues;
4308
+ listContainer.innerHTML = "";
4309
+
4310
+ for( let i = 0; i < values.length; ++i )
4302
4311
  {
4303
- icon = item_value[1];
4304
- item_value = item_value[0];
4312
+ let icon = null;
4313
+ let itemValue = values[ i ];
4314
+
4315
+ if( itemValue.constructor === Array )
4316
+ {
4317
+ icon = itemValue[ 1 ];
4318
+ itemValue = itemValue[ 0 ];
4319
+ }
4320
+
4321
+ let listElement = document.createElement( 'div' );
4322
+ listElement.className = "lexlistitem" + ( value == itemValue ? " selected" : "" );
4323
+ listElement.innerHTML = "<span>" + itemValue + "</span>" + ( icon ? "<a class='" + icon + "'></a>" : "" );
4324
+
4325
+ listElement.addEventListener( 'click', e => {
4326
+ listContainer.querySelectorAll( '.lexlistitem' ).forEach( e => e.classList.remove( 'selected' ) );
4327
+ listElement.classList.toggle( 'selected' );
4328
+ value = itemValue;
4329
+ this._trigger( new IEvent( name, itemValue, e ), callback );
4330
+ });
4331
+
4332
+ listContainer.appendChild( listElement );
4305
4333
  }
4334
+ };
4306
4335
 
4307
- let list_item = document.createElement('div');
4308
- list_item.className = "lexlistitem" + (value == item_value ? " selected" : "");
4309
- list_item.innerHTML = "<span>" + item_value + "</span>" + (icon ? "<a class='" + icon + "'></a>" : "");
4336
+ let element = widget.domEl;
4310
4337
 
4311
- list_item.addEventListener('click', (e) => {
4312
- list_container.querySelectorAll('.lexlistitem').forEach( e => e.classList.remove('selected'));
4313
- list_item.classList.toggle( 'selected' );
4314
- this._trigger( new IEvent(name, item_value, e), callback );
4315
- });
4338
+ // Show list
4316
4339
 
4317
- list_container.appendChild(list_item);
4318
- }
4340
+ let listContainer = document.createElement( 'div' );
4341
+ listContainer.className = "lexlist";
4342
+ listContainer.style.width = "calc( 100% - " + LX.DEFAULT_NAME_WIDTH + ")";
4343
+
4344
+ widget.updateValues( values );
4319
4345
 
4320
4346
  // Remove branch padding and margins
4321
- if(!widget.name) {
4347
+ if( !widget.name ) {
4322
4348
  element.className += " noname";
4323
- list_container.style.width = "100%";
4349
+ listContainer.style.width = "100%";
4324
4350
  }
4325
4351
 
4326
- element.appendChild(list_container);
4352
+ element.appendChild( listContainer );
4327
4353
 
4328
4354
  return widget;
4329
4355
  }
package/changelog.md CHANGED
@@ -1,38 +1,66 @@
1
1
  # lexgui.js changelog
2
2
 
3
+ ## 0.1.25
4
+
5
+ Code Editor:
6
+ - Added Ctrl+K + C/U Shortcuts to Comment/Uncomment lines.
7
+ - Improved WGSL highlighting.
8
+ - Minor bug fixes.
9
+
10
+ Added title attribute by default to Widget Name Dom elements.
11
+ Added value getter/setter for LIST widget.
12
+ Added updateValues method for modify list options in LIST widget.
13
+
14
+ ## 0.1.24
15
+
16
+ Code Editor:
17
+ - Improved single and multiple cursor usability.
18
+ - Cursor can be added or removed using "Alt+LeftClick".
19
+ - Fixed clicks outside the code area.
20
+ - Minor bug fixes.
21
+
3
22
  ## 0.1.23
4
23
 
5
- Begin integration of multiple cursors ("Ctrl+ArrowDown").
6
- Code tabs have new VS Code-alike style.
7
- Improved CSS highlighting.
8
- Add Undo Steps to some actions that were missing.
9
- When using Ctrl+G, the selected line is now highlighted.
10
- General bug fixes.
24
+ Code Editor:
25
+ - Begin integration of multiple cursors ("Ctrl+ArrowDown").
26
+ - Code tabs have new VS Code-alike style.
27
+ - Improved CSS highlighting.
28
+ - Add Undo Steps to some actions that were missing.
29
+ - When using Ctrl+G, the selected line is now highlighted.
30
+
31
+ Minor fixes.
11
32
 
12
33
  ## 0.1.22
13
34
 
14
- Added REDO using "Ctrl+Y".
15
- Added FontSize customization. "Ctrl+PLUS", "Ctrl+MINUS" or "Ctrl+Wheel".
16
- Added "Ctrl+G" to scroll to specific line.
17
- General bug fixes.
35
+ Code Editor:
36
+ - Added REDO using "Ctrl+Y".
37
+ - Added FontSize customization. "Ctrl+PLUS", "Ctrl+MINUS" or "Ctrl+Wheel".
38
+ - Added "Ctrl+G" to scroll to specific line.
39
+
40
+ Minor fixes.
18
41
 
19
42
  ## 0.1.21
20
43
 
21
- Added "Ctrl+F" to find text in code tabs.
22
- "Shift+Backspace" deletes word at current position.
23
- Added "Markdown" syntax highlighting.
24
- Improved hightlighting of tag languages (HTML, Markdown, XML).
44
+ Code Editor:
45
+ - Added "Ctrl+F" to find text in code tabs.
46
+ - "Shift+Backspace" deletes word at current position.
47
+ - Added "Markdown" syntax highlighting.
48
+ - Improved hightlighting of tag languages (HTML, Markdown, XML).
25
49
 
26
50
  ## 0.1.20
27
51
 
28
- Active line is now hightlighted.
29
- Using CommitMono font (https://commitmono.com/) as the font for the Code Editor.
30
- Added "Rust" syntax highlighting.
31
- Improved all code selections (and some bugs fixed).
32
- Block comments are now working again (with bugs probably).
52
+ Code Editor:
53
+ - Active line is now hightlighted.
54
+ - Using CommitMono font (https://commitmono.com/) as the font for the Code Editor.
55
+ - Added "Rust" syntax highlighting.
56
+ - Improved all code selections (and some bugs fixed).
57
+ - Block comments are now working again (with bugs probably).
58
+
33
59
  Minor fixes.
34
60
 
35
61
  ## 0.1.19
36
62
 
37
- Add file explorer to Code Editor component.
63
+ Code Editor:
64
+ - Add file explorer to Code Editor component.
65
+
38
66
  Minor fixes.
@@ -55,7 +55,7 @@
55
55
  file_explorer: file_explorer
56
56
  });
57
57
 
58
- editor.loadFile( "../demo.js" );
58
+ editor.loadFile( "../data/js_sample.js" );
59
59
  // editor.loadFile( "../data/json_sample.json" );
60
60
  // editor.loadFile( "../data/css_sample.css" );
61
61
  // editor.loadFile( "../data/cpp_sample.cpp" );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lexgui",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
4
4
  "description": "JS library to create web graphical user interfaces",
5
5
  "type": "module",
6
6
  "main": "./build/lexgui.js",