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