@opentui/core 0.6.4 → 0.6.6
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/Renderable.d.ts +27 -9
- package/{chunk-bun-qphgryjx.js → chunk-bun-6qjat6qa.js} +128 -133
- package/{chunk-node-j1h89sfg.js.map → chunk-bun-6qjat6qa.js.map} +8 -8
- package/{chunk-bun-e2gttx65.js → chunk-bun-jztcnb74.js} +22 -15
- package/chunk-bun-jztcnb74.js.map +35 -0
- package/{chunk-node-j1h89sfg.js → chunk-node-2rg7pskw.js} +128 -133
- package/{chunk-bun-qphgryjx.js.map → chunk-node-2rg7pskw.js.map} +8 -8
- package/{chunk-node-6rc18den.js → chunk-node-p43t2gam.js} +22 -15
- package/chunk-node-p43t2gam.js.map +34 -0
- package/index.bun.js +39 -12
- package/index.bun.js.map +8 -8
- package/index.node.js +39 -12
- package/index.node.js.map +8 -8
- package/package.json +9 -9
- package/renderables/ASCIIFont.d.ts +1 -0
- package/renderables/Box.d.ts +4 -3
- package/renderables/EmbeddedTerminal.d.ts +2 -0
- package/renderables/Input.d.ts +1 -0
- package/renderables/ScrollBar.d.ts +2 -0
- package/renderables/TabSelect.d.ts +1 -0
- package/renderables/TimeToFirstDraw.d.ts +1 -0
- package/testing.bun.js +2 -2
- package/testing.js +2 -2
- package/yoga.bun.js +1 -1
- package/yoga.js +1 -1
- package/zig.d.ts +3 -3
- package/chunk-bun-e2gttx65.js.map +0 -35
- package/chunk-node-6rc18den.js.map +0 -34
package/index.node.js
CHANGED
|
@@ -109,7 +109,7 @@ import {
|
|
|
109
109
|
resolveRenderLib2,
|
|
110
110
|
MeasureMode2,
|
|
111
111
|
exports_yoga
|
|
112
|
-
} from "./chunk-node-
|
|
112
|
+
} from "./chunk-node-p43t2gam.js";
|
|
113
113
|
import {
|
|
114
114
|
isValidBorderStyle2,
|
|
115
115
|
parseBorderStyle2,
|
|
@@ -241,7 +241,7 @@ import {
|
|
|
241
241
|
CliRenderEvents2,
|
|
242
242
|
RendererControlState2,
|
|
243
243
|
CliRenderer2
|
|
244
|
-
} from "./chunk-node-
|
|
244
|
+
} from "./chunk-node-2rg7pskw.js";
|
|
245
245
|
// src/post/effects.ts
|
|
246
246
|
function toU8(value) {
|
|
247
247
|
return Math.round(Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * 255);
|
|
@@ -5692,6 +5692,9 @@ class ASCIIFontRenderable extends FrameBufferRenderable {
|
|
|
5692
5692
|
this.renderFontToBuffer();
|
|
5693
5693
|
this.requestRender();
|
|
5694
5694
|
}
|
|
5695
|
+
defaultDimension(kind) {
|
|
5696
|
+
return measureText2({ text: this._text, font: this._font })[kind] || 1;
|
|
5697
|
+
}
|
|
5695
5698
|
updateDimensions() {
|
|
5696
5699
|
const measurements = measureText2({ text: this._text, font: this._font });
|
|
5697
5700
|
this.width = measurements.width;
|
|
@@ -7819,6 +7822,7 @@ class EmbeddedTerminalRenderable extends Renderable2 {
|
|
|
7819
7822
|
selection = false;
|
|
7820
7823
|
composedHookGeneration = 0n;
|
|
7821
7824
|
_transparentBackground = false;
|
|
7825
|
+
sizeDefaults;
|
|
7822
7826
|
constructor(ctx, options) {
|
|
7823
7827
|
const cols = options.cols ?? (typeof options.width === "number" ? options.width : 80);
|
|
7824
7828
|
const rows = options.rows ?? (typeof options.height === "number" ? options.height : 24);
|
|
@@ -7830,6 +7834,7 @@ class EmbeddedTerminalRenderable extends Renderable2 {
|
|
|
7830
7834
|
});
|
|
7831
7835
|
this._focusable = true;
|
|
7832
7836
|
this.lib = ctx.nativeScene.driver.renderLib;
|
|
7837
|
+
this.sizeDefaults = { width: options.cols ?? 80, height: options.rows ?? 24 };
|
|
7833
7838
|
try {
|
|
7834
7839
|
this._onData = options.onData;
|
|
7835
7840
|
this._onTerminalResize = options.onTerminalResize;
|
|
@@ -7843,6 +7848,9 @@ class EmbeddedTerminalRenderable extends Renderable2 {
|
|
|
7843
7848
|
this.rollbackConstruction(error);
|
|
7844
7849
|
}
|
|
7845
7850
|
}
|
|
7851
|
+
defaultDimension(kind) {
|
|
7852
|
+
return this.sizeDefaults[kind];
|
|
7853
|
+
}
|
|
7846
7854
|
get onData() {
|
|
7847
7855
|
return this._onData;
|
|
7848
7856
|
}
|
|
@@ -8631,6 +8639,9 @@ class InputRenderable extends TextareaRenderable {
|
|
|
8631
8639
|
this.emit("input" /* INPUT */, this.plainText);
|
|
8632
8640
|
});
|
|
8633
8641
|
}
|
|
8642
|
+
defaultDimension(kind) {
|
|
8643
|
+
return kind === "height" ? 1 : super.defaultDimension(kind);
|
|
8644
|
+
}
|
|
8634
8645
|
get value() {
|
|
8635
8646
|
return this.plainText;
|
|
8636
8647
|
}
|
|
@@ -13206,6 +13217,10 @@ class ScrollBarRenderable extends Renderable2 {
|
|
|
13206
13217
|
return super.visible;
|
|
13207
13218
|
}
|
|
13208
13219
|
set visible(value) {
|
|
13220
|
+
if (value == null) {
|
|
13221
|
+
this.resetVisibilityControl();
|
|
13222
|
+
return;
|
|
13223
|
+
}
|
|
13209
13224
|
this._manualVisibility = true;
|
|
13210
13225
|
super.visible = value;
|
|
13211
13226
|
}
|
|
@@ -13278,6 +13293,7 @@ class ScrollBarRenderable extends Renderable2 {
|
|
|
13278
13293
|
return this._showArrows;
|
|
13279
13294
|
}
|
|
13280
13295
|
set showArrows(value) {
|
|
13296
|
+
value ??= false;
|
|
13281
13297
|
if (this.isDestroyed || value === this._showArrows)
|
|
13282
13298
|
return;
|
|
13283
13299
|
this.assertMutable();
|
|
@@ -13520,15 +13536,8 @@ class ArrowRenderable extends Renderable2 {
|
|
|
13520
13536
|
right: "▶",
|
|
13521
13537
|
...options.arrowChars
|
|
13522
13538
|
};
|
|
13523
|
-
if (!options.width)
|
|
13524
|
-
|
|
13525
|
-
const unicode = renderLib.createContextUnicode(context, this.getArrowChar(), ctx.widthMethod);
|
|
13526
|
-
try {
|
|
13527
|
-
this.width = renderLib.getContextUnicode(context, unicode).reduce((width, glyph) => width + glyph.width, 0);
|
|
13528
|
-
} finally {
|
|
13529
|
-
renderLib.destroyContextUnicode(context, unicode);
|
|
13530
|
-
}
|
|
13531
|
-
}
|
|
13539
|
+
if (!options.width)
|
|
13540
|
+
this.width = this.glyphWidth();
|
|
13532
13541
|
this.setNativeSceneArrow();
|
|
13533
13542
|
this.setNativeScenePaint();
|
|
13534
13543
|
} catch (error) {
|
|
@@ -13599,6 +13608,18 @@ class ArrowRenderable extends Renderable2 {
|
|
|
13599
13608
|
const char = this.getArrowChar();
|
|
13600
13609
|
buffer.drawText(char, this.x, this.y, this._foregroundColor, this._backgroundColor, this._attributes);
|
|
13601
13610
|
}
|
|
13611
|
+
defaultDimension(kind) {
|
|
13612
|
+
return kind === "width" ? this.glyphWidth() : super.defaultDimension(kind);
|
|
13613
|
+
}
|
|
13614
|
+
glyphWidth() {
|
|
13615
|
+
const { context, renderLib } = this._ctx.nativeScene.driver;
|
|
13616
|
+
const unicode = renderLib.createContextUnicode(context, this.getArrowChar(), this._ctx.widthMethod);
|
|
13617
|
+
try {
|
|
13618
|
+
return renderLib.getContextUnicode(context, unicode).reduce((width, glyph) => width + glyph.width, 0);
|
|
13619
|
+
} finally {
|
|
13620
|
+
renderLib.destroyContextUnicode(context, unicode);
|
|
13621
|
+
}
|
|
13622
|
+
}
|
|
13602
13623
|
getArrowChar() {
|
|
13603
13624
|
return this._arrowChars[this._direction];
|
|
13604
13625
|
}
|
|
@@ -14789,6 +14810,9 @@ class TabSelectRenderable extends Renderable2 {
|
|
|
14789
14810
|
calculateDynamicHeight() {
|
|
14790
14811
|
return calculateDynamicHeight(this._showUnderline, this._showDescription);
|
|
14791
14812
|
}
|
|
14813
|
+
defaultDimension(kind) {
|
|
14814
|
+
return kind === "height" ? this.calculateDynamicHeight() : super.defaultDimension(kind);
|
|
14815
|
+
}
|
|
14792
14816
|
renderSelf(buffer, deltaTime) {
|
|
14793
14817
|
if (!this.visible || !this.frameBuffer)
|
|
14794
14818
|
return;
|
|
@@ -15080,6 +15104,9 @@ class TimeToFirstDrawRenderable extends Renderable2 {
|
|
|
15080
15104
|
this.label = options.label ?? "Time to first draw";
|
|
15081
15105
|
this.precision = this.normalizePrecision(options.precision ?? 2);
|
|
15082
15106
|
}
|
|
15107
|
+
defaultDimension(kind) {
|
|
15108
|
+
return kind === "width" ? "100%" : 1;
|
|
15109
|
+
}
|
|
15083
15110
|
get runtimeMs() {
|
|
15084
15111
|
return this._runtimeMs;
|
|
15085
15112
|
}
|
|
@@ -15434,5 +15461,5 @@ export {
|
|
|
15434
15461
|
yellow2 as yellow
|
|
15435
15462
|
};
|
|
15436
15463
|
|
|
15437
|
-
//# debugId=
|
|
15464
|
+
//# debugId=C1B12A177A7D3E0364756E2164756E21
|
|
15438
15465
|
//# sourceMappingURL=index.node.js.map
|