@opentui/core 0.5.13 → 0.5.15

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.bun.js CHANGED
@@ -160,7 +160,7 @@ import {
160
160
  setRenderLibPath2,
161
161
  resolveRenderLib2,
162
162
  exports_yoga
163
- } from "./chunk-bun-sjw2d9bq.js";
163
+ } from "./chunk-bun-6rvkxs1v.js";
164
164
  import {
165
165
  convertThemeToStyles2,
166
166
  SyntaxStyle2,
@@ -206,7 +206,7 @@ import {
206
206
  CliRenderEvents2,
207
207
  RendererControlState2,
208
208
  CliRenderer2
209
- } from "./chunk-bun-awdjbppg.js";
209
+ } from "./chunk-bun-3qwevekk.js";
210
210
  // src/post/effects.ts
211
211
  function toU8(value) {
212
212
  return Math.round(Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * 255);
@@ -6730,7 +6730,6 @@ class LineNumberRenderable extends Renderable2 {
6730
6730
  _lineNumberOffset;
6731
6731
  _hideLineNumbers;
6732
6732
  _lineNumbers;
6733
- _isDestroying = false;
6734
6733
  handleLineInfoChange = () => {
6735
6734
  this.gutter?.remeasure();
6736
6735
  this.requestRender();
@@ -6785,14 +6784,7 @@ class LineNumberRenderable extends Renderable2 {
6785
6784
  setTarget(target) {
6786
6785
  if (this.target === target)
6787
6786
  return;
6788
- if (this.target) {
6789
- this.target.off("line-info-change", this.handleLineInfoChange);
6790
- super.remove(this.target);
6791
- }
6792
- if (this.gutter) {
6793
- super.remove(this.gutter);
6794
- this.gutter = null;
6795
- }
6787
+ this.clearTarget();
6796
6788
  this.target = target;
6797
6789
  this.target.on("line-info-change", this.handleLineInfoChange);
6798
6790
  this.gutter = new GutterRenderable(this.ctx, this.target, {
@@ -6819,10 +6811,6 @@ class LineNumberRenderable extends Renderable2 {
6819
6811
  return -1;
6820
6812
  }
6821
6813
  remove(child) {
6822
- if (this._isDestroying) {
6823
- super.remove(child);
6824
- return;
6825
- }
6826
6814
  if (this.gutter && child === this.gutter) {
6827
6815
  throw new Error("LineNumberRenderable: Cannot remove gutter directly.");
6828
6816
  }
@@ -6832,13 +6820,14 @@ class LineNumberRenderable extends Renderable2 {
6832
6820
  super.remove(child);
6833
6821
  }
6834
6822
  destroyRecursively() {
6835
- this._isDestroying = true;
6836
- if (this.target) {
6837
- this.target.off("line-info-change", this.handleLineInfoChange);
6838
- }
6823
+ const target = this.target;
6824
+ this.clearTarget();
6825
+ target?.destroyRecursively();
6839
6826
  super.destroyRecursively();
6840
- this.gutter = null;
6841
- this.target = null;
6827
+ }
6828
+ destroy() {
6829
+ this.clearTarget();
6830
+ super.destroy();
6842
6831
  }
6843
6832
  clearTarget() {
6844
6833
  if (this.target) {
@@ -6848,6 +6837,7 @@ class LineNumberRenderable extends Renderable2 {
6848
6837
  }
6849
6838
  if (this.gutter) {
6850
6839
  super.remove(this.gutter);
6840
+ this.gutter.destroy();
6851
6841
  this.gutter = null;
6852
6842
  }
6853
6843
  }
@@ -7352,6 +7342,7 @@ class DiffRenderable extends Renderable2 {
7352
7342
  _fg;
7353
7343
  _filetype;
7354
7344
  _syntaxStyle;
7345
+ _defaultSyntaxStyle;
7355
7346
  _wrapMode;
7356
7347
  _conceal;
7357
7348
  _selectionBg;
@@ -7540,12 +7531,26 @@ class DiffRenderable extends Renderable2 {
7540
7531
  }
7541
7532
  this._lineInfoChangeHandler = null;
7542
7533
  }
7543
- destroyRecursively() {
7534
+ destroySelf() {
7544
7535
  this.detachLineInfoListeners();
7545
7536
  this.pendingRebuild = false;
7546
7537
  this.leftSideAdded = false;
7547
7538
  this.rightSideAdded = false;
7548
- super.destroyRecursively();
7539
+ for (const node of [this.leftSide, this.rightSide, this.errorTextRenderable, this.errorCodeRenderable]) {
7540
+ node?.destroyRecursively();
7541
+ }
7542
+ this.leftSide = null;
7543
+ this.rightSide = null;
7544
+ this.leftCodeRenderable = null;
7545
+ this.rightCodeRenderable = null;
7546
+ this.errorTextRenderable = null;
7547
+ this.errorCodeRenderable = null;
7548
+ this._defaultSyntaxStyle?.destroy();
7549
+ this._defaultSyntaxStyle = undefined;
7550
+ super.destroySelf();
7551
+ }
7552
+ getCodeSyntaxStyle() {
7553
+ return this._syntaxStyle ?? (this._defaultSyntaxStyle ??= SyntaxStyle2.create());
7549
7554
  }
7550
7555
  buildErrorView() {
7551
7556
  this.flexDirection = "column";
@@ -7580,7 +7585,7 @@ class DiffRenderable extends Renderable2 {
7580
7585
  id: this.id ? `${this.id}-error-code` : undefined,
7581
7586
  content: this._diff,
7582
7587
  filetype: "diff",
7583
- syntaxStyle: this._syntaxStyle ?? SyntaxStyle2.create(),
7588
+ syntaxStyle: this.getCodeSyntaxStyle(),
7584
7589
  wrapMode: this._wrapMode,
7585
7590
  conceal: this._conceal,
7586
7591
  width: "100%",
@@ -7610,7 +7615,7 @@ class DiffRenderable extends Renderable2 {
7610
7615
  filetype: this._filetype,
7611
7616
  wrapMode,
7612
7617
  conceal: this._conceal,
7613
- syntaxStyle: this._syntaxStyle ?? SyntaxStyle2.create(),
7618
+ syntaxStyle: this.getCodeSyntaxStyle(),
7614
7619
  width: "100%",
7615
7620
  height: "100%",
7616
7621
  ...this._fg !== undefined && { fg: this._fg },
@@ -15908,5 +15913,5 @@ export {
15908
15913
  yellow2 as yellow
15909
15914
  };
15910
15915
 
15911
- //# debugId=113BFC03ED86E2A964756E2164756E21
15916
+ //# debugId=93462D808245BC6D64756E2164756E21
15912
15917
  //# sourceMappingURL=index.bun.js.map