@opentui/core 0.6.8 → 0.7.0

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.
Files changed (48) hide show
  1. package/NativeScene.d.ts +5 -26
  2. package/Renderable.d.ts +27 -32
  3. package/audio.d.ts +1 -0
  4. package/{chunk-bun-ehr9v0n8.js → chunk-bun-qkpm62w1.js} +257 -69
  5. package/chunk-bun-qkpm62w1.js.map +35 -0
  6. package/{chunk-bun-4e5bpeqh.js → chunk-bun-zevtbcf6.js} +846 -785
  7. package/chunk-bun-zevtbcf6.js.map +70 -0
  8. package/{chunk-node-yyjd8p1g.js → chunk-node-7bcmqh18.js} +846 -785
  9. package/chunk-node-7bcmqh18.js.map +70 -0
  10. package/{chunk-node-jhq62x0c.js → chunk-node-mzgnr3sw.js} +257 -69
  11. package/chunk-node-mzgnr3sw.js.map +34 -0
  12. package/index.bun.js +313 -91
  13. package/index.bun.js.map +12 -11
  14. package/index.node.js +313 -91
  15. package/index.node.js.map +12 -10
  16. package/lib/detect-links.d.ts +2 -0
  17. package/lib/parse.keypress-kitty.d.ts +2 -0
  18. package/lib/scroll-chain.d.ts +16 -0
  19. package/lib/stdin-parser-native.d.ts +88 -0
  20. package/native-abi.generated.d.ts +394 -5
  21. package/package.json +9 -9
  22. package/renderables/Box.d.ts +2 -2
  23. package/renderables/Code.d.ts +2 -1
  24. package/renderables/Diff.d.ts +2 -2
  25. package/renderables/EditBufferRenderable.d.ts +2 -2
  26. package/renderables/EmbeddedTerminal.d.ts +2 -2
  27. package/renderables/FrameBuffer.d.ts +3 -3
  28. package/renderables/Image.d.ts +2 -2
  29. package/renderables/Markdown.d.ts +2 -2
  30. package/renderables/ScrollBar.d.ts +3 -3
  31. package/renderables/ScrollBox.d.ts +6 -3
  32. package/renderables/Slider.d.ts +2 -2
  33. package/renderables/Text.d.ts +2 -2
  34. package/renderables/TextBufferRenderable.d.ts +2 -4
  35. package/renderer.d.ts +8 -4
  36. package/testing/test-renderer.d.ts +2 -0
  37. package/testing.bun.js +11 -4
  38. package/testing.bun.js.map +3 -3
  39. package/testing.js +11 -4
  40. package/testing.js.map +3 -3
  41. package/yoga.bun.js +1 -1
  42. package/yoga.js +1 -1
  43. package/zig-structs.d.ts +25 -0
  44. package/zig.d.ts +20 -7
  45. package/chunk-bun-4e5bpeqh.js.map +0 -69
  46. package/chunk-bun-ehr9v0n8.js.map +0 -35
  47. package/chunk-node-jhq62x0c.js.map +0 -34
  48. package/chunk-node-yyjd8p1g.js.map +0 -69
