lexgui 8.2.4 → 8.2.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/components/NodeTree.d.ts +51 -51
- package/build/core/Namespace.js +1 -1
- package/build/core/Namespace.js.map +1 -1
- package/build/extensions/AssetView.d.ts +138 -137
- package/build/extensions/AssetView.js +58 -29
- package/build/extensions/AssetView.js.map +1 -1
- package/build/extensions/CodeEditor.d.ts +363 -363
- package/build/extensions/CodeEditor.js +24 -23
- package/build/extensions/CodeEditor.js.map +1 -1
- package/build/extensions/DocMaker.d.ts +28 -28
- package/build/extensions/DocMaker.js +13 -4
- package/build/extensions/DocMaker.js.map +1 -1
- package/build/lexgui.all.js +129 -65
- package/build/lexgui.all.js.map +1 -1
- package/build/lexgui.all.min.js +1 -1
- package/build/lexgui.all.module.js +129 -65
- package/build/lexgui.all.module.js.map +1 -1
- package/build/lexgui.all.module.min.js +1 -1
- package/build/lexgui.css +7466 -7466
- package/build/lexgui.js +34 -9
- package/build/lexgui.js.map +1 -1
- package/build/lexgui.min.css +1 -1
- package/build/lexgui.min.js +1 -1
- package/build/lexgui.module.js +34 -9
- package/build/lexgui.module.js.map +1 -1
- package/build/lexgui.module.min.js +1 -1
- package/changelog.md +14 -1
- package/examples/asset-view.html +29 -2
- package/package.json +2 -1
|
@@ -20,7 +20,7 @@ function swapArrayElements(array, id0, id1) {
|
|
|
20
20
|
[array[id0], array[id1]] = [array[id1], array[id0]];
|
|
21
21
|
}
|
|
22
22
|
function sliceChars(str, idx, n = 1) {
|
|
23
|
-
return str.
|
|
23
|
+
return str.substring(0, idx) + str.substring(idx + n);
|
|
24
24
|
}
|
|
25
25
|
function firstNonspaceIndex(str) {
|
|
26
26
|
const index = str.search(/\S|$/);
|
|
@@ -265,7 +265,7 @@ const HighlightRules = {
|
|
|
265
265
|
common: [
|
|
266
266
|
{ test: (ctx) => ctx.inBlockComment, className: 'cm-com' },
|
|
267
267
|
{ test: (ctx) => ctx.inString, action: (ctx, editor) => editor._appendStringToken(ctx.token), discard: true },
|
|
268
|
-
{ test: (ctx) => ctx.token.
|
|
268
|
+
{ test: (ctx) => ctx.token.substring(0, ctx.singleLineCommentToken.length) == ctx.singleLineCommentToken, className: 'cm-com' },
|
|
269
269
|
{ test: (ctx, editor) => editor._isKeyword(ctx), className: 'cm-kwd' },
|
|
270
270
|
{
|
|
271
271
|
test: (ctx, editor) => editor._mustHightlightWord(ctx.token, CE.builtIn, ctx.lang) && (ctx.lang.tags ?? false
|
|
@@ -1031,8 +1031,8 @@ class CodeEditor {
|
|
|
1031
1031
|
var _c0 = this.getCharAtPos(cursor, -1);
|
|
1032
1032
|
var _c1 = this.getCharAtPos(cursor);
|
|
1033
1033
|
this.code.lines.splice(cursor.line + 1, 0, '');
|
|
1034
|
-
this.code.lines[cursor.line + 1] = this.code.lines[ln].
|
|
1035
|
-
this.code.lines[ln] = this.code.lines[ln].
|
|
1034
|
+
this.code.lines[cursor.line + 1] = this.code.lines[ln].substring(cursor.position); // new line (below)
|
|
1035
|
+
this.code.lines[ln] = this.code.lines[ln].substring(0, cursor.position); // line above
|
|
1036
1036
|
this.lineDown(cursor, true);
|
|
1037
1037
|
// Check indentation
|
|
1038
1038
|
var spaces = firstNonspaceIndex(this.code.lines[ln]);
|
|
@@ -1124,7 +1124,7 @@ class CodeEditor {
|
|
|
1124
1124
|
e.keepSelection = kS;
|
|
1125
1125
|
}
|
|
1126
1126
|
var diff = Math.max(cursor.position - from, 1);
|
|
1127
|
-
var substr = word.
|
|
1127
|
+
var substr = word.substring(0, diff);
|
|
1128
1128
|
// Selections...
|
|
1129
1129
|
if (e.shiftKey) {
|
|
1130
1130
|
if (!cursor.selection) {
|
|
@@ -1194,7 +1194,7 @@ class CodeEditor {
|
|
|
1194
1194
|
if (!word.length)
|
|
1195
1195
|
this.lineDown(cursor, true);
|
|
1196
1196
|
var diff = cursor.position - from;
|
|
1197
|
-
var substr = word.
|
|
1197
|
+
var substr = word.substring(diff);
|
|
1198
1198
|
// Selections...
|
|
1199
1199
|
if (e.shiftKey) {
|
|
1200
1200
|
if (!cursor.selection) {
|
|
@@ -1578,6 +1578,7 @@ class CodeEditor {
|
|
|
1578
1578
|
this._addRedoStep(cursor);
|
|
1579
1579
|
// Extract info from the last code state
|
|
1580
1580
|
const step = this.code.undoSteps.pop();
|
|
1581
|
+
debugger;
|
|
1581
1582
|
// Set old state lines
|
|
1582
1583
|
this.code.lines = step.lines;
|
|
1583
1584
|
this.processLines();
|
|
@@ -2193,9 +2194,9 @@ class CodeEditor {
|
|
|
2193
2194
|
index += i == cursor.selection.fromY ? cursor.selection.fromX : this.code.lines[i].length;
|
|
2194
2195
|
}
|
|
2195
2196
|
index += cursor.selection.fromY * separator.length;
|
|
2196
|
-
const
|
|
2197
|
+
const numChars = cursor.selection.chars
|
|
2197
2198
|
+ (cursor.selection.toY - cursor.selection.fromY) * separator.length;
|
|
2198
|
-
const text = code.
|
|
2199
|
+
const text = code.substring(index, index + numChars);
|
|
2199
2200
|
content = text.split(separator).join('\n');
|
|
2200
2201
|
}
|
|
2201
2202
|
const options = this.onContextMenu(this, content, e);
|
|
@@ -2340,7 +2341,7 @@ class CodeEditor {
|
|
|
2340
2341
|
: this.code.lines[i].substring(toX, fromX);
|
|
2341
2342
|
}
|
|
2342
2343
|
else
|
|
2343
|
-
string = this.code.lines[i].
|
|
2344
|
+
string = this.code.lines[i].substring(fromX);
|
|
2344
2345
|
const pixels = (reverse && deltaY == 0 ? toX : fromX) * this.charWidth;
|
|
2345
2346
|
if (isVisible)
|
|
2346
2347
|
domEl.style.left = `calc(${pixels}px + ${this.xPadding})`;
|
|
@@ -2380,7 +2381,7 @@ class CodeEditor {
|
|
|
2380
2381
|
// Compute new width and selection margins
|
|
2381
2382
|
let string;
|
|
2382
2383
|
if (sId == 0) {
|
|
2383
|
-
string = this.code.lines[i].
|
|
2384
|
+
string = this.code.lines[i].substring(toX);
|
|
2384
2385
|
const pixels = toX * this.charWidth;
|
|
2385
2386
|
if (isVisible)
|
|
2386
2387
|
domEl.style.left = 'calc(' + pixels + 'px + ' + this.xPadding + ')';
|
|
@@ -2707,9 +2708,9 @@ class CodeEditor {
|
|
|
2707
2708
|
index += i == cursor.selection.fromY ? cursor.selection.fromX : this.code.lines[i].length;
|
|
2708
2709
|
}
|
|
2709
2710
|
index += cursor.selection.fromY * separator.length;
|
|
2710
|
-
const
|
|
2711
|
+
const numChars = cursor.selection.chars
|
|
2711
2712
|
+ (cursor.selection.toY - cursor.selection.fromY) * separator.length;
|
|
2712
|
-
const text = code.
|
|
2713
|
+
const text = code.substring(index, index + numChars);
|
|
2713
2714
|
const lines = text.split(separator);
|
|
2714
2715
|
textToCopy = lines.join('\n');
|
|
2715
2716
|
}
|
|
@@ -2743,7 +2744,7 @@ class CodeEditor {
|
|
|
2743
2744
|
index += cursor.selection.fromY * separator.length;
|
|
2744
2745
|
const numChars = cursor.selection.chars
|
|
2745
2746
|
+ (cursor.selection.toY - cursor.selection.fromY) * separator.length;
|
|
2746
|
-
const text = code.
|
|
2747
|
+
const text = code.substring(index, index + numChars);
|
|
2747
2748
|
const lines = text.split(separator);
|
|
2748
2749
|
textToCut = lines.join('\n');
|
|
2749
2750
|
this.deleteSelection(cursor);
|
|
@@ -3024,7 +3025,7 @@ class CodeEditor {
|
|
|
3024
3025
|
tokens: tokensToEvaluate
|
|
3025
3026
|
});
|
|
3026
3027
|
if (blockComments && this._buildingBlockComment != undefined
|
|
3027
|
-
&& token.
|
|
3028
|
+
&& token.substring(0, blockCommentsTokens[1].length) == blockCommentsTokens[1]) {
|
|
3028
3029
|
const [commentLineNumber, tokenPos] = this._buildingBlockComment;
|
|
3029
3030
|
this._blockCommentCache.push([new LX.vec2(commentLineNumber, lineNumber), new LX.vec2(tokenPos, tokenStartIndex)]);
|
|
3030
3031
|
delete this._buildingBlockComment;
|
|
@@ -3047,10 +3048,10 @@ class CodeEditor {
|
|
|
3047
3048
|
const openIdx = kLineString.lastIndexOf('{');
|
|
3048
3049
|
const closeIdx = kLineString.lastIndexOf('}');
|
|
3049
3050
|
if (openIdx > -1) {
|
|
3050
|
-
kLineString = kLineString.
|
|
3051
|
+
kLineString = kLineString.substring(openIdx);
|
|
3051
3052
|
}
|
|
3052
3053
|
else if (closeIdx > -1) {
|
|
3053
|
-
kLineString = kLineString.
|
|
3054
|
+
kLineString = kLineString.substring(closeIdx);
|
|
3054
3055
|
}
|
|
3055
3056
|
contextTokens = [...this._getTokensFromLine(kLineString), ...contextTokens];
|
|
3056
3057
|
if (kLineString.length !== this.code.lines[lineNumber - k]) {
|
|
@@ -3113,7 +3114,7 @@ class CodeEditor {
|
|
|
3113
3114
|
until reaching new delimiters
|
|
3114
3115
|
*/
|
|
3115
3116
|
if (lineOpensBlock) {
|
|
3116
|
-
const r = tokens.filter((t) => t.
|
|
3117
|
+
const r = tokens.filter((t) => t.substring(0, blockCommentsTokens[0].length) == blockCommentsTokens[0]);
|
|
3117
3118
|
if (!r.length) {
|
|
3118
3119
|
this._buildingBlockComment = [lineNumber - 1, 0];
|
|
3119
3120
|
this.mustProcessPreviousLine = (tokens) => {
|
|
@@ -3135,7 +3136,7 @@ class CodeEditor {
|
|
|
3135
3136
|
}
|
|
3136
3137
|
}
|
|
3137
3138
|
else if (lineClosesBlock) {
|
|
3138
|
-
const r = tokens.filter((t) => t.
|
|
3139
|
+
const r = tokens.filter((t) => t.substring(0, blockCommentsTokens[1].length) == blockCommentsTokens[1]);
|
|
3139
3140
|
if (!r.length) {
|
|
3140
3141
|
this._buildingBlockComment = [section[0].x, section[1].x];
|
|
3141
3142
|
this.mustProcessNextLine = (tokens) => {
|
|
@@ -3910,9 +3911,9 @@ class CodeEditor {
|
|
|
3910
3911
|
index += i == selection.fromY ? selection.fromX : this.code.lines[i].length;
|
|
3911
3912
|
}
|
|
3912
3913
|
index += selection.fromY * separator.length;
|
|
3913
|
-
const
|
|
3914
|
+
const numChars = selection.chars + (selection.toY - selection.fromY) * separator.length;
|
|
3914
3915
|
const pre = code.slice(0, index);
|
|
3915
|
-
const post = code.slice(index +
|
|
3916
|
+
const post = code.slice(index + numChars);
|
|
3916
3917
|
this.code.lines = (pre + post).split(separator);
|
|
3917
3918
|
this.cursorToLine(cursor, selection.fromY, true);
|
|
3918
3919
|
this.cursorToPosition(cursor, selection.fromX);
|
|
@@ -4558,7 +4559,7 @@ class CodeEditor {
|
|
|
4558
4559
|
preWord.innerHTML = currSuggestion.substring(0, index);
|
|
4559
4560
|
pre.appendChild(preWord);
|
|
4560
4561
|
var actualWord = document.createElement('span');
|
|
4561
|
-
actualWord.innerHTML = currSuggestion.
|
|
4562
|
+
actualWord.innerHTML = currSuggestion.substring(index, index + word.length);
|
|
4562
4563
|
actualWord.classList.add('word-highlight');
|
|
4563
4564
|
pre.appendChild(actualWord);
|
|
4564
4565
|
var postWord = document.createElement('span');
|
|
@@ -4699,13 +4700,13 @@ class CodeEditor {
|
|
|
4699
4700
|
const getIndex = (l) => {
|
|
4700
4701
|
var string = this.code.lines[l];
|
|
4701
4702
|
if (reverse) {
|
|
4702
|
-
string = string.
|
|
4703
|
+
string = string.substring(0, l == cursorData.y ? cursorData.x : string.length);
|
|
4703
4704
|
var reversed = strReverse(string);
|
|
4704
4705
|
var reversedIdx = reversed.indexOf(strReverse(text));
|
|
4705
4706
|
return reversedIdx == -1 ? -1 : string.length - reversedIdx - text.length;
|
|
4706
4707
|
}
|
|
4707
4708
|
else {
|
|
4708
|
-
return string.
|
|
4709
|
+
return string.substring(l == cursorData.y ? cursorData.x : 0).indexOf(text);
|
|
4709
4710
|
}
|
|
4710
4711
|
};
|
|
4711
4712
|
if (reverse) {
|