lexgui 0.6.0 → 0.6.1
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 +4 -4
- package/build/lexgui.js +156 -49
- package/build/lexgui.min.css +1 -1
- package/build/lexgui.min.js +1 -1
- package/build/lexgui.module.js +156 -49
- package/build/lexgui.module.min.js +1 -1
- package/changelog.md +13 -1
- package/package.json +1 -1
package/build/lexgui.css
CHANGED
|
@@ -4510,15 +4510,15 @@ meter:-moz-meter-sub-sub-optimum::-moz-meter-bar {
|
|
|
4510
4510
|
}
|
|
4511
4511
|
|
|
4512
4512
|
ul.lexassetscontent {
|
|
4513
|
-
|
|
4513
|
+
height: 100%;
|
|
4514
4514
|
-webkit-text-size-adjust: 100%;
|
|
4515
|
+
padding: 0 1em;
|
|
4516
|
+
margin: 0;
|
|
4515
4517
|
font-size: var(--global-font-size);
|
|
4516
4518
|
color: #AAA;
|
|
4519
|
+
position: relative;
|
|
4517
4520
|
box-sizing: border-box;
|
|
4518
4521
|
overflow: auto;
|
|
4519
|
-
padding: 0 1em;
|
|
4520
|
-
margin: 0;
|
|
4521
|
-
height: calc(100% - 36px);
|
|
4522
4522
|
}
|
|
4523
4523
|
|
|
4524
4524
|
.lexassetscontent.list {
|
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 = {
|
|
15
|
-
version: "0.6.
|
|
15
|
+
version: "0.6.1",
|
|
16
16
|
ready: false,
|
|
17
17
|
components: [], // Specific pre-build components
|
|
18
18
|
signals: {}, // Events and triggers
|
|
@@ -91,7 +91,21 @@ LX.doAsync = doAsync;
|
|
|
91
91
|
*/
|
|
92
92
|
function getSupportedDOMName( text )
|
|
93
93
|
{
|
|
94
|
-
|
|
94
|
+
console.assert( typeof text == "string", "getSupportedDOMName: Text is not a string!" );
|
|
95
|
+
|
|
96
|
+
let name = text.trim();
|
|
97
|
+
|
|
98
|
+
// Replace specific known symbols
|
|
99
|
+
name = name.replace( /@/g, '_at_' ).replace( /\+/g, '_plus_' ).replace( /\./g, '_dot_' );
|
|
100
|
+
name = name.replace( /[^a-zA-Z0-9_-]/g, '_' );
|
|
101
|
+
|
|
102
|
+
// prefix with an underscore if needed
|
|
103
|
+
if( /^[0-9]/.test( name ) )
|
|
104
|
+
{
|
|
105
|
+
name = '_' + name;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return name;
|
|
95
109
|
}
|
|
96
110
|
|
|
97
111
|
LX.getSupportedDOMName = getSupportedDOMName;
|
|
@@ -2302,7 +2316,7 @@ class DropdownMenu {
|
|
|
2302
2316
|
|
|
2303
2317
|
console.assert( trigger, "DropdownMenu needs a DOM element as trigger!" );
|
|
2304
2318
|
|
|
2305
|
-
if( DropdownMenu.currentMenu )
|
|
2319
|
+
if( DropdownMenu.currentMenu || !items?.length )
|
|
2306
2320
|
{
|
|
2307
2321
|
DropdownMenu.currentMenu.destroy();
|
|
2308
2322
|
this.invalid = true;
|
|
@@ -2320,6 +2334,7 @@ class DropdownMenu {
|
|
|
2320
2334
|
this.align = options.align ?? "center";
|
|
2321
2335
|
this.avoidCollisions = options.avoidCollisions ?? true;
|
|
2322
2336
|
this.onBlur = options.onBlur;
|
|
2337
|
+
this.inPlace = false;
|
|
2323
2338
|
|
|
2324
2339
|
this.root = document.createElement( "div" );
|
|
2325
2340
|
this.root.id = "root";
|
|
@@ -2339,7 +2354,8 @@ class DropdownMenu {
|
|
|
2339
2354
|
|
|
2340
2355
|
this._onClick = e => {
|
|
2341
2356
|
|
|
2342
|
-
|
|
2357
|
+
// Check if the click is inside a menu or on the trigger
|
|
2358
|
+
if( e.target && ( e.target.closest( ".lexdropdownmenu" ) != undefined || e.target == this._trigger ) )
|
|
2343
2359
|
{
|
|
2344
2360
|
return;
|
|
2345
2361
|
}
|
|
@@ -2347,7 +2363,8 @@ class DropdownMenu {
|
|
|
2347
2363
|
this.destroy( true );
|
|
2348
2364
|
};
|
|
2349
2365
|
|
|
2350
|
-
document.body.addEventListener( "
|
|
2366
|
+
document.body.addEventListener( "mousedown", this._onClick, true );
|
|
2367
|
+
document.body.addEventListener( "focusin", this._onClick, true );
|
|
2351
2368
|
}, 10 );
|
|
2352
2369
|
}
|
|
2353
2370
|
|
|
@@ -2357,7 +2374,8 @@ class DropdownMenu {
|
|
|
2357
2374
|
|
|
2358
2375
|
delete this._trigger.ddm;
|
|
2359
2376
|
|
|
2360
|
-
document.body.removeEventListener( "
|
|
2377
|
+
document.body.removeEventListener( "mousedown", this._onClick, true );
|
|
2378
|
+
document.body.removeEventListener( "focusin", this._onClick, true );
|
|
2361
2379
|
|
|
2362
2380
|
LX.root.querySelectorAll( ".lexdropdownmenu" ).forEach( m => { m.remove(); } );
|
|
2363
2381
|
|
|
@@ -2382,7 +2400,7 @@ class DropdownMenu {
|
|
|
2382
2400
|
let newParent = document.createElement( "div" );
|
|
2383
2401
|
newParent.tabIndex = "1";
|
|
2384
2402
|
newParent.className = "lexdropdownmenu";
|
|
2385
|
-
newParent.id = parentDom.id;
|
|
2403
|
+
newParent.dataset["id"] = parentDom.dataset["id"];
|
|
2386
2404
|
newParent.dataset["side"] = "right"; // submenus always come from the right
|
|
2387
2405
|
LX.root.appendChild( newParent );
|
|
2388
2406
|
|
|
@@ -2414,7 +2432,7 @@ class DropdownMenu {
|
|
|
2414
2432
|
}
|
|
2415
2433
|
|
|
2416
2434
|
const key = item.name ?? item;
|
|
2417
|
-
const pKey =
|
|
2435
|
+
const pKey = LX.getSupportedDOMName( key );
|
|
2418
2436
|
|
|
2419
2437
|
// Item already created
|
|
2420
2438
|
if( parentDom.querySelector( "#" + pKey ) )
|
|
@@ -2424,7 +2442,7 @@ class DropdownMenu {
|
|
|
2424
2442
|
|
|
2425
2443
|
const menuItem = document.createElement('div');
|
|
2426
2444
|
menuItem.className = "lexdropdownmenuitem" + ( item.name ? "" : " label" ) + ( item.disabled ?? false ? " disabled" : "" ) + ( ` ${ item.className ?? "" }` );
|
|
2427
|
-
menuItem.id = pKey;
|
|
2445
|
+
menuItem.dataset["id"] = pKey;
|
|
2428
2446
|
menuItem.innerHTML = `<span>${ key }</span>`;
|
|
2429
2447
|
menuItem.tabIndex = "1";
|
|
2430
2448
|
parentDom.appendChild( menuItem );
|
|
@@ -2510,24 +2528,24 @@ class DropdownMenu {
|
|
|
2510
2528
|
|
|
2511
2529
|
menuItem.addEventListener("mouseover", e => {
|
|
2512
2530
|
|
|
2513
|
-
let path = menuItem.id;
|
|
2531
|
+
let path = menuItem.dataset["id"];
|
|
2514
2532
|
let p = parentDom;
|
|
2515
2533
|
|
|
2516
2534
|
while( p )
|
|
2517
2535
|
{
|
|
2518
|
-
path += "/" + p.id;
|
|
2536
|
+
path += "/" + p.dataset["id"];
|
|
2519
2537
|
p = p.currentParent?.parentElement;
|
|
2520
2538
|
}
|
|
2521
2539
|
|
|
2522
2540
|
LX.root.querySelectorAll( ".lexdropdownmenu" ).forEach( m => {
|
|
2523
|
-
if( !path.includes( m.id ) )
|
|
2541
|
+
if( !path.includes( m.dataset["id"] ) )
|
|
2524
2542
|
{
|
|
2525
2543
|
m.currentParent.built = false;
|
|
2526
2544
|
m.remove();
|
|
2527
2545
|
}
|
|
2528
2546
|
} );
|
|
2529
2547
|
|
|
2530
|
-
if( item.submenu )
|
|
2548
|
+
if( item.submenu && this.inPlace )
|
|
2531
2549
|
{
|
|
2532
2550
|
if( menuItem.built )
|
|
2533
2551
|
{
|
|
@@ -2601,6 +2619,7 @@ class DropdownMenu {
|
|
|
2601
2619
|
|
|
2602
2620
|
this.root.style.left = `${ position[ 0 ] }px`;
|
|
2603
2621
|
this.root.style.top = `${ position[ 1 ] }px`;
|
|
2622
|
+
this.inPlace = true;
|
|
2604
2623
|
}
|
|
2605
2624
|
|
|
2606
2625
|
_addSeparator( parent ) {
|
|
@@ -3462,6 +3481,7 @@ class Area {
|
|
|
3462
3481
|
const type = options.type ?? "horizontal";
|
|
3463
3482
|
const sizes = options.sizes || [ "50%", "50%" ];
|
|
3464
3483
|
const auto = (options.sizes === 'auto') || ( options.sizes && options.sizes[ 0 ] == "auto" && options.sizes[ 1 ] == "auto" );
|
|
3484
|
+
const rect = this.root.getBoundingClientRect();
|
|
3465
3485
|
|
|
3466
3486
|
// Secondary area fills space
|
|
3467
3487
|
if( !sizes[ 1 ] || ( sizes[ 0 ] != "auto" && sizes[ 1 ] == "auto" ) )
|
|
@@ -3512,7 +3532,7 @@ class Area {
|
|
|
3512
3532
|
|
|
3513
3533
|
if( !fixedSize )
|
|
3514
3534
|
{
|
|
3515
|
-
const parentWidth =
|
|
3535
|
+
const parentWidth = rect.width;
|
|
3516
3536
|
const leftPx = parsePixelSize( sizes[ 0 ], parentWidth );
|
|
3517
3537
|
const rightPx = parsePixelSize( sizes[ 1 ], parentWidth );
|
|
3518
3538
|
const leftPercent = ( leftPx / parentWidth ) * 100;
|
|
@@ -3536,10 +3556,11 @@ class Area {
|
|
|
3536
3556
|
if( auto )
|
|
3537
3557
|
{
|
|
3538
3558
|
primarySize[ 1 ] = "auto";
|
|
3559
|
+
secondarySize[ 1 ] = "auto";
|
|
3539
3560
|
}
|
|
3540
3561
|
else if( !fixedSize )
|
|
3541
3562
|
{
|
|
3542
|
-
const parentHeight =
|
|
3563
|
+
const parentHeight = rect.height;
|
|
3543
3564
|
const topPx = parsePixelSize( sizes[ 0 ], parentHeight );
|
|
3544
3565
|
const bottomPx = parsePixelSize( sizes[ 1 ], parentHeight );
|
|
3545
3566
|
const topPercent = ( topPx / parentHeight ) * 100;
|
|
@@ -3562,6 +3583,72 @@ class Area {
|
|
|
3562
3583
|
let area1 = new Area( { width: primarySize[ 0 ], height: primarySize[ 1 ], skipAppend: true, className: "split" + ( options.menubar || options.sidebar ? "" : " origin" ) } );
|
|
3563
3584
|
let area2 = new Area( { width: secondarySize[ 0 ], height: secondarySize[ 1 ], skipAppend: true, className: "split" } );
|
|
3564
3585
|
|
|
3586
|
+
/*
|
|
3587
|
+
If the parent area is not in the DOM, we need to wait for the resize event to get the its correct size
|
|
3588
|
+
and set the sizes of the split areas accordingly.
|
|
3589
|
+
*/
|
|
3590
|
+
if( !fixedSize && ( !rect.width || !rect.height ) )
|
|
3591
|
+
{
|
|
3592
|
+
const observer = new ResizeObserver( entries => {
|
|
3593
|
+
|
|
3594
|
+
console.assert( entries.length == 1, "AreaResizeObserver: more than one entry" );
|
|
3595
|
+
|
|
3596
|
+
const rect = entries[ 0 ].contentRect;
|
|
3597
|
+
if( !rect.width || !rect.height )
|
|
3598
|
+
{
|
|
3599
|
+
return;
|
|
3600
|
+
}
|
|
3601
|
+
|
|
3602
|
+
this._update( [ rect.width, rect.height ], false );
|
|
3603
|
+
|
|
3604
|
+
// On auto splits, we only need to set the size of the parent area
|
|
3605
|
+
if( !auto )
|
|
3606
|
+
{
|
|
3607
|
+
if( type == "horizontal" )
|
|
3608
|
+
{
|
|
3609
|
+
const parentWidth = rect.width;
|
|
3610
|
+
const leftPx = parsePixelSize( sizes[ 0 ], parentWidth );
|
|
3611
|
+
const rightPx = parsePixelSize( sizes[ 1 ], parentWidth );
|
|
3612
|
+
const leftPercent = ( leftPx / parentWidth ) * 100;
|
|
3613
|
+
const rightPercent = ( rightPx / parentWidth ) * 100;
|
|
3614
|
+
|
|
3615
|
+
// Style using percentages
|
|
3616
|
+
primarySize[ 0 ] = `calc(${ leftPercent }% - ${ splitbarOffset }px)`;
|
|
3617
|
+
secondarySize[ 0 ] = `calc(${ rightPercent }% - ${ splitbarOffset }px)`;
|
|
3618
|
+
}
|
|
3619
|
+
else // vertical
|
|
3620
|
+
{
|
|
3621
|
+
const parentHeight = rect.height;
|
|
3622
|
+
const topPx = parsePixelSize( sizes[ 0 ], parentHeight );
|
|
3623
|
+
const bottomPx = parsePixelSize( sizes[ 1 ], parentHeight );
|
|
3624
|
+
const topPercent = ( topPx / parentHeight ) * 100;
|
|
3625
|
+
const bottomPercent = ( bottomPx / parentHeight ) * 100;
|
|
3626
|
+
|
|
3627
|
+
primarySize[ 1 ] = ( sizes[ 0 ] == "auto" ? "auto" : `calc(${ topPercent }% - ${ splitbarOffset }px)`);
|
|
3628
|
+
secondarySize[ 1 ] = ( sizes[ 1 ] == "auto" ? "auto" : `calc(${ bottomPercent }% - ${ splitbarOffset }px)`);
|
|
3629
|
+
}
|
|
3630
|
+
|
|
3631
|
+
area1.root.style.width = primarySize[ 0 ];
|
|
3632
|
+
area1.root.style.height = primarySize[ 1 ];
|
|
3633
|
+
|
|
3634
|
+
area2.root.style.width = secondarySize[ 0 ];
|
|
3635
|
+
area2.root.style.height = secondarySize[ 1 ];
|
|
3636
|
+
}
|
|
3637
|
+
|
|
3638
|
+
area1._update();
|
|
3639
|
+
area2._update();
|
|
3640
|
+
|
|
3641
|
+
// Stop observing
|
|
3642
|
+
observer.disconnect();
|
|
3643
|
+
});
|
|
3644
|
+
|
|
3645
|
+
// Observe the parent area until the DOM is ready
|
|
3646
|
+
// and the size is set correctly.
|
|
3647
|
+
doAsync( () => {
|
|
3648
|
+
observer.observe( this.root );
|
|
3649
|
+
}, 100 );
|
|
3650
|
+
}
|
|
3651
|
+
|
|
3565
3652
|
if( auto && type == "vertical" )
|
|
3566
3653
|
{
|
|
3567
3654
|
// Listen resize event on first area
|
|
@@ -3571,6 +3658,7 @@ class Area {
|
|
|
3571
3658
|
const size = entry.target.getComputedSize();
|
|
3572
3659
|
area2.root.style.height = "calc(100% - " + ( size.height ) + "px )";
|
|
3573
3660
|
}
|
|
3661
|
+
resizeObserver.disconnect();
|
|
3574
3662
|
});
|
|
3575
3663
|
|
|
3576
3664
|
resizeObserver.observe( area1.root );
|
|
@@ -3614,7 +3702,7 @@ class Area {
|
|
|
3614
3702
|
this.type = type;
|
|
3615
3703
|
|
|
3616
3704
|
// Update sizes
|
|
3617
|
-
this._update();
|
|
3705
|
+
this._update( rect.width || rect.height ? [ rect.width, rect.height ] : undefined );
|
|
3618
3706
|
|
|
3619
3707
|
if( !resize )
|
|
3620
3708
|
{
|
|
@@ -3671,6 +3759,11 @@ class Area {
|
|
|
3671
3759
|
this.minHeight = minh;
|
|
3672
3760
|
this.maxWidth = maxw;
|
|
3673
3761
|
this.maxHeight = maxh;
|
|
3762
|
+
|
|
3763
|
+
if( minw != 0 ) this.root.style.minWidth = `${ minw }px`;
|
|
3764
|
+
if( minh != 0 ) this.root.style.minHeight = `${ minh }px`;
|
|
3765
|
+
if( maxw != Infinity ) this.root.style.maxWidth = `${ maxw }px`;
|
|
3766
|
+
if( maxh != Infinity ) this.root.style.maxHeight = `${ maxh }px`;
|
|
3674
3767
|
}
|
|
3675
3768
|
|
|
3676
3769
|
/**
|
|
@@ -3730,7 +3823,7 @@ class Area {
|
|
|
3730
3823
|
{
|
|
3731
3824
|
this.offset = area2.root.offsetHeight;
|
|
3732
3825
|
area2.root.classList.add("fadeout-vertical");
|
|
3733
|
-
this._moveSplit(-Infinity, true);
|
|
3826
|
+
this._moveSplit( -Infinity, true );
|
|
3734
3827
|
|
|
3735
3828
|
}
|
|
3736
3829
|
else
|
|
@@ -4038,7 +4131,6 @@ class Area {
|
|
|
4038
4131
|
{
|
|
4039
4132
|
_addButton( b );
|
|
4040
4133
|
}
|
|
4041
|
-
|
|
4042
4134
|
}
|
|
4043
4135
|
|
|
4044
4136
|
// Add floating info
|
|
@@ -4130,12 +4222,12 @@ class Area {
|
|
|
4130
4222
|
|
|
4131
4223
|
if( a1.maxWidth != Infinity )
|
|
4132
4224
|
{
|
|
4133
|
-
a2Root.style.minWidth =
|
|
4225
|
+
a2Root.style.minWidth = `calc( 100% - ${ parseInt( a1.maxWidth ) }px )`;
|
|
4134
4226
|
}
|
|
4135
4227
|
}
|
|
4136
4228
|
else
|
|
4137
4229
|
{
|
|
4138
|
-
var size = Math.max( ( a2Root.offsetHeight + dt ) + a2.offset, parseInt(a2.minHeight) );
|
|
4230
|
+
var size = Math.max( ( a2Root.offsetHeight + dt ) + a2.offset, parseInt( a2.minHeight ) );
|
|
4139
4231
|
if( forceWidth ) size = forceWidth;
|
|
4140
4232
|
|
|
4141
4233
|
const parentHeight = this.size[ 1 ];
|
|
@@ -4149,7 +4241,10 @@ class Area {
|
|
|
4149
4241
|
a2Root.style.height = `${ bottomPercent }%`;
|
|
4150
4242
|
a2Root.style.height = `${ bottomPercent }%`;
|
|
4151
4243
|
|
|
4152
|
-
|
|
4244
|
+
if( a1.maxHeight != Infinity )
|
|
4245
|
+
{
|
|
4246
|
+
a2Root.style.minHeight = `calc( 100% - ${ parseInt( a1.maxHeight ) }px )`;
|
|
4247
|
+
}
|
|
4153
4248
|
}
|
|
4154
4249
|
|
|
4155
4250
|
if( !forceAnimation )
|
|
@@ -4171,15 +4266,24 @@ class Area {
|
|
|
4171
4266
|
delete this.splitBar;
|
|
4172
4267
|
}
|
|
4173
4268
|
|
|
4174
|
-
_update() {
|
|
4175
|
-
|
|
4176
|
-
const rect = this.root.getBoundingClientRect();
|
|
4269
|
+
_update( newSize, propagate = true ) {
|
|
4177
4270
|
|
|
4178
|
-
|
|
4271
|
+
if( !newSize )
|
|
4272
|
+
{
|
|
4273
|
+
const rect = this.root.getBoundingClientRect();
|
|
4274
|
+
this.size = [ rect.width, rect.height ];
|
|
4275
|
+
}
|
|
4276
|
+
else
|
|
4277
|
+
{
|
|
4278
|
+
this.size = newSize;
|
|
4279
|
+
}
|
|
4179
4280
|
|
|
4180
|
-
|
|
4281
|
+
if( propagate )
|
|
4181
4282
|
{
|
|
4182
|
-
this.sections
|
|
4283
|
+
for( var i = 0; i < this.sections.length; i++ )
|
|
4284
|
+
{
|
|
4285
|
+
this.sections[ i ]._update();
|
|
4286
|
+
}
|
|
4183
4287
|
}
|
|
4184
4288
|
}
|
|
4185
4289
|
};
|
|
@@ -4579,7 +4683,7 @@ class Menubar {
|
|
|
4579
4683
|
|
|
4580
4684
|
this.root.querySelectorAll(".lexmenuentry").forEach( e => {
|
|
4581
4685
|
e.classList.remove( 'selected' );
|
|
4582
|
-
e.built
|
|
4686
|
+
delete e.dataset[ "built" ];
|
|
4583
4687
|
} );
|
|
4584
4688
|
|
|
4585
4689
|
if( this._currentDropdown )
|
|
@@ -4601,7 +4705,7 @@ class Menubar {
|
|
|
4601
4705
|
for( let item of this.items )
|
|
4602
4706
|
{
|
|
4603
4707
|
let key = item.name;
|
|
4604
|
-
let pKey =
|
|
4708
|
+
let pKey = LX.getSupportedDOMName( key );
|
|
4605
4709
|
|
|
4606
4710
|
// Item already created
|
|
4607
4711
|
if( this.root.querySelector( "#" + pKey ) )
|
|
@@ -4620,8 +4724,8 @@ class Menubar {
|
|
|
4620
4724
|
const _showEntry = () => {
|
|
4621
4725
|
this._resetMenubar(true);
|
|
4622
4726
|
entry.classList.add( "selected" );
|
|
4623
|
-
entry.built = true;
|
|
4624
|
-
this._currentDropdown = addDropdownMenu( entry, item.submenu, { side: "bottom", align: "start", onBlur: () => {
|
|
4727
|
+
entry.dataset["built"] = "true";
|
|
4728
|
+
this._currentDropdown = addDropdownMenu( entry, item.submenu ?? [], { side: "bottom", align: "start", onBlur: () => {
|
|
4625
4729
|
this._resetMenubar();
|
|
4626
4730
|
} });
|
|
4627
4731
|
};
|
|
@@ -4641,7 +4745,7 @@ class Menubar {
|
|
|
4641
4745
|
|
|
4642
4746
|
entry.addEventListener( "mouseover", (e) => {
|
|
4643
4747
|
|
|
4644
|
-
if( this.focused && !entry.built )
|
|
4748
|
+
if( this.focused && !( entry.dataset[ "built" ] ?? false ) )
|
|
4645
4749
|
{
|
|
4646
4750
|
_showEntry();
|
|
4647
4751
|
}
|
|
@@ -5234,7 +5338,7 @@ class SideBar {
|
|
|
5234
5338
|
|
|
5235
5339
|
select( name ) {
|
|
5236
5340
|
|
|
5237
|
-
let pKey =
|
|
5341
|
+
let pKey = LX.getSupportedDOMName( name );
|
|
5238
5342
|
|
|
5239
5343
|
const entry = this.items.find( v => v.name === pKey );
|
|
5240
5344
|
|
|
@@ -5272,7 +5376,7 @@ class SideBar {
|
|
|
5272
5376
|
continue;
|
|
5273
5377
|
}
|
|
5274
5378
|
|
|
5275
|
-
let pKey =
|
|
5379
|
+
let pKey = LX.getSupportedDOMName( key );
|
|
5276
5380
|
let currentGroup = null;
|
|
5277
5381
|
|
|
5278
5382
|
let entry = document.createElement( 'div' );
|
|
@@ -6989,7 +7093,7 @@ class ComboButtons extends Widget {
|
|
|
6989
7093
|
buttonEl.classList.add( options.buttonClass );
|
|
6990
7094
|
}
|
|
6991
7095
|
|
|
6992
|
-
if( shouldSelect && b.selected )
|
|
7096
|
+
if( shouldSelect && ( b.selected || options.selected?.includes( b.value ) ) )
|
|
6993
7097
|
{
|
|
6994
7098
|
buttonEl.classList.add("selected");
|
|
6995
7099
|
currentValue = ( currentValue ).concat( [ b.value ] );
|
|
@@ -7038,7 +7142,7 @@ class ComboButtons extends Widget {
|
|
|
7038
7142
|
|
|
7039
7143
|
if( !shouldToggle && currentValue.length > 1 )
|
|
7040
7144
|
{
|
|
7041
|
-
console.error( `Enable _options.toggle_ to allow selecting multiple options in ComboButtons.` )
|
|
7145
|
+
console.error( `Enable _options.toggle_ to allow selecting multiple options in ComboButtons.` );
|
|
7042
7146
|
return;
|
|
7043
7147
|
}
|
|
7044
7148
|
|
|
@@ -7052,9 +7156,12 @@ class ComboButtons extends Widget {
|
|
|
7052
7156
|
|
|
7053
7157
|
if( currentValue.length > 1 )
|
|
7054
7158
|
{
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7159
|
+
if( !shouldToggle )
|
|
7160
|
+
{
|
|
7161
|
+
options.toggle = true;
|
|
7162
|
+
shouldToggle = shouldSelect;
|
|
7163
|
+
console.warn( `Multiple options selected in '${ name }' ComboButtons. Enabling _toggle_ mode.` );
|
|
7164
|
+
}
|
|
7058
7165
|
}
|
|
7059
7166
|
else
|
|
7060
7167
|
{
|
|
@@ -8691,7 +8798,7 @@ class NumberInput extends Widget {
|
|
|
8691
8798
|
vecinput.value = vecinput.iValue = value;
|
|
8692
8799
|
valueBox.appendChild( vecinput );
|
|
8693
8800
|
|
|
8694
|
-
const dragIcon = LX.makeIcon( "MoveVertical", { iconClass: "drag-icon hidden", svgClass: "sm" } );
|
|
8801
|
+
const dragIcon = LX.makeIcon( "MoveVertical", { iconClass: "drag-icon hidden-opacity", svgClass: "sm" } );
|
|
8695
8802
|
valueBox.appendChild( dragIcon );
|
|
8696
8803
|
|
|
8697
8804
|
if( options.units )
|
|
@@ -8784,7 +8891,7 @@ class NumberInput extends Widget {
|
|
|
8784
8891
|
doc.addEventListener( 'mousemove', innerMouseMove );
|
|
8785
8892
|
doc.addEventListener( 'mouseup', innerMouseUp );
|
|
8786
8893
|
document.body.classList.add( 'noevents' );
|
|
8787
|
-
dragIcon.classList.remove( 'hidden' );
|
|
8894
|
+
dragIcon.classList.remove( 'hidden-opacity' );
|
|
8788
8895
|
e.stopImmediatePropagation();
|
|
8789
8896
|
e.stopPropagation();
|
|
8790
8897
|
|
|
@@ -8822,7 +8929,7 @@ class NumberInput extends Widget {
|
|
|
8822
8929
|
doc.removeEventListener( 'mousemove', innerMouseMove );
|
|
8823
8930
|
doc.removeEventListener( 'mouseup', innerMouseUp );
|
|
8824
8931
|
document.body.classList.remove( 'noevents' );
|
|
8825
|
-
dragIcon.classList.add( 'hidden' );
|
|
8932
|
+
dragIcon.classList.add( 'hidden-opacity' );
|
|
8826
8933
|
|
|
8827
8934
|
if( document.pointerLockElement )
|
|
8828
8935
|
{
|
|
@@ -8917,6 +9024,7 @@ class Vector extends Widget {
|
|
|
8917
9024
|
vecinput.id = "vec" + numComponents + "_" + simple_guidGenerator();
|
|
8918
9025
|
vecinput.idx = i;
|
|
8919
9026
|
vectorInputs[ i ] = vecinput;
|
|
9027
|
+
box.appendChild( vecinput );
|
|
8920
9028
|
|
|
8921
9029
|
if( value[ i ].constructor == Number )
|
|
8922
9030
|
{
|
|
@@ -8926,7 +9034,7 @@ class Vector extends Widget {
|
|
|
8926
9034
|
|
|
8927
9035
|
vecinput.value = vecinput.iValue = value[ i ];
|
|
8928
9036
|
|
|
8929
|
-
const dragIcon = LX.makeIcon( "MoveVertical", { iconClass: "drag-icon hidden", svgClass: "sm" } );
|
|
9037
|
+
const dragIcon = LX.makeIcon( "MoveVertical", { iconClass: "drag-icon hidden-opacity", svgClass: "sm" } );
|
|
8930
9038
|
box.appendChild( dragIcon );
|
|
8931
9039
|
|
|
8932
9040
|
if( options.disabled )
|
|
@@ -8998,7 +9106,7 @@ class Vector extends Widget {
|
|
|
8998
9106
|
doc.addEventListener( 'mousemove', innerMouseMove );
|
|
8999
9107
|
doc.addEventListener( 'mouseup', innerMouseUp );
|
|
9000
9108
|
document.body.classList.add( 'noevents' );
|
|
9001
|
-
dragIcon.classList.remove( 'hidden' );
|
|
9109
|
+
dragIcon.classList.remove( 'hidden-opacity' );
|
|
9002
9110
|
e.stopImmediatePropagation();
|
|
9003
9111
|
e.stopPropagation();
|
|
9004
9112
|
|
|
@@ -9048,7 +9156,7 @@ class Vector extends Widget {
|
|
|
9048
9156
|
doc.removeEventListener( 'mousemove', innerMouseMove );
|
|
9049
9157
|
doc.removeEventListener( 'mouseup', innerMouseUp );
|
|
9050
9158
|
document.body.classList.remove( 'noevents' );
|
|
9051
|
-
dragIcon.classList.add('hidden');
|
|
9159
|
+
dragIcon.classList.add('hidden-opacity');
|
|
9052
9160
|
|
|
9053
9161
|
if( document.pointerLockElement )
|
|
9054
9162
|
{
|
|
@@ -9062,8 +9170,6 @@ class Vector extends Widget {
|
|
|
9062
9170
|
}
|
|
9063
9171
|
|
|
9064
9172
|
vecinput.addEventListener( "mousedown", innerMouseDown );
|
|
9065
|
-
|
|
9066
|
-
box.appendChild( vecinput );
|
|
9067
9173
|
container.appendChild( box );
|
|
9068
9174
|
}
|
|
9069
9175
|
|
|
@@ -11133,6 +11239,7 @@ class Panel {
|
|
|
11133
11239
|
* @param {Object} options:
|
|
11134
11240
|
* hideName: Don't use name as label [false]
|
|
11135
11241
|
* float: Justify content (left, center, right) [center]
|
|
11242
|
+
* selected: Selected button by default (String|Array)
|
|
11136
11243
|
* noSelection: Buttons can be clicked, but they are not selectable
|
|
11137
11244
|
* toggle: Buttons can be toggled insted of selecting only one
|
|
11138
11245
|
*/
|
|
@@ -13415,7 +13522,7 @@ class AssetView {
|
|
|
13415
13522
|
|
|
13416
13523
|
if( !this.skipBrowser )
|
|
13417
13524
|
{
|
|
13418
|
-
[left, right] = area.split({ type: "horizontal", sizes: ["15%", "85%"]});
|
|
13525
|
+
[ left, right ] = area.split({ type: "horizontal", sizes: ["15%", "85%"]});
|
|
13419
13526
|
contentArea = right;
|
|
13420
13527
|
|
|
13421
13528
|
left.setLimitBox( 210, 0 );
|
|
@@ -13625,7 +13732,7 @@ class AssetView {
|
|
|
13625
13732
|
}
|
|
13626
13733
|
else
|
|
13627
13734
|
{
|
|
13628
|
-
this.rightPanel = area.addPanel({ className: 'lexassetcontentpanel' });
|
|
13735
|
+
this.rightPanel = area.addPanel({ className: 'lexassetcontentpanel flex flex-col overflow-hidden' });
|
|
13629
13736
|
}
|
|
13630
13737
|
|
|
13631
13738
|
const on_sort = ( value, event ) => {
|