lexgui 0.1.29 → 0.1.30
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/codeeditor.js +11 -22
- package/build/components/nodegraph.js +806 -342
- package/build/lexgui.css +70 -36
- package/build/lexgui.js +110 -29
- package/build/lexgui.module.js +108 -27
- package/changelog.md +19 -0
- package/examples/code_editor.html +10 -13
- package/examples/index.html +1 -1
- package/examples/node_graph.html +1 -0
- package/examples/previews/code_editor.png +0 -0
- package/examples/previews/dialogs.png +0 -0
- package/examples/previews/node_graph.png +0 -0
- package/package.json +1 -1
|
@@ -6,13 +6,6 @@ if(!LX) {
|
|
|
6
6
|
|
|
7
7
|
LX.components.push( 'CodeEditor' );
|
|
8
8
|
|
|
9
|
-
function flushCss(element) {
|
|
10
|
-
// By reading the offsetHeight property, we are forcing
|
|
11
|
-
// the browser to flush the pending CSS changes (which it
|
|
12
|
-
// does to ensure the value obtained is accurate).
|
|
13
|
-
element.offsetHeight;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
9
|
function swapElements( obj, a, b ) {
|
|
17
10
|
[obj[a], obj[b]] = [obj[b], obj[a]];
|
|
18
11
|
}
|
|
@@ -53,10 +46,6 @@ function indexOfFrom( str, reg, from, reverse ) {
|
|
|
53
46
|
}
|
|
54
47
|
}
|
|
55
48
|
|
|
56
|
-
function deleteElement( el ) {
|
|
57
|
-
if( el ) el.remove();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
49
|
let ASYNC_ENABLED = true;
|
|
61
50
|
|
|
62
51
|
function doAsync( fn, ms ) {
|
|
@@ -1289,7 +1278,7 @@ class CodeEditor {
|
|
|
1289
1278
|
get: (v) => { return cursor._position },
|
|
1290
1279
|
set: (v) => {
|
|
1291
1280
|
cursor._position = v;
|
|
1292
|
-
if( cursor.isMain ) this._updateDataInfoPanel( "@cursor-pos", "Col " + v );
|
|
1281
|
+
if( cursor.isMain ) this._updateDataInfoPanel( "@cursor-pos", "Col " + ( v + 1 ) );
|
|
1293
1282
|
}
|
|
1294
1283
|
} );
|
|
1295
1284
|
|
|
@@ -1957,7 +1946,7 @@ class CodeEditor {
|
|
|
1957
1946
|
if( deltaY >= 0 )
|
|
1958
1947
|
{
|
|
1959
1948
|
while( deltaY < ( cursorSelections.childElementCount - 1 ) )
|
|
1960
|
-
deleteElement( cursorSelections.lastChild );
|
|
1949
|
+
LX.UTILS.deleteElement( cursorSelections.lastChild );
|
|
1961
1950
|
|
|
1962
1951
|
for(let i = fromY; i <= toY; i++){
|
|
1963
1952
|
|
|
@@ -2008,7 +1997,7 @@ class CodeEditor {
|
|
|
2008
1997
|
else // Selection goes up...
|
|
2009
1998
|
{
|
|
2010
1999
|
while( Math.abs( deltaY ) < ( cursorSelections.childElementCount - 1 ) )
|
|
2011
|
-
deleteElement( cursorSelections.firstChild );
|
|
2000
|
+
LX.UTILS.deleteElement( cursorSelections.firstChild );
|
|
2012
2001
|
|
|
2013
2002
|
for( let i = toY; i <= fromY; i++ ){
|
|
2014
2003
|
|
|
@@ -2688,7 +2677,7 @@ class CodeEditor {
|
|
|
2688
2677
|
// Single line
|
|
2689
2678
|
if( !force )
|
|
2690
2679
|
{
|
|
2691
|
-
deleteElement( this.code.childNodes[ local_line_num ] );
|
|
2680
|
+
LX.UTILS.deleteElement( this.code.childNodes[ local_line_num ] );
|
|
2692
2681
|
this.code.insertChildAtIndex( document.createElement( 'pre' ), local_line_num );
|
|
2693
2682
|
}
|
|
2694
2683
|
|
|
@@ -3244,7 +3233,7 @@ class CodeEditor {
|
|
|
3244
3233
|
|
|
3245
3234
|
if( cursor )
|
|
3246
3235
|
{
|
|
3247
|
-
deleteElement( this.selections[ cursor.name ] );
|
|
3236
|
+
LX.UTILS.deleteElement( this.selections[ cursor.name ] );
|
|
3248
3237
|
delete this.selections[ cursor.name ];
|
|
3249
3238
|
delete cursor.selection;
|
|
3250
3239
|
}
|
|
@@ -3252,7 +3241,7 @@ class CodeEditor {
|
|
|
3252
3241
|
{
|
|
3253
3242
|
for( let cursor of this.cursors.children )
|
|
3254
3243
|
{
|
|
3255
|
-
deleteElement( this.selections[ cursor.name ] );
|
|
3244
|
+
LX.UTILS.deleteElement( this.selections[ cursor.name ] );
|
|
3256
3245
|
delete this.selections[ cursor.name ];
|
|
3257
3246
|
delete cursor.selection;
|
|
3258
3247
|
}
|
|
@@ -3441,9 +3430,9 @@ class CodeEditor {
|
|
|
3441
3430
|
|
|
3442
3431
|
removeCursor( cursor ) {
|
|
3443
3432
|
|
|
3444
|
-
deleteElement( this.selections[ cursor.name ] );
|
|
3433
|
+
LX.UTILS.deleteElement( this.selections[ cursor.name ] );
|
|
3445
3434
|
delete this.selections[ cursor.name ];
|
|
3446
|
-
deleteElement( cursor );
|
|
3435
|
+
LX.UTILS.deleteElement( cursor );
|
|
3447
3436
|
}
|
|
3448
3437
|
|
|
3449
3438
|
resetCursorPos( flag, cursor ) {
|
|
@@ -3730,7 +3719,7 @@ class CodeEditor {
|
|
|
3730
3719
|
text.innerText = char;
|
|
3731
3720
|
this.code.appendChild( line );
|
|
3732
3721
|
var rect = text.getBoundingClientRect();
|
|
3733
|
-
deleteElement( line );
|
|
3722
|
+
LX.UTILS.deleteElement( line );
|
|
3734
3723
|
const bb = [ use_floating ? rect.width : Math.floor( rect.width ), use_floating ? rect.height : Math.floor( rect.height ) ];
|
|
3735
3724
|
return get_bb ? bb : bb[ 0 ];
|
|
3736
3725
|
}
|
|
@@ -3993,7 +3982,7 @@ class CodeEditor {
|
|
|
3993
3982
|
|
|
3994
3983
|
else if( this._lastResult )
|
|
3995
3984
|
{
|
|
3996
|
-
deleteElement( this._lastResult.dom );
|
|
3985
|
+
LX.UTILS.deleteElement( this._lastResult.dom );
|
|
3997
3986
|
delete this._lastResult;
|
|
3998
3987
|
}
|
|
3999
3988
|
|
|
@@ -4016,7 +4005,7 @@ class CodeEditor {
|
|
|
4016
4005
|
|
|
4017
4006
|
if( this._lastResult )
|
|
4018
4007
|
{
|
|
4019
|
-
deleteElement( this._lastResult.dom );
|
|
4008
|
+
LX.UTILS.deleteElement( this._lastResult.dom );
|
|
4020
4009
|
cursorData = this._lastResult.pos;
|
|
4021
4010
|
delete this._lastResult;
|
|
4022
4011
|
}
|