lexgui 0.6.5 → 0.6.7
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/components/codeeditor.js +27 -11
- package/build/components/docmaker.js +425 -0
- package/build/lexgui-docs.css +354 -0
- package/build/lexgui.css +11 -0
- package/build/lexgui.js +88 -22
- package/build/lexgui.min.css +1 -1
- package/build/lexgui.min.js +1 -1
- package/build/lexgui.module.js +88 -22
- package/build/lexgui.module.min.js +1 -1
- package/changelog.md +25 -1
- package/examples/index.html +50 -23
- package/examples/node_graph.html +7 -7
- package/package.json +1 -1
package/build/lexgui.module.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
const LX = {
|
|
10
|
-
version: "0.6.
|
|
10
|
+
version: "0.6.7",
|
|
11
11
|
ready: false,
|
|
12
12
|
components: [], // Specific pre-build components
|
|
13
13
|
signals: {}, // Events and triggers
|
|
@@ -870,7 +870,7 @@ class Sheet {
|
|
|
870
870
|
this.root.dataset["side"] = this.side;
|
|
871
871
|
this.root.tabIndex = "1";
|
|
872
872
|
this.root.role = "dialog";
|
|
873
|
-
this.root.className = "lexsheet fixed z-
|
|
873
|
+
this.root.className = "lexsheet fixed z-1000 bg-primary";
|
|
874
874
|
LX.root.appendChild( this.root );
|
|
875
875
|
|
|
876
876
|
this.root.addEventListener( "keydown", (e) => {
|
|
@@ -1144,6 +1144,7 @@ class DropdownMenu {
|
|
|
1144
1144
|
{
|
|
1145
1145
|
const checkbox = new LX.Checkbox( pKey + "_entryChecked", item.checked, (v) => {
|
|
1146
1146
|
const f = item[ 'callback' ];
|
|
1147
|
+
item.checked = v;
|
|
1147
1148
|
if( f )
|
|
1148
1149
|
{
|
|
1149
1150
|
f.call( this, key, v, menuItem );
|
|
@@ -2204,6 +2205,11 @@ class Tabs {
|
|
|
2204
2205
|
|
|
2205
2206
|
delete( name ) {
|
|
2206
2207
|
|
|
2208
|
+
if( this.selected == name )
|
|
2209
|
+
{
|
|
2210
|
+
this.selected = null;
|
|
2211
|
+
}
|
|
2212
|
+
|
|
2207
2213
|
const tabEl = this.tabDOMs[ name ];
|
|
2208
2214
|
|
|
2209
2215
|
if( !tabEl || tabEl.fixed )
|
|
@@ -7401,11 +7407,6 @@ function ADD_CUSTOM_WIDGET( customWidgetName, options = {} )
|
|
|
7401
7407
|
|
|
7402
7408
|
const refresh_widget = () => {
|
|
7403
7409
|
|
|
7404
|
-
if( instance )
|
|
7405
|
-
{
|
|
7406
|
-
widget.instance = instance = Object.assign( LX.deepCopy(defaultInstance), instance );
|
|
7407
|
-
}
|
|
7408
|
-
|
|
7409
7410
|
if( container ) container.remove();
|
|
7410
7411
|
if( customWidgetsDom ) customWidgetsDom.remove();
|
|
7411
7412
|
|
|
@@ -7470,13 +7471,36 @@ function ADD_CUSTOM_WIDGET( customWidgetName, options = {} )
|
|
|
7470
7471
|
this.queue( customWidgetsDom );
|
|
7471
7472
|
|
|
7472
7473
|
const on_instance_changed = ( key, value, event ) => {
|
|
7473
|
-
|
|
7474
|
+
const setter = options[ `_set_${ key }` ];
|
|
7475
|
+
if( setter )
|
|
7476
|
+
{
|
|
7477
|
+
setter.call( instance, value );
|
|
7478
|
+
}
|
|
7479
|
+
else
|
|
7480
|
+
{
|
|
7481
|
+
instance[ key ] = value;
|
|
7482
|
+
}
|
|
7474
7483
|
widget._trigger( new LX.IEvent( name, instance, event ), callback );
|
|
7475
7484
|
};
|
|
7476
7485
|
|
|
7477
7486
|
for( let key in defaultInstance )
|
|
7478
7487
|
{
|
|
7479
|
-
|
|
7488
|
+
let value = null;
|
|
7489
|
+
|
|
7490
|
+
const getter = options[ `_get_${ key }` ];
|
|
7491
|
+
if( getter )
|
|
7492
|
+
{
|
|
7493
|
+
value = instance[ key ] ? getter.call( instance ) : getter.call( defaultInstance );
|
|
7494
|
+
}
|
|
7495
|
+
else
|
|
7496
|
+
{
|
|
7497
|
+
value = instance[ key ] ?? defaultInstance[ key ];
|
|
7498
|
+
}
|
|
7499
|
+
|
|
7500
|
+
if( !value )
|
|
7501
|
+
{
|
|
7502
|
+
continue;
|
|
7503
|
+
}
|
|
7480
7504
|
|
|
7481
7505
|
switch( value.constructor )
|
|
7482
7506
|
{
|
|
@@ -7506,6 +7530,9 @@ function ADD_CUSTOM_WIDGET( customWidgetName, options = {} )
|
|
|
7506
7530
|
this._addVector( value.length, key, value, on_instance_changed.bind( this, key ) );
|
|
7507
7531
|
}
|
|
7508
7532
|
break;
|
|
7533
|
+
default:
|
|
7534
|
+
console.warn( `Unsupported property type: ${ value.constructor.name }` );
|
|
7535
|
+
break;
|
|
7509
7536
|
}
|
|
7510
7537
|
}
|
|
7511
7538
|
|
|
@@ -8443,6 +8470,27 @@ class Button extends Widget {
|
|
|
8443
8470
|
wValue.innerHTML = `<span>${ ( value || "" ) }</span>`;
|
|
8444
8471
|
}
|
|
8445
8472
|
|
|
8473
|
+
if( options.fileInput )
|
|
8474
|
+
{
|
|
8475
|
+
const fileInput = document.createElement( "input" );
|
|
8476
|
+
fileInput.type = "file";
|
|
8477
|
+
fileInput.className = "file-input";
|
|
8478
|
+
fileInput.style.display = "none";
|
|
8479
|
+
wValue.appendChild( fileInput );
|
|
8480
|
+
|
|
8481
|
+
fileInput.addEventListener( 'change', function( e ) {
|
|
8482
|
+
const files = e.target.files;
|
|
8483
|
+
if( !files.length ) return;
|
|
8484
|
+
|
|
8485
|
+
const reader = new FileReader();
|
|
8486
|
+
if( options.fileInputType === 'text' ) reader.readAsText( files[ 0 ] );
|
|
8487
|
+
else if( options.fileInputType === 'buffer' ) reader.readAsArrayBuffer( files[ 0 ] );
|
|
8488
|
+
else if( options.fileInputType === 'bin' ) reader.readAsBinaryString( files[ 0 ] );
|
|
8489
|
+
else if( options.fileInputType === 'url' ) reader.readAsDataURL( files[ 0 ] );
|
|
8490
|
+
reader.onload = e => { callback.call( this, e.target.result, files[ 0 ] ); } ;
|
|
8491
|
+
});
|
|
8492
|
+
}
|
|
8493
|
+
|
|
8446
8494
|
if( options.disabled )
|
|
8447
8495
|
{
|
|
8448
8496
|
this.disabled = true;
|
|
@@ -8495,8 +8543,15 @@ class Button extends Widget {
|
|
|
8495
8543
|
wValue.classList.toggle('selected');
|
|
8496
8544
|
}
|
|
8497
8545
|
|
|
8498
|
-
|
|
8499
|
-
|
|
8546
|
+
if( options.fileInput )
|
|
8547
|
+
{
|
|
8548
|
+
wValue.querySelector( ".file-input" ).click();
|
|
8549
|
+
}
|
|
8550
|
+
else
|
|
8551
|
+
{
|
|
8552
|
+
const swapInput = wValue.querySelector( "input" );
|
|
8553
|
+
this._trigger( new LX.IEvent( name, swapInput?.checked ?? value, e ), callback );
|
|
8554
|
+
}
|
|
8500
8555
|
});
|
|
8501
8556
|
|
|
8502
8557
|
if( options.tooltip )
|
|
@@ -12832,6 +12887,8 @@ class Panel {
|
|
|
12832
12887
|
* hideName: Don't use name as label [false]
|
|
12833
12888
|
* disabled: Make the widget disabled [false]
|
|
12834
12889
|
* icon: Icon class to show as button value
|
|
12890
|
+
* fileInput: Button click requests a file
|
|
12891
|
+
* fileInputType: Type of the requested file
|
|
12835
12892
|
* img: Path to image to show as button value
|
|
12836
12893
|
* title: Text to show in native Element title
|
|
12837
12894
|
* buttonClass: Class to add to the native button element
|
|
@@ -14172,6 +14229,13 @@ class Sidebar {
|
|
|
14172
14229
|
info.appendChild( infoSubtext );
|
|
14173
14230
|
}
|
|
14174
14231
|
|
|
14232
|
+
// Add icon if onHeaderPressed is defined and not collapsable (it uses the toggler icon)
|
|
14233
|
+
if( options.onHeaderPressed && !this.collapsable )
|
|
14234
|
+
{
|
|
14235
|
+
const icon = LX.makeIcon( "MenuArrows" );
|
|
14236
|
+
header.appendChild( icon );
|
|
14237
|
+
}
|
|
14238
|
+
|
|
14175
14239
|
return header;
|
|
14176
14240
|
}
|
|
14177
14241
|
|
|
@@ -14217,8 +14281,13 @@ class Sidebar {
|
|
|
14217
14281
|
info.appendChild( infoSubtext );
|
|
14218
14282
|
}
|
|
14219
14283
|
|
|
14220
|
-
|
|
14221
|
-
footer
|
|
14284
|
+
// Add icon if onFooterPressed is defined
|
|
14285
|
+
// Useful to indicate that the footer is clickable
|
|
14286
|
+
if( options.onFooterPressed )
|
|
14287
|
+
{
|
|
14288
|
+
const icon = LX.makeIcon( "MenuArrows" );
|
|
14289
|
+
footer.appendChild( icon );
|
|
14290
|
+
}
|
|
14222
14291
|
|
|
14223
14292
|
return footer;
|
|
14224
14293
|
}
|
|
@@ -14519,20 +14588,17 @@ class Sidebar {
|
|
|
14519
14588
|
return;
|
|
14520
14589
|
}
|
|
14521
14590
|
|
|
14591
|
+
const f = options.callback;
|
|
14592
|
+
if( f ) f.call( this, key, item.value, e );
|
|
14593
|
+
|
|
14522
14594
|
if( isCollapsable )
|
|
14523
14595
|
{
|
|
14524
14596
|
itemDom.querySelector( ".collapser" ).click();
|
|
14525
14597
|
}
|
|
14526
|
-
else
|
|
14598
|
+
else if( item.checkbox )
|
|
14527
14599
|
{
|
|
14528
|
-
|
|
14529
|
-
|
|
14530
|
-
|
|
14531
|
-
if( item.checkbox )
|
|
14532
|
-
{
|
|
14533
|
-
item.value = !item.value;
|
|
14534
|
-
item.checkbox.set( item.value, true );
|
|
14535
|
-
}
|
|
14600
|
+
item.value = !item.value;
|
|
14601
|
+
item.checkbox.set( item.value, true );
|
|
14536
14602
|
}
|
|
14537
14603
|
|
|
14538
14604
|
// Manage selected
|