@opentui/core 0.5.4 → 0.5.7
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/README.md +1 -1
- package/buffer.d.ts +2 -2
- package/{chunk-bun-1n307cze.js → chunk-bun-xmsp0nqq.js} +551 -221
- package/{chunk-bun-1n307cze.js.map → chunk-bun-xmsp0nqq.js.map} +8 -8
- package/{chunk-bun-gvv8cwwz.js → chunk-bun-z4gs6jzg.js} +129 -54
- package/chunk-bun-z4gs6jzg.js.map +32 -0
- package/{chunk-node-crchpns1.js → chunk-node-267dafd8.js} +551 -221
- package/{chunk-node-crchpns1.js.map → chunk-node-267dafd8.js.map} +8 -8
- package/{chunk-node-tq0x9mbj.js → chunk-node-591ssncm.js} +129 -54
- package/chunk-node-591ssncm.js.map +32 -0
- package/editor-view.d.ts +9 -2
- package/index.bun.js +377 -4
- package/index.bun.js.map +5 -4
- package/index.node.js +377 -4
- package/index.node.js.map +5 -3
- package/lib/selection.d.ts +4 -2
- package/package.json +9 -9
- package/renderables/EditBufferRenderable.d.ts +5 -1
- package/renderables/EmbeddedTerminal.d.ts +67 -0
- package/renderables/index.d.ts +1 -0
- package/renderer.d.ts +5 -2
- package/testing.bun.js +2 -2
- package/testing.js +2 -2
- package/text-buffer-view.d.ts +5 -2
- package/types.d.ts +10 -1
- package/yoga.bun.js +1 -1
- package/yoga.js +1 -1
- package/zig-structs.d.ts +2 -0
- package/zig.d.ts +76 -11
- package/chunk-bun-gvv8cwwz.js.map +0 -32
- package/chunk-node-tq0x9mbj.js.map +0 -32
package/editor-view.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RGBA } from "./lib/RGBA.js";
|
|
2
2
|
import { type EditorViewHandle, type RenderLib, type VisualCursor, type LineInfo } from "./zig.js";
|
|
3
3
|
import type { EditBuffer } from "./edit-buffer.js";
|
|
4
|
+
import type { SelectionBehavior, SelectionOccupancy } from "./types.js";
|
|
4
5
|
export interface Viewport {
|
|
5
6
|
offsetY: number;
|
|
6
7
|
offsetX: number;
|
|
@@ -34,9 +35,14 @@ export declare class EditorView {
|
|
|
34
35
|
end: number;
|
|
35
36
|
} | null;
|
|
36
37
|
hasSelection(): boolean;
|
|
37
|
-
setLocalSelection(anchorX: number, anchorY: number, focusX: number, focusY: number, bgColor?: RGBA, fgColor?: RGBA, updateCursor?: boolean, followCursor?: boolean): boolean;
|
|
38
|
-
updateLocalSelection(anchorX: number, anchorY: number, focusX: number, focusY: number, bgColor?: RGBA, fgColor?: RGBA, updateCursor?: boolean, followCursor?: boolean): boolean;
|
|
38
|
+
setLocalSelection(anchorX: number, anchorY: number, focusX: number, focusY: number, bgColor?: RGBA, fgColor?: RGBA, updateCursor?: boolean, followCursor?: boolean, behavior?: SelectionBehavior): boolean;
|
|
39
|
+
updateLocalSelection(anchorX: number, anchorY: number, focusX: number, focusY: number, bgColor?: RGBA, fgColor?: RGBA, updateCursor?: boolean, followCursor?: boolean, behavior?: SelectionBehavior): boolean;
|
|
39
40
|
resetLocalSelection(): void;
|
|
41
|
+
convertSelectionToCell(): boolean;
|
|
42
|
+
setSelectionOccupancy(occupancy: SelectionOccupancy): void;
|
|
43
|
+
getSelectionOccupancy(): SelectionOccupancy;
|
|
44
|
+
setSelectionInclusive(start: number, end: number, bgColor?: RGBA, fgColor?: RGBA): void;
|
|
45
|
+
setSelectionColors(bgColor?: RGBA, fgColor?: RGBA): void;
|
|
40
46
|
getSelectedText(): string;
|
|
41
47
|
getCursor(): {
|
|
42
48
|
row: number;
|
|
@@ -53,6 +59,7 @@ export declare class EditorView {
|
|
|
53
59
|
getEOL(): VisualCursor;
|
|
54
60
|
getVisualSOL(): VisualCursor;
|
|
55
61
|
getVisualEOL(): VisualCursor;
|
|
62
|
+
gotoVisualLineEnd(): void;
|
|
56
63
|
getLineInfo(): LineInfo;
|
|
57
64
|
getLogicalLineInfo(): LineInfo;
|
|
58
65
|
get extmarks(): any;
|
package/index.bun.js
CHANGED
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
mergeKeyAliases,
|
|
45
45
|
mergeKeyBindings,
|
|
46
46
|
wrapWithDelegates
|
|
47
|
-
} from "./chunk-bun-
|
|
47
|
+
} from "./chunk-bun-z4gs6jzg.js";
|
|
48
48
|
import {
|
|
49
49
|
ASCIIFontSelectionHelper,
|
|
50
50
|
ATTRIBUTE_BASE_BITS,
|
|
@@ -204,7 +204,7 @@ import {
|
|
|
204
204
|
visualizeRenderableTree,
|
|
205
205
|
white,
|
|
206
206
|
yellow
|
|
207
|
-
} from "./chunk-bun-
|
|
207
|
+
} from "./chunk-bun-xmsp0nqq.js";
|
|
208
208
|
// src/post/effects.ts
|
|
209
209
|
function toU8(value) {
|
|
210
210
|
return Math.round(Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * 255);
|
|
@@ -6219,7 +6219,7 @@ class ASCIIFontRenderable extends FrameBufferRenderable {
|
|
|
6219
6219
|
this.renderFontToBuffer();
|
|
6220
6220
|
this.requestRender();
|
|
6221
6221
|
}
|
|
6222
|
-
return
|
|
6222
|
+
return this.selectionHelper.hasSelection();
|
|
6223
6223
|
}
|
|
6224
6224
|
getSelectedText() {
|
|
6225
6225
|
const selection = this.selectionHelper.getSelection();
|
|
@@ -8223,6 +8223,378 @@ class DiffRenderable extends Renderable {
|
|
|
8223
8223
|
return offsets;
|
|
8224
8224
|
}
|
|
8225
8225
|
}
|
|
8226
|
+
// src/renderables/EmbeddedTerminal.ts
|
|
8227
|
+
var MOD_SHIFT = 1 << 0;
|
|
8228
|
+
var MOD_CTRL = 1 << 1;
|
|
8229
|
+
var MOD_ALT = 1 << 2;
|
|
8230
|
+
var MOD_SUPER = 1 << 3;
|
|
8231
|
+
var MOD_CAPS_LOCK = 1 << 4;
|
|
8232
|
+
var MOD_NUM_LOCK = 1 << 5;
|
|
8233
|
+
|
|
8234
|
+
class EmbeddedTerminalRenderable extends Renderable {
|
|
8235
|
+
selectable = true;
|
|
8236
|
+
lib;
|
|
8237
|
+
handle = null;
|
|
8238
|
+
_onData;
|
|
8239
|
+
_onTerminalResize;
|
|
8240
|
+
_onScreenChange;
|
|
8241
|
+
keyreleaseHandler = null;
|
|
8242
|
+
hadRenderHooks = false;
|
|
8243
|
+
selection = false;
|
|
8244
|
+
constructor(ctx, options) {
|
|
8245
|
+
const cols = options.cols ?? (typeof options.width === "number" ? options.width : 80);
|
|
8246
|
+
const rows = options.rows ?? (typeof options.height === "number" ? options.height : 24);
|
|
8247
|
+
super(ctx, {
|
|
8248
|
+
...options,
|
|
8249
|
+
width: options.width ?? cols,
|
|
8250
|
+
height: options.height ?? rows,
|
|
8251
|
+
buffered: true
|
|
8252
|
+
});
|
|
8253
|
+
this._focusable = true;
|
|
8254
|
+
this._onData = options.onData;
|
|
8255
|
+
this._onTerminalResize = options.onTerminalResize;
|
|
8256
|
+
this._onScreenChange = options.onScreenChange;
|
|
8257
|
+
this.selectable = options.selectable ?? true;
|
|
8258
|
+
this.lib = resolveRenderLib();
|
|
8259
|
+
try {
|
|
8260
|
+
this.handle = this.lib.createEmbeddedTerminal({ cols, rows, maxScrollback: options.maxScrollback });
|
|
8261
|
+
this.setupMouse(options);
|
|
8262
|
+
} catch (error) {
|
|
8263
|
+
this.destroy();
|
|
8264
|
+
throw error;
|
|
8265
|
+
}
|
|
8266
|
+
}
|
|
8267
|
+
get onData() {
|
|
8268
|
+
return this._onData;
|
|
8269
|
+
}
|
|
8270
|
+
set onData(value) {
|
|
8271
|
+
this._onData = value;
|
|
8272
|
+
}
|
|
8273
|
+
get onTerminalResize() {
|
|
8274
|
+
return this._onTerminalResize;
|
|
8275
|
+
}
|
|
8276
|
+
set onTerminalResize(value) {
|
|
8277
|
+
this._onTerminalResize = value;
|
|
8278
|
+
}
|
|
8279
|
+
get onScreenChange() {
|
|
8280
|
+
return this._onScreenChange;
|
|
8281
|
+
}
|
|
8282
|
+
set onScreenChange(value) {
|
|
8283
|
+
this._onScreenChange = value;
|
|
8284
|
+
}
|
|
8285
|
+
screen() {
|
|
8286
|
+
const cursor = this.handle ? this.lib.embeddedTerminalCursor(this.handle) : { x: 0, y: 0, visible: false, hasValue: false };
|
|
8287
|
+
const lines = this.frameBuffer ? new TextDecoder().decode(this.frameBuffer.getRealCharBytes(true)).split(`
|
|
8288
|
+
`).slice(0, this.height).map((line) => line.trimEnd()) : [];
|
|
8289
|
+
while (lines.at(-1) === "")
|
|
8290
|
+
lines.pop();
|
|
8291
|
+
return {
|
|
8292
|
+
text: lines.join(`
|
|
8293
|
+
`),
|
|
8294
|
+
lines,
|
|
8295
|
+
columns: this.width,
|
|
8296
|
+
rows: this.height,
|
|
8297
|
+
cursor: {
|
|
8298
|
+
x: cursor.x,
|
|
8299
|
+
y: cursor.y,
|
|
8300
|
+
visible: cursor.hasValue && cursor.visible
|
|
8301
|
+
}
|
|
8302
|
+
};
|
|
8303
|
+
}
|
|
8304
|
+
write(data) {
|
|
8305
|
+
if (!this.handle)
|
|
8306
|
+
return;
|
|
8307
|
+
this.lib.embeddedTerminalWrite(this.handle, data);
|
|
8308
|
+
try {
|
|
8309
|
+
this.flushResponses();
|
|
8310
|
+
} finally {
|
|
8311
|
+
this.requestRender();
|
|
8312
|
+
}
|
|
8313
|
+
}
|
|
8314
|
+
invalidate() {
|
|
8315
|
+
if (!this.handle)
|
|
8316
|
+
return;
|
|
8317
|
+
this.lib.embeddedTerminalInvalidate(this.handle);
|
|
8318
|
+
this.requestRender();
|
|
8319
|
+
}
|
|
8320
|
+
encodeKey(key) {
|
|
8321
|
+
if (!this.handle)
|
|
8322
|
+
return new Uint8Array;
|
|
8323
|
+
const text = textualKey(key);
|
|
8324
|
+
return this.lib.embeddedTerminalEncodeKey(this.handle, {
|
|
8325
|
+
action: key.eventType === "release" ? "release" : key.repeated ? "repeat" : "press",
|
|
8326
|
+
key: physicalKey(key),
|
|
8327
|
+
mods: modifiers(key),
|
|
8328
|
+
text,
|
|
8329
|
+
unshiftedCodepoint: key.baseCode ?? physicalUnshiftedCodepoint(key.code)
|
|
8330
|
+
});
|
|
8331
|
+
}
|
|
8332
|
+
encodePaste(bytes) {
|
|
8333
|
+
if (!this.handle)
|
|
8334
|
+
return new Uint8Array;
|
|
8335
|
+
return this.lib.embeddedTerminalEncodePaste(this.handle, bytes);
|
|
8336
|
+
}
|
|
8337
|
+
shouldStartSelection(x, y) {
|
|
8338
|
+
if (!this.selectable)
|
|
8339
|
+
return false;
|
|
8340
|
+
const localX = x - this.x;
|
|
8341
|
+
const localY = y - this.y;
|
|
8342
|
+
return localX >= 0 && localX < this.width && localY >= 0 && localY < this.height;
|
|
8343
|
+
}
|
|
8344
|
+
onSelectionChanged(selection) {
|
|
8345
|
+
if (!this.handle)
|
|
8346
|
+
return false;
|
|
8347
|
+
const local = convertGlobalToLocalSelection(selection, this.x, this.y);
|
|
8348
|
+
if (!local?.isActive) {
|
|
8349
|
+
if (!this.selection)
|
|
8350
|
+
return false;
|
|
8351
|
+
this.lib.embeddedTerminalClearSelection(this.handle);
|
|
8352
|
+
this.selection = false;
|
|
8353
|
+
this.requestRender();
|
|
8354
|
+
return false;
|
|
8355
|
+
}
|
|
8356
|
+
const point = (x, y) => {
|
|
8357
|
+
if (y < 0)
|
|
8358
|
+
return { x: 0, y: 0 };
|
|
8359
|
+
if (y >= this.height)
|
|
8360
|
+
return { x: this.width - 1, y: this.height - 1 };
|
|
8361
|
+
return { x: Math.max(0, Math.min(this.width - 1, x)), y };
|
|
8362
|
+
};
|
|
8363
|
+
this.lib.embeddedTerminalSetSelection(this.handle, point(local.anchorX, local.anchorY), point(local.focusX, local.focusY));
|
|
8364
|
+
this.selection = true;
|
|
8365
|
+
this.requestRender();
|
|
8366
|
+
return true;
|
|
8367
|
+
}
|
|
8368
|
+
hasSelection() {
|
|
8369
|
+
return this.selection;
|
|
8370
|
+
}
|
|
8371
|
+
getSelectedText() {
|
|
8372
|
+
if (!this.handle || !this.selection)
|
|
8373
|
+
return "";
|
|
8374
|
+
return new TextDecoder().decode(this.lib.embeddedTerminalGetSelectedText(this.handle));
|
|
8375
|
+
}
|
|
8376
|
+
focus() {
|
|
8377
|
+
if (this.focused)
|
|
8378
|
+
return;
|
|
8379
|
+
super.focus();
|
|
8380
|
+
if (!this.focused)
|
|
8381
|
+
return;
|
|
8382
|
+
this.keyreleaseHandler = (key) => this.handleKeyPress(key);
|
|
8383
|
+
this.ctx._internalKeyInput.onInternal("keyrelease", this.keyreleaseHandler);
|
|
8384
|
+
try {
|
|
8385
|
+
this.send(this.handle ? this.lib.embeddedTerminalEncodeFocus(this.handle, true) : new Uint8Array, "input");
|
|
8386
|
+
} catch (error) {
|
|
8387
|
+
this.removeKeyreleaseHandler();
|
|
8388
|
+
super.blur();
|
|
8389
|
+
throw error;
|
|
8390
|
+
}
|
|
8391
|
+
}
|
|
8392
|
+
blur() {
|
|
8393
|
+
if (!this.focused)
|
|
8394
|
+
return;
|
|
8395
|
+
try {
|
|
8396
|
+
this.send(this.handle ? this.lib.embeddedTerminalEncodeFocus(this.handle, false) : new Uint8Array, "input");
|
|
8397
|
+
} catch {} finally {
|
|
8398
|
+
this.removeKeyreleaseHandler();
|
|
8399
|
+
super.blur();
|
|
8400
|
+
this._ctx.setCursorPosition(0, 0, false);
|
|
8401
|
+
}
|
|
8402
|
+
}
|
|
8403
|
+
handleKeyPress(key) {
|
|
8404
|
+
const output = this.encodeKey(key);
|
|
8405
|
+
this.send(output, "input");
|
|
8406
|
+
return output.byteLength > 0;
|
|
8407
|
+
}
|
|
8408
|
+
handlePaste(event) {
|
|
8409
|
+
this.send(this.encodePaste(event.bytes), "input");
|
|
8410
|
+
}
|
|
8411
|
+
render(buffer, deltaTime) {
|
|
8412
|
+
const hasRenderHooks = Boolean(this.renderBefore || this.renderAfter);
|
|
8413
|
+
if (this.handle && (hasRenderHooks || this.hadRenderHooks))
|
|
8414
|
+
this.lib.embeddedTerminalInvalidate(this.handle);
|
|
8415
|
+
this.hadRenderHooks = hasRenderHooks;
|
|
8416
|
+
super.render(buffer, deltaTime);
|
|
8417
|
+
}
|
|
8418
|
+
onResize(width, height) {
|
|
8419
|
+
super.onResize(width, height);
|
|
8420
|
+
if (!this.handle || !Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0)
|
|
8421
|
+
return;
|
|
8422
|
+
const cols = Math.min(Math.floor(width), 65535);
|
|
8423
|
+
const rows = Math.min(Math.floor(height), 65535);
|
|
8424
|
+
this.lib.embeddedTerminalResize(this.handle, cols, rows);
|
|
8425
|
+
this.lib.embeddedTerminalInvalidate(this.handle);
|
|
8426
|
+
this.flushResponses();
|
|
8427
|
+
this._onTerminalResize?.(cols, rows);
|
|
8428
|
+
}
|
|
8429
|
+
renderSelf(buffer) {
|
|
8430
|
+
if (!this.handle || !this.frameBuffer || !this.visible || this.isDestroyed)
|
|
8431
|
+
return;
|
|
8432
|
+
this.lib.embeddedTerminalCompose(this.handle, buffer.ptr, 0, 0);
|
|
8433
|
+
this._onScreenChange?.();
|
|
8434
|
+
if (!this.focused)
|
|
8435
|
+
return;
|
|
8436
|
+
const cursor = this.lib.embeddedTerminalCursor(this.handle);
|
|
8437
|
+
const visible = cursor.visible && cursor.hasValue;
|
|
8438
|
+
const cursorX = cursor.wideTail && cursor.x > 0 ? cursor.x - 1 : cursor.x;
|
|
8439
|
+
this._ctx.setCursorPosition(this._screenX + cursorX + 1, this._screenY + cursor.y + 1, visible);
|
|
8440
|
+
if (!visible)
|
|
8441
|
+
return;
|
|
8442
|
+
this._ctx.setCursorStyle({
|
|
8443
|
+
style: cursor.style === "bar" ? "line" : cursor.style === "underline" ? "underline" : "block",
|
|
8444
|
+
blinking: cursor.blinking
|
|
8445
|
+
});
|
|
8446
|
+
if (cursor.color)
|
|
8447
|
+
this._ctx.setCursorColor(RGBA.fromInts(cursor.color.r, cursor.color.g, cursor.color.b, 255));
|
|
8448
|
+
}
|
|
8449
|
+
destroySelf() {
|
|
8450
|
+
if (this.handle) {
|
|
8451
|
+
this.lib.destroyEmbeddedTerminal(this.handle);
|
|
8452
|
+
this.handle = null;
|
|
8453
|
+
}
|
|
8454
|
+
this._ctx.setCursorPosition(0, 0, false);
|
|
8455
|
+
super.destroySelf();
|
|
8456
|
+
}
|
|
8457
|
+
onRemove() {
|
|
8458
|
+
if (this.focused)
|
|
8459
|
+
this.blur();
|
|
8460
|
+
}
|
|
8461
|
+
setupMouse(options) {
|
|
8462
|
+
const { onMouseDown, onMouseUp, onMouseMove, onMouseDrag, onMouseScroll } = options;
|
|
8463
|
+
this.onMouseDown = (event) => {
|
|
8464
|
+
this.forwardMouse(event, "press");
|
|
8465
|
+
onMouseDown?.call(this, event);
|
|
8466
|
+
};
|
|
8467
|
+
this.onMouseUp = (event) => {
|
|
8468
|
+
this.forwardMouse(event, "release");
|
|
8469
|
+
onMouseUp?.call(this, event);
|
|
8470
|
+
};
|
|
8471
|
+
this.onMouseMove = (event) => {
|
|
8472
|
+
this.forwardMouse(event, "motion");
|
|
8473
|
+
onMouseMove?.call(this, event);
|
|
8474
|
+
};
|
|
8475
|
+
this.onMouseDrag = (event) => {
|
|
8476
|
+
this.forwardMouse(event, "motion");
|
|
8477
|
+
onMouseDrag?.call(this, event);
|
|
8478
|
+
};
|
|
8479
|
+
this.onMouseScroll = (event) => {
|
|
8480
|
+
this.forwardMouse(event, "press");
|
|
8481
|
+
onMouseScroll?.call(this, event);
|
|
8482
|
+
};
|
|
8483
|
+
}
|
|
8484
|
+
forwardMouse(event, action) {
|
|
8485
|
+
if (!this.handle)
|
|
8486
|
+
return;
|
|
8487
|
+
if (event.type === "down" && event.button === 0)
|
|
8488
|
+
this.focus();
|
|
8489
|
+
const output = this.lib.embeddedTerminalEncodeMouse(this.handle, {
|
|
8490
|
+
action,
|
|
8491
|
+
button: event.type === "move" && !event.isDragging ? undefined : mouseButton(event),
|
|
8492
|
+
mods: modifiers(event.modifiers),
|
|
8493
|
+
x: event.x - this._screenX,
|
|
8494
|
+
y: event.y - this._screenY,
|
|
8495
|
+
anyButtonPressed: event.isDragging === true || event.type === "down"
|
|
8496
|
+
});
|
|
8497
|
+
if (event.type === "scroll" && output.byteLength === 0) {
|
|
8498
|
+
const direction = event.scroll?.direction;
|
|
8499
|
+
if (direction !== "up" && direction !== "down")
|
|
8500
|
+
return;
|
|
8501
|
+
this.lib.embeddedTerminalScroll(this.handle, direction === "up" ? -3 : 3);
|
|
8502
|
+
this.requestRender();
|
|
8503
|
+
event.preventDefault();
|
|
8504
|
+
event.stopPropagation();
|
|
8505
|
+
return;
|
|
8506
|
+
}
|
|
8507
|
+
if (output.byteLength === 0)
|
|
8508
|
+
return;
|
|
8509
|
+
event.preventDefault();
|
|
8510
|
+
event.stopPropagation();
|
|
8511
|
+
this.send(output, "input");
|
|
8512
|
+
}
|
|
8513
|
+
flushResponses() {
|
|
8514
|
+
if (!this.handle)
|
|
8515
|
+
return;
|
|
8516
|
+
this.send(this.lib.embeddedTerminalDrainResponses(this.handle), "response");
|
|
8517
|
+
}
|
|
8518
|
+
removeKeyreleaseHandler() {
|
|
8519
|
+
if (!this.keyreleaseHandler)
|
|
8520
|
+
return;
|
|
8521
|
+
this.ctx._internalKeyInput.offInternal("keyrelease", this.keyreleaseHandler);
|
|
8522
|
+
this.keyreleaseHandler = null;
|
|
8523
|
+
}
|
|
8524
|
+
send(data, source) {
|
|
8525
|
+
if (data.byteLength > 0)
|
|
8526
|
+
this._onData?.(data, source);
|
|
8527
|
+
}
|
|
8528
|
+
}
|
|
8529
|
+
function modifiers(input) {
|
|
8530
|
+
let value = 0;
|
|
8531
|
+
if (input.shift)
|
|
8532
|
+
value |= MOD_SHIFT;
|
|
8533
|
+
if (input.ctrl)
|
|
8534
|
+
value |= MOD_CTRL;
|
|
8535
|
+
if (input.alt || input.option)
|
|
8536
|
+
value |= MOD_ALT;
|
|
8537
|
+
if (input.meta || input.super)
|
|
8538
|
+
value |= MOD_SUPER;
|
|
8539
|
+
if (input.capsLock)
|
|
8540
|
+
value |= MOD_CAPS_LOCK;
|
|
8541
|
+
if (input.numLock)
|
|
8542
|
+
value |= MOD_NUM_LOCK;
|
|
8543
|
+
return value;
|
|
8544
|
+
}
|
|
8545
|
+
function physicalKey(key) {
|
|
8546
|
+
if (key.code)
|
|
8547
|
+
return key.code;
|
|
8548
|
+
return {
|
|
8549
|
+
backspace: "Backspace",
|
|
8550
|
+
enter: "Enter",
|
|
8551
|
+
return: "Enter",
|
|
8552
|
+
space: "Space",
|
|
8553
|
+
tab: "Tab",
|
|
8554
|
+
delete: "Delete",
|
|
8555
|
+
end: "End",
|
|
8556
|
+
home: "Home",
|
|
8557
|
+
insert: "Insert",
|
|
8558
|
+
pagedown: "PageDown",
|
|
8559
|
+
pageup: "PageUp",
|
|
8560
|
+
down: "ArrowDown",
|
|
8561
|
+
left: "ArrowLeft",
|
|
8562
|
+
right: "ArrowRight",
|
|
8563
|
+
up: "ArrowUp",
|
|
8564
|
+
escape: "Escape"
|
|
8565
|
+
}[key.name.toLowerCase()] ?? "";
|
|
8566
|
+
}
|
|
8567
|
+
function textualKey(key) {
|
|
8568
|
+
if (key.sequence.length > 0 && !/[\p{Cc}]/u.test(key.sequence))
|
|
8569
|
+
return key.sequence;
|
|
8570
|
+
if (key.name === "space")
|
|
8571
|
+
return " ";
|
|
8572
|
+
if (key.name.length === 0 || /[\p{Cc}]/u.test(key.name))
|
|
8573
|
+
return;
|
|
8574
|
+
if ([...key.name].length === 1 || /[^\x00-\x7f]/.test(key.name))
|
|
8575
|
+
return key.name;
|
|
8576
|
+
}
|
|
8577
|
+
function physicalUnshiftedCodepoint(code) {
|
|
8578
|
+
if (code?.startsWith("Key") && code.length === 4)
|
|
8579
|
+
return code.charCodeAt(3) + 32;
|
|
8580
|
+
if (code?.startsWith("Digit") && code.length === 6)
|
|
8581
|
+
return code.charCodeAt(5);
|
|
8582
|
+
return 0;
|
|
8583
|
+
}
|
|
8584
|
+
function mouseButton(event) {
|
|
8585
|
+
if (event.type === "scroll") {
|
|
8586
|
+
if (event.scroll?.direction === "up")
|
|
8587
|
+
return "four";
|
|
8588
|
+
if (event.scroll?.direction === "down")
|
|
8589
|
+
return "five";
|
|
8590
|
+
if (event.scroll?.direction === "left")
|
|
8591
|
+
return "six";
|
|
8592
|
+
if (event.scroll?.direction === "right")
|
|
8593
|
+
return "seven";
|
|
8594
|
+
return;
|
|
8595
|
+
}
|
|
8596
|
+
return { 0: "left", 1: "middle", 2: "right", 4: "four", 5: "five" }[event.button];
|
|
8597
|
+
}
|
|
8226
8598
|
// src/renderables/Textarea.ts
|
|
8227
8599
|
var defaultTextareaKeyBindings = [
|
|
8228
8600
|
{ name: "left", action: "move-left" },
|
|
@@ -15153,6 +15525,7 @@ export {
|
|
|
15153
15525
|
FrameBuffer,
|
|
15154
15526
|
FlamesEffect,
|
|
15155
15527
|
ExtmarksController,
|
|
15528
|
+
EmbeddedTerminalRenderable,
|
|
15156
15529
|
EditorView,
|
|
15157
15530
|
EditBufferRenderableEvents,
|
|
15158
15531
|
EditBufferRenderable,
|
|
@@ -15197,5 +15570,5 @@ export {
|
|
|
15197
15570
|
ACHROMATOPSIA_MATRIX
|
|
15198
15571
|
};
|
|
15199
15572
|
|
|
15200
|
-
//# debugId=
|
|
15573
|
+
//# debugId=C0029738F074C79064756E2164756E21
|
|
15201
15574
|
//# sourceMappingURL=index.bun.js.map
|