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.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.5.
|
|
15
|
+
version: "0.5.8",
|
|
16
16
|
ready: false,
|
|
17
17
|
components: [], // Specific pre-build components
|
|
18
18
|
signals: {}, // Events and triggers
|
|
@@ -134,6 +134,56 @@ function stripHTML( html )
|
|
|
134
134
|
|
|
135
135
|
LX.stripHTML = stripHTML;
|
|
136
136
|
|
|
137
|
+
/**
|
|
138
|
+
* @method parsePixelSize
|
|
139
|
+
* @description Parses any css size and returns a number of pixels
|
|
140
|
+
* @param {Number|String} size
|
|
141
|
+
* @param {Number} total
|
|
142
|
+
*/
|
|
143
|
+
const parsePixelSize = ( size, total ) => {
|
|
144
|
+
|
|
145
|
+
if( size.constructor === Number ) { return size; } // Assuming pixels..
|
|
146
|
+
|
|
147
|
+
if( size.constructor === String )
|
|
148
|
+
{
|
|
149
|
+
const value = parseFloat( size );
|
|
150
|
+
|
|
151
|
+
if( size.endsWith( "px" ) ) { return value; } // String pixels
|
|
152
|
+
if( size.endsWith( '%' ) ) { return ( value / 100 ) * total; } // Percentage
|
|
153
|
+
if( size.endsWith( "rem" ) || size.endsWith( "em" ) ) { const rootFontSize = 16; /*parseFloat(getComputedStyle(document.documentElement).fontSize);*/ return value * rootFontSize; } // rem unit: assume 16px = 1rem
|
|
154
|
+
if( size.endsWith( "vw" ) ) { return ( value / 100 ) * window.innerWidth; } // wViewport units
|
|
155
|
+
if( size.endsWith( "vh" ) ) { return ( value / 100 ) * window.innerHeight; } // hViewport units
|
|
156
|
+
|
|
157
|
+
// Any CSS calc expression (e.g., "calc(30% - 4px)")
|
|
158
|
+
if( size.startsWith( "calc(" ) )
|
|
159
|
+
{
|
|
160
|
+
const expr = size.slice( 5, -1 );
|
|
161
|
+
const parts = expr.split( /([+\-])/ ); // ["30% ", "-", "4px"]
|
|
162
|
+
let result = 0;
|
|
163
|
+
let op = "+";
|
|
164
|
+
for( let part of parts )
|
|
165
|
+
{
|
|
166
|
+
part = part.trim();
|
|
167
|
+
if( part === "+" || part === "-" )
|
|
168
|
+
{
|
|
169
|
+
op = part;
|
|
170
|
+
}
|
|
171
|
+
else
|
|
172
|
+
{
|
|
173
|
+
let value = parsePixelSize( part, total );
|
|
174
|
+
result = ( op === "+" ) ? result + value : result - value;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return result;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
throw( "Bad size format!" );
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
LX.parsePixelSize = parsePixelSize;
|
|
186
|
+
|
|
137
187
|
/**
|
|
138
188
|
* @method deepCopy
|
|
139
189
|
* @description Create a deep copy with no references from an object
|
|
@@ -728,14 +778,20 @@ LX.makeKbd = makeKbd;
|
|
|
728
778
|
* @method makeIcon
|
|
729
779
|
* @description Gets an SVG element using one of LX.ICONS
|
|
730
780
|
* @param {String} iconName
|
|
731
|
-
* @param {
|
|
732
|
-
*
|
|
781
|
+
* @param {Object} options
|
|
782
|
+
* iconTitle
|
|
783
|
+
* extraClass
|
|
784
|
+
* svgClass
|
|
733
785
|
*/
|
|
734
|
-
function makeIcon( iconName,
|
|
786
|
+
function makeIcon( iconName, options = { } )
|
|
735
787
|
{
|
|
736
788
|
let data = LX.ICONS[ iconName ];
|
|
737
789
|
console.assert( data, `No icon named _${ iconName }_` );
|
|
738
790
|
|
|
791
|
+
const iconTitle = options.iconTitle;
|
|
792
|
+
const iconClass = options.iconClass;
|
|
793
|
+
const svgClass = options.svgClass;
|
|
794
|
+
|
|
739
795
|
// Just another name for the same icon..
|
|
740
796
|
if( data.constructor == String )
|
|
741
797
|
{
|
|
@@ -745,9 +801,9 @@ function makeIcon( iconName, iconTitle, extraClass = "" )
|
|
|
745
801
|
const svg = document.createElementNS( "http://www.w3.org/2000/svg", "svg" );
|
|
746
802
|
svg.setAttribute( "viewBox", `0 0 ${ data[ 0 ] } ${ data[ 1 ] }` );
|
|
747
803
|
|
|
748
|
-
if(
|
|
804
|
+
if( svgClass )
|
|
749
805
|
{
|
|
750
|
-
svg.classList.add(
|
|
806
|
+
svg.classList.add( svgClass );
|
|
751
807
|
}
|
|
752
808
|
|
|
753
809
|
if( data[ 5 ] )
|
|
@@ -775,7 +831,7 @@ function makeIcon( iconName, iconTitle, extraClass = "" )
|
|
|
775
831
|
|
|
776
832
|
const icon = document.createElement( "a" );
|
|
777
833
|
icon.title = iconTitle ?? "";
|
|
778
|
-
icon.className = "lexicon " +
|
|
834
|
+
icon.className = "lexicon " + ( iconClass ?? "" );
|
|
779
835
|
icon.appendChild( svg );
|
|
780
836
|
|
|
781
837
|
return icon;
|
|
@@ -1374,6 +1430,19 @@ function init( options = { } )
|
|
|
1374
1430
|
|
|
1375
1431
|
LX.init = init;
|
|
1376
1432
|
|
|
1433
|
+
/**
|
|
1434
|
+
* @method setStrictViewport
|
|
1435
|
+
* @param {Boolean} value
|
|
1436
|
+
*/
|
|
1437
|
+
|
|
1438
|
+
function setStrictViewport( value )
|
|
1439
|
+
{
|
|
1440
|
+
this.usingStrictViewport = value ?? true;
|
|
1441
|
+
document.documentElement.setAttribute( "data-strictVP", ( this.usingStrictViewport ) ? "true" : "false" );
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
LX.setStrictViewport = setStrictViewport;
|
|
1445
|
+
|
|
1377
1446
|
/**
|
|
1378
1447
|
* @method setCommandbarState
|
|
1379
1448
|
* @param {Boolean} value
|
|
@@ -2238,6 +2307,8 @@ class ColorPicker {
|
|
|
2238
2307
|
|
|
2239
2308
|
doAsync( this._svToPosition.bind( this, this.currentColor.hsv.s, this.currentColor.hsv.v ) );
|
|
2240
2309
|
|
|
2310
|
+
let pickerRect = null;
|
|
2311
|
+
|
|
2241
2312
|
let innerMouseDown = e => {
|
|
2242
2313
|
var doc = this.root.ownerDocument;
|
|
2243
2314
|
doc.addEventListener( 'mousemove', innerMouseMove );
|
|
@@ -2252,15 +2323,15 @@ class ColorPicker {
|
|
|
2252
2323
|
this.intSatMarker.style.top = currentTop + "px";
|
|
2253
2324
|
this._positionToSv( currentLeft, currentTop );
|
|
2254
2325
|
this._updateColorValue();
|
|
2326
|
+
|
|
2327
|
+
pickerRect = this.colorPickerBackground.getBoundingClientRect();
|
|
2255
2328
|
}
|
|
2256
2329
|
|
|
2257
2330
|
let innerMouseMove = e => {
|
|
2258
2331
|
const dX = e.movementX;
|
|
2259
2332
|
const dY = e.movementY;
|
|
2260
|
-
|
|
2261
|
-
const
|
|
2262
|
-
const mouseX = e.offsetX - rect.x;
|
|
2263
|
-
const mouseY = e.offsetY - rect.y;
|
|
2333
|
+
const mouseX = e.x - pickerRect.x;
|
|
2334
|
+
const mouseY = e.y - pickerRect.y;
|
|
2264
2335
|
|
|
2265
2336
|
if ( dX != 0 && ( mouseX >= 0 || dX < 0 ) && ( mouseX < this.colorPickerBackground.offsetWidth || dX > 0 ) )
|
|
2266
2337
|
{
|
|
@@ -2330,6 +2401,8 @@ class ColorPicker {
|
|
|
2330
2401
|
this._updateColorValue();
|
|
2331
2402
|
};
|
|
2332
2403
|
|
|
2404
|
+
let hueTrackerRect = null;
|
|
2405
|
+
|
|
2333
2406
|
let innerMouseDownHue = e => {
|
|
2334
2407
|
const doc = this.root.ownerDocument;
|
|
2335
2408
|
doc.addEventListener( 'mousemove', innerMouseMoveHue );
|
|
@@ -2340,15 +2413,15 @@ class ColorPicker {
|
|
|
2340
2413
|
|
|
2341
2414
|
const hueX = clamp( e.offsetX - this.markerHalfSize, 0, this.colorPickerTracker.offsetWidth - this.markerSize );
|
|
2342
2415
|
_fromHueX( hueX );
|
|
2416
|
+
|
|
2417
|
+
hueTrackerRect = this.colorPickerTracker.getBoundingClientRect();
|
|
2343
2418
|
}
|
|
2344
2419
|
|
|
2345
2420
|
let innerMouseMoveHue = e => {
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
const rect = this.colorPickerTracker.getBoundingClientRect();
|
|
2349
|
-
const mouseX = e.offsetX - rect.x;
|
|
2421
|
+
const dX = e.movementX;
|
|
2422
|
+
const mouseX = e.x - hueTrackerRect.x;
|
|
2350
2423
|
|
|
2351
|
-
if ( dX != 0 && ( mouseX >=
|
|
2424
|
+
if ( dX != 0 && ( mouseX >= this.markerHalfSize || dX < 0 ) && ( mouseX < ( this.colorPickerTracker.offsetWidth - this.markerHalfSize ) || dX > 0 ) )
|
|
2352
2425
|
{
|
|
2353
2426
|
const hueX = LX.clamp( parseInt( this.hueMarker.style.left ) + dX, 0, this.colorPickerTracker.offsetWidth - this.markerSize );
|
|
2354
2427
|
_fromHueX( hueX )
|
|
@@ -2393,6 +2466,8 @@ class ColorPicker {
|
|
|
2393
2466
|
this.alphaMarker.style.backgroundColor = `rgb(${ this.currentColor.css.r }, ${ this.currentColor.css.g }, ${ this.currentColor.css.b },${ this.currentColor.css.a })`;
|
|
2394
2467
|
};
|
|
2395
2468
|
|
|
2469
|
+
let alphaTrackerRect = null;
|
|
2470
|
+
|
|
2396
2471
|
let innerMouseDownAlpha = e => {
|
|
2397
2472
|
const doc = this.root.ownerDocument;
|
|
2398
2473
|
doc.addEventListener( 'mousemove', innerMouseMoveAlpha );
|
|
@@ -2402,15 +2477,14 @@ class ColorPicker {
|
|
|
2402
2477
|
e.stopPropagation();
|
|
2403
2478
|
const alphaX = clamp( e.offsetX - this.markerHalfSize, 0, this.alphaTracker.offsetWidth - this.markerSize );
|
|
2404
2479
|
_fromAlphaX( alphaX );
|
|
2480
|
+
alphaTrackerRect = this.alphaTracker.getBoundingClientRect();
|
|
2405
2481
|
}
|
|
2406
2482
|
|
|
2407
2483
|
let innerMouseMoveAlpha = e => {
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
const rect = this.alphaTracker.getBoundingClientRect();
|
|
2411
|
-
const mouseX = e.offsetX - rect.x;
|
|
2484
|
+
const dX = e.movementX;
|
|
2485
|
+
const mouseX = e.x - alphaTrackerRect.x;
|
|
2412
2486
|
|
|
2413
|
-
if ( dX != 0 && ( mouseX >=
|
|
2487
|
+
if ( dX != 0 && ( mouseX >= this.markerHalfSize || dX < 0 ) && ( mouseX < ( this.alphaTracker.offsetWidth - this.markerHalfSize ) || dX > 0 ) )
|
|
2414
2488
|
{
|
|
2415
2489
|
const alphaX = LX.clamp( parseInt( this.alphaMarker.style.left ) + dX, 0, this.alphaTracker.offsetWidth - this.markerSize );
|
|
2416
2490
|
_fromAlphaX( alphaX );
|
|
@@ -2441,9 +2515,23 @@ class ColorPicker {
|
|
|
2441
2515
|
this.labelWidget = new TextInput( null, "", null, { inputClass: "bg-none", fit: true, disabled: true } );
|
|
2442
2516
|
colorLabel.appendChild( this.labelWidget.root );
|
|
2443
2517
|
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2518
|
+
// Copy button
|
|
2519
|
+
{
|
|
2520
|
+
const copyButtonWidget = new Button(null, "copy", async () => {
|
|
2521
|
+
navigator.clipboard.writeText( this.labelWidget.value() );
|
|
2522
|
+
copyButtonWidget.root.querySelector( "input[type='checkbox']" ).style.pointerEvents = "none";
|
|
2523
|
+
|
|
2524
|
+
doAsync( () => {
|
|
2525
|
+
copyButtonWidget.root.swap( true );
|
|
2526
|
+
copyButtonWidget.root.querySelector( "input[type='checkbox']" ).style.pointerEvents = "auto";
|
|
2527
|
+
}, 3000 );
|
|
2528
|
+
|
|
2529
|
+
}, { swap: "check", icon: "copy", buttonClass: "bg-none", className: "ml-auto", title: "Copy" })
|
|
2530
|
+
|
|
2531
|
+
copyButtonWidget.root.querySelector( ".swap-on svg path" ).style.fill = "#42d065";
|
|
2532
|
+
|
|
2533
|
+
colorLabel.appendChild( copyButtonWidget.root );
|
|
2534
|
+
}
|
|
2447
2535
|
|
|
2448
2536
|
this._updateColorValue( hexValue, true );
|
|
2449
2537
|
|
|
@@ -2517,7 +2605,7 @@ class ColorPicker {
|
|
|
2517
2605
|
|
|
2518
2606
|
if( this.useAlpha )
|
|
2519
2607
|
{
|
|
2520
|
-
this.alphaTracker.style.color = `rgb(${ this.currentColor.css.r }, ${ this.currentColor.css.g }, ${ this.currentColor.css.b }
|
|
2608
|
+
this.alphaTracker.style.color = `rgb(${ this.currentColor.css.r }, ${ this.currentColor.css.g }, ${ this.currentColor.css.b })`;
|
|
2521
2609
|
}
|
|
2522
2610
|
|
|
2523
2611
|
const toFixed = ( s, n = 2) => { return s.toFixed( n ).replace( /([0-9]+(\.[0-9]+[1-9])?)(\.?0+$)/, '$1' ) };
|
|
@@ -2525,7 +2613,7 @@ class ColorPicker {
|
|
|
2525
2613
|
if( this.colorModel == "CSS" )
|
|
2526
2614
|
{
|
|
2527
2615
|
const { r, g, b, a } = this.currentColor.css;
|
|
2528
|
-
this.labelWidget.set( `
|
|
2616
|
+
this.labelWidget.set( `rgb${ this.useAlpha ? 'a' : '' }(${ r },${ g },${ b }${ this.useAlpha ? ',' + toFixed( a ) : '' })` );
|
|
2529
2617
|
}
|
|
2530
2618
|
else if( this.colorModel == "Hex" )
|
|
2531
2619
|
{
|
|
@@ -2834,7 +2922,7 @@ class Area {
|
|
|
2834
2922
|
* @method split
|
|
2835
2923
|
* @param {Object} options
|
|
2836
2924
|
* type: Split mode (horizontal, vertical) ["horizontal"]
|
|
2837
|
-
* sizes: Size of each new area (Array) ["50%", "50%"]
|
|
2925
|
+
* sizes: CSS Size of each new area (Array) ["50%", "50%"]
|
|
2838
2926
|
* resize: Allow area manual resizing [true]
|
|
2839
2927
|
* sizes: "Allow the area to be minimized [false]
|
|
2840
2928
|
*/
|
|
@@ -2849,11 +2937,12 @@ class Area {
|
|
|
2849
2937
|
this.root = this.sections[ 1 ].root;
|
|
2850
2938
|
}
|
|
2851
2939
|
|
|
2852
|
-
const type = options.type
|
|
2940
|
+
const type = options.type ?? "horizontal";
|
|
2853
2941
|
const sizes = options.sizes || [ "50%", "50%" ];
|
|
2854
2942
|
const auto = (options.sizes === 'auto') || ( options.sizes && options.sizes[ 0 ] == "auto" && options.sizes[ 1 ] == "auto" );
|
|
2855
2943
|
|
|
2856
|
-
|
|
2944
|
+
// Secondary area fills space
|
|
2945
|
+
if( !sizes[ 1 ] || ( sizes[ 0 ] != "auto" && sizes[ 1 ] == "auto" ) )
|
|
2857
2946
|
{
|
|
2858
2947
|
let size = sizes[ 0 ];
|
|
2859
2948
|
let margin = options.top ? options.top : 0;
|
|
@@ -2866,17 +2955,13 @@ class Area {
|
|
|
2866
2955
|
sizes[ 1 ] = "calc( 100% - " + size + " )";
|
|
2867
2956
|
}
|
|
2868
2957
|
|
|
2869
|
-
// Create areas
|
|
2870
|
-
let area1 = new Area( { skipAppend: true, className: "split" + ( options.menubar || options.sidebar ? "" : " origin" ) } );
|
|
2871
|
-
let area2 = new Area( { skipAppend: true, className: "split" } );
|
|
2872
|
-
|
|
2873
|
-
area1.parentArea = this;
|
|
2874
|
-
area2.parentArea = this;
|
|
2875
|
-
|
|
2876
2958
|
let minimizable = options.minimizable ?? false;
|
|
2877
2959
|
let resize = ( options.resize ?? true ) || minimizable;
|
|
2960
|
+
let fixedSize = options.fixedSize ?? !resize;
|
|
2961
|
+
let splitbarOffset = 0;
|
|
2962
|
+
let primarySize = [];
|
|
2963
|
+
let secondarySize = [];
|
|
2878
2964
|
|
|
2879
|
-
let data = "0px";
|
|
2880
2965
|
this.offset = 0;
|
|
2881
2966
|
|
|
2882
2967
|
if( resize )
|
|
@@ -2896,93 +2981,104 @@ class Area {
|
|
|
2896
2981
|
|
|
2897
2982
|
this.splitBar.addEventListener( 'mousedown', innerMouseDown );
|
|
2898
2983
|
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
// Being minimizable means it's also resizeable!
|
|
2902
|
-
if( minimizable )
|
|
2903
|
-
{
|
|
2904
|
-
this.splitExtended = false;
|
|
2905
|
-
|
|
2906
|
-
// Keep state of the animation when ends...
|
|
2907
|
-
area2.root.addEventListener('animationend', e => {
|
|
2908
|
-
const opacity = getComputedStyle( area2.root ).opacity;
|
|
2909
|
-
area2.root.classList.remove( e.animationName + "-" + type );
|
|
2910
|
-
area2.root.style.opacity = opacity;
|
|
2911
|
-
flushCss(area2.root);
|
|
2912
|
-
});
|
|
2913
|
-
|
|
2914
|
-
this.splitBar.addEventListener("contextmenu", e => {
|
|
2915
|
-
e.preventDefault();
|
|
2916
|
-
addContextMenu(null, e, c => {
|
|
2917
|
-
c.add("Extend", { disabled: this.splitExtended, callback: () => { this.extend() } });
|
|
2918
|
-
c.add("Reduce", { disabled: !this.splitExtended, callback: () => { this.reduce() } });
|
|
2919
|
-
});
|
|
2920
|
-
});
|
|
2921
|
-
}
|
|
2984
|
+
splitbarOffset = ( LX.DEFAULT_SPLITBAR_SIZE / 2 ); // updates
|
|
2922
2985
|
}
|
|
2923
2986
|
|
|
2924
2987
|
if( type == "horizontal" )
|
|
2925
2988
|
{
|
|
2926
|
-
|
|
2927
|
-
width2 = sizes[ 1 ];
|
|
2989
|
+
this.root.style.display = "flex";
|
|
2928
2990
|
|
|
2929
|
-
if(
|
|
2991
|
+
if( !fixedSize )
|
|
2930
2992
|
{
|
|
2931
|
-
|
|
2932
|
-
|
|
2993
|
+
const parentWidth = this.root.offsetWidth;
|
|
2994
|
+
const leftPx = parsePixelSize( sizes[ 0 ], parentWidth );
|
|
2995
|
+
const rightPx = parsePixelSize( sizes[ 1 ], parentWidth );
|
|
2996
|
+
const leftPercent = ( leftPx / parentWidth ) * 100;
|
|
2997
|
+
const rightPercent = ( rightPx / parentWidth ) * 100;
|
|
2933
2998
|
|
|
2934
|
-
|
|
2999
|
+
// Style using percentages
|
|
3000
|
+
primarySize[ 0 ] = `calc(${ leftPercent }% - ${ splitbarOffset }px)`;
|
|
3001
|
+
secondarySize[ 0 ] = `calc(${ rightPercent }% - ${ splitbarOffset }px)`;
|
|
3002
|
+
}
|
|
3003
|
+
else
|
|
2935
3004
|
{
|
|
2936
|
-
|
|
3005
|
+
primarySize[ 0 ] = `calc(${ sizes[ 0 ] } - ${ splitbarOffset }px)`;
|
|
3006
|
+
secondarySize[ 0 ] = `calc(${ sizes[ 1 ] } - ${ splitbarOffset }px)`;
|
|
2937
3007
|
}
|
|
2938
3008
|
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
area2.root.style.width = "calc( " + width2 + " - " + data + " )";
|
|
2942
|
-
area2.root.style.height = "calc(100% - 0px)";
|
|
2943
|
-
this.root.style.display = "flex";
|
|
3009
|
+
primarySize[ 1 ] = "100%";
|
|
3010
|
+
secondarySize[ 1 ] = "100%";
|
|
2944
3011
|
}
|
|
2945
3012
|
else // vertical
|
|
2946
3013
|
{
|
|
2947
|
-
area1.root.style.width = "100%";
|
|
2948
|
-
area2.root.style.width = "100%";
|
|
2949
|
-
|
|
2950
3014
|
if( auto )
|
|
2951
3015
|
{
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
});
|
|
3016
|
+
primarySize[ 1 ] = "auto";
|
|
3017
|
+
}
|
|
3018
|
+
else if( !fixedSize )
|
|
3019
|
+
{
|
|
3020
|
+
const parentHeight = this.root.offsetHeight;
|
|
3021
|
+
const topPx = parsePixelSize( sizes[ 0 ], parentHeight );
|
|
3022
|
+
const bottomPx = parsePixelSize( sizes[ 1 ], parentHeight );
|
|
3023
|
+
const topPercent = ( topPx / parentHeight ) * 100;
|
|
3024
|
+
const bottomPercent = ( bottomPx / parentHeight ) * 100;
|
|
2962
3025
|
|
|
2963
|
-
|
|
3026
|
+
primarySize[ 1 ] = ( sizes[ 0 ] == "auto" ? "auto" : `calc(${ topPercent }% - ${ splitbarOffset }px)`);
|
|
3027
|
+
secondarySize[ 1 ] = ( sizes[ 1 ] == "auto" ? "auto" : `calc(${ bottomPercent }% - ${ splitbarOffset }px)`);
|
|
2964
3028
|
}
|
|
2965
3029
|
else
|
|
2966
3030
|
{
|
|
2967
|
-
|
|
2968
|
-
|
|
3031
|
+
primarySize[ 1 ] = ( sizes[ 0 ] == "auto" ? "auto" : `calc(${ sizes[ 0 ] } - ${ splitbarOffset }px)`);
|
|
3032
|
+
secondarySize[ 1 ] = ( sizes[ 1 ] == "auto" ? "auto" : `calc(${ sizes[ 1 ] } - ${ splitbarOffset }px)`);
|
|
3033
|
+
}
|
|
2969
3034
|
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
3035
|
+
primarySize[ 0 ] = "100%";
|
|
3036
|
+
secondarySize[ 0 ] = "100%";
|
|
3037
|
+
}
|
|
3038
|
+
|
|
3039
|
+
// Create areas
|
|
3040
|
+
let area1 = new Area( { width: primarySize[ 0 ], height: primarySize[ 1 ], skipAppend: true, className: "split" + ( options.menubar || options.sidebar ? "" : " origin" ) } );
|
|
3041
|
+
let area2 = new Area( { width: secondarySize[ 0 ], height: secondarySize[ 1 ], skipAppend: true, className: "split" } );
|
|
2974
3042
|
|
|
2975
|
-
|
|
3043
|
+
if( auto && type == "vertical" )
|
|
3044
|
+
{
|
|
3045
|
+
// Listen resize event on first area
|
|
3046
|
+
const resizeObserver = new ResizeObserver( entries => {
|
|
3047
|
+
for ( const entry of entries )
|
|
2976
3048
|
{
|
|
2977
|
-
|
|
3049
|
+
const size = entry.target.getComputedSize();
|
|
3050
|
+
area2.root.style.height = "calc(100% - " + ( size.height ) + "px )";
|
|
2978
3051
|
}
|
|
3052
|
+
});
|
|
2979
3053
|
|
|
2980
|
-
|
|
2981
|
-
area1.root.style.height = ( height1 == "auto" ? height1 : "calc( " + height1 + " - " + data + " )");
|
|
2982
|
-
area2.root.style.height = ( height2 == "auto" ? height2 : "calc( " + height2 + " - " + data + " )");
|
|
2983
|
-
}
|
|
3054
|
+
resizeObserver.observe( area1.root );
|
|
2984
3055
|
}
|
|
2985
3056
|
|
|
3057
|
+
// Being minimizable means it's also resizeable!
|
|
3058
|
+
if( resize && minimizable )
|
|
3059
|
+
{
|
|
3060
|
+
this.splitExtended = false;
|
|
3061
|
+
|
|
3062
|
+
// Keep state of the animation when ends...
|
|
3063
|
+
area2.root.addEventListener('animationend', e => {
|
|
3064
|
+
const opacity = getComputedStyle( area2.root ).opacity;
|
|
3065
|
+
area2.root.classList.remove( e.animationName + "-" + type );
|
|
3066
|
+
area2.root.style.opacity = opacity;
|
|
3067
|
+
flushCss( area2.root );
|
|
3068
|
+
});
|
|
3069
|
+
|
|
3070
|
+
this.splitBar.addEventListener("contextmenu", e => {
|
|
3071
|
+
e.preventDefault();
|
|
3072
|
+
addContextMenu(null, e, c => {
|
|
3073
|
+
c.add("Extend", { disabled: this.splitExtended, callback: () => { this.extend() } });
|
|
3074
|
+
c.add("Reduce", { disabled: !this.splitExtended, callback: () => { this.reduce() } });
|
|
3075
|
+
});
|
|
3076
|
+
});
|
|
3077
|
+
}
|
|
3078
|
+
|
|
3079
|
+
area1.parentArea = this;
|
|
3080
|
+
area2.parentArea = this;
|
|
3081
|
+
|
|
2986
3082
|
this.root.appendChild( area1.root );
|
|
2987
3083
|
|
|
2988
3084
|
if( resize )
|
|
@@ -2991,6 +3087,7 @@ class Area {
|
|
|
2991
3087
|
}
|
|
2992
3088
|
|
|
2993
3089
|
this.root.appendChild( area2.root );
|
|
3090
|
+
|
|
2994
3091
|
this.sections = [ area1, area2 ];
|
|
2995
3092
|
this.type = type;
|
|
2996
3093
|
|
|
@@ -3104,10 +3201,10 @@ class Area {
|
|
|
3104
3201
|
return;
|
|
3105
3202
|
}
|
|
3106
3203
|
|
|
3107
|
-
let [area1, area2] = this.sections;
|
|
3204
|
+
let [ area1, area2 ] = this.sections;
|
|
3108
3205
|
this.splitExtended = true;
|
|
3109
3206
|
|
|
3110
|
-
if( this.type == "vertical")
|
|
3207
|
+
if( this.type == "vertical" )
|
|
3111
3208
|
{
|
|
3112
3209
|
this.offset = area2.root.offsetHeight;
|
|
3113
3210
|
area2.root.classList.add("fadeout-vertical");
|
|
@@ -3118,7 +3215,7 @@ class Area {
|
|
|
3118
3215
|
{
|
|
3119
3216
|
this.offset = area2.root.offsetWidth - 8; // Force some height here...
|
|
3120
3217
|
area2.root.classList.add("fadeout-horizontal");
|
|
3121
|
-
this._moveSplit(-Infinity, true, 8);
|
|
3218
|
+
this._moveSplit( -Infinity, true, 8 );
|
|
3122
3219
|
}
|
|
3123
3220
|
|
|
3124
3221
|
doAsync( () => this.propagateEvent('onresize'), 150 );
|
|
@@ -3225,8 +3322,7 @@ class Area {
|
|
|
3225
3322
|
|
|
3226
3323
|
LX.menubars.push( menubar );
|
|
3227
3324
|
|
|
3228
|
-
const
|
|
3229
|
-
const [ bar, content ] = this.split({ type: 'vertical', sizes: [height, null], resize: false, menubar: true });
|
|
3325
|
+
const [ bar, content ] = this.split({ type: 'vertical', sizes: ["48px", null], resize: false, menubar: true });
|
|
3230
3326
|
menubar.siblingArea = content;
|
|
3231
3327
|
|
|
3232
3328
|
bar.attach( menubar );
|
|
@@ -3343,7 +3439,8 @@ class Area {
|
|
|
3343
3439
|
img: b.img,
|
|
3344
3440
|
className: b.class ?? "",
|
|
3345
3441
|
title: b.name,
|
|
3346
|
-
overflowContainerX: overlayPanel.root
|
|
3442
|
+
overflowContainerX: overlayPanel.root,
|
|
3443
|
+
swap: b.swap
|
|
3347
3444
|
};
|
|
3348
3445
|
|
|
3349
3446
|
if( group )
|
|
@@ -3480,7 +3577,7 @@ class Area {
|
|
|
3480
3577
|
|
|
3481
3578
|
const a2 = this.sections[ 1 ];
|
|
3482
3579
|
const a2Root = a2.root;
|
|
3483
|
-
const splitData = "
|
|
3580
|
+
const splitData = "- "+ LX.DEFAULT_SPLITBAR_SIZE + "px";
|
|
3484
3581
|
|
|
3485
3582
|
let transition = null;
|
|
3486
3583
|
if( !forceAnimation )
|
|
@@ -3488,30 +3585,47 @@ class Area {
|
|
|
3488
3585
|
// Remove transitions for this change..
|
|
3489
3586
|
transition = a1Root.style.transition;
|
|
3490
3587
|
a1Root.style.transition = a2Root.style.transition = "none";
|
|
3491
|
-
flushCss( a1Root );
|
|
3492
|
-
flushCss( a2Root );
|
|
3588
|
+
// flushCss( a1Root );
|
|
3493
3589
|
}
|
|
3494
3590
|
|
|
3495
3591
|
if( this.type == "horizontal" )
|
|
3496
3592
|
{
|
|
3497
3593
|
var size = Math.max( a2Root.offsetWidth + dt, parseInt( a2.minWidth ) );
|
|
3498
3594
|
if( forceWidth ) size = forceWidth;
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3595
|
+
|
|
3596
|
+
const parentWidth = this.size[ 0 ];
|
|
3597
|
+
const rightPercent = ( size / parentWidth ) * 100;
|
|
3598
|
+
const leftPercent = Math.max( 0, 100 - rightPercent );
|
|
3599
|
+
|
|
3600
|
+
a1Root.style.width = `-moz-calc(${ leftPercent }% ${ splitData })`;
|
|
3601
|
+
a1Root.style.width = `-webkit-calc( ${ leftPercent }% ${ splitData })`;
|
|
3602
|
+
a1Root.style.width = `calc( ${ leftPercent }% ${ splitData })`;
|
|
3603
|
+
a2Root.style.width = `${ rightPercent }%`;
|
|
3604
|
+
a2Root.style.width = `${ rightPercent }%`;
|
|
3605
|
+
a2Root.style.width = `${ rightPercent }%`;
|
|
3606
|
+
|
|
3607
|
+
if( a1.maxWidth != Infinity )
|
|
3608
|
+
{
|
|
3609
|
+
a2Root.style.minWidth = "calc( 100% - " + parseInt( a1.maxWidth ) + "px" + " )";
|
|
3610
|
+
}
|
|
3505
3611
|
}
|
|
3506
3612
|
else
|
|
3507
3613
|
{
|
|
3508
|
-
var size = Math.max((a2Root.offsetHeight + dt) + a2.offset, parseInt(a2.minHeight));
|
|
3614
|
+
var size = Math.max( ( a2Root.offsetHeight + dt ) + a2.offset, parseInt(a2.minHeight) );
|
|
3509
3615
|
if( forceWidth ) size = forceWidth;
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3616
|
+
|
|
3617
|
+
const parentHeight = this.size[ 1 ];
|
|
3618
|
+
const bottomPercent = ( size / parentHeight ) * 100;
|
|
3619
|
+
const topPercent = Math.max( 0, 100 - bottomPercent );
|
|
3620
|
+
|
|
3621
|
+
a1Root.style.height = `-moz-calc(${ topPercent }% ${ splitData })`;
|
|
3622
|
+
a1Root.style.height = `-webkit-calc( ${ topPercent }% ${ splitData })`;
|
|
3623
|
+
a1Root.style.height = `calc( ${ topPercent }% ${ splitData })`;
|
|
3624
|
+
a2Root.style.height = `${ bottomPercent }%`;
|
|
3625
|
+
a2Root.style.height = `${ bottomPercent }%`;
|
|
3626
|
+
a2Root.style.height = `${ bottomPercent }%`;
|
|
3627
|
+
|
|
3513
3628
|
a1Root.style.minHeight = a1.minHeight + "px";
|
|
3514
|
-
a2Root.style.height = ( size - a2.offset ) + "px";
|
|
3515
3629
|
}
|
|
3516
3630
|
|
|
3517
3631
|
if( !forceAnimation )
|
|
@@ -3520,10 +3634,10 @@ class Area {
|
|
|
3520
3634
|
a1Root.style.transition = a2Root.style.transition = transition;
|
|
3521
3635
|
}
|
|
3522
3636
|
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3637
|
+
doAsync( () => {
|
|
3638
|
+
this._update();
|
|
3639
|
+
this.propagateEvent( 'onresize' );
|
|
3640
|
+
}, 10 );
|
|
3527
3641
|
}
|
|
3528
3642
|
|
|
3529
3643
|
_disableSplitResize() {
|
|
@@ -4402,7 +4516,7 @@ class Menubar {
|
|
|
4402
4516
|
// Otherwise, create it
|
|
4403
4517
|
button = document.createElement('div');
|
|
4404
4518
|
const disabled = options.disabled ?? false;
|
|
4405
|
-
button.className = "lexmenubutton" + (disabled ? " disabled" : "");
|
|
4519
|
+
button.className = "lexmenubutton main" + (disabled ? " disabled" : "");
|
|
4406
4520
|
button.title = name;
|
|
4407
4521
|
button.innerHTML = "<a><image src='" + src + "' class='lexicon' style='height:32px;'></a>";
|
|
4408
4522
|
|
|
@@ -4566,7 +4680,7 @@ class SideBar {
|
|
|
4566
4680
|
|
|
4567
4681
|
if( this.collapsable )
|
|
4568
4682
|
{
|
|
4569
|
-
const icon = LX.makeIcon( "sidebar", "Toggle Sidebar", "toggler" );
|
|
4683
|
+
const icon = LX.makeIcon( "sidebar", { title: "Toggle Sidebar", iconClass: "toggler" } );
|
|
4570
4684
|
this.header.appendChild( icon );
|
|
4571
4685
|
|
|
4572
4686
|
icon.addEventListener( "click", (e) => {
|
|
@@ -5053,7 +5167,7 @@ class SideBar {
|
|
|
5053
5167
|
|
|
5054
5168
|
if( options.action )
|
|
5055
5169
|
{
|
|
5056
|
-
const actionIcon = LX.makeIcon( options.action.icon ?? "more-horizontal", options.action.name );
|
|
5170
|
+
const actionIcon = LX.makeIcon( options.action.icon ?? "more-horizontal", { title: options.action.name } );
|
|
5057
5171
|
itemDom.appendChild( actionIcon );
|
|
5058
5172
|
|
|
5059
5173
|
actionIcon.addEventListener( "click", (e) => {
|
|
@@ -5113,7 +5227,7 @@ class SideBar {
|
|
|
5113
5227
|
|
|
5114
5228
|
if( suboptions.action )
|
|
5115
5229
|
{
|
|
5116
|
-
const actionIcon = LX.makeIcon( suboptions.action.icon ?? "more-horizontal", suboptions.action.name );
|
|
5230
|
+
const actionIcon = LX.makeIcon( suboptions.action.icon ?? "more-horizontal", { title: suboptions.action.name } );
|
|
5117
5231
|
subentry.appendChild( actionIcon );
|
|
5118
5232
|
|
|
5119
5233
|
actionIcon.addEventListener( "click", (e) => {
|
|
@@ -5305,7 +5419,7 @@ class Widget {
|
|
|
5305
5419
|
|
|
5306
5420
|
_addResetProperty( container, callback ) {
|
|
5307
5421
|
|
|
5308
|
-
const domEl = LX.makeIcon( "rotate-left", "Reset" )
|
|
5422
|
+
const domEl = LX.makeIcon( "rotate-left", { title: "Reset" } )
|
|
5309
5423
|
domEl.style.display = "none";
|
|
5310
5424
|
domEl.style.marginRight = "6px";
|
|
5311
5425
|
domEl.style.marginLeft = "0";
|
|
@@ -6089,7 +6203,17 @@ class NodeTree {
|
|
|
6089
6203
|
|
|
6090
6204
|
this.data = newData ?? this.data;
|
|
6091
6205
|
this.domEl.querySelector( "ul" ).innerHTML = "";
|
|
6092
|
-
|
|
6206
|
+
if( this.data.constructor === Object )
|
|
6207
|
+
{
|
|
6208
|
+
this._createItem( null, this.data, 0, selectedId );
|
|
6209
|
+
}
|
|
6210
|
+
else
|
|
6211
|
+
{
|
|
6212
|
+
for( let d of this.data )
|
|
6213
|
+
{
|
|
6214
|
+
this._createItem( null, d, 0, selectedId );
|
|
6215
|
+
}
|
|
6216
|
+
}
|
|
6093
6217
|
}
|
|
6094
6218
|
|
|
6095
6219
|
/* Refreshes the tree and focuses current element */
|
|
@@ -6216,8 +6340,8 @@ class TextInput extends Widget {
|
|
|
6216
6340
|
};
|
|
6217
6341
|
|
|
6218
6342
|
this.onResize = ( rect ) => {
|
|
6219
|
-
const realNameWidth = ( this.root.domName?.
|
|
6220
|
-
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth }
|
|
6343
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
6344
|
+
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth })`;
|
|
6221
6345
|
};
|
|
6222
6346
|
|
|
6223
6347
|
this.valid = ( v ) => {
|
|
@@ -6355,8 +6479,8 @@ class TextArea extends Widget {
|
|
|
6355
6479
|
};
|
|
6356
6480
|
|
|
6357
6481
|
this.onResize = ( rect ) => {
|
|
6358
|
-
const realNameWidth = ( this.root.domName?.
|
|
6359
|
-
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth }
|
|
6482
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
6483
|
+
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth })`;
|
|
6360
6484
|
};
|
|
6361
6485
|
|
|
6362
6486
|
let container = document.createElement( "div" );
|
|
@@ -6449,8 +6573,8 @@ class Button extends Widget {
|
|
|
6449
6573
|
};
|
|
6450
6574
|
|
|
6451
6575
|
this.onResize = ( rect ) => {
|
|
6452
|
-
const realNameWidth = ( this.root.domName?.
|
|
6453
|
-
wValue.style.width = `calc( 100% - ${ realNameWidth }
|
|
6576
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
6577
|
+
wValue.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
6454
6578
|
};
|
|
6455
6579
|
|
|
6456
6580
|
var wValue = document.createElement( 'button' );
|
|
@@ -6512,10 +6636,20 @@ class Button extends Widget {
|
|
|
6512
6636
|
const input = document.createElement( "input" );
|
|
6513
6637
|
input.type = "checkbox";
|
|
6514
6638
|
wValue.prepend( input );
|
|
6515
|
-
// trigger = input;
|
|
6516
6639
|
|
|
6517
|
-
|
|
6518
|
-
|
|
6640
|
+
let swapIcon = null;
|
|
6641
|
+
|
|
6642
|
+
// @legacy
|
|
6643
|
+
if( options.swap.includes( "fa-" ) )
|
|
6644
|
+
{
|
|
6645
|
+
swapIcon = document.createElement( 'a' );
|
|
6646
|
+
swapIcon.className = options.swap + " swap-on lexicon";
|
|
6647
|
+
}
|
|
6648
|
+
else
|
|
6649
|
+
{
|
|
6650
|
+
swapIcon = LX.makeIcon( options.swap, { iconClass: "swap-on" } );
|
|
6651
|
+
}
|
|
6652
|
+
|
|
6519
6653
|
wValue.appendChild( swapIcon );
|
|
6520
6654
|
|
|
6521
6655
|
this.root.swap = function( skipCallback ) {
|
|
@@ -6702,8 +6836,8 @@ class ComboButtons extends Widget {
|
|
|
6702
6836
|
};
|
|
6703
6837
|
|
|
6704
6838
|
this.onResize = ( rect ) => {
|
|
6705
|
-
const realNameWidth = ( this.root.domName?.
|
|
6706
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
6839
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
6840
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
6707
6841
|
};
|
|
6708
6842
|
|
|
6709
6843
|
this.root.appendChild( container );
|
|
@@ -6919,8 +7053,8 @@ class Select extends Widget {
|
|
|
6919
7053
|
};
|
|
6920
7054
|
|
|
6921
7055
|
this.onResize = ( rect ) => {
|
|
6922
|
-
const realNameWidth = ( this.root.domName?.
|
|
6923
|
-
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth }
|
|
7056
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
7057
|
+
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth })`;
|
|
6924
7058
|
};
|
|
6925
7059
|
|
|
6926
7060
|
let container = document.createElement( "div" );
|
|
@@ -7267,11 +7401,8 @@ class Curve extends Widget {
|
|
|
7267
7401
|
};
|
|
7268
7402
|
|
|
7269
7403
|
this.onResize = ( rect ) => {
|
|
7270
|
-
const realNameWidth = ( this.root.domName?.
|
|
7271
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
7272
|
-
flushCss( container );
|
|
7273
|
-
curveInstance.canvas.width = container.offsetWidth;
|
|
7274
|
-
curveInstance.redraw();
|
|
7404
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
7405
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
7275
7406
|
};
|
|
7276
7407
|
|
|
7277
7408
|
var container = document.createElement( "div" );
|
|
@@ -7288,6 +7419,16 @@ class Curve extends Widget {
|
|
|
7288
7419
|
container.appendChild( curveInstance.element );
|
|
7289
7420
|
this.curveInstance = curveInstance;
|
|
7290
7421
|
|
|
7422
|
+
const observer = new ResizeObserver( entries => {
|
|
7423
|
+
for ( const entry of entries )
|
|
7424
|
+
{
|
|
7425
|
+
curveInstance.canvas.width = entry.contentRect.width;
|
|
7426
|
+
curveInstance.redraw();
|
|
7427
|
+
}
|
|
7428
|
+
});
|
|
7429
|
+
|
|
7430
|
+
observer.observe( container );
|
|
7431
|
+
|
|
7291
7432
|
doAsync( this.onResize.bind( this ) );
|
|
7292
7433
|
}
|
|
7293
7434
|
}
|
|
@@ -7321,8 +7462,8 @@ class Dial extends Widget {
|
|
|
7321
7462
|
};
|
|
7322
7463
|
|
|
7323
7464
|
this.onResize = ( rect ) => {
|
|
7324
|
-
const realNameWidth = ( this.root.domName?.
|
|
7325
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
7465
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
7466
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
7326
7467
|
flushCss( container );
|
|
7327
7468
|
dialInstance.element.style.height = dialInstance.element.offsetWidth + "px";
|
|
7328
7469
|
dialInstance.canvas.width = dialInstance.element.offsetWidth;
|
|
@@ -7376,8 +7517,8 @@ class Layers extends Widget {
|
|
|
7376
7517
|
};
|
|
7377
7518
|
|
|
7378
7519
|
this.onResize = ( rect ) => {
|
|
7379
|
-
const realNameWidth = ( this.root.domName?.
|
|
7380
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
7520
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
7521
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
7381
7522
|
};
|
|
7382
7523
|
|
|
7383
7524
|
var container = document.createElement( "div" );
|
|
@@ -7601,8 +7742,8 @@ class List extends Widget {
|
|
|
7601
7742
|
};
|
|
7602
7743
|
|
|
7603
7744
|
this.onResize = ( rect ) => {
|
|
7604
|
-
const realNameWidth = ( this.root.domName?.
|
|
7605
|
-
listContainer.style.width = `calc( 100% - ${ realNameWidth }
|
|
7745
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
7746
|
+
listContainer.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
7606
7747
|
};
|
|
7607
7748
|
|
|
7608
7749
|
this._updateValues = ( newValues ) => {
|
|
@@ -7678,8 +7819,8 @@ class Tags extends Widget {
|
|
|
7678
7819
|
};
|
|
7679
7820
|
|
|
7680
7821
|
this.onResize = ( rect ) => {
|
|
7681
|
-
const realNameWidth = ( this.root.domName?.
|
|
7682
|
-
tagsContainer.style.width = `calc( 100% - ${ realNameWidth }
|
|
7822
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
7823
|
+
tagsContainer.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
7683
7824
|
};
|
|
7684
7825
|
|
|
7685
7826
|
// Show tags
|
|
@@ -7779,8 +7920,8 @@ class Checkbox extends Widget {
|
|
|
7779
7920
|
};
|
|
7780
7921
|
|
|
7781
7922
|
this.onResize = ( rect ) => {
|
|
7782
|
-
const realNameWidth = ( this.root.domName?.
|
|
7783
|
-
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth }
|
|
7923
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
7924
|
+
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth })`;
|
|
7784
7925
|
};
|
|
7785
7926
|
|
|
7786
7927
|
var container = document.createElement( "div" );
|
|
@@ -7862,8 +8003,8 @@ class Toggle extends Widget {
|
|
|
7862
8003
|
};
|
|
7863
8004
|
|
|
7864
8005
|
this.onResize = ( rect ) => {
|
|
7865
|
-
const realNameWidth = ( this.root.domName?.
|
|
7866
|
-
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth }
|
|
8006
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
8007
|
+
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth })`;
|
|
7867
8008
|
};
|
|
7868
8009
|
|
|
7869
8010
|
var container = document.createElement('div');
|
|
@@ -8045,8 +8186,8 @@ class ColorInput extends Widget {
|
|
|
8045
8186
|
};
|
|
8046
8187
|
|
|
8047
8188
|
this.onResize = ( rect ) => {
|
|
8048
|
-
const realNameWidth = ( this.root.domName?.
|
|
8049
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
8189
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
8190
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
8050
8191
|
};
|
|
8051
8192
|
|
|
8052
8193
|
var container = document.createElement( 'span' );
|
|
@@ -8136,8 +8277,8 @@ class RangeInput extends Widget {
|
|
|
8136
8277
|
};
|
|
8137
8278
|
|
|
8138
8279
|
this.onResize = ( rect ) => {
|
|
8139
|
-
const realNameWidth = ( this.root.domName?.
|
|
8140
|
-
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth }
|
|
8280
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
8281
|
+
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth })`;
|
|
8141
8282
|
};
|
|
8142
8283
|
|
|
8143
8284
|
const container = document.createElement( 'div' );
|
|
@@ -8250,8 +8391,8 @@ class NumberInput extends Widget {
|
|
|
8250
8391
|
};
|
|
8251
8392
|
|
|
8252
8393
|
this.onResize = ( rect ) => {
|
|
8253
|
-
const realNameWidth = ( this.root.domName?.
|
|
8254
|
-
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth }
|
|
8394
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
8395
|
+
container.style.width = options.inputWidth ?? `calc( 100% - ${ realNameWidth })`;
|
|
8255
8396
|
};
|
|
8256
8397
|
|
|
8257
8398
|
var container = document.createElement( 'div' );
|
|
@@ -8406,7 +8547,6 @@ class NumberInput extends Widget {
|
|
|
8406
8547
|
else if( e.altKey ) mult *= 0.1;
|
|
8407
8548
|
value = ( +vecinput.valueAsNumber + mult * dt );
|
|
8408
8549
|
this.set( value, false, e );
|
|
8409
|
-
// vecinput.value = ( +new_value ).toFixed( 4 ).replace( /([0-9]+(\.[0-9]+[1-9])?)(\.?0+$)/, '$1' );
|
|
8410
8550
|
}
|
|
8411
8551
|
|
|
8412
8552
|
e.stopPropagation();
|
|
@@ -8487,8 +8627,8 @@ class Vector extends Widget {
|
|
|
8487
8627
|
};
|
|
8488
8628
|
|
|
8489
8629
|
this.onResize = ( rect ) => {
|
|
8490
|
-
const realNameWidth = ( this.root.domName?.
|
|
8491
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
8630
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
8631
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
8492
8632
|
};
|
|
8493
8633
|
|
|
8494
8634
|
const vectorInputs = [];
|
|
@@ -8841,8 +8981,8 @@ class OTPInput extends Widget {
|
|
|
8841
8981
|
};
|
|
8842
8982
|
|
|
8843
8983
|
this.onResize = ( rect ) => {
|
|
8844
|
-
const realNameWidth = ( this.root.domName?.
|
|
8845
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
8984
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
8985
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
8846
8986
|
};
|
|
8847
8987
|
|
|
8848
8988
|
this.disabled = options.disabled ?? false;
|
|
@@ -8987,8 +9127,8 @@ class Pad extends Widget {
|
|
|
8987
9127
|
};
|
|
8988
9128
|
|
|
8989
9129
|
this.onResize = ( rect ) => {
|
|
8990
|
-
const realNameWidth = ( this.root.domName?.
|
|
8991
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
9130
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
9131
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
8992
9132
|
};
|
|
8993
9133
|
|
|
8994
9134
|
var container = document.createElement( 'div' );
|
|
@@ -9107,8 +9247,8 @@ class Progress extends Widget {
|
|
|
9107
9247
|
};
|
|
9108
9248
|
|
|
9109
9249
|
this.onResize = ( rect ) => {
|
|
9110
|
-
const realNameWidth = ( this.root.domName?.
|
|
9111
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
9250
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
9251
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
9112
9252
|
};
|
|
9113
9253
|
|
|
9114
9254
|
const container = document.createElement('div');
|
|
@@ -9234,8 +9374,8 @@ class FileInput extends Widget {
|
|
|
9234
9374
|
let read = options.read ?? true;
|
|
9235
9375
|
|
|
9236
9376
|
this.onResize = ( rect ) => {
|
|
9237
|
-
const realNameWidth = ( this.root.domName?.
|
|
9238
|
-
input.style.width = `calc( 100% - ${ realNameWidth }
|
|
9377
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
9378
|
+
input.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
9239
9379
|
};
|
|
9240
9380
|
|
|
9241
9381
|
// Create hidden input
|
|
@@ -9561,8 +9701,8 @@ class Table extends Widget {
|
|
|
9561
9701
|
super( Widget.TABLE, name, null, options );
|
|
9562
9702
|
|
|
9563
9703
|
this.onResize = ( rect ) => {
|
|
9564
|
-
const realNameWidth = ( this.root.domName?.
|
|
9565
|
-
container.style.width = `calc( 100% - ${ realNameWidth }
|
|
9704
|
+
const realNameWidth = ( this.root.domName?.style.width ?? "0px" );
|
|
9705
|
+
container.style.width = `calc( 100% - ${ realNameWidth })`;
|
|
9566
9706
|
};
|
|
9567
9707
|
|
|
9568
9708
|
const container = document.createElement('div');
|
|
@@ -9621,7 +9761,7 @@ class Table extends Widget {
|
|
|
9621
9761
|
|
|
9622
9762
|
if( this.customFilters )
|
|
9623
9763
|
{
|
|
9624
|
-
const icon = LX.makeIcon( "circle-plus",
|
|
9764
|
+
const icon = LX.makeIcon( "circle-plus", { svgClass: "sm" } );
|
|
9625
9765
|
|
|
9626
9766
|
for( let f of this.customFilters )
|
|
9627
9767
|
{
|
|
@@ -9646,7 +9786,6 @@ class Table extends Widget {
|
|
|
9646
9786
|
headerContainer.appendChild( customFilterBtn.root );
|
|
9647
9787
|
}
|
|
9648
9788
|
|
|
9649
|
-
// const resetIcon = LX.makeIcon( "xmark", null, "sm" );
|
|
9650
9789
|
this._resetCustomFiltersBtn = new Button(null, "resetButton", ( v ) => {
|
|
9651
9790
|
this.activeCustomFilters = {};
|
|
9652
9791
|
this.refresh();
|
|
@@ -9658,7 +9797,7 @@ class Table extends Widget {
|
|
|
9658
9797
|
|
|
9659
9798
|
if( this.toggleColumns )
|
|
9660
9799
|
{
|
|
9661
|
-
const icon = LX.makeIcon( "sliders" );
|
|
9800
|
+
const icon = LX.makeIcon( "sliders-large" );
|
|
9662
9801
|
const toggleColumnsBtn = new Button( "toggleColumnsBtn", icon.innerHTML + "View", (value, e) => {
|
|
9663
9802
|
const menuOptions = data.head.map( ( colName, idx ) => {
|
|
9664
9803
|
const item = {
|
|
@@ -9741,7 +9880,7 @@ class Table extends Widget {
|
|
|
9741
9880
|
{
|
|
9742
9881
|
const th = document.createElement( 'th' );
|
|
9743
9882
|
th.innerHTML = `<span>${ headData }</span>`;
|
|
9744
|
-
th.querySelector( "span" ).appendChild( LX.makeIcon( "menu-arrows",
|
|
9883
|
+
th.querySelector( "span" ).appendChild( LX.makeIcon( "menu-arrows", { svgClass: "sm" } ) );
|
|
9745
9884
|
|
|
9746
9885
|
const idx = data.head.indexOf( headData );
|
|
9747
9886
|
if( this.centered && this.centered.indexOf( idx ) > -1 )
|
|
@@ -9992,7 +10131,7 @@ class Table extends Widget {
|
|
|
9992
10131
|
|
|
9993
10132
|
if( action == "delete" )
|
|
9994
10133
|
{
|
|
9995
|
-
button = LX.makeIcon( "trash-can", "Delete Row" );
|
|
10134
|
+
button = LX.makeIcon( "trash-can", { title: "Delete Row" } );
|
|
9996
10135
|
button.addEventListener( 'click', function() {
|
|
9997
10136
|
// Don't need to refresh table..
|
|
9998
10137
|
data.body.splice( r, 1 );
|
|
@@ -10001,7 +10140,7 @@ class Table extends Widget {
|
|
|
10001
10140
|
}
|
|
10002
10141
|
else if( action == "menu" )
|
|
10003
10142
|
{
|
|
10004
|
-
button = LX.makeIcon( "more-horizontal", "Menu" );
|
|
10143
|
+
button = LX.makeIcon( "more-horizontal", { title: "Menu" } );
|
|
10005
10144
|
button.addEventListener( 'click', function( event ) {
|
|
10006
10145
|
if( !options.onMenuAction )
|
|
10007
10146
|
{
|
|
@@ -10017,7 +10156,7 @@ class Table extends Widget {
|
|
|
10017
10156
|
else // custom actions
|
|
10018
10157
|
{
|
|
10019
10158
|
console.assert( action.constructor == Object );
|
|
10020
|
-
button = LX.makeIcon( action.icon, action.title );
|
|
10159
|
+
button = LX.makeIcon( action.icon, { title: action.title } );
|
|
10021
10160
|
|
|
10022
10161
|
if( action.callback )
|
|
10023
10162
|
{
|
|
@@ -12314,12 +12453,6 @@ class CanvasCurve {
|
|
|
12314
12453
|
if( o.xrange ) element.xrange = o.xrange;
|
|
12315
12454
|
if( o.yrange ) element.yrange = o.yrange;
|
|
12316
12455
|
if( o.smooth ) element.smooth = o.smooth;
|
|
12317
|
-
var rect = canvas.parentElement.getBoundingClientRect();
|
|
12318
|
-
if( canvas.parentElement.parentElement ) rect = canvas.parentElement.parentElement.getBoundingClientRect();
|
|
12319
|
-
if( rect && canvas.width != rect.width && rect.width && rect.width < 1000 )
|
|
12320
|
-
{
|
|
12321
|
-
canvas.width = rect.width;
|
|
12322
|
-
}
|
|
12323
12456
|
|
|
12324
12457
|
var ctx = canvas.getContext( "2d" );
|
|
12325
12458
|
ctx.setTransform( 1, 0, 0, 1, 0, 0 );
|
|
@@ -12654,12 +12787,6 @@ class CanvasDial {
|
|
|
12654
12787
|
if( o.xrange ) element.xrange = o.xrange;
|
|
12655
12788
|
if( o.yrange ) element.yrange = o.yrange;
|
|
12656
12789
|
if( o.smooth ) element.smooth = o.smooth;
|
|
12657
|
-
var rect = canvas.parentElement.getBoundingClientRect();
|
|
12658
|
-
if( canvas.parentElement.parentElement ) rect = canvas.parentElement.parentElement.getBoundingClientRect();
|
|
12659
|
-
if( rect && canvas.width != rect.width && rect.width && rect.width < 1000 )
|
|
12660
|
-
{
|
|
12661
|
-
canvas.width = rect.width;
|
|
12662
|
-
}
|
|
12663
12790
|
|
|
12664
12791
|
var ctx = canvas.getContext( "2d" );
|
|
12665
12792
|
ctx.setTransform( 1, 0, 0, 1, 0, 0 );
|