@opentui/core 0.1.79 → 0.1.81
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/NativeSpanFeed.d.ts +41 -0
- package/README.md +5 -2
- package/{index-zrvzvh6r.js → index-ve2seej0.js} +519 -209
- package/{index-zrvzvh6r.js.map → index-ve2seej0.js.map} +8 -8
- package/index.d.ts +1 -0
- package/index.js +367 -58
- package/index.js.map +10 -9
- package/lib/parse.mouse.d.ts +7 -0
- package/package.json +9 -9
- package/renderables/Diff.d.ts +7 -0
- package/renderables/LineNumberRenderable.d.ts +2 -0
- package/renderables/Textarea.d.ts +1 -1
- package/renderer.d.ts +6 -3
- package/testing.js +1 -1
- package/types.d.ts +7 -3
- package/zig-structs.d.ts +79 -0
- package/zig.d.ts +20 -2
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
RendererControlState,
|
|
34
34
|
RootRenderable,
|
|
35
35
|
Selection,
|
|
36
|
+
SpanInfoStruct,
|
|
36
37
|
StdinBuffer,
|
|
37
38
|
StyledText,
|
|
38
39
|
TerminalConsole,
|
|
@@ -152,7 +153,7 @@ import {
|
|
|
152
153
|
white,
|
|
153
154
|
wrapWithDelegates,
|
|
154
155
|
yellow
|
|
155
|
-
} from "./index-
|
|
156
|
+
} from "./index-ve2seej0.js";
|
|
156
157
|
// src/text-buffer-view.ts
|
|
157
158
|
class TextBufferView {
|
|
158
159
|
lib;
|
|
@@ -2064,6 +2065,266 @@ function createTimeline(options = {}) {
|
|
|
2064
2065
|
engine.register(timeline);
|
|
2065
2066
|
return timeline;
|
|
2066
2067
|
}
|
|
2068
|
+
// src/NativeSpanFeed.ts
|
|
2069
|
+
import { toArrayBuffer } from "bun:ffi";
|
|
2070
|
+
function toPointer(value) {
|
|
2071
|
+
if (typeof value === "bigint") {
|
|
2072
|
+
if (value > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
2073
|
+
throw new Error("Pointer exceeds safe integer range");
|
|
2074
|
+
}
|
|
2075
|
+
return Number(value);
|
|
2076
|
+
}
|
|
2077
|
+
return value;
|
|
2078
|
+
}
|
|
2079
|
+
function toNumber(value) {
|
|
2080
|
+
return typeof value === "bigint" ? Number(value) : value;
|
|
2081
|
+
}
|
|
2082
|
+
|
|
2083
|
+
class NativeSpanFeed {
|
|
2084
|
+
static create(options) {
|
|
2085
|
+
const lib = resolveRenderLib();
|
|
2086
|
+
const streamPtr = lib.createNativeSpanFeed(options);
|
|
2087
|
+
const stream = new NativeSpanFeed(streamPtr);
|
|
2088
|
+
lib.registerNativeSpanFeedStream(streamPtr, stream.eventHandler);
|
|
2089
|
+
const status = lib.attachNativeSpanFeed(streamPtr);
|
|
2090
|
+
if (status !== 0) {
|
|
2091
|
+
lib.unregisterNativeSpanFeedStream(streamPtr);
|
|
2092
|
+
lib.destroyNativeSpanFeed(streamPtr);
|
|
2093
|
+
throw new Error(`Failed to attach stream: ${status}`);
|
|
2094
|
+
}
|
|
2095
|
+
return stream;
|
|
2096
|
+
}
|
|
2097
|
+
static attach(streamPtr, _options) {
|
|
2098
|
+
const lib = resolveRenderLib();
|
|
2099
|
+
const ptr = toPointer(streamPtr);
|
|
2100
|
+
const stream = new NativeSpanFeed(ptr);
|
|
2101
|
+
lib.registerNativeSpanFeedStream(ptr, stream.eventHandler);
|
|
2102
|
+
const status = lib.attachNativeSpanFeed(ptr);
|
|
2103
|
+
if (status !== 0) {
|
|
2104
|
+
lib.unregisterNativeSpanFeedStream(ptr);
|
|
2105
|
+
throw new Error(`Failed to attach stream: ${status}`);
|
|
2106
|
+
}
|
|
2107
|
+
return stream;
|
|
2108
|
+
}
|
|
2109
|
+
streamPtr;
|
|
2110
|
+
lib = resolveRenderLib();
|
|
2111
|
+
eventHandler;
|
|
2112
|
+
chunkMap = new Map;
|
|
2113
|
+
chunkSizes = new Map;
|
|
2114
|
+
dataHandlers = new Set;
|
|
2115
|
+
errorHandlers = new Set;
|
|
2116
|
+
drainBuffer = null;
|
|
2117
|
+
stateBuffer = null;
|
|
2118
|
+
closed = false;
|
|
2119
|
+
destroyed = false;
|
|
2120
|
+
draining = false;
|
|
2121
|
+
pendingDataAvailable = false;
|
|
2122
|
+
pendingClose = false;
|
|
2123
|
+
closing = false;
|
|
2124
|
+
pendingAsyncHandlers = 0;
|
|
2125
|
+
inCallback = false;
|
|
2126
|
+
closeQueued = false;
|
|
2127
|
+
constructor(streamPtr) {
|
|
2128
|
+
this.streamPtr = streamPtr;
|
|
2129
|
+
this.eventHandler = (eventId, arg0, arg1) => {
|
|
2130
|
+
this.handleEvent(eventId, arg0, arg1);
|
|
2131
|
+
};
|
|
2132
|
+
this.ensureDrainBuffer();
|
|
2133
|
+
}
|
|
2134
|
+
ensureDrainBuffer() {
|
|
2135
|
+
if (this.drainBuffer)
|
|
2136
|
+
return;
|
|
2137
|
+
const capacity = 256;
|
|
2138
|
+
this.drainBuffer = new Uint8Array(capacity * SpanInfoStruct.size);
|
|
2139
|
+
}
|
|
2140
|
+
onData(handler) {
|
|
2141
|
+
this.dataHandlers.add(handler);
|
|
2142
|
+
if (this.pendingDataAvailable) {
|
|
2143
|
+
this.pendingDataAvailable = false;
|
|
2144
|
+
this.drainAll();
|
|
2145
|
+
}
|
|
2146
|
+
return () => this.dataHandlers.delete(handler);
|
|
2147
|
+
}
|
|
2148
|
+
onError(handler) {
|
|
2149
|
+
this.errorHandlers.add(handler);
|
|
2150
|
+
return () => this.errorHandlers.delete(handler);
|
|
2151
|
+
}
|
|
2152
|
+
close() {
|
|
2153
|
+
if (this.destroyed)
|
|
2154
|
+
return;
|
|
2155
|
+
if (this.inCallback || this.draining || this.pendingAsyncHandlers > 0) {
|
|
2156
|
+
this.pendingClose = true;
|
|
2157
|
+
if (!this.closeQueued) {
|
|
2158
|
+
this.closeQueued = true;
|
|
2159
|
+
queueMicrotask(() => {
|
|
2160
|
+
this.closeQueued = false;
|
|
2161
|
+
this.processPendingClose();
|
|
2162
|
+
});
|
|
2163
|
+
}
|
|
2164
|
+
return;
|
|
2165
|
+
}
|
|
2166
|
+
this.performClose();
|
|
2167
|
+
}
|
|
2168
|
+
processPendingClose() {
|
|
2169
|
+
if (!this.pendingClose || this.destroyed)
|
|
2170
|
+
return;
|
|
2171
|
+
if (this.inCallback || this.draining || this.pendingAsyncHandlers > 0)
|
|
2172
|
+
return;
|
|
2173
|
+
this.pendingClose = false;
|
|
2174
|
+
this.performClose();
|
|
2175
|
+
}
|
|
2176
|
+
performClose() {
|
|
2177
|
+
if (this.closing)
|
|
2178
|
+
return;
|
|
2179
|
+
this.closing = true;
|
|
2180
|
+
if (!this.closed) {
|
|
2181
|
+
const status = this.lib.streamClose(this.streamPtr);
|
|
2182
|
+
if (status !== 0) {
|
|
2183
|
+
this.closing = false;
|
|
2184
|
+
return;
|
|
2185
|
+
}
|
|
2186
|
+
this.closed = true;
|
|
2187
|
+
}
|
|
2188
|
+
this.finalizeDestroy();
|
|
2189
|
+
}
|
|
2190
|
+
finalizeDestroy() {
|
|
2191
|
+
if (this.destroyed)
|
|
2192
|
+
return;
|
|
2193
|
+
this.lib.unregisterNativeSpanFeedStream(this.streamPtr);
|
|
2194
|
+
this.lib.destroyNativeSpanFeed(this.streamPtr);
|
|
2195
|
+
this.destroyed = true;
|
|
2196
|
+
this.chunkMap.clear();
|
|
2197
|
+
this.chunkSizes.clear();
|
|
2198
|
+
this.stateBuffer = null;
|
|
2199
|
+
this.drainBuffer = null;
|
|
2200
|
+
this.dataHandlers.clear();
|
|
2201
|
+
this.errorHandlers.clear();
|
|
2202
|
+
this.pendingDataAvailable = false;
|
|
2203
|
+
}
|
|
2204
|
+
handleEvent(eventId, arg0, arg1) {
|
|
2205
|
+
this.inCallback = true;
|
|
2206
|
+
try {
|
|
2207
|
+
switch (eventId) {
|
|
2208
|
+
case 8 /* StateBuffer */: {
|
|
2209
|
+
const len = toNumber(arg1);
|
|
2210
|
+
if (len > 0 && arg0) {
|
|
2211
|
+
const buffer = toArrayBuffer(arg0, 0, len);
|
|
2212
|
+
this.stateBuffer = new Uint8Array(buffer);
|
|
2213
|
+
}
|
|
2214
|
+
break;
|
|
2215
|
+
}
|
|
2216
|
+
case 7 /* DataAvailable */: {
|
|
2217
|
+
if (this.closing)
|
|
2218
|
+
break;
|
|
2219
|
+
if (this.dataHandlers.size === 0) {
|
|
2220
|
+
this.pendingDataAvailable = true;
|
|
2221
|
+
break;
|
|
2222
|
+
}
|
|
2223
|
+
this.drainAll();
|
|
2224
|
+
break;
|
|
2225
|
+
}
|
|
2226
|
+
case 2 /* ChunkAdded */: {
|
|
2227
|
+
const chunkLen = toNumber(arg1);
|
|
2228
|
+
if (chunkLen > 0 && arg0) {
|
|
2229
|
+
if (!this.chunkMap.has(arg0)) {
|
|
2230
|
+
const buffer = toArrayBuffer(arg0, 0, chunkLen);
|
|
2231
|
+
this.chunkMap.set(arg0, buffer);
|
|
2232
|
+
}
|
|
2233
|
+
this.chunkSizes.set(arg0, chunkLen);
|
|
2234
|
+
}
|
|
2235
|
+
break;
|
|
2236
|
+
}
|
|
2237
|
+
case 6 /* Error */: {
|
|
2238
|
+
const code = arg0;
|
|
2239
|
+
for (const handler of this.errorHandlers)
|
|
2240
|
+
handler(code);
|
|
2241
|
+
break;
|
|
2242
|
+
}
|
|
2243
|
+
case 5 /* Closed */: {
|
|
2244
|
+
this.closed = true;
|
|
2245
|
+
break;
|
|
2246
|
+
}
|
|
2247
|
+
default:
|
|
2248
|
+
break;
|
|
2249
|
+
}
|
|
2250
|
+
} finally {
|
|
2251
|
+
this.inCallback = false;
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
decrementRefcount(chunkIndex) {
|
|
2255
|
+
if (this.stateBuffer && chunkIndex < this.stateBuffer.length) {
|
|
2256
|
+
const prev = this.stateBuffer[chunkIndex];
|
|
2257
|
+
this.stateBuffer[chunkIndex] = prev > 0 ? prev - 1 : 0;
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
drainOnce() {
|
|
2261
|
+
if (!this.drainBuffer || this.draining || this.pendingClose)
|
|
2262
|
+
return 0;
|
|
2263
|
+
const capacity = Math.floor(this.drainBuffer.byteLength / SpanInfoStruct.size);
|
|
2264
|
+
if (capacity === 0)
|
|
2265
|
+
return 0;
|
|
2266
|
+
const count = this.lib.streamDrainSpans(this.streamPtr, this.drainBuffer, capacity);
|
|
2267
|
+
if (count === 0)
|
|
2268
|
+
return 0;
|
|
2269
|
+
this.draining = true;
|
|
2270
|
+
const spans = SpanInfoStruct.unpackList(this.drainBuffer.buffer, count);
|
|
2271
|
+
let firstError = null;
|
|
2272
|
+
try {
|
|
2273
|
+
for (const span of spans) {
|
|
2274
|
+
if (span.len === 0)
|
|
2275
|
+
continue;
|
|
2276
|
+
let buffer = this.chunkMap.get(span.chunkPtr);
|
|
2277
|
+
if (!buffer) {
|
|
2278
|
+
const size = this.chunkSizes.get(span.chunkPtr);
|
|
2279
|
+
if (!size)
|
|
2280
|
+
continue;
|
|
2281
|
+
buffer = toArrayBuffer(span.chunkPtr, 0, size);
|
|
2282
|
+
this.chunkMap.set(span.chunkPtr, buffer);
|
|
2283
|
+
}
|
|
2284
|
+
if (span.offset + span.len > buffer.byteLength)
|
|
2285
|
+
continue;
|
|
2286
|
+
const slice = new Uint8Array(buffer, span.offset, span.len);
|
|
2287
|
+
let asyncResults = null;
|
|
2288
|
+
for (const handler of this.dataHandlers) {
|
|
2289
|
+
try {
|
|
2290
|
+
const result = handler(slice);
|
|
2291
|
+
if (result && typeof result.then === "function") {
|
|
2292
|
+
asyncResults ??= [];
|
|
2293
|
+
asyncResults.push(result);
|
|
2294
|
+
}
|
|
2295
|
+
} catch (e) {
|
|
2296
|
+
firstError ??= e;
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
const shouldStopAfterThisSpan = this.pendingClose;
|
|
2300
|
+
if (asyncResults) {
|
|
2301
|
+
const chunkIndex = span.chunkIndex;
|
|
2302
|
+
this.pendingAsyncHandlers += 1;
|
|
2303
|
+
Promise.allSettled(asyncResults).then(() => {
|
|
2304
|
+
this.decrementRefcount(chunkIndex);
|
|
2305
|
+
this.pendingAsyncHandlers -= 1;
|
|
2306
|
+
this.processPendingClose();
|
|
2307
|
+
});
|
|
2308
|
+
} else {
|
|
2309
|
+
this.decrementRefcount(span.chunkIndex);
|
|
2310
|
+
}
|
|
2311
|
+
if (shouldStopAfterThisSpan)
|
|
2312
|
+
break;
|
|
2313
|
+
}
|
|
2314
|
+
} finally {
|
|
2315
|
+
this.draining = false;
|
|
2316
|
+
}
|
|
2317
|
+
if (firstError)
|
|
2318
|
+
throw firstError;
|
|
2319
|
+
return count;
|
|
2320
|
+
}
|
|
2321
|
+
drainAll() {
|
|
2322
|
+
let count = this.drainOnce();
|
|
2323
|
+
while (count > 0) {
|
|
2324
|
+
count = this.drainOnce();
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2067
2328
|
// src/renderables/FrameBuffer.ts
|
|
2068
2329
|
class FrameBufferRenderable extends Renderable {
|
|
2069
2330
|
frameBuffer;
|
|
@@ -3856,6 +4117,23 @@ class LineNumberRenderable extends Renderable {
|
|
|
3856
4117
|
getLineNumbers() {
|
|
3857
4118
|
return this._lineNumbers;
|
|
3858
4119
|
}
|
|
4120
|
+
highlightLines(startLine, endLine, color) {
|
|
4121
|
+
for (let i = startLine;i <= endLine; i++) {
|
|
4122
|
+
this.parseLineColor(i, color);
|
|
4123
|
+
}
|
|
4124
|
+
if (this.gutter) {
|
|
4125
|
+
this.gutter.setLineColors(this._lineColorsGutter, this._lineColorsContent);
|
|
4126
|
+
}
|
|
4127
|
+
}
|
|
4128
|
+
clearHighlightLines(startLine, endLine) {
|
|
4129
|
+
for (let i = startLine;i <= endLine; i++) {
|
|
4130
|
+
this._lineColorsGutter.delete(i);
|
|
4131
|
+
this._lineColorsContent.delete(i);
|
|
4132
|
+
}
|
|
4133
|
+
if (this.gutter) {
|
|
4134
|
+
this.gutter.setLineColors(this._lineColorsGutter, this._lineColorsContent);
|
|
4135
|
+
}
|
|
4136
|
+
}
|
|
3859
4137
|
}
|
|
3860
4138
|
|
|
3861
4139
|
// ../../node_modules/.bun/diff@8.0.2/node_modules/diff/libesm/diff/base.js
|
|
@@ -5580,6 +5858,30 @@ class DiffRenderable extends Renderable {
|
|
|
5580
5858
|
}
|
|
5581
5859
|
}
|
|
5582
5860
|
}
|
|
5861
|
+
setLineColor(line, color) {
|
|
5862
|
+
this.leftSide?.setLineColor(line, color);
|
|
5863
|
+
this.rightSide?.setLineColor(line, color);
|
|
5864
|
+
}
|
|
5865
|
+
clearLineColor(line) {
|
|
5866
|
+
this.leftSide?.clearLineColor(line);
|
|
5867
|
+
this.rightSide?.clearLineColor(line);
|
|
5868
|
+
}
|
|
5869
|
+
setLineColors(lineColors) {
|
|
5870
|
+
this.leftSide?.setLineColors(lineColors);
|
|
5871
|
+
this.rightSide?.setLineColors(lineColors);
|
|
5872
|
+
}
|
|
5873
|
+
clearAllLineColors() {
|
|
5874
|
+
this.leftSide?.clearAllLineColors();
|
|
5875
|
+
this.rightSide?.clearAllLineColors();
|
|
5876
|
+
}
|
|
5877
|
+
highlightLines(startLine, endLine, color) {
|
|
5878
|
+
this.leftSide?.highlightLines(startLine, endLine, color);
|
|
5879
|
+
this.rightSide?.highlightLines(startLine, endLine, color);
|
|
5880
|
+
}
|
|
5881
|
+
clearHighlightLines(startLine, endLine) {
|
|
5882
|
+
this.leftSide?.clearHighlightLines(startLine, endLine);
|
|
5883
|
+
this.rightSide?.clearHighlightLines(startLine, endLine);
|
|
5884
|
+
}
|
|
5583
5885
|
}
|
|
5584
5886
|
// src/renderables/EditBufferRenderable.ts
|
|
5585
5887
|
class EditBufferRenderable extends Renderable {
|
|
@@ -6011,13 +6313,11 @@ class EditBufferRenderable extends Renderable {
|
|
|
6011
6313
|
const cursorX = this.x + visualCursor.visualCol + 1;
|
|
6012
6314
|
const cursorY = this.y + visualCursor.visualRow + 1;
|
|
6013
6315
|
this._ctx.setCursorPosition(cursorX, cursorY, true);
|
|
6014
|
-
this._ctx.
|
|
6015
|
-
this._ctx.setCursorStyle(this._cursorStyle.style, this._cursorStyle.blinking);
|
|
6316
|
+
this._ctx.setCursorStyle({ ...this._cursorStyle, color: this._cursorColor });
|
|
6016
6317
|
}
|
|
6017
6318
|
focus() {
|
|
6018
6319
|
super.focus();
|
|
6019
|
-
this._ctx.setCursorStyle(this._cursorStyle
|
|
6020
|
-
this._ctx.setCursorColor(this._cursorColor);
|
|
6320
|
+
this._ctx.setCursorStyle({ ...this._cursorStyle, color: this._cursorColor });
|
|
6021
6321
|
this.requestRender();
|
|
6022
6322
|
}
|
|
6023
6323
|
blur() {
|
|
@@ -6608,9 +6908,10 @@ class TextareaRenderable extends EditBufferRenderable {
|
|
|
6608
6908
|
return this._placeholder;
|
|
6609
6909
|
}
|
|
6610
6910
|
set placeholder(value) {
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
this.
|
|
6911
|
+
const normalizedValue = value ?? null;
|
|
6912
|
+
if (this._placeholder !== normalizedValue) {
|
|
6913
|
+
this._placeholder = normalizedValue;
|
|
6914
|
+
this.applyPlaceholder(normalizedValue);
|
|
6614
6915
|
this.requestRender();
|
|
6615
6916
|
}
|
|
6616
6917
|
}
|
|
@@ -8181,7 +8482,8 @@ class MarkdownRenderable extends Renderable {
|
|
|
8181
8482
|
constructor(ctx, options) {
|
|
8182
8483
|
super(ctx, {
|
|
8183
8484
|
...options,
|
|
8184
|
-
flexDirection: "column"
|
|
8485
|
+
flexDirection: "column",
|
|
8486
|
+
flexShrink: options.flexShrink ?? 0
|
|
8185
8487
|
});
|
|
8186
8488
|
this._syntaxStyle = options.syntaxStyle;
|
|
8187
8489
|
this._conceal = options.conceal ?? this._contentDefaultOptions.conceal;
|
|
@@ -8225,8 +8527,7 @@ class MarkdownRenderable extends Renderable {
|
|
|
8225
8527
|
set streaming(value) {
|
|
8226
8528
|
if (this._streaming !== value) {
|
|
8227
8529
|
this._streaming = value;
|
|
8228
|
-
this.
|
|
8229
|
-
this.requestRender();
|
|
8530
|
+
this.clearCache();
|
|
8230
8531
|
}
|
|
8231
8532
|
}
|
|
8232
8533
|
getStyle(group) {
|
|
@@ -9514,13 +9815,13 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
9514
9815
|
if (this.scrollTop <= 0) {
|
|
9515
9816
|
this._stickyScrollTop = true;
|
|
9516
9817
|
this._stickyScrollBottom = false;
|
|
9517
|
-
if (this._stickyStart === "top" || this._stickyStart === "bottom" && maxScrollTop === 0) {
|
|
9818
|
+
if (!this._isApplyingStickyScroll && (this._stickyStart === "top" || this._stickyStart === "bottom" && maxScrollTop === 0)) {
|
|
9518
9819
|
this._hasManualScroll = false;
|
|
9519
9820
|
}
|
|
9520
9821
|
} else if (this.scrollTop >= maxScrollTop) {
|
|
9521
9822
|
this._stickyScrollTop = false;
|
|
9522
9823
|
this._stickyScrollBottom = true;
|
|
9523
|
-
if (this._stickyStart === "bottom") {
|
|
9824
|
+
if (!this._isApplyingStickyScroll && this._stickyStart === "bottom") {
|
|
9524
9825
|
this._hasManualScroll = false;
|
|
9525
9826
|
}
|
|
9526
9827
|
} else {
|
|
@@ -9530,13 +9831,13 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
9530
9831
|
if (this.scrollLeft <= 0) {
|
|
9531
9832
|
this._stickyScrollLeft = true;
|
|
9532
9833
|
this._stickyScrollRight = false;
|
|
9533
|
-
if (this._stickyStart === "left" || this._stickyStart === "right" && maxScrollLeft === 0) {
|
|
9834
|
+
if (!this._isApplyingStickyScroll && (this._stickyStart === "left" || this._stickyStart === "right" && maxScrollLeft === 0)) {
|
|
9534
9835
|
this._hasManualScroll = false;
|
|
9535
9836
|
}
|
|
9536
9837
|
} else if (this.scrollLeft >= maxScrollLeft) {
|
|
9537
9838
|
this._stickyScrollLeft = false;
|
|
9538
9839
|
this._stickyScrollRight = true;
|
|
9539
|
-
if (this._stickyStart === "right") {
|
|
9840
|
+
if (!this._isApplyingStickyScroll && this._stickyStart === "right") {
|
|
9540
9841
|
this._hasManualScroll = false;
|
|
9541
9842
|
}
|
|
9542
9843
|
} else {
|
|
@@ -9545,30 +9846,34 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
9545
9846
|
}
|
|
9546
9847
|
}
|
|
9547
9848
|
applyStickyStart(stickyStart) {
|
|
9849
|
+
const wasApplyingStickyScroll = this._isApplyingStickyScroll;
|
|
9548
9850
|
this._isApplyingStickyScroll = true;
|
|
9549
|
-
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
|
|
9560
|
-
|
|
9561
|
-
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
|
-
|
|
9565
|
-
|
|
9566
|
-
|
|
9567
|
-
|
|
9568
|
-
|
|
9569
|
-
|
|
9851
|
+
try {
|
|
9852
|
+
switch (stickyStart) {
|
|
9853
|
+
case "top":
|
|
9854
|
+
this._stickyScrollTop = true;
|
|
9855
|
+
this._stickyScrollBottom = false;
|
|
9856
|
+
this.verticalScrollBar.scrollPosition = 0;
|
|
9857
|
+
break;
|
|
9858
|
+
case "bottom":
|
|
9859
|
+
this._stickyScrollTop = false;
|
|
9860
|
+
this._stickyScrollBottom = true;
|
|
9861
|
+
this.verticalScrollBar.scrollPosition = Math.max(0, this.scrollHeight - this.viewport.height);
|
|
9862
|
+
break;
|
|
9863
|
+
case "left":
|
|
9864
|
+
this._stickyScrollLeft = true;
|
|
9865
|
+
this._stickyScrollRight = false;
|
|
9866
|
+
this.horizontalScrollBar.scrollPosition = 0;
|
|
9867
|
+
break;
|
|
9868
|
+
case "right":
|
|
9869
|
+
this._stickyScrollLeft = false;
|
|
9870
|
+
this._stickyScrollRight = true;
|
|
9871
|
+
this.horizontalScrollBar.scrollPosition = Math.max(0, this.scrollWidth - this.viewport.width);
|
|
9872
|
+
break;
|
|
9873
|
+
}
|
|
9874
|
+
} finally {
|
|
9875
|
+
this._isApplyingStickyScroll = wasApplyingStickyScroll;
|
|
9570
9876
|
}
|
|
9571
|
-
this._isApplyingStickyScroll = false;
|
|
9572
9877
|
}
|
|
9573
9878
|
constructor(ctx, {
|
|
9574
9879
|
wrapperOptions,
|
|
@@ -9908,29 +10213,32 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
9908
10213
|
recalculateBarProps() {
|
|
9909
10214
|
const wasApplyingStickyScroll = this._isApplyingStickyScroll;
|
|
9910
10215
|
this._isApplyingStickyScroll = true;
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
|
|
9915
|
-
|
|
9916
|
-
|
|
9917
|
-
|
|
9918
|
-
|
|
9919
|
-
this.
|
|
9920
|
-
|
|
9921
|
-
|
|
9922
|
-
this.
|
|
9923
|
-
|
|
9924
|
-
this.
|
|
9925
|
-
|
|
9926
|
-
|
|
9927
|
-
this.
|
|
9928
|
-
|
|
9929
|
-
this.
|
|
10216
|
+
try {
|
|
10217
|
+
this.verticalScrollBar.scrollSize = this.content.height;
|
|
10218
|
+
this.verticalScrollBar.viewportSize = this.viewport.height;
|
|
10219
|
+
this.horizontalScrollBar.scrollSize = this.content.width;
|
|
10220
|
+
this.horizontalScrollBar.viewportSize = this.viewport.width;
|
|
10221
|
+
if (this._stickyScroll) {
|
|
10222
|
+
const newMaxScrollTop = Math.max(0, this.scrollHeight - this.viewport.height);
|
|
10223
|
+
const newMaxScrollLeft = Math.max(0, this.scrollWidth - this.viewport.width);
|
|
10224
|
+
if (this._stickyStart && !this._hasManualScroll) {
|
|
10225
|
+
this.applyStickyStart(this._stickyStart);
|
|
10226
|
+
} else {
|
|
10227
|
+
if (this._stickyScrollTop) {
|
|
10228
|
+
this.scrollTop = 0;
|
|
10229
|
+
} else if (this._stickyScrollBottom && newMaxScrollTop > 0) {
|
|
10230
|
+
this.scrollTop = newMaxScrollTop;
|
|
10231
|
+
}
|
|
10232
|
+
if (this._stickyScrollLeft) {
|
|
10233
|
+
this.scrollLeft = 0;
|
|
10234
|
+
} else if (this._stickyScrollRight && newMaxScrollLeft > 0) {
|
|
10235
|
+
this.scrollLeft = newMaxScrollLeft;
|
|
10236
|
+
}
|
|
9930
10237
|
}
|
|
9931
10238
|
}
|
|
10239
|
+
} finally {
|
|
10240
|
+
this._isApplyingStickyScroll = wasApplyingStickyScroll;
|
|
9932
10241
|
}
|
|
9933
|
-
this._isApplyingStickyScroll = wasApplyingStickyScroll;
|
|
9934
10242
|
process.nextTick(() => {
|
|
9935
10243
|
this.requestRender();
|
|
9936
10244
|
});
|
|
@@ -10851,6 +11159,7 @@ export {
|
|
|
10851
11159
|
RGBA,
|
|
10852
11160
|
PasteEvent,
|
|
10853
11161
|
OptimizedBuffer,
|
|
11162
|
+
NativeSpanFeed,
|
|
10854
11163
|
MouseParser,
|
|
10855
11164
|
MouseEvent,
|
|
10856
11165
|
MouseButton,
|
|
@@ -10897,5 +11206,5 @@ export {
|
|
|
10897
11206
|
ASCIIFont
|
|
10898
11207
|
};
|
|
10899
11208
|
|
|
10900
|
-
//# debugId=
|
|
11209
|
+
//# debugId=B77F27E92D33B1E964756E2164756E21
|
|
10901
11210
|
//# sourceMappingURL=index.js.map
|