@opentui/core 0.5.2 → 0.5.4
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/README.md +1 -1
- package/{chunk-bun-26r5c5w5.js → chunk-bun-1n307cze.js} +7 -6
- package/{chunk-bun-26r5c5w5.js.map → chunk-bun-1n307cze.js.map} +4 -4
- package/{chunk-bun-t68f2fmr.js → chunk-bun-gvv8cwwz.js} +14 -4
- package/{chunk-bun-t68f2fmr.js.map → chunk-bun-gvv8cwwz.js.map} +4 -4
- package/{chunk-node-aj3n20gq.js → chunk-node-crchpns1.js} +7 -6
- package/{chunk-node-aj3n20gq.js.map → chunk-node-crchpns1.js.map} +4 -4
- package/{chunk-node-kq7as74d.js → chunk-node-tq0x9mbj.js} +14 -4
- package/{chunk-node-kq7as74d.js.map → chunk-node-tq0x9mbj.js.map} +4 -4
- package/index.bun.js +30 -6
- package/index.bun.js.map +3 -3
- package/index.node.js +30 -6
- package/index.node.js.map +3 -3
- package/package.json +9 -9
- package/testing.bun.js +2 -2
- package/testing.js +2 -2
- package/utils.d.ts +2 -1
- package/yoga.bun.js +1 -1
- package/yoga.js +1 -1
- package/zig.d.ts +1 -1
package/index.bun.js
CHANGED
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
mergeKeyAliases,
|
|
45
45
|
mergeKeyBindings,
|
|
46
46
|
wrapWithDelegates
|
|
47
|
-
} from "./chunk-bun-
|
|
47
|
+
} from "./chunk-bun-gvv8cwwz.js";
|
|
48
48
|
import {
|
|
49
49
|
ASCIIFontSelectionHelper,
|
|
50
50
|
ATTRIBUTE_BASE_BITS,
|
|
@@ -204,7 +204,7 @@ import {
|
|
|
204
204
|
visualizeRenderableTree,
|
|
205
205
|
white,
|
|
206
206
|
yellow
|
|
207
|
-
} from "./chunk-bun-
|
|
207
|
+
} from "./chunk-bun-1n307cze.js";
|
|
208
208
|
// src/post/effects.ts
|
|
209
209
|
function toU8(value) {
|
|
210
210
|
return Math.round(Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * 255);
|
|
@@ -14831,6 +14831,30 @@ class TabSelectRenderable extends Renderable {
|
|
|
14831
14831
|
}
|
|
14832
14832
|
}
|
|
14833
14833
|
// src/renderables/TimeToFirstDraw.ts
|
|
14834
|
+
var graphemeSegmenter = new Intl.Segmenter(undefined, { granularity: "grapheme" });
|
|
14835
|
+
function measureCellWidth(buffer, text) {
|
|
14836
|
+
const encoded = buffer.encodeUnicode(text);
|
|
14837
|
+
if (!encoded)
|
|
14838
|
+
return 0;
|
|
14839
|
+
try {
|
|
14840
|
+
return encoded.data.reduce((width, glyph) => width + glyph.width, 0);
|
|
14841
|
+
} finally {
|
|
14842
|
+
buffer.freeUnicode(encoded);
|
|
14843
|
+
}
|
|
14844
|
+
}
|
|
14845
|
+
function truncateToCellWidth(buffer, text, maxWidth) {
|
|
14846
|
+
let visibleText = "";
|
|
14847
|
+
let visibleWidth = 0;
|
|
14848
|
+
for (const { segment } of graphemeSegmenter.segment(text)) {
|
|
14849
|
+
const segmentWidth = measureCellWidth(buffer, segment);
|
|
14850
|
+
if (visibleWidth + segmentWidth > maxWidth)
|
|
14851
|
+
break;
|
|
14852
|
+
visibleText += segment;
|
|
14853
|
+
visibleWidth += segmentWidth;
|
|
14854
|
+
}
|
|
14855
|
+
return { text: visibleText, width: visibleWidth };
|
|
14856
|
+
}
|
|
14857
|
+
|
|
14834
14858
|
class TimeToFirstDrawRenderable extends Renderable {
|
|
14835
14859
|
_runtimeMs = null;
|
|
14836
14860
|
textColor;
|
|
@@ -14883,9 +14907,9 @@ class TimeToFirstDrawRenderable extends Renderable {
|
|
|
14883
14907
|
}
|
|
14884
14908
|
const content = `${this.label}: ${this._runtimeMs.toFixed(this.precision)}ms`;
|
|
14885
14909
|
const maxWidth = Math.max(this.width, 1);
|
|
14886
|
-
const visibleContent =
|
|
14887
|
-
const centeredX = this.x + Math.max(0, Math.floor((maxWidth - visibleContent.
|
|
14888
|
-
buffer.drawText(visibleContent, centeredX, this.y, this.textColor);
|
|
14910
|
+
const visibleContent = truncateToCellWidth(buffer, content, maxWidth);
|
|
14911
|
+
const centeredX = this.x + Math.max(0, Math.floor((maxWidth - visibleContent.width) / 2));
|
|
14912
|
+
buffer.drawText(visibleContent.text, centeredX, this.y, this.textColor);
|
|
14889
14913
|
}
|
|
14890
14914
|
normalizePrecision(value) {
|
|
14891
14915
|
if (!Number.isFinite(value)) {
|
|
@@ -15173,5 +15197,5 @@ export {
|
|
|
15173
15197
|
ACHROMATOPSIA_MATRIX
|
|
15174
15198
|
};
|
|
15175
15199
|
|
|
15176
|
-
//# debugId=
|
|
15200
|
+
//# debugId=A848CCAED7419F3F64756E2164756E21
|
|
15177
15201
|
//# sourceMappingURL=index.bun.js.map
|