@opentui/core 0.1.80 → 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/index.js CHANGED
@@ -153,7 +153,7 @@ import {
153
153
  white,
154
154
  wrapWithDelegates,
155
155
  yellow
156
- } from "./index-vnvba6q9.js";
156
+ } from "./index-ve2seej0.js";
157
157
  // src/text-buffer-view.ts
158
158
  class TextBufferView {
159
159
  lib;
@@ -6908,9 +6908,10 @@ class TextareaRenderable extends EditBufferRenderable {
6908
6908
  return this._placeholder;
6909
6909
  }
6910
6910
  set placeholder(value) {
6911
- if (this._placeholder !== value) {
6912
- this._placeholder = value;
6913
- this.applyPlaceholder(value);
6911
+ const normalizedValue = value ?? null;
6912
+ if (this._placeholder !== normalizedValue) {
6913
+ this._placeholder = normalizedValue;
6914
+ this.applyPlaceholder(normalizedValue);
6914
6915
  this.requestRender();
6915
6916
  }
6916
6917
  }
@@ -9814,13 +9815,13 @@ class ScrollBoxRenderable extends BoxRenderable {
9814
9815
  if (this.scrollTop <= 0) {
9815
9816
  this._stickyScrollTop = true;
9816
9817
  this._stickyScrollBottom = false;
9817
- if (this._stickyStart === "top" || this._stickyStart === "bottom" && maxScrollTop === 0) {
9818
+ if (!this._isApplyingStickyScroll && (this._stickyStart === "top" || this._stickyStart === "bottom" && maxScrollTop === 0)) {
9818
9819
  this._hasManualScroll = false;
9819
9820
  }
9820
9821
  } else if (this.scrollTop >= maxScrollTop) {
9821
9822
  this._stickyScrollTop = false;
9822
9823
  this._stickyScrollBottom = true;
9823
- if (this._stickyStart === "bottom") {
9824
+ if (!this._isApplyingStickyScroll && this._stickyStart === "bottom") {
9824
9825
  this._hasManualScroll = false;
9825
9826
  }
9826
9827
  } else {
@@ -9830,13 +9831,13 @@ class ScrollBoxRenderable extends BoxRenderable {
9830
9831
  if (this.scrollLeft <= 0) {
9831
9832
  this._stickyScrollLeft = true;
9832
9833
  this._stickyScrollRight = false;
9833
- if (this._stickyStart === "left" || this._stickyStart === "right" && maxScrollLeft === 0) {
9834
+ if (!this._isApplyingStickyScroll && (this._stickyStart === "left" || this._stickyStart === "right" && maxScrollLeft === 0)) {
9834
9835
  this._hasManualScroll = false;
9835
9836
  }
9836
9837
  } else if (this.scrollLeft >= maxScrollLeft) {
9837
9838
  this._stickyScrollLeft = false;
9838
9839
  this._stickyScrollRight = true;
9839
- if (this._stickyStart === "right") {
9840
+ if (!this._isApplyingStickyScroll && this._stickyStart === "right") {
9840
9841
  this._hasManualScroll = false;
9841
9842
  }
9842
9843
  } else {
@@ -9845,30 +9846,34 @@ class ScrollBoxRenderable extends BoxRenderable {
9845
9846
  }
9846
9847
  }
9847
9848
  applyStickyStart(stickyStart) {
9849
+ const wasApplyingStickyScroll = this._isApplyingStickyScroll;
9848
9850
  this._isApplyingStickyScroll = true;
9849
- switch (stickyStart) {
9850
- case "top":
9851
- this._stickyScrollTop = true;
9852
- this._stickyScrollBottom = false;
9853
- this.verticalScrollBar.scrollPosition = 0;
9854
- break;
9855
- case "bottom":
9856
- this._stickyScrollTop = false;
9857
- this._stickyScrollBottom = true;
9858
- this.verticalScrollBar.scrollPosition = Math.max(0, this.scrollHeight - this.viewport.height);
9859
- break;
9860
- case "left":
9861
- this._stickyScrollLeft = true;
9862
- this._stickyScrollRight = false;
9863
- this.horizontalScrollBar.scrollPosition = 0;
9864
- break;
9865
- case "right":
9866
- this._stickyScrollLeft = false;
9867
- this._stickyScrollRight = true;
9868
- this.horizontalScrollBar.scrollPosition = Math.max(0, this.scrollWidth - this.viewport.width);
9869
- break;
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;
9870
9876
  }
9871
- this._isApplyingStickyScroll = false;
9872
9877
  }
9873
9878
  constructor(ctx, {
9874
9879
  wrapperOptions,
@@ -10208,29 +10213,32 @@ class ScrollBoxRenderable extends BoxRenderable {
10208
10213
  recalculateBarProps() {
10209
10214
  const wasApplyingStickyScroll = this._isApplyingStickyScroll;
10210
10215
  this._isApplyingStickyScroll = true;
10211
- this.verticalScrollBar.scrollSize = this.content.height;
10212
- this.verticalScrollBar.viewportSize = this.viewport.height;
10213
- this.horizontalScrollBar.scrollSize = this.content.width;
10214
- this.horizontalScrollBar.viewportSize = this.viewport.width;
10215
- if (this._stickyScroll) {
10216
- const newMaxScrollTop = Math.max(0, this.scrollHeight - this.viewport.height);
10217
- const newMaxScrollLeft = Math.max(0, this.scrollWidth - this.viewport.width);
10218
- if (this._stickyStart && !this._hasManualScroll) {
10219
- this.applyStickyStart(this._stickyStart);
10220
- } else {
10221
- if (this._stickyScrollTop) {
10222
- this.scrollTop = 0;
10223
- } else if (this._stickyScrollBottom && newMaxScrollTop > 0) {
10224
- this.scrollTop = newMaxScrollTop;
10225
- }
10226
- if (this._stickyScrollLeft) {
10227
- this.scrollLeft = 0;
10228
- } else if (this._stickyScrollRight && newMaxScrollLeft > 0) {
10229
- this.scrollLeft = newMaxScrollLeft;
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
+ }
10230
10237
  }
10231
10238
  }
10239
+ } finally {
10240
+ this._isApplyingStickyScroll = wasApplyingStickyScroll;
10232
10241
  }
10233
- this._isApplyingStickyScroll = wasApplyingStickyScroll;
10234
10242
  process.nextTick(() => {
10235
10243
  this.requestRender();
10236
10244
  });
@@ -11198,5 +11206,5 @@ export {
11198
11206
  ASCIIFont
11199
11207
  };
11200
11208
 
11201
- //# debugId=3CB381A14248B1EF64756E2164756E21
11209
+ //# debugId=B77F27E92D33B1E964756E2164756E21
11202
11210
  //# sourceMappingURL=index.js.map