lexgui 0.5.9 → 0.5.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lexgui.css +8 -10
- package/build/lexgui.js +97 -32
- package/build/lexgui.min.css +1 -1
- package/build/lexgui.min.js +1 -1
- package/build/lexgui.module.js +97 -32
- package/build/lexgui.module.min.js +1 -1
- package/changelog.md +18 -1
- package/demo.js +6 -4
- package/package.json +1 -1
package/build/lexgui.css
CHANGED
|
@@ -1434,7 +1434,10 @@ a svg, svg path {
|
|
|
1434
1434
|
|
|
1435
1435
|
.lexwidget .lextext.formlabel {
|
|
1436
1436
|
margin-left: 8px;
|
|
1437
|
-
margin-bottom: -
|
|
1437
|
+
margin-bottom: -6px;
|
|
1438
|
+
font-weight: 500;
|
|
1439
|
+
padding: 0;
|
|
1440
|
+
font-size: var(--global-font-size-sm);
|
|
1438
1441
|
}
|
|
1439
1442
|
|
|
1440
1443
|
.lexwidget .lextext.outline {
|
|
@@ -2158,10 +2161,6 @@ dialog .lexselect .lexselectoptions {
|
|
|
2158
2161
|
--toggle-fg-color: var(--global-color-primary);
|
|
2159
2162
|
}
|
|
2160
2163
|
|
|
2161
|
-
.lextoggle.outline.primary, .lextoggle.outline.secondary {
|
|
2162
|
-
/* border: 1px solid var(--global-text-tertiary); */
|
|
2163
|
-
}
|
|
2164
|
-
|
|
2165
2164
|
.lextoggle.outline:checked, .lextoggle.outline[aria-checked=true], .lextoggle.outline:has(>input:checked) {
|
|
2166
2165
|
border: 1px solid currentColor;
|
|
2167
2166
|
color: var(--toggle-bg-color);
|
|
@@ -2485,7 +2484,6 @@ input[type=number] {
|
|
|
2485
2484
|
-webkit-appearance: none;
|
|
2486
2485
|
-moz-appearance: none;
|
|
2487
2486
|
appearance: none;
|
|
2488
|
-
webkit-appearance: none;
|
|
2489
2487
|
--radius-selector-max: calc(var(--radius-selector) + var(--radius-selector) + var(--radius-selector));
|
|
2490
2488
|
border-radius: calc(var(--radius-selector) + min(var(--range-thumb-padding),var(--radius-selector-max)));
|
|
2491
2489
|
width: 100%;
|
|
@@ -2555,7 +2553,6 @@ input[type=number] {
|
|
|
2555
2553
|
-webkit-appearance: none;
|
|
2556
2554
|
-moz-appearance: none;
|
|
2557
2555
|
appearance: none;
|
|
2558
|
-
webkit-appearance: none;
|
|
2559
2556
|
color: var(--range-progress);
|
|
2560
2557
|
box-shadow: 0 -1px oklch(0% 0 0/0.1) inset,0 8px 0 -4px oklch(100% 0 0/0.1) inset,0 1px color-mix(in oklab,currentColor calc(1*10%),#0000),0 0 0 2rem var(--range-thumb-color) inset,calc((var(--range-dir,1)*-100rem) - (var(--range-dir,1)*var(--range-thumb-size)/2)) 0 0 calc(100rem*var(--range-fill));
|
|
2561
2558
|
background-color: currentColor;
|
|
@@ -4857,6 +4854,7 @@ ul.lexassetscontent {
|
|
|
4857
4854
|
.lexassetscontent li .lexassettitle {
|
|
4858
4855
|
position: absolute;
|
|
4859
4856
|
width: 100%;
|
|
4857
|
+
height: 24px;
|
|
4860
4858
|
bottom: 0px;
|
|
4861
4859
|
-webkit-text-size-adjust: 100%;
|
|
4862
4860
|
font-size: var(--global-font-size);
|
|
@@ -4865,12 +4863,11 @@ ul.lexassetscontent {
|
|
|
4865
4863
|
text-align: center;
|
|
4866
4864
|
box-sizing: border-box;
|
|
4867
4865
|
display: block;
|
|
4868
|
-
height: 20px;
|
|
4869
4866
|
padding: 0.1em;
|
|
4870
|
-
padding-top: 0.15em;
|
|
4871
4867
|
overflow: hidden;
|
|
4872
4868
|
text-overflow: ellipsis;
|
|
4873
4869
|
white-space: nowrap;
|
|
4870
|
+
align-content: center;
|
|
4874
4871
|
background-color: var(--global-intense-background);
|
|
4875
4872
|
transition: all 0.1s;
|
|
4876
4873
|
z-index: 1;
|
|
@@ -6058,6 +6055,7 @@ ul.lexassetscontent {
|
|
|
6058
6055
|
.bg-warning { --background-color: var(--global-color-warning); background-color: var(--background-color)!important }
|
|
6059
6056
|
.bg-white { --background-color: white; background-color: var(--background-color)!important }
|
|
6060
6057
|
.bg-black { --background-color: black; background-color: var(--background-color)!important }
|
|
6058
|
+
.bg-blur { --background-color: var(--global-blur-background); background-color: var(--background-color)!important }
|
|
6061
6059
|
.bg-none { background: none !important }
|
|
6062
6060
|
|
|
6063
6061
|
.hover\:bg-primary:hover { background-color: var(--global-color-primary) !important }
|
|
@@ -6140,7 +6138,7 @@ ul.lexassetscontent {
|
|
|
6140
6138
|
.text-balance { text-wrap: balance }
|
|
6141
6139
|
.break-words { overflow-wrap: break-word }
|
|
6142
6140
|
|
|
6143
|
-
.line-clamp-1, .line-clamp-2 { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical }
|
|
6141
|
+
.line-clamp-1, .line-clamp-2, .line-clamp-3, .line-clamp-4 { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical }
|
|
6144
6142
|
.line-clamp-1 { -webkit-line-clamp: 1; line-clamp: 1 }
|
|
6145
6143
|
.line-clamp-2 { -webkit-line-clamp: 2; line-clamp: 2 }
|
|
6146
6144
|
.line-clamp-3 { -webkit-line-clamp: 3; line-clamp: 3 }
|
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.11",
|
|
16
16
|
ready: false,
|
|
17
17
|
components: [], // Specific pre-build components
|
|
18
18
|
signals: {}, // Events and triggers
|
|
@@ -210,6 +210,29 @@ function setTheme( colorScheme )
|
|
|
210
210
|
|
|
211
211
|
LX.setTheme = setTheme;
|
|
212
212
|
|
|
213
|
+
/**
|
|
214
|
+
* @method getTheme
|
|
215
|
+
* @description Gets either "dark" or "light" theme value
|
|
216
|
+
*/
|
|
217
|
+
function getTheme()
|
|
218
|
+
{
|
|
219
|
+
return document.documentElement.getAttribute( "data-theme" ) ?? "dark";
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
LX.getTheme = getTheme;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* @method switchTheme
|
|
226
|
+
* @description Toggles between "dark" and "light" themes
|
|
227
|
+
*/
|
|
228
|
+
function switchTheme()
|
|
229
|
+
{
|
|
230
|
+
const currentTheme = getTheme();
|
|
231
|
+
setTheme( currentTheme == "dark" ? "light" : "dark" );
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
LX.switchTheme = switchTheme;
|
|
235
|
+
|
|
213
236
|
/**
|
|
214
237
|
* @method setThemeColor
|
|
215
238
|
* @description Sets a new value for one of the main theme variables
|
|
@@ -1245,7 +1268,7 @@ function _createCommandbar( root )
|
|
|
1245
1268
|
if( LX.has('CodeEditor') )
|
|
1246
1269
|
{
|
|
1247
1270
|
const instances = LX.CodeEditor.getInstances();
|
|
1248
|
-
if( !instances.length ) return;
|
|
1271
|
+
if( !instances.length || !instances[ 0 ].area.root.offsetHeight ) return;
|
|
1249
1272
|
|
|
1250
1273
|
const languages = instances[ 0 ].languages;
|
|
1251
1274
|
|
|
@@ -1708,35 +1731,52 @@ function badge( text, className, options = {} )
|
|
|
1708
1731
|
LX.badge = badge;
|
|
1709
1732
|
|
|
1710
1733
|
/**
|
|
1711
|
-
* @method
|
|
1712
|
-
* @param {
|
|
1734
|
+
* @method makeElement
|
|
1735
|
+
* @param {String} htmlType
|
|
1713
1736
|
* @param {String} className
|
|
1714
1737
|
* @param {String} innerHTML
|
|
1715
1738
|
* @param {HTMLElement} parent
|
|
1716
1739
|
* @param {Object} overrideStyle
|
|
1717
1740
|
*/
|
|
1718
1741
|
|
|
1719
|
-
function
|
|
1742
|
+
function makeElement( htmlType, className, innerHTML, parent, overrideStyle = {} )
|
|
1720
1743
|
{
|
|
1721
|
-
const
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
container.style.height = size && size[ 1 ] ? size[ 1 ] : "100%";
|
|
1726
|
-
Object.assign( container.style, overrideStyle );
|
|
1744
|
+
const element = document.createElement( htmlType );
|
|
1745
|
+
element.className = className ?? ""
|
|
1746
|
+
element.innerHTML = innerHTML ?? "";
|
|
1747
|
+
Object.assign( element.style, overrideStyle );
|
|
1727
1748
|
|
|
1728
1749
|
if( parent )
|
|
1729
1750
|
{
|
|
1730
1751
|
if( parent.attach ) // Use attach method if possible
|
|
1731
1752
|
{
|
|
1732
|
-
parent.attach(
|
|
1753
|
+
parent.attach( element );
|
|
1733
1754
|
}
|
|
1734
1755
|
else // its a native HTMLElement
|
|
1735
1756
|
{
|
|
1736
|
-
parent.appendChild(
|
|
1757
|
+
parent.appendChild( element );
|
|
1737
1758
|
}
|
|
1738
1759
|
}
|
|
1739
1760
|
|
|
1761
|
+
return element;
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
LX.makeElement = makeElement;
|
|
1765
|
+
|
|
1766
|
+
/**
|
|
1767
|
+
* @method makeContainer
|
|
1768
|
+
* @param {Array} size
|
|
1769
|
+
* @param {String} className
|
|
1770
|
+
* @param {String} innerHTML
|
|
1771
|
+
* @param {HTMLElement} parent
|
|
1772
|
+
* @param {Object} overrideStyle
|
|
1773
|
+
*/
|
|
1774
|
+
|
|
1775
|
+
function makeContainer( size, className, innerHTML, parent, overrideStyle = {} )
|
|
1776
|
+
{
|
|
1777
|
+
const container = LX.makeElement( "div", "lexcontainer " + ( className ?? "" ), innerHTML, parent, overrideStyle );
|
|
1778
|
+
container.style.width = size && size[ 0 ] ? size[ 0 ] : "100%";
|
|
1779
|
+
container.style.height = size && size[ 1 ] ? size[ 1 ] : "100%";
|
|
1740
1780
|
return container;
|
|
1741
1781
|
}
|
|
1742
1782
|
|
|
@@ -5003,14 +5043,14 @@ class SideBar {
|
|
|
5003
5043
|
this.root.appendChild( this.footer );
|
|
5004
5044
|
}
|
|
5005
5045
|
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
( parseInt( this.filter?.getComputedSize().height ) ?? 0 ) +
|
|
5011
|
-
( parseInt( this.footer?.getComputedSize().height ) ?? 0 );
|
|
5046
|
+
const resizeObserver = new ResizeObserver( entries => {
|
|
5047
|
+
const contentOffset = ( this.header?.offsetHeight ?? 0 ) +
|
|
5048
|
+
( this.filter?.offsetHeight ?? 0 ) +
|
|
5049
|
+
( this.footer?.offsetHeight ?? 0 );
|
|
5012
5050
|
this.content.style.height = `calc(100% - ${ contentOffset }px)`;
|
|
5013
|
-
}
|
|
5051
|
+
} );
|
|
5052
|
+
|
|
5053
|
+
resizeObserver.observe( this.root );
|
|
5014
5054
|
|
|
5015
5055
|
this.items = [ ];
|
|
5016
5056
|
this.icons = { };
|
|
@@ -7258,12 +7298,17 @@ class Form extends Widget {
|
|
|
7258
7298
|
if( entryData.constructor != Object )
|
|
7259
7299
|
{
|
|
7260
7300
|
entryData = { };
|
|
7301
|
+
data[ entry ] = entryData;
|
|
7261
7302
|
}
|
|
7262
7303
|
|
|
7263
7304
|
entryData.placeholder = entryData.placeholder ?? entry;
|
|
7264
7305
|
entryData.width = "100%";
|
|
7265
7306
|
|
|
7266
|
-
|
|
7307
|
+
if( !( options.skipLabels ?? false ) )
|
|
7308
|
+
{
|
|
7309
|
+
const label = new TextInput( null, entry, null, { disabled: true, inputClass: "formlabel nobg" } );
|
|
7310
|
+
container.appendChild( label.root );
|
|
7311
|
+
}
|
|
7267
7312
|
|
|
7268
7313
|
entryData.textWidget = new TextInput( null, entryData.constructor == Object ? entryData.value : entryData, ( value ) => {
|
|
7269
7314
|
container.formData[ entry ] = value;
|
|
@@ -7273,9 +7318,21 @@ class Form extends Widget {
|
|
|
7273
7318
|
container.formData[ entry ] = entryData.constructor == Object ? entryData.value : entryData;
|
|
7274
7319
|
}
|
|
7275
7320
|
|
|
7276
|
-
|
|
7321
|
+
const buttonContainer = LX.makeContainer( ["100%", "auto"], "flex flex-row", "", container );
|
|
7322
|
+
|
|
7323
|
+
if( options.secondaryActionName || options.secondaryActionCallback )
|
|
7324
|
+
{
|
|
7325
|
+
const secondaryButton = new Button( null, options.secondaryActionName ?? "Cancel", ( value, event ) => {
|
|
7326
|
+
if( callback )
|
|
7327
|
+
{
|
|
7328
|
+
callback( container.formData, event );
|
|
7329
|
+
}
|
|
7330
|
+
}, { width: "100%", minWidth: "0", buttonClass: options.secondaryButtonClass ?? "primary" } );
|
|
7331
|
+
|
|
7332
|
+
buttonContainer.appendChild( secondaryButton.root );
|
|
7333
|
+
}
|
|
7277
7334
|
|
|
7278
|
-
const
|
|
7335
|
+
const primaryButton = new Button( null, options.primaryActionName ?? "Submit", ( value, event ) => {
|
|
7279
7336
|
|
|
7280
7337
|
for( let entry in data )
|
|
7281
7338
|
{
|
|
@@ -7291,9 +7348,9 @@ class Form extends Widget {
|
|
|
7291
7348
|
{
|
|
7292
7349
|
callback( container.formData, event );
|
|
7293
7350
|
}
|
|
7294
|
-
}, { buttonClass: "
|
|
7351
|
+
}, { width: "100%", minWidth: "0", buttonClass: options.primaryButtonClass ?? "contrast" } );
|
|
7295
7352
|
|
|
7296
|
-
|
|
7353
|
+
buttonContainer.appendChild( primaryButton.root );
|
|
7297
7354
|
}
|
|
7298
7355
|
}
|
|
7299
7356
|
|
|
@@ -10550,9 +10607,7 @@ class DatePicker extends Widget {
|
|
|
10550
10607
|
container.innerHTML = "";
|
|
10551
10608
|
const calendarIcon = LX.makeIcon( "calendar" );
|
|
10552
10609
|
const calendarButton = new Button( null, currentDate ?? "Pick a date", () => {
|
|
10553
|
-
this._popover = new Popover( calendarButton.root,
|
|
10554
|
-
popoverRoot.appendChild( this.calendar.root );
|
|
10555
|
-
} );
|
|
10610
|
+
this._popover = new Popover( calendarButton.root, [ this.calendar ] );
|
|
10556
10611
|
}, { buttonClass: `flex flex-row px-3 ${ currentDate ? "" : "fg-tertiary" } justify-between` } );
|
|
10557
10612
|
|
|
10558
10613
|
calendarButton.root.querySelector( "button" ).appendChild( calendarIcon );
|
|
@@ -11225,7 +11280,12 @@ class Panel {
|
|
|
11225
11280
|
* @param {Object} data Form data
|
|
11226
11281
|
* @param {Function} callback Callback function on submit form
|
|
11227
11282
|
* @param {Object} options:
|
|
11228
|
-
*
|
|
11283
|
+
* primaryActionName: Text to be shown in the primary action button ['Submit']
|
|
11284
|
+
* primaryButtonClass: Button class for primary action button ['contrast']
|
|
11285
|
+
* secondaryActionName: Text to be shown in the secondary action button ['Cancel']
|
|
11286
|
+
* secondaryActionCallback: Callback function on press secondary button
|
|
11287
|
+
* secondaryButtonClass: Button class for secondary action button ['primary']
|
|
11288
|
+
* skipLabels: Do not show input field labels [false]
|
|
11229
11289
|
*/
|
|
11230
11290
|
|
|
11231
11291
|
addForm( name, data, callback, options = {} ) {
|
|
@@ -12056,7 +12116,6 @@ class Footer {
|
|
|
12056
12116
|
parent.appendChild( root );
|
|
12057
12117
|
|
|
12058
12118
|
// Set always at bottom
|
|
12059
|
-
root.previousElementSibling.style.height = "unset";
|
|
12060
12119
|
root.previousElementSibling.style.flexGrow = "1";
|
|
12061
12120
|
|
|
12062
12121
|
this.root = root;
|
|
@@ -13452,8 +13511,8 @@ class AssetView {
|
|
|
13452
13511
|
div.className = 'lexassetbrowser';
|
|
13453
13512
|
this.root = div;
|
|
13454
13513
|
|
|
13455
|
-
let area = new LX.Area({height: "100%"});
|
|
13456
|
-
div.appendChild(area.root);
|
|
13514
|
+
let area = new LX.Area( { width: "100%", height: "100%" } );
|
|
13515
|
+
div.appendChild( area.root );
|
|
13457
13516
|
|
|
13458
13517
|
let left, right, contentArea = area;
|
|
13459
13518
|
|
|
@@ -13466,6 +13525,9 @@ class AssetView {
|
|
|
13466
13525
|
this.contextMenu = options.contextMenu ?? [];
|
|
13467
13526
|
this.onRefreshContent = options.onRefreshContent;
|
|
13468
13527
|
|
|
13528
|
+
// Append temporarily to the dom
|
|
13529
|
+
document.body.appendChild( this.root );
|
|
13530
|
+
|
|
13469
13531
|
if( !this.skipBrowser )
|
|
13470
13532
|
{
|
|
13471
13533
|
[left, right] = area.split({ type: "horizontal", sizes: ["15%", "85%"]});
|
|
@@ -13503,6 +13565,9 @@ class AssetView {
|
|
|
13503
13565
|
{
|
|
13504
13566
|
this.previewPanel = right.addPanel( {className: 'lexassetcontentpanel', style: { overflow: 'scroll' }} );
|
|
13505
13567
|
}
|
|
13568
|
+
|
|
13569
|
+
// Clean up
|
|
13570
|
+
document.body.removeChild( this.root );
|
|
13506
13571
|
}
|
|
13507
13572
|
|
|
13508
13573
|
/**
|