@opentui/core 0.1.35 → 0.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/3d.js +1 -1
- package/Renderable.d.ts +1 -3
- package/assets/zig/highlights.scm +284 -0
- package/assets/zig/tree-sitter-zig.wasm +0 -0
- package/console.d.ts +2 -2
- package/{index-n8nbvvhk.js → index-7bav3fax.js} +386 -101
- package/{index-n8nbvvhk.js.map → index-7bav3fax.js.map} +8 -7
- package/index.js +48 -20
- package/index.js.map +4 -4
- package/lib/index.d.ts +1 -0
- package/lib/terminal-palette.d.ts +38 -0
- package/package.json +7 -7
- package/renderables/ScrollBox.d.ts +2 -1
- package/renderer.d.ts +13 -0
- package/testing.js +1 -1
package/index.js
CHANGED
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
StdinBuffer,
|
|
34
34
|
StyledText,
|
|
35
35
|
TerminalConsole,
|
|
36
|
+
TerminalPalette,
|
|
36
37
|
TextAttributes,
|
|
37
38
|
TextBuffer,
|
|
38
39
|
TreeSitterClient,
|
|
@@ -65,6 +66,7 @@ import {
|
|
|
65
66
|
coordinateToCharacterIndex,
|
|
66
67
|
createCliRenderer,
|
|
67
68
|
createExtmarksController,
|
|
69
|
+
createTerminalPalette,
|
|
68
70
|
createTextAttributes,
|
|
69
71
|
cyan,
|
|
70
72
|
delegate,
|
|
@@ -134,7 +136,7 @@ import {
|
|
|
134
136
|
white,
|
|
135
137
|
wrapWithDelegates,
|
|
136
138
|
yellow
|
|
137
|
-
} from "./index-
|
|
139
|
+
} from "./index-7bav3fax.js";
|
|
138
140
|
// src/text-buffer-view.ts
|
|
139
141
|
class TextBufferView {
|
|
140
142
|
lib;
|
|
@@ -2774,20 +2776,27 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
2774
2776
|
this._hadInitialContent = true;
|
|
2775
2777
|
}
|
|
2776
2778
|
const shouldDrawUnstyledNow = this._streaming ? isInitialContent && this._drawUnstyledText : this._drawUnstyledText;
|
|
2777
|
-
this.fallback(content);
|
|
2778
2779
|
if (!shouldDrawUnstyledNow) {
|
|
2779
2780
|
this._shouldRenderTextBuffer = false;
|
|
2780
|
-
}
|
|
2781
|
-
if (this._streaming && !isInitialContent && this._lastHighlights.length > 0) {
|
|
2782
|
-
const chunks = treeSitterToTextChunks(content, this._lastHighlights, this._syntaxStyle, {
|
|
2783
|
-
enabled: this._conceal
|
|
2784
|
-
});
|
|
2785
|
-
const partialStyledText = new StyledText(chunks);
|
|
2786
|
-
if (this.isDestroyed)
|
|
2787
|
-
return;
|
|
2788
|
-
this.textBuffer.setStyledText(partialStyledText);
|
|
2781
|
+
} else {
|
|
2789
2782
|
this._shouldRenderTextBuffer = true;
|
|
2790
|
-
this.
|
|
2783
|
+
this.fallback(content);
|
|
2784
|
+
}
|
|
2785
|
+
if (this._streaming && !isInitialContent) {
|
|
2786
|
+
if (this._lastHighlights.length > 0) {
|
|
2787
|
+
const chunks = treeSitterToTextChunks(content, this._lastHighlights, this._syntaxStyle, {
|
|
2788
|
+
enabled: this._conceal
|
|
2789
|
+
});
|
|
2790
|
+
const partialStyledText = new StyledText(chunks);
|
|
2791
|
+
if (this.isDestroyed)
|
|
2792
|
+
return;
|
|
2793
|
+
this.textBuffer.setStyledText(partialStyledText);
|
|
2794
|
+
this._shouldRenderTextBuffer = true;
|
|
2795
|
+
this.updateTextInfo();
|
|
2796
|
+
} else {
|
|
2797
|
+
this.fallback(content);
|
|
2798
|
+
this._shouldRenderTextBuffer = true;
|
|
2799
|
+
}
|
|
2791
2800
|
}
|
|
2792
2801
|
this._isHighlighting = true;
|
|
2793
2802
|
this._pendingRehighlight = false;
|
|
@@ -4044,11 +4053,11 @@ class ContentRenderable extends BoxRenderable {
|
|
|
4044
4053
|
set viewportCulling(value) {
|
|
4045
4054
|
this._viewportCulling = value;
|
|
4046
4055
|
}
|
|
4047
|
-
|
|
4056
|
+
_getVisibleChildren() {
|
|
4048
4057
|
if (this._viewportCulling) {
|
|
4049
|
-
return getObjectsInViewport(this.viewport, this.getChildrenSortedByPrimaryAxis(), this.primaryAxis);
|
|
4058
|
+
return getObjectsInViewport(this.viewport, this.getChildrenSortedByPrimaryAxis(), this.primaryAxis).map((child) => child.num);
|
|
4050
4059
|
}
|
|
4051
|
-
return this.getChildrenSortedByPrimaryAxis();
|
|
4060
|
+
return this.getChildrenSortedByPrimaryAxis().map((child) => child.num);
|
|
4052
4061
|
}
|
|
4053
4062
|
}
|
|
4054
4063
|
|
|
@@ -4080,6 +4089,7 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
4080
4089
|
_stickyScrollRight = false;
|
|
4081
4090
|
_stickyStart;
|
|
4082
4091
|
_hasManualScroll = false;
|
|
4092
|
+
_isApplyingStickyScroll = false;
|
|
4083
4093
|
scrollAccel;
|
|
4084
4094
|
get stickyScroll() {
|
|
4085
4095
|
return this._stickyScroll;
|
|
@@ -4100,7 +4110,9 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
4100
4110
|
}
|
|
4101
4111
|
set scrollTop(value) {
|
|
4102
4112
|
this.verticalScrollBar.scrollPosition = value;
|
|
4103
|
-
this.
|
|
4113
|
+
if (!this._isApplyingStickyScroll) {
|
|
4114
|
+
this._hasManualScroll = true;
|
|
4115
|
+
}
|
|
4104
4116
|
this.updateStickyState();
|
|
4105
4117
|
}
|
|
4106
4118
|
get scrollLeft() {
|
|
@@ -4108,7 +4120,9 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
4108
4120
|
}
|
|
4109
4121
|
set scrollLeft(value) {
|
|
4110
4122
|
this.horizontalScrollBar.scrollPosition = value;
|
|
4111
|
-
this.
|
|
4123
|
+
if (!this._isApplyingStickyScroll) {
|
|
4124
|
+
this._hasManualScroll = true;
|
|
4125
|
+
}
|
|
4112
4126
|
this.updateStickyState();
|
|
4113
4127
|
}
|
|
4114
4128
|
get scrollWidth() {
|
|
@@ -4122,6 +4136,9 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
4122
4136
|
return;
|
|
4123
4137
|
const maxScrollTop = Math.max(0, this.scrollHeight - this.viewport.height);
|
|
4124
4138
|
const maxScrollLeft = Math.max(0, this.scrollWidth - this.viewport.width);
|
|
4139
|
+
if (this._hasManualScroll && this._stickyStart) {
|
|
4140
|
+
return;
|
|
4141
|
+
}
|
|
4125
4142
|
if (this.scrollTop <= 0) {
|
|
4126
4143
|
this._stickyScrollTop = true;
|
|
4127
4144
|
this._stickyScrollBottom = false;
|
|
@@ -4144,6 +4161,7 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
4144
4161
|
}
|
|
4145
4162
|
}
|
|
4146
4163
|
applyStickyStart(stickyStart) {
|
|
4164
|
+
this._isApplyingStickyScroll = true;
|
|
4147
4165
|
switch (stickyStart) {
|
|
4148
4166
|
case "top":
|
|
4149
4167
|
this._stickyScrollTop = true;
|
|
@@ -4166,6 +4184,7 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
4166
4184
|
this.horizontalScrollBar.scrollPosition = Math.max(0, this.scrollWidth - this.viewport.width);
|
|
4167
4185
|
break;
|
|
4168
4186
|
}
|
|
4187
|
+
this._isApplyingStickyScroll = false;
|
|
4169
4188
|
}
|
|
4170
4189
|
constructor(ctx, {
|
|
4171
4190
|
wrapperOptions,
|
|
@@ -4239,7 +4258,9 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
4239
4258
|
orientation: "vertical",
|
|
4240
4259
|
onChange: (position) => {
|
|
4241
4260
|
this.content.translateY = -position;
|
|
4242
|
-
this.
|
|
4261
|
+
if (!this._isApplyingStickyScroll) {
|
|
4262
|
+
this._hasManualScroll = true;
|
|
4263
|
+
}
|
|
4243
4264
|
this.updateStickyState();
|
|
4244
4265
|
}
|
|
4245
4266
|
});
|
|
@@ -4255,7 +4276,9 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
4255
4276
|
orientation: "horizontal",
|
|
4256
4277
|
onChange: (position) => {
|
|
4257
4278
|
this.content.translateX = -position;
|
|
4258
|
-
this.
|
|
4279
|
+
if (!this._isApplyingStickyScroll) {
|
|
4280
|
+
this._hasManualScroll = true;
|
|
4281
|
+
}
|
|
4259
4282
|
this.updateStickyState();
|
|
4260
4283
|
}
|
|
4261
4284
|
});
|
|
@@ -4449,6 +4472,8 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
4449
4472
|
}
|
|
4450
4473
|
}
|
|
4451
4474
|
recalculateBarProps() {
|
|
4475
|
+
const wasApplyingStickyScroll = this._isApplyingStickyScroll;
|
|
4476
|
+
this._isApplyingStickyScroll = true;
|
|
4452
4477
|
this.verticalScrollBar.scrollSize = this.content.height;
|
|
4453
4478
|
this.verticalScrollBar.viewportSize = this.viewport.height;
|
|
4454
4479
|
this.horizontalScrollBar.scrollSize = this.content.width;
|
|
@@ -4471,6 +4496,7 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
4471
4496
|
}
|
|
4472
4497
|
}
|
|
4473
4498
|
}
|
|
4499
|
+
this._isApplyingStickyScroll = wasApplyingStickyScroll;
|
|
4474
4500
|
process.nextTick(() => {
|
|
4475
4501
|
this.requestRender();
|
|
4476
4502
|
});
|
|
@@ -6222,6 +6248,7 @@ export {
|
|
|
6222
6248
|
cyan,
|
|
6223
6249
|
createTimeline,
|
|
6224
6250
|
createTextAttributes,
|
|
6251
|
+
createTerminalPalette,
|
|
6225
6252
|
createExtmarksController,
|
|
6226
6253
|
createCliRenderer,
|
|
6227
6254
|
coordinateToCharacterIndex,
|
|
@@ -6272,6 +6299,7 @@ export {
|
|
|
6272
6299
|
TextBuffer,
|
|
6273
6300
|
TextAttributes,
|
|
6274
6301
|
Text,
|
|
6302
|
+
TerminalPalette,
|
|
6275
6303
|
TerminalConsole,
|
|
6276
6304
|
TabSelectRenderableEvents,
|
|
6277
6305
|
TabSelectRenderable,
|
|
@@ -6334,5 +6362,5 @@ export {
|
|
|
6334
6362
|
ASCIIFont
|
|
6335
6363
|
};
|
|
6336
6364
|
|
|
6337
|
-
//# debugId=
|
|
6365
|
+
//# debugId=1E654B6F0692B62564756E2164756E21
|
|
6338
6366
|
//# sourceMappingURL=index.js.map
|