@opentui/core 0.0.0-20250918-7ff2578a → 0.0.0-20250919-6683564e
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/3d.js +1 -1
- package/Renderable.d.ts +5 -1
- package/{index-9skjt1d2.js → index-0yx9rnxg.js} +3380 -3331
- package/{index-9skjt1d2.js.map → index-0yx9rnxg.js.map} +11 -11
- package/index.d.ts +1 -0
- package/index.js +48 -21
- package/index.js.map +4 -4
- package/package.json +9 -12
- package/renderables/ScrollBox.d.ts +3 -1
- package/renderables/Text.d.ts +10 -0
- package/renderer.d.ts +2 -0
- package/testing.js +1 -1
- package/text-buffer.d.ts +6 -9
- package/zig.d.ts +9 -8
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
KeyHandler,
|
|
14
14
|
LayoutEvents,
|
|
15
15
|
LogLevel,
|
|
16
|
-
MeasureMode,
|
|
17
16
|
MouseButton,
|
|
18
17
|
MouseEvent,
|
|
19
18
|
MouseParser,
|
|
@@ -58,6 +57,7 @@ import {
|
|
|
58
57
|
cyan,
|
|
59
58
|
delegate,
|
|
60
59
|
dim,
|
|
60
|
+
exports_src,
|
|
61
61
|
fg,
|
|
62
62
|
fonts,
|
|
63
63
|
getBorderFromSides,
|
|
@@ -111,7 +111,7 @@ import {
|
|
|
111
111
|
white,
|
|
112
112
|
wrapWithDelegates,
|
|
113
113
|
yellow
|
|
114
|
-
} from "./index-
|
|
114
|
+
} from "./index-0yx9rnxg.js";
|
|
115
115
|
// src/post/filters.ts
|
|
116
116
|
function applyScanlines(buffer, strength = 0.8, step = 2) {
|
|
117
117
|
const width = buffer.width;
|
|
@@ -1672,9 +1672,11 @@ class TextRenderable extends Renderable {
|
|
|
1672
1672
|
_defaultAttributes;
|
|
1673
1673
|
_selectionBg;
|
|
1674
1674
|
_selectionFg;
|
|
1675
|
+
_wrap = false;
|
|
1676
|
+
_wrapMode = "word";
|
|
1675
1677
|
lastLocalSelection = null;
|
|
1676
1678
|
textBuffer;
|
|
1677
|
-
_lineInfo = { lineStarts: [], lineWidths: [] };
|
|
1679
|
+
_lineInfo = { lineStarts: [], lineWidths: [], maxLineWidth: 0 };
|
|
1678
1680
|
rootTextNode;
|
|
1679
1681
|
_defaultOptions = {
|
|
1680
1682
|
content: "",
|
|
@@ -1683,7 +1685,9 @@ class TextRenderable extends Renderable {
|
|
|
1683
1685
|
selectionBg: undefined,
|
|
1684
1686
|
selectionFg: undefined,
|
|
1685
1687
|
selectable: true,
|
|
1686
|
-
attributes: 0
|
|
1688
|
+
attributes: 0,
|
|
1689
|
+
wrap: true,
|
|
1690
|
+
wrapMode: "word"
|
|
1687
1691
|
};
|
|
1688
1692
|
constructor(ctx, options) {
|
|
1689
1693
|
super(ctx, options);
|
|
@@ -1696,7 +1700,13 @@ class TextRenderable extends Renderable {
|
|
|
1696
1700
|
this._selectionBg = options.selectionBg ? parseColor(options.selectionBg) : this._defaultOptions.selectionBg;
|
|
1697
1701
|
this._selectionFg = options.selectionFg ? parseColor(options.selectionFg) : this._defaultOptions.selectionFg;
|
|
1698
1702
|
this.selectable = options.selectable ?? this._defaultOptions.selectable;
|
|
1699
|
-
this.
|
|
1703
|
+
this._wrap = options.wrap ?? this._defaultOptions.wrap;
|
|
1704
|
+
this._wrapMode = options.wrapMode ?? this._defaultOptions.wrapMode;
|
|
1705
|
+
this.textBuffer = TextBuffer.create(this._ctx.widthMethod);
|
|
1706
|
+
this.textBuffer.setWrapMode(this._wrapMode);
|
|
1707
|
+
if (this._wrap) {
|
|
1708
|
+
this.textBuffer.setWrapWidth(this.width > 0 ? this.width : 40);
|
|
1709
|
+
}
|
|
1700
1710
|
this.textBuffer.setDefaultFg(this._defaultFg);
|
|
1701
1711
|
this.textBuffer.setDefaultBg(this._defaultBg);
|
|
1702
1712
|
this.textBuffer.setDefaultAttributes(this._defaultAttributes);
|
|
@@ -1803,8 +1813,31 @@ class TextRenderable extends Renderable {
|
|
|
1803
1813
|
this.requestRender();
|
|
1804
1814
|
}
|
|
1805
1815
|
}
|
|
1816
|
+
get wrap() {
|
|
1817
|
+
return this._wrap;
|
|
1818
|
+
}
|
|
1819
|
+
set wrap(value) {
|
|
1820
|
+
if (this._wrap !== value) {
|
|
1821
|
+
this._wrap = value;
|
|
1822
|
+
this.textBuffer.setWrapWidth(this._wrap ? this.width : null);
|
|
1823
|
+
this.requestRender();
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
get wrapMode() {
|
|
1827
|
+
return this._wrapMode;
|
|
1828
|
+
}
|
|
1829
|
+
set wrapMode(value) {
|
|
1830
|
+
if (this._wrapMode !== value) {
|
|
1831
|
+
this._wrapMode = value;
|
|
1832
|
+
this.textBuffer.setWrapMode(this._wrapMode);
|
|
1833
|
+
this.requestRender();
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1806
1836
|
onResize(width, height) {
|
|
1807
|
-
if (this.
|
|
1837
|
+
if (this._wrap) {
|
|
1838
|
+
this.textBuffer.setWrapWidth(width);
|
|
1839
|
+
this.updateTextInfo();
|
|
1840
|
+
} else if (this.lastLocalSelection) {
|
|
1808
1841
|
const changed = this.updateLocalSelection(this.lastLocalSelection);
|
|
1809
1842
|
if (changed) {
|
|
1810
1843
|
this.requestRender();
|
|
@@ -1822,6 +1855,7 @@ class TextRenderable extends Renderable {
|
|
|
1822
1855
|
const lineInfo = this.textBuffer.lineInfo;
|
|
1823
1856
|
this._lineInfo.lineStarts = lineInfo.lineStarts;
|
|
1824
1857
|
this._lineInfo.lineWidths = lineInfo.lineWidths;
|
|
1858
|
+
this._lineInfo.maxLineWidth = lineInfo.maxLineWidth;
|
|
1825
1859
|
if (this.lastLocalSelection) {
|
|
1826
1860
|
const changed = this.updateLocalSelection(this.lastLocalSelection);
|
|
1827
1861
|
if (changed) {
|
|
@@ -1833,20 +1867,10 @@ class TextRenderable extends Renderable {
|
|
|
1833
1867
|
}
|
|
1834
1868
|
setupMeasureFunc() {
|
|
1835
1869
|
const measureFunc = (width, widthMode, height, heightMode) => {
|
|
1836
|
-
const maxLineWidth =
|
|
1837
|
-
const numLines = this._lineInfo.lineStarts.length
|
|
1870
|
+
const maxLineWidth = this._lineInfo.maxLineWidth;
|
|
1871
|
+
const numLines = this._lineInfo.lineStarts.length;
|
|
1838
1872
|
let measuredWidth = maxLineWidth;
|
|
1839
1873
|
let measuredHeight = numLines;
|
|
1840
|
-
if (widthMode === MeasureMode.Exactly) {
|
|
1841
|
-
measuredWidth = width;
|
|
1842
|
-
} else if (widthMode === MeasureMode.AtMost) {
|
|
1843
|
-
measuredWidth = Math.min(maxLineWidth, width);
|
|
1844
|
-
}
|
|
1845
|
-
if (heightMode === MeasureMode.Exactly) {
|
|
1846
|
-
measuredHeight = height;
|
|
1847
|
-
} else if (heightMode === MeasureMode.AtMost) {
|
|
1848
|
-
measuredHeight = Math.min(numLines, height);
|
|
1849
|
-
}
|
|
1850
1874
|
return {
|
|
1851
1875
|
width: Math.max(1, measuredWidth),
|
|
1852
1876
|
height: Math.max(1, measuredHeight)
|
|
@@ -3733,6 +3757,8 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
3733
3757
|
horizontalScrollbarOptions,
|
|
3734
3758
|
stickyScroll = false,
|
|
3735
3759
|
stickyStart,
|
|
3760
|
+
scrollX = false,
|
|
3761
|
+
scrollY = true,
|
|
3736
3762
|
...options
|
|
3737
3763
|
}) {
|
|
3738
3764
|
super(ctx, {
|
|
@@ -3767,8 +3793,8 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
3767
3793
|
this.wrapper.add(this.viewport);
|
|
3768
3794
|
this.content = new ContentRenderable(ctx, this.viewport, {
|
|
3769
3795
|
alignSelf: "flex-start",
|
|
3770
|
-
minWidth: "100%",
|
|
3771
|
-
minHeight: "100%",
|
|
3796
|
+
...scrollX ? { minWidth: "100%" } : { minWidth: "100%", maxWidth: "100%" },
|
|
3797
|
+
...scrollY ? { minHeight: "100%" } : { minHeight: "100%", maxHeight: "100%" },
|
|
3772
3798
|
onSizeChange: () => {
|
|
3773
3799
|
this.recalculateBarProps();
|
|
3774
3800
|
},
|
|
@@ -4213,6 +4239,7 @@ export {
|
|
|
4213
4239
|
applyGrayscale,
|
|
4214
4240
|
applyChromaticAberration,
|
|
4215
4241
|
applyAsciiArt,
|
|
4242
|
+
exports_src as Yoga,
|
|
4216
4243
|
VignetteEffect,
|
|
4217
4244
|
VRenderable,
|
|
4218
4245
|
Timeline,
|
|
@@ -4270,5 +4297,5 @@ export {
|
|
|
4270
4297
|
ASCIIFont
|
|
4271
4298
|
};
|
|
4272
4299
|
|
|
4273
|
-
//# debugId=
|
|
4300
|
+
//# debugId=5FB73C20BB0792E864756E2164756E21
|
|
4274
4301
|
//# sourceMappingURL=index.js.map
|