package/index.node.js CHANGED
@@ -109,7 +109,7 @@ import {
109
109
  resolveRenderLib2,
110
110
  MeasureMode2,
111
111
  exports_yoga
112
- } from "./chunk-node-jhq62x0c.js";
112
+ } from "./chunk-node-mzgnr3sw.js";
113
113
  import {
114
114
  isValidBorderStyle2,
115
115
  parseBorderStyle2,
@@ -127,8 +127,6 @@ import {
127
127
  getCharacterPositions2,
128
128
  coordinateToCharacterIndex2,
129
129
  renderFontToFrameBuffer2,
130
- convertThemeToStyles2,
131
- SyntaxStyle2,
132
130
  hastToStyledText2,
133
131
  SystemClock2,
134
132
  nonAlphanumericKeys2,
@@ -209,6 +207,8 @@ import {
209
207
  getTimelineEngine2,
210
208
  createTimeline2,
211
209
  BoxRenderable2,
210
+ wheelDirection,
211
+ scrollOnce,
212
212
  TextBufferRenderable2,
213
213
  CodeRenderable2,
214
214
  ImageLoadError2,
@@ -241,7 +241,237 @@ import {
241
241
  CliRenderEvents2,
242
242
  RendererControlState2,
243
243
  CliRenderer2
244
- } from "./chunk-node-yyjd8p1g.js";
244
+ } from "./chunk-node-7bcmqh18.js";
245
+ // src/syntax-style.ts
246
+ function cloneStyle(style) {
247
+ return {
248
+ ...style,
249
+ fg: style.fg ? RGBA2.clone(style.fg) : undefined,
250
+ bg: style.bg ? RGBA2.clone(style.bg) : undefined
251
+ };
252
+ }
253
+ function convertThemeToStyles(theme) {
254
+ const flatStyles = {};
255
+ for (const tokenStyle of theme) {
256
+ const styleDefinition = {};
257
+ if (tokenStyle.style.foreground) {
258
+ styleDefinition.fg = parseColor2(tokenStyle.style.foreground);
259
+ }
260
+ if (tokenStyle.style.background) {
261
+ styleDefinition.bg = parseColor2(tokenStyle.style.background);
262
+ }
263
+ if (tokenStyle.style.bold !== undefined) {
264
+ styleDefinition.bold = tokenStyle.style.bold;
265
+ }
266
+ if (tokenStyle.style.italic !== undefined) {
267
+ styleDefinition.italic = tokenStyle.style.italic;
268
+ }
269
+ if (tokenStyle.style.underline !== undefined) {
270
+ styleDefinition.underline = tokenStyle.style.underline;
271
+ }
272
+ if (tokenStyle.style.dim !== undefined) {
273
+ styleDefinition.dim = tokenStyle.style.dim;
274
+ }
275
+ for (const scope of tokenStyle.scope) {
276
+ flatStyles[scope] = cloneStyle(styleDefinition);
277
+ }
278
+ }
279
+ return flatStyles;
280
+ }
281
+
282
+ class SyntaxStyle {
283
+ lib;
284
+ native;
285
+ _destroyed = false;
286
+ nameCache = new Map;
287
+ styleDefs = new Map;
288
+ mergedCache = new Map;
289
+ constructor(lib, handle, source) {
290
+ const owner = source?.resourceContext;
291
+ if (!owner)
292
+ throw new Error("SyntaxStyle requires an explicit resource owner");
293
+ owner.assertAlive();
294
+ if (owner.renderLib !== lib || !handle || typeof handle !== "object" || handle.context !== owner.context) {
295
+ throw new Error("SyntaxStyle Context owner mismatch");
296
+ }
297
+ this.lib = lib;
298
+ this.native = { owner, handle };
299
+ }
300
+ static create(source) {
301
+ const owner = source?.resourceContext;
302
+ if (!owner)
303
+ throw new Error("SyntaxStyle requires an explicit resource owner: pass renderer.nativeScene, or a ResourceContext when there is no renderer");
304
+ owner.assertAlive();
305
+ const lib = owner.renderLib;
306
+ const handle = lib.createContextSyntaxStyle(owner.context);
307
+ try {
308
+ return new SyntaxStyle(lib, handle, owner);
309
+ } catch (error) {
310
+ lib.destroyContextSyntaxStyle(owner.context, handle);
311
+ throw error;
312
+ }
313
+ }
314
+ static fromTheme(theme, owner) {
315
+ return SyntaxStyle.fromStyles(convertThemeToStyles(theme), owner);
316
+ }
317
+ static fromStyles(styles, owner) {
318
+ const style = SyntaxStyle.create(owner);
319
+ try {
320
+ for (const [name, styleDef] of styles instanceof Map ? styles : Object.entries(styles)) {
321
+ style.registerStyle(name, styleDef);
322
+ }
323
+ return style;
324
+ } catch (error) {
325
+ style.destroy();
326
+ throw error;
327
+ }
328
+ }
329
+ guard() {
330
+ if (this._destroyed)
331
+ throw new Error("NativeSyntaxStyle is destroyed");
332
+ this.native.owner.assertAlive();
333
+ }
334
+ _getSceneHandle(scene) {
335
+ this.guard();
336
+ if (this.native.owner !== scene.resourceContext)
337
+ throw new Error("SyntaxStyle owner mismatch: bind definitions in the destination Context");
338
+ return this.native.handle;
339
+ }
340
+ registerStyle(name, style) {
341
+ this.guard();
342
+ const { bold, italic, underline, dim, fg: foreground, bg: background } = style;
343
+ const definition = {
344
+ bold,
345
+ italic,
346
+ underline,
347
+ dim,
348
+ fg: foreground ? RGBA2.clone(parseColor2(foreground)) : undefined,
349
+ bg: background ? RGBA2.clone(parseColor2(background)) : undefined
350
+ };
351
+ const attributes = createTextAttributes2(definition);
352
+ const fg = definition.fg ?? null;
353
+ const bg = definition.bg ?? null;
354
+ return this.lib.getYogaHost().runMutation(() => {
355
+ const id = this.lib.contextSyntaxStyleRegister(this.native.handle.context, this.native.handle, name, {
356
+ fg,
357
+ bg,
358
+ attributes
359
+ });
360
+ this.nameCache.set(name, id);
361
+ this.styleDefs.set(name, definition);
362
+ this.mergedCache.clear();
363
+ return id;
364
+ });
365
+ }
366
+ resolveStyleId(name) {
367
+ this.guard();
368
+ const cached = this.nameCache.get(name);
369
+ if (cached !== undefined)
370
+ return cached;
371
+ const id = this.lib.contextSyntaxStyleResolveByName(this.native.handle.context, this.native.handle, name);
372
+ if (id !== null) {
373
+ this.nameCache.set(name, id);
374
+ }
375
+ return id;
376
+ }
377
+ getStyleId(name) {
378
+ this.guard();
379
+ const id = this.resolveStyleId(name);
380
+ if (id !== null)
381
+ return id;
382
+ if (name.includes(".")) {
383
+ const baseName = name.split(".")[0];
384
+ return this.resolveStyleId(baseName);
385
+ }
386
+ return null;
387
+ }
388
+ getStyleCount() {
389
+ this.guard();
390
+ return this.lib.contextSyntaxStyleGetStyleCount(this.native.handle.context, this.native.handle);
391
+ }
392
+ clearNameCache() {
393
+ this.guard();
394
+ this.nameCache.clear();
395
+ }
396
+ getStyle(name) {
397
+ this.guard();
398
+ const style = this.styleDefs.get(name);
399
+ if (style)
400
+ return cloneStyle(style);
401
+ if (name.includes(".")) {
402
+ const baseName = name.split(".")[0];
403
+ const base = this.styleDefs.get(baseName);
404
+ return base ? cloneStyle(base) : undefined;
405
+ }
406
+ return;
407
+ }
408
+ mergeStyles(...styleNames) {
409
+ this.guard();
410
+ const cacheKey = styleNames.join(":");
411
+ const cached = this.mergedCache.get(cacheKey);
412
+ if (cached)
413
+ return cloneStyle(cached);
414
+ const styleDefinition = {};
415
+ for (const name of styleNames) {
416
+ const style = this.getStyle(name);
417
+ if (!style)
418
+ continue;
419
+ if (style.fg)
420
+ styleDefinition.fg = style.fg;
421
+ if (style.bg)
422
+ styleDefinition.bg = style.bg;
423
+ if (style.bold !== undefined)
424
+ styleDefinition.bold = style.bold;
425
+ if (style.italic !== undefined)
426
+ styleDefinition.italic = style.italic;
427
+ if (style.underline !== undefined)
428
+ styleDefinition.underline = style.underline;
429
+ if (style.dim !== undefined)
430
+ styleDefinition.dim = style.dim;
431
+ }
432
+ const attributes = createTextAttributes2({
433
+ bold: styleDefinition.bold,
434
+ italic: styleDefinition.italic,
435
+ underline: styleDefinition.underline,
436
+ dim: styleDefinition.dim
437
+ });
438
+ const merged = {
439
+ fg: styleDefinition.fg,
440
+ bg: styleDefinition.bg,
441
+ attributes
442
+ };
443
+ this.mergedCache.set(cacheKey, merged);
444
+ return cloneStyle(merged);
445
+ }
446
+ clearCache() {
447
+ this.guard();
448
+ this.mergedCache.clear();
449
+ }
450
+ getCacheSize() {
451
+ this.guard();
452
+ return this.mergedCache.size;
453
+ }
454
+ getAllStyles() {
455
+ this.guard();
456
+ return new Map(Array.from(this.styleDefs, ([name, style]) => [name, cloneStyle(style)]));
457
+ }
458
+ getRegisteredNames() {
459
+ this.guard();
460
+ return Array.from(this.styleDefs.keys());
461
+ }
462
+ destroy() {
463
+ if (this._destroyed)
464
+ return;
465
+ this.lib.getYogaHost().runMutation(() => {
466
+ if (!this.native.owner.disposed)
467
+ this.lib.destroyContextSyntaxStyle(this.native.handle.context, this.native.handle);
468
+ this._destroyed = true;
469
+ this.nameCache.clear();
470
+ this.styleDefs.clear();
471
+ this.mergedCache.clear();
472
+ });
473
+ }
474
+ }
245
475
  // src/post/effects.ts
246
476
  function toU8(value) {
247
477
  return Math.round(Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * 255);
@@ -3251,13 +3481,8 @@ class AudioStream extends EventEmitter {
3251
3481
  if (this.lifecycleController.signal.aborted)
3252
3482
  return false;
3253
3483
  const status = this.lib.audioEndStream(this.engine, this.nativeStreamId);
3254
- if (status !== 0) {
3255
- const nativeError = this.snapshotError(this.readNativeStats());
3256
- if (nativeError?.context.action === "decoder")
3257
- throw nativeError;
3258
- const context = { action: "end", status };
3259
- throw new AudioStreamError(`Audio stream end failed: ${status}`, context);
3260
- }
3484
+ if (status !== 0)
3485
+ throw this.nativeCallError("end", status);
3261
3486
  if (!await decoderReady || this.lifecycleController.signal.aborted)
3262
3487
  return false;
3263
3488
  if (!await this.awaitEnded(attempt))
@@ -3379,10 +3604,8 @@ class AudioStream extends EventEmitter {
3379
3604
  const context = { action: "write" };
3380
3605
  throw new AudioStreamError("Audio stream write failed", context, cause);
3381
3606
  }
3382
- if (accepted < 0) {
3383
- const context = { action: "write", status: accepted };
3384
- throw new AudioStreamError(`Audio stream write failed: ${accepted}`, context);
3385
- }
3607
+ if (accepted < 0)
3608
+ throw this.nativeCallError("write", accepted);
3386
3609
  offset += accepted;
3387
3610
  if (accepted === 0 || ++attempt.writeBatches >= 32) {
3388
3611
  attempt.writeBatches = 0;
@@ -3392,6 +3615,12 @@ class AudioStream extends EventEmitter {
3392
3615
  }
3393
3616
  }
3394
3617
  }
3618
+ nativeCallError(action, status) {
3619
+ const nativeError = this.snapshotError(this.readNativeStats());
3620
+ if (nativeError?.context.action === "decoder")
3621
+ return nativeError;
3622
+ return new AudioStreamError(`Audio stream ${action} failed: ${status}`, { action, status });
3623
+ }
3395
3624
  resolveConnection(connection, attempt) {
3396
3625
  const finishAcquisition = this.beginResourceAcquisition(attempt);
3397
3626
  try {
@@ -5546,11 +5775,10 @@ function setupAudio(options = {}) {
5546
5775
  }
5547
5776
  // src/renderables/FrameBuffer.ts
5548
5777
  class FrameBufferRenderable extends Renderable2 {
5549
- static nativeIntegration = this.defineNativeIntegration({
5778
+ static nativeIntegration = {
5550
5779
  kind: "custom",
5551
- body: { native: this.prototype.renderSelf },
5552
- construction: "prototype"
5553
- });
5780
+ body: { native: this.prototype.renderSelf }
5781
+ };
5554
5782
  respectAlpha;
5555
5783
  constructor(ctx, options) {
5556
5784
  super(ctx, options);
@@ -5568,7 +5796,7 @@ class FrameBufferRenderable extends Renderable2 {
5568
5796
  }
5569
5797
  }
5570
5798
  _refreshNativeSceneSurface() {
5571
- if (this.respectAlpha === undefined || Object.getOwnPropertyDescriptor(this, "frameBuffer")?.get)
5799
+ if (Object.getOwnPropertyDescriptor(this, "frameBuffer")?.get)
5572
5800
  return;
5573
5801
  let surface = this.frameBuffer;
5574
5802
  this._ctx.nativeScene.setSurface(this, surface);
@@ -6784,10 +7012,9 @@ var defaultColors = {
6784
7012
  };
6785
7013
 
6786
7014
  class DiffRenderable extends Renderable2 {
6787
- static nativeIntegration = this.defineNativeIntegration({
6788
- ...Renderable2.nativeIntegration,
6789
- construction: "prototype"
6790
- });
7015
+ static nativeIntegration = {
7016
+ ...Renderable2.nativeIntegration
7017
+ };
6791
7018
  _diff;
6792
7019
  _syncScroll = false;
6793
7020
  _view;
@@ -7027,7 +7254,7 @@ class DiffRenderable extends Renderable2 {
7027
7254
  });
7028
7255
  }
7029
7256
  get codeSyntaxStyle() {
7030
- return this._syntaxStyle ?? (this.fallbackSyntaxStyle ??= SyntaxStyle2.create(this.ctx.nativeScene));
7257
+ return this._syntaxStyle ?? (this.fallbackSyntaxStyle ??= SyntaxStyle.create(this.ctx.nativeScene));
7031
7258
  }
7032
7259
  buildErrorView() {
7033
7260
  this.flexDirection = "column";
@@ -7847,11 +8074,10 @@ var MOD_CAPS_LOCK = 1 << 4;
7847
8074
  var MOD_NUM_LOCK = 1 << 5;
7848
8075
 
7849
8076
  class EmbeddedTerminalRenderable extends Renderable2 {
7850
- static nativeIntegration = this.defineNativeIntegration({
8077
+ static nativeIntegration = {
7851
8078
  kind: "custom",
7852
- body: "host",
7853
- construction: "prototype"
7854
- });
8079
+ body: "host"
8080
+ };
7855
8081
  lib;
7856
8082
  handle = null;
7857
8083
  _onData;
@@ -11274,10 +11500,9 @@ function cloneTableOptions(options) {
11274
11500
  }
11275
11501
 
11276
11502
  class MarkdownRenderable extends Renderable2 {
11277
- static nativeIntegration = this.defineNativeIntegration({
11278
- ...Renderable2.nativeIntegration,
11279
- construction: "prototype"
11280
- });
11503
+ static nativeIntegration = {
11504
+ ...Renderable2.nativeIntegration
11505
+ };
11281
11506
  static _capabilitySubscriptions = new WeakMap;
11282
11507
  _content = "";
11283
11508
  _syntaxStyle;
@@ -12950,11 +13175,10 @@ var defaultMin = 0;
12950
13175
  var defaultMax = 100;
12951
13176
 
12952
13177
  class SliderRenderable extends Renderable2 {
12953
- static nativeIntegration = this.defineNativeIntegration({
13178
+ static nativeIntegration = {
12954
13179
  kind: "slider",
12955
- body: { native: this.prototype.renderSelf },
12956
- construction: "prototype"
12957
- });
13180
+ body: { native: this.prototype.renderSelf }
13181
+ };
12958
13182
  _orientation;
12959
13183
  _value;
12960
13184
  _min;
@@ -13234,11 +13458,10 @@ class SliderRenderable extends Renderable2 {
13234
13458
 
13235
13459
  // src/renderables/ScrollBar.ts
13236
13460
  class ScrollBarRenderable extends Renderable2 {
13237
- static nativeIntegration = this.defineNativeIntegration({
13461
+ static nativeIntegration = {
13238
13462
  ...Renderable2.nativeIntegration,
13239
- kind: "box",
13240
- construction: "prototype"
13241
- });
13463
+ kind: "box"
13464
+ };
13242
13465
  slider;
13243
13466
  startArrow;
13244
13467
  endArrow;
@@ -13299,7 +13522,7 @@ class ScrollBarRenderable extends Renderable2 {
13299
13522
  if (this.isDestroyed)
13300
13523
  return;
13301
13524
  this.assertMutable();
13302
- const newPosition = Math.round(Math.min(Math.max(0, value ?? 0), this.scrollSize - this.viewportSize));
13525
+ const newPosition = Math.round(Math.max(0, Math.min(value ?? 0, this.scrollSize - this.viewportSize)));
13303
13526
  if (!Number.isFinite(newPosition)) {
13304
13527
  throw new RangeError("Scene scroll positions must be finite numbers");
13305
13528
  }
@@ -13551,11 +13774,10 @@ var defaultArrowForeground = RGBA2.fromValues(1, 1, 1, 1);
13551
13774
  var defaultArrowBackground = RGBA2.fromValues(0, 0, 0, 0);
13552
13775
 
13553
13776
  class ArrowRenderable extends Renderable2 {
13554
- static nativeIntegration = this.defineNativeIntegration({
13777
+ static nativeIntegration = {
13555
13778
  kind: "arrow",
13556
- body: { native: this.prototype.renderSelf },
13557
- construction: "prototype"
13558
- });
13779
+ body: { native: this.prototype.renderSelf }
13780
+ };
13559
13781
  _direction;
13560
13782
  _foregroundColor;
13561
13783
  _backgroundColor;
@@ -13665,7 +13887,7 @@ class ArrowRenderable extends Renderable2 {
13665
13887
  }
13666
13888
  // src/renderables/ScrollBox.ts
13667
13889
  class ContentRenderable extends BoxRenderable2 {
13668
- static nativeIntegration = this.defineNativeIntegration(BoxRenderable2.nativeIntegration);
13890
+ static nativeIntegration = BoxRenderable2.nativeIntegration;
13669
13891
  viewport;
13670
13892
  _viewportCulling;
13671
13893
  constructor(ctx, viewport, viewportCulling, options) {
@@ -13718,7 +13940,15 @@ function stripScrollBoxPadding(options) {
13718
13940
  }
13719
13941
 
13720
13942
  class ScrollBoxRenderable extends BoxRenderable2 {
13721
- static nativeIntegration = this.defineNativeIntegration(BoxRenderable2.nativeIntegration);
13943
+ static nativeIntegration = {
13944
+ ...BoxRenderable2.nativeIntegration,
13945
+ lifecycle: {
13946
+ update: {
13947
+ idle: this.prototype.onUpdate,
13948
+ active: (renderable) => renderable["isAutoScrolling"]
13949
+ }
13950
+ }
13951
+ };
13722
13952
  static idCounter = 0;
13723
13953
  internalId = 0;
13724
13954
  wrapper;
@@ -14101,46 +14331,35 @@ class ScrollBoxRenderable extends BoxRenderable2 {
14101
14331
  getRenderable(id) {
14102
14332
  return this.content.getRenderable(id);
14103
14333
  }
14334
+ scrollByWheel(event) {
14335
+ const dir = wheelDirection(event);
14336
+ const vertical = dir === "up" || dir === "down";
14337
+ if (!vertical && dir !== "left" && dir !== "right")
14338
+ return false;
14339
+ const bar = vertical ? this.verticalScrollBar : this.horizontalScrollBar;
14340
+ const sign = dir === "up" || dir === "left" ? -1 : 1;
14341
+ const position = bar.scrollPosition;
14342
+ if (sign < 0 ? position <= 0 : position >= bar.scrollSize - bar.viewportSize)
14343
+ return false;
14344
+ let remainder = vertical ? this.scrollAccumulatorY : this.scrollAccumulatorX;
14345
+ if (remainder * sign < 0)
14346
+ remainder = 0;
14347
+ remainder += sign * (event.scroll?.delta ?? 0) * this.scrollAccel.tick(Date.now());
14348
+ const step = Math.trunc(remainder);
14349
+ if (step !== 0 && vertical)
14350
+ this.scrollTop = position + step;
14351
+ else if (step !== 0)
14352
+ this.scrollLeft = position + step;
14353
+ remainder = bar.scrollPosition - position === step ? remainder - step : 0;
14354
+ if (vertical)
14355
+ this.scrollAccumulatorY = remainder;
14356
+ else
14357
+ this.scrollAccumulatorX = remainder;
14358
+ return true;
14359
+ }
14104
14360
  onMouseEvent(event) {
14105
- if (event.type === "scroll") {
14106
- let dir = event.scroll?.direction;
14107
- if (event.modifiers.shift)
14108
- dir = dir === "up" ? "left" : dir === "down" ? "right" : dir === "right" ? "down" : "up";
14109
- const baseDelta = event.scroll?.delta ?? 0;
14110
- const now = Date.now();
14111
- const multiplier = this.scrollAccel.tick(now);
14112
- const scrollAmount = baseDelta * multiplier;
14113
- if (dir === "up") {
14114
- this.scrollAccumulatorY -= scrollAmount;
14115
- const integerScroll = Math.trunc(this.scrollAccumulatorY);
14116
- if (integerScroll !== 0) {
14117
- this.scrollTop += integerScroll;
14118
- this.scrollAccumulatorY -= integerScroll;
14119
- }
14120
- } else if (dir === "down") {
14121
- this.scrollAccumulatorY += scrollAmount;
14122
- const integerScroll = Math.trunc(this.scrollAccumulatorY);
14123
- if (integerScroll !== 0) {
14124
- this.scrollTop += integerScroll;
14125
- this.scrollAccumulatorY -= integerScroll;
14126
- }
14127
- } else if (dir === "left") {
14128
- this.scrollAccumulatorX -= scrollAmount;
14129
- const integerScroll = Math.trunc(this.scrollAccumulatorX);
14130
- if (integerScroll !== 0) {
14131
- this.scrollLeft += integerScroll;
14132
- this.scrollAccumulatorX -= integerScroll;
14133
- }
14134
- } else if (dir === "right") {
14135
- this.scrollAccumulatorX += scrollAmount;
14136
- const integerScroll = Math.trunc(this.scrollAccumulatorX);
14137
- if (integerScroll !== 0) {
14138
- this.scrollLeft += integerScroll;
14139
- this.scrollAccumulatorX -= integerScroll;
14140
- }
14141
- }
14142
- this.syncManualScrollState();
14143
- }
14361
+ if (event.type === "scroll")
14362
+ scrollOnce(event, this, () => this.scrollByWheel(event));
14144
14363
  if (event.type === "drag" && event.isDragging) {
14145
14364
  this.updateAutoScroll(event.x, event.y);
14146
14365
  } else if (event.type === "up") {
@@ -14173,6 +14392,7 @@ class ScrollBoxRenderable extends BoxRenderable2 {
14173
14392
  this.cachedAutoScrollSpeed = this.getAutoScrollSpeed(mouseX, mouseY);
14174
14393
  this.isAutoScrolling = true;
14175
14394
  this.live = true;
14395
+ this.refreshNativeSceneHooks();
14176
14396
  }
14177
14397
  updateAutoScroll(mouseX, mouseY) {
14178
14398
  this.autoScrollMouseX = mouseX;
@@ -14191,8 +14411,10 @@ class ScrollBoxRenderable extends BoxRenderable2 {
14191
14411
  this.isAutoScrolling = false;
14192
14412
  this.autoScrollAccumulatorX = 0;
14193
14413
  this.autoScrollAccumulatorY = 0;
14194
- if (wasAutoScrolling)
14414
+ if (wasAutoScrolling) {
14195
14415
  this.live = false;
14416
+ this.refreshNativeSceneHooks();
14417
+ }
14196
14418
  }
14197
14419
  handleAutoScroll(deltaTime) {
14198
14420
  if (!this.isAutoScrolling)
@@ -15325,7 +15547,7 @@ export {
15325
15547
  SlotRenderable,
15326
15548
  StdinParser2 as StdinParser,
15327
15549
  StyledText2 as StyledText,
15328
- SyntaxStyle2 as SyntaxStyle,
15550
+ SyntaxStyle,
15329
15551
  SystemClock2 as SystemClock,
15330
15552
  TECHNICOLOR_MATRIX,
15331
15553
  TRITANOPIA_COMP_MATRIX,
@@ -15391,7 +15613,7 @@ export {
15391
15613
  capture2 as capture,
15392
15614
  clearEnvCache2 as clearEnvCache,
15393
15615
  convertGlobalToLocalSelection2 as convertGlobalToLocalSelection,
15394
- convertThemeToStyles2 as convertThemeToStyles,
15616
+ convertThemeToStyles,
15395
15617
  coordinateToCharacterIndex2 as coordinateToCharacterIndex,
15396
15618
  createCliRenderer2 as createCliRenderer,
15397
15619
  createClipboard2 as createClipboard,
@@ -15500,5 +15722,5 @@ export {
15500
15722
  yellow2 as yellow
15501
15723
  };
15502
15724
 
15503
- //# debugId=7D2171B169F19E4C64756E2164756E21
15725
+ //# debugId=B22B34CB6114361B64756E2164756E21
15504
15726
  //# sourceMappingURL=index.node.js.map