@opentui/core 0.0.0-20251202-52296102 → 0.0.0-20251208-bec95e7d
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/3d.js +3 -5
- package/3d.js.map +2 -2
- package/Renderable.d.ts +2 -1
- package/{index-re80811e.js → index-crebvcxc.js} +1801 -1307
- package/index-crebvcxc.js.map +59 -0
- package/index.d.ts +1 -1
- package/index.js +265 -93
- package/index.js.map +13 -13
- package/lib/bunfs.d.ts +7 -0
- package/lib/keymapping.d.ts +4 -1
- package/lib/yoga.options.d.ts +1 -1
- package/package.json +9 -9
- package/parser.worker.js +17 -3
- package/parser.worker.js.map +6 -5
- package/renderables/Diff.d.ts +4 -0
- package/renderables/Input.d.ts +10 -0
- package/renderables/Select.d.ts +10 -0
- package/renderables/TabSelect.d.ts +10 -0
- package/renderables/Textarea.d.ts +5 -1
- package/renderer.d.ts +19 -0
- package/testing/mock-keys.d.ts +12 -0
- package/testing/test-recorder.d.ts +44 -0
- package/testing.d.ts +1 -0
- package/testing.js +69 -4
- package/testing.js.map +6 -5
- package/index-g8dczzvv.js +0 -33
- package/index-g8dczzvv.js.map +0 -9
- package/index-re80811e.js.map +0 -55
- package/libyoga-2ksztx35.dylib +0 -0
- package/libyoga-gh2tjwb7.so +0 -0
- package/libyoga-j5nt7np1.dylib +0 -0
- package/libyoga-jjdjx62k.js +0 -11
- package/libyoga-jjdjx62k.js.map +0 -9
- package/libyoga-jkq1dr7g.js +0 -11
- package/libyoga-jkq1dr7g.js.map +0 -9
- package/libyoga-m7gmcz0e.js +0 -11
- package/libyoga-m7gmcz0e.js.map +0 -9
- package/libyoga-wnbqxxhv.so +0 -0
- package/libyoga-zt51h244.js +0 -11
- package/libyoga-zt51h244.js.map +0 -9
- package/yoga-jkgc6c1f.dll +0 -0
- package/yoga-merwjcba.js +0 -11
- package/yoga-merwjcba.js.map +0 -9
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
dim,
|
|
75
75
|
env,
|
|
76
76
|
envRegistry,
|
|
77
|
-
|
|
77
|
+
exports_src,
|
|
78
78
|
extToFiletype,
|
|
79
79
|
fg,
|
|
80
80
|
fonts,
|
|
@@ -137,8 +137,7 @@ import {
|
|
|
137
137
|
white,
|
|
138
138
|
wrapWithDelegates,
|
|
139
139
|
yellow
|
|
140
|
-
} from "./index-
|
|
141
|
-
import"./index-g8dczzvv.js";
|
|
140
|
+
} from "./index-crebvcxc.js";
|
|
142
141
|
// src/text-buffer-view.ts
|
|
143
142
|
class TextBufferView {
|
|
144
143
|
lib;
|
|
@@ -4574,6 +4573,7 @@ class DiffRenderable extends Renderable {
|
|
|
4574
4573
|
_view;
|
|
4575
4574
|
_parsedDiff = null;
|
|
4576
4575
|
_parseError = null;
|
|
4576
|
+
_fg;
|
|
4577
4577
|
_filetype;
|
|
4578
4578
|
_syntaxStyle;
|
|
4579
4579
|
_wrapMode;
|
|
@@ -4611,6 +4611,7 @@ class DiffRenderable extends Renderable {
|
|
|
4611
4611
|
});
|
|
4612
4612
|
this._diff = options.diff ?? "";
|
|
4613
4613
|
this._view = options.view ?? "unified";
|
|
4614
|
+
this._fg = options.fg ? parseColor(options.fg) : undefined;
|
|
4614
4615
|
this._filetype = options.filetype;
|
|
4615
4616
|
this._syntaxStyle = options.syntaxStyle;
|
|
4616
4617
|
this._wrapMode = options.wrapMode;
|
|
@@ -4771,6 +4772,7 @@ class DiffRenderable extends Renderable {
|
|
|
4771
4772
|
syntaxStyle: this._syntaxStyle ?? SyntaxStyle.create(),
|
|
4772
4773
|
width: "100%",
|
|
4773
4774
|
height: "100%",
|
|
4775
|
+
...this._fg !== undefined && { fg: this._fg },
|
|
4774
4776
|
...drawUnstyledText !== undefined && { drawUnstyledText },
|
|
4775
4777
|
...this._selectionBg !== undefined && { selectionBg: this._selectionBg },
|
|
4776
4778
|
...this._selectionFg !== undefined && { selectionFg: this._selectionFg },
|
|
@@ -4802,6 +4804,9 @@ class DiffRenderable extends Renderable {
|
|
|
4802
4804
|
if (this._selectionFg !== undefined) {
|
|
4803
4805
|
existingRenderable.selectionFg = this._selectionFg;
|
|
4804
4806
|
}
|
|
4807
|
+
if (this._fg !== undefined) {
|
|
4808
|
+
existingRenderable.fg = this._fg;
|
|
4809
|
+
}
|
|
4805
4810
|
return existingRenderable;
|
|
4806
4811
|
}
|
|
4807
4812
|
}
|
|
@@ -5413,8 +5418,78 @@ class DiffRenderable extends Renderable {
|
|
|
5413
5418
|
this.rebuildView();
|
|
5414
5419
|
}
|
|
5415
5420
|
}
|
|
5421
|
+
get fg() {
|
|
5422
|
+
return this._fg;
|
|
5423
|
+
}
|
|
5424
|
+
set fg(value) {
|
|
5425
|
+
const parsed = value ? parseColor(value) : undefined;
|
|
5426
|
+
if (this._fg !== parsed) {
|
|
5427
|
+
this._fg = parsed;
|
|
5428
|
+
if (this.leftCodeRenderable) {
|
|
5429
|
+
this.leftCodeRenderable.fg = parsed;
|
|
5430
|
+
}
|
|
5431
|
+
if (this.rightCodeRenderable) {
|
|
5432
|
+
this.rightCodeRenderable.fg = parsed;
|
|
5433
|
+
}
|
|
5434
|
+
}
|
|
5435
|
+
}
|
|
5436
|
+
}
|
|
5437
|
+
// src/lib/keymapping.ts
|
|
5438
|
+
var defaultKeyAliases = {
|
|
5439
|
+
enter: "return",
|
|
5440
|
+
esc: "escape"
|
|
5441
|
+
};
|
|
5442
|
+
function mergeKeyAliases(defaults, custom) {
|
|
5443
|
+
return { ...defaults, ...custom };
|
|
5444
|
+
}
|
|
5445
|
+
function mergeKeyBindings(defaults, custom) {
|
|
5446
|
+
const map = new Map;
|
|
5447
|
+
for (const binding of defaults) {
|
|
5448
|
+
const key = getKeyBindingKey(binding);
|
|
5449
|
+
map.set(key, binding);
|
|
5450
|
+
}
|
|
5451
|
+
for (const binding of custom) {
|
|
5452
|
+
const key = getKeyBindingKey(binding);
|
|
5453
|
+
map.set(key, binding);
|
|
5454
|
+
}
|
|
5455
|
+
return Array.from(map.values());
|
|
5456
|
+
}
|
|
5457
|
+
function getKeyBindingKey(binding) {
|
|
5458
|
+
return `${binding.name}:${binding.ctrl ? 1 : 0}:${binding.shift ? 1 : 0}:${binding.meta ? 1 : 0}:${binding.super ? 1 : 0}`;
|
|
5459
|
+
}
|
|
5460
|
+
function buildKeyBindingsMap(bindings, aliasMap) {
|
|
5461
|
+
const map = new Map;
|
|
5462
|
+
const aliases = aliasMap || {};
|
|
5463
|
+
for (const binding of bindings) {
|
|
5464
|
+
const key = getKeyBindingKey(binding);
|
|
5465
|
+
map.set(key, binding.action);
|
|
5466
|
+
}
|
|
5467
|
+
for (const binding of bindings) {
|
|
5468
|
+
const normalizedName = aliases[binding.name] || binding.name;
|
|
5469
|
+
if (normalizedName !== binding.name) {
|
|
5470
|
+
const aliasedKey = getKeyBindingKey({ ...binding, name: normalizedName });
|
|
5471
|
+
map.set(aliasedKey, binding.action);
|
|
5472
|
+
}
|
|
5473
|
+
}
|
|
5474
|
+
return map;
|
|
5416
5475
|
}
|
|
5476
|
+
|
|
5417
5477
|
// src/renderables/Input.ts
|
|
5478
|
+
var defaultInputKeybindings = [
|
|
5479
|
+
{ name: "left", action: "move-left" },
|
|
5480
|
+
{ name: "right", action: "move-right" },
|
|
5481
|
+
{ name: "home", action: "move-home" },
|
|
5482
|
+
{ name: "end", action: "move-end" },
|
|
5483
|
+
{ name: "backspace", action: "delete-backward" },
|
|
5484
|
+
{ name: "delete", action: "delete-forward" },
|
|
5485
|
+
{ name: "return", action: "submit" },
|
|
5486
|
+
{ name: "linefeed", action: "submit" },
|
|
5487
|
+
{ name: "a", ctrl: true, action: "move-home" },
|
|
5488
|
+
{ name: "e", ctrl: true, action: "move-end" },
|
|
5489
|
+
{ name: "f", ctrl: true, action: "move-right" },
|
|
5490
|
+
{ name: "b", ctrl: true, action: "move-left" },
|
|
5491
|
+
{ name: "d", ctrl: true, action: "delete-forward" }
|
|
5492
|
+
];
|
|
5418
5493
|
var InputRenderableEvents;
|
|
5419
5494
|
((InputRenderableEvents2) => {
|
|
5420
5495
|
InputRenderableEvents2["INPUT"] = "input";
|
|
@@ -5436,6 +5511,9 @@ class InputRenderable extends Renderable {
|
|
|
5436
5511
|
_cursorStyle;
|
|
5437
5512
|
_maxLength;
|
|
5438
5513
|
_lastCommittedValue = "";
|
|
5514
|
+
_keyBindingsMap;
|
|
5515
|
+
_keyAliasMap;
|
|
5516
|
+
_keyBindings;
|
|
5439
5517
|
_defaultOptions = {
|
|
5440
5518
|
backgroundColor: "transparent",
|
|
5441
5519
|
textColor: "#FFFFFF",
|
|
@@ -5465,6 +5543,10 @@ class InputRenderable extends Renderable {
|
|
|
5465
5543
|
this._placeholderColor = parseColor(options.placeholderColor || this._defaultOptions.placeholderColor);
|
|
5466
5544
|
this._cursorColor = parseColor(options.cursorColor || this._defaultOptions.cursorColor);
|
|
5467
5545
|
this._cursorStyle = options.cursorStyle || this._defaultOptions.cursorStyle;
|
|
5546
|
+
this._keyAliasMap = mergeKeyAliases(defaultKeyAliases, options.keyAliasMap || {});
|
|
5547
|
+
this._keyBindings = options.keyBindings || [];
|
|
5548
|
+
const mergedBindings = mergeKeyBindings(defaultInputKeybindings, this._keyBindings);
|
|
5549
|
+
this._keyBindingsMap = buildKeyBindingsMap(mergedBindings, this._keyAliasMap);
|
|
5468
5550
|
}
|
|
5469
5551
|
updateCursorPosition() {
|
|
5470
5552
|
if (!this._focused)
|
|
@@ -5595,39 +5677,52 @@ class InputRenderable extends Renderable {
|
|
|
5595
5677
|
handleKeyPress(key) {
|
|
5596
5678
|
const keyName = typeof key === "string" ? key : key.name;
|
|
5597
5679
|
const keySequence = typeof key === "string" ? key : key.sequence;
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
return true;
|
|
5617
|
-
case "return":
|
|
5618
|
-
case "linefeed":
|
|
5619
|
-
if (this._value !== this._lastCommittedValue) {
|
|
5620
|
-
this._lastCommittedValue = this._value;
|
|
5621
|
-
this.emit("change" /* CHANGE */, this._value);
|
|
5622
|
-
}
|
|
5623
|
-
this.emit("enter" /* ENTER */, this._value);
|
|
5624
|
-
return true;
|
|
5625
|
-
default:
|
|
5626
|
-
if (keySequence && keySequence.length === 1 && keySequence.charCodeAt(0) >= 32 && keySequence.charCodeAt(0) <= 126) {
|
|
5627
|
-
this.insertText(keySequence);
|
|
5680
|
+
const keyCtrl = typeof key === "string" ? false : key.ctrl;
|
|
5681
|
+
const keyShift = typeof key === "string" ? false : key.shift;
|
|
5682
|
+
const keyMeta = typeof key === "string" ? false : key.meta;
|
|
5683
|
+
const keySuper = typeof key === "string" ? false : key.super;
|
|
5684
|
+
const keyHyper = typeof key === "string" ? false : key.hyper;
|
|
5685
|
+
const bindingKey = getKeyBindingKey({
|
|
5686
|
+
name: keyName,
|
|
5687
|
+
ctrl: keyCtrl,
|
|
5688
|
+
shift: keyShift,
|
|
5689
|
+
meta: keyMeta,
|
|
5690
|
+
super: keySuper,
|
|
5691
|
+
action: "move-left"
|
|
5692
|
+
});
|
|
5693
|
+
const action = this._keyBindingsMap.get(bindingKey);
|
|
5694
|
+
if (action) {
|
|
5695
|
+
switch (action) {
|
|
5696
|
+
case "move-left":
|
|
5697
|
+
this.cursorPosition = this._cursorPosition - 1;
|
|
5628
5698
|
return true;
|
|
5629
|
-
|
|
5630
|
-
|
|
5699
|
+
case "move-right":
|
|
5700
|
+
this.cursorPosition = this._cursorPosition + 1;
|
|
5701
|
+
return true;
|
|
5702
|
+
case "move-home":
|
|
5703
|
+
this.cursorPosition = 0;
|
|
5704
|
+
return true;
|
|
5705
|
+
case "move-end":
|
|
5706
|
+
this.cursorPosition = this._value.length;
|
|
5707
|
+
return true;
|
|
5708
|
+
case "delete-backward":
|
|
5709
|
+
this.deleteCharacter("backward");
|
|
5710
|
+
return true;
|
|
5711
|
+
case "delete-forward":
|
|
5712
|
+
this.deleteCharacter("forward");
|
|
5713
|
+
return true;
|
|
5714
|
+
case "submit":
|
|
5715
|
+
if (this._value !== this._lastCommittedValue) {
|
|
5716
|
+
this._lastCommittedValue = this._value;
|
|
5717
|
+
this.emit("change" /* CHANGE */, this._value);
|
|
5718
|
+
}
|
|
5719
|
+
this.emit("enter" /* ENTER */, this._value);
|
|
5720
|
+
return true;
|
|
5721
|
+
}
|
|
5722
|
+
}
|
|
5723
|
+
if (keySequence && keySequence.length === 1 && keySequence.charCodeAt(0) >= 32 && keySequence.charCodeAt(0) <= 126 && !keyCtrl && !keyMeta && !keySuper && !keyHyper) {
|
|
5724
|
+
this.insertText(keySequence);
|
|
5725
|
+
return true;
|
|
5631
5726
|
}
|
|
5632
5727
|
return false;
|
|
5633
5728
|
}
|
|
@@ -5707,6 +5802,16 @@ class InputRenderable extends Renderable {
|
|
|
5707
5802
|
this._ctx.setCursorPosition(0, 0, false);
|
|
5708
5803
|
}
|
|
5709
5804
|
}
|
|
5805
|
+
set keyBindings(bindings) {
|
|
5806
|
+
this._keyBindings = bindings;
|
|
5807
|
+
const mergedBindings = mergeKeyBindings(defaultInputKeybindings, bindings);
|
|
5808
|
+
this._keyBindingsMap = buildKeyBindingsMap(mergedBindings, this._keyAliasMap);
|
|
5809
|
+
}
|
|
5810
|
+
set keyAliasMap(aliases) {
|
|
5811
|
+
this._keyAliasMap = mergeKeyAliases(defaultKeyAliases, aliases);
|
|
5812
|
+
const mergedBindings = mergeKeyBindings(defaultInputKeybindings, this._keyBindings);
|
|
5813
|
+
this._keyBindingsMap = buildKeyBindingsMap(mergedBindings, this._keyAliasMap);
|
|
5814
|
+
}
|
|
5710
5815
|
}
|
|
5711
5816
|
// src/renderables/Slider.ts
|
|
5712
5817
|
var defaultThumbBackgroundColor = RGBA.fromHex("#9a9ea3");
|
|
@@ -6859,6 +6964,16 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
6859
6964
|
}
|
|
6860
6965
|
}
|
|
6861
6966
|
// src/renderables/Select.ts
|
|
6967
|
+
var defaultSelectKeybindings = [
|
|
6968
|
+
{ name: "up", action: "move-up" },
|
|
6969
|
+
{ name: "k", action: "move-up" },
|
|
6970
|
+
{ name: "down", action: "move-down" },
|
|
6971
|
+
{ name: "j", action: "move-down" },
|
|
6972
|
+
{ name: "up", shift: true, action: "move-up-fast" },
|
|
6973
|
+
{ name: "down", shift: true, action: "move-down-fast" },
|
|
6974
|
+
{ name: "return", action: "select-current" },
|
|
6975
|
+
{ name: "linefeed", action: "select-current" }
|
|
6976
|
+
];
|
|
6862
6977
|
var SelectRenderableEvents;
|
|
6863
6978
|
((SelectRenderableEvents2) => {
|
|
6864
6979
|
SelectRenderableEvents2["SELECTION_CHANGED"] = "selectionChanged";
|
|
@@ -6887,6 +7002,9 @@ class SelectRenderable extends Renderable {
|
|
|
6887
7002
|
linesPerItem;
|
|
6888
7003
|
fontHeight;
|
|
6889
7004
|
_fastScrollStep;
|
|
7005
|
+
_keyBindingsMap;
|
|
7006
|
+
_keyAliasMap;
|
|
7007
|
+
_keyBindings;
|
|
6890
7008
|
_defaultOptions = {
|
|
6891
7009
|
backgroundColor: "transparent",
|
|
6892
7010
|
textColor: "#FFFFFF",
|
|
@@ -6926,6 +7044,10 @@ class SelectRenderable extends Renderable {
|
|
|
6926
7044
|
this._descriptionColor = parseColor(options.descriptionColor || this._defaultOptions.descriptionColor);
|
|
6927
7045
|
this._selectedDescriptionColor = parseColor(options.selectedDescriptionColor || this._defaultOptions.selectedDescriptionColor);
|
|
6928
7046
|
this._fastScrollStep = options.fastScrollStep || this._defaultOptions.fastScrollStep;
|
|
7047
|
+
this._keyAliasMap = mergeKeyAliases(defaultKeyAliases, options.keyAliasMap || {});
|
|
7048
|
+
this._keyBindings = options.keyBindings || [];
|
|
7049
|
+
const mergedBindings = mergeKeyBindings(defaultSelectKeybindings, this._keyBindings);
|
|
7050
|
+
this._keyBindingsMap = buildKeyBindingsMap(mergedBindings, this._keyAliasMap);
|
|
6929
7051
|
this.requestRender();
|
|
6930
7052
|
}
|
|
6931
7053
|
renderSelf(buffer, deltaTime) {
|
|
@@ -7066,20 +7188,37 @@ class SelectRenderable extends Renderable {
|
|
|
7066
7188
|
}
|
|
7067
7189
|
handleKeyPress(key) {
|
|
7068
7190
|
const keyName = typeof key === "string" ? key : key.name;
|
|
7069
|
-
const
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7191
|
+
const keyCtrl = typeof key === "string" ? false : key.ctrl;
|
|
7192
|
+
const keyShift = typeof key === "string" ? false : key.shift;
|
|
7193
|
+
const keyMeta = typeof key === "string" ? false : key.meta;
|
|
7194
|
+
const keySuper = typeof key === "string" ? false : key.super;
|
|
7195
|
+
const bindingKey = getKeyBindingKey({
|
|
7196
|
+
name: keyName,
|
|
7197
|
+
ctrl: keyCtrl,
|
|
7198
|
+
shift: keyShift,
|
|
7199
|
+
meta: keyMeta,
|
|
7200
|
+
super: keySuper,
|
|
7201
|
+
action: "move-up"
|
|
7202
|
+
});
|
|
7203
|
+
const action = this._keyBindingsMap.get(bindingKey);
|
|
7204
|
+
if (action) {
|
|
7205
|
+
switch (action) {
|
|
7206
|
+
case "move-up":
|
|
7207
|
+
this.moveUp(1);
|
|
7208
|
+
return true;
|
|
7209
|
+
case "move-down":
|
|
7210
|
+
this.moveDown(1);
|
|
7211
|
+
return true;
|
|
7212
|
+
case "move-up-fast":
|
|
7213
|
+
this.moveUp(this._fastScrollStep);
|
|
7214
|
+
return true;
|
|
7215
|
+
case "move-down-fast":
|
|
7216
|
+
this.moveDown(this._fastScrollStep);
|
|
7217
|
+
return true;
|
|
7218
|
+
case "select-current":
|
|
7219
|
+
this.selectCurrent();
|
|
7220
|
+
return true;
|
|
7221
|
+
}
|
|
7083
7222
|
}
|
|
7084
7223
|
return false;
|
|
7085
7224
|
}
|
|
@@ -7185,6 +7324,16 @@ class SelectRenderable extends Renderable {
|
|
|
7185
7324
|
set fastScrollStep(step) {
|
|
7186
7325
|
this._fastScrollStep = step;
|
|
7187
7326
|
}
|
|
7327
|
+
set keyBindings(bindings) {
|
|
7328
|
+
this._keyBindings = bindings;
|
|
7329
|
+
const mergedBindings = mergeKeyBindings(defaultSelectKeybindings, bindings);
|
|
7330
|
+
this._keyBindingsMap = buildKeyBindingsMap(mergedBindings, this._keyAliasMap);
|
|
7331
|
+
}
|
|
7332
|
+
set keyAliasMap(aliases) {
|
|
7333
|
+
this._keyAliasMap = mergeKeyAliases(defaultKeyAliases, aliases);
|
|
7334
|
+
const mergedBindings = mergeKeyBindings(defaultSelectKeybindings, this._keyBindings);
|
|
7335
|
+
this._keyBindingsMap = buildKeyBindingsMap(mergedBindings, this._keyAliasMap);
|
|
7336
|
+
}
|
|
7188
7337
|
set selectedIndex(value) {
|
|
7189
7338
|
const newIndex = value ?? this._defaultOptions.selectedIndex;
|
|
7190
7339
|
const clampedIndex = this._options.length > 0 ? Math.min(Math.max(0, newIndex), this._options.length - 1) : 0;
|
|
@@ -7196,6 +7345,14 @@ class SelectRenderable extends Renderable {
|
|
|
7196
7345
|
}
|
|
7197
7346
|
}
|
|
7198
7347
|
// src/renderables/TabSelect.ts
|
|
7348
|
+
var defaultTabSelectKeybindings = [
|
|
7349
|
+
{ name: "left", action: "move-left" },
|
|
7350
|
+
{ name: "[", action: "move-left" },
|
|
7351
|
+
{ name: "right", action: "move-right" },
|
|
7352
|
+
{ name: "]", action: "move-right" },
|
|
7353
|
+
{ name: "return", action: "select-current" },
|
|
7354
|
+
{ name: "linefeed", action: "select-current" }
|
|
7355
|
+
];
|
|
7199
7356
|
var TabSelectRenderableEvents;
|
|
7200
7357
|
((TabSelectRenderableEvents2) => {
|
|
7201
7358
|
TabSelectRenderableEvents2["SELECTION_CHANGED"] = "selectionChanged";
|
|
@@ -7230,6 +7387,9 @@ class TabSelectRenderable extends Renderable {
|
|
|
7230
7387
|
_showDescription;
|
|
7231
7388
|
_showUnderline;
|
|
7232
7389
|
_wrapSelection;
|
|
7390
|
+
_keyBindingsMap;
|
|
7391
|
+
_keyAliasMap;
|
|
7392
|
+
_keyBindings;
|
|
7233
7393
|
constructor(ctx, options) {
|
|
7234
7394
|
const calculatedHeight = calculateDynamicHeight(options.showUnderline ?? true, options.showDescription ?? true);
|
|
7235
7395
|
super(ctx, { ...options, height: calculatedHeight, buffered: true });
|
|
@@ -7247,6 +7407,10 @@ class TabSelectRenderable extends Renderable {
|
|
|
7247
7407
|
this._selectedBackgroundColor = parseColor(options.selectedBackgroundColor || "#334455");
|
|
7248
7408
|
this._selectedTextColor = parseColor(options.selectedTextColor || "#FFFF00");
|
|
7249
7409
|
this._selectedDescriptionColor = parseColor(options.selectedDescriptionColor || "#CCCCCC");
|
|
7410
|
+
this._keyAliasMap = mergeKeyAliases(defaultKeyAliases, options.keyAliasMap || {});
|
|
7411
|
+
this._keyBindings = options.keyBindings || [];
|
|
7412
|
+
const mergedBindings = mergeKeyBindings(defaultTabSelectKeybindings, this._keyBindings);
|
|
7413
|
+
this._keyBindingsMap = buildKeyBindingsMap(mergedBindings, this._keyAliasMap);
|
|
7250
7414
|
}
|
|
7251
7415
|
calculateDynamicHeight() {
|
|
7252
7416
|
return calculateDynamicHeight(this._showUnderline, this._showDescription);
|
|
@@ -7397,19 +7561,31 @@ class TabSelectRenderable extends Renderable {
|
|
|
7397
7561
|
}
|
|
7398
7562
|
handleKeyPress(key) {
|
|
7399
7563
|
const keyName = typeof key === "string" ? key : key.name;
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7564
|
+
const keyCtrl = typeof key === "string" ? false : key.ctrl;
|
|
7565
|
+
const keyShift = typeof key === "string" ? false : key.shift;
|
|
7566
|
+
const keyMeta = typeof key === "string" ? false : key.meta;
|
|
7567
|
+
const keySuper = typeof key === "string" ? false : key.super;
|
|
7568
|
+
const bindingKey = getKeyBindingKey({
|
|
7569
|
+
name: keyName,
|
|
7570
|
+
ctrl: keyCtrl,
|
|
7571
|
+
shift: keyShift,
|
|
7572
|
+
meta: keyMeta,
|
|
7573
|
+
super: keySuper,
|
|
7574
|
+
action: "move-left"
|
|
7575
|
+
});
|
|
7576
|
+
const action = this._keyBindingsMap.get(bindingKey);
|
|
7577
|
+
if (action) {
|
|
7578
|
+
switch (action) {
|
|
7579
|
+
case "move-left":
|
|
7580
|
+
this.moveLeft();
|
|
7581
|
+
return true;
|
|
7582
|
+
case "move-right":
|
|
7583
|
+
this.moveRight();
|
|
7584
|
+
return true;
|
|
7585
|
+
case "select-current":
|
|
7586
|
+
this.selectCurrent();
|
|
7587
|
+
return true;
|
|
7588
|
+
}
|
|
7413
7589
|
}
|
|
7414
7590
|
return false;
|
|
7415
7591
|
}
|
|
@@ -7498,6 +7674,16 @@ class TabSelectRenderable extends Renderable {
|
|
|
7498
7674
|
this.updateScrollOffset();
|
|
7499
7675
|
this.requestRender();
|
|
7500
7676
|
}
|
|
7677
|
+
set keyBindings(bindings) {
|
|
7678
|
+
this._keyBindings = bindings;
|
|
7679
|
+
const mergedBindings = mergeKeyBindings(defaultTabSelectKeybindings, bindings);
|
|
7680
|
+
this._keyBindingsMap = buildKeyBindingsMap(mergedBindings, this._keyAliasMap);
|
|
7681
|
+
}
|
|
7682
|
+
set keyAliasMap(aliases) {
|
|
7683
|
+
this._keyAliasMap = mergeKeyAliases(defaultKeyAliases, aliases);
|
|
7684
|
+
const mergedBindings = mergeKeyBindings(defaultTabSelectKeybindings, this._keyBindings);
|
|
7685
|
+
this._keyBindingsMap = buildKeyBindingsMap(mergedBindings, this._keyAliasMap);
|
|
7686
|
+
}
|
|
7501
7687
|
}
|
|
7502
7688
|
// src/renderables/EditBufferRenderable.ts
|
|
7503
7689
|
class EditBufferRenderable extends Renderable {
|
|
@@ -7991,31 +8177,6 @@ class EditBufferRenderable extends Renderable {
|
|
|
7991
8177
|
}
|
|
7992
8178
|
}
|
|
7993
8179
|
|
|
7994
|
-
// src/lib/keymapping.ts
|
|
7995
|
-
function mergeKeyBindings(defaults, custom) {
|
|
7996
|
-
const map = new Map;
|
|
7997
|
-
for (const binding of defaults) {
|
|
7998
|
-
const key = getKeyBindingKey(binding);
|
|
7999
|
-
map.set(key, binding);
|
|
8000
|
-
}
|
|
8001
|
-
for (const binding of custom) {
|
|
8002
|
-
const key = getKeyBindingKey(binding);
|
|
8003
|
-
map.set(key, binding);
|
|
8004
|
-
}
|
|
8005
|
-
return Array.from(map.values());
|
|
8006
|
-
}
|
|
8007
|
-
function getKeyBindingKey(binding) {
|
|
8008
|
-
return `${binding.name}:${binding.ctrl ? 1 : 0}:${binding.shift ? 1 : 0}:${binding.meta ? 1 : 0}:${binding.super ? 1 : 0}`;
|
|
8009
|
-
}
|
|
8010
|
-
function buildKeyBindingsMap(bindings) {
|
|
8011
|
-
const map = new Map;
|
|
8012
|
-
for (const binding of bindings) {
|
|
8013
|
-
const key = getKeyBindingKey(binding);
|
|
8014
|
-
map.set(key, binding.action);
|
|
8015
|
-
}
|
|
8016
|
-
return map;
|
|
8017
|
-
}
|
|
8018
|
-
|
|
8019
8180
|
// src/renderables/Textarea.ts
|
|
8020
8181
|
var defaultTextareaKeybindings = [
|
|
8021
8182
|
{ name: "left", action: "move-left" },
|
|
@@ -8068,6 +8229,8 @@ class TextareaRenderable extends EditBufferRenderable {
|
|
|
8068
8229
|
_focusedBackgroundColor;
|
|
8069
8230
|
_focusedTextColor;
|
|
8070
8231
|
_keyBindingsMap;
|
|
8232
|
+
_keyAliasMap;
|
|
8233
|
+
_keyBindings;
|
|
8071
8234
|
_actionHandlers;
|
|
8072
8235
|
_initialValueSet = false;
|
|
8073
8236
|
_submitListener = undefined;
|
|
@@ -8091,8 +8254,10 @@ class TextareaRenderable extends EditBufferRenderable {
|
|
|
8091
8254
|
this._focusedBackgroundColor = parseColor(options.focusedBackgroundColor || options.backgroundColor || defaults.focusedBackgroundColor);
|
|
8092
8255
|
this._focusedTextColor = parseColor(options.focusedTextColor || options.textColor || defaults.focusedTextColor);
|
|
8093
8256
|
this._placeholder = options.placeholder ?? defaults.placeholder;
|
|
8094
|
-
|
|
8095
|
-
this.
|
|
8257
|
+
this._keyAliasMap = mergeKeyAliases(defaultKeyAliases, options.keyAliasMap || {});
|
|
8258
|
+
this._keyBindings = options.keyBindings || [];
|
|
8259
|
+
const mergedBindings = mergeKeyBindings(defaultTextareaKeybindings, this._keyBindings);
|
|
8260
|
+
this._keyBindingsMap = buildKeyBindingsMap(mergedBindings, this._keyAliasMap);
|
|
8096
8261
|
this._actionHandlers = this.buildActionHandlers();
|
|
8097
8262
|
this._submitListener = options.onSubmit;
|
|
8098
8263
|
if (options.initialValue) {
|
|
@@ -8160,6 +8325,7 @@ class TextareaRenderable extends EditBufferRenderable {
|
|
|
8160
8325
|
const keyShift = typeof key === "string" ? false : key.shift;
|
|
8161
8326
|
const keyMeta = typeof key === "string" ? false : key.meta;
|
|
8162
8327
|
const keySuper = typeof key === "string" ? false : key.super;
|
|
8328
|
+
const keyHyper = typeof key === "string" ? false : key.hyper;
|
|
8163
8329
|
const bindingKey = getKeyBindingKey({
|
|
8164
8330
|
name: keyName,
|
|
8165
8331
|
ctrl: keyCtrl,
|
|
@@ -8175,7 +8341,7 @@ class TextareaRenderable extends EditBufferRenderable {
|
|
|
8175
8341
|
return handler();
|
|
8176
8342
|
}
|
|
8177
8343
|
}
|
|
8178
|
-
if (keySequence && !keyCtrl && !keyMeta) {
|
|
8344
|
+
if (keySequence && !keyCtrl && !keyMeta && !keySuper && !keyHyper) {
|
|
8179
8345
|
const firstCharCode = keySequence.charCodeAt(0);
|
|
8180
8346
|
if (firstCharCode < 32) {
|
|
8181
8347
|
return false;
|
|
@@ -8463,8 +8629,14 @@ class TextareaRenderable extends EditBufferRenderable {
|
|
|
8463
8629
|
return this._submitListener;
|
|
8464
8630
|
}
|
|
8465
8631
|
set keyBindings(bindings) {
|
|
8632
|
+
this._keyBindings = bindings;
|
|
8466
8633
|
const mergedBindings = mergeKeyBindings(defaultTextareaKeybindings, bindings);
|
|
8467
|
-
this._keyBindingsMap = buildKeyBindingsMap(mergedBindings);
|
|
8634
|
+
this._keyBindingsMap = buildKeyBindingsMap(mergedBindings, this._keyAliasMap);
|
|
8635
|
+
}
|
|
8636
|
+
set keyAliasMap(aliases) {
|
|
8637
|
+
this._keyAliasMap = mergeKeyAliases(defaultKeyAliases, aliases);
|
|
8638
|
+
const mergedBindings = mergeKeyBindings(defaultTextareaKeybindings, this._keyBindings);
|
|
8639
|
+
this._keyBindingsMap = buildKeyBindingsMap(mergedBindings, this._keyAliasMap);
|
|
8468
8640
|
}
|
|
8469
8641
|
get extmarks() {
|
|
8470
8642
|
return this.editorView.extmarks;
|
|
@@ -8579,7 +8751,7 @@ export {
|
|
|
8579
8751
|
applyChromaticAberration,
|
|
8580
8752
|
applyAsciiArt,
|
|
8581
8753
|
addDefaultParsers,
|
|
8582
|
-
|
|
8754
|
+
exports_src as Yoga,
|
|
8583
8755
|
VignetteEffect,
|
|
8584
8756
|
VRenderable,
|
|
8585
8757
|
TreeSitterClient,
|
|
@@ -8657,5 +8829,5 @@ export {
|
|
|
8657
8829
|
ASCIIFont
|
|
8658
8830
|
};
|
|
8659
8831
|
|
|
8660
|
-
//# debugId=
|
|
8832
|
+
//# debugId=F8C236171D38686464756E2164756E21
|
|
8661
8833
|
//# sourceMappingURL=index.js.map
|