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