@opentui/core 0.0.0-20251001-d57654da → 0.0.0-20251008-63d6b70d

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-pxa2sv92.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,12 @@ 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
+ }
3945
+ this.scrollAccel ??= new LinearScrollAccel;
3932
3946
  this.wrapper = new BoxRenderable(ctx, {
3933
3947
  flexDirection: "column",
3934
3948
  flexGrow: 1,
@@ -4026,6 +4040,9 @@ class ScrollBoxRenderable extends BoxRenderable {
4026
4040
  add(obj, index) {
4027
4041
  return this.content.add(obj, index);
4028
4042
  }
4043
+ insertBefore(obj, anchor) {
4044
+ return this.content.insertBefore(obj, anchor);
4045
+ }
4029
4046
  remove(id) {
4030
4047
  this.content.remove(id);
4031
4048
  }
@@ -4037,14 +4054,18 @@ class ScrollBoxRenderable extends BoxRenderable {
4037
4054
  let dir = event.scroll?.direction;
4038
4055
  if (event.modifiers.shift)
4039
4056
  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;
4057
+ const baseDelta = event.scroll?.delta ?? 0;
4058
+ const now = Date.now();
4059
+ const multiplier = this.scrollAccel.tick(now);
4060
+ if (dir === "up") {
4061
+ this.scrollTop -= baseDelta * multiplier;
4062
+ } else if (dir === "down") {
4063
+ this.scrollTop += baseDelta * multiplier;
4064
+ } else if (dir === "left") {
4065
+ this.scrollLeft -= baseDelta * multiplier;
4066
+ } else if (dir === "right") {
4067
+ this.scrollLeft += baseDelta * multiplier;
4068
+ }
4048
4069
  this._hasManualScroll = true;
4049
4070
  }
4050
4071
  if (event.type === "drag" && event.isSelecting) {
@@ -4056,10 +4077,12 @@ class ScrollBoxRenderable extends BoxRenderable {
4056
4077
  handleKeyPress(key) {
4057
4078
  if (this.verticalScrollBar.handleKeyPress(key)) {
4058
4079
  this._hasManualScroll = true;
4080
+ this.scrollAccel.reset();
4059
4081
  return true;
4060
4082
  }
4061
4083
  if (this.horizontalScrollBar.handleKeyPress(key)) {
4062
4084
  this._hasManualScroll = true;
4085
+ this.scrollAccel.reset();
4063
4086
  return true;
4064
4087
  }
4065
4088
  return false;
@@ -4226,6 +4249,12 @@ class ScrollBoxRenderable extends BoxRenderable {
4226
4249
  Object.assign(this.horizontalScrollBar, options);
4227
4250
  this.requestRender();
4228
4251
  }
4252
+ get scrollAcceleration() {
4253
+ return this.scrollAccel;
4254
+ }
4255
+ set scrollAcceleration(value) {
4256
+ this.scrollAccel = value;
4257
+ }
4229
4258
  destroySelf() {
4230
4259
  if (this.selectionListener) {
4231
4260
  this._ctx.off("selection", this.selectionListener);
@@ -4443,7 +4472,9 @@ export {
4443
4472
  MouseParser,
4444
4473
  MouseEvent,
4445
4474
  MouseButton,
4475
+ MacOSScrollAccel,
4446
4476
  LogLevel,
4477
+ LinearScrollAccel,
4447
4478
  LayoutEvents,
4448
4479
  KeyHandler,
4449
4480
  KeyEvent,
@@ -4475,5 +4506,5 @@ export {
4475
4506
  ASCIIFont
4476
4507
  };
4477
4508
 
4478
- //# debugId=E76E0BC5C702E8AC64756E2164756E21
4509
+ //# debugId=FC58789917A63DFA64756E2164756E21
4479
4510
  //# sourceMappingURL=index.js.map