@opentui/core 0.6.0 → 0.6.2
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/{chunk-bun-tsc14mt5.js → chunk-bun-b3p27aka.js} +28 -5
- package/chunk-bun-b3p27aka.js.map +35 -0
- package/{chunk-bun-s01c2jyn.js → chunk-bun-ehstr7d7.js} +24 -67
- package/{chunk-node-hjr2tm60.js.map → chunk-bun-ehstr7d7.js.map} +6 -6
- package/{chunk-node-hjr2tm60.js → chunk-node-fs50qdd7.js} +24 -67
- package/{chunk-bun-s01c2jyn.js.map → chunk-node-fs50qdd7.js.map} +6 -6
- package/{chunk-node-df90qrqc.js → chunk-node-jt82vcf9.js} +28 -5
- package/chunk-node-jt82vcf9.js.map +34 -0
- package/edit-buffer.d.ts +15 -0
- package/index.bun.js +41 -7
- package/index.bun.js.map +5 -5
- package/index.node.js +41 -7
- package/index.node.js.map +5 -5
- package/native-abi.generated.d.ts +8 -0
- package/package.json +10 -11
- package/platform/runtime.d.ts +0 -1
- package/testing.bun.js +2 -2
- package/testing.js +2 -2
- package/yoga.bun.js +1 -1
- package/yoga.js +1 -1
- package/zig.d.ts +3 -0
- package/chunk-bun-tsc14mt5.js.map +0 -35
- package/chunk-node-df90qrqc.js.map +0 -34
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
registerEnvVar2,
|
|
8
8
|
env2,
|
|
9
9
|
stringWidth,
|
|
10
|
-
stripANSI,
|
|
11
10
|
Worker,
|
|
12
11
|
DEFAULT_FOREGROUND_RGB2,
|
|
13
12
|
DEFAULT_BACKGROUND_RGB2,
|
|
@@ -63,7 +62,7 @@ import {
|
|
|
63
62
|
PositionType2,
|
|
64
63
|
Unit2,
|
|
65
64
|
Wrap2
|
|
66
|
-
} from "./chunk-node-
|
|
65
|
+
} from "./chunk-node-jt82vcf9.js";
|
|
67
66
|
|
|
68
67
|
// src/lib/border.ts
|
|
69
68
|
var VALID_BORDER_STYLES = ["single", "double", "rounded", "heavy"];
|
|
@@ -4101,8 +4100,7 @@ var parseKeypress2 = (s = "", options = {}) => {
|
|
|
4101
4100
|
let parts;
|
|
4102
4101
|
if (Buffer2.isBuffer(s)) {
|
|
4103
4102
|
if (s[0] > 127 && s[1] === undefined) {
|
|
4104
|
-
s[0]
|
|
4105
|
-
s = "\x1B" + String(s);
|
|
4103
|
+
s = "\x1B" + String.fromCharCode(s[0] - 128);
|
|
4106
4104
|
} else {
|
|
4107
4105
|
s = String(s);
|
|
4108
4106
|
}
|
|
@@ -8080,8 +8078,7 @@ class ExtmarksController2 {
|
|
|
8080
8078
|
return;
|
|
8081
8079
|
}
|
|
8082
8080
|
const targetOffset = currentOffset + 1;
|
|
8083
|
-
|
|
8084
|
-
if (targetOffset > textLength) {
|
|
8081
|
+
if (this.editBuffer.offsetToPosition(targetOffset) === null) {
|
|
8085
8082
|
this.originalMoveCursorRight();
|
|
8086
8083
|
return;
|
|
8087
8084
|
}
|
|
@@ -8255,28 +8252,12 @@ class ExtmarksController2 {
|
|
|
8255
8252
|
this.originalDeleteLine();
|
|
8256
8253
|
return;
|
|
8257
8254
|
}
|
|
8258
|
-
const
|
|
8259
|
-
const
|
|
8260
|
-
|
|
8261
|
-
for (let i = currentOffset - 1;i >= 0; i--) {
|
|
8262
|
-
if (text[i] === `
|
|
8263
|
-
`) {
|
|
8264
|
-
lineStart = i + 1;
|
|
8265
|
-
break;
|
|
8266
|
-
}
|
|
8267
|
-
}
|
|
8268
|
-
let lineEnd = text.length;
|
|
8269
|
-
for (let i = currentOffset;i < text.length; i++) {
|
|
8270
|
-
if (text[i] === `
|
|
8271
|
-
`) {
|
|
8272
|
-
lineEnd = i + 1;
|
|
8273
|
-
break;
|
|
8274
|
-
}
|
|
8275
|
-
}
|
|
8276
|
-
const deleteLength = lineEnd - lineStart;
|
|
8255
|
+
const row = this.editBuffer.getCursorPosition().row;
|
|
8256
|
+
const lineStart = this.editBuffer.getLineStartOffset(row);
|
|
8257
|
+
const [start, end] = row + 1 < this.editBuffer.getLineCount() ? [lineStart, this.editBuffer.getLineStartOffset(row + 1)] : [Math.max(0, lineStart - 1), this.editBuffer.getEOL().offset];
|
|
8277
8258
|
this.originalDeleteLine();
|
|
8278
8259
|
this.saveSnapshot();
|
|
8279
|
-
this.adjustExtmarksAfterDeletion(
|
|
8260
|
+
this.adjustExtmarksAfterDeletion(start, end - start);
|
|
8280
8261
|
});
|
|
8281
8262
|
}
|
|
8282
8263
|
wrapInsertion() {
|
|
@@ -8467,15 +8448,11 @@ class ExtmarksController2 {
|
|
|
8467
8448
|
}
|
|
8468
8449
|
updateHighlights() {
|
|
8469
8450
|
this.editBuffer.clearAllHighlights();
|
|
8470
|
-
let text;
|
|
8471
8451
|
for (const extmark of this.extmarks.values()) {
|
|
8472
8452
|
if (extmark.styleId !== undefined) {
|
|
8473
|
-
text ??= this.editBuffer.getText();
|
|
8474
|
-
const startWithoutNewlines = this.offsetExcludingNewlines(extmark.start, text);
|
|
8475
|
-
const endWithoutNewlines = this.offsetExcludingNewlines(extmark.end, text);
|
|
8476
8453
|
this.editBuffer.addHighlightByCharRange({
|
|
8477
|
-
start:
|
|
8478
|
-
end:
|
|
8454
|
+
start: this.offsetExcludingNewlines(extmark.start),
|
|
8455
|
+
end: this.offsetExcludingNewlines(extmark.end),
|
|
8479
8456
|
styleId: extmark.styleId,
|
|
8480
8457
|
priority: extmark.priority ?? 0,
|
|
8481
8458
|
hlRef: extmark.id & 65535
|
|
@@ -8483,37 +8460,8 @@ class ExtmarksController2 {
|
|
|
8483
8460
|
}
|
|
8484
8461
|
}
|
|
8485
8462
|
}
|
|
8486
|
-
offsetExcludingNewlines(offset
|
|
8487
|
-
|
|
8488
|
-
let newlineCount = 0;
|
|
8489
|
-
let i = 0;
|
|
8490
|
-
while (i < text.length && displayWidthSoFar < offset) {
|
|
8491
|
-
if (text[i] === `
|
|
8492
|
-
`) {
|
|
8493
|
-
displayWidthSoFar++;
|
|
8494
|
-
newlineCount++;
|
|
8495
|
-
i++;
|
|
8496
|
-
} else {
|
|
8497
|
-
let j = i;
|
|
8498
|
-
while (j < text.length && text[j] !== `
|
|
8499
|
-
`) {
|
|
8500
|
-
j++;
|
|
8501
|
-
}
|
|
8502
|
-
const chunk = text.substring(i, j);
|
|
8503
|
-
const chunkWidth = stringWidth(chunk);
|
|
8504
|
-
if (displayWidthSoFar + chunkWidth < offset) {
|
|
8505
|
-
displayWidthSoFar += chunkWidth;
|
|
8506
|
-
i = j;
|
|
8507
|
-
} else {
|
|
8508
|
-
for (let k = i;k < j && displayWidthSoFar < offset; k++) {
|
|
8509
|
-
const charWidth = stringWidth(text[k]);
|
|
8510
|
-
displayWidthSoFar += charWidth;
|
|
8511
|
-
}
|
|
8512
|
-
break;
|
|
8513
|
-
}
|
|
8514
|
-
}
|
|
8515
|
-
}
|
|
8516
|
-
return offset - newlineCount;
|
|
8463
|
+
offsetExcludingNewlines(offset) {
|
|
8464
|
+
return offset - (this.editBuffer.offsetToPosition(offset)?.row ?? 0);
|
|
8517
8465
|
}
|
|
8518
8466
|
create(options) {
|
|
8519
8467
|
if (this.destroyed) {
|
|
@@ -9032,11 +8980,12 @@ function buildTerminalPaletteSignature2(colors) {
|
|
|
9032
8980
|
|
|
9033
8981
|
// src/lib/paste.ts
|
|
9034
8982
|
var PASTE_TEXT_DECODER = new TextDecoder;
|
|
8983
|
+
var ANSI_SEQUENCES = /(?:\x1b\[|\x9b)[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]?|(?:\x1b[P\]X^_]|[\x90\x98\x9d-\x9f])[^\x07\x1b\x9c]*(?:\x07|\x1b\\|\x9c)?|\x1b[\x20-\x2f]*[\x30-\x7e]?/g;
|
|
9035
8984
|
function decodePasteBytes2(bytes) {
|
|
9036
8985
|
return PASTE_TEXT_DECODER.decode(bytes);
|
|
9037
8986
|
}
|
|
9038
8987
|
function stripAnsiSequences2(text) {
|
|
9039
|
-
return
|
|
8988
|
+
return text.replace(ANSI_SEQUENCES, "");
|
|
9040
8989
|
}
|
|
9041
8990
|
|
|
9042
8991
|
// src/lib/host-clipboard.internal.ts
|
|
@@ -13428,6 +13377,10 @@ class EditBuffer2 extends EventEmitter5 {
|
|
|
13428
13377
|
getLineStartOffset(row) {
|
|
13429
13378
|
return this.position(6 /* LineStart */, row)?.offset ?? 0;
|
|
13430
13379
|
}
|
|
13380
|
+
measureText(text) {
|
|
13381
|
+
this.guard();
|
|
13382
|
+
return this.lib.contextEditBufferMeasureText(this.native.handle.context, this.native.handle, this.lib.encoder.encode(text));
|
|
13383
|
+
}
|
|
13431
13384
|
getTextRange(startOffset, endOffset) {
|
|
13432
13385
|
this.guard();
|
|
13433
13386
|
if (startOffset >= endOffset)
|
|
@@ -13519,6 +13472,10 @@ class EditBuffer2 extends EventEmitter5 {
|
|
|
13519
13472
|
});
|
|
13520
13473
|
}
|
|
13521
13474
|
}
|
|
13475
|
+
function measureEditText2(text, options) {
|
|
13476
|
+
const lib = resolveRenderLib2();
|
|
13477
|
+
return lib.editMeasureText(lib.encoder.encode(text), options.widthMethod, options.tabWidth ?? 0);
|
|
13478
|
+
}
|
|
13522
13479
|
|
|
13523
13480
|
// src/editor-view.ts
|
|
13524
13481
|
class EditorView2 {
|
|
@@ -24907,7 +24864,7 @@ Captured external output:
|
|
|
24907
24864
|
}
|
|
24908
24865
|
}
|
|
24909
24866
|
|
|
24910
|
-
export { isValidBorderStyle2, parseBorderStyle2, BorderChars2, getBorderFromSides2, getBorderSides2, borderCharsToArray2, BorderCharArrays2, KeyEvent2, PasteEvent2, KeyHandler2, InternalKeyHandler2, fonts2, measureText2, getCharacterPositions2, coordinateToCharacterIndex2, renderFontToFrameBuffer2, convertThemeToStyles2, SyntaxStyle2, hastToStyledText2, SystemClock2, nonAlphanumericKeys2, terminalNamedSingleStrokeKeys2, parseKeypress2, LinearScrollAccel2, MacOSScrollAccel2, parseAlign2, parseAlignItems2, parseBoxSizing2, parseDimension2, parseDirection2, parseDisplay2, parseEdge2, parseFlexDirection2, parseGutter2, parseJustify2, parseLogLevel2, parseMeasureMode2, parseOverflow2, parsePositionType2, parseUnit2, parseWrap2, MouseParser2, Selection2, convertGlobalToLocalSelection2, ASCIIFontSelectionHelper2, StdinParser2, addDefaultParsers2, TreeSitterClient2, treeSitterToTextChunks2, treeSitterToStyledText2, DataPathsManager2, getDataPaths2, extensionToFiletype2, basenameToFiletype2, extToFiletype2, pathToFiletype2, infoStringToFiletype2, getTreeSitterClient2, destroyTreeSitterClient2, ExtmarksController2, createExtmarksController2, TerminalPalette2, createTerminalPalette2, normalizeTerminalPalette2, buildTerminalPaletteSignature2, decodePasteBytes2, stripAnsiSequences2, createHostClipboard2, createClipboard2, ClipboardTarget2, createRendererClipboardAdapter2, normalizeMarkdownLinkTarget, detectLinks2, acquireSessionBufferLease2, ResourceContext2, OptimizedBuffer2, h2, isVNode2, maybeMakeRenderable2, wrapWithDelegates2, instantiate2, delegate2, LayoutEvents2, RenderableEvents2, isRenderable2, BaseRenderable2, Renderable2, RootRenderable2, TextBuffer2, TextBufferView2, EditBuffer2, EditorView2, Timeline2, engine2, getTimelineEngine2, createTimeline2, ANSI, BoxRenderable2, TextBufferRenderable2, CodeRenderable2, ImageLoadError2, ImageError2, imageInfo2, NativeImage2, NativeImagePool2, resolveImageRenderProtocol2, ImageRenderable2, isTextNodeRenderable2, TextNodeRenderable2, RootTextNodeRenderable2, TextRenderable2, NativeSession2, defaultKeyAliases, mergeKeyAliases, mergeKeyBindings, getKeyBindingAction, buildKeyBindingsMap, capture2, ConsolePosition2, TerminalConsole2, EditBufferRenderableEvents2, isEditBufferRenderable2, EditBufferRenderable2, buildKittyKeyboardFlags2, MouseEvent2, MouseButton2, createCliRenderer2, CliRenderEvents2, RendererControlState2, CliRenderer2 };
|
|
24867
|
+
export { isValidBorderStyle2, parseBorderStyle2, BorderChars2, getBorderFromSides2, getBorderSides2, borderCharsToArray2, BorderCharArrays2, KeyEvent2, PasteEvent2, KeyHandler2, InternalKeyHandler2, fonts2, measureText2, getCharacterPositions2, coordinateToCharacterIndex2, renderFontToFrameBuffer2, convertThemeToStyles2, SyntaxStyle2, hastToStyledText2, SystemClock2, nonAlphanumericKeys2, terminalNamedSingleStrokeKeys2, parseKeypress2, LinearScrollAccel2, MacOSScrollAccel2, parseAlign2, parseAlignItems2, parseBoxSizing2, parseDimension2, parseDirection2, parseDisplay2, parseEdge2, parseFlexDirection2, parseGutter2, parseJustify2, parseLogLevel2, parseMeasureMode2, parseOverflow2, parsePositionType2, parseUnit2, parseWrap2, MouseParser2, Selection2, convertGlobalToLocalSelection2, ASCIIFontSelectionHelper2, StdinParser2, addDefaultParsers2, TreeSitterClient2, treeSitterToTextChunks2, treeSitterToStyledText2, DataPathsManager2, getDataPaths2, extensionToFiletype2, basenameToFiletype2, extToFiletype2, pathToFiletype2, infoStringToFiletype2, getTreeSitterClient2, destroyTreeSitterClient2, ExtmarksController2, createExtmarksController2, TerminalPalette2, createTerminalPalette2, normalizeTerminalPalette2, buildTerminalPaletteSignature2, decodePasteBytes2, stripAnsiSequences2, createHostClipboard2, createClipboard2, ClipboardTarget2, createRendererClipboardAdapter2, normalizeMarkdownLinkTarget, detectLinks2, acquireSessionBufferLease2, ResourceContext2, OptimizedBuffer2, h2, isVNode2, maybeMakeRenderable2, wrapWithDelegates2, instantiate2, delegate2, LayoutEvents2, RenderableEvents2, isRenderable2, BaseRenderable2, Renderable2, RootRenderable2, TextBuffer2, TextBufferView2, EditBuffer2, measureEditText2, EditorView2, Timeline2, engine2, getTimelineEngine2, createTimeline2, ANSI, BoxRenderable2, TextBufferRenderable2, CodeRenderable2, ImageLoadError2, ImageError2, imageInfo2, NativeImage2, NativeImagePool2, resolveImageRenderProtocol2, ImageRenderable2, isTextNodeRenderable2, TextNodeRenderable2, RootTextNodeRenderable2, TextRenderable2, NativeSession2, defaultKeyAliases, mergeKeyAliases, mergeKeyBindings, getKeyBindingAction, buildKeyBindingsMap, capture2, ConsolePosition2, TerminalConsole2, EditBufferRenderableEvents2, isEditBufferRenderable2, EditBufferRenderable2, buildKittyKeyboardFlags2, MouseEvent2, MouseButton2, createCliRenderer2, CliRenderEvents2, RendererControlState2, CliRenderer2 };
|
|
24911
24868
|
|
|
24912
|
-
//# debugId=
|
|
24913
|
-
//# sourceMappingURL=chunk-node-
|
|
24869
|
+
//# debugId=EE74AA1C4860D9AB64756E2164756E21
|
|
24870
|
+
//# sourceMappingURL=chunk-node-fs50qdd7.js.map
|