@opentui/core 0.1.75 → 0.1.76
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/ThreeRenderable.d.ts +40 -0
- package/3d/index.d.ts +1 -0
- package/3d.js +165 -2
- package/3d.js.map +4 -3
- package/Renderable.d.ts +1 -0
- package/console.d.ts +1 -1
- package/{index-s0q9547t.js → index-phtsmwj4.js} +132 -36
- package/index-phtsmwj4.js.map +61 -0
- package/index.js +65 -33
- package/index.js.map +7 -7
- package/lib/clipboard.d.ts +17 -0
- package/lib/selection.d.ts +3 -3
- package/package.json +7 -7
- package/parser.worker.js +1 -17
- package/parser.worker.js.map +2 -2
- package/renderables/Box.d.ts +1 -0
- package/renderables/Textarea.d.ts +2 -1
- package/renderer.d.ts +12 -3
- package/testing.js +6 -3
- package/testing.js.map +3 -3
- package/types.d.ts +3 -1
- package/zig-structs.d.ts +1 -1
- package/zig.d.ts +4 -1
- package/index-s0q9547t.js.map +0 -60
package/index.js
CHANGED
|
@@ -152,7 +152,7 @@ import {
|
|
|
152
152
|
white,
|
|
153
153
|
wrapWithDelegates,
|
|
154
154
|
yellow
|
|
155
|
-
} from "./index-
|
|
155
|
+
} from "./index-phtsmwj4.js";
|
|
156
156
|
// src/text-buffer-view.ts
|
|
157
157
|
class TextBufferView {
|
|
158
158
|
lib;
|
|
@@ -2285,6 +2285,9 @@ class BoxRenderable extends Renderable {
|
|
|
2285
2285
|
};
|
|
2286
2286
|
constructor(ctx, options) {
|
|
2287
2287
|
super(ctx, options);
|
|
2288
|
+
if (options.focusable === true) {
|
|
2289
|
+
this._focusable = true;
|
|
2290
|
+
}
|
|
2288
2291
|
this._backgroundColor = parseColor(options.backgroundColor || this._defaultOptions.backgroundColor);
|
|
2289
2292
|
this._border = options.border ?? this._defaultOptions.border;
|
|
2290
2293
|
if (!options.border && (options.borderStyle || options.borderColor || options.focusedBorderColor || options.customBorderChars)) {
|
|
@@ -5913,7 +5916,7 @@ class EditBufferRenderable extends Renderable {
|
|
|
5913
5916
|
} else {
|
|
5914
5917
|
changed = this.editorView.updateLocalSelection(localSelection.anchorX, localSelection.anchorY, localSelection.focusX, localSelection.focusY, this._selectionBg, this._selectionFg, updateCursor, followCursor);
|
|
5915
5918
|
}
|
|
5916
|
-
if (changed && localSelection?.isActive && selection?.
|
|
5919
|
+
if (changed && localSelection?.isActive && selection?.isDragging) {
|
|
5917
5920
|
const viewport = this.editorView.getViewport();
|
|
5918
5921
|
const focusY = localSelection.focusY;
|
|
5919
5922
|
const scrollMargin = Math.max(1, Math.floor(viewport.height * this._scrollMargin));
|
|
@@ -6130,7 +6133,7 @@ class EditBufferRenderable extends Renderable {
|
|
|
6130
6133
|
}
|
|
6131
6134
|
return;
|
|
6132
6135
|
}
|
|
6133
|
-
this._ctx.updateSelection(this, cursorX, cursorY);
|
|
6136
|
+
this._ctx.updateSelection(this, cursorX, cursorY, { finishDragging: true });
|
|
6134
6137
|
}
|
|
6135
6138
|
}
|
|
6136
6139
|
|
|
@@ -6196,7 +6199,8 @@ var defaultTextareaKeybindings = [
|
|
|
6196
6199
|
{ name: "left", super: true, shift: true, action: "select-visual-line-home" },
|
|
6197
6200
|
{ name: "right", super: true, shift: true, action: "select-visual-line-end" },
|
|
6198
6201
|
{ name: "up", super: true, shift: true, action: "select-buffer-home" },
|
|
6199
|
-
{ name: "down", super: true, shift: true, action: "select-buffer-end" }
|
|
6202
|
+
{ name: "down", super: true, shift: true, action: "select-buffer-end" },
|
|
6203
|
+
{ name: "a", super: true, action: "select-all" }
|
|
6200
6204
|
];
|
|
6201
6205
|
|
|
6202
6206
|
class TextareaRenderable extends EditBufferRenderable {
|
|
@@ -6296,6 +6300,7 @@ class TextareaRenderable extends EditBufferRenderable {
|
|
|
6296
6300
|
["select-word-backward", () => this.moveWordBackward({ select: true })],
|
|
6297
6301
|
["delete-word-forward", () => this.deleteWordForward()],
|
|
6298
6302
|
["delete-word-backward", () => this.deleteWordBackward()],
|
|
6303
|
+
["select-all", () => this.selectAll()],
|
|
6299
6304
|
["submit", () => this.submit()]
|
|
6300
6305
|
]);
|
|
6301
6306
|
}
|
|
@@ -6396,6 +6401,13 @@ class TextareaRenderable extends EditBufferRenderable {
|
|
|
6396
6401
|
}
|
|
6397
6402
|
moveCursorLeft(options) {
|
|
6398
6403
|
const select = options?.select ?? false;
|
|
6404
|
+
if (!select && this.hasSelection()) {
|
|
6405
|
+
const selection = this.getSelection();
|
|
6406
|
+
this.editBuffer.setCursorByOffset(selection.start);
|
|
6407
|
+
this._ctx.clearSelection();
|
|
6408
|
+
this.requestRender();
|
|
6409
|
+
return true;
|
|
6410
|
+
}
|
|
6399
6411
|
this.updateSelectionForMovement(select, true);
|
|
6400
6412
|
this.editBuffer.moveCursorLeft();
|
|
6401
6413
|
this.updateSelectionForMovement(select, false);
|
|
@@ -6404,6 +6416,14 @@ class TextareaRenderable extends EditBufferRenderable {
|
|
|
6404
6416
|
}
|
|
6405
6417
|
moveCursorRight(options) {
|
|
6406
6418
|
const select = options?.select ?? false;
|
|
6419
|
+
if (!select && this.hasSelection()) {
|
|
6420
|
+
const selection = this.getSelection();
|
|
6421
|
+
const targetOffset = this.cursorOffset === selection.start ? selection.end - 1 : selection.end;
|
|
6422
|
+
this.editBuffer.setCursorByOffset(targetOffset);
|
|
6423
|
+
this._ctx.clearSelection();
|
|
6424
|
+
this.requestRender();
|
|
6425
|
+
return true;
|
|
6426
|
+
}
|
|
6407
6427
|
this.updateSelectionForMovement(select, true);
|
|
6408
6428
|
this.editBuffer.moveCursorRight();
|
|
6409
6429
|
this.updateSelectionForMovement(select, false);
|
|
@@ -6494,6 +6514,11 @@ class TextareaRenderable extends EditBufferRenderable {
|
|
|
6494
6514
|
this.requestRender();
|
|
6495
6515
|
return true;
|
|
6496
6516
|
}
|
|
6517
|
+
selectAll() {
|
|
6518
|
+
this.updateSelectionForMovement(false, true);
|
|
6519
|
+
this.editBuffer.setCursor(0, 0);
|
|
6520
|
+
return this.gotoBufferEnd({ select: true });
|
|
6521
|
+
}
|
|
6497
6522
|
deleteToLineEnd() {
|
|
6498
6523
|
const cursor = this.editorView.getCursor();
|
|
6499
6524
|
const eol = this.editBuffer.getEOL();
|
|
@@ -8170,6 +8195,8 @@ class MarkdownRenderable extends Renderable {
|
|
|
8170
8195
|
}
|
|
8171
8196
|
}
|
|
8172
8197
|
getStyle(group) {
|
|
8198
|
+
if (!this._syntaxStyle)
|
|
8199
|
+
return;
|
|
8173
8200
|
let style = this._syntaxStyle.getStyle(group);
|
|
8174
8201
|
if (!style && group.includes(".")) {
|
|
8175
8202
|
const baseName = group.split(".")[0];
|
|
@@ -8177,7 +8204,7 @@ class MarkdownRenderable extends Renderable {
|
|
|
8177
8204
|
}
|
|
8178
8205
|
return style;
|
|
8179
8206
|
}
|
|
8180
|
-
createChunk(text, group) {
|
|
8207
|
+
createChunk(text, group, link2) {
|
|
8181
8208
|
const style = this.getStyle(group) || this.getStyle("default");
|
|
8182
8209
|
return {
|
|
8183
8210
|
__isChunk: true,
|
|
@@ -8189,7 +8216,8 @@ class MarkdownRenderable extends Renderable {
|
|
|
8189
8216
|
italic: style.italic,
|
|
8190
8217
|
underline: style.underline,
|
|
8191
8218
|
dim: style.dim
|
|
8192
|
-
}) : 0
|
|
8219
|
+
}) : 0,
|
|
8220
|
+
link: link2
|
|
8193
8221
|
};
|
|
8194
8222
|
}
|
|
8195
8223
|
createDefaultChunk(text) {
|
|
@@ -8250,35 +8278,39 @@ class MarkdownRenderable extends Renderable {
|
|
|
8250
8278
|
chunks.push(this.createChunk("~~", "markup.strikethrough"));
|
|
8251
8279
|
}
|
|
8252
8280
|
break;
|
|
8253
|
-
case "link":
|
|
8281
|
+
case "link": {
|
|
8282
|
+
const linkHref = { url: token.href };
|
|
8254
8283
|
if (this._conceal) {
|
|
8255
8284
|
for (const child of token.tokens) {
|
|
8256
|
-
this.renderInlineTokenWithStyle(child, chunks, "markup.link.label");
|
|
8285
|
+
this.renderInlineTokenWithStyle(child, chunks, "markup.link.label", linkHref);
|
|
8257
8286
|
}
|
|
8258
|
-
chunks.push(this.createChunk(" (", "markup.link"));
|
|
8259
|
-
chunks.push(this.createChunk(token.href, "markup.link.url"));
|
|
8260
|
-
chunks.push(this.createChunk(")", "markup.link"));
|
|
8287
|
+
chunks.push(this.createChunk(" (", "markup.link", linkHref));
|
|
8288
|
+
chunks.push(this.createChunk(token.href, "markup.link.url", linkHref));
|
|
8289
|
+
chunks.push(this.createChunk(")", "markup.link", linkHref));
|
|
8261
8290
|
} else {
|
|
8262
|
-
chunks.push(this.createChunk("[", "markup.link"));
|
|
8291
|
+
chunks.push(this.createChunk("[", "markup.link", linkHref));
|
|
8263
8292
|
for (const child of token.tokens) {
|
|
8264
|
-
this.renderInlineTokenWithStyle(child, chunks, "markup.link.label");
|
|
8293
|
+
this.renderInlineTokenWithStyle(child, chunks, "markup.link.label", linkHref);
|
|
8265
8294
|
}
|
|
8266
|
-
chunks.push(this.createChunk("](", "markup.link"));
|
|
8267
|
-
chunks.push(this.createChunk(token.href, "markup.link.url"));
|
|
8268
|
-
chunks.push(this.createChunk(")", "markup.link"));
|
|
8295
|
+
chunks.push(this.createChunk("](", "markup.link", linkHref));
|
|
8296
|
+
chunks.push(this.createChunk(token.href, "markup.link.url", linkHref));
|
|
8297
|
+
chunks.push(this.createChunk(")", "markup.link", linkHref));
|
|
8269
8298
|
}
|
|
8270
8299
|
break;
|
|
8271
|
-
|
|
8300
|
+
}
|
|
8301
|
+
case "image": {
|
|
8302
|
+
const imageHref = { url: token.href };
|
|
8272
8303
|
if (this._conceal) {
|
|
8273
|
-
chunks.push(this.createChunk(token.text || "image", "markup.link.label"));
|
|
8304
|
+
chunks.push(this.createChunk(token.text || "image", "markup.link.label", imageHref));
|
|
8274
8305
|
} else {
|
|
8275
|
-
chunks.push(this.createChunk(");
|
|
8278
|
-
chunks.push(this.createChunk(token.href, "markup.link.url"));
|
|
8279
|
-
chunks.push(this.createChunk(")", "markup.link"));
|
|
8306
|
+
chunks.push(this.createChunk(");
|
|
8309
|
+
chunks.push(this.createChunk(token.href, "markup.link.url", imageHref));
|
|
8310
|
+
chunks.push(this.createChunk(")", "markup.link", imageHref));
|
|
8280
8311
|
}
|
|
8281
8312
|
break;
|
|
8313
|
+
}
|
|
8282
8314
|
case "br":
|
|
8283
8315
|
chunks.push(this.createDefaultChunk(`
|
|
8284
8316
|
`));
|
|
@@ -8292,21 +8324,21 @@ class MarkdownRenderable extends Renderable {
|
|
|
8292
8324
|
break;
|
|
8293
8325
|
}
|
|
8294
8326
|
}
|
|
8295
|
-
renderInlineTokenWithStyle(token, chunks, styleGroup) {
|
|
8327
|
+
renderInlineTokenWithStyle(token, chunks, styleGroup, link2) {
|
|
8296
8328
|
switch (token.type) {
|
|
8297
8329
|
case "text":
|
|
8298
|
-
chunks.push(this.createChunk(token.text, styleGroup));
|
|
8330
|
+
chunks.push(this.createChunk(token.text, styleGroup, link2));
|
|
8299
8331
|
break;
|
|
8300
8332
|
case "escape":
|
|
8301
|
-
chunks.push(this.createChunk(token.text, styleGroup));
|
|
8333
|
+
chunks.push(this.createChunk(token.text, styleGroup, link2));
|
|
8302
8334
|
break;
|
|
8303
8335
|
case "codespan":
|
|
8304
8336
|
if (this._conceal) {
|
|
8305
|
-
chunks.push(this.createChunk(token.text, "markup.raw"));
|
|
8337
|
+
chunks.push(this.createChunk(token.text, "markup.raw", link2));
|
|
8306
8338
|
} else {
|
|
8307
|
-
chunks.push(this.createChunk("`", "markup.raw"));
|
|
8308
|
-
chunks.push(this.createChunk(token.text, "markup.raw"));
|
|
8309
|
-
chunks.push(this.createChunk("`", "markup.raw"));
|
|
8339
|
+
chunks.push(this.createChunk("`", "markup.raw", link2));
|
|
8340
|
+
chunks.push(this.createChunk(token.text, "markup.raw", link2));
|
|
8341
|
+
chunks.push(this.createChunk("`", "markup.raw", link2));
|
|
8310
8342
|
}
|
|
8311
8343
|
break;
|
|
8312
8344
|
default:
|
|
@@ -9607,7 +9639,7 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
9607
9639
|
}
|
|
9608
9640
|
this.selectionListener = () => {
|
|
9609
9641
|
const selection = this._ctx.getSelection();
|
|
9610
|
-
if (!selection || !selection.
|
|
9642
|
+
if (!selection || !selection.isDragging) {
|
|
9611
9643
|
this.stopAutoScroll();
|
|
9612
9644
|
}
|
|
9613
9645
|
};
|
|
@@ -9707,7 +9739,7 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
9707
9739
|
this._hasManualScroll = true;
|
|
9708
9740
|
}
|
|
9709
9741
|
}
|
|
9710
|
-
if (event.type === "drag" && event.
|
|
9742
|
+
if (event.type === "drag" && event.isDragging) {
|
|
9711
9743
|
this.updateAutoScroll(event.x, event.y);
|
|
9712
9744
|
} else if (event.type === "up") {
|
|
9713
9745
|
this.stopAutoScroll();
|
|
@@ -10830,5 +10862,5 @@ export {
|
|
|
10830
10862
|
ASCIIFont
|
|
10831
10863
|
};
|
|
10832
10864
|
|
|
10833
|
-
//# debugId=
|
|
10865
|
+
//# debugId=004D8C839D92DEBF64756E2164756E21
|
|
10834
10866
|
//# sourceMappingURL=index.js.map
|