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