@opentui/core 0.0.0-20251001-d57654da → 0.0.0-20251006-283f60d7

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/index.js CHANGED
@@ -15,7 +15,9 @@ import {
15
15
  KeyEvent,
16
16
  KeyHandler,
17
17
  LayoutEvents,
18
+ LinearScrollAccel,
18
19
  LogLevel,
20
+ MacOSScrollAccel,
19
21
  MouseButton,
20
22
  MouseEvent,
21
23
  MouseParser,
@@ -130,7 +132,7 @@ import {
130
132
  white,
131
133
  wrapWithDelegates,
132
134
  yellow
133
- } from "./index-zgy8chsr.js";
135
+ } from "./index-hxktycf0.js";
134
136
  // src/post/filters.ts
135
137
  function applyScanlines(buffer, strength = 0.8, step = 2) {
136
138
  const width = buffer.width;
@@ -1735,6 +1737,7 @@ class CodeRenderable extends TextBufferRenderable {
1735
1737
  this.fallback(content);
1736
1738
  return;
1737
1739
  }
1740
+ this.fallback(content);
1738
1741
  this._isHighlighting = true;
1739
1742
  try {
1740
1743
  const styledText = await treeSitterToStyledText(content, this._filetype, this._syntaxStyle, this._treeSitterClient);
@@ -2013,6 +2016,9 @@ class TextNodeRenderable extends BaseRenderable {
2013
2016
  get attributes() {
2014
2017
  return this._attributes;
2015
2018
  }
2019
+ findDescendantById(id) {
2020
+ return;
2021
+ }
2016
2022
  }
2017
2023
 
2018
2024
  class RootTextNodeRenderable extends TextNodeRenderable {
@@ -3820,6 +3826,7 @@ class ScrollBoxRenderable extends BoxRenderable {
3820
3826
  _stickyScrollRight = false;
3821
3827
  _stickyStart;
3822
3828
  _hasManualScroll = false;
3829
+ scrollAccel;
3823
3830
  get stickyScroll() {
3824
3831
  return this._stickyScroll;
3825
3832
  }
@@ -3918,6 +3925,7 @@ class ScrollBoxRenderable extends BoxRenderable {
3918
3925
  stickyStart,
3919
3926
  scrollX = false,
3920
3927
  scrollY = true,
3928
+ scrollAcceleration,
3921
3929
  ...options
3922
3930
  }) {
3923
3931
  super(ctx, {
@@ -3929,6 +3937,13 @@ class ScrollBoxRenderable extends BoxRenderable {
3929
3937
  this.internalId = ScrollBoxRenderable.idCounter++;
3930
3938
  this._stickyScroll = stickyScroll;
3931
3939
  this._stickyStart = stickyStart;
3940
+ if (scrollAcceleration) {
3941
+ this.scrollAccel = scrollAcceleration;
3942
+ } else if (process.platform === "darwin") {
3943
+ this.scrollAccel = new MacOSScrollAccel;
3944
+ } else {
3945
+ this.scrollAccel = new LinearScrollAccel;
3946
+ }
3932
3947
  this.wrapper = new BoxRenderable(ctx, {
3933
3948
  flexDirection: "column",
3934
3949
  flexGrow: 1,
@@ -4026,6 +4041,9 @@ class ScrollBoxRenderable extends BoxRenderable {
4026
4041
  add(obj, index) {
4027
4042
  return this.content.add(obj, index);
4028
4043
  }
4044
+ insertBefore(obj, anchor) {
4045
+ return this.content.insertBefore(obj, anchor);
4046
+ }
4029
4047
  remove(id) {
4030
4048
  this.content.remove(id);
4031
4049
  }
@@ -4037,14 +4055,18 @@ class ScrollBoxRenderable extends BoxRenderable {
4037
4055
  let dir = event.scroll?.direction;
4038
4056
  if (event.modifiers.shift)
4039
4057
  dir = dir === "up" ? "left" : dir === "down" ? "right" : dir === "right" ? "down" : "up";
4040
- if (dir === "up")
4041
- this.scrollTop -= event.scroll?.delta ?? 0;
4042
- else if (dir === "down")
4043
- this.scrollTop += event.scroll?.delta ?? 0;
4044
- else if (dir === "left")
4045
- this.scrollLeft -= event.scroll?.delta ?? 0;
4046
- else if (dir === "right")
4047
- this.scrollLeft += event.scroll?.delta ?? 0;
4058
+ const baseDelta = event.scroll?.delta ?? 0;
4059
+ const now = Date.now();
4060
+ const multiplier = this.scrollAccel.tick(now);
4061
+ if (dir === "up") {
4062
+ this.scrollTop -= baseDelta * multiplier;
4063
+ } else if (dir === "down") {
4064
+ this.scrollTop += baseDelta * multiplier;
4065
+ } else if (dir === "left") {
4066
+ this.scrollLeft -= baseDelta * multiplier;
4067
+ } else if (dir === "right") {
4068
+ this.scrollLeft += baseDelta * multiplier;
4069
+ }
4048
4070
  this._hasManualScroll = true;
4049
4071
  }
4050
4072
  if (event.type === "drag" && event.isSelecting) {
@@ -4056,10 +4078,12 @@ class ScrollBoxRenderable extends BoxRenderable {
4056
4078
  handleKeyPress(key) {
4057
4079
  if (this.verticalScrollBar.handleKeyPress(key)) {
4058
4080
  this._hasManualScroll = true;
4081
+ this.scrollAccel.reset();
4059
4082
  return true;
4060
4083
  }
4061
4084
  if (this.horizontalScrollBar.handleKeyPress(key)) {
4062
4085
  this._hasManualScroll = true;
4086
+ this.scrollAccel.reset();
4063
4087
  return true;
4064
4088
  }
4065
4089
  return false;
@@ -4443,7 +4467,9 @@ export {
4443
4467
  MouseParser,
4444
4468
  MouseEvent,
4445
4469
  MouseButton,
4470
+ MacOSScrollAccel,
4446
4471
  LogLevel,
4472
+ LinearScrollAccel,
4447
4473
  LayoutEvents,
4448
4474
  KeyHandler,
4449
4475
  KeyEvent,
@@ -4475,5 +4501,5 @@ export {
4475
4501
  ASCIIFont
4476
4502
  };
4477
4503
 
4478
- //# debugId=E76E0BC5C702E8AC64756E2164756E21
4504
+ //# debugId=4FEFDA985A6D9A7064756E2164756E21
4479
4505
  //# sourceMappingURL=index.js.map