lexgui 0.5.6 → 0.5.8
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/audio.js +2 -2
- package/build/components/timeline.js +475 -420
- package/build/components/videoeditor.js +97 -148
- package/build/lexgui.css +25 -1
- package/build/lexgui.js +323 -196
- package/build/lexgui.min.css +1 -1
- package/build/lexgui.min.js +1 -1
- package/build/lexgui.module.js +323 -196
- package/build/lexgui.module.min.js +1 -1
- package/build/utilities.css +62 -8
- package/changelog.md +31 -1
- package/demo.js +17 -10
- package/package.json +1 -1
package/build/lexgui.module.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
var LX = {
|
|
9
|
-
version: "0.5.
|
|
9
|
+
version: "0.5.8",
|
|
10
10
|
ready: false,
|
|
11
11
|
components: [], // Specific pre-build components
|
|
12
12
|
signals: {}, // Events and triggers
|
|
@@ -128,6 +128,56 @@ function stripHTML( html )
|
|
|
128
128
|
|
|
129
129
|
LX.stripHTML = stripHTML;
|
|
130
130
|
|
|
131
|
+
/**
|
|
132
|
+
* @method parsePixelSize
|
|
133
|
+
* @description Parses any css size and returns a number of pixels
|
|
134
|
+
* @param {Number|String} size
|
|
135
|
+
* @param {Number} total
|
|
136
|
+
*/
|
|
137
|
+
const parsePixelSize = ( size, total ) => {
|
|
138
|
+
|
|
139
|
+
if( size.constructor === Number ) { return size; } // Assuming pixels..
|
|
140
|
+
|
|
141
|
+
if( size.constructor === String )
|
|
142
|
+
{
|
|
143
|
+
const value = parseFloat( size );
|
|
144
|
+
|
|
145
|
+
if( size.endsWith( "px" ) ) { return value; } // String pixels
|
|
146
|
+
if( size.endsWith( '%' ) ) { return ( value / 100 ) * total; } // Percentage
|
|
147
|
+
if( size.endsWith( "rem" ) || size.endsWith( "em" ) ) { const rootFontSize = 16; /*parseFloat(getComputedStyle(document.documentElement).fontSize);*/ return value * rootFontSize; } // rem unit: assume 16px = 1rem
|
|
148
|
+
if( size.endsWith( "vw" ) ) { return ( value / 100 ) * window.innerWidth; } // wViewport units
|
|
149
|
+
if( size.endsWith( "vh" ) ) { return ( value / 100 ) * window.innerHeight; } // hViewport units
|
|
150
|
+
|
|
151
|
+
// Any CSS calc expression (e.g., "calc(30% - 4px)")
|
|
152
|
+
if( size.startsWith( "calc(" ) )
|
|
153
|
+
{
|
|
154
|
+
const expr = size.slice( 5, -1 );
|
|
155
|
+
const parts = expr.split( /([+\-])/ ); // ["30% ", "-", "4px"]
|
|
156
|
+
let result = 0;
|
|
157
|
+
let op = "+";
|
|
158
|
+
for( let part of parts )
|
|
159
|
+
{
|
|
160
|
+
part = part.trim();
|
|
161
|
+
if( part === "+" || part === "-" )
|
|
162
|
+
{
|
|
163
|
+
op = part;
|
|
164
|
+
}
|
|
165
|
+
else
|
|
166
|
+
{
|
|
167
|
+
let value = parsePixelSize( part, total );
|
|
168
|
+
result = ( op === "+" ) ? result + value : result - value;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return result;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
throw( "Bad size format!" );
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
LX.parsePixelSize = parsePixelSize;
|
|
180
|
+
|
|
131
181
|
/**
|
|
132
182
|
* @method deepCopy
|
|
133
183
|
* @description Create a deep copy with no references from an object
|
|
@@ -722,14 +772,20 @@ LX.makeKbd = makeKbd;
|
|
|
722
772
|
* @method makeIcon
|
|
723
773
|
* @description Gets an SVG element using one of LX.ICONS
|
|
724
774
|
* @param {String} iconName
|
|
725
|
-
* @param {
|
|
726
|
-
*
|
|
775
|
+
* @param {Object} options
|
|
776
|
+
* iconTitle
|
|
777
|
+
* extraClass
|
|
778
|
+
* svgClass
|
|
727
779
|
*/
|
|
728
|
-
function makeIcon( iconName,
|
|
780
|
+
function makeIcon( iconName, options = { } )
|
|
729
781
|
{
|
|
730
782
|
let data = LX.ICONS[ iconName ];
|
|
731
783
|
console.assert( data, `No icon named _${ iconName }_` );
|
|
732
784
|
|
|
785
|
+
const iconTitle = options.iconTitle;
|
|
786
|
+
const iconClass = options.iconClass;
|
|
787
|
+
const svgClass = options.svgClass;
|
|
788
|
+
|
|
733
789
|
// Just another name for the same icon..
|
|
734
790
|
if( data.constructor == String )
|
|
735
791
|
{
|
|
@@ -739,9 +795,9 @@ function makeIcon( iconName, iconTitle, extraClass = "" )
|
|
|
739
795
|
const svg = document.createElementNS( "http://www.w3.org/2000/svg", "svg" );
|
|
740
796
|
svg.setAttribute( "viewBox", `0 0 ${ data[ 0 ] } ${ data[ 1 ] }` );
|
|
741
797
|
|
|
742
|
-
if(
|
|
798
|
+
if( svgClass )
|
|
743
799
|
{
|
|
744
|
-
svg.classList.add(
|
|
800
|
+
svg.classList.add( svgClass );
|
|
745
801
|
}
|
|
746
802
|
|
|
747
803
|
if( data[ 5 ] )
|
|
@@ -769,7 +825,7 @@ function makeIcon( iconName, iconTitle, extraClass = "" )
|
|
|
769
825
|
|
|
770
826
|
const icon = document.createElement( "a" );
|
|
771
827
|
icon.title = iconTitle ?? "";
|
|
772
|
-
icon.className = "lexicon " +
|
|
828
|
+
icon.className = "lexicon " + ( iconClass ?? "" );
|
|
773
829
|
icon.appendChild( svg );
|
|
774
830
|
|
|
775
831
|
return icon;
|
|
@@ -1368,6 +1424,19 @@ function init( options = { } )
|
|
|
1368
1424
|
|
|
1369
1425
|
LX.init = init;
|
|
1370
1426
|
|
|
1427
|
+
/**
|
|
1428
|
+
* @method setStrictViewport
|
|
1429
|
+
* @param {Boolean} value
|
|
1430
|
+
*/
|
|
1431
|
+
|
|
1432
|
+
function setStrictViewport( value )
|
|
1433
|
+
{
|
|
1434
|
+
this.usingStrictViewport = value ?? true;
|
|
1435
|
+
document.documentElement.setAttribute( "data-strictVP", ( this.usingStrictViewport ) ? "true" : "false" );
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
LX.setStrictViewport = setStrictViewport;
|
|
1439
|
+
|
|
1371
1440
|
/**
|
|
1372
1441
|
* @method setCommandbarState
|
|
1373
1442
|
* @param {Boolean} value
|
|
@@ -2232,6 +2301,8 @@ class ColorPicker {
|
|
|
2232
2301
|
|
|
2233
2302
|
doAsync( this._svToPosition.bind( this, this.currentColor.hsv.s, this.currentColor.hsv.v ) );
|
|
2234
2303
|
|
|
2304
|
+
let pickerRect = null;
|
|
2305
|
+
|
|
2235
2306
|
let innerMouseDown = e => {
|
|
2236
2307
|
var doc = this.root.ownerDocument;
|
|
2237
2308
|
doc.addEventListener( 'mousemove', innerMouseMove );
|
|
@@ -2246,15 +2317,15 @@ class ColorPicker {
|
|
|
2246
2317
|
this.intSatMarker.style.top = currentTop + "px";
|
|
2247
2318
|
this._positionToSv( currentLeft, currentTop );
|
|
2248
2319
|
this._updateColorValue();
|
|
2320
|
+
|
|
2321
|
+
pickerRect = this.colorPickerBackground.getBoundingClientRect();
|
|
2249
2322
|
}
|
|
2250
2323
|
|
|
2251
2324
|
let innerMouseMove = e => {
|
|
2252
2325
|
const dX = e.movementX;
|
|
2253
2326
|
const dY = e.movementY;
|
|
2254
|
-
|
|
2255
|
-
const
|
|
2256
|
-
const mouseX = e.offsetX - rect.x;
|
|
2257
|
-
const mouseY = e.offsetY - rect.y;
|
|
2327
|
+
const mouseX = e.x - pickerRect.x;
|
|
2328
|
+
const mouseY = e.y - pickerRect.y;
|
|
2258
2329
|
|
|
2259
2330
|
if ( dX != 0 && ( mouseX >= 0 || dX < 0 ) && ( mouseX < this.colorPickerBackground.offsetWidth || dX > 0 ) )
|
|
2260
2331
|
{
|
|
@@ -2324,6 +2395,8 @@ class ColorPicker {
|
|
|
2324
2395
|
this._updateColorValue();
|
|
2325
2396
|
};
|
|
2326
2397
|
|
|
2398
|
+
let hueTrackerRect = null;
|
|
2399
|
+
|
|
2327
2400
|
let innerMouseDownHue = e => {
|
|
2328
2401
|
const doc = this.root.ownerDocument;
|
|
2329
2402
|
doc.addEventListener( 'mousemove', innerMouseMoveHue );
|
|
@@ -2334,15 +2407,15 @@ class ColorPicker {
|
|
|
2334
2407
|
|
|
2335
2408
|
const hueX = clamp( e.offsetX - this.markerHalfSize, 0, this.colorPickerTracker.offsetWidth - this.markerSize );
|
|
2336
2409
|
_fromHueX( hueX );
|
|
2410
|
+
|
|
2411
|
+
hueTrackerRect = this.colorPickerTracker.getBoundingClientRect();
|
|
2337
2412
|
}
|
|
2338
2413
|
|
|
2339
2414
|
let innerMouseMoveHue = e => {
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
const rect = this.colorPickerTracker.getBoundingClientRect();
|
|
2343
|
-
const mouseX = e.offsetX - rect.x;
|
|
2415
|
+
const dX = e.movementX;
|
|
2416
|
+
const mouseX = e.x - hueTrackerRect.x;
|
|
2344
2417
|
|
|
2345
|
-
if ( dX != 0 && ( mouseX >=
|
|
2418
|
+
if ( dX != 0 && ( mouseX >= this.markerHalfSize || dX < 0 ) && ( mouseX < ( this.colorPickerTracker.offsetWidth - this.markerHalfSize ) || dX > 0 ) )
|
|
2346
2419
|
{
|
|
2347
2420
|
const hueX = LX.clamp( parseInt( this.hueMarker.style.left ) + dX, 0, this.colorPickerTracker.offsetWidth - this.markerSize );
|
|
2348
2421
|
_fromHueX( hueX )
|
|
@@ -2387,6 +2460,8 @@ class ColorPicker {
|
|
|
2387
2460
|
this.alphaMarker.style.backgroundColor = `rgb(${ this.currentColor.css.r }, ${ this.currentColor.css.g }, ${ this.currentColor.css.b },${ this.currentColor.css.a })`;
|
|
2388
2461
|
};
|
|
2389
2462
|
|
|
2463
|
+
let alphaTrackerRect = null;
|
|
2464
|
+
|
|
2390
2465
|
let innerMouseDownAlpha = e => {
|
|
2391
2466
|
const doc = this.root.ownerDocument;
|
|
2392
2467
|
doc.addEventListener( 'mousemove', innerMouseMoveAlpha );
|
|
@@ -2396,15 +2471,14 @@ class ColorPicker {
|
|
|
2396
2471
|
e.stopPropagation();
|
|
2397
2472
|
const alphaX = clamp( e.offsetX - this.markerHalfSize, 0, this.alphaTracker.offsetWidth - this.markerSize );
|
|
2398
2473
|
_fromAlphaX( alphaX );
|
|
2474
|
+
alphaTrackerRect = this.alphaTracker.getBoundingClientRect();
|
|
2399
2475
|
}
|
|
2400
2476
|
|
|
2401
2477
|
let innerMouseMoveAlpha = e => {
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
const rect = this.alphaTracker.getBoundingClientRect();
|
|
2405
|
-
const mouseX = e.offsetX - rect.x;
|
|
2478
|
+
const dX = e.movementX;
|
|
2479
|
+
const mouseX = e.x - alphaTrackerRect.x;
|
|
2406
2480
|
|
|
2407
|
-
if ( dX != 0 && ( mouseX >=
|
|
2481
|
+
if ( dX != 0 && ( mouseX >= this.markerHalfSize || dX < 0 ) && ( mouseX < ( this.alphaTracker.offsetWidth - this.markerHalfSize ) || dX > 0 ) )
|
|
2408
2482
|
{
|
|
2409
2483
|
const alphaX = LX.clamp( parseInt( this.alphaMarker.style.left ) + dX, 0, this.alphaTracker.offsetWidth - this.markerSize );
|
|
2410
2484
|
_fromAlphaX( alphaX );
|
|
@@ -2435,9 +2509,23 @@ class ColorPicker {
|
|
|
2435
2509
|
this.labelWidget = new TextInput( null, "", null, { inputClass: "bg-none", fit: true, disabled: true } );
|
|
2436
2510
|
colorLabel.appendChild( this.labelWidget.root );
|
|
2437
2511
|
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2512
|
+
// Copy button
|
|
2513
|
+
{
|
|
2514
|
+
const copyButtonWidget = new Button(null, "copy", async () => {
|
|
2515
|
+
navigator.clipboard.writeText( this.labelWidget.value() );
|
|
2516
|
+
copyButtonWidget.root.querySelector( "input[type='checkbox']" ).style.pointerEvents = "none";
|
|
2517
|
+
|
|
2518
|
+
doAsync( () => {
|
|
2519
|
+
copyButtonWidget.root.swap( true );
|
|
2520
|
+
copyButtonWidget.root.querySelector( "input[type='checkbox']" ).style.pointerEvents = "auto";
|
|
2521
|
+
}, 3000 );
|
|
2522
|
+
|
|
2523
|
+
}, { swap: "check", icon: "copy", buttonClass: "bg-none", className: "ml-auto", title: "Copy" })
|
|
2524
|
+
|
|
2525
|
+
copyButtonWidget.root.querySelector( ".swap-on svg path" ).style.fill = "#42d065";
|
|
2526
|
+
|
|
2527
|
+
colorLabel.appendChild( copyButtonWidget.root );
|
|
2528
|
+
}
|
|
2441
2529
|
|
|
2442
2530
|
this._updateColorValue( hexValue, true );
|
|
2443
2531
|
|
|
@@ -2511,7 +2599,7 @@ class ColorPicker {
|
|
|
2511
2599
|
|
|
2512
2600
|
if( this.useAlpha )
|
|
2513
2601
|
{
|
|
2514
|
-
this.alphaTracker.style.color = `rgb(${ this.currentColor.css.r }, ${ this.currentColor.css.g }, ${ this.currentColor.css.b }
|
|
2602
|
+
this.alphaTracker.style.color = `rgb(${ this.currentColor.css.r }, ${ this.currentColor.css.g }, ${ this.currentColor.css.b })`;
|
|
2515
2603
|
}
|
|
2516
2604
|
|
|
2517
2605
|
const toFixed = ( s, n = 2) => { return s.toFixed( n ).replace( /([0-9]+(\.[0-9]+[1-9])?)(\.?0+$)/, '$1' ) };
|
|
@@ -2519,7 +2607,7 @@ class ColorPicker {
|
|
|
2519
2607
|
if( this.colorModel == "CSS" )
|
|
2520
2608
|
{
|
|
2521
2609
|
const { r, g, b, a } = this.currentColor.css;
|
|
2522
|
-
this.labelWidget.set( `
|
|
2610
|
+
this.labelWidget.set( `rgb${ this.useAlpha ? 'a' : '' }(${ r },${ g },${ b }${ this.useAlpha ? ',' + toFixed( a ) : '' })` );
|
|
2523
2611
|
}
|
|
2524
2612
|
else if( this.colorModel == "Hex" )
|
|
2525
2613
|
{
|
|
@@ -2828,7 +2916,7 @@ class Area {
|
|
|
2828
2916
|
* @method split
|
|
2829
2917
|
* @param {Object} options
|
|
2830
2918
|
* type: Split mode (horizontal, vertical) ["horizontal"]
|
|
2831
|
-
* sizes: Size of each new area (Array) ["50%", "50%"]
|
|
2919
|
+
* sizes: CSS Size of each new area (Array) ["50%", "50%"]
|
|
2832
2920
|
* resize: Allow area manual resizing [true]
|
|
2833
2921
|
* sizes: "Allow the area to be minimized [false]
|
|
2834
2922
|
*/
|
|
@@ -2843,11 +2931,12 @@ class Area {
|
|
|
2843
2931
|
this.root = this.sections[ 1 ].root;
|
|
2844
2932
|
}
|
|
2845
2933
|
|
|
2846
|
-
const type = options.type
|
|
2934
|
+
const type = options.type ?? "horizontal";
|
|
2847
2935
|
const sizes = options.sizes || [ "50%", "50%" ];
|
|
2848
2936
|
const auto = (options.sizes === 'auto') || ( options.sizes && options.sizes[ 0 ] == "auto" && options.sizes[ 1 ] == "auto" );
|
|
2849
2937
|
|
|
2850
|
-
|
|
2938
|
+
// Secondary area fills space
|
|
2939
|
+
if( !sizes[ 1 ] || ( sizes[ 0 ] != "auto" && sizes[ 1 ] == "auto" ) )
|
|
2851
2940
|
{
|
|
2852
2941
|
let size = sizes[ 0 ];
|
|
2853
2942
|
let margin = options.top ? options.top : 0;
|
|
@@ -2860,17 +2949,13 @@ class Area {
|
|
|
2860
2949
|
sizes[ 1 ] = "calc( 100% - " + size + " )";
|
|
2861
2950
|
}
|
|
2862
2951
|
|
|
2863
|
-
// Create areas
|
|
2864
|
-
let area1 = new Area( { skipAppend: true, className: "split" + ( options.menubar || options.sidebar ? "" : " origin" ) } );
|
|
2865
|
-
let area2 = new Area( { skipAppend: true, className: "split" } );
|
|
2866
|
-
|
|
2867
|
-
area1.parentArea = this;
|
|
2868
|
-
area2.parentArea = this;
|
|
2869
|
-
|
|
2870
2952
|
let minimizable = options.minimizable ?? false;
|
|
2871
2953
|
let resize = ( options.resize ?? true ) || minimizable;
|
|
2954
|
+
let fixedSize = options.fixedSize ?? !resize;
|
|
2955
|
+
let splitbarOffset = 0;
|
|
2956
|
+
let primarySize = [];
|
|
2957
|
+
let secondarySize = [];
|
|
2872
2958
|
|
|
2873
|
-
let data = "0px";
|
|
2874
2959
|
this.offset = 0;
|
|
2875
2960
|
|
|
2876
2961
|
if( resize )
|
|
@@ -2890,93 +2975,104 @@ class Area {
|
|
|
2890
2975
|
|
|
2891
2976
|
this.splitBar.addEventListener( 'mousedown', innerMouseDown );
|
|
2892
2977
|
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
// Being minimizable means it's also resizeable!
|
|
2896
|
-
if( minimizable )
|
|
2897
|
-
{
|
|
2898
|
-
this.splitExtended = false;
|
|
2899
|
-
|
|
2900
|
-
// Keep state of the animation when ends...
|
|
2901
|
-
area2.root.addEventListener('animationend', e => {
|
|
2902
|
-
const opacity = getComputedStyle( area2.root ).opacity;
|
|
2903
|
-
area2.root.classList.remove( e.animationName + "-" + type );
|
|
2904
|
-
area2.root.style.opacity = opacity;
|
|
2905
|
-
flushCss(area2.root);
|
|
2906
|
-
});
|
|
2907
|
-
|
|
2908
|
-
this.splitBar.addEventListener("contextmenu", e => {
|
|
2909
|
-
e.preventDefault();
|
|
2910
|
-
addContextMenu(null, e, c => {
|
|
2911
|
-
c.add("Extend", { disabled: this.splitExtended, callback: () => { this.extend() } });
|
|
2912
|
-
c.add("Reduce", { disabled: !this.splitExtended, callback: () => { this.reduce() } });
|
|
2913
|
-
});
|
|
2914
|
-
});
|
|
2915
|
-
}
|
|
2978
|
+
splitbarOffset = ( LX.DEFAULT_SPLITBAR_SIZE / 2 ); // updates
|
|
2916
2979
|
}
|
|
2917
2980
|
|
|
2918
2981
|
if( type == "horizontal" )
|
|
2919
2982
|
{
|
|
2920
|
-
|
|
2921
|
-
width2 = sizes[ 1 ];
|
|
2983
|
+
this.root.style.display = "flex";
|
|
2922
2984
|
|
|
2923
|
-
if(
|
|
2985
|
+
if( !fixedSize )
|
|
2924
2986
|
{
|
|
2925
|
-
|
|
2926
|
-
|
|
2987
|
+
const parentWidth = this.root.offsetWidth;
|
|
2988
|
+
const leftPx = parsePixelSize( sizes[ 0 ], parentWidth );
|
|
2989
|
+
const rightPx = parsePixelSize( sizes[ 1 ], parentWidth );
|
|
2990
|
+
const leftPercent = ( leftPx / parentWidth ) * 100;
|
|
2991
|
+
const rightPercent = ( rightPx / parentWidth ) * 100;
|
|
2927
2992
|
|
|
2928
|
-
|
|
2993
|
+
// Style using percentages
|
|
2994
|
+
primarySize[ 0 ] = `calc(${ leftPercent }% - ${ splitbarOffset }px)`;
|
|
2995
|
+
secondarySize[ 0 ] = `calc(${ rightPercent }% - ${ splitbarOffset }px)`;
|
|
2996
|
+
}
|
|
2997
|
+
else
|
|
2929
2998
|
{
|
|
2930
|
-
|
|
2999
|
+
primarySize[ 0 ] = `calc(${ sizes[ 0 ] } - ${ splitbarOffset }px)`;
|
|
3000
|
+
secondarySize[ 0 ] = `calc(${ sizes[ 1 ] } - ${ splitbarOffset }px)`;
|
|
2931
3001
|
}
|
|
2932
3002
|
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
area2.root.style.width = "calc( " + width2 + " - " + data + " )";
|
|
2936
|
-
area2.root.style.height = "calc(100% - 0px)";
|
|
2937
|
-
this.root.style.display = "flex";
|
|
3003
|
+
primarySize[ 1 ] = "100%";
|
|
3004
|
+
secondarySize[ 1 ] = "100%";
|
|
2938
3005
|
}
|
|
2939
3006
|
else // vertical
|
|
2940
3007
|
{
|
|
2941
|
-
area1.root.style.width = "100%";
|
|
2942
|
-
area2.root.style.width = "100%";
|
|
2943
|
-
|
|
2944
3008
|
if( auto )
|
|
2945
3009
|
{
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
});
|
|
3010
|
+
primarySize[ 1 ] = "auto";
|
|
3011
|
+
}
|
|
3012
|
+
else if( !fixedSize )
|
|
3013
|
+
{
|
|
3014
|
+
const parentHeight = this.root.offsetHeight;
|
|
3015
|
+
const topPx = parsePixelSize( sizes[ 0 ], parentHeight );
|
|
3016
|
+
const bottomPx = parsePixelSize( sizes[ 1 ], parentHeight );
|
|
3017
|
+
const topPercent = ( topPx / parentHeight ) * 100;
|
|
3018
|
+
const bottomPercent = ( bottomPx / parentHeight ) * 100;
|
|
2956
3019
|
|
|
2957
|
-
|
|
3020
|
+
primarySize[ 1 ] = ( sizes[ 0 ] == "auto" ? "auto" : `calc(${ topPercent }% - ${ splitbarOffset }px)`);
|
|
3021
|
+
secondarySize[ 1 ] = ( sizes[ 1 ] == "auto" ? "auto" : `calc(${ bottomPercent }% - ${ splitbarOffset }px)`);
|
|
2958
3022
|
}
|
|
2959
3023
|
else
|
|
2960
3024
|
{
|
|
2961
|
-
|
|
2962
|
-
|
|
3025
|
+
primarySize[ 1 ] = ( sizes[ 0 ] == "auto" ? "auto" : `calc(${ sizes[ 0 ] } - ${ splitbarOffset }px)`);
|
|
3026
|
+
secondarySize[ 1 ] = ( sizes[ 1 ] == "auto" ? "auto" : `calc(${ sizes[ 1 ] } - ${ splitbarOffset }px)`);
|
|
3027
|
+
}
|
|
2963
3028
|
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
3029
|
+
primarySize[ 0 ] = "100%";
|
|
3030
|
+
secondarySize[ 0 ] = "100%";
|
|
3031
|
+
}
|
|
3032
|
+
|
|
3033
|
+
// Create areas
|
|
3034
|
+
let area1 = new Area( { width: primarySize[ 0 ], height: primarySize[ 1 ], skipAppend: true, className: "split" + ( options.menubar || options.sidebar ? "" : " origin" ) } );
|
|
3035
|
+
let area2 = new Area( { width: secondarySize[ 0 ], height: secondarySize[ 1 ], skipAppend: true, className: "split" } );
|
|
2968
3036
|
|
|
2969
|
-
|
|
3037
|
+
if( auto && type == "vertical" )
|
|
3038
|
+
{
|
|
3039
|
+
// Listen resize event on first area
|
|
3040
|
+
const resizeObserver = new ResizeObserver( entries => {
|
|
3041
|
+
for ( const entry of entries )
|
|
2970
3042
|
{
|
|
2971
|
-
|
|
3043
|
+
const size = entry.target.getComputedSize();
|
|
3044
|
+
area2.root.style.height = "calc(100% - " + ( size.height ) + "px )";
|
|
2972
3045
|
}
|
|
3046
|
+
});
|
|
2973
3047
|
|
|
2974
|
-
|
|
2975
|
-
area1.root.style.height = ( height1 == "auto" ? height1 : "calc( " + height1 + " - " + data + " )");
|
|
2976
|
-
area2.root.style.height = ( height2 == "auto" ? height2 : "calc( " + height2 + " - " + data + " )");
|
|
2977
|
-
}
|
|
3048
|
+
resizeObserver.observe( area1.root );
|
|
2978
3049
|
}
|
|
2979
3050
|
|
|
3051
|
+
// Being minimizable means it's also resizeable!
|
|
3052
|
+
if( resize && minimizable )
|
|
3053
|
+
{
|
|
3054
|
+
this.splitExtended = false;
|
|
3055
|
+
|
|
3056
|
+
// Keep state of the animation when ends...
|
|
3057
|
+
area2.root.addEventListener('animationend', e => {
|
|
3058
|
+
const opacity = getComputedStyle( area2.root ).opacity;
|
|
3059
|
+
area2.root.classList.remove( e.animationName + "-" + type );
|
|
3060
|
+
area2.root.style.opacity = opacity;
|
|
3061
|
+
flushCss( area2.root );
|
|
3062
|
+
});
|
|
3063
|
+
|
|
3064
|
+
this.splitBar.addEventListener("contextmenu", e => {
|
|
3065
|
+
e.preventDefault();
|
|
3066
|
+
addContextMenu(null, e, c => {
|
|
3067
|
+
c.add("Extend", { disabled: this.splitExtended, callback: () => { this.extend() } });
|
|
3068
|
+
c.add("Reduce", { disabled: !this.splitExtended, callback: () => { this.reduce() } });
|
|
3069
|
+
});
|
|
3070
|
+
});
|
|
3071
|
+
}
|
|
3072
|
+
|
|
3073
|
+
area1.parentArea = this;
|
|
3074
|
+
area2.parentArea = this;
|
|
3075
|
+
|
|
2980
3076
|
this.root.appendChild( area1.root );
|
|
2981
3077
|
|
|
2982
3078
|
if( resize )
|
|
@@ -2985,6 +3081,7 @@ class Area {
|
|
|
2985
3081
|
}
|
|
2986
3082
|
|
|
2987
3083
|
this.root.appendChild( area2.root );
|
|
3084
|
+
|
|
2988
3085
|
this.sections = [ area1, area2 ];
|
|
2989
3086
|
this.type = type;
|
|
2990
3087
|
|
|
@@ -3098,10 +3195,10 @@ class Area {
|
|
|
3098
3195
|
return;
|
|
3099
3196
|
}
|
|
3100
3197
|
|
|
3101
|
-
let [area1, area2] = this.sections;
|
|
3198
|
+
let [ area1, area2 ] = this.sections;
|
|
3102
3199
|
this.splitExtended = true;
|
|
3103
3200
|
|
|
3104
|
-
if( this.type == "vertical")
|
|
3201
|
+
if( this.type == "vertical" )
|
|
3105
3202
|
{
|
|
3106
3203
|
this.offset = area2.root.offsetHeight;
|
|
3107
3204
|
area2.root.classList.add("fadeout-vertical");
|
|
@@ -3112,7 +3209,7 @@ class Area {
|
|
|
3112
3209
|
{
|
|
3113
3210
|
this.offset = area2.root.offsetWidth - 8; // Force some height here...
|
|
3114
3211
|
area2.root.classList.add("fadeout-horizontal");
|
|
3115
|
-
this._moveSplit(-Infinity, true, 8);
|
|
3212
|
+
this._moveSplit( -Infinity, true, 8 );
|
|
3116
3213
|
}
|
|
3117
3214
|
|
|
3118
3215
|
doAsync( () => this.propagateEvent('onresize'), 150 );
|
|
@@ -3219,8 +3316,7 @@ class Area {
|
|
|
3219
3316
|
|
|
3220
3317
|
LX.menubars.push( menubar );
|
|
3221
3318
|
|
|
3222
|
-
const
|
|
3223
|
-
const [ bar, content ] = this.split({ type: 'vertical', sizes: [height, null], resize: false, menubar: true });
|
|
3319
|
+
const [ bar, content ] = this.split({ type: 'vertical', sizes: ["48px", null], resize: false, menubar: true });
|
|
3224
3320
|
menubar.siblingArea = content;
|
|
3225
3321
|
|
|
3226
3322
|
bar.attach( menubar );
|
|
@@ -3337,7 +3433,8 @@ class Area {
|
|
|
3337
3433
|
img: b.img,
|
|
3338
3434
|
className: b.class ?? "",
|
|
3339
3435
|
title: b.name,
|
|
3340
|
-
overflowContainerX: overlayPanel.root
|
|
3436
|
+
overflowContainerX: overlayPanel.root,
|
|
3437
|
+
swap: b.swap
|
|
3341
3438
|
};
|
|
3342
3439
|
|
|
3343
3440
|
if( group )
|
|
@@ -3474,7 +3571,7 @@ class Area {
|
|
|
3474
3571
|
|
|
3475
3572
|
const a2 = this.sections[ 1 ];
|
|
3476
3573
|
const a2Root = a2.root;
|
|
3477
|
-
const splitData = "
|
|
3574
|
+
const splitData = "- "+ LX.DEFAULT_SPLITBAR_SIZE + "px";
|
|
3478
3575
|
|
|
3479
3576
|
let transition = null;
|
|
3480
3577
|
if( !forceAnimation )
|
|
@@ -3482,30 +3579,47 @@ class Area {
|
|
|
3482
3579
|
// Remove transitions for this change..
|
|
3483
3580
|
transition = a1Root.style.transition;
|
|
3484
3581
|
a1Root.style.transition = a2Root.style.transition = "none";
|
|
3485
|
-
flushCss( a1Root );
|
|
3486
|
-
flushCss( a2Root );
|
|
3582
|
+
// flushCss( a1Root );
|
|
3487
3583
|
}
|
|
3488
3584
|
|
|
3489
3585
|
if( this.type == "horizontal" )
|
|
3490
3586
|
{
|
|
3491
3587
|
var size = Math.max( a2Root.offsetWidth + dt, parseInt( a2.minWidth ) );
|
|
3492
3588
|
if( forceWidth ) size = forceWidth;
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3589
|
+
|
|
3590
|
+
const parentWidth = this.size[ 0 ];
|
|
3591
|
+
const rightPercent = ( size / parentWidth ) * 100;
|
|
3592
|
+
const leftPercent = Math.max( 0, 100 - rightPercent );
|
|
3593
|
+
|
|
3594
|
+
a1Root.style.width = `-moz-calc(${ leftPercent }% ${ splitData })`;
|
|
3595
|
+
a1Root.style.width = `-webkit-calc( ${ leftPercent }% ${ splitData })`;
|
|
3596
|
+
a1Root.style.width = `calc( ${ leftPercent }% ${ splitData })`;
|
|
3597
|
+
a2Root.style.width = `${ rightPercent }%`;
|
|
3598
|
+
a2Root.style.width = `${ rightPercent }%`;
|
|
3599
|
+
a2Root.style.width = `${ rightPercent }%`;
|
|
3600
|
+
|
|
3601
|
+
if( a1.maxWidth != Infinity )
|
|
3602
|
+
{
|
|
3603
|
+
a2Root.style.minWidth = "calc( 100% - " + parseInt( a1.maxWidth ) + "px" + " )";
|
|
3604
|
+
}
|
|
3499
3605
|
}
|
|
3500
3606
|
else
|
|
3501
3607
|
{
|
|
3502
|
-
var size = Math.max((a2Root.offsetHeight + dt) + a2.offset, parseInt(a2.minHeight));
|
|
3608
|
+
var size = Math.max( ( a2Root.offsetHeight + dt ) + a2.offset, parseInt(a2.minHeight) );
|
|
3503
3609
|
if( forceWidth ) size = forceWidth;
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3610
|
+
|
|
3611
|
+
const parentHeight = this.size[ 1 ];
|
|
3612
|
+
const bottomPercent = ( size / parentHeight ) * 100;
|
|
3613
|
+
const topPercent = Math.max( 0, 100 - bottomPercent );
|
|
3614
|
+
|
|
3615
|
+
a1Root.style.height = `-moz-calc(${ topPercent }% ${ splitData })`;
|
|
3616
|
+
a1Root.style.height = `-webkit-calc( ${ topPercent }% ${ splitData })`;
|
|
3617
|
+
a1Root.style.height = `calc( ${ topPercent }% ${ splitData })`;
|
|
3618
|
+
a2Root.style.height = `${ bottomPercent }%`;
|
|
3619
|
+
a2Root.style.height = `${ bottomPercent }%`;
|
|
3620
|
+
a2Root.style.height = `${ bottomPercent }%`;
|
|
3621
|
+
|
|
3507
3622
|
a1Root.style.minHeight = a1.minHeight + "px";
|
|
3508
|
-
a2Root.style.height = ( size - a2.offset ) + "px";
|
|
3509
3623
|
}
|
|
3510
3624
|
|
|
3511
3625
|
if( !forceAnimation )
|
|
@@ -3514,10 +3628,10 @@ class Area {
|
|
|
3514
3628
|
a1Root.style.transition = a2Root.style.transition = transition;
|
|
3515
3629
|
}
|
|
3516
3630
|
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3631
|
+
doAsync( () => {
|
|
3632
|
+
this._update();
|
|
3633
|
+
this.propagateEvent( 'onresize' );
|
|
3634
|
+
}, 10 );
|
|
3521
3635
|
}
|
|
3522
3636
|
|
|
3523
3637
|
_disableSplitResize() {
|
|
@@ -4396,7 +4510,7 @@ class Menubar {
|
|
|
4396
4510
|
// Otherwise, create it
|
|
4397
4511
|
button = document.createElement('div');
|
|
4398
4512
|
const disabled = options.disabled ?? false;
|
|
4399
|
-
button.className = "lexmenubutton" + (disabled ? " disabled" : "");
|
|
4513
|
+
button.className = "lexmenubutton main" + (disabled ? " disabled" : "");
|
|
4400
4514
|
button.title = name;
|
|
4401
4515
|
button.innerHTML = "<a><image src='" + src + "' class='lexicon' style='height:32px;'></a>";
|
|
4402
4516
|
|
|
@@ -4560,7 +4674,7 @@ class SideBar {
|
|
|
4560
4674
|
|
|
4561
4675
|
if( this.collapsable )
|
|
4562
4676
|
{
|
|
4563
|
-
const icon = LX.makeIcon( "sidebar", "Toggle Sidebar", "toggler" );
|
|
4677
|
+
const icon = LX.makeIcon( "sidebar", { title: "Toggle Sidebar", iconClass: "toggler" } );
|
|
4564
4678
|
this.header.appendChild( icon );
|
|
4565
4679
|
|
|
4566
4680
|
icon.addEventListener( "click", (e) => {
|
|
@@ -5047,7 +5161,7 @@ class SideBar {
|
|
|
5047
5161
|
|
|
5048
5162
|
if( options.action )
|
|
5049
5163
|
{
|
|
5050
|
-
const actionIcon = LX.makeIcon( options.action.icon ?? "more-horizontal", options.action.name );
|
|
5164
|
+
const actionIcon = LX.makeIcon( options.action.icon ?? "more-horizontal", { title: options.action.name } );
|
|
5051
5165
|
itemDom.appendChild( actionIcon );
|
|
5052
5166
|
|
|
5053
5167
|
actionIcon.addEventListener( "click", (e) => {
|
|
@@ -5107,7 +5221,7 @@ class SideBar {
|
|
|
5107
5221
|
|
|
5108
5222
|
if( suboptions.action )
|
|
5109
5223
|
{
|
|
5110
|
-
const actionIcon = LX.makeIcon( suboptions.action.icon ?? "more-horizontal", suboptions.action.name );
|
|
5224
|
+
const actionIcon = LX.makeIcon( suboptions.action.icon ?? "more-horizontal", { title: suboptions.action.name } );
|
|
5111
5225
|
subentry.appendChild( actionIcon );
|
|
5112
5226
|
|
|
5113
5227
|
actionIcon.addEventListener( "click", (e) => {
|
|
@@ -5299,7 +5413,7 @@ class Widget {
|
|
|
5299
5413
|
|
|
5300
5414
|
_addResetProperty( container, callback ) {
|
|
5301
5415
|
|
|
5302
|
-
const domEl = LX.makeIcon( "rotate-left", "Reset" )
|
|
5416
|
+
const domEl = LX.makeIcon( "rotate-left", { title: "Reset" } )
|
|
5303
5417
|
domEl.style.display = "none";
|
|
5304
5418
|
domEl.style.marginRight = "6px";
|
|
5305
5419
|
domEl.style.marginLeft = "0";
|
|
@@ -6083,7 +6197,17 @@ class NodeTree {
|
|
|
6083
6197
|
|
|
6084
6198
|
this.data = newData ?? this.data;
|
|
6085
6199
|
this.domEl.querySelector( "ul" ).innerHTML = "";
|
|
6086
|
-
|
|
6200
|
+
if( this.data.constructor === Object )
|
|
6201
|
+
{
|
|
6202
|
+
this._createItem( null, this.data, 0, selectedId );
|
|
6203
|
+
}
|
|
6204
|
+
else
|
|
6205
|
+
{
|
|
6206
|
+
for( let d of this.data )
|
|
6207
|
+
{
|
|
6208
|
+
this._createItem( null, d, 0, selectedId );
|
|
6209
|
+
}
|
|
6210
|
+
}
|
|
6087
6211
|
}
|
|
6088
6212
|
|
|
6089
6213
|
/* Refreshes the tree and focuses current element */
|
|
@@ -6210,8 +6334,8 @@ class TextInput extends Widget {
|
|
|
6210
6334
|
};
|
|
6211
6335
|
|
|
6212
6336
|
this.onResize = ( rect ) => {
|
|
6213
|
-
const realNameWidth = ( this.root.domName?.
|
|
6214
|
-
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth }
|
|
6337
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
6338
|
+
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth })`;
|
|
6215
6339
|
};
|
|
6216
6340
|
|
|
6217
6341
|
this.valid = ( v ) => {
|
|
@@ -6349,8 +6473,8 @@ class TextArea extends Widget {
|
|
|
6349
6473
|
};
|
|
6350
6474
|
|
|
6351
6475
|
this.onResize = ( rect ) => {
|
|
6352
|
-
const realNameWidth = ( this.root.domName?.
|
|
6353
|
-
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth }
|
|
6476
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
6477
|
+
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth })`;
|
|
6354
6478
|
};
|
|
6355
6479
|
|
|
6356
6480
|
let container = document.createElement( "div" );
|
|
@@ -6443,8 +6567,8 @@ class Button extends Widget {
|
|
|
6443
6567
|
};
|
|
6444
6568
|
|
|
6445
6569
|
this.onResize = ( rect ) => {
|
|
6446
|
-
const realNameWidth = ( this.root.domName?.
|
|
6447
|
-
wValue.style.width = `calc( 100% - ${ realNameWidth }
|
|
6570
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
6571
|
+
wValue.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
6448
6572
|
};
|
|
6449
6573
|
|
|
6450
6574
|
var wValue = document.createElement( 'button' );
|
|
@@ -6506,10 +6630,20 @@ class Button extends Widget {
|
|
|
6506
6630
|
const input = document.createElement( "input" );
|
|
6507
6631
|
input.type = "checkbox";
|
|
6508
6632
|
wValue.prepend( input );
|
|
6509
|
-
// trigger = input;
|
|
6510
6633
|
|
|
6511
|
-
|
|
6512
|
-
|
|
6634
|
+
let swapIcon = null;
|
|
6635
|
+
|
|
6636
|
+
// @legacy
|
|
6637
|
+
if( options.swap.includes( "fa-" ) )
|
|
6638
|
+
{
|
|
6639
|
+
swapIcon = document.createElement( 'a' );
|
|
6640
|
+
swapIcon.className = options.swap + " swap-on lexicon";
|
|
6641
|
+
}
|
|
6642
|
+
else
|
|
6643
|
+
{
|
|
6644
|
+
swapIcon = LX.makeIcon( options.swap, { iconClass: "swap-on" } );
|
|
6645
|
+
}
|
|
6646
|
+
|
|
6513
6647
|
wValue.appendChild( swapIcon );
|
|
6514
6648
|
|
|
6515
6649
|
this.root.swap = function( skipCallback ) {
|
|
@@ -6696,8 +6830,8 @@ class ComboButtons extends Widget {
|
|
|
6696
6830
|
};
|
|
6697
6831
|
|
|
6698
6832
|
this.onResize = ( rect ) => {
|
|
6699
|
-
const realNameWidth = ( this.root.domName?.
|
|
6700
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
6833
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
6834
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
6701
6835
|
};
|
|
6702
6836
|
|
|
6703
6837
|
this.root.appendChild( container );
|
|
@@ -6913,8 +7047,8 @@ class Select extends Widget {
|
|
|
6913
7047
|
};
|
|
6914
7048
|
|
|
6915
7049
|
this.onResize = ( rect ) => {
|
|
6916
|
-
const realNameWidth = ( this.root.domName?.
|
|
6917
|
-
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth }
|
|
7050
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
7051
|
+
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth })`;
|
|
6918
7052
|
};
|
|
6919
7053
|
|
|
6920
7054
|
let container = document.createElement( "div" );
|
|
@@ -7261,11 +7395,8 @@ class Curve extends Widget {
|
|
|
7261
7395
|
};
|
|
7262
7396
|
|
|
7263
7397
|
this.onResize = ( rect ) => {
|
|
7264
|
-
const realNameWidth = ( this.root.domName?.
|
|
7265
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
7266
|
-
flushCss( container );
|
|
7267
|
-
curveInstance.canvas.width = container.offsetWidth;
|
|
7268
|
-
curveInstance.redraw();
|
|
7398
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
7399
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
7269
7400
|
};
|
|
7270
7401
|
|
|
7271
7402
|
var container = document.createElement( "div" );
|
|
@@ -7282,6 +7413,16 @@ class Curve extends Widget {
|
|
|
7282
7413
|
container.appendChild( curveInstance.element );
|
|
7283
7414
|
this.curveInstance = curveInstance;
|
|
7284
7415
|
|
|
7416
|
+
const observer = new ResizeObserver( entries => {
|
|
7417
|
+
for ( const entry of entries )
|
|
7418
|
+
{
|
|
7419
|
+
curveInstance.canvas.width = entry.contentRect.width;
|
|
7420
|
+
curveInstance.redraw();
|
|
7421
|
+
}
|
|
7422
|
+
});
|
|
7423
|
+
|
|
7424
|
+
observer.observe( container );
|
|
7425
|
+
|
|
7285
7426
|
doAsync( this.onResize.bind( this ) );
|
|
7286
7427
|
}
|
|
7287
7428
|
}
|
|
@@ -7315,8 +7456,8 @@ class Dial extends Widget {
|
|
|
7315
7456
|
};
|
|
7316
7457
|
|
|
7317
7458
|
this.onResize = ( rect ) => {
|
|
7318
|
-
const realNameWidth = ( this.root.domName?.
|
|
7319
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
7459
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
7460
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
7320
7461
|
flushCss( container );
|
|
7321
7462
|
dialInstance.element.style.height = dialInstance.element.offsetWidth + "px";
|
|
7322
7463
|
dialInstance.canvas.width = dialInstance.element.offsetWidth;
|
|
@@ -7370,8 +7511,8 @@ class Layers extends Widget {
|
|
|
7370
7511
|
};
|
|
7371
7512
|
|
|
7372
7513
|
this.onResize = ( rect ) => {
|
|
7373
|
-
const realNameWidth = ( this.root.domName?.
|
|
7374
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
7514
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
7515
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
7375
7516
|
};
|
|
7376
7517
|
|
|
7377
7518
|
var container = document.createElement( "div" );
|
|
@@ -7595,8 +7736,8 @@ class List extends Widget {
|
|
|
7595
7736
|
};
|
|
7596
7737
|
|
|
7597
7738
|
this.onResize = ( rect ) => {
|
|
7598
|
-
const realNameWidth = ( this.root.domName?.
|
|
7599
|
-
listContainer.style.width = `calc( 100% - ${ realNameWidth }
|
|
7739
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
7740
|
+
listContainer.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
7600
7741
|
};
|
|
7601
7742
|
|
|
7602
7743
|
this._updateValues = ( newValues ) => {
|
|
@@ -7672,8 +7813,8 @@ class Tags extends Widget {
|
|
|
7672
7813
|
};
|
|
7673
7814
|
|
|
7674
7815
|
this.onResize = ( rect ) => {
|
|
7675
|
-
const realNameWidth = ( this.root.domName?.
|
|
7676
|
-
tagsContainer.style.width = `calc( 100% - ${ realNameWidth }
|
|
7816
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
7817
|
+
tagsContainer.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
7677
7818
|
};
|
|
7678
7819
|
|
|
7679
7820
|
// Show tags
|
|
@@ -7773,8 +7914,8 @@ class Checkbox extends Widget {
|
|
|
7773
7914
|
};
|
|
7774
7915
|
|
|
7775
7916
|
this.onResize = ( rect ) => {
|
|
7776
|
-
const realNameWidth = ( this.root.domName?.
|
|
7777
|
-
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth }
|
|
7917
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
7918
|
+
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth })`;
|
|
7778
7919
|
};
|
|
7779
7920
|
|
|
7780
7921
|
var container = document.createElement( "div" );
|
|
@@ -7856,8 +7997,8 @@ class Toggle extends Widget {
|
|
|
7856
7997
|
};
|
|
7857
7998
|
|
|
7858
7999
|
this.onResize = ( rect ) => {
|
|
7859
|
-
const realNameWidth = ( this.root.domName?.
|
|
7860
|
-
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth }
|
|
8000
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
8001
|
+
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth })`;
|
|
7861
8002
|
};
|
|
7862
8003
|
|
|
7863
8004
|
var container = document.createElement('div');
|
|
@@ -8039,8 +8180,8 @@ class ColorInput extends Widget {
|
|
|
8039
8180
|
};
|
|
8040
8181
|
|
|
8041
8182
|
this.onResize = ( rect ) => {
|
|
8042
|
-
const realNameWidth = ( this.root.domName?.
|
|
8043
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
8183
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
8184
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
8044
8185
|
};
|
|
8045
8186
|
|
|
8046
8187
|
var container = document.createElement( 'span' );
|
|
@@ -8130,8 +8271,8 @@ class RangeInput extends Widget {
|
|
|
8130
8271
|
};
|
|
8131
8272
|
|
|
8132
8273
|
this.onResize = ( rect ) => {
|
|
8133
|
-
const realNameWidth = ( this.root.domName?.
|
|
8134
|
-
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth }
|
|
8274
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
8275
|
+
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth })`;
|
|
8135
8276
|
};
|
|
8136
8277
|
|
|
8137
8278
|
const container = document.createElement( 'div' );
|
|
@@ -8244,8 +8385,8 @@ class NumberInput extends Widget {
|
|
|
8244
8385
|
};
|
|
8245
8386
|
|
|
8246
8387
|
this.onResize = ( rect ) => {
|
|
8247
|
-
const realNameWidth = ( this.root.domName?.
|
|
8248
|
-
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth }
|
|
8388
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
8389
|
+
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth })`;
|
|
8249
8390
|
};
|
|
8250
8391
|
|
|
8251
8392
|
var container = document.createElement( 'div' );
|
|
@@ -8400,7 +8541,6 @@ class NumberInput extends Widget {
|
|
|
8400
8541
|
else if( e.altKey ) mult *= 0.1;
|
|
8401
8542
|
value = ( +vecinput.valueAsNumber + mult * dt );
|
|
8402
8543
|
this.set( value, false, e );
|
|
8403
|
-
// vecinput.value = ( +new_value ).toFixed( 4 ).replace( /([0-9]+(\.[0-9]+[1-9])?)(\.?0+$)/, '$1' );
|
|
8404
8544
|
}
|
|
8405
8545
|
|
|
8406
8546
|
e.stopPropagation();
|
|
@@ -8481,8 +8621,8 @@ class Vector extends Widget {
|
|
|
8481
8621
|
};
|
|
8482
8622
|
|
|
8483
8623
|
this.onResize = ( rect ) => {
|
|
8484
|
-
const realNameWidth = ( this.root.domName?.
|
|
8485
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
8624
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
8625
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
8486
8626
|
};
|
|
8487
8627
|
|
|
8488
8628
|
const vectorInputs = [];
|
|
@@ -8835,8 +8975,8 @@ class OTPInput extends Widget {
|
|
|
8835
8975
|
};
|
|
8836
8976
|
|
|
8837
8977
|
this.onResize = ( rect ) => {
|
|
8838
|
-
const realNameWidth = ( this.root.domName?.
|
|
8839
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
8978
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
8979
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
8840
8980
|
};
|
|
8841
8981
|
|
|
8842
8982
|
this.disabled = options.disabled ?? false;
|
|
@@ -8981,8 +9121,8 @@ class Pad extends Widget {
|
|
|
8981
9121
|
};
|
|
8982
9122
|
|
|
8983
9123
|
this.onResize = ( rect ) => {
|
|
8984
|
-
const realNameWidth = ( this.root.domName?.
|
|
8985
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
9124
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
9125
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
8986
9126
|
};
|
|
8987
9127
|
|
|
8988
9128
|
var container = document.createElement( 'div' );
|
|
@@ -9101,8 +9241,8 @@ class Progress extends Widget {
|
|
|
9101
9241
|
};
|
|
9102
9242
|
|
|
9103
9243
|
this.onResize = ( rect ) => {
|
|
9104
|
-
const realNameWidth = ( this.root.domName?.
|
|
9105
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
9244
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
9245
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
9106
9246
|
};
|
|
9107
9247
|
|
|
9108
9248
|
const container = document.createElement('div');
|
|
@@ -9228,8 +9368,8 @@ class FileInput extends Widget {
|
|
|
9228
9368
|
let read = options.read ?? true;
|
|
9229
9369
|
|
|
9230
9370
|
this.onResize = ( rect ) => {
|
|
9231
|
-
const realNameWidth = ( this.root.domName?.
|
|
9232
|
-
input.style.width = `calc( 100% - ${ realNameWidth }
|
|
9371
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
9372
|
+
input.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
9233
9373
|
};
|
|
9234
9374
|
|
|
9235
9375
|
// Create hidden input
|
|
@@ -9555,8 +9695,8 @@ class Table extends Widget {
|
|
|
9555
9695
|
super( Widget.TABLE, name, null, options );
|
|
9556
9696
|
|
|
9557
9697
|
this.onResize = ( rect ) => {
|
|
9558
|
-
const realNameWidth = ( this.root.domName?.
|
|
9559
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
9698
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
9699
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
9560
9700
|
};
|
|
9561
9701
|
|
|
9562
9702
|
const container = document.createElement('div');
|
|
@@ -9615,7 +9755,7 @@ class Table extends Widget {
|
|
|
9615
9755
|
|
|
9616
9756
|
if( this.customFilters )
|
|
9617
9757
|
{
|
|
9618
|
-
const icon = LX.makeIcon( "circle-plus",
|
|
9758
|
+
const icon = LX.makeIcon( "circle-plus", { svgClass: "sm" } );
|
|
9619
9759
|
|
|
9620
9760
|
for( let f of this.customFilters )
|
|
9621
9761
|
{
|
|
@@ -9640,7 +9780,6 @@ class Table extends Widget {
|
|
|
9640
9780
|
headerContainer.appendChild( customFilterBtn.root );
|
|
9641
9781
|
}
|
|
9642
9782
|
|
|
9643
|
-
// const resetIcon = LX.makeIcon( "xmark", null, "sm" );
|
|
9644
9783
|
this._resetCustomFiltersBtn = new Button(null, "resetButton", ( v ) => {
|
|
9645
9784
|
this.activeCustomFilters = {};
|
|
9646
9785
|
this.refresh();
|
|
@@ -9652,7 +9791,7 @@ class Table extends Widget {
|
|
|
9652
9791
|
|
|
9653
9792
|
if( this.toggleColumns )
|
|
9654
9793
|
{
|
|
9655
|
-
const icon = LX.makeIcon( "sliders" );
|
|
9794
|
+
const icon = LX.makeIcon( "sliders-large" );
|
|
9656
9795
|
const toggleColumnsBtn = new Button( "toggleColumnsBtn", icon.innerHTML + "View", (value, e) => {
|
|
9657
9796
|
const menuOptions = data.head.map( ( colName, idx ) => {
|
|
9658
9797
|
const item = {
|
|
@@ -9735,7 +9874,7 @@ class Table extends Widget {
|
|
|
9735
9874
|
{
|
|
9736
9875
|
const th = document.createElement( 'th' );
|
|
9737
9876
|
th.innerHTML = `<span>${ headData }</span>`;
|
|
9738
|
-
th.querySelector( "span" ).appendChild( LX.makeIcon( "menu-arrows",
|
|
9877
|
+
th.querySelector( "span" ).appendChild( LX.makeIcon( "menu-arrows", { svgClass: "sm" } ) );
|
|
9739
9878
|
|
|
9740
9879
|
const idx = data.head.indexOf( headData );
|
|
9741
9880
|
if( this.centered && this.centered.indexOf( idx ) > -1 )
|
|
@@ -9986,7 +10125,7 @@ class Table extends Widget {
|
|
|
9986
10125
|
|
|
9987
10126
|
if( action == "delete" )
|
|
9988
10127
|
{
|
|
9989
|
-
button = LX.makeIcon( "trash-can", "Delete Row" );
|
|
10128
|
+
button = LX.makeIcon( "trash-can", { title: "Delete Row" } );
|
|
9990
10129
|
button.addEventListener( 'click', function() {
|
|
9991
10130
|
// Don't need to refresh table..
|
|
9992
10131
|
data.body.splice( r, 1 );
|
|
@@ -9995,7 +10134,7 @@ class Table extends Widget {
|
|
|
9995
10134
|
}
|
|
9996
10135
|
else if( action == "menu" )
|
|
9997
10136
|
{
|
|
9998
|
-
button = LX.makeIcon( "more-horizontal", "Menu" );
|
|
10137
|
+
button = LX.makeIcon( "more-horizontal", { title: "Menu" } );
|
|
9999
10138
|
button.addEventListener( 'click', function( event ) {
|
|
10000
10139
|
if( !options.onMenuAction )
|
|
10001
10140
|
{
|
|
@@ -10011,7 +10150,7 @@ class Table extends Widget {
|
|
|
10011
10150
|
else // custom actions
|
|
10012
10151
|
{
|
|
10013
10152
|
console.assert( action.constructor == Object );
|
|
10014
|
-
button = LX.makeIcon( action.icon, action.title );
|
|
10153
|
+
button = LX.makeIcon( action.icon, { title: action.title } );
|
|
10015
10154
|
|
|
10016
10155
|
if( action.callback )
|
|
10017
10156
|
{
|
|
@@ -12308,12 +12447,6 @@ class CanvasCurve {
|
|
|
12308
12447
|
if( o.xrange ) element.xrange = o.xrange;
|
|
12309
12448
|
if( o.yrange ) element.yrange = o.yrange;
|
|
12310
12449
|
if( o.smooth ) element.smooth = o.smooth;
|
|
12311
|
-
var rect = canvas.parentElement.getBoundingClientRect();
|
|
12312
|
-
if( canvas.parentElement.parentElement ) rect = canvas.parentElement.parentElement.getBoundingClientRect();
|
|
12313
|
-
if( rect && canvas.width != rect.width && rect.width && rect.width < 1000 )
|
|
12314
|
-
{
|
|
12315
|
-
canvas.width = rect.width;
|
|
12316
|
-
}
|
|
12317
12450
|
|
|
12318
12451
|
var ctx = canvas.getContext( "2d" );
|
|
12319
12452
|
ctx.setTransform( 1, 0, 0, 1, 0, 0 );
|
|
@@ -12648,12 +12781,6 @@ class CanvasDial {
|
|
|
12648
12781
|
if( o.xrange ) element.xrange = o.xrange;
|
|
12649
12782
|
if( o.yrange ) element.yrange = o.yrange;
|
|
12650
12783
|
if( o.smooth ) element.smooth = o.smooth;
|
|
12651
|
-
var rect = canvas.parentElement.getBoundingClientRect();
|
|
12652
|
-
if( canvas.parentElement.parentElement ) rect = canvas.parentElement.parentElement.getBoundingClientRect();
|
|
12653
|
-
if( rect && canvas.width != rect.width && rect.width && rect.width < 1000 )
|
|
12654
|
-
{
|
|
12655
|
-
canvas.width = rect.width;
|
|
12656
|
-
}
|
|
12657
12784
|
|
|
12658
12785
|
var ctx = canvas.getContext( "2d" );
|
|
12659
12786
|
ctx.setTransform( 1, 0, 0, 1, 0, 0 );
|