@opentui/core 0.5.10 → 0.5.12
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 +2 -0
- package/audio.d.ts +6 -1
- package/{chunk-bun-9gqvxy8c.js → chunk-bun-8f4q4e2m.js} +1234 -1039
- package/{chunk-bun-9gqvxy8c.js.map → chunk-bun-8f4q4e2m.js.map} +8 -8
- package/{chunk-bun-bb3k0yt8.js → chunk-bun-91mz470w.js} +680 -585
- package/chunk-bun-91mz470w.js.map +32 -0
- package/{chunk-node-f647ts9q.js → chunk-node-1zjyxy5y.js} +1241 -1043
- package/chunk-node-1zjyxy5y.js.map +63 -0
- package/{chunk-node-6bg8r2m7.js → chunk-node-fyb4fckk.js} +680 -585
- package/chunk-node-fyb4fckk.js.map +32 -0
- package/editor-view.d.ts +1 -0
- package/index.bun.js +1603 -1377
- package/index.bun.js.map +8 -8
- package/index.node.js +1603 -1377
- package/index.node.js.map +8 -8
- package/lib/detect-links.d.ts +5 -0
- package/lib/tree-sitter/update-assets.js +4 -4
- package/lib/tree-sitter/update-assets.js.map +2 -2
- package/lib/tree-sitter-styled-text.d.ts +4 -0
- package/node-assets.js +6 -2
- package/node-assets.js.map +3 -3
- package/package.json +13 -9
- package/parser.worker.js +7 -12
- package/parser.worker.js.map +3 -3
- package/renderables/Code.d.ts +6 -0
- package/renderables/Diff.d.ts +1 -2
- package/renderables/EmbeddedTerminal.d.ts +4 -0
- package/renderables/Markdown.d.ts +6 -0
- package/renderables/TextBufferRenderable.d.ts +7 -0
- package/renderables/TextTable.d.ts +2 -0
- package/renderer.d.ts +2 -0
- package/runtime-plugin.js +15 -4
- package/runtime-plugin.js.map +1 -1
- package/testing.bun.js +23 -23
- package/testing.bun.js.map +2 -2
- package/testing.js +23 -23
- package/testing.js.map +2 -2
- package/text-buffer-view.d.ts +2 -0
- package/types.d.ts +2 -1
- package/yoga.bun.js +187 -187
- package/yoga.bun.js.map +1 -1
- package/yoga.js +187 -187
- package/yoga.js.map +1 -1
- package/zig-structs.d.ts +8 -1
- package/zig.d.ts +6 -0
- package/chunk-bun-bb3k0yt8.js.map +0 -32
- package/chunk-node-6bg8r2m7.js.map +0 -32
- package/chunk-node-f647ts9q.js.map +0 -63
|
@@ -1,47 +1,243 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
InternalKeyHandler,
|
|
5
|
-
KeyHandler,
|
|
6
|
-
NativeMeasureTargetKind,
|
|
7
|
-
OptimizedBuffer,
|
|
8
|
-
RGBA,
|
|
9
|
-
Selection,
|
|
10
|
-
SpanInfoStruct,
|
|
11
|
-
StdinParser,
|
|
12
|
-
StyledText,
|
|
13
|
-
SystemClock,
|
|
14
|
-
TextBuffer,
|
|
15
|
-
borderCharsToArray,
|
|
16
|
-
buildTerminalPaletteSignature,
|
|
17
|
-
convertGlobalToLocalSelection,
|
|
18
|
-
createExtmarksController,
|
|
19
|
-
createTerminalPalette,
|
|
20
|
-
createTextAttributes,
|
|
21
|
-
destroyTreeSitterClient,
|
|
22
|
-
env,
|
|
23
|
-
getBorderSides,
|
|
24
|
-
getTreeSitterClient,
|
|
25
|
-
isStyledText,
|
|
26
|
-
normalizeTerminalPalette,
|
|
27
|
-
parseAlign,
|
|
28
|
-
parseAlignItems,
|
|
29
|
-
parseBorderStyle,
|
|
30
|
-
parseColor,
|
|
31
|
-
parseFlexDirection,
|
|
32
|
-
parseJustify,
|
|
33
|
-
parseOverflow,
|
|
34
|
-
parsePositionType,
|
|
35
|
-
parseWrap,
|
|
36
|
-
registerEnvVar,
|
|
37
|
-
resolveRenderLib,
|
|
3
|
+
toArrayBuffer,
|
|
38
4
|
singleton,
|
|
5
|
+
registerEnvVar2,
|
|
6
|
+
env2,
|
|
39
7
|
sleep,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
8
|
+
RGBA2,
|
|
9
|
+
parseColor2,
|
|
10
|
+
parseBorderStyle2,
|
|
11
|
+
getBorderSides2,
|
|
12
|
+
borderCharsToArray2,
|
|
13
|
+
KeyHandler2,
|
|
14
|
+
InternalKeyHandler2,
|
|
15
|
+
createTextAttributes2,
|
|
16
|
+
getLinkId2,
|
|
17
|
+
isStyledText2,
|
|
18
|
+
StyledText2,
|
|
19
|
+
stringToStyledText2,
|
|
20
|
+
SystemClock2,
|
|
21
|
+
parseAlign2,
|
|
22
|
+
parseAlignItems2,
|
|
23
|
+
parseFlexDirection2,
|
|
24
|
+
parseJustify2,
|
|
25
|
+
parseOverflow2,
|
|
26
|
+
parsePositionType2,
|
|
27
|
+
parseWrap2,
|
|
28
|
+
Selection2,
|
|
29
|
+
convertGlobalToLocalSelection2,
|
|
30
|
+
StdinParser2,
|
|
31
|
+
treeSitterToTextChunks2,
|
|
32
|
+
getTreeSitterClient2,
|
|
33
|
+
destroyTreeSitterClient2,
|
|
34
|
+
createExtmarksController2,
|
|
35
|
+
createTerminalPalette2,
|
|
36
|
+
normalizeTerminalPalette2,
|
|
37
|
+
buildTerminalPaletteSignature2,
|
|
38
|
+
Clipboard2,
|
|
39
|
+
OptimizedBuffer2,
|
|
40
|
+
TextBuffer2,
|
|
41
|
+
SpanInfoStruct,
|
|
42
|
+
NativeMeasureTargetKind2,
|
|
43
|
+
resolveRenderLib2,
|
|
43
44
|
yoga_default
|
|
44
|
-
} from "./chunk-bun-
|
|
45
|
+
} from "./chunk-bun-8f4q4e2m.js";
|
|
46
|
+
|
|
47
|
+
// src/syntax-style.ts
|
|
48
|
+
function convertThemeToStyles2(theme) {
|
|
49
|
+
const flatStyles = {};
|
|
50
|
+
for (const tokenStyle of theme) {
|
|
51
|
+
const styleDefinition = {};
|
|
52
|
+
if (tokenStyle.style.foreground) {
|
|
53
|
+
styleDefinition.fg = parseColor2(tokenStyle.style.foreground);
|
|
54
|
+
}
|
|
55
|
+
if (tokenStyle.style.background) {
|
|
56
|
+
styleDefinition.bg = parseColor2(tokenStyle.style.background);
|
|
57
|
+
}
|
|
58
|
+
if (tokenStyle.style.bold !== undefined) {
|
|
59
|
+
styleDefinition.bold = tokenStyle.style.bold;
|
|
60
|
+
}
|
|
61
|
+
if (tokenStyle.style.italic !== undefined) {
|
|
62
|
+
styleDefinition.italic = tokenStyle.style.italic;
|
|
63
|
+
}
|
|
64
|
+
if (tokenStyle.style.underline !== undefined) {
|
|
65
|
+
styleDefinition.underline = tokenStyle.style.underline;
|
|
66
|
+
}
|
|
67
|
+
if (tokenStyle.style.dim !== undefined) {
|
|
68
|
+
styleDefinition.dim = tokenStyle.style.dim;
|
|
69
|
+
}
|
|
70
|
+
for (const scope of tokenStyle.scope) {
|
|
71
|
+
flatStyles[scope] = styleDefinition;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return flatStyles;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
class SyntaxStyle2 {
|
|
78
|
+
lib;
|
|
79
|
+
stylePtr;
|
|
80
|
+
_destroyed = false;
|
|
81
|
+
nameCache = new Map;
|
|
82
|
+
styleDefs = new Map;
|
|
83
|
+
mergedCache = new Map;
|
|
84
|
+
constructor(lib, ptr) {
|
|
85
|
+
this.lib = lib;
|
|
86
|
+
this.stylePtr = ptr;
|
|
87
|
+
}
|
|
88
|
+
static create() {
|
|
89
|
+
const lib = resolveRenderLib2();
|
|
90
|
+
const ptr = lib.createSyntaxStyle();
|
|
91
|
+
return new SyntaxStyle2(lib, ptr);
|
|
92
|
+
}
|
|
93
|
+
static fromTheme(theme) {
|
|
94
|
+
const style = SyntaxStyle2.create();
|
|
95
|
+
const flatStyles = convertThemeToStyles2(theme);
|
|
96
|
+
for (const [name, styleDef] of Object.entries(flatStyles)) {
|
|
97
|
+
style.registerStyle(name, styleDef);
|
|
98
|
+
}
|
|
99
|
+
return style;
|
|
100
|
+
}
|
|
101
|
+
static fromStyles(styles) {
|
|
102
|
+
const style = SyntaxStyle2.create();
|
|
103
|
+
for (const [name, styleDef] of Object.entries(styles)) {
|
|
104
|
+
style.registerStyle(name, styleDef);
|
|
105
|
+
}
|
|
106
|
+
return style;
|
|
107
|
+
}
|
|
108
|
+
guard() {
|
|
109
|
+
if (this._destroyed)
|
|
110
|
+
throw new Error("NativeSyntaxStyle is destroyed");
|
|
111
|
+
}
|
|
112
|
+
registerStyle(name, style) {
|
|
113
|
+
this.guard();
|
|
114
|
+
const attributes = createTextAttributes2({
|
|
115
|
+
bold: style.bold,
|
|
116
|
+
italic: style.italic,
|
|
117
|
+
underline: style.underline,
|
|
118
|
+
dim: style.dim
|
|
119
|
+
});
|
|
120
|
+
const fg = style.fg ? parseColor2(style.fg) : null;
|
|
121
|
+
const bg = style.bg ? parseColor2(style.bg) : null;
|
|
122
|
+
const id = this.lib.syntaxStyleRegister(this.stylePtr, name, fg, bg, attributes);
|
|
123
|
+
this.nameCache.set(name, id);
|
|
124
|
+
this.styleDefs.set(name, { ...style, fg: fg ?? undefined, bg: bg ?? undefined });
|
|
125
|
+
return id;
|
|
126
|
+
}
|
|
127
|
+
resolveStyleId(name) {
|
|
128
|
+
this.guard();
|
|
129
|
+
const cached = this.nameCache.get(name);
|
|
130
|
+
if (cached !== undefined)
|
|
131
|
+
return cached;
|
|
132
|
+
const id = this.lib.syntaxStyleResolveByName(this.stylePtr, name);
|
|
133
|
+
if (id !== null) {
|
|
134
|
+
this.nameCache.set(name, id);
|
|
135
|
+
}
|
|
136
|
+
return id;
|
|
137
|
+
}
|
|
138
|
+
getStyleId(name) {
|
|
139
|
+
this.guard();
|
|
140
|
+
const id = this.resolveStyleId(name);
|
|
141
|
+
if (id !== null)
|
|
142
|
+
return id;
|
|
143
|
+
if (name.includes(".")) {
|
|
144
|
+
const baseName = name.split(".")[0];
|
|
145
|
+
return this.resolveStyleId(baseName);
|
|
146
|
+
}
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
get ptr() {
|
|
150
|
+
this.guard();
|
|
151
|
+
return this.stylePtr;
|
|
152
|
+
}
|
|
153
|
+
getStyleCount() {
|
|
154
|
+
this.guard();
|
|
155
|
+
return this.lib.syntaxStyleGetStyleCount(this.stylePtr);
|
|
156
|
+
}
|
|
157
|
+
clearNameCache() {
|
|
158
|
+
this.nameCache.clear();
|
|
159
|
+
}
|
|
160
|
+
getStyle(name) {
|
|
161
|
+
this.guard();
|
|
162
|
+
if (Object.prototype.hasOwnProperty.call(this.styleDefs, name)) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const style = this.styleDefs.get(name);
|
|
166
|
+
if (style)
|
|
167
|
+
return style;
|
|
168
|
+
if (name.includes(".")) {
|
|
169
|
+
const baseName = name.split(".")[0];
|
|
170
|
+
if (Object.prototype.hasOwnProperty.call(this.styleDefs, baseName)) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
return this.styleDefs.get(baseName);
|
|
174
|
+
}
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
mergeStyles(...styleNames) {
|
|
178
|
+
this.guard();
|
|
179
|
+
const cacheKey = styleNames.join(":");
|
|
180
|
+
const cached = this.mergedCache.get(cacheKey);
|
|
181
|
+
if (cached)
|
|
182
|
+
return cached;
|
|
183
|
+
const styleDefinition = {};
|
|
184
|
+
for (const name of styleNames) {
|
|
185
|
+
const style = this.getStyle(name);
|
|
186
|
+
if (!style)
|
|
187
|
+
continue;
|
|
188
|
+
if (style.fg)
|
|
189
|
+
styleDefinition.fg = style.fg;
|
|
190
|
+
if (style.bg)
|
|
191
|
+
styleDefinition.bg = style.bg;
|
|
192
|
+
if (style.bold !== undefined)
|
|
193
|
+
styleDefinition.bold = style.bold;
|
|
194
|
+
if (style.italic !== undefined)
|
|
195
|
+
styleDefinition.italic = style.italic;
|
|
196
|
+
if (style.underline !== undefined)
|
|
197
|
+
styleDefinition.underline = style.underline;
|
|
198
|
+
if (style.dim !== undefined)
|
|
199
|
+
styleDefinition.dim = style.dim;
|
|
200
|
+
}
|
|
201
|
+
const attributes = createTextAttributes2({
|
|
202
|
+
bold: styleDefinition.bold,
|
|
203
|
+
italic: styleDefinition.italic,
|
|
204
|
+
underline: styleDefinition.underline,
|
|
205
|
+
dim: styleDefinition.dim
|
|
206
|
+
});
|
|
207
|
+
const merged = {
|
|
208
|
+
fg: styleDefinition.fg,
|
|
209
|
+
bg: styleDefinition.bg,
|
|
210
|
+
attributes
|
|
211
|
+
};
|
|
212
|
+
this.mergedCache.set(cacheKey, merged);
|
|
213
|
+
return merged;
|
|
214
|
+
}
|
|
215
|
+
clearCache() {
|
|
216
|
+
this.guard();
|
|
217
|
+
this.mergedCache.clear();
|
|
218
|
+
}
|
|
219
|
+
getCacheSize() {
|
|
220
|
+
this.guard();
|
|
221
|
+
return this.mergedCache.size;
|
|
222
|
+
}
|
|
223
|
+
getAllStyles() {
|
|
224
|
+
this.guard();
|
|
225
|
+
return new Map(this.styleDefs);
|
|
226
|
+
}
|
|
227
|
+
getRegisteredNames() {
|
|
228
|
+
this.guard();
|
|
229
|
+
return Array.from(this.styleDefs.keys());
|
|
230
|
+
}
|
|
231
|
+
destroy() {
|
|
232
|
+
if (this._destroyed)
|
|
233
|
+
return;
|
|
234
|
+
this._destroyed = true;
|
|
235
|
+
this.nameCache.clear();
|
|
236
|
+
this.styleDefs.clear();
|
|
237
|
+
this.mergedCache.clear();
|
|
238
|
+
this.lib.destroySyntaxStyle(this.stylePtr);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
45
241
|
|
|
46
242
|
// src/Renderable.ts
|
|
47
243
|
import { EventEmitter } from "events";
|
|
@@ -121,22 +317,22 @@ function isSizeType(value) {
|
|
|
121
317
|
|
|
122
318
|
// src/Renderable.ts
|
|
123
319
|
var BrandedRenderable = Symbol.for("@opentui/core/Renderable");
|
|
124
|
-
var
|
|
125
|
-
((
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
})(
|
|
129
|
-
var
|
|
130
|
-
((
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
})(
|
|
135
|
-
function
|
|
320
|
+
var LayoutEvents2;
|
|
321
|
+
((LayoutEvents) => {
|
|
322
|
+
LayoutEvents["LAYOUT_CHANGED"] = "layout-changed";
|
|
323
|
+
LayoutEvents["RESIZED"] = "resized";
|
|
324
|
+
})(LayoutEvents2 ||= {});
|
|
325
|
+
var RenderableEvents2;
|
|
326
|
+
((RenderableEvents) => {
|
|
327
|
+
RenderableEvents["FOCUSED"] = "focused";
|
|
328
|
+
RenderableEvents["BLURRED"] = "blurred";
|
|
329
|
+
RenderableEvents["DESTROYED"] = "destroyed";
|
|
330
|
+
})(RenderableEvents2 ||= {});
|
|
331
|
+
function isRenderable2(obj) {
|
|
136
332
|
return !!obj?.[BrandedRenderable];
|
|
137
333
|
}
|
|
138
334
|
|
|
139
|
-
class
|
|
335
|
+
class BaseRenderable2 extends EventEmitter {
|
|
140
336
|
[BrandedRenderable] = true;
|
|
141
337
|
static renderableNumber = 1;
|
|
142
338
|
_id;
|
|
@@ -146,7 +342,7 @@ class BaseRenderable extends EventEmitter {
|
|
|
146
342
|
_visible = true;
|
|
147
343
|
constructor(options) {
|
|
148
344
|
super();
|
|
149
|
-
this.num =
|
|
345
|
+
this.num = BaseRenderable2.renderableNumber++;
|
|
150
346
|
this._id = options.id ?? `renderable-${this.num}`;
|
|
151
347
|
}
|
|
152
348
|
get id() {
|
|
@@ -190,7 +386,7 @@ function bumpRenderListRevision(ctx) {
|
|
|
190
386
|
generationContext.__otuiRenderListRevision = getRenderListRevision(ctx) + 1;
|
|
191
387
|
}
|
|
192
388
|
|
|
193
|
-
class
|
|
389
|
+
class Renderable2 extends BaseRenderable2 {
|
|
194
390
|
static renderablesByNumber = new Map;
|
|
195
391
|
_isDestroyed = false;
|
|
196
392
|
_ctx;
|
|
@@ -240,7 +436,7 @@ class Renderable extends BaseRenderable {
|
|
|
240
436
|
constructor(ctx, options) {
|
|
241
437
|
super(options);
|
|
242
438
|
this._ctx = ctx;
|
|
243
|
-
|
|
439
|
+
Renderable2.renderablesByNumber.set(this.num, this);
|
|
244
440
|
validateOptions(this.id, options);
|
|
245
441
|
this.renderBefore = options.renderBefore;
|
|
246
442
|
this.renderAfter = options.renderAfter;
|
|
@@ -412,7 +608,7 @@ class Renderable extends BaseRenderable {
|
|
|
412
608
|
for (const child of this._childrenInLayoutOrder) {
|
|
413
609
|
if (child.id === id)
|
|
414
610
|
return child;
|
|
415
|
-
if (
|
|
611
|
+
if (isRenderable2(child)) {
|
|
416
612
|
const found = child.findDescendantById(id);
|
|
417
613
|
if (found)
|
|
418
614
|
return found;
|
|
@@ -601,11 +797,11 @@ class Renderable extends BaseRenderable {
|
|
|
601
797
|
this._flexShrink = hasExplicitWidth || hasExplicitHeight ? 0 : 1;
|
|
602
798
|
node.setFlexShrink(this._flexShrink);
|
|
603
799
|
}
|
|
604
|
-
node.setFlexDirection(
|
|
605
|
-
node.setFlexWrap(
|
|
606
|
-
node.setAlignItems(
|
|
607
|
-
node.setJustifyContent(
|
|
608
|
-
node.setAlignSelf(
|
|
800
|
+
node.setFlexDirection(parseFlexDirection2(options.flexDirection));
|
|
801
|
+
node.setFlexWrap(parseWrap2(options.flexWrap));
|
|
802
|
+
node.setAlignItems(parseAlignItems2(options.alignItems));
|
|
803
|
+
node.setJustifyContent(parseJustify2(options.justifyContent));
|
|
804
|
+
node.setAlignSelf(parseAlign2(options.alignSelf));
|
|
609
805
|
if (isDimensionType(options.width)) {
|
|
610
806
|
this._width = options.width;
|
|
611
807
|
this.yogaNode.setWidth(options.width);
|
|
@@ -616,11 +812,11 @@ class Renderable extends BaseRenderable {
|
|
|
616
812
|
}
|
|
617
813
|
this._positionType = options.position === "absolute" ? "absolute" : "relative";
|
|
618
814
|
if (this._positionType !== "relative") {
|
|
619
|
-
node.setPositionType(
|
|
815
|
+
node.setPositionType(parsePositionType2(this._positionType));
|
|
620
816
|
}
|
|
621
817
|
this._overflow = options.overflow === "hidden" ? "hidden" : options.overflow === "scroll" ? "scroll" : "visible";
|
|
622
818
|
if (this._overflow !== "visible") {
|
|
623
|
-
node.setOverflow(
|
|
819
|
+
node.setOverflow(parseOverflow2(this._overflow));
|
|
624
820
|
}
|
|
625
821
|
const hasPositionProps = options.top !== undefined || options.right !== undefined || options.bottom !== undefined || options.left !== undefined;
|
|
626
822
|
if (hasPositionProps) {
|
|
@@ -689,7 +885,7 @@ class Renderable extends BaseRenderable {
|
|
|
689
885
|
if (!isPositionTypeType(positionType) || this._positionType === positionType)
|
|
690
886
|
return;
|
|
691
887
|
this._positionType = positionType;
|
|
692
|
-
this.yogaNode.setPositionType(
|
|
888
|
+
this.yogaNode.setPositionType(parsePositionType2(positionType));
|
|
693
889
|
this.requestRender();
|
|
694
890
|
}
|
|
695
891
|
get overflow() {
|
|
@@ -699,7 +895,7 @@ class Renderable extends BaseRenderable {
|
|
|
699
895
|
if (!isOverflowType(overflow) || this._overflow === overflow)
|
|
700
896
|
return;
|
|
701
897
|
this._overflow = overflow;
|
|
702
|
-
this.yogaNode.setOverflow(
|
|
898
|
+
this.yogaNode.setOverflow(parseOverflow2(overflow));
|
|
703
899
|
bumpRenderListRevision(this._ctx);
|
|
704
900
|
this.requestRender();
|
|
705
901
|
}
|
|
@@ -755,23 +951,23 @@ class Renderable extends BaseRenderable {
|
|
|
755
951
|
this.requestRender();
|
|
756
952
|
}
|
|
757
953
|
set flexDirection(direction) {
|
|
758
|
-
this.yogaNode.setFlexDirection(
|
|
954
|
+
this.yogaNode.setFlexDirection(parseFlexDirection2(direction));
|
|
759
955
|
this.requestRender();
|
|
760
956
|
}
|
|
761
957
|
set flexWrap(wrap) {
|
|
762
|
-
this.yogaNode.setFlexWrap(
|
|
958
|
+
this.yogaNode.setFlexWrap(parseWrap2(wrap));
|
|
763
959
|
this.requestRender();
|
|
764
960
|
}
|
|
765
961
|
set alignItems(alignItems) {
|
|
766
|
-
this.yogaNode.setAlignItems(
|
|
962
|
+
this.yogaNode.setAlignItems(parseAlignItems2(alignItems));
|
|
767
963
|
this.requestRender();
|
|
768
964
|
}
|
|
769
965
|
set justifyContent(justifyContent) {
|
|
770
|
-
this.yogaNode.setJustifyContent(
|
|
966
|
+
this.yogaNode.setJustifyContent(parseJustify2(justifyContent));
|
|
771
967
|
this.requestRender();
|
|
772
968
|
}
|
|
773
969
|
set alignSelf(alignSelf) {
|
|
774
|
-
this.yogaNode.setAlignSelf(
|
|
970
|
+
this.yogaNode.setAlignSelf(parseAlign2(alignSelf));
|
|
775
971
|
this.requestRender();
|
|
776
972
|
}
|
|
777
973
|
set flexBasis(basis) {
|
|
@@ -956,7 +1152,7 @@ class Renderable extends BaseRenderable {
|
|
|
956
1152
|
}
|
|
957
1153
|
try {
|
|
958
1154
|
const widthMethod = this._ctx.widthMethod;
|
|
959
|
-
this.frameBuffer =
|
|
1155
|
+
this.frameBuffer = OptimizedBuffer2.create(w, h, widthMethod, {
|
|
960
1156
|
respectAlpha: true,
|
|
961
1157
|
id: `framebuffer-${this.id}`
|
|
962
1158
|
});
|
|
@@ -979,7 +1175,7 @@ class Renderable extends BaseRenderable {
|
|
|
979
1175
|
if (!obj) {
|
|
980
1176
|
return -1;
|
|
981
1177
|
}
|
|
982
|
-
const renderable =
|
|
1178
|
+
const renderable = maybeMakeRenderable2(this._ctx, obj);
|
|
983
1179
|
if (!renderable) {
|
|
984
1180
|
return -1;
|
|
985
1181
|
}
|
|
@@ -1024,7 +1220,7 @@ class Renderable extends BaseRenderable {
|
|
|
1024
1220
|
if (!obj) {
|
|
1025
1221
|
return -1;
|
|
1026
1222
|
}
|
|
1027
|
-
const renderable =
|
|
1223
|
+
const renderable = maybeMakeRenderable2(this._ctx, obj);
|
|
1028
1224
|
if (!renderable) {
|
|
1029
1225
|
return -1;
|
|
1030
1226
|
}
|
|
@@ -1034,7 +1230,7 @@ class Renderable extends BaseRenderable {
|
|
|
1034
1230
|
}
|
|
1035
1231
|
return -1;
|
|
1036
1232
|
}
|
|
1037
|
-
if (!
|
|
1233
|
+
if (!isRenderable2(anchor)) {
|
|
1038
1234
|
throw new Error("Anchor must be a Renderable");
|
|
1039
1235
|
}
|
|
1040
1236
|
if (anchor.isDestroyed) {
|
|
@@ -1083,7 +1279,7 @@ class Renderable extends BaseRenderable {
|
|
|
1083
1279
|
return this._childrenInLayoutOrder.find((child) => child.id === id);
|
|
1084
1280
|
}
|
|
1085
1281
|
remove(child) {
|
|
1086
|
-
if (!(child instanceof
|
|
1282
|
+
if (!(child instanceof BaseRenderable2)) {
|
|
1087
1283
|
throw new Error("remove expects a renderable child object");
|
|
1088
1284
|
}
|
|
1089
1285
|
const index = this._childrenInLayoutOrder.indexOf(child);
|
|
@@ -1200,13 +1396,13 @@ class Renderable extends BaseRenderable {
|
|
|
1200
1396
|
}
|
|
1201
1397
|
}
|
|
1202
1398
|
_hasVisibleChildFilter() {
|
|
1203
|
-
return this._getVisibleChildren !==
|
|
1399
|
+
return this._getVisibleChildren !== Renderable2.prototype._getVisibleChildren;
|
|
1204
1400
|
}
|
|
1205
1401
|
_getVisibleChildren() {
|
|
1206
1402
|
return this._childrenInZIndexOrder.map((child) => child.num);
|
|
1207
1403
|
}
|
|
1208
1404
|
canReuseRenderCommandList() {
|
|
1209
|
-
return this.onUpdate ===
|
|
1405
|
+
return this.onUpdate === Renderable2.prototype.onUpdate && (this._overflow === "visible" || this.getScissorRect === Renderable2.prototype.getScissorRect) && !this._hasVisibleChildFilter();
|
|
1210
1406
|
}
|
|
1211
1407
|
onUpdate(deltaTime) {}
|
|
1212
1408
|
getScissorRect() {
|
|
@@ -1240,7 +1436,7 @@ class Renderable extends BaseRenderable {
|
|
|
1240
1436
|
this._childrenInLayoutOrder = [];
|
|
1241
1437
|
this._childrenInZIndexOrder = [];
|
|
1242
1438
|
this._shouldUpdateBefore.clear();
|
|
1243
|
-
|
|
1439
|
+
Renderable2.renderablesByNumber.delete(this.num);
|
|
1244
1440
|
this.blur();
|
|
1245
1441
|
this.removeAllListeners();
|
|
1246
1442
|
this.destroySelf();
|
|
@@ -1364,7 +1560,7 @@ class Renderable extends BaseRenderable {
|
|
|
1364
1560
|
}
|
|
1365
1561
|
}
|
|
1366
1562
|
|
|
1367
|
-
class
|
|
1563
|
+
class RootRenderable2 extends Renderable2 {
|
|
1368
1564
|
renderList = [];
|
|
1369
1565
|
_currentRenderable;
|
|
1370
1566
|
appliedLayoutGeneration = -1;
|
|
@@ -1491,7 +1687,7 @@ class RootRenderable extends Renderable {
|
|
|
1491
1687
|
import util from "util";
|
|
1492
1688
|
var BrandedVNode = Symbol.for("@opentui/core/VNode");
|
|
1493
1689
|
function isRenderableConstructor(value) {
|
|
1494
|
-
return typeof value === "function" && value.prototype &&
|
|
1690
|
+
return typeof value === "function" && value.prototype && Renderable2.prototype.isPrototypeOf(value.prototype);
|
|
1495
1691
|
}
|
|
1496
1692
|
function flattenChildren(children) {
|
|
1497
1693
|
const result = [];
|
|
@@ -1504,7 +1700,7 @@ function flattenChildren(children) {
|
|
|
1504
1700
|
}
|
|
1505
1701
|
return result;
|
|
1506
1702
|
}
|
|
1507
|
-
function
|
|
1703
|
+
function h2(type, props, ...children) {
|
|
1508
1704
|
if (typeof type !== "function") {
|
|
1509
1705
|
throw new TypeError("h() received an invalid vnode type");
|
|
1510
1706
|
}
|
|
@@ -1550,20 +1746,20 @@ function h(type, props, ...children) {
|
|
|
1550
1746
|
}
|
|
1551
1747
|
return vnode;
|
|
1552
1748
|
}
|
|
1553
|
-
function
|
|
1749
|
+
function isVNode2(node) {
|
|
1554
1750
|
return node && node[BrandedVNode];
|
|
1555
1751
|
}
|
|
1556
|
-
function
|
|
1557
|
-
if (
|
|
1752
|
+
function maybeMakeRenderable2(ctx, node) {
|
|
1753
|
+
if (isRenderable2(node))
|
|
1558
1754
|
return node;
|
|
1559
|
-
if (
|
|
1560
|
-
return
|
|
1755
|
+
if (isVNode2(node))
|
|
1756
|
+
return instantiate2(ctx, node);
|
|
1561
1757
|
if (true) {
|
|
1562
1758
|
console.warn("maybeMakeRenderable received an invalid node", util.inspect(node, { depth: 2 }));
|
|
1563
1759
|
}
|
|
1564
1760
|
return null;
|
|
1565
1761
|
}
|
|
1566
|
-
function
|
|
1762
|
+
function wrapWithDelegates2(instance, delegateMap) {
|
|
1567
1763
|
if (!delegateMap || Object.keys(delegateMap).length === 0)
|
|
1568
1764
|
return instance;
|
|
1569
1765
|
const getDescendant = (id) => {
|
|
@@ -1595,8 +1791,8 @@ function wrapWithDelegates(instance, delegateMap) {
|
|
|
1595
1791
|
});
|
|
1596
1792
|
return proxy;
|
|
1597
1793
|
}
|
|
1598
|
-
function
|
|
1599
|
-
if (
|
|
1794
|
+
function instantiate2(ctx, node) {
|
|
1795
|
+
if (isRenderable2(node))
|
|
1600
1796
|
return node;
|
|
1601
1797
|
if (!node || typeof node !== "object") {
|
|
1602
1798
|
throw new TypeError("mount() received an invalid vnode");
|
|
@@ -1608,14 +1804,14 @@ function instantiate(ctx, node) {
|
|
|
1608
1804
|
if (isRenderableConstructor(type)) {
|
|
1609
1805
|
const instance = new type(ctx, props || {});
|
|
1610
1806
|
for (const child of children) {
|
|
1611
|
-
if (
|
|
1807
|
+
if (isRenderable2(child)) {
|
|
1612
1808
|
instance.add(child);
|
|
1613
1809
|
} else {
|
|
1614
|
-
const mounted =
|
|
1810
|
+
const mounted = instantiate2(ctx, child);
|
|
1615
1811
|
instance.add(mounted);
|
|
1616
1812
|
}
|
|
1617
1813
|
}
|
|
1618
|
-
const delegatedInstance =
|
|
1814
|
+
const delegatedInstance = wrapWithDelegates2(instance, delegateMap);
|
|
1619
1815
|
const pendingCalls = vnode.__pendingCalls;
|
|
1620
1816
|
if (pendingCalls) {
|
|
1621
1817
|
for (const call of pendingCalls) {
|
|
@@ -1629,12 +1825,12 @@ function instantiate(ctx, node) {
|
|
|
1629
1825
|
return delegatedInstance;
|
|
1630
1826
|
}
|
|
1631
1827
|
const resolved = type(props || {}, children);
|
|
1632
|
-
const inst =
|
|
1633
|
-
return
|
|
1828
|
+
const inst = instantiate2(ctx, resolved);
|
|
1829
|
+
return wrapWithDelegates2(inst, delegateMap);
|
|
1634
1830
|
}
|
|
1635
|
-
function
|
|
1636
|
-
if (
|
|
1637
|
-
return
|
|
1831
|
+
function delegate2(mapping, vnode) {
|
|
1832
|
+
if (isRenderable2(vnode)) {
|
|
1833
|
+
return wrapWithDelegates2(vnode, mapping);
|
|
1638
1834
|
}
|
|
1639
1835
|
if (!vnode || typeof vnode !== "object")
|
|
1640
1836
|
return vnode;
|
|
@@ -1643,7 +1839,7 @@ function delegate(mapping, vnode) {
|
|
|
1643
1839
|
}
|
|
1644
1840
|
|
|
1645
1841
|
// src/text-buffer-view.ts
|
|
1646
|
-
class
|
|
1842
|
+
class TextBufferView2 {
|
|
1647
1843
|
lib;
|
|
1648
1844
|
viewPtr;
|
|
1649
1845
|
textBuffer;
|
|
@@ -1654,9 +1850,9 @@ class TextBufferView {
|
|
|
1654
1850
|
this.textBuffer = textBuffer;
|
|
1655
1851
|
}
|
|
1656
1852
|
static create(textBuffer) {
|
|
1657
|
-
const lib =
|
|
1853
|
+
const lib = resolveRenderLib2();
|
|
1658
1854
|
const viewPtr = lib.createTextBufferView(textBuffer.ptr);
|
|
1659
|
-
return new
|
|
1855
|
+
return new TextBufferView2(lib, viewPtr, textBuffer);
|
|
1660
1856
|
}
|
|
1661
1857
|
guard() {
|
|
1662
1858
|
if (this._destroyed)
|
|
@@ -1714,6 +1910,10 @@ class TextBufferView {
|
|
|
1714
1910
|
this.guard();
|
|
1715
1911
|
this.lib.textBufferViewSetWrapMode(this.viewPtr, mode);
|
|
1716
1912
|
}
|
|
1913
|
+
setTextAlign(alignment) {
|
|
1914
|
+
this.guard();
|
|
1915
|
+
this.lib.textBufferViewSetTextAlign(this.viewPtr, alignment);
|
|
1916
|
+
}
|
|
1717
1917
|
setFirstLineOffset(offset) {
|
|
1718
1918
|
this.guard();
|
|
1719
1919
|
this.lib.textBufferViewSetFirstLineOffset(this.viewPtr, offset);
|
|
@@ -1734,6 +1934,10 @@ class TextBufferView {
|
|
|
1734
1934
|
this.guard();
|
|
1735
1935
|
return this.lib.textBufferViewGetLogicalLineInfo(this.viewPtr);
|
|
1736
1936
|
}
|
|
1937
|
+
getLineSources(startLine, lineCount) {
|
|
1938
|
+
this.guard();
|
|
1939
|
+
return this.lib.textBufferViewGetLineSources(this.viewPtr, startLine, lineCount);
|
|
1940
|
+
}
|
|
1737
1941
|
getSelectedText() {
|
|
1738
1942
|
this.guard();
|
|
1739
1943
|
const byteSize = this.textBuffer.byteSize;
|
|
@@ -1786,7 +1990,7 @@ class TextBufferView {
|
|
|
1786
1990
|
// src/edit-buffer.ts
|
|
1787
1991
|
import { EventEmitter as EventEmitter2 } from "events";
|
|
1788
1992
|
|
|
1789
|
-
class
|
|
1993
|
+
class EditBuffer2 extends EventEmitter2 {
|
|
1790
1994
|
static registry = new Map;
|
|
1791
1995
|
static nativeEventsSubscribed = false;
|
|
1792
1996
|
lib;
|
|
@@ -1804,23 +2008,23 @@ class EditBuffer extends EventEmitter2 {
|
|
|
1804
2008
|
this.bufferPtr = ptr;
|
|
1805
2009
|
this.textBufferPtr = lib.editBufferGetTextBuffer(ptr);
|
|
1806
2010
|
this.id = lib.editBufferGetId(ptr);
|
|
1807
|
-
|
|
1808
|
-
|
|
2011
|
+
EditBuffer2.registry.set(this.id, this);
|
|
2012
|
+
EditBuffer2.subscribeToNativeEvents(lib);
|
|
1809
2013
|
}
|
|
1810
2014
|
static create(widthMethod) {
|
|
1811
|
-
const lib =
|
|
2015
|
+
const lib = resolveRenderLib2();
|
|
1812
2016
|
const ptr = lib.createEditBuffer(widthMethod);
|
|
1813
|
-
return new
|
|
2017
|
+
return new EditBuffer2(lib, ptr);
|
|
1814
2018
|
}
|
|
1815
2019
|
static subscribeToNativeEvents(lib) {
|
|
1816
|
-
if (
|
|
2020
|
+
if (EditBuffer2.nativeEventsSubscribed)
|
|
1817
2021
|
return;
|
|
1818
|
-
|
|
2022
|
+
EditBuffer2.nativeEventsSubscribed = true;
|
|
1819
2023
|
lib.onAnyNativeEvent((name, data) => {
|
|
1820
2024
|
const buffer = new Uint16Array(data);
|
|
1821
2025
|
if (name.startsWith("eb_") && buffer.length >= 1) {
|
|
1822
2026
|
const id = buffer[0];
|
|
1823
|
-
const instance =
|
|
2027
|
+
const instance = EditBuffer2.registry.get(id);
|
|
1824
2028
|
if (instance) {
|
|
1825
2029
|
const eventName = name.slice(3);
|
|
1826
2030
|
const eventData = data.slice(2);
|
|
@@ -2099,13 +2303,13 @@ class EditBuffer extends EventEmitter2 {
|
|
|
2099
2303
|
if (this._destroyed)
|
|
2100
2304
|
return;
|
|
2101
2305
|
this._destroyed = true;
|
|
2102
|
-
|
|
2306
|
+
EditBuffer2.registry.delete(this.id);
|
|
2103
2307
|
this.lib.destroyEditBuffer(this.bufferPtr);
|
|
2104
2308
|
}
|
|
2105
2309
|
}
|
|
2106
2310
|
|
|
2107
2311
|
// src/editor-view.ts
|
|
2108
|
-
class
|
|
2312
|
+
class EditorView2 {
|
|
2109
2313
|
lib;
|
|
2110
2314
|
viewPtr;
|
|
2111
2315
|
editBuffer;
|
|
@@ -2118,9 +2322,12 @@ class EditorView {
|
|
|
2118
2322
|
this.editBuffer = editBuffer;
|
|
2119
2323
|
}
|
|
2120
2324
|
static create(editBuffer, viewportWidth, viewportHeight) {
|
|
2121
|
-
const lib =
|
|
2325
|
+
const lib = resolveRenderLib2();
|
|
2122
2326
|
const viewPtr = lib.createEditorView(editBuffer.ptr, viewportWidth, viewportHeight);
|
|
2123
|
-
return new
|
|
2327
|
+
return new EditorView2(lib, viewPtr, editBuffer);
|
|
2328
|
+
}
|
|
2329
|
+
get isDestroyed() {
|
|
2330
|
+
return this._destroyed;
|
|
2124
2331
|
}
|
|
2125
2332
|
guard() {
|
|
2126
2333
|
if (this._destroyed)
|
|
@@ -2285,7 +2492,7 @@ class EditorView {
|
|
|
2285
2492
|
}
|
|
2286
2493
|
get extmarks() {
|
|
2287
2494
|
if (!this._extmarksController) {
|
|
2288
|
-
this._extmarksController =
|
|
2495
|
+
this._extmarksController = createExtmarksController2(this.editBuffer, this);
|
|
2289
2496
|
}
|
|
2290
2497
|
return this._extmarksController;
|
|
2291
2498
|
}
|
|
@@ -2319,201 +2526,6 @@ class EditorView {
|
|
|
2319
2526
|
}
|
|
2320
2527
|
}
|
|
2321
2528
|
|
|
2322
|
-
// src/syntax-style.ts
|
|
2323
|
-
function convertThemeToStyles(theme) {
|
|
2324
|
-
const flatStyles = {};
|
|
2325
|
-
for (const tokenStyle of theme) {
|
|
2326
|
-
const styleDefinition = {};
|
|
2327
|
-
if (tokenStyle.style.foreground) {
|
|
2328
|
-
styleDefinition.fg = parseColor(tokenStyle.style.foreground);
|
|
2329
|
-
}
|
|
2330
|
-
if (tokenStyle.style.background) {
|
|
2331
|
-
styleDefinition.bg = parseColor(tokenStyle.style.background);
|
|
2332
|
-
}
|
|
2333
|
-
if (tokenStyle.style.bold !== undefined) {
|
|
2334
|
-
styleDefinition.bold = tokenStyle.style.bold;
|
|
2335
|
-
}
|
|
2336
|
-
if (tokenStyle.style.italic !== undefined) {
|
|
2337
|
-
styleDefinition.italic = tokenStyle.style.italic;
|
|
2338
|
-
}
|
|
2339
|
-
if (tokenStyle.style.underline !== undefined) {
|
|
2340
|
-
styleDefinition.underline = tokenStyle.style.underline;
|
|
2341
|
-
}
|
|
2342
|
-
if (tokenStyle.style.dim !== undefined) {
|
|
2343
|
-
styleDefinition.dim = tokenStyle.style.dim;
|
|
2344
|
-
}
|
|
2345
|
-
for (const scope of tokenStyle.scope) {
|
|
2346
|
-
flatStyles[scope] = styleDefinition;
|
|
2347
|
-
}
|
|
2348
|
-
}
|
|
2349
|
-
return flatStyles;
|
|
2350
|
-
}
|
|
2351
|
-
|
|
2352
|
-
class SyntaxStyle {
|
|
2353
|
-
lib;
|
|
2354
|
-
stylePtr;
|
|
2355
|
-
_destroyed = false;
|
|
2356
|
-
nameCache = new Map;
|
|
2357
|
-
styleDefs = new Map;
|
|
2358
|
-
mergedCache = new Map;
|
|
2359
|
-
constructor(lib, ptr) {
|
|
2360
|
-
this.lib = lib;
|
|
2361
|
-
this.stylePtr = ptr;
|
|
2362
|
-
}
|
|
2363
|
-
static create() {
|
|
2364
|
-
const lib = resolveRenderLib();
|
|
2365
|
-
const ptr = lib.createSyntaxStyle();
|
|
2366
|
-
return new SyntaxStyle(lib, ptr);
|
|
2367
|
-
}
|
|
2368
|
-
static fromTheme(theme) {
|
|
2369
|
-
const style = SyntaxStyle.create();
|
|
2370
|
-
const flatStyles = convertThemeToStyles(theme);
|
|
2371
|
-
for (const [name, styleDef] of Object.entries(flatStyles)) {
|
|
2372
|
-
style.registerStyle(name, styleDef);
|
|
2373
|
-
}
|
|
2374
|
-
return style;
|
|
2375
|
-
}
|
|
2376
|
-
static fromStyles(styles) {
|
|
2377
|
-
const style = SyntaxStyle.create();
|
|
2378
|
-
for (const [name, styleDef] of Object.entries(styles)) {
|
|
2379
|
-
style.registerStyle(name, styleDef);
|
|
2380
|
-
}
|
|
2381
|
-
return style;
|
|
2382
|
-
}
|
|
2383
|
-
guard() {
|
|
2384
|
-
if (this._destroyed)
|
|
2385
|
-
throw new Error("NativeSyntaxStyle is destroyed");
|
|
2386
|
-
}
|
|
2387
|
-
registerStyle(name, style) {
|
|
2388
|
-
this.guard();
|
|
2389
|
-
const attributes = createTextAttributes({
|
|
2390
|
-
bold: style.bold,
|
|
2391
|
-
italic: style.italic,
|
|
2392
|
-
underline: style.underline,
|
|
2393
|
-
dim: style.dim
|
|
2394
|
-
});
|
|
2395
|
-
const fg = style.fg ? parseColor(style.fg) : null;
|
|
2396
|
-
const bg = style.bg ? parseColor(style.bg) : null;
|
|
2397
|
-
const id = this.lib.syntaxStyleRegister(this.stylePtr, name, fg, bg, attributes);
|
|
2398
|
-
this.nameCache.set(name, id);
|
|
2399
|
-
this.styleDefs.set(name, { ...style, fg: fg ?? undefined, bg: bg ?? undefined });
|
|
2400
|
-
return id;
|
|
2401
|
-
}
|
|
2402
|
-
resolveStyleId(name) {
|
|
2403
|
-
this.guard();
|
|
2404
|
-
const cached = this.nameCache.get(name);
|
|
2405
|
-
if (cached !== undefined)
|
|
2406
|
-
return cached;
|
|
2407
|
-
const id = this.lib.syntaxStyleResolveByName(this.stylePtr, name);
|
|
2408
|
-
if (id !== null) {
|
|
2409
|
-
this.nameCache.set(name, id);
|
|
2410
|
-
}
|
|
2411
|
-
return id;
|
|
2412
|
-
}
|
|
2413
|
-
getStyleId(name) {
|
|
2414
|
-
this.guard();
|
|
2415
|
-
const id = this.resolveStyleId(name);
|
|
2416
|
-
if (id !== null)
|
|
2417
|
-
return id;
|
|
2418
|
-
if (name.includes(".")) {
|
|
2419
|
-
const baseName = name.split(".")[0];
|
|
2420
|
-
return this.resolveStyleId(baseName);
|
|
2421
|
-
}
|
|
2422
|
-
return null;
|
|
2423
|
-
}
|
|
2424
|
-
get ptr() {
|
|
2425
|
-
this.guard();
|
|
2426
|
-
return this.stylePtr;
|
|
2427
|
-
}
|
|
2428
|
-
getStyleCount() {
|
|
2429
|
-
this.guard();
|
|
2430
|
-
return this.lib.syntaxStyleGetStyleCount(this.stylePtr);
|
|
2431
|
-
}
|
|
2432
|
-
clearNameCache() {
|
|
2433
|
-
this.nameCache.clear();
|
|
2434
|
-
}
|
|
2435
|
-
getStyle(name) {
|
|
2436
|
-
this.guard();
|
|
2437
|
-
if (Object.prototype.hasOwnProperty.call(this.styleDefs, name)) {
|
|
2438
|
-
return;
|
|
2439
|
-
}
|
|
2440
|
-
const style = this.styleDefs.get(name);
|
|
2441
|
-
if (style)
|
|
2442
|
-
return style;
|
|
2443
|
-
if (name.includes(".")) {
|
|
2444
|
-
const baseName = name.split(".")[0];
|
|
2445
|
-
if (Object.prototype.hasOwnProperty.call(this.styleDefs, baseName)) {
|
|
2446
|
-
return;
|
|
2447
|
-
}
|
|
2448
|
-
return this.styleDefs.get(baseName);
|
|
2449
|
-
}
|
|
2450
|
-
return;
|
|
2451
|
-
}
|
|
2452
|
-
mergeStyles(...styleNames) {
|
|
2453
|
-
this.guard();
|
|
2454
|
-
const cacheKey = styleNames.join(":");
|
|
2455
|
-
const cached = this.mergedCache.get(cacheKey);
|
|
2456
|
-
if (cached)
|
|
2457
|
-
return cached;
|
|
2458
|
-
const styleDefinition = {};
|
|
2459
|
-
for (const name of styleNames) {
|
|
2460
|
-
const style = this.getStyle(name);
|
|
2461
|
-
if (!style)
|
|
2462
|
-
continue;
|
|
2463
|
-
if (style.fg)
|
|
2464
|
-
styleDefinition.fg = style.fg;
|
|
2465
|
-
if (style.bg)
|
|
2466
|
-
styleDefinition.bg = style.bg;
|
|
2467
|
-
if (style.bold !== undefined)
|
|
2468
|
-
styleDefinition.bold = style.bold;
|
|
2469
|
-
if (style.italic !== undefined)
|
|
2470
|
-
styleDefinition.italic = style.italic;
|
|
2471
|
-
if (style.underline !== undefined)
|
|
2472
|
-
styleDefinition.underline = style.underline;
|
|
2473
|
-
if (style.dim !== undefined)
|
|
2474
|
-
styleDefinition.dim = style.dim;
|
|
2475
|
-
}
|
|
2476
|
-
const attributes = createTextAttributes({
|
|
2477
|
-
bold: styleDefinition.bold,
|
|
2478
|
-
italic: styleDefinition.italic,
|
|
2479
|
-
underline: styleDefinition.underline,
|
|
2480
|
-
dim: styleDefinition.dim
|
|
2481
|
-
});
|
|
2482
|
-
const merged = {
|
|
2483
|
-
fg: styleDefinition.fg,
|
|
2484
|
-
bg: styleDefinition.bg,
|
|
2485
|
-
attributes
|
|
2486
|
-
};
|
|
2487
|
-
this.mergedCache.set(cacheKey, merged);
|
|
2488
|
-
return merged;
|
|
2489
|
-
}
|
|
2490
|
-
clearCache() {
|
|
2491
|
-
this.guard();
|
|
2492
|
-
this.mergedCache.clear();
|
|
2493
|
-
}
|
|
2494
|
-
getCacheSize() {
|
|
2495
|
-
this.guard();
|
|
2496
|
-
return this.mergedCache.size;
|
|
2497
|
-
}
|
|
2498
|
-
getAllStyles() {
|
|
2499
|
-
this.guard();
|
|
2500
|
-
return new Map(this.styleDefs);
|
|
2501
|
-
}
|
|
2502
|
-
getRegisteredNames() {
|
|
2503
|
-
this.guard();
|
|
2504
|
-
return Array.from(this.styleDefs.keys());
|
|
2505
|
-
}
|
|
2506
|
-
destroy() {
|
|
2507
|
-
if (this._destroyed)
|
|
2508
|
-
return;
|
|
2509
|
-
this._destroyed = true;
|
|
2510
|
-
this.nameCache.clear();
|
|
2511
|
-
this.styleDefs.clear();
|
|
2512
|
-
this.mergedCache.clear();
|
|
2513
|
-
this.lib.destroySyntaxStyle(this.stylePtr);
|
|
2514
|
-
}
|
|
2515
|
-
}
|
|
2516
|
-
|
|
2517
2529
|
// src/renderables/Box.ts
|
|
2518
2530
|
function isGapType(value) {
|
|
2519
2531
|
if (value === undefined) {
|
|
@@ -2525,7 +2537,7 @@ function isGapType(value) {
|
|
|
2525
2537
|
return isValidPercentage(value);
|
|
2526
2538
|
}
|
|
2527
2539
|
|
|
2528
|
-
class
|
|
2540
|
+
class BoxRenderable2 extends Renderable2 {
|
|
2529
2541
|
_backgroundColor;
|
|
2530
2542
|
_border;
|
|
2531
2543
|
_borderStyle;
|
|
@@ -2555,20 +2567,20 @@ class BoxRenderable extends Renderable {
|
|
|
2555
2567
|
if (options.focusable === true) {
|
|
2556
2568
|
this._focusable = true;
|
|
2557
2569
|
}
|
|
2558
|
-
this._backgroundColor =
|
|
2570
|
+
this._backgroundColor = parseColor2(options.backgroundColor || this._defaultOptions.backgroundColor);
|
|
2559
2571
|
this._border = options.border ?? this._defaultOptions.border;
|
|
2560
2572
|
if (!options.border && (options.borderStyle || options.borderColor || options.focusedBorderColor || options.customBorderChars)) {
|
|
2561
2573
|
this._border = true;
|
|
2562
2574
|
}
|
|
2563
|
-
this._borderStyle =
|
|
2564
|
-
this._borderColor =
|
|
2565
|
-
this._focusedBorderColor =
|
|
2575
|
+
this._borderStyle = parseBorderStyle2(options.borderStyle, this._defaultOptions.borderStyle);
|
|
2576
|
+
this._borderColor = parseColor2(options.borderColor || this._defaultOptions.borderColor);
|
|
2577
|
+
this._focusedBorderColor = parseColor2(options.focusedBorderColor || this._defaultOptions.focusedBorderColor);
|
|
2566
2578
|
this._customBorderCharsObj = options.customBorderChars;
|
|
2567
|
-
this._customBorderChars = this._customBorderCharsObj ?
|
|
2568
|
-
this.borderSides =
|
|
2579
|
+
this._customBorderChars = this._customBorderCharsObj ? borderCharsToArray2(this._customBorderCharsObj) : undefined;
|
|
2580
|
+
this.borderSides = getBorderSides2(this._border);
|
|
2569
2581
|
this.shouldFill = options.shouldFill ?? this._defaultOptions.shouldFill;
|
|
2570
2582
|
this._title = options.title;
|
|
2571
|
-
this._titleColor = options.titleColor ?
|
|
2583
|
+
this._titleColor = options.titleColor ? parseColor2(options.titleColor) : undefined;
|
|
2572
2584
|
this._titleAlignment = options.titleAlignment || this._defaultOptions.titleAlignment;
|
|
2573
2585
|
this._bottomTitle = options.bottomTitle;
|
|
2574
2586
|
this._bottomTitleAlignment = options.bottomTitleAlignment || this._defaultOptions.bottomTitleAlignment;
|
|
@@ -2581,7 +2593,7 @@ class BoxRenderable extends Renderable {
|
|
|
2581
2593
|
initializeBorder() {
|
|
2582
2594
|
if (this._border === false) {
|
|
2583
2595
|
this._border = true;
|
|
2584
|
-
this.borderSides =
|
|
2596
|
+
this.borderSides = getBorderSides2(this._border);
|
|
2585
2597
|
this.applyYogaBorders();
|
|
2586
2598
|
}
|
|
2587
2599
|
}
|
|
@@ -2590,14 +2602,14 @@ class BoxRenderable extends Renderable {
|
|
|
2590
2602
|
}
|
|
2591
2603
|
set customBorderChars(value) {
|
|
2592
2604
|
this._customBorderCharsObj = value;
|
|
2593
|
-
this._customBorderChars = value ?
|
|
2605
|
+
this._customBorderChars = value ? borderCharsToArray2(value) : undefined;
|
|
2594
2606
|
this.requestRender();
|
|
2595
2607
|
}
|
|
2596
2608
|
get backgroundColor() {
|
|
2597
2609
|
return this._backgroundColor;
|
|
2598
2610
|
}
|
|
2599
2611
|
set backgroundColor(value) {
|
|
2600
|
-
const newColor =
|
|
2612
|
+
const newColor = parseColor2(value ?? this._defaultOptions.backgroundColor);
|
|
2601
2613
|
if (this._backgroundColor !== newColor) {
|
|
2602
2614
|
this._backgroundColor = newColor;
|
|
2603
2615
|
this.requestRender();
|
|
@@ -2609,7 +2621,7 @@ class BoxRenderable extends Renderable {
|
|
|
2609
2621
|
set border(value) {
|
|
2610
2622
|
if (this._border !== value) {
|
|
2611
2623
|
this._border = value;
|
|
2612
|
-
this.borderSides =
|
|
2624
|
+
this.borderSides = getBorderSides2(value);
|
|
2613
2625
|
this.applyYogaBorders();
|
|
2614
2626
|
this.requestRender();
|
|
2615
2627
|
}
|
|
@@ -2618,7 +2630,7 @@ class BoxRenderable extends Renderable {
|
|
|
2618
2630
|
return this._borderStyle;
|
|
2619
2631
|
}
|
|
2620
2632
|
set borderStyle(value) {
|
|
2621
|
-
const _value =
|
|
2633
|
+
const _value = parseBorderStyle2(value, this._defaultOptions.borderStyle);
|
|
2622
2634
|
if (this._borderStyle !== _value || !this._border) {
|
|
2623
2635
|
this._borderStyle = _value;
|
|
2624
2636
|
this._customBorderChars = undefined;
|
|
@@ -2630,7 +2642,7 @@ class BoxRenderable extends Renderable {
|
|
|
2630
2642
|
return this._borderColor;
|
|
2631
2643
|
}
|
|
2632
2644
|
set borderColor(value) {
|
|
2633
|
-
const newColor =
|
|
2645
|
+
const newColor = parseColor2(value ?? this._defaultOptions.borderColor);
|
|
2634
2646
|
if (this._borderColor !== newColor) {
|
|
2635
2647
|
this._borderColor = newColor;
|
|
2636
2648
|
this.initializeBorder();
|
|
@@ -2641,7 +2653,7 @@ class BoxRenderable extends Renderable {
|
|
|
2641
2653
|
return this._focusedBorderColor;
|
|
2642
2654
|
}
|
|
2643
2655
|
set focusedBorderColor(value) {
|
|
2644
|
-
const newColor =
|
|
2656
|
+
const newColor = parseColor2(value ?? this._defaultOptions.focusedBorderColor);
|
|
2645
2657
|
if (this._focusedBorderColor !== newColor) {
|
|
2646
2658
|
this._focusedBorderColor = newColor;
|
|
2647
2659
|
this.initializeBorder();
|
|
@@ -2663,7 +2675,7 @@ class BoxRenderable extends Renderable {
|
|
|
2663
2675
|
return this._titleColor;
|
|
2664
2676
|
}
|
|
2665
2677
|
set titleColor(value) {
|
|
2666
|
-
const newColor = value ?
|
|
2678
|
+
const newColor = value ? parseColor2(value) : undefined;
|
|
2667
2679
|
if (this._titleColor !== newColor) {
|
|
2668
2680
|
this._titleColor = newColor;
|
|
2669
2681
|
this.requestRender();
|
|
@@ -2781,7 +2793,7 @@ class BoxRenderable extends Renderable {
|
|
|
2781
2793
|
}
|
|
2782
2794
|
|
|
2783
2795
|
// src/renderables/TextBufferRenderable.ts
|
|
2784
|
-
class
|
|
2796
|
+
class TextBufferRenderable2 extends Renderable2 {
|
|
2785
2797
|
selectable = true;
|
|
2786
2798
|
_defaultFg;
|
|
2787
2799
|
_defaultBg;
|
|
@@ -2789,6 +2801,7 @@ class TextBufferRenderable extends Renderable {
|
|
|
2789
2801
|
_selectionBg;
|
|
2790
2802
|
_selectionFg;
|
|
2791
2803
|
_wrapMode = "word";
|
|
2804
|
+
_textAlign = "left";
|
|
2792
2805
|
lastLocalSelection = null;
|
|
2793
2806
|
_tabIndicator;
|
|
2794
2807
|
_tabIndicatorColor;
|
|
@@ -2801,35 +2814,38 @@ class TextBufferRenderable extends Renderable {
|
|
|
2801
2814
|
_textBufferSyntaxStyle;
|
|
2802
2815
|
nativeRenderable = null;
|
|
2803
2816
|
_defaultOptions = {
|
|
2804
|
-
fg:
|
|
2805
|
-
bg:
|
|
2817
|
+
fg: RGBA2.fromValues(1, 1, 1, 1),
|
|
2818
|
+
bg: RGBA2.fromValues(0, 0, 0, 0),
|
|
2806
2819
|
selectionBg: undefined,
|
|
2807
2820
|
selectionFg: undefined,
|
|
2808
2821
|
selectable: true,
|
|
2809
2822
|
attributes: 0,
|
|
2810
2823
|
wrapMode: "word",
|
|
2824
|
+
textAlign: "left",
|
|
2811
2825
|
tabIndicator: undefined,
|
|
2812
2826
|
tabIndicatorColor: undefined,
|
|
2813
2827
|
truncate: false
|
|
2814
2828
|
};
|
|
2815
2829
|
constructor(ctx, options) {
|
|
2816
2830
|
super(ctx, options);
|
|
2817
|
-
this._defaultFg =
|
|
2818
|
-
this._defaultBg =
|
|
2831
|
+
this._defaultFg = parseColor2(options.fg ?? this._defaultOptions.fg);
|
|
2832
|
+
this._defaultBg = parseColor2(options.bg ?? this._defaultOptions.bg);
|
|
2819
2833
|
this._defaultAttributes = options.attributes ?? this._defaultOptions.attributes;
|
|
2820
|
-
this._selectionBg = options.selectionBg ?
|
|
2821
|
-
this._selectionFg = options.selectionFg ?
|
|
2834
|
+
this._selectionBg = options.selectionBg ? parseColor2(options.selectionBg) : this._defaultOptions.selectionBg;
|
|
2835
|
+
this._selectionFg = options.selectionFg ? parseColor2(options.selectionFg) : this._defaultOptions.selectionFg;
|
|
2822
2836
|
this.selectable = options.selectable ?? this._defaultOptions.selectable;
|
|
2823
2837
|
this._wrapMode = options.wrapMode ?? this._defaultOptions.wrapMode;
|
|
2838
|
+
this._textAlign = options.textAlign ?? this._defaultOptions.textAlign;
|
|
2824
2839
|
this._tabIndicator = options.tabIndicator ?? this._defaultOptions.tabIndicator;
|
|
2825
|
-
this._tabIndicatorColor = options.tabIndicatorColor ?
|
|
2840
|
+
this._tabIndicatorColor = options.tabIndicatorColor ? parseColor2(options.tabIndicatorColor) : this._defaultOptions.tabIndicatorColor;
|
|
2826
2841
|
this._truncate = options.truncate ?? this._defaultOptions.truncate;
|
|
2827
|
-
this.textBuffer =
|
|
2828
|
-
this.textBufferView =
|
|
2842
|
+
this.textBuffer = TextBuffer2.create(this._ctx.widthMethod);
|
|
2843
|
+
this.textBufferView = TextBufferView2.create(this.textBuffer);
|
|
2829
2844
|
this._firstLineOffset = ctx.claimFirstLineOffset?.(this) ?? 0;
|
|
2830
|
-
this._textBufferSyntaxStyle =
|
|
2845
|
+
this._textBufferSyntaxStyle = SyntaxStyle2.create();
|
|
2831
2846
|
this.textBuffer.setSyntaxStyle(this._textBufferSyntaxStyle);
|
|
2832
2847
|
this.textBufferView.setWrapMode(this._wrapMode);
|
|
2848
|
+
this.textBufferView.setTextAlign(this._textAlign);
|
|
2833
2849
|
this.textBufferView.setFirstLineOffset(this._firstLineOffset);
|
|
2834
2850
|
this.setupNativeRenderable();
|
|
2835
2851
|
this.textBuffer.setDefaultFg(this._defaultFg);
|
|
@@ -2875,6 +2891,23 @@ class TextBufferRenderable extends Renderable {
|
|
|
2875
2891
|
get lineInfo() {
|
|
2876
2892
|
return this.textBufferView.logicalLineInfo;
|
|
2877
2893
|
}
|
|
2894
|
+
getLineSources(startLine, lineCount) {
|
|
2895
|
+
if (this.needsLineInfoFallback(TextBufferRenderable2.prototype)) {
|
|
2896
|
+
return this.lineInfo.lineSources.slice(startLine, startLine + lineCount);
|
|
2897
|
+
}
|
|
2898
|
+
return this.textBufferView.getLineSources(startLine, lineCount);
|
|
2899
|
+
}
|
|
2900
|
+
needsLineInfoFallback(owner) {
|
|
2901
|
+
let prototype = this;
|
|
2902
|
+
while (prototype && prototype !== owner) {
|
|
2903
|
+
if (Object.hasOwn(prototype, "getLineSources"))
|
|
2904
|
+
return false;
|
|
2905
|
+
if (Object.hasOwn(prototype, "lineInfo"))
|
|
2906
|
+
return true;
|
|
2907
|
+
prototype = Object.getPrototypeOf(prototype);
|
|
2908
|
+
}
|
|
2909
|
+
return false;
|
|
2910
|
+
}
|
|
2878
2911
|
get lineCount() {
|
|
2879
2912
|
return this.textBuffer.getLineCount();
|
|
2880
2913
|
}
|
|
@@ -2909,7 +2942,7 @@ class TextBufferRenderable extends Renderable {
|
|
|
2909
2942
|
return this.lineInfo.lineWidthColsMax;
|
|
2910
2943
|
}
|
|
2911
2944
|
get scrollHeight() {
|
|
2912
|
-
return this.
|
|
2945
|
+
return this.virtualLineCount;
|
|
2913
2946
|
}
|
|
2914
2947
|
get maxScrollY() {
|
|
2915
2948
|
return Math.max(0, this.scrollHeight - this.height);
|
|
@@ -2932,7 +2965,7 @@ class TextBufferRenderable extends Renderable {
|
|
|
2932
2965
|
return this._defaultFg;
|
|
2933
2966
|
}
|
|
2934
2967
|
set fg(value) {
|
|
2935
|
-
const newColor =
|
|
2968
|
+
const newColor = parseColor2(value ?? this._defaultOptions.fg);
|
|
2936
2969
|
if (this._defaultFg !== newColor) {
|
|
2937
2970
|
this._defaultFg = newColor;
|
|
2938
2971
|
this.textBuffer.setDefaultFg(this._defaultFg);
|
|
@@ -2944,7 +2977,7 @@ class TextBufferRenderable extends Renderable {
|
|
|
2944
2977
|
return this._selectionBg;
|
|
2945
2978
|
}
|
|
2946
2979
|
set selectionBg(value) {
|
|
2947
|
-
const newColor = value ?
|
|
2980
|
+
const newColor = value ? parseColor2(value) : this._defaultOptions.selectionBg;
|
|
2948
2981
|
if (this._selectionBg !== newColor) {
|
|
2949
2982
|
this._selectionBg = newColor;
|
|
2950
2983
|
if (this.lastLocalSelection) {
|
|
@@ -2957,7 +2990,7 @@ class TextBufferRenderable extends Renderable {
|
|
|
2957
2990
|
return this._selectionFg;
|
|
2958
2991
|
}
|
|
2959
2992
|
set selectionFg(value) {
|
|
2960
|
-
const newColor = value ?
|
|
2993
|
+
const newColor = value ? parseColor2(value) : this._defaultOptions.selectionFg;
|
|
2961
2994
|
if (this._selectionFg !== newColor) {
|
|
2962
2995
|
this._selectionFg = newColor;
|
|
2963
2996
|
if (this.lastLocalSelection) {
|
|
@@ -2970,7 +3003,7 @@ class TextBufferRenderable extends Renderable {
|
|
|
2970
3003
|
return this._defaultBg;
|
|
2971
3004
|
}
|
|
2972
3005
|
set bg(value) {
|
|
2973
|
-
const newColor =
|
|
3006
|
+
const newColor = parseColor2(value ?? this._defaultOptions.bg);
|
|
2974
3007
|
if (this._defaultBg !== newColor) {
|
|
2975
3008
|
this._defaultBg = newColor;
|
|
2976
3009
|
this.textBuffer.setDefaultBg(this._defaultBg);
|
|
@@ -3003,6 +3036,16 @@ class TextBufferRenderable extends Renderable {
|
|
|
3003
3036
|
this.requestRender();
|
|
3004
3037
|
}
|
|
3005
3038
|
}
|
|
3039
|
+
get textAlign() {
|
|
3040
|
+
return this._textAlign;
|
|
3041
|
+
}
|
|
3042
|
+
set textAlign(value) {
|
|
3043
|
+
if (this._textAlign !== value) {
|
|
3044
|
+
this._textAlign = value;
|
|
3045
|
+
this.textBufferView.setTextAlign(this._textAlign);
|
|
3046
|
+
this.requestRender();
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3006
3049
|
get tabIndicator() {
|
|
3007
3050
|
return this._tabIndicator;
|
|
3008
3051
|
}
|
|
@@ -3019,7 +3062,7 @@ class TextBufferRenderable extends Renderable {
|
|
|
3019
3062
|
return this._tabIndicatorColor;
|
|
3020
3063
|
}
|
|
3021
3064
|
set tabIndicatorColor(value) {
|
|
3022
|
-
const newColor = value ?
|
|
3065
|
+
const newColor = value ? parseColor2(value) : undefined;
|
|
3023
3066
|
if (this._tabIndicatorColor !== newColor) {
|
|
3024
3067
|
this._tabIndicatorColor = newColor;
|
|
3025
3068
|
if (newColor !== undefined) {
|
|
@@ -3066,13 +3109,13 @@ class TextBufferRenderable extends Renderable {
|
|
|
3066
3109
|
this.emit("line-info-change");
|
|
3067
3110
|
}
|
|
3068
3111
|
setupNativeRenderable() {
|
|
3069
|
-
const lib =
|
|
3112
|
+
const lib = resolveRenderLib2();
|
|
3070
3113
|
const nativeRenderable = lib.createNativeRenderable();
|
|
3071
3114
|
if (!lib.nativeRenderableAttachYogaNode(nativeRenderable, this.yogaNode.ptr)) {
|
|
3072
3115
|
lib.destroyNativeRenderable(nativeRenderable);
|
|
3073
3116
|
throw new Error("Failed to attach native renderable Yoga node");
|
|
3074
3117
|
}
|
|
3075
|
-
if (!lib.nativeRenderableSetMeasureTarget(nativeRenderable,
|
|
3118
|
+
if (!lib.nativeRenderableSetMeasureTarget(nativeRenderable, NativeMeasureTargetKind2.TextBufferView, this.textBufferView.ptr)) {
|
|
3076
3119
|
lib.destroyNativeRenderable(nativeRenderable);
|
|
3077
3120
|
throw new Error("Failed to attach text buffer native measure target");
|
|
3078
3121
|
}
|
|
@@ -3086,7 +3129,7 @@ class TextBufferRenderable extends Renderable {
|
|
|
3086
3129
|
return localX >= 0 && localX < this.width && localY >= 0 && localY < this.height;
|
|
3087
3130
|
}
|
|
3088
3131
|
onSelectionChanged(selection) {
|
|
3089
|
-
const localSelection =
|
|
3132
|
+
const localSelection = convertGlobalToLocalSelection2(selection, this.x, this.y);
|
|
3090
3133
|
this.lastLocalSelection = localSelection;
|
|
3091
3134
|
let changed;
|
|
3092
3135
|
if (!localSelection?.isActive) {
|
|
@@ -3132,7 +3175,7 @@ class TextBufferRenderable extends Renderable {
|
|
|
3132
3175
|
if (this.isDestroyed)
|
|
3133
3176
|
return;
|
|
3134
3177
|
if (this.nativeRenderable) {
|
|
3135
|
-
|
|
3178
|
+
resolveRenderLib2().destroyNativeRenderable(this.nativeRenderable);
|
|
3136
3179
|
this.nativeRenderable = null;
|
|
3137
3180
|
}
|
|
3138
3181
|
this.textBuffer.setSyntaxStyle(null);
|
|
@@ -3147,7 +3190,7 @@ class TextBufferRenderable extends Renderable {
|
|
|
3147
3190
|
}
|
|
3148
3191
|
|
|
3149
3192
|
// src/renderables/Code.ts
|
|
3150
|
-
class
|
|
3193
|
+
class CodeRenderable2 extends TextBufferRenderable2 {
|
|
3151
3194
|
_content;
|
|
3152
3195
|
_filetype;
|
|
3153
3196
|
_syntaxStyle;
|
|
@@ -3182,7 +3225,7 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3182
3225
|
this._content = options.content ?? this._contentDefaultOptions.content;
|
|
3183
3226
|
this._filetype = options.filetype;
|
|
3184
3227
|
this._syntaxStyle = options.syntaxStyle;
|
|
3185
|
-
this._treeSitterClient = options.treeSitterClient ??
|
|
3228
|
+
this._treeSitterClient = options.treeSitterClient ?? getTreeSitterClient2();
|
|
3186
3229
|
this._conceal = options.conceal ?? this._contentDefaultOptions.conceal;
|
|
3187
3230
|
this._drawUnstyledText = options.drawUnstyledText ?? this._contentDefaultOptions.drawUnstyledText;
|
|
3188
3231
|
this._streaming = options.streaming ?? this._contentDefaultOptions.streaming;
|
|
@@ -3216,7 +3259,7 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3216
3259
|
this.requestRender();
|
|
3217
3260
|
return;
|
|
3218
3261
|
}
|
|
3219
|
-
if (this._initialStyledText && this._drawUnstyledText) {
|
|
3262
|
+
if (value && this._initialStyledText && this._drawUnstyledText) {
|
|
3220
3263
|
this.textBuffer.setStyledText(this._initialStyledText);
|
|
3221
3264
|
} else {
|
|
3222
3265
|
this.textBuffer.setText(value);
|
|
@@ -3225,6 +3268,14 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3225
3268
|
this.updateTextInfo();
|
|
3226
3269
|
}
|
|
3227
3270
|
}
|
|
3271
|
+
updateStreamingPreview(content, initialStyledText) {
|
|
3272
|
+
this._content = content;
|
|
3273
|
+
this._initialStyledText = initialStyledText;
|
|
3274
|
+
this.invalidateHighlights();
|
|
3275
|
+
this.textBuffer.setStyledText(initialStyledText);
|
|
3276
|
+
this.setRenderedLineSources(undefined);
|
|
3277
|
+
this.updateTextInfo();
|
|
3278
|
+
}
|
|
3228
3279
|
get lineInfo() {
|
|
3229
3280
|
if (!this._renderedLineSources)
|
|
3230
3281
|
return super.lineInfo;
|
|
@@ -3238,6 +3289,14 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3238
3289
|
};
|
|
3239
3290
|
return this._mappedLineInfo;
|
|
3240
3291
|
}
|
|
3292
|
+
getLineSources(startLine, lineCount) {
|
|
3293
|
+
if (this.needsLineInfoFallback(CodeRenderable2.prototype)) {
|
|
3294
|
+
return this.lineInfo.lineSources.slice(startLine, startLine + lineCount);
|
|
3295
|
+
}
|
|
3296
|
+
const sources = this.textBufferView.getLineSources(startLine, lineCount);
|
|
3297
|
+
const renderedLineSources = this._renderedLineSources;
|
|
3298
|
+
return renderedLineSources ? sources.map((line) => renderedLineSources[line] ?? line) : sources;
|
|
3299
|
+
}
|
|
3241
3300
|
get wrapMode() {
|
|
3242
3301
|
return super.wrapMode;
|
|
3243
3302
|
}
|
|
@@ -3296,6 +3355,10 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3296
3355
|
}
|
|
3297
3356
|
set initialStyledText(value) {
|
|
3298
3357
|
if (this._initialStyledText !== value) {
|
|
3358
|
+
if (value && this._streaming && this._drawUnstyledText && this._isHighlighting) {
|
|
3359
|
+
this.updateStreamingPreview(this._content, value);
|
|
3360
|
+
return;
|
|
3361
|
+
}
|
|
3299
3362
|
this._initialStyledText = value;
|
|
3300
3363
|
this.invalidateHighlights();
|
|
3301
3364
|
}
|
|
@@ -3423,15 +3486,18 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3423
3486
|
}
|
|
3424
3487
|
}
|
|
3425
3488
|
if (highlights.length > 0 || this._onChunks || this._baseHighlight) {
|
|
3489
|
+
const sourceRanges = this._onChunks ? [] : undefined;
|
|
3426
3490
|
const context = {
|
|
3427
3491
|
content,
|
|
3428
3492
|
filetype,
|
|
3429
3493
|
syntaxStyle: this._syntaxStyle,
|
|
3430
|
-
highlights
|
|
3494
|
+
highlights,
|
|
3495
|
+
sourceRanges
|
|
3431
3496
|
};
|
|
3432
|
-
let chunks =
|
|
3497
|
+
let chunks = treeSitterToTextChunks2(content, highlights, this._syntaxStyle, {
|
|
3433
3498
|
enabled: this._conceal,
|
|
3434
|
-
baseHighlight: this._baseHighlight
|
|
3499
|
+
baseHighlight: this._baseHighlight,
|
|
3500
|
+
ranges: sourceRanges
|
|
3435
3501
|
});
|
|
3436
3502
|
const renderedLineSources = this._onChunks ? undefined : this.getConcealLinesSourceMap(content, highlights);
|
|
3437
3503
|
chunks = await this.transformChunks(chunks, context);
|
|
@@ -3441,7 +3507,7 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3441
3507
|
}
|
|
3442
3508
|
if (this.isDestroyed)
|
|
3443
3509
|
return;
|
|
3444
|
-
const styledText = new
|
|
3510
|
+
const styledText = new StyledText2(chunks);
|
|
3445
3511
|
this.textBuffer.setStyledText(styledText);
|
|
3446
3512
|
this.setRenderedLineSources(renderedLineSources);
|
|
3447
3513
|
} else {
|
|
@@ -3530,7 +3596,7 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3530
3596
|
getConcealLinesSourceMap(content, highlights) {
|
|
3531
3597
|
if (!this._conceal || content.length === 0)
|
|
3532
3598
|
return;
|
|
3533
|
-
const concealLineRanges =
|
|
3599
|
+
const concealLineRanges = CodeRenderable2.getMergedConcealLineRanges(highlights);
|
|
3534
3600
|
if (concealLineRanges.length === 0)
|
|
3535
3601
|
return;
|
|
3536
3602
|
const lineSources = [];
|
|
@@ -3572,7 +3638,7 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3572
3638
|
break;
|
|
3573
3639
|
lineStart = newlineOffset + 1;
|
|
3574
3640
|
}
|
|
3575
|
-
if (lineSources.length === 0 ||
|
|
3641
|
+
if (lineSources.length === 0 || CodeRenderable2.isIdentityLineSources(lineSources))
|
|
3576
3642
|
return;
|
|
3577
3643
|
return lineSources;
|
|
3578
3644
|
}
|
|
@@ -3634,12 +3700,12 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3634
3700
|
|
|
3635
3701
|
// src/renderables/TextNode.ts
|
|
3636
3702
|
var BrandedTextNodeRenderable = Symbol.for("@opentui/core/TextNodeRenderable");
|
|
3637
|
-
function
|
|
3703
|
+
function isTextNodeRenderable2(obj) {
|
|
3638
3704
|
return !!obj?.[BrandedTextNodeRenderable];
|
|
3639
3705
|
}
|
|
3640
3706
|
function styledTextToTextNodes(styledText) {
|
|
3641
3707
|
return styledText.chunks.map((chunk) => {
|
|
3642
|
-
const node = new
|
|
3708
|
+
const node = new TextNodeRenderable2({
|
|
3643
3709
|
fg: chunk.fg,
|
|
3644
3710
|
bg: chunk.bg,
|
|
3645
3711
|
attributes: chunk.attributes,
|
|
@@ -3650,7 +3716,7 @@ function styledTextToTextNodes(styledText) {
|
|
|
3650
3716
|
});
|
|
3651
3717
|
}
|
|
3652
3718
|
|
|
3653
|
-
class
|
|
3719
|
+
class TextNodeRenderable2 extends BaseRenderable2 {
|
|
3654
3720
|
[BrandedTextNodeRenderable] = true;
|
|
3655
3721
|
_fg;
|
|
3656
3722
|
_bg;
|
|
@@ -3660,8 +3726,8 @@ class TextNodeRenderable extends BaseRenderable {
|
|
|
3660
3726
|
parent = null;
|
|
3661
3727
|
constructor(options) {
|
|
3662
3728
|
super(options);
|
|
3663
|
-
this._fg = options.fg ?
|
|
3664
|
-
this._bg = options.bg ?
|
|
3729
|
+
this._fg = options.fg ? parseColor2(options.fg) : undefined;
|
|
3730
|
+
this._bg = options.bg ? parseColor2(options.bg) : undefined;
|
|
3665
3731
|
this._attributes = options.attributes ?? 0;
|
|
3666
3732
|
this._link = options.link;
|
|
3667
3733
|
}
|
|
@@ -3670,12 +3736,12 @@ class TextNodeRenderable extends BaseRenderable {
|
|
|
3670
3736
|
}
|
|
3671
3737
|
set children(children) {
|
|
3672
3738
|
for (const child of this._children) {
|
|
3673
|
-
if (
|
|
3739
|
+
if (isTextNodeRenderable2(child) && child.parent === this) {
|
|
3674
3740
|
child.parent = null;
|
|
3675
3741
|
}
|
|
3676
3742
|
}
|
|
3677
3743
|
for (const child of children) {
|
|
3678
|
-
if (
|
|
3744
|
+
if (isTextNodeRenderable2(child)) {
|
|
3679
3745
|
if (child.parent && child.parent !== this) {
|
|
3680
3746
|
child.parent.remove(child);
|
|
3681
3747
|
}
|
|
@@ -3701,14 +3767,14 @@ class TextNodeRenderable extends BaseRenderable {
|
|
|
3701
3767
|
this.requestRender();
|
|
3702
3768
|
return insertIndex;
|
|
3703
3769
|
}
|
|
3704
|
-
if (
|
|
3770
|
+
if (isTextNodeRenderable2(obj)) {
|
|
3705
3771
|
const insertIndex = this.prepareChildInsert(obj, index);
|
|
3706
3772
|
this._children.splice(insertIndex, 0, obj);
|
|
3707
3773
|
obj.parent = this;
|
|
3708
3774
|
this.requestRender();
|
|
3709
3775
|
return insertIndex;
|
|
3710
3776
|
}
|
|
3711
|
-
if (
|
|
3777
|
+
if (isStyledText2(obj)) {
|
|
3712
3778
|
const textNodes = styledTextToTextNodes(obj);
|
|
3713
3779
|
if (index !== undefined) {
|
|
3714
3780
|
this._children.splice(index, 0, ...textNodes);
|
|
@@ -3740,10 +3806,10 @@ class TextNodeRenderable extends BaseRenderable {
|
|
|
3740
3806
|
}
|
|
3741
3807
|
replace(obj, index) {
|
|
3742
3808
|
const existing = this._children[index];
|
|
3743
|
-
if (
|
|
3809
|
+
if (isTextNodeRenderable2(existing) && existing.parent === this) {
|
|
3744
3810
|
existing.parent = null;
|
|
3745
3811
|
}
|
|
3746
|
-
if (
|
|
3812
|
+
if (isTextNodeRenderable2(obj)) {
|
|
3747
3813
|
if (obj.parent && obj.parent !== this) {
|
|
3748
3814
|
obj.parent.remove(obj);
|
|
3749
3815
|
} else if (obj.parent === this) {
|
|
@@ -3760,7 +3826,7 @@ class TextNodeRenderable extends BaseRenderable {
|
|
|
3760
3826
|
this.requestRender();
|
|
3761
3827
|
}
|
|
3762
3828
|
insertBefore(child, anchorNode) {
|
|
3763
|
-
if (!anchorNode || !
|
|
3829
|
+
if (!anchorNode || !isTextNodeRenderable2(anchorNode)) {
|
|
3764
3830
|
throw new Error("Anchor must be a TextNodeRenderable");
|
|
3765
3831
|
}
|
|
3766
3832
|
const anchorIndex = this._children.indexOf(anchorNode);
|
|
@@ -3770,13 +3836,13 @@ class TextNodeRenderable extends BaseRenderable {
|
|
|
3770
3836
|
if (child === anchorNode) {
|
|
3771
3837
|
return this;
|
|
3772
3838
|
}
|
|
3773
|
-
if (
|
|
3839
|
+
if (isTextNodeRenderable2(child)) {
|
|
3774
3840
|
this.add(child, anchorIndex);
|
|
3775
3841
|
return this;
|
|
3776
3842
|
}
|
|
3777
3843
|
if (typeof child === "string") {
|
|
3778
3844
|
this._children.splice(anchorIndex, 0, child);
|
|
3779
|
-
} else if (
|
|
3845
|
+
} else if (isStyledText2(child)) {
|
|
3780
3846
|
const textNodes = styledTextToTextNodes(child);
|
|
3781
3847
|
this._children.splice(anchorIndex, 0, ...textNodes);
|
|
3782
3848
|
textNodes.forEach((node) => node.parent = this);
|
|
@@ -3787,7 +3853,7 @@ class TextNodeRenderable extends BaseRenderable {
|
|
|
3787
3853
|
return this;
|
|
3788
3854
|
}
|
|
3789
3855
|
remove(child) {
|
|
3790
|
-
if (!
|
|
3856
|
+
if (!isTextNodeRenderable2(child)) {
|
|
3791
3857
|
throw new Error("remove expects a TextNodeRenderable child object");
|
|
3792
3858
|
}
|
|
3793
3859
|
const childIndex = this._children.indexOf(child);
|
|
@@ -3803,7 +3869,7 @@ class TextNodeRenderable extends BaseRenderable {
|
|
|
3803
3869
|
}
|
|
3804
3870
|
clear() {
|
|
3805
3871
|
for (const child of this._children) {
|
|
3806
|
-
if (
|
|
3872
|
+
if (isTextNodeRenderable2(child) && child.parent === this) {
|
|
3807
3873
|
child.parent = null;
|
|
3808
3874
|
}
|
|
3809
3875
|
}
|
|
@@ -3844,12 +3910,12 @@ class TextNodeRenderable extends BaseRenderable {
|
|
|
3844
3910
|
return chunks;
|
|
3845
3911
|
}
|
|
3846
3912
|
static fromString(text, options = {}) {
|
|
3847
|
-
const node = new
|
|
3913
|
+
const node = new TextNodeRenderable2(options);
|
|
3848
3914
|
node.add(text);
|
|
3849
3915
|
return node;
|
|
3850
3916
|
}
|
|
3851
3917
|
static fromNodes(nodes, options = {}) {
|
|
3852
|
-
const node = new
|
|
3918
|
+
const node = new TextNodeRenderable2(options);
|
|
3853
3919
|
for (const childNode of nodes) {
|
|
3854
3920
|
node.add(childNode);
|
|
3855
3921
|
}
|
|
@@ -3872,7 +3938,7 @@ class TextNodeRenderable extends BaseRenderable {
|
|
|
3872
3938
|
return this._children.find((child) => typeof child !== "string" && child.id === id);
|
|
3873
3939
|
}
|
|
3874
3940
|
getRenderableIndex(id) {
|
|
3875
|
-
return this._children.findIndex((child) =>
|
|
3941
|
+
return this._children.findIndex((child) => isTextNodeRenderable2(child) && child.id === id);
|
|
3876
3942
|
}
|
|
3877
3943
|
get fg() {
|
|
3878
3944
|
return this._fg;
|
|
@@ -3883,7 +3949,7 @@ class TextNodeRenderable extends BaseRenderable {
|
|
|
3883
3949
|
this.requestRender();
|
|
3884
3950
|
return;
|
|
3885
3951
|
}
|
|
3886
|
-
this._fg =
|
|
3952
|
+
this._fg = parseColor2(fg);
|
|
3887
3953
|
this.requestRender();
|
|
3888
3954
|
}
|
|
3889
3955
|
set bg(bg) {
|
|
@@ -3892,7 +3958,7 @@ class TextNodeRenderable extends BaseRenderable {
|
|
|
3892
3958
|
this.requestRender();
|
|
3893
3959
|
return;
|
|
3894
3960
|
}
|
|
3895
|
-
this._bg =
|
|
3961
|
+
this._bg = parseColor2(bg);
|
|
3896
3962
|
this.requestRender();
|
|
3897
3963
|
}
|
|
3898
3964
|
get bg() {
|
|
@@ -3917,7 +3983,7 @@ class TextNodeRenderable extends BaseRenderable {
|
|
|
3917
3983
|
}
|
|
3918
3984
|
}
|
|
3919
3985
|
|
|
3920
|
-
class
|
|
3986
|
+
class RootTextNodeRenderable2 extends TextNodeRenderable2 {
|
|
3921
3987
|
ctx;
|
|
3922
3988
|
textParent;
|
|
3923
3989
|
constructor(ctx, options, textParent) {
|
|
@@ -3932,7 +3998,7 @@ class RootTextNodeRenderable extends TextNodeRenderable {
|
|
|
3932
3998
|
}
|
|
3933
3999
|
|
|
3934
4000
|
// src/renderables/Text.ts
|
|
3935
|
-
class
|
|
4001
|
+
class TextRenderable2 extends TextBufferRenderable2 {
|
|
3936
4002
|
_text;
|
|
3937
4003
|
_hasManualStyledText = false;
|
|
3938
4004
|
rootTextNode;
|
|
@@ -3942,10 +4008,10 @@ class TextRenderable extends TextBufferRenderable {
|
|
|
3942
4008
|
constructor(ctx, options) {
|
|
3943
4009
|
super(ctx, options);
|
|
3944
4010
|
const content = options.content ?? this._contentDefaultOptions.content;
|
|
3945
|
-
const styledText = typeof content === "string" ?
|
|
4011
|
+
const styledText = typeof content === "string" ? stringToStyledText2(content) : content;
|
|
3946
4012
|
this._text = styledText;
|
|
3947
4013
|
this._hasManualStyledText = options.content !== undefined && content !== "";
|
|
3948
|
-
this.rootTextNode = new
|
|
4014
|
+
this.rootTextNode = new RootTextNodeRenderable2(ctx, {
|
|
3949
4015
|
id: `${this.id}-root`,
|
|
3950
4016
|
fg: this._defaultFg,
|
|
3951
4017
|
bg: this._defaultBg,
|
|
@@ -3969,7 +4035,7 @@ class TextRenderable extends TextBufferRenderable {
|
|
|
3969
4035
|
}
|
|
3970
4036
|
set content(value) {
|
|
3971
4037
|
this._hasManualStyledText = true;
|
|
3972
|
-
const styledText = typeof value === "string" ?
|
|
4038
|
+
const styledText = typeof value === "string" ? stringToStyledText2(value) : value;
|
|
3973
4039
|
if (this._text !== styledText) {
|
|
3974
4040
|
this._text = styledText;
|
|
3975
4041
|
this.updateTextBuffer(styledText);
|
|
@@ -3984,7 +4050,7 @@ class TextRenderable extends TextBufferRenderable {
|
|
|
3984
4050
|
attributes: this._defaultAttributes,
|
|
3985
4051
|
link: undefined
|
|
3986
4052
|
});
|
|
3987
|
-
this.textBuffer.setStyledText(new
|
|
4053
|
+
this.textBuffer.setStyledText(new StyledText2(chunks));
|
|
3988
4054
|
this.refreshLocalSelection();
|
|
3989
4055
|
this.yogaNode.markDirty();
|
|
3990
4056
|
}
|
|
@@ -4004,7 +4070,7 @@ class TextRenderable extends TextBufferRenderable {
|
|
|
4004
4070
|
}
|
|
4005
4071
|
clear() {
|
|
4006
4072
|
this.rootTextNode.clear();
|
|
4007
|
-
const emptyStyledText =
|
|
4073
|
+
const emptyStyledText = stringToStyledText2("");
|
|
4008
4074
|
this._text = emptyStyledText;
|
|
4009
4075
|
this.updateTextBuffer(emptyStyledText);
|
|
4010
4076
|
this.updateTextInfo();
|
|
@@ -4034,11 +4100,11 @@ function toNumber(value) {
|
|
|
4034
4100
|
}
|
|
4035
4101
|
var canThrowAcrossNativeCallback = typeof process !== "undefined" && typeof process.versions === "object" && process.versions !== null && typeof process.versions.bun === "string";
|
|
4036
4102
|
|
|
4037
|
-
class
|
|
4103
|
+
class NativeSpanFeed2 {
|
|
4038
4104
|
static create(options) {
|
|
4039
|
-
const lib =
|
|
4105
|
+
const lib = resolveRenderLib2();
|
|
4040
4106
|
const streamPtr = lib.createNativeSpanFeed(options);
|
|
4041
|
-
const stream = new
|
|
4107
|
+
const stream = new NativeSpanFeed2(streamPtr);
|
|
4042
4108
|
lib.registerNativeSpanFeedStream(streamPtr, stream.eventHandler);
|
|
4043
4109
|
const status = lib.attachNativeSpanFeed(streamPtr);
|
|
4044
4110
|
if (status !== 0) {
|
|
@@ -4049,8 +4115,8 @@ class NativeSpanFeed {
|
|
|
4049
4115
|
return stream;
|
|
4050
4116
|
}
|
|
4051
4117
|
static attach(streamPtr, _options) {
|
|
4052
|
-
const lib =
|
|
4053
|
-
const stream = new
|
|
4118
|
+
const lib = resolveRenderLib2();
|
|
4119
|
+
const stream = new NativeSpanFeed2(streamPtr);
|
|
4054
4120
|
lib.registerNativeSpanFeedStream(streamPtr, stream.eventHandler);
|
|
4055
4121
|
const status = lib.attachNativeSpanFeed(streamPtr);
|
|
4056
4122
|
if (status !== 0) {
|
|
@@ -4060,7 +4126,7 @@ class NativeSpanFeed {
|
|
|
4060
4126
|
return stream;
|
|
4061
4127
|
}
|
|
4062
4128
|
streamPtr;
|
|
4063
|
-
lib =
|
|
4129
|
+
lib = resolveRenderLib2();
|
|
4064
4130
|
eventHandler;
|
|
4065
4131
|
chunkMap = new Map;
|
|
4066
4132
|
chunkSizes = new Map;
|
|
@@ -4534,14 +4600,14 @@ function getCallerInfo() {
|
|
|
4534
4600
|
const columnNumber = parseInt(match[4], 10) || 0;
|
|
4535
4601
|
return { functionName, fullPath, fileName, lineNumber, columnNumber };
|
|
4536
4602
|
}
|
|
4537
|
-
var
|
|
4538
|
-
|
|
4603
|
+
var capture2 = singleton("ConsoleCapture", () => new Capture);
|
|
4604
|
+
registerEnvVar2({
|
|
4539
4605
|
name: "OTUI_USE_CONSOLE",
|
|
4540
4606
|
description: "Whether to use the console. Will not capture console output if set to false.",
|
|
4541
4607
|
type: "boolean",
|
|
4542
4608
|
default: true
|
|
4543
4609
|
});
|
|
4544
|
-
|
|
4610
|
+
registerEnvVar2({
|
|
4545
4611
|
name: "SHOW_CONSOLE",
|
|
4546
4612
|
description: "Show the console at startup if set to true.",
|
|
4547
4613
|
type: "boolean",
|
|
@@ -4561,7 +4627,7 @@ class TerminalConsoleCache extends EventEmitter4 {
|
|
|
4561
4627
|
super();
|
|
4562
4628
|
}
|
|
4563
4629
|
activate() {
|
|
4564
|
-
if (!
|
|
4630
|
+
if (!env2.OTUI_USE_CONSOLE)
|
|
4565
4631
|
return;
|
|
4566
4632
|
if (!this._originalConsole) {
|
|
4567
4633
|
this._originalConsole = global.console;
|
|
@@ -4570,10 +4636,10 @@ class TerminalConsoleCache extends EventEmitter4 {
|
|
|
4570
4636
|
this.overrideConsoleMethods();
|
|
4571
4637
|
}
|
|
4572
4638
|
setupConsoleCapture() {
|
|
4573
|
-
if (!
|
|
4639
|
+
if (!env2.OTUI_USE_CONSOLE)
|
|
4574
4640
|
return;
|
|
4575
|
-
const mockStdout = new CapturedWritableStream("stdout",
|
|
4576
|
-
const mockStderr = new CapturedWritableStream("stderr",
|
|
4641
|
+
const mockStdout = new CapturedWritableStream("stdout", capture2);
|
|
4642
|
+
const mockStderr = new CapturedWritableStream("stderr", capture2);
|
|
4577
4643
|
global.console = new Console({
|
|
4578
4644
|
stdout: mockStdout,
|
|
4579
4645
|
stderr: mockStderr,
|
|
@@ -4645,19 +4711,19 @@ class TerminalConsoleCache extends EventEmitter4 {
|
|
|
4645
4711
|
}
|
|
4646
4712
|
}
|
|
4647
4713
|
var terminalConsoleCache = singleton("TerminalConsoleCache", () => {
|
|
4648
|
-
const
|
|
4714
|
+
const terminalConsoleCache = new TerminalConsoleCache;
|
|
4649
4715
|
process.on("exit", () => {
|
|
4650
|
-
|
|
4716
|
+
terminalConsoleCache.destroy();
|
|
4651
4717
|
});
|
|
4652
|
-
return
|
|
4718
|
+
return terminalConsoleCache;
|
|
4653
4719
|
});
|
|
4654
|
-
var
|
|
4655
|
-
((
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
})(
|
|
4720
|
+
var ConsolePosition2;
|
|
4721
|
+
((ConsolePosition) => {
|
|
4722
|
+
ConsolePosition["TOP"] = "top";
|
|
4723
|
+
ConsolePosition["BOTTOM"] = "bottom";
|
|
4724
|
+
ConsolePosition["LEFT"] = "left";
|
|
4725
|
+
ConsolePosition["RIGHT"] = "right";
|
|
4726
|
+
})(ConsolePosition2 ||= {});
|
|
4661
4727
|
var defaultConsoleKeybindings = [
|
|
4662
4728
|
{ name: "up", action: "scroll-up" },
|
|
4663
4729
|
{ name: "down", action: "scroll-down" },
|
|
@@ -4680,10 +4746,10 @@ var DEFAULT_CONSOLE_OPTIONS = {
|
|
|
4680
4746
|
colorError: "#FF0000",
|
|
4681
4747
|
colorDebug: "#808080",
|
|
4682
4748
|
colorDefault: "#FFFFFF",
|
|
4683
|
-
backgroundColor:
|
|
4749
|
+
backgroundColor: RGBA2.fromValues(0.1, 0.1, 0.1, 0.7),
|
|
4684
4750
|
startInDebugMode: false,
|
|
4685
4751
|
title: "Console",
|
|
4686
|
-
titleBarColor:
|
|
4752
|
+
titleBarColor: RGBA2.fromValues(0.05, 0.05, 0.05, 0.7),
|
|
4687
4753
|
titleBarTextColor: "#FFFFFF",
|
|
4688
4754
|
cursorColor: "#00A0FF",
|
|
4689
4755
|
maxStoredLogs: 2000,
|
|
@@ -4691,12 +4757,12 @@ var DEFAULT_CONSOLE_OPTIONS = {
|
|
|
4691
4757
|
onCopySelection: undefined,
|
|
4692
4758
|
keyBindings: undefined,
|
|
4693
4759
|
keyAliasMap: undefined,
|
|
4694
|
-
selectionColor:
|
|
4760
|
+
selectionColor: RGBA2.fromValues(0.3, 0.5, 0.8, 0.5),
|
|
4695
4761
|
copyButtonColor: "#00A0FF"
|
|
4696
4762
|
};
|
|
4697
4763
|
var INDENT_WIDTH = 2;
|
|
4698
4764
|
|
|
4699
|
-
class
|
|
4765
|
+
class TerminalConsole2 extends EventEmitter4 {
|
|
4700
4766
|
isVisible = false;
|
|
4701
4767
|
isFocused = false;
|
|
4702
4768
|
renderer;
|
|
@@ -4765,23 +4831,23 @@ class TerminalConsole extends EventEmitter4 {
|
|
|
4765
4831
|
constructor(renderer, options = {}) {
|
|
4766
4832
|
super();
|
|
4767
4833
|
this.renderer = renderer;
|
|
4768
|
-
this.clock = options.clock ?? new
|
|
4834
|
+
this.clock = options.clock ?? new SystemClock2;
|
|
4769
4835
|
this.options = { ...DEFAULT_CONSOLE_OPTIONS, ...options };
|
|
4770
4836
|
this.keyHandler = this.handleKeyPress.bind(this);
|
|
4771
4837
|
this._debugModeEnabled = this.options.startInDebugMode;
|
|
4772
4838
|
terminalConsoleCache.setCollectCallerInfo(this._debugModeEnabled);
|
|
4773
|
-
this._rgbaInfo =
|
|
4774
|
-
this._rgbaWarn =
|
|
4775
|
-
this._rgbaError =
|
|
4776
|
-
this._rgbaDebug =
|
|
4777
|
-
this._rgbaDefault =
|
|
4778
|
-
this.backgroundColor =
|
|
4779
|
-
this._rgbaTitleBar =
|
|
4780
|
-
this._rgbaTitleBarText =
|
|
4839
|
+
this._rgbaInfo = parseColor2(this.options.colorInfo);
|
|
4840
|
+
this._rgbaWarn = parseColor2(this.options.colorWarn);
|
|
4841
|
+
this._rgbaError = parseColor2(this.options.colorError);
|
|
4842
|
+
this._rgbaDebug = parseColor2(this.options.colorDebug);
|
|
4843
|
+
this._rgbaDefault = parseColor2(this.options.colorDefault);
|
|
4844
|
+
this.backgroundColor = parseColor2(this.options.backgroundColor);
|
|
4845
|
+
this._rgbaTitleBar = parseColor2(this.options.titleBarColor);
|
|
4846
|
+
this._rgbaTitleBarText = parseColor2(this.options.titleBarTextColor || this.options.colorDefault);
|
|
4781
4847
|
this._title = this.options.title;
|
|
4782
|
-
this._rgbaCursor =
|
|
4783
|
-
this._rgbaSelection =
|
|
4784
|
-
this._rgbaCopyButton =
|
|
4848
|
+
this._rgbaCursor = parseColor2(this.options.cursorColor);
|
|
4849
|
+
this._rgbaSelection = parseColor2(this.options.selectionColor);
|
|
4850
|
+
this._rgbaCopyButton = parseColor2(this.options.copyButtonColor);
|
|
4785
4851
|
this._keyAliasMap = mergeKeyAliases(defaultKeyAliases, options.keyAliasMap || {});
|
|
4786
4852
|
this._keyBindings = options.keyBindings || [];
|
|
4787
4853
|
this._mergedKeyBindings = mergeKeyBindings(defaultConsoleKeybindings, this._keyBindings);
|
|
@@ -4793,7 +4859,7 @@ class TerminalConsole extends EventEmitter4 {
|
|
|
4793
4859
|
this._handleNewLog(logEntry);
|
|
4794
4860
|
};
|
|
4795
4861
|
terminalConsoleCache.on("entry", this._entryListener);
|
|
4796
|
-
if (
|
|
4862
|
+
if (env2.SHOW_CONSOLE) {
|
|
4797
4863
|
this.show();
|
|
4798
4864
|
}
|
|
4799
4865
|
}
|
|
@@ -5052,7 +5118,7 @@ class TerminalConsole extends EventEmitter4 {
|
|
|
5052
5118
|
this._processCachedLogs();
|
|
5053
5119
|
terminalConsoleCache.setCachingEnabled(false);
|
|
5054
5120
|
if (!this.frameBuffer) {
|
|
5055
|
-
this.frameBuffer =
|
|
5121
|
+
this.frameBuffer = OptimizedBuffer2.create(this.consoleWidth, this.consoleHeight, this.renderer.widthMethod, {
|
|
5056
5122
|
respectAlpha: this.backgroundColor.a < 1,
|
|
5057
5123
|
id: "console framebuffer"
|
|
5058
5124
|
});
|
|
@@ -5099,7 +5165,7 @@ class TerminalConsole extends EventEmitter4 {
|
|
|
5099
5165
|
const copyButtonX = this.consoleWidth - copyLabel.length - 1;
|
|
5100
5166
|
if (copyButtonX >= 0) {
|
|
5101
5167
|
const copyButtonEnabled = this.hasSelection();
|
|
5102
|
-
const disabledColor =
|
|
5168
|
+
const disabledColor = RGBA2.fromInts(100, 100, 100, 255);
|
|
5103
5169
|
const copyColor = copyButtonEnabled ? this._rgbaCopyButton : disabledColor;
|
|
5104
5170
|
this.frameBuffer.drawText(copyLabel, copyButtonX, 0, copyColor, this._rgbaTitleBar);
|
|
5105
5171
|
this._copyButtonBounds = { x: copyButtonX, y: 0, width: copyLabel.length, height: 1 };
|
|
@@ -5488,10 +5554,17 @@ class TerminalConsole extends EventEmitter4 {
|
|
|
5488
5554
|
|
|
5489
5555
|
// src/renderables/EditBufferRenderable.ts
|
|
5490
5556
|
var BrandedEditBufferRenderable = Symbol.for("@opentui/core/EditBufferRenderable");
|
|
5491
|
-
var
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5557
|
+
var emptyVisualCursor = Object.freeze({
|
|
5558
|
+
visualRow: 0,
|
|
5559
|
+
visualCol: 0,
|
|
5560
|
+
logicalRow: 0,
|
|
5561
|
+
logicalCol: 0,
|
|
5562
|
+
offset: 0
|
|
5563
|
+
});
|
|
5564
|
+
var EditBufferRenderableEvents2;
|
|
5565
|
+
((EditBufferRenderableEvents) => {
|
|
5566
|
+
EditBufferRenderableEvents["TRAITS_CHANGED"] = "traits-changed";
|
|
5567
|
+
})(EditBufferRenderableEvents2 ||= {});
|
|
5495
5568
|
function sameCapture(a, b) {
|
|
5496
5569
|
if (a === b)
|
|
5497
5570
|
return true;
|
|
@@ -5504,11 +5577,11 @@ function sameCapture(a, b) {
|
|
|
5504
5577
|
function sameTraits(a, b) {
|
|
5505
5578
|
return a.suspend === b.suspend && a.status === b.status && sameCapture(a.capture, b.capture);
|
|
5506
5579
|
}
|
|
5507
|
-
function
|
|
5580
|
+
function isEditBufferRenderable2(obj) {
|
|
5508
5581
|
return !!(obj && typeof obj === "object" && (BrandedEditBufferRenderable in obj));
|
|
5509
5582
|
}
|
|
5510
5583
|
|
|
5511
|
-
class
|
|
5584
|
+
class EditBufferRenderable2 extends Renderable2 {
|
|
5512
5585
|
[BrandedEditBufferRenderable] = true;
|
|
5513
5586
|
_focusable = true;
|
|
5514
5587
|
selectable = true;
|
|
@@ -5536,7 +5609,7 @@ class EditBufferRenderable extends Renderable {
|
|
|
5536
5609
|
editorView;
|
|
5537
5610
|
nativeRenderable = null;
|
|
5538
5611
|
_defaultOptions = {
|
|
5539
|
-
textColor:
|
|
5612
|
+
textColor: RGBA2.fromValues(1, 1, 1, 1),
|
|
5540
5613
|
backgroundColor: "transparent",
|
|
5541
5614
|
selectionBg: undefined,
|
|
5542
5615
|
selectionFg: undefined,
|
|
@@ -5546,7 +5619,7 @@ class EditBufferRenderable extends Renderable {
|
|
|
5546
5619
|
scrollMargin: 0.2,
|
|
5547
5620
|
scrollSpeed: 16,
|
|
5548
5621
|
showCursor: true,
|
|
5549
|
-
cursorColor:
|
|
5622
|
+
cursorColor: RGBA2.fromValues(1, 1, 1, 1),
|
|
5550
5623
|
cursorStyle: {
|
|
5551
5624
|
style: "block",
|
|
5552
5625
|
blinking: true
|
|
@@ -5556,22 +5629,22 @@ class EditBufferRenderable extends Renderable {
|
|
|
5556
5629
|
};
|
|
5557
5630
|
constructor(ctx, options) {
|
|
5558
5631
|
super(ctx, options);
|
|
5559
|
-
this._textColor =
|
|
5560
|
-
this._backgroundColor =
|
|
5632
|
+
this._textColor = parseColor2(options.textColor ?? this._defaultOptions.textColor);
|
|
5633
|
+
this._backgroundColor = parseColor2(options.backgroundColor ?? this._defaultOptions.backgroundColor);
|
|
5561
5634
|
this._defaultAttributes = options.attributes ?? this._defaultOptions.attributes;
|
|
5562
|
-
this._selectionBg = options.selectionBg ?
|
|
5563
|
-
this._selectionFg = options.selectionFg ?
|
|
5635
|
+
this._selectionBg = options.selectionBg ? parseColor2(options.selectionBg) : this._defaultOptions.selectionBg;
|
|
5636
|
+
this._selectionFg = options.selectionFg ? parseColor2(options.selectionFg) : this._defaultOptions.selectionFg;
|
|
5564
5637
|
this.selectable = options.selectable ?? this._defaultOptions.selectable;
|
|
5565
5638
|
this._wrapMode = options.wrapMode ?? this._defaultOptions.wrapMode;
|
|
5566
5639
|
this._scrollMargin = options.scrollMargin ?? this._defaultOptions.scrollMargin;
|
|
5567
5640
|
this._scrollSpeed = options.scrollSpeed ?? this._defaultOptions.scrollSpeed;
|
|
5568
5641
|
this._showCursor = options.showCursor ?? this._defaultOptions.showCursor;
|
|
5569
|
-
this._cursorColor =
|
|
5642
|
+
this._cursorColor = parseColor2(options.cursorColor ?? this._defaultOptions.cursorColor);
|
|
5570
5643
|
this._cursorStyle = options.cursorStyle ?? this._defaultOptions.cursorStyle;
|
|
5571
5644
|
this._tabIndicator = options.tabIndicator ?? this._defaultOptions.tabIndicator;
|
|
5572
|
-
this._tabIndicatorColor = options.tabIndicatorColor ?
|
|
5573
|
-
this.editBuffer =
|
|
5574
|
-
this.editorView =
|
|
5645
|
+
this._tabIndicatorColor = options.tabIndicatorColor ? parseColor2(options.tabIndicatorColor) : this._defaultOptions.tabIndicatorColor;
|
|
5646
|
+
this.editBuffer = EditBuffer2.create(this._ctx.widthMethod);
|
|
5647
|
+
this.editorView = EditorView2.create(this.editBuffer, this.width || 80, this.height || 24);
|
|
5575
5648
|
this.editorView.setWrapMode(this._wrapMode);
|
|
5576
5649
|
this.editorView.setScrollMargin(this._scrollMargin);
|
|
5577
5650
|
if (options.selectionOccupancy === "boundary") {
|
|
@@ -5632,10 +5705,12 @@ class EditBufferRenderable extends Renderable {
|
|
|
5632
5705
|
return this.editBuffer.getCursorPosition();
|
|
5633
5706
|
}
|
|
5634
5707
|
get visualCursor() {
|
|
5708
|
+
if (this.editorView.isDestroyed)
|
|
5709
|
+
return emptyVisualCursor;
|
|
5635
5710
|
return this.editorView.getVisualCursor();
|
|
5636
5711
|
}
|
|
5637
5712
|
get cursorOffset() {
|
|
5638
|
-
return this.
|
|
5713
|
+
return this.visualCursor.offset;
|
|
5639
5714
|
}
|
|
5640
5715
|
set cursorOffset(offset) {
|
|
5641
5716
|
this.clearSelection();
|
|
@@ -5663,7 +5738,7 @@ class EditBufferRenderable extends Renderable {
|
|
|
5663
5738
|
return this._textColor;
|
|
5664
5739
|
}
|
|
5665
5740
|
set textColor(value) {
|
|
5666
|
-
const newColor =
|
|
5741
|
+
const newColor = parseColor2(value ?? this._defaultOptions.textColor);
|
|
5667
5742
|
if (this._textColor !== newColor) {
|
|
5668
5743
|
this._textColor = newColor;
|
|
5669
5744
|
this.editBuffer.setDefaultFg(newColor);
|
|
@@ -5684,7 +5759,7 @@ class EditBufferRenderable extends Renderable {
|
|
|
5684
5759
|
this.emit("traits-changed" /* TRAITS_CHANGED */, value, prev);
|
|
5685
5760
|
}
|
|
5686
5761
|
set selectionBg(value) {
|
|
5687
|
-
const newColor = value ?
|
|
5762
|
+
const newColor = value ? parseColor2(value) : this._defaultOptions.selectionBg;
|
|
5688
5763
|
if (this._selectionBg !== newColor) {
|
|
5689
5764
|
this._selectionBg = newColor;
|
|
5690
5765
|
this.refreshSelectionStyle();
|
|
@@ -5695,7 +5770,7 @@ class EditBufferRenderable extends Renderable {
|
|
|
5695
5770
|
return this._selectionFg;
|
|
5696
5771
|
}
|
|
5697
5772
|
set selectionFg(value) {
|
|
5698
|
-
const newColor = value ?
|
|
5773
|
+
const newColor = value ? parseColor2(value) : this._defaultOptions.selectionFg;
|
|
5699
5774
|
if (this._selectionFg !== newColor) {
|
|
5700
5775
|
this._selectionFg = newColor;
|
|
5701
5776
|
this.refreshSelectionStyle();
|
|
@@ -5706,7 +5781,7 @@ class EditBufferRenderable extends Renderable {
|
|
|
5706
5781
|
return this._backgroundColor;
|
|
5707
5782
|
}
|
|
5708
5783
|
set backgroundColor(value) {
|
|
5709
|
-
const newColor =
|
|
5784
|
+
const newColor = parseColor2(value ?? this._defaultOptions.backgroundColor);
|
|
5710
5785
|
if (this._backgroundColor !== newColor) {
|
|
5711
5786
|
this._backgroundColor = newColor;
|
|
5712
5787
|
this.editBuffer.setDefaultBg(newColor);
|
|
@@ -5750,7 +5825,7 @@ class EditBufferRenderable extends Renderable {
|
|
|
5750
5825
|
return this._cursorColor;
|
|
5751
5826
|
}
|
|
5752
5827
|
set cursorColor(value) {
|
|
5753
|
-
const newColor =
|
|
5828
|
+
const newColor = parseColor2(value);
|
|
5754
5829
|
if (this._cursorColor !== newColor) {
|
|
5755
5830
|
this._cursorColor = newColor;
|
|
5756
5831
|
if (this._focused) {
|
|
@@ -5796,7 +5871,7 @@ class EditBufferRenderable extends Renderable {
|
|
|
5796
5871
|
return this._tabIndicatorColor;
|
|
5797
5872
|
}
|
|
5798
5873
|
set tabIndicatorColor(value) {
|
|
5799
|
-
const newColor = value ?
|
|
5874
|
+
const newColor = value ? parseColor2(value) : undefined;
|
|
5800
5875
|
if (this._tabIndicatorColor !== newColor) {
|
|
5801
5876
|
this._tabIndicatorColor = newColor;
|
|
5802
5877
|
if (newColor !== undefined) {
|
|
@@ -5868,7 +5943,7 @@ class EditBufferRenderable extends Renderable {
|
|
|
5868
5943
|
return localX >= 0 && localX < this.width && localY >= 0 && localY < this.height;
|
|
5869
5944
|
}
|
|
5870
5945
|
onSelectionChanged(selection) {
|
|
5871
|
-
const localSelection =
|
|
5946
|
+
const localSelection = convertGlobalToLocalSelection2(selection, this.x, this.y);
|
|
5872
5947
|
this.lastLocalSelection = localSelection;
|
|
5873
5948
|
const updateCursor = true;
|
|
5874
5949
|
const followCursor = this._keyboardSelectionActive;
|
|
@@ -6240,13 +6315,13 @@ class EditBufferRenderable extends Renderable {
|
|
|
6240
6315
|
return true;
|
|
6241
6316
|
}
|
|
6242
6317
|
setupNativeRenderable() {
|
|
6243
|
-
const lib =
|
|
6318
|
+
const lib = resolveRenderLib2();
|
|
6244
6319
|
const nativeRenderable = lib.createNativeRenderable();
|
|
6245
6320
|
if (!lib.nativeRenderableAttachYogaNode(nativeRenderable, this.yogaNode.ptr)) {
|
|
6246
6321
|
lib.destroyNativeRenderable(nativeRenderable);
|
|
6247
6322
|
throw new Error("Failed to attach native renderable Yoga node");
|
|
6248
6323
|
}
|
|
6249
|
-
if (!lib.nativeRenderableSetMeasureTarget(nativeRenderable,
|
|
6324
|
+
if (!lib.nativeRenderableSetMeasureTarget(nativeRenderable, NativeMeasureTargetKind2.EditorView, this.editorView.ptr)) {
|
|
6250
6325
|
lib.destroyNativeRenderable(nativeRenderable);
|
|
6251
6326
|
throw new Error("Failed to attach editor native measure target");
|
|
6252
6327
|
}
|
|
@@ -6270,7 +6345,7 @@ class EditBufferRenderable extends Renderable {
|
|
|
6270
6345
|
renderCursor(buffer) {
|
|
6271
6346
|
if (!this._showCursor || !this._focused)
|
|
6272
6347
|
return;
|
|
6273
|
-
const visualCursor = this.
|
|
6348
|
+
const visualCursor = this.visualCursor;
|
|
6274
6349
|
const screenX = this._screenX;
|
|
6275
6350
|
const screenY = this._screenY;
|
|
6276
6351
|
const cursorX = screenX + visualCursor.visualCol + 1;
|
|
@@ -6302,7 +6377,7 @@ class EditBufferRenderable extends Renderable {
|
|
|
6302
6377
|
this.blur();
|
|
6303
6378
|
}
|
|
6304
6379
|
if (this.nativeRenderable) {
|
|
6305
|
-
|
|
6380
|
+
resolveRenderLib2().destroyNativeRenderable(this.nativeRenderable);
|
|
6306
6381
|
this.nativeRenderable = null;
|
|
6307
6382
|
}
|
|
6308
6383
|
this.editorView.destroy();
|
|
@@ -6612,7 +6687,7 @@ function oscThemeColorToHex(r, g, b, hex6) {
|
|
|
6612
6687
|
return "#000000";
|
|
6613
6688
|
}
|
|
6614
6689
|
function inferThemeModeFromBackgroundColor(color) {
|
|
6615
|
-
const [r, g, b] =
|
|
6690
|
+
const [r, g, b] = parseColor2(color).toInts();
|
|
6616
6691
|
const brightness = (r * 299 + g * 587 + b * 114) / 1000;
|
|
6617
6692
|
return brightness > 128 ? "light" : "dark";
|
|
6618
6693
|
}
|
|
@@ -6744,43 +6819,43 @@ class RendererThemeMode {
|
|
|
6744
6819
|
}
|
|
6745
6820
|
|
|
6746
6821
|
// src/renderer.ts
|
|
6747
|
-
|
|
6822
|
+
registerEnvVar2({
|
|
6748
6823
|
name: "OTUI_DUMP_CAPTURES",
|
|
6749
6824
|
description: "Dump captured stdout and console caches when the renderer exit handler runs.",
|
|
6750
6825
|
type: "boolean",
|
|
6751
6826
|
default: false
|
|
6752
6827
|
});
|
|
6753
|
-
|
|
6828
|
+
registerEnvVar2({
|
|
6754
6829
|
name: "OTUI_NO_NATIVE_RENDER",
|
|
6755
6830
|
description: "Skip the Zig/native frame renderer. Useful for debugging the render loop; split-footer stdout flushing may still write ANSI.",
|
|
6756
6831
|
type: "boolean",
|
|
6757
6832
|
default: false
|
|
6758
6833
|
});
|
|
6759
|
-
|
|
6834
|
+
registerEnvVar2({
|
|
6760
6835
|
name: "OTUI_USE_ALTERNATE_SCREEN",
|
|
6761
6836
|
description: "When explicitly set, force screen mode selection: true=alternate-screen, false=main-screen.",
|
|
6762
6837
|
type: "boolean",
|
|
6763
6838
|
default: true
|
|
6764
6839
|
});
|
|
6765
|
-
|
|
6840
|
+
registerEnvVar2({
|
|
6766
6841
|
name: "OTUI_OVERRIDE_STDOUT",
|
|
6767
6842
|
description: "When explicitly set, force stdout routing: false=passthrough, true=capture in split-footer mode.",
|
|
6768
6843
|
type: "boolean",
|
|
6769
6844
|
default: true
|
|
6770
6845
|
});
|
|
6771
|
-
|
|
6846
|
+
registerEnvVar2({
|
|
6772
6847
|
name: "OTUI_DEBUG",
|
|
6773
6848
|
description: "Enable debug mode to capture all raw input for debugging purposes.",
|
|
6774
6849
|
type: "boolean",
|
|
6775
6850
|
default: false
|
|
6776
6851
|
});
|
|
6777
|
-
|
|
6852
|
+
registerEnvVar2({
|
|
6778
6853
|
name: "OTUI_STDIN_LOG",
|
|
6779
6854
|
description: "Write the raw stdin byte stream to this file for debugging.",
|
|
6780
6855
|
type: "string",
|
|
6781
6856
|
default: ""
|
|
6782
6857
|
});
|
|
6783
|
-
|
|
6858
|
+
registerEnvVar2({
|
|
6784
6859
|
name: "OTUI_SHOW_STATS",
|
|
6785
6860
|
description: "Show the debug overlay at startup.",
|
|
6786
6861
|
type: "boolean",
|
|
@@ -6789,7 +6864,7 @@ registerEnvVar({
|
|
|
6789
6864
|
var KITTY_IMAGE_TRANSPORTS = ["raw", "zlib", "file"];
|
|
6790
6865
|
var DEFAULT_FOOTER_HEIGHT = 12;
|
|
6791
6866
|
var MAX_SCROLLBACK_SURFACE_HEIGHT_PASSES = 4;
|
|
6792
|
-
var TRANSPARENT_RGBA =
|
|
6867
|
+
var TRANSPARENT_RGBA = RGBA2.fromValues(0, 0, 0, 0);
|
|
6793
6868
|
var scrollbackSurfaceCounter = 0;
|
|
6794
6869
|
function normalizeFooterHeight(footerHeight) {
|
|
6795
6870
|
if (footerHeight === undefined) {
|
|
@@ -6807,12 +6882,12 @@ function normalizeFooterHeight(footerHeight) {
|
|
|
6807
6882
|
function resolveModes(config) {
|
|
6808
6883
|
let screenMode = config.screenMode ?? "alternate-screen";
|
|
6809
6884
|
if (process.env.OTUI_USE_ALTERNATE_SCREEN !== undefined) {
|
|
6810
|
-
screenMode =
|
|
6885
|
+
screenMode = env2.OTUI_USE_ALTERNATE_SCREEN ? "alternate-screen" : "main-screen";
|
|
6811
6886
|
}
|
|
6812
6887
|
const footerHeight = screenMode === "split-footer" ? normalizeFooterHeight(config.footerHeight) : DEFAULT_FOOTER_HEIGHT;
|
|
6813
6888
|
let externalOutputMode = config.externalOutputMode ?? (screenMode === "split-footer" ? "capture-stdout" : "passthrough");
|
|
6814
6889
|
if (process.env.OTUI_OVERRIDE_STDOUT !== undefined) {
|
|
6815
|
-
externalOutputMode =
|
|
6890
|
+
externalOutputMode = env2.OTUI_OVERRIDE_STDOUT && screenMode === "split-footer" ? "capture-stdout" : "passthrough";
|
|
6816
6891
|
}
|
|
6817
6892
|
if (externalOutputMode === "capture-stdout" && screenMode !== "split-footer") {
|
|
6818
6893
|
throw new Error('externalOutputMode "capture-stdout" requires screenMode "split-footer"');
|
|
@@ -6842,9 +6917,9 @@ class ExternalOutputQueue {
|
|
|
6842
6917
|
}
|
|
6843
6918
|
const clampedLimit = Number.isFinite(limit) ? Math.max(1, Math.trunc(limit)) : this.commits.length;
|
|
6844
6919
|
if (clampedLimit >= this.commits.length) {
|
|
6845
|
-
const
|
|
6920
|
+
const output = this.commits;
|
|
6846
6921
|
this.commits = [];
|
|
6847
|
-
return
|
|
6922
|
+
return output;
|
|
6848
6923
|
}
|
|
6849
6924
|
const output = this.commits.slice(0, clampedLimit);
|
|
6850
6925
|
this.commits = this.commits.slice(clampedLimit);
|
|
@@ -6885,8 +6960,8 @@ class ScrollbackSnapshotRenderContext extends EventEmitter5 {
|
|
|
6885
6960
|
this.resolution = resolution;
|
|
6886
6961
|
this.capabilities = capabilities;
|
|
6887
6962
|
this.widthMethod = widthMethod;
|
|
6888
|
-
this.keyInput = new
|
|
6889
|
-
this._internalKeyInput = new
|
|
6963
|
+
this.keyInput = new KeyHandler2;
|
|
6964
|
+
this._internalKeyInput = new InternalKeyHandler2;
|
|
6890
6965
|
}
|
|
6891
6966
|
addToHitGrid(_x, _y, _width, _height, _id) {}
|
|
6892
6967
|
pushHitGridScissorRect(_x, _y, _width, _height) {}
|
|
@@ -6905,7 +6980,7 @@ class ScrollbackSnapshotRenderContext extends EventEmitter5 {
|
|
|
6905
6980
|
get currentFocusedEditor() {
|
|
6906
6981
|
if (!this.currentFocusedRenderable)
|
|
6907
6982
|
return null;
|
|
6908
|
-
if (!
|
|
6983
|
+
if (!isEditBufferRenderable2(this.currentFocusedRenderable))
|
|
6909
6984
|
return null;
|
|
6910
6985
|
return this.currentFocusedRenderable;
|
|
6911
6986
|
}
|
|
@@ -6972,7 +7047,7 @@ var KITTY_FLAG_ALL_KEYS_AS_ESCAPES = 8;
|
|
|
6972
7047
|
var KITTY_FLAG_REPORT_TEXT = 16;
|
|
6973
7048
|
var DEFAULT_STDIN_PARSER_MAX_BUFFER_BYTES = 64 * 1024 * 1024;
|
|
6974
7049
|
var NATIVE_PALETTE_QUERY_SIZE = 16;
|
|
6975
|
-
function
|
|
7050
|
+
function buildKittyKeyboardFlags2(config) {
|
|
6976
7051
|
if (!config) {
|
|
6977
7052
|
return 0;
|
|
6978
7053
|
}
|
|
@@ -6995,7 +7070,7 @@ function buildKittyKeyboardFlags(config) {
|
|
|
6995
7070
|
return flags;
|
|
6996
7071
|
}
|
|
6997
7072
|
|
|
6998
|
-
class
|
|
7073
|
+
class MouseEvent2 {
|
|
6999
7074
|
type;
|
|
7000
7075
|
button;
|
|
7001
7076
|
x;
|
|
@@ -7032,19 +7107,19 @@ class MouseEvent {
|
|
|
7032
7107
|
this._defaultPrevented = true;
|
|
7033
7108
|
}
|
|
7034
7109
|
}
|
|
7035
|
-
var
|
|
7036
|
-
((
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
})(
|
|
7110
|
+
var MouseButton2;
|
|
7111
|
+
((MouseButton) => {
|
|
7112
|
+
MouseButton[MouseButton["LEFT"] = 0] = "LEFT";
|
|
7113
|
+
MouseButton[MouseButton["MIDDLE"] = 1] = "MIDDLE";
|
|
7114
|
+
MouseButton[MouseButton["RIGHT"] = 2] = "RIGHT";
|
|
7115
|
+
MouseButton[MouseButton["WHEEL_UP"] = 4] = "WHEEL_UP";
|
|
7116
|
+
MouseButton[MouseButton["WHEEL_DOWN"] = 5] = "WHEEL_DOWN";
|
|
7117
|
+
})(MouseButton2 ||= {});
|
|
7043
7118
|
var rendererTracker = singleton("RendererTracker", () => ({
|
|
7044
7119
|
renderers: new Set,
|
|
7045
7120
|
streamOwners: new WeakMap
|
|
7046
7121
|
}));
|
|
7047
|
-
async function
|
|
7122
|
+
async function createCliRenderer2(config = {}) {
|
|
7048
7123
|
if (process.argv.includes("--delay-start")) {
|
|
7049
7124
|
await new Promise((resolve) => setTimeout(resolve, 5000));
|
|
7050
7125
|
}
|
|
@@ -7052,7 +7127,7 @@ async function createCliRenderer(config = {}) {
|
|
|
7052
7127
|
const stdout = config.stdout ?? process.stdout;
|
|
7053
7128
|
const width = stdout.columns || config.width || 80;
|
|
7054
7129
|
const height = stdout.rows || config.height || 24;
|
|
7055
|
-
const renderer = new
|
|
7130
|
+
const renderer = new CliRenderer2(stdin, stdout, width, height, config);
|
|
7056
7131
|
try {
|
|
7057
7132
|
await renderer.setupTerminal();
|
|
7058
7133
|
return renderer;
|
|
@@ -7065,37 +7140,37 @@ async function createCliRenderer(config = {}) {
|
|
|
7065
7140
|
throw error;
|
|
7066
7141
|
}
|
|
7067
7142
|
}
|
|
7068
|
-
var
|
|
7069
|
-
((
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
})(
|
|
7087
|
-
var
|
|
7088
|
-
((
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
})(
|
|
7143
|
+
var CliRenderEvents2;
|
|
7144
|
+
((CliRenderEvents) => {
|
|
7145
|
+
CliRenderEvents["RESIZE"] = "resize";
|
|
7146
|
+
CliRenderEvents["FRAME"] = "frame";
|
|
7147
|
+
CliRenderEvents["RENDER_ERROR"] = "render:error";
|
|
7148
|
+
CliRenderEvents["HANDLER_ERROR"] = "handler:error";
|
|
7149
|
+
CliRenderEvents["EXTERNAL_OUTPUT"] = "external_output";
|
|
7150
|
+
CliRenderEvents["FOCUS"] = "focus";
|
|
7151
|
+
CliRenderEvents["BLUR"] = "blur";
|
|
7152
|
+
CliRenderEvents["FOCUSED_RENDERABLE"] = "focused_renderable";
|
|
7153
|
+
CliRenderEvents["FOCUSED_EDITOR"] = "focused_editor";
|
|
7154
|
+
CliRenderEvents["THEME_MODE"] = "theme_mode";
|
|
7155
|
+
CliRenderEvents["PALETTE"] = "palette";
|
|
7156
|
+
CliRenderEvents["CAPABILITIES"] = "capabilities";
|
|
7157
|
+
CliRenderEvents["SELECTION"] = "selection";
|
|
7158
|
+
CliRenderEvents["DEBUG_OVERLAY_TOGGLE"] = "debugOverlay:toggle";
|
|
7159
|
+
CliRenderEvents["DESTROY"] = "destroy";
|
|
7160
|
+
CliRenderEvents["MEMORY_SNAPSHOT"] = "memory:snapshot";
|
|
7161
|
+
})(CliRenderEvents2 ||= {});
|
|
7162
|
+
var RendererControlState2;
|
|
7163
|
+
((RendererControlState) => {
|
|
7164
|
+
RendererControlState["IDLE"] = "idle";
|
|
7165
|
+
RendererControlState["AUTO_STARTED"] = "auto_started";
|
|
7166
|
+
RendererControlState["EXPLICIT_STARTED"] = "explicit_started";
|
|
7167
|
+
RendererControlState["EXPLICIT_PAUSED"] = "explicit_paused";
|
|
7168
|
+
RendererControlState["EXPLICIT_SUSPENDED"] = "explicit_suspended";
|
|
7169
|
+
RendererControlState["EXPLICIT_STOPPED"] = "explicit_stopped";
|
|
7170
|
+
})(RendererControlState2 ||= {});
|
|
7096
7171
|
var CLICK_REPEAT_INTERVAL_MS = 500;
|
|
7097
7172
|
|
|
7098
|
-
class
|
|
7173
|
+
class CliRenderer2 extends EventEmitter5 {
|
|
7099
7174
|
static animationFrameId = 0;
|
|
7100
7175
|
lib;
|
|
7101
7176
|
rendererPtr;
|
|
@@ -7130,7 +7205,7 @@ class CliRenderer extends EventEmitter5 {
|
|
|
7130
7205
|
frameTimes = [];
|
|
7131
7206
|
maxStatSamples = 300;
|
|
7132
7207
|
postProcessFns = [];
|
|
7133
|
-
backgroundColor =
|
|
7208
|
+
backgroundColor = RGBA2.fromInts(0, 0, 0, 0);
|
|
7134
7209
|
waitingForPixelResolution = false;
|
|
7135
7210
|
pixelResolutionRequeryPending = false;
|
|
7136
7211
|
clock;
|
|
@@ -7157,7 +7232,7 @@ class CliRenderer extends EventEmitter5 {
|
|
|
7157
7232
|
frameCallbackTime: 0
|
|
7158
7233
|
};
|
|
7159
7234
|
debugOverlay = {
|
|
7160
|
-
enabled:
|
|
7235
|
+
enabled: env2.OTUI_SHOW_STATS,
|
|
7161
7236
|
corner: 3 /* bottomRight */
|
|
7162
7237
|
};
|
|
7163
7238
|
_console;
|
|
@@ -7242,8 +7317,8 @@ class CliRenderer extends EventEmitter5 {
|
|
|
7242
7317
|
themeModeHandler;
|
|
7243
7318
|
idleResolvers = [];
|
|
7244
7319
|
_debugInputs = [];
|
|
7245
|
-
_debugModeEnabled =
|
|
7246
|
-
stdinLogPath =
|
|
7320
|
+
_debugModeEnabled = env2.OTUI_DEBUG;
|
|
7321
|
+
stdinLogPath = env2.OTUI_STDIN_LOG;
|
|
7247
7322
|
handleError = ((error) => {
|
|
7248
7323
|
console.error(error);
|
|
7249
7324
|
if (this._openConsoleOnError) {
|
|
@@ -7252,7 +7327,7 @@ class CliRenderer extends EventEmitter5 {
|
|
|
7252
7327
|
}).bind(this);
|
|
7253
7328
|
dumpOutputCache(optionalMessage = "") {
|
|
7254
7329
|
const cachedLogs = this.console.getCachedLogs();
|
|
7255
|
-
const capturedConsoleOutput =
|
|
7330
|
+
const capturedConsoleOutput = capture2.claimOutput();
|
|
7256
7331
|
const capturedExternalOutputCommits = this.externalOutputQueue.claim();
|
|
7257
7332
|
let capturedExternalOutput = "";
|
|
7258
7333
|
for (const commit of capturedExternalOutputCommits) {
|
|
@@ -7286,7 +7361,7 @@ Captured external output:
|
|
|
7286
7361
|
}
|
|
7287
7362
|
exitHandler = (() => {
|
|
7288
7363
|
this.destroy();
|
|
7289
|
-
if (
|
|
7364
|
+
if (env2.OTUI_DUMP_CAPTURES) {
|
|
7290
7365
|
sleep(100).then(() => {
|
|
7291
7366
|
this.dumpOutputCache(`=== CAPTURED OUTPUT ===
|
|
7292
7367
|
`);
|
|
@@ -7311,7 +7386,7 @@ Captured external output:
|
|
|
7311
7386
|
this.stdout = stdout;
|
|
7312
7387
|
this._usesProcessStdout = stdout === process.stdout;
|
|
7313
7388
|
this.realStdoutWrite = stdout.write;
|
|
7314
|
-
const lib =
|
|
7389
|
+
const lib = resolveRenderLib2();
|
|
7315
7390
|
const useMemoryBufferedOutput = config.bufferedOutput === "memory";
|
|
7316
7391
|
const useFeedOutput = !this._usesProcessStdout && !useMemoryBufferedOutput;
|
|
7317
7392
|
const { screenMode, footerHeight, externalOutputMode } = resolveModes(config);
|
|
@@ -7330,7 +7405,7 @@ Captured external output:
|
|
|
7330
7405
|
let feed = null;
|
|
7331
7406
|
if (useFeedOutput) {
|
|
7332
7407
|
try {
|
|
7333
|
-
feed =
|
|
7408
|
+
feed = NativeSpanFeed2.create();
|
|
7334
7409
|
} catch (error) {
|
|
7335
7410
|
throw new Error(`Failed to allocate NativeSpanFeed for custom stdout: ${error instanceof Error ? error.message : String(error)}`);
|
|
7336
7411
|
}
|
|
@@ -7357,7 +7432,7 @@ Captured external output:
|
|
|
7357
7432
|
config.useThread = false;
|
|
7358
7433
|
lib.setUseThread(rendererPtr, config.useThread);
|
|
7359
7434
|
const kittyConfig = config.useKittyKeyboard ?? {};
|
|
7360
|
-
const kittyFlags =
|
|
7435
|
+
const kittyFlags = buildKittyKeyboardFlags2(kittyConfig);
|
|
7361
7436
|
lib.setKittyKeyboardFlags(rendererPtr, kittyFlags);
|
|
7362
7437
|
this._feed = feed;
|
|
7363
7438
|
if (feed) {
|
|
@@ -7403,11 +7478,11 @@ Captured external output:
|
|
|
7403
7478
|
"SIGBREAK",
|
|
7404
7479
|
"SIGBUS"
|
|
7405
7480
|
];
|
|
7406
|
-
this.clipboard = new
|
|
7481
|
+
this.clipboard = new Clipboard2(this.lib, this.rendererPtr);
|
|
7407
7482
|
this.resizeDebounceDelay = config.debounceDelay || 100;
|
|
7408
7483
|
this.targetFps = config.targetFps || 30;
|
|
7409
7484
|
this.maxFps = config.maxFps || 60;
|
|
7410
|
-
this.clock = config.clock ?? new
|
|
7485
|
+
this.clock = config.clock ?? new SystemClock2;
|
|
7411
7486
|
this.themeModeState = new RendererThemeMode({
|
|
7412
7487
|
queryThemeColors: () => {
|
|
7413
7488
|
this.lib.queryThemeColors(this.rendererPtr);
|
|
@@ -7434,7 +7509,7 @@ Captured external output:
|
|
|
7434
7509
|
this.currentRenderBuffer = this.lib.getCurrentBuffer(this.rendererPtr);
|
|
7435
7510
|
this.postProcessFns = config.postProcessFns || [];
|
|
7436
7511
|
this.prependedInputHandlers = config.prependInputHandlers || [];
|
|
7437
|
-
this.root = new
|
|
7512
|
+
this.root = new RootRenderable2(this);
|
|
7438
7513
|
if (this.memorySnapshotInterval > 0) {
|
|
7439
7514
|
this.startMemorySnapshotTimer();
|
|
7440
7515
|
}
|
|
@@ -7445,7 +7520,7 @@ Captured external output:
|
|
|
7445
7520
|
process.on("uncaughtException", this.handleError);
|
|
7446
7521
|
process.on("unhandledRejection", this.handleError);
|
|
7447
7522
|
const useKittyForParsing = kittyConfig !== null;
|
|
7448
|
-
this._keyHandler = new
|
|
7523
|
+
this._keyHandler = new InternalKeyHandler2;
|
|
7449
7524
|
this._keyHandler.on("keypress", (event) => {
|
|
7450
7525
|
if (this.exitOnCtrlC && matchesKeyBinding(event, { name: "c", ctrl: true })) {
|
|
7451
7526
|
process.nextTick(() => {
|
|
@@ -7456,7 +7531,7 @@ Captured external output:
|
|
|
7456
7531
|
});
|
|
7457
7532
|
this.addExitListeners();
|
|
7458
7533
|
const stdinParserMaxBufferBytes = config.stdinParserMaxBufferBytes ?? DEFAULT_STDIN_PARSER_MAX_BUFFER_BYTES;
|
|
7459
|
-
this.stdinParser = new
|
|
7534
|
+
this.stdinParser = new StdinParser2({
|
|
7460
7535
|
timeoutMs: 20,
|
|
7461
7536
|
maxPendingBytes: stdinParserMaxBufferBytes,
|
|
7462
7537
|
armTimeouts: true,
|
|
@@ -7473,7 +7548,7 @@ Captured external output:
|
|
|
7473
7548
|
},
|
|
7474
7549
|
clock: this.clock
|
|
7475
7550
|
});
|
|
7476
|
-
this._console = new
|
|
7551
|
+
this._console = new TerminalConsole2(this, {
|
|
7477
7552
|
...config.consoleOptions ?? {},
|
|
7478
7553
|
clock: this.clock
|
|
7479
7554
|
});
|
|
@@ -7487,7 +7562,7 @@ Captured external output:
|
|
|
7487
7562
|
this._openConsoleOnError = config.openConsoleOnError ?? true;
|
|
7488
7563
|
this._onDestroy = config.onDestroy;
|
|
7489
7564
|
global.requestAnimationFrame = (callback) => {
|
|
7490
|
-
const id =
|
|
7565
|
+
const id = CliRenderer2.animationFrameId++;
|
|
7491
7566
|
this.animationRequest.set(id, callback);
|
|
7492
7567
|
this.requestLive();
|
|
7493
7568
|
return id;
|
|
@@ -7501,7 +7576,7 @@ Captured external output:
|
|
|
7501
7576
|
global.window = {};
|
|
7502
7577
|
}
|
|
7503
7578
|
global.window.requestAnimationFrame = requestAnimationFrame;
|
|
7504
|
-
if (
|
|
7579
|
+
if (env2.OTUI_NO_NATIVE_RENDER) {
|
|
7505
7580
|
this.renderNative = () => {
|
|
7506
7581
|
if (this._splitHeight > 0) {
|
|
7507
7582
|
this.flushStdoutCache(this._splitHeight);
|
|
@@ -7542,8 +7617,9 @@ Captured external output:
|
|
|
7542
7617
|
removeExitListeners() {
|
|
7543
7618
|
if (!this._exitListenersAdded || this.exitSignals.length === 0)
|
|
7544
7619
|
return;
|
|
7620
|
+
const processEvents = process;
|
|
7545
7621
|
this.exitSignals.forEach((signal) => {
|
|
7546
|
-
|
|
7622
|
+
processEvents.removeListener(signal, this.exitHandler);
|
|
7547
7623
|
});
|
|
7548
7624
|
this._exitListenersAdded = false;
|
|
7549
7625
|
}
|
|
@@ -7565,7 +7641,7 @@ Captured external output:
|
|
|
7565
7641
|
get currentFocusedEditor() {
|
|
7566
7642
|
if (!this._currentFocusedRenderable)
|
|
7567
7643
|
return null;
|
|
7568
|
-
if (!
|
|
7644
|
+
if (!isEditBufferRenderable2(this._currentFocusedRenderable))
|
|
7569
7645
|
return null;
|
|
7570
7646
|
return this._currentFocusedRenderable;
|
|
7571
7647
|
}
|
|
@@ -8059,8 +8135,8 @@ Captured external output:
|
|
|
8059
8135
|
enumerable: true,
|
|
8060
8136
|
configurable: true
|
|
8061
8137
|
});
|
|
8062
|
-
const internalRoot = new
|
|
8063
|
-
const publicRoot = new
|
|
8138
|
+
const internalRoot = new RootRenderable2(renderContext);
|
|
8139
|
+
const publicRoot = new BoxRenderable2(renderContext, {
|
|
8064
8140
|
id: `scrollback-surface-root-${surfaceId}`,
|
|
8065
8141
|
position: "absolute",
|
|
8066
8142
|
left: 0,
|
|
@@ -8083,12 +8159,16 @@ Captured external output:
|
|
|
8083
8159
|
let surfaceDestroyed = false;
|
|
8084
8160
|
let hasRendered = false;
|
|
8085
8161
|
let nextCommitStartOnNewLine = startOnNewLine;
|
|
8086
|
-
let backingBuffer =
|
|
8162
|
+
let backingBuffer = OptimizedBuffer2.create(surfaceWidth, surfaceHeight, surfaceWidthMethod, {
|
|
8087
8163
|
id: `scrollback-surface-buffer-${surfaceId}`
|
|
8088
8164
|
});
|
|
8089
8165
|
const destroyListener = () => {
|
|
8090
8166
|
destroySurface();
|
|
8091
8167
|
};
|
|
8168
|
+
const capabilitiesListener = (capabilities) => {
|
|
8169
|
+
snapshotContext.capabilities = capabilities;
|
|
8170
|
+
renderContext.emit("capabilities" /* CAPABILITIES */, capabilities);
|
|
8171
|
+
};
|
|
8092
8172
|
const assertNotDestroyed = () => {
|
|
8093
8173
|
if (surfaceDestroyed) {
|
|
8094
8174
|
throw new Error("ScrollbackSurface is destroyed");
|
|
@@ -8120,7 +8200,7 @@ Captured external output:
|
|
|
8120
8200
|
};
|
|
8121
8201
|
const collectPendingCodeRenderables = (node) => {
|
|
8122
8202
|
const pending = [];
|
|
8123
|
-
if (node instanceof
|
|
8203
|
+
if (node instanceof CodeRenderable2 && node.isHighlighting) {
|
|
8124
8204
|
pending.push(node);
|
|
8125
8205
|
}
|
|
8126
8206
|
for (const child of node.getChildren()) {
|
|
@@ -8177,7 +8257,7 @@ Captured external output:
|
|
|
8177
8257
|
let targetHeight = Math.max(1, surfaceHeight);
|
|
8178
8258
|
if (surfaceWidthMethod !== widthMethod) {
|
|
8179
8259
|
backingBuffer.destroy();
|
|
8180
|
-
backingBuffer =
|
|
8260
|
+
backingBuffer = OptimizedBuffer2.create(width, targetHeight, widthMethod, {
|
|
8181
8261
|
id: `scrollback-surface-buffer-${surfaceId}`
|
|
8182
8262
|
});
|
|
8183
8263
|
} else {
|
|
@@ -8237,7 +8317,7 @@ Captured external output:
|
|
|
8237
8317
|
return;
|
|
8238
8318
|
}
|
|
8239
8319
|
const rowCount = endRowExclusive - startRow;
|
|
8240
|
-
const commitBuffer =
|
|
8320
|
+
const commitBuffer = OptimizedBuffer2.create(surfaceWidth, rowCount, surfaceWidthMethod, {
|
|
8241
8321
|
id: `scrollback-surface-commit-${surfaceId}`
|
|
8242
8322
|
});
|
|
8243
8323
|
try {
|
|
@@ -8260,6 +8340,7 @@ Captured external output:
|
|
|
8260
8340
|
}
|
|
8261
8341
|
surfaceDestroyed = true;
|
|
8262
8342
|
renderer.off("destroy" /* DESTROY */, destroyListener);
|
|
8343
|
+
renderer.off("capabilities" /* CAPABILITIES */, capabilitiesListener);
|
|
8263
8344
|
let destroyError = null;
|
|
8264
8345
|
try {
|
|
8265
8346
|
internalRoot.destroyRecursively();
|
|
@@ -8280,6 +8361,7 @@ Captured external output:
|
|
|
8280
8361
|
}
|
|
8281
8362
|
};
|
|
8282
8363
|
renderer.on("destroy" /* DESTROY */, destroyListener);
|
|
8364
|
+
renderer.on("capabilities" /* CAPABILITIES */, capabilitiesListener);
|
|
8283
8365
|
return {
|
|
8284
8366
|
get renderContext() {
|
|
8285
8367
|
return renderContext;
|
|
@@ -8326,8 +8408,8 @@ Captured external output:
|
|
|
8326
8408
|
snapshotContext.width = snapshotWidth;
|
|
8327
8409
|
snapshotContext.height = snapshotHeight;
|
|
8328
8410
|
snapshotContext.widthMethod = this.widthMethod;
|
|
8329
|
-
snapshotRoot = new
|
|
8330
|
-
snapshotBuffer =
|
|
8411
|
+
snapshotRoot = new RootRenderable2(snapshotContext);
|
|
8412
|
+
snapshotBuffer = OptimizedBuffer2.create(snapshotWidth, snapshotHeight, this.widthMethod, {
|
|
8331
8413
|
id: "scrollback-snapshot-commit"
|
|
8332
8414
|
});
|
|
8333
8415
|
snapshotRoot.add(rootRenderable);
|
|
@@ -8486,8 +8568,8 @@ Captured external output:
|
|
|
8486
8568
|
const lineCells = [...line];
|
|
8487
8569
|
const rowColumns = Math.min(lineCells.length, maxWidth);
|
|
8488
8570
|
const renderedLine = lineCells.slice(0, maxWidth).join("");
|
|
8489
|
-
const snapshotRoot = new
|
|
8490
|
-
const snapshotRenderable = new
|
|
8571
|
+
const snapshotRoot = new RootRenderable2(snapshotContext);
|
|
8572
|
+
const snapshotRenderable = new TextRenderable2(snapshotContext, {
|
|
8491
8573
|
id: "captured-stdout-snapshot",
|
|
8492
8574
|
position: "absolute",
|
|
8493
8575
|
left: 0,
|
|
@@ -8496,7 +8578,7 @@ Captured external output:
|
|
|
8496
8578
|
height: 1,
|
|
8497
8579
|
content: renderedLine
|
|
8498
8580
|
});
|
|
8499
|
-
const snapshotBuffer =
|
|
8581
|
+
const snapshotBuffer = OptimizedBuffer2.create(Math.max(1, rowColumns), 1, this.widthMethod, {
|
|
8500
8582
|
id: "captured-stdout-snapshot"
|
|
8501
8583
|
});
|
|
8502
8584
|
try {
|
|
@@ -9169,7 +9251,7 @@ Captured external output:
|
|
|
9169
9251
|
this.startTerminalKeepAlive();
|
|
9170
9252
|
}
|
|
9171
9253
|
dispatchMouseEvent(target, attributes) {
|
|
9172
|
-
const event = new
|
|
9254
|
+
const event = new MouseEvent2(target, attributes);
|
|
9173
9255
|
this.sendMouseEvent(target, event);
|
|
9174
9256
|
if (this.autoFocus && event.type === "down" && event.button === 0 /* LEFT */ && !event.defaultPrevented) {
|
|
9175
9257
|
let current = target;
|
|
@@ -9206,27 +9288,27 @@ Captured external output:
|
|
|
9206
9288
|
if (this._console.visible) {
|
|
9207
9289
|
const consoleBounds = this._console.bounds;
|
|
9208
9290
|
if (mouseEvent.x >= consoleBounds.x && mouseEvent.x < consoleBounds.x + consoleBounds.width && mouseEvent.y >= consoleBounds.y && mouseEvent.y < consoleBounds.y + consoleBounds.height) {
|
|
9209
|
-
const
|
|
9210
|
-
const handled = this._console.handleMouse(
|
|
9291
|
+
const event = new MouseEvent2(null, mouseEvent);
|
|
9292
|
+
const handled = this._console.handleMouse(event);
|
|
9211
9293
|
if (handled)
|
|
9212
9294
|
return true;
|
|
9213
9295
|
}
|
|
9214
9296
|
}
|
|
9215
9297
|
if (mouseEvent.type === "scroll") {
|
|
9216
|
-
const
|
|
9217
|
-
const
|
|
9298
|
+
const maybeRenderableId = this.hitTest(mouseEvent.x, mouseEvent.y);
|
|
9299
|
+
const maybeRenderable = Renderable2.renderablesByNumber.get(maybeRenderableId);
|
|
9218
9300
|
const fallbackTarget = this._currentFocusedRenderable && !this._currentFocusedRenderable.isDestroyed && this._currentFocusedRenderable.focused ? this._currentFocusedRenderable : null;
|
|
9219
|
-
const scrollTarget =
|
|
9301
|
+
const scrollTarget = maybeRenderable ?? fallbackTarget;
|
|
9220
9302
|
if (scrollTarget) {
|
|
9221
|
-
const
|
|
9222
|
-
this.sendMouseEvent(scrollTarget,
|
|
9303
|
+
const event = new MouseEvent2(scrollTarget, mouseEvent);
|
|
9304
|
+
this.sendMouseEvent(scrollTarget, event);
|
|
9223
9305
|
}
|
|
9224
9306
|
return true;
|
|
9225
9307
|
}
|
|
9226
9308
|
const maybeRenderableId = this.hitTest(mouseEvent.x, mouseEvent.y);
|
|
9227
9309
|
const sameElement = maybeRenderableId === this.lastOverRenderableNum;
|
|
9228
9310
|
this.lastOverRenderableNum = maybeRenderableId;
|
|
9229
|
-
const maybeRenderable =
|
|
9311
|
+
const maybeRenderable = Renderable2.renderablesByNumber.get(maybeRenderableId);
|
|
9230
9312
|
if (mouseEvent.type === "down" && mouseEvent.button === 0 /* LEFT */ && !this.currentSelection?.isDragging && !mouseEvent.modifiers.ctrl) {
|
|
9231
9313
|
const canStartSelection = Boolean(maybeRenderable && maybeRenderable.selectable && !maybeRenderable.isDestroyed && maybeRenderable.shouldStartSelection(mouseEvent.x, mouseEvent.y));
|
|
9232
9314
|
if (canStartSelection && maybeRenderable) {
|
|
@@ -9238,21 +9320,21 @@ Captured external output:
|
|
|
9238
9320
|
if (mouseEvent.type === "drag" && this.currentSelection?.isDragging) {
|
|
9239
9321
|
this.updateSelection(maybeRenderable, mouseEvent.x, mouseEvent.y);
|
|
9240
9322
|
if (maybeRenderable) {
|
|
9241
|
-
const
|
|
9323
|
+
const event = new MouseEvent2(maybeRenderable, {
|
|
9242
9324
|
...mouseEvent,
|
|
9243
9325
|
isDragging: true
|
|
9244
9326
|
});
|
|
9245
|
-
this.sendMouseEvent(maybeRenderable,
|
|
9327
|
+
this.sendMouseEvent(maybeRenderable, event);
|
|
9246
9328
|
}
|
|
9247
9329
|
return true;
|
|
9248
9330
|
}
|
|
9249
9331
|
if (mouseEvent.type === "up" && mouseEvent.button === 0 /* LEFT */ && this.currentSelection?.isDragging) {
|
|
9250
9332
|
if (maybeRenderable) {
|
|
9251
|
-
const
|
|
9333
|
+
const event = new MouseEvent2(maybeRenderable, {
|
|
9252
9334
|
...mouseEvent,
|
|
9253
9335
|
isDragging: true
|
|
9254
9336
|
});
|
|
9255
|
-
this.sendMouseEvent(maybeRenderable,
|
|
9337
|
+
this.sendMouseEvent(maybeRenderable, event);
|
|
9256
9338
|
}
|
|
9257
9339
|
this.finishSelection();
|
|
9258
9340
|
return true;
|
|
@@ -9266,41 +9348,41 @@ Captured external output:
|
|
|
9266
9348
|
}
|
|
9267
9349
|
if (!sameElement && (mouseEvent.type === "drag" || mouseEvent.type === "move")) {
|
|
9268
9350
|
if (this.lastOverRenderable && this.lastOverRenderable !== this.capturedRenderable && !this.lastOverRenderable.isDestroyed) {
|
|
9269
|
-
const
|
|
9351
|
+
const event = new MouseEvent2(this.lastOverRenderable, {
|
|
9270
9352
|
...mouseEvent,
|
|
9271
9353
|
type: "out"
|
|
9272
9354
|
});
|
|
9273
|
-
this.sendMouseEvent(this.lastOverRenderable,
|
|
9355
|
+
this.sendMouseEvent(this.lastOverRenderable, event);
|
|
9274
9356
|
}
|
|
9275
9357
|
this.lastOverRenderable = maybeRenderable;
|
|
9276
9358
|
if (maybeRenderable) {
|
|
9277
|
-
const
|
|
9359
|
+
const event = new MouseEvent2(maybeRenderable, {
|
|
9278
9360
|
...mouseEvent,
|
|
9279
9361
|
type: "over",
|
|
9280
9362
|
source: this.capturedRenderable
|
|
9281
9363
|
});
|
|
9282
|
-
this.sendMouseEvent(maybeRenderable,
|
|
9364
|
+
this.sendMouseEvent(maybeRenderable, event);
|
|
9283
9365
|
}
|
|
9284
9366
|
}
|
|
9285
9367
|
if (this.capturedRenderable && mouseEvent.type !== "up") {
|
|
9286
|
-
const
|
|
9287
|
-
this.sendMouseEvent(this.capturedRenderable,
|
|
9368
|
+
const event = new MouseEvent2(this.capturedRenderable, mouseEvent);
|
|
9369
|
+
this.sendMouseEvent(this.capturedRenderable, event);
|
|
9288
9370
|
return true;
|
|
9289
9371
|
}
|
|
9290
9372
|
if (this.capturedRenderable && mouseEvent.type === "up") {
|
|
9291
|
-
const
|
|
9373
|
+
const event = new MouseEvent2(this.capturedRenderable, {
|
|
9292
9374
|
...mouseEvent,
|
|
9293
9375
|
type: "drag-end"
|
|
9294
9376
|
});
|
|
9295
|
-
this.sendMouseEvent(this.capturedRenderable,
|
|
9296
|
-
this.sendMouseEvent(this.capturedRenderable, new
|
|
9377
|
+
this.sendMouseEvent(this.capturedRenderable, event);
|
|
9378
|
+
this.sendMouseEvent(this.capturedRenderable, new MouseEvent2(this.capturedRenderable, mouseEvent));
|
|
9297
9379
|
if (maybeRenderable) {
|
|
9298
|
-
const
|
|
9380
|
+
const event = new MouseEvent2(maybeRenderable, {
|
|
9299
9381
|
...mouseEvent,
|
|
9300
9382
|
type: "drop",
|
|
9301
9383
|
source: this.capturedRenderable
|
|
9302
9384
|
});
|
|
9303
|
-
this.sendMouseEvent(maybeRenderable,
|
|
9385
|
+
this.sendMouseEvent(maybeRenderable, event);
|
|
9304
9386
|
}
|
|
9305
9387
|
this.lastOverRenderable = this.capturedRenderable;
|
|
9306
9388
|
this.lastOverRenderableNum = this.capturedRenderable.num;
|
|
@@ -9330,7 +9412,7 @@ Captured external output:
|
|
|
9330
9412
|
if (this.capturedRenderable)
|
|
9331
9413
|
return;
|
|
9332
9414
|
const hitId = this.hitTest(this._latestPointer.x, this._latestPointer.y);
|
|
9333
|
-
const hitRenderable =
|
|
9415
|
+
const hitRenderable = Renderable2.renderablesByNumber.get(hitId);
|
|
9334
9416
|
const lastOver = this.lastOverRenderable;
|
|
9335
9417
|
if (lastOver?.num === hitId) {
|
|
9336
9418
|
this.lastOverRenderableNum = hitId;
|
|
@@ -9344,13 +9426,13 @@ Captured external output:
|
|
|
9344
9426
|
modifiers: this._lastPointerModifiers
|
|
9345
9427
|
};
|
|
9346
9428
|
if (lastOver && !lastOver.isDestroyed) {
|
|
9347
|
-
const event = new
|
|
9429
|
+
const event = new MouseEvent2(lastOver, { ...baseEvent, type: "out" });
|
|
9348
9430
|
this.sendMouseEvent(lastOver, event);
|
|
9349
9431
|
}
|
|
9350
9432
|
this.lastOverRenderable = hitRenderable;
|
|
9351
9433
|
this.lastOverRenderableNum = hitId;
|
|
9352
9434
|
if (hitRenderable) {
|
|
9353
|
-
const event = new
|
|
9435
|
+
const event = new MouseEvent2(hitRenderable, {
|
|
9354
9436
|
...baseEvent,
|
|
9355
9437
|
type: "over"
|
|
9356
9438
|
});
|
|
@@ -9364,6 +9446,18 @@ Captured external output:
|
|
|
9364
9446
|
hitTest(x, y) {
|
|
9365
9447
|
return this.lib.checkHit(this.rendererPtr, x, y);
|
|
9366
9448
|
}
|
|
9449
|
+
getLinkIdAt(x, y) {
|
|
9450
|
+
if (this._isDestroyed || !Number.isInteger(x) || !Number.isInteger(y))
|
|
9451
|
+
return 0;
|
|
9452
|
+
const buffer = this.currentRenderBuffer;
|
|
9453
|
+
if (x < 0 || y < 0 || x >= buffer.width || y >= buffer.height)
|
|
9454
|
+
return 0;
|
|
9455
|
+
return getLinkId2(buffer.buffers.attributes[y * buffer.width + x]);
|
|
9456
|
+
}
|
|
9457
|
+
getLinkAt(x, y) {
|
|
9458
|
+
const linkId = this.getLinkIdAt(x, y);
|
|
9459
|
+
return linkId === 0 ? null : this.currentRenderBuffer.lib.linkGetUrl(linkId) || null;
|
|
9460
|
+
}
|
|
9367
9461
|
takeMemorySnapshot() {
|
|
9368
9462
|
if (this._isDestroyed)
|
|
9369
9463
|
return;
|
|
@@ -9444,7 +9538,7 @@ Captured external output:
|
|
|
9444
9538
|
if (splitFooterActive) {
|
|
9445
9539
|
let clearStart = null;
|
|
9446
9540
|
if (width < prevWidth && visiblePreviousSplitHeight > 0) {
|
|
9447
|
-
clearStart = Math.max(previousTerminalHeight - visiblePreviousSplitHeight * 2, 1);
|
|
9541
|
+
clearStart = Math.min(this.renderOffset + 1, Math.max(previousTerminalHeight - visiblePreviousSplitHeight * 2, 1));
|
|
9448
9542
|
}
|
|
9449
9543
|
if (pendingSplitFooterTransition !== null) {
|
|
9450
9544
|
clearStart = clearStart === null ? pendingSplitFooterTransition.sourceTopLine : Math.min(clearStart, pendingSplitFooterTransition.sourceTopLine);
|
|
@@ -9478,7 +9572,7 @@ Captured external output:
|
|
|
9478
9572
|
this.processResize(width, height);
|
|
9479
9573
|
}
|
|
9480
9574
|
setBackgroundColor(color) {
|
|
9481
|
-
const parsedColor =
|
|
9575
|
+
const parsedColor = parseColor2(color);
|
|
9482
9576
|
this.lib.setBackgroundColor(this.rendererPtr, parsedColor);
|
|
9483
9577
|
this.backgroundColor = parsedColor;
|
|
9484
9578
|
this.nextRenderBuffer.clear(parsedColor);
|
|
@@ -9531,18 +9625,18 @@ Captured external output:
|
|
|
9531
9625
|
this.lib.dumpOutputBuffer(this.rendererPtr, timestamp);
|
|
9532
9626
|
}
|
|
9533
9627
|
static setCursorPosition(renderer, x, y, visible = true) {
|
|
9534
|
-
const lib =
|
|
9628
|
+
const lib = resolveRenderLib2();
|
|
9535
9629
|
lib.setCursorPosition(renderer.rendererPtr, x, y, visible);
|
|
9536
9630
|
}
|
|
9537
9631
|
static setCursorStyle(renderer, options) {
|
|
9538
|
-
const lib =
|
|
9632
|
+
const lib = resolveRenderLib2();
|
|
9539
9633
|
lib.setCursorStyleOptions(renderer.rendererPtr, options);
|
|
9540
9634
|
if (options.cursor !== undefined) {
|
|
9541
9635
|
renderer._currentMousePointerStyle = options.cursor;
|
|
9542
9636
|
}
|
|
9543
9637
|
}
|
|
9544
9638
|
static setCursorColor(renderer, color) {
|
|
9545
|
-
const lib =
|
|
9639
|
+
const lib = resolveRenderLib2();
|
|
9546
9640
|
lib.setCursorColor(renderer.rendererPtr, color);
|
|
9547
9641
|
}
|
|
9548
9642
|
setCursorPosition(x, y, visible = true) {
|
|
@@ -9750,12 +9844,13 @@ Captured external output:
|
|
|
9750
9844
|
this.stdout.off("error", this.kittyOutputErrorHandler);
|
|
9751
9845
|
this.lib.cancelKittyImageTransport(this.rendererPtr, false);
|
|
9752
9846
|
}
|
|
9847
|
+
const processEvents = process;
|
|
9753
9848
|
if (this._usesProcessStdout) {
|
|
9754
|
-
|
|
9849
|
+
processEvents.removeListener("SIGWINCH", this.sigwinchHandler);
|
|
9755
9850
|
}
|
|
9756
|
-
|
|
9757
|
-
|
|
9758
|
-
|
|
9851
|
+
processEvents.removeListener("uncaughtException", this.handleError);
|
|
9852
|
+
processEvents.removeListener("unhandledRejection", this.handleError);
|
|
9853
|
+
processEvents.removeListener("warning", this.warningHandler);
|
|
9759
9854
|
this.removeExitListeners();
|
|
9760
9855
|
if (this.resizeTimeoutId !== null) {
|
|
9761
9856
|
this.clock.clearTimeout(this.resizeTimeoutId);
|
|
@@ -9873,7 +9968,7 @@ Captured external output:
|
|
|
9873
9968
|
}
|
|
9874
9969
|
rendererTracker.renderers.delete(this);
|
|
9875
9970
|
if (rendererTracker.renderers.size === 0) {
|
|
9876
|
-
|
|
9971
|
+
destroyTreeSitterClient2().catch((error) => {
|
|
9877
9972
|
console.error("Failed to destroy tree-sitter client:", error);
|
|
9878
9973
|
});
|
|
9879
9974
|
}
|
|
@@ -10151,7 +10246,7 @@ Captured external output:
|
|
|
10151
10246
|
return;
|
|
10152
10247
|
this.clearSelectionState();
|
|
10153
10248
|
this.selectionContainers.push(renderable.parent || this.root);
|
|
10154
|
-
this.currentSelection = new
|
|
10249
|
+
this.currentSelection = new Selection2(renderable, { x, y }, { x, y }, behavior);
|
|
10155
10250
|
this.currentSelection.isStart = true;
|
|
10156
10251
|
this.notifySelectablesOfSelectionChange();
|
|
10157
10252
|
}
|
|
@@ -10193,7 +10288,7 @@ Captured external output:
|
|
|
10193
10288
|
if (this.currentSelection?.isDragging) {
|
|
10194
10289
|
const pointer = this._latestPointer;
|
|
10195
10290
|
const maybeRenderableId = this.hitTest(pointer.x, pointer.y);
|
|
10196
|
-
const maybeRenderable =
|
|
10291
|
+
const maybeRenderable = Renderable2.renderablesByNumber.get(maybeRenderableId);
|
|
10197
10292
|
this.updateSelection(maybeRenderable, pointer.x, pointer.y);
|
|
10198
10293
|
}
|
|
10199
10294
|
}
|
|
@@ -10274,7 +10369,7 @@ Captured external output:
|
|
|
10274
10369
|
if (!this._paletteDetector) {
|
|
10275
10370
|
const isTmux = Boolean(this.capabilities?.multiplexer === "tmux" || this.capabilities?.terminal?.name?.toLowerCase()?.includes("tmux"));
|
|
10276
10371
|
const isLegacyTmux = this.capabilities?.terminal?.name?.toLowerCase()?.includes("tmux") && this.capabilities?.terminal?.version?.localeCompare("3.6") < 0;
|
|
10277
|
-
this._paletteDetector =
|
|
10372
|
+
this._paletteDetector = createTerminalPalette2({
|
|
10278
10373
|
stdin: this.stdin,
|
|
10279
10374
|
stdout: this.stdout,
|
|
10280
10375
|
writeFn: (data) => this._isDestroyed ? false : this.writeOut(data),
|
|
@@ -10289,18 +10384,18 @@ Captured external output:
|
|
|
10289
10384
|
return this._paletteDetector;
|
|
10290
10385
|
}
|
|
10291
10386
|
syncNativePaletteState(colors) {
|
|
10292
|
-
const signature =
|
|
10387
|
+
const signature = buildTerminalPaletteSignature2(colors);
|
|
10293
10388
|
if (this._nativePaletteSignature !== signature) {
|
|
10294
10389
|
this._paletteEpoch = this._paletteEpoch + 1 >>> 0;
|
|
10295
10390
|
}
|
|
10296
10391
|
this._nativePaletteSignature = signature;
|
|
10297
|
-
const normalized =
|
|
10392
|
+
const normalized = normalizeTerminalPalette2(colors);
|
|
10298
10393
|
this.lib.rendererSetPaletteState(this.rendererPtr, normalized.palette, normalized.defaultForeground, normalized.defaultBackground, this._paletteEpoch);
|
|
10299
10394
|
}
|
|
10300
10395
|
emitPaletteChange(colors) {
|
|
10301
10396
|
if (this.listenerCount("palette" /* PALETTE */) === 0)
|
|
10302
10397
|
return;
|
|
10303
|
-
const signature =
|
|
10398
|
+
const signature = buildTerminalPaletteSignature2(colors);
|
|
10304
10399
|
if (this._emittedPaletteSignature === signature)
|
|
10305
10400
|
return;
|
|
10306
10401
|
this._emittedPaletteSignature = signature;
|
|
@@ -10406,7 +10501,7 @@ Captured external output:
|
|
|
10406
10501
|
}
|
|
10407
10502
|
}
|
|
10408
10503
|
|
|
10409
|
-
export {
|
|
10504
|
+
export { convertThemeToStyles2, SyntaxStyle2, h2, isVNode2, maybeMakeRenderable2, wrapWithDelegates2, instantiate2, delegate2, LayoutEvents2, RenderableEvents2, isRenderable2, BaseRenderable2, Renderable2, RootRenderable2, TextBufferView2, EditBuffer2, EditorView2, ANSI, BoxRenderable2, TextBufferRenderable2, CodeRenderable2, isTextNodeRenderable2, TextNodeRenderable2, RootTextNodeRenderable2, TextRenderable2, NativeSpanFeed2, defaultKeyAliases, mergeKeyAliases, mergeKeyBindings, getKeyBindingAction, buildKeyBindingsMap, capture2, ConsolePosition2, TerminalConsole2, getObjectsInViewport, EditBufferRenderableEvents2, isEditBufferRenderable2, EditBufferRenderable2, buildKittyKeyboardFlags2, MouseEvent2, MouseButton2, createCliRenderer2, CliRenderEvents2, RendererControlState2, CliRenderer2 };
|
|
10410
10505
|
|
|
10411
|
-
//# debugId=
|
|
10412
|
-
//# sourceMappingURL=chunk-bun-
|
|
10506
|
+
//# debugId=445D1A23AA42892B64756E2164756E21
|
|
10507
|
+
//# sourceMappingURL=chunk-bun-91mz470w.js.map
|