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