lexgui 0.7.4 → 0.7.5
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/extensions/codeeditor.js +51 -14
- package/build/extensions/videoeditor.js +12 -1
- package/build/lexgui.css +20 -11
- package/build/lexgui.js +14 -7
- package/build/lexgui.min.css +1 -1
- package/build/lexgui.min.js +1 -1
- package/build/lexgui.module.js +14 -7
- package/build/lexgui.module.min.js +1 -1
- package/changelog.md +15 -1
- package/examples/code-editor.html +4 -0
- package/package.json +1 -1
|
@@ -338,7 +338,7 @@ class CodeEditor {
|
|
|
338
338
|
|
|
339
339
|
let panel = new LX.Panel();
|
|
340
340
|
|
|
341
|
-
panel.addTitle( "EXPLORER" );
|
|
341
|
+
panel.addTitle( options.explorerName ?? "EXPLORER" );
|
|
342
342
|
|
|
343
343
|
let sceneData = {
|
|
344
344
|
'id': 'WORKSPACE',
|
|
@@ -403,11 +403,11 @@ class CodeEditor {
|
|
|
403
403
|
|
|
404
404
|
if( !this.disableEdition )
|
|
405
405
|
{
|
|
406
|
-
this.tabs.root.addEventListener( 'dblclick', (e) => {
|
|
406
|
+
this.tabs.root.parentElement.addEventListener( 'dblclick', (e) => {
|
|
407
407
|
if( options.allowAddScripts ?? true )
|
|
408
408
|
{
|
|
409
409
|
e.preventDefault();
|
|
410
|
-
this.
|
|
410
|
+
this._onCreateNewFile();
|
|
411
411
|
}
|
|
412
412
|
} );
|
|
413
413
|
}
|
|
@@ -1232,6 +1232,7 @@ class CodeEditor {
|
|
|
1232
1232
|
const s = getComputedStyle( r );
|
|
1233
1233
|
this.fontSize = parseInt( s.getPropertyValue( "--code-editor-font-size" ) );
|
|
1234
1234
|
this.charWidth = this._measureChar( "a", true );
|
|
1235
|
+
this.processLines();
|
|
1235
1236
|
}
|
|
1236
1237
|
|
|
1237
1238
|
LX.emit( "@font-size", this.fontSize );
|
|
@@ -1257,7 +1258,9 @@ class CodeEditor {
|
|
|
1257
1258
|
|
|
1258
1259
|
if( options.allowAddScripts ?? true )
|
|
1259
1260
|
{
|
|
1260
|
-
this.
|
|
1261
|
+
this.onCreateFile = options.onCreateFile;
|
|
1262
|
+
|
|
1263
|
+
this.addTab( "+", false, "Create file" );
|
|
1261
1264
|
}
|
|
1262
1265
|
|
|
1263
1266
|
if( options.files )
|
|
@@ -1828,10 +1831,23 @@ class CodeEditor {
|
|
|
1828
1831
|
|
|
1829
1832
|
this.processFocus( false );
|
|
1830
1833
|
|
|
1831
|
-
LX.
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
});
|
|
1834
|
+
new LX.DropdownMenu( e.target, [
|
|
1835
|
+
{ name: "Create file", icon: "FilePlus", callback: this._onCreateNewFile.bind( this ) },
|
|
1836
|
+
{ name: "Load file", icon: "FileUp", callback: this.loadTabFromFile.bind( this ) },
|
|
1837
|
+
], { side: "bottom", align: "start" });
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
_onCreateNewFile() {
|
|
1841
|
+
|
|
1842
|
+
let options = {};
|
|
1843
|
+
|
|
1844
|
+
if( this.onCreateFile )
|
|
1845
|
+
{
|
|
1846
|
+
options = this.onCreateFile( this );
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
const name = options.name ?? "unnamed.js";
|
|
1850
|
+
this.addTab( name, true, name, { language: options.language ?? "JavaScript" } );
|
|
1835
1851
|
}
|
|
1836
1852
|
|
|
1837
1853
|
_onSelectTab( isNewTabButton, event, name ) {
|
|
@@ -1868,18 +1884,38 @@ class CodeEditor {
|
|
|
1868
1884
|
{
|
|
1869
1885
|
this._changeLanguageFromExtension( LX.getExtension( name ) );
|
|
1870
1886
|
}
|
|
1887
|
+
|
|
1888
|
+
this.processLines();
|
|
1871
1889
|
}
|
|
1872
1890
|
|
|
1873
1891
|
_onContextMenuTab( isNewTabButton, event, name, ) {
|
|
1874
1892
|
|
|
1875
1893
|
if( isNewTabButton )
|
|
1894
|
+
{
|
|
1876
1895
|
return;
|
|
1896
|
+
}
|
|
1877
1897
|
|
|
1878
|
-
LX.
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1898
|
+
new LX.DropdownMenu( event.target, [
|
|
1899
|
+
{ name: "Close", kbd: "MWB", callback: () => { this.tabs.delete( name ) } },
|
|
1900
|
+
{ name: "Close Others", callback: () => {
|
|
1901
|
+
for( const [ key, data ] of Object.entries( this.tabs.tabs ) )
|
|
1902
|
+
{
|
|
1903
|
+
if( key === '+' || key === name ) continue;
|
|
1904
|
+
this.tabs.delete( key )
|
|
1905
|
+
}
|
|
1906
|
+
} },
|
|
1907
|
+
{ name: "Close All", callback: () => {
|
|
1908
|
+
for( const [ key, data ] of Object.entries( this.tabs.tabs ) )
|
|
1909
|
+
{
|
|
1910
|
+
if( key === '+' ) continue;
|
|
1911
|
+
this.tabs.delete( key )
|
|
1912
|
+
}
|
|
1913
|
+
} },
|
|
1914
|
+
null,
|
|
1915
|
+
{ name: "Copy Path", icon: "Copy", callback: () => {
|
|
1916
|
+
navigator.clipboard.writeText( this.openedTabs[ name ].path ?? "" );
|
|
1917
|
+
} }
|
|
1918
|
+
], { side: "bottom", align: "start", event });
|
|
1883
1919
|
}
|
|
1884
1920
|
|
|
1885
1921
|
addTab( name, selected, title, options = {} ) {
|
|
@@ -1900,6 +1936,7 @@ class CodeEditor {
|
|
|
1900
1936
|
// Create code content
|
|
1901
1937
|
let code = document.createElement( 'div' );
|
|
1902
1938
|
Object.assign( code, {
|
|
1939
|
+
path: options.path ?? "",
|
|
1903
1940
|
className: 'code',
|
|
1904
1941
|
lines: [ "" ],
|
|
1905
1942
|
language: options.language ?? "Plain Text",
|
|
@@ -2132,7 +2169,7 @@ class CodeEditor {
|
|
|
2132
2169
|
document.body.appendChild( input );
|
|
2133
2170
|
input.click();
|
|
2134
2171
|
input.addEventListener('change', e => {
|
|
2135
|
-
if
|
|
2172
|
+
if( e.target.files[ 0 ] )
|
|
2136
2173
|
{
|
|
2137
2174
|
this.loadFile( e.target.files[ 0 ] );
|
|
2138
2175
|
}
|
|
@@ -530,7 +530,10 @@ class VideoEditor {
|
|
|
530
530
|
this.isResizing = true;
|
|
531
531
|
}
|
|
532
532
|
});
|
|
533
|
-
});
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
this.onChangeStart = null;
|
|
536
|
+
this.onChangeEnd = null;
|
|
534
537
|
}
|
|
535
538
|
|
|
536
539
|
resizeCropArea(event) {
|
|
@@ -714,6 +717,10 @@ class VideoEditor {
|
|
|
714
717
|
if(this.onSetTime) {
|
|
715
718
|
this.onSetTime(t);
|
|
716
719
|
}
|
|
720
|
+
|
|
721
|
+
if(this.onChangeStart) {
|
|
722
|
+
this.onChangeStart(t);
|
|
723
|
+
}
|
|
717
724
|
}
|
|
718
725
|
|
|
719
726
|
_setEndValue ( x ) {
|
|
@@ -733,6 +740,10 @@ class VideoEditor {
|
|
|
733
740
|
if(this.onSetTime) {
|
|
734
741
|
this.onSetTime(t);
|
|
735
742
|
}
|
|
743
|
+
|
|
744
|
+
if(this.onChangeEnd) {
|
|
745
|
+
this.onChangeEnd(t);
|
|
746
|
+
}
|
|
736
747
|
}
|
|
737
748
|
|
|
738
749
|
getStartTime ( ) {
|
package/build/lexgui.css
CHANGED
|
@@ -4933,33 +4933,37 @@ ul.lexassetscontent {
|
|
|
4933
4933
|
.codebasearea .lexareatabs {
|
|
4934
4934
|
padding: 0px;
|
|
4935
4935
|
margin: 0px;
|
|
4936
|
+
gap: 0;
|
|
4937
|
+
background-color: var(--global-color-primary);
|
|
4936
4938
|
}
|
|
4937
4939
|
|
|
4938
4940
|
.codebasearea .lexareatab {
|
|
4939
4941
|
padding: 5px;
|
|
4940
4942
|
border-radius: 0px !important;
|
|
4941
4943
|
margin: 0px !important;
|
|
4942
|
-
border:
|
|
4943
|
-
|
|
4944
|
-
border-bottom:
|
|
4945
|
-
background-color: var(--global-color-primary) !important;
|
|
4944
|
+
border: none;
|
|
4945
|
+
background-color: var(--global-color-secondary) !important;
|
|
4946
|
+
border-bottom: 1px solid transparent;
|
|
4946
4947
|
transition: none;
|
|
4947
4948
|
display: flex !important;
|
|
4948
4949
|
}
|
|
4949
4950
|
|
|
4950
4951
|
.codebasearea .lexareatab:hover {
|
|
4951
|
-
background-color: var(--global-color-
|
|
4952
|
+
background-color: var(--global-color-tertiary) !important;
|
|
4953
|
+
}
|
|
4954
|
+
|
|
4955
|
+
.codebasearea .lexareatab:first-child {
|
|
4956
|
+
border-top-left-radius: 8px !important;
|
|
4952
4957
|
}
|
|
4953
4958
|
|
|
4954
4959
|
.codebasearea .lexareatab:last-child {
|
|
4955
|
-
border-right:
|
|
4960
|
+
border-top-right-radius: 8px !important;
|
|
4956
4961
|
}
|
|
4957
4962
|
|
|
4958
4963
|
.codebasearea .lexareatab.selected {
|
|
4959
|
-
background-color: var(--global-color-secondary) !important;
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
border-bottom: none;
|
|
4964
|
+
background-color: light-dark(var(--global-color-secondary), var(--global-medium-background)) !important;
|
|
4965
|
+
border-bottom: 1px solid var(--global-color-accent);
|
|
4966
|
+
color: var(--global-text-primary) !important;
|
|
4963
4967
|
}
|
|
4964
4968
|
|
|
4965
4969
|
.codebasearea .lexareatab i {
|
|
@@ -6105,6 +6109,10 @@ ul.lexassetscontent {
|
|
|
6105
6109
|
.items-center { place-items: center }
|
|
6106
6110
|
.items-end { place-items: end }
|
|
6107
6111
|
|
|
6112
|
+
.align-items-start { align-items: start }
|
|
6113
|
+
.align-items-center { align-items: center }
|
|
6114
|
+
.align-items-end { align-items: end }
|
|
6115
|
+
|
|
6108
6116
|
.justify-start { justify-content: start }
|
|
6109
6117
|
.justify-center { justify-content: center }
|
|
6110
6118
|
.justify-end { justify-content: end }
|
|
@@ -6316,6 +6324,8 @@ ul.lexassetscontent {
|
|
|
6316
6324
|
.font-bold { font-weight: 700 }
|
|
6317
6325
|
.font-extrabold { font-weight: 800 }
|
|
6318
6326
|
|
|
6327
|
+
.font-code { font-family: var(--global-code-font) }
|
|
6328
|
+
|
|
6319
6329
|
.tracking-tighter { letter-spacing: -0.05em }
|
|
6320
6330
|
.tracking-tight { letter-spacing: -0.025em }
|
|
6321
6331
|
.tracking-normal { letter-spacing: 0em }
|
|
@@ -6358,7 +6368,6 @@ ul.lexassetscontent {
|
|
|
6358
6368
|
.w-16 { width: 4rem } /* 64px */
|
|
6359
6369
|
.w-32 { width: 8rem } /* 128px */
|
|
6360
6370
|
|
|
6361
|
-
|
|
6362
6371
|
.h-full { height: 100% }
|
|
6363
6372
|
.h-screen { height: 100vh }
|
|
6364
6373
|
.h-auto { height: auto }
|
package/build/lexgui.js
CHANGED
|
@@ -14,7 +14,7 @@ console.warn( 'Script _build/lexgui.js_ is depracated and will be removed soon.
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
const LX = {
|
|
17
|
-
version: "0.7.
|
|
17
|
+
version: "0.7.5",
|
|
18
18
|
ready: false,
|
|
19
19
|
extensions: [], // Store extensions used
|
|
20
20
|
signals: {}, // Events and triggers
|
|
@@ -1099,6 +1099,7 @@ class DropdownMenu {
|
|
|
1099
1099
|
this.alignOffset = options.alignOffset ?? 0;
|
|
1100
1100
|
this.avoidCollisions = options.avoidCollisions ?? true;
|
|
1101
1101
|
this.onBlur = options.onBlur;
|
|
1102
|
+
this.event = options.event;
|
|
1102
1103
|
this.inPlace = false;
|
|
1103
1104
|
|
|
1104
1105
|
this.root = document.createElement( "div" );
|
|
@@ -1389,11 +1390,11 @@ class DropdownMenu {
|
|
|
1389
1390
|
_adjustPosition() {
|
|
1390
1391
|
|
|
1391
1392
|
const position = [ 0, 0 ];
|
|
1393
|
+
const rect = this._trigger.getBoundingClientRect();
|
|
1392
1394
|
|
|
1393
1395
|
// Place menu using trigger position and user options
|
|
1396
|
+
if( !this.event )
|
|
1394
1397
|
{
|
|
1395
|
-
const rect = this._trigger.getBoundingClientRect();
|
|
1396
|
-
|
|
1397
1398
|
let alignWidth = true;
|
|
1398
1399
|
|
|
1399
1400
|
switch( this.side )
|
|
@@ -1435,11 +1436,11 @@ class DropdownMenu {
|
|
|
1435
1436
|
if( alignWidth ) { position[ 0 ] += this.alignOffset; }
|
|
1436
1437
|
else { position[ 1 ] += this.alignOffset; }
|
|
1437
1438
|
}
|
|
1438
|
-
|
|
1439
|
-
|
|
1439
|
+
// Offset position based on event
|
|
1440
|
+
else
|
|
1440
1441
|
{
|
|
1441
|
-
position[ 0 ] =
|
|
1442
|
-
position[ 1 ] =
|
|
1442
|
+
position[ 0 ] = this.event.x;
|
|
1443
|
+
position[ 1 ] = this.event.y;
|
|
1443
1444
|
}
|
|
1444
1445
|
|
|
1445
1446
|
if( this._parent instanceof HTMLDialogElement )
|
|
@@ -1449,6 +1450,12 @@ class DropdownMenu {
|
|
|
1449
1450
|
position[ 1 ] -= parentRect.y;
|
|
1450
1451
|
}
|
|
1451
1452
|
|
|
1453
|
+
if( this.avoidCollisions )
|
|
1454
|
+
{
|
|
1455
|
+
position[ 0 ] = LX.clamp( position[ 0 ], 0, window.innerWidth - this.root.offsetWidth - this._windowPadding );
|
|
1456
|
+
position[ 1 ] = LX.clamp( position[ 1 ], 0, window.innerHeight - this.root.offsetHeight - this._windowPadding );
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1452
1459
|
this.root.style.left = `${ position[ 0 ] }px`;
|
|
1453
1460
|
this.root.style.top = `${ position[ 1 ] }px`;
|
|
1454
1461
|
this.inPlace = true;
|