lexgui 0.6.7 → 0.6.9
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 +49 -19
- package/build/components/timeline.js +14 -7
- package/build/lexgui.css +27 -5
- package/build/lexgui.js +232 -64
- package/build/lexgui.min.css +1 -1
- package/build/lexgui.min.js +1 -1
- package/build/lexgui.module.js +254 -86
- package/build/lexgui.module.min.js +1 -1
- package/changelog.md +44 -1
- package/demo.js +2 -2
- package/examples/all_widgets.html +5 -4
- package/examples/editor.html +18 -16
- package/package.json +1 -1
|
@@ -756,31 +756,43 @@ class CodeEditor {
|
|
|
756
756
|
let idx = firstNonspaceIndex( this.code.lines[ ln ] );
|
|
757
757
|
|
|
758
758
|
// We already are in the first non space index...
|
|
759
|
-
if(idx == cursor.position) idx = 0;
|
|
759
|
+
if( idx == cursor.position ) idx = 0;
|
|
760
760
|
|
|
761
761
|
const prestring = this.code.lines[ ln ].substring( 0, idx );
|
|
762
762
|
let lastX = cursor.position;
|
|
763
763
|
|
|
764
764
|
this.resetCursorPos( CodeEditor.CURSOR_LEFT, cursor );
|
|
765
|
-
if(idx > 0)
|
|
765
|
+
if( idx > 0 )
|
|
766
|
+
{
|
|
766
767
|
this.cursorToString( cursor, prestring );
|
|
767
|
-
|
|
768
|
+
}
|
|
769
|
+
else
|
|
770
|
+
{
|
|
771
|
+
// No spaces, start from char 0
|
|
772
|
+
idx = 0;
|
|
773
|
+
}
|
|
768
774
|
|
|
769
|
-
|
|
775
|
+
this.setScrollLeft( 0 );
|
|
770
776
|
this.mergeCursors( ln );
|
|
771
777
|
|
|
772
778
|
if( e.shiftKey && !e.cancelShift )
|
|
773
779
|
{
|
|
774
780
|
// Get last selection range
|
|
775
781
|
if( cursor.selection )
|
|
782
|
+
{
|
|
776
783
|
lastX += cursor.selection.chars;
|
|
784
|
+
}
|
|
777
785
|
|
|
778
786
|
if( !cursor.selection )
|
|
787
|
+
{
|
|
779
788
|
this.startSelection( cursor );
|
|
789
|
+
}
|
|
780
790
|
|
|
781
791
|
var string = this.code.lines[ ln ].substring( idx, lastX );
|
|
782
792
|
if( cursor.selection.sameLine() )
|
|
793
|
+
{
|
|
783
794
|
cursor.selection.selectInline( cursor, idx, cursor.line, this.measureString( string ) );
|
|
795
|
+
}
|
|
784
796
|
else
|
|
785
797
|
{
|
|
786
798
|
this._processSelection( cursor, e );
|
|
@@ -1666,14 +1678,16 @@ class CodeEditor {
|
|
|
1666
1678
|
}
|
|
1667
1679
|
|
|
1668
1680
|
this._removeSecondaryCursors();
|
|
1669
|
-
var cursor = this._getCurrentCursor( true );
|
|
1670
1681
|
|
|
1682
|
+
var cursor = this._getCurrentCursor( true );
|
|
1671
1683
|
this.saveCursor( cursor, this.code.cursorState );
|
|
1672
|
-
|
|
1673
1684
|
this.code = this.loadedTabs[ name ];
|
|
1674
1685
|
this.restoreCursor( cursor, this.code.cursorState );
|
|
1675
1686
|
|
|
1676
1687
|
this.endSelection();
|
|
1688
|
+
|
|
1689
|
+
this.hideAutoCompleteBox();
|
|
1690
|
+
|
|
1677
1691
|
this._updateDataInfoPanel( "@tab-name", name );
|
|
1678
1692
|
|
|
1679
1693
|
if( this.code.languageOverride )
|
|
@@ -2220,6 +2234,14 @@ class CodeEditor {
|
|
|
2220
2234
|
return;
|
|
2221
2235
|
|
|
2222
2236
|
const key = e.key ?? e.detail.key;
|
|
2237
|
+
|
|
2238
|
+
// Do not propagate "space to scroll" event
|
|
2239
|
+
if( key == ' ' )
|
|
2240
|
+
{
|
|
2241
|
+
e.preventDefault();
|
|
2242
|
+
e.stopPropagation();
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2223
2245
|
const target = e.detail.targetCursor;
|
|
2224
2246
|
|
|
2225
2247
|
// Global keys
|
|
@@ -2359,7 +2381,9 @@ class CodeEditor {
|
|
|
2359
2381
|
|
|
2360
2382
|
// keys with length > 1 are probably special keys
|
|
2361
2383
|
if( key.length > 1 && this.specialKeys.indexOf( key ) == -1 )
|
|
2384
|
+
{
|
|
2362
2385
|
return;
|
|
2386
|
+
}
|
|
2363
2387
|
|
|
2364
2388
|
let lidx = cursor.line;
|
|
2365
2389
|
this.code.lines[ lidx ] = this.code.lines[ lidx ] ?? "";
|
|
@@ -2545,11 +2569,11 @@ class CodeEditor {
|
|
|
2545
2569
|
|
|
2546
2570
|
async _copyContent( cursor ) {
|
|
2547
2571
|
|
|
2548
|
-
let
|
|
2572
|
+
let textToCopy = "";
|
|
2549
2573
|
|
|
2550
2574
|
if( !cursor.selection )
|
|
2551
2575
|
{
|
|
2552
|
-
|
|
2576
|
+
textToCopy = "\n" + this.code.lines[ cursor.line ];
|
|
2553
2577
|
}
|
|
2554
2578
|
else
|
|
2555
2579
|
{
|
|
@@ -2569,27 +2593,30 @@ class CodeEditor {
|
|
|
2569
2593
|
const num_chars = cursor.selection.chars + ( cursor.selection.toY - cursor.selection.fromY ) * separator.length;
|
|
2570
2594
|
const text = code.substr( index, num_chars );
|
|
2571
2595
|
const lines = text.split( separator );
|
|
2572
|
-
|
|
2596
|
+
textToCopy = lines.join('\n');
|
|
2573
2597
|
}
|
|
2574
2598
|
|
|
2575
|
-
navigator.clipboard.writeText(
|
|
2599
|
+
navigator.clipboard.writeText( textToCopy );
|
|
2600
|
+
// .then(() => console.log("Successfully copied"), (err) => console.error("Error"));
|
|
2576
2601
|
}
|
|
2577
2602
|
|
|
2578
2603
|
async _cutContent( cursor ) {
|
|
2579
2604
|
|
|
2580
2605
|
let lidx = cursor.line;
|
|
2581
|
-
let
|
|
2606
|
+
let textToCut = "";
|
|
2582
2607
|
|
|
2583
2608
|
this._addUndoStep( cursor, true );
|
|
2584
2609
|
|
|
2585
2610
|
if( !cursor.selection )
|
|
2586
2611
|
{
|
|
2587
|
-
|
|
2612
|
+
textToCut = "\n" + this.code.lines[ cursor.line ];
|
|
2588
2613
|
this.code.lines.splice( lidx, 1 );
|
|
2589
2614
|
this.processLines();
|
|
2590
2615
|
this.resetCursorPos( CodeEditor.CURSOR_LEFT, cursor );
|
|
2591
2616
|
if( this.code.lines[ lidx ] == undefined )
|
|
2617
|
+
{
|
|
2592
2618
|
this.lineUp( cursor );
|
|
2619
|
+
}
|
|
2593
2620
|
}
|
|
2594
2621
|
else
|
|
2595
2622
|
{
|
|
@@ -2597,24 +2624,27 @@ class CodeEditor {
|
|
|
2597
2624
|
if( cursor.selection ) cursor.selection.invertIfNecessary();
|
|
2598
2625
|
|
|
2599
2626
|
const separator = "_NEWLINE_";
|
|
2600
|
-
let code = this.code.lines.join(separator);
|
|
2627
|
+
let code = this.code.lines.join( separator );
|
|
2601
2628
|
|
|
2602
2629
|
// Get linear start index
|
|
2603
2630
|
let index = 0;
|
|
2604
2631
|
|
|
2605
|
-
for(let i = 0; i <= cursor.selection.fromY; i++)
|
|
2632
|
+
for( let i = 0; i <= cursor.selection.fromY; i++ )
|
|
2633
|
+
{
|
|
2606
2634
|
index += (i == cursor.selection.fromY ? cursor.selection.fromX : this.code.lines[ i ].length);
|
|
2635
|
+
}
|
|
2607
2636
|
|
|
2608
2637
|
index += cursor.selection.fromY * separator.length;
|
|
2609
|
-
const
|
|
2610
|
-
const text = code.substr(index,
|
|
2611
|
-
const lines = text.split(separator);
|
|
2612
|
-
|
|
2638
|
+
const numChars = cursor.selection.chars + (cursor.selection.toY - cursor.selection.fromY) * separator.length;
|
|
2639
|
+
const text = code.substr( index, numChars );
|
|
2640
|
+
const lines = text.split( separator );
|
|
2641
|
+
textToCut = lines.join('\n');
|
|
2613
2642
|
|
|
2614
2643
|
this.deleteSelection( cursor );
|
|
2615
2644
|
}
|
|
2616
2645
|
|
|
2617
|
-
navigator.clipboard.writeText(
|
|
2646
|
+
navigator.clipboard.writeText( textToCut );
|
|
2647
|
+
// .then(() => console.log("Successfully cut"), (err) => console.error("Error"));
|
|
2618
2648
|
}
|
|
2619
2649
|
|
|
2620
2650
|
_duplicateLine( lidx, cursor ) {
|
|
@@ -2633,7 +2633,7 @@ class KeyFramesTimeline extends Timeline {
|
|
|
2633
2633
|
*
|
|
2634
2634
|
* @param {int} trackIdx
|
|
2635
2635
|
* @param {array} newValues array of values for each keyframe. It should be a flat array of size track.dim*numKeyframes. Check ADDKEY_VALUESINARRAYS flag
|
|
2636
|
-
* @param {array of numbers} newTimes
|
|
2636
|
+
* @param {array of numbers} newTimes must be ordered ascendently
|
|
2637
2637
|
* @param {number} timeOffset
|
|
2638
2638
|
* @param {int} flags
|
|
2639
2639
|
* KeyFramesTimeline.ADDKEY_VALUESINARRAYS: if set, newValues is an array of arrays, one for each entry [ [1,2,3], [5,6,7] ]. Times is still a flat array of values [ 0, 0.2 ]
|
|
@@ -2656,8 +2656,7 @@ class KeyFramesTimeline extends Timeline {
|
|
|
2656
2656
|
|
|
2657
2657
|
let newIdx = newTimes.length-1;
|
|
2658
2658
|
let oldIdx = trackTimes.length-1;
|
|
2659
|
-
|
|
2660
|
-
let t1 = performance.now();
|
|
2659
|
+
let resultIndices = [];
|
|
2661
2660
|
if ( KeyFramesTimeline.ADDKEY_VALUESINARRAYS & flags ){
|
|
2662
2661
|
|
|
2663
2662
|
for( let i = times.length-1; i > -1; --i ){
|
|
@@ -2672,6 +2671,8 @@ class KeyFramesTimeline extends Timeline {
|
|
|
2672
2671
|
track.hovered.splice(oldIdx+1, 0, false);
|
|
2673
2672
|
track.selected.splice(oldIdx+1, 0, false);
|
|
2674
2673
|
track.edited.splice(oldIdx+1, 0, true);
|
|
2674
|
+
|
|
2675
|
+
resultIndices.push(i);
|
|
2675
2676
|
continue;
|
|
2676
2677
|
}
|
|
2677
2678
|
|
|
@@ -2695,6 +2696,8 @@ class KeyFramesTimeline extends Timeline {
|
|
|
2695
2696
|
track.hovered.splice(oldIdx+1, 0, false);
|
|
2696
2697
|
track.selected.splice(oldIdx+1, 0, false);
|
|
2697
2698
|
track.edited.splice(oldIdx+1, 0, true);
|
|
2699
|
+
|
|
2700
|
+
resultIndices.push(i);
|
|
2698
2701
|
continue;
|
|
2699
2702
|
}
|
|
2700
2703
|
|
|
@@ -2715,8 +2718,11 @@ class KeyFramesTimeline extends Timeline {
|
|
|
2715
2718
|
this.setDuration(newTimes[newTimes.length - 1] + timeOffset);
|
|
2716
2719
|
}
|
|
2717
2720
|
|
|
2718
|
-
if(this.onUpdateTrack)
|
|
2721
|
+
if(this.onUpdateTrack){
|
|
2719
2722
|
this.onUpdateTrack( [trackIdx] );
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2725
|
+
return resultIndices;
|
|
2720
2726
|
}
|
|
2721
2727
|
|
|
2722
2728
|
deleteSelectedContent(skipCallback = false) {
|
|
@@ -3099,6 +3105,7 @@ class ClipsTimeline extends Timeline {
|
|
|
3099
3105
|
setAnimationClip( animation, needsToProcess ){
|
|
3100
3106
|
super.setAnimationClip(animation, needsToProcess);
|
|
3101
3107
|
this.changeSelectedItems();
|
|
3108
|
+
return this.animationClip;
|
|
3102
3109
|
}
|
|
3103
3110
|
|
|
3104
3111
|
// OVERRIDE
|
|
@@ -3297,10 +3304,10 @@ class ClipsTimeline extends Timeline {
|
|
|
3297
3304
|
const track = this.animationClip.tracks[this.lastClipsSelected[0][0]];
|
|
3298
3305
|
let clip = track.clips[this.lastClipsSelected[0][1]];
|
|
3299
3306
|
if( this.dragClipMode == "fadein" ) {
|
|
3300
|
-
clip.fadein = Math.min(Math.max(clip.fadein + delta, clip.start), clip.fadeout);
|
|
3307
|
+
clip.fadein = Math.min(Math.max(clip.fadein + delta, clip.start), clip.fadeout ?? (clip.start+clip.duration) );
|
|
3301
3308
|
}
|
|
3302
3309
|
else if( this.dragClipMode == "fadeout" ) {
|
|
3303
|
-
clip.fadeout = Math.max(Math.min(clip.fadeout + delta, clip.start+clip.duration), clip.fadein);
|
|
3310
|
+
clip.fadeout = Math.max(Math.min(clip.fadeout + delta, clip.start+clip.duration), clip.fadein ?? clip.start );
|
|
3304
3311
|
}
|
|
3305
3312
|
else if( this.dragClipMode == "duration" ) {
|
|
3306
3313
|
let duration = Math.max(0, clip.duration + delta);
|
|
@@ -3715,7 +3722,7 @@ class ClipsTimeline extends Timeline {
|
|
|
3715
3722
|
const fadeinX = this.pixelsPerSecond * (clip.fadein - clip.start);
|
|
3716
3723
|
ctx.roundRect(x, y + offset, fadeinX, trackHeight, {tl: 5, bl: 5, tr:0, br:0}, true);
|
|
3717
3724
|
}
|
|
3718
|
-
if ( clip.
|
|
3725
|
+
if ( clip.fadeout != undefined ){
|
|
3719
3726
|
const fadeoutX = this.pixelsPerSecond * (clip.start + clip.duration - (clip.fadeout));
|
|
3720
3727
|
ctx.roundRect( x + w - fadeoutX, y + offset, fadeoutX, trackHeight, {tl: 0, bl: 0, tr:5, br:5}, true);
|
|
3721
3728
|
}
|
package/build/lexgui.css
CHANGED
|
@@ -1889,7 +1889,7 @@ dialog .lexselect .lexselectoptions {
|
|
|
1889
1889
|
|
|
1890
1890
|
.lexselect .lexselectlabel {
|
|
1891
1891
|
width: 100%;
|
|
1892
|
-
color: var(--global-text-
|
|
1892
|
+
color: var(--global-text-tertiary);
|
|
1893
1893
|
padding-inline: 0.6rem;
|
|
1894
1894
|
padding-block: 0.2rem;
|
|
1895
1895
|
min-height: 20px;
|
|
@@ -2966,6 +2966,10 @@ meter:-moz-meter-sub-sub-optimum::-moz-meter-bar {
|
|
|
2966
2966
|
font-size: var(--global-font-size-lg);
|
|
2967
2967
|
}
|
|
2968
2968
|
|
|
2969
|
+
.lexmenubar .lexmenubuttons.left {
|
|
2970
|
+
margin-left: unset;
|
|
2971
|
+
}
|
|
2972
|
+
|
|
2969
2973
|
.lexmenubar .lexmenubuttons.right {
|
|
2970
2974
|
margin-left: unset;
|
|
2971
2975
|
margin-right: 12px;
|
|
@@ -3565,6 +3569,20 @@ meter:-moz-meter-sub-sub-optimum::-moz-meter-bar {
|
|
|
3565
3569
|
margin-right: 0px;
|
|
3566
3570
|
}
|
|
3567
3571
|
|
|
3572
|
+
.lexoverlayseparator {
|
|
3573
|
+
background-color: var(--global-color-tertiary);
|
|
3574
|
+
opacity: 0.9;
|
|
3575
|
+
width: 2px;
|
|
3576
|
+
height: calc(100% + 0.5em);
|
|
3577
|
+
margin-top: -0.25em;
|
|
3578
|
+
}
|
|
3579
|
+
|
|
3580
|
+
.lexoverlaybuttonscontainer.vertical .lexoverlayseparator {
|
|
3581
|
+
width: calc(100% + 0.5em);
|
|
3582
|
+
height: 2px;
|
|
3583
|
+
margin-left: -0.25em;
|
|
3584
|
+
}
|
|
3585
|
+
|
|
3568
3586
|
/* Area Tabs */
|
|
3569
3587
|
|
|
3570
3588
|
.lexareatabs {
|
|
@@ -3835,10 +3853,9 @@ meter:-moz-meter-sub-sub-optimum::-moz-meter-bar {
|
|
|
3835
3853
|
.lexwidget:has(.lextogglesubmenu),
|
|
3836
3854
|
.lexwidget:has(.lexcustomcontainer) {
|
|
3837
3855
|
border-radius: 6px;
|
|
3838
|
-
display: grid;
|
|
3839
|
-
grid-template-columns: repeat(2, 1fr);
|
|
3840
|
-
grid-template-rows: auto auto;
|
|
3841
3856
|
transition: background-color 0.2s ease-out;
|
|
3857
|
+
display: flex;
|
|
3858
|
+
flex-wrap: wrap;
|
|
3842
3859
|
}
|
|
3843
3860
|
|
|
3844
3861
|
.lexwidget:has(.lexarrayitems)[data-opened=true],
|
|
@@ -3995,6 +4012,11 @@ meter:-moz-meter-sub-sub-optimum::-moz-meter-bar {
|
|
|
3995
4012
|
align-content: center;
|
|
3996
4013
|
}
|
|
3997
4014
|
|
|
4015
|
+
.lextable td.empty-row {
|
|
4016
|
+
text-align: center;
|
|
4017
|
+
padding-block: 16px;
|
|
4018
|
+
}
|
|
4019
|
+
|
|
3998
4020
|
.lextable th {
|
|
3999
4021
|
--th-color: var(--global-text-secondary);
|
|
4000
4022
|
font-weight: 600;
|
|
@@ -4102,7 +4124,7 @@ meter:-moz-meter-sub-sub-optimum::-moz-meter-bar {
|
|
|
4102
4124
|
grid-column: span 2;
|
|
4103
4125
|
}
|
|
4104
4126
|
|
|
4105
|
-
.lexcustomcontainer span {
|
|
4127
|
+
.lexcustomcontainer button.custom span {
|
|
4106
4128
|
align-items: center;
|
|
4107
4129
|
display: flex;
|
|
4108
4130
|
justify-content: space-between;
|