@opentui/core 0.6.6 → 0.6.7
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/{chunk-bun-jztcnb74.js → chunk-bun-ehr9v0n8.js} +43 -43
- package/{chunk-bun-jztcnb74.js.map → chunk-bun-ehr9v0n8.js.map} +4 -4
- package/{chunk-bun-6qjat6qa.js → chunk-bun-rk6266v5.js} +33 -37
- package/{chunk-bun-6qjat6qa.js.map → chunk-bun-rk6266v5.js.map} +5 -5
- package/{chunk-node-p43t2gam.js → chunk-node-jhq62x0c.js} +43 -43
- package/{chunk-node-p43t2gam.js.map → chunk-node-jhq62x0c.js.map} +4 -4
- package/{chunk-node-2rg7pskw.js → chunk-node-y5p1g2pb.js} +33 -37
- package/{chunk-node-2rg7pskw.js.map → chunk-node-y5p1g2pb.js.map} +5 -5
- package/index.bun.js +59 -20
- package/index.bun.js.map +4 -4
- package/index.node.js +59 -20
- package/index.node.js.map +4 -4
- package/package.json +9 -9
- package/renderables/Diff.d.ts +16 -0
- package/renderables/LineNumberRenderable.d.ts +13 -2
- package/renderer.d.ts +1 -1
- package/testing.bun.js +2 -2
- package/testing.js +2 -2
- package/yoga.bun.js +1 -1
- package/yoga.js +1 -1
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-ehr9v0n8.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-rk6266v5.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);
|
|
@@ -5860,8 +5860,7 @@ class GutterRenderable extends Renderable2 {
|
|
|
5860
5860
|
target;
|
|
5861
5861
|
_fg;
|
|
5862
5862
|
_bg;
|
|
5863
|
-
|
|
5864
|
-
_paddingRight;
|
|
5863
|
+
_layout;
|
|
5865
5864
|
_lineColorsGutter;
|
|
5866
5865
|
_lineColorsContent;
|
|
5867
5866
|
_lineSigns;
|
|
@@ -5885,8 +5884,7 @@ class GutterRenderable extends Renderable2 {
|
|
|
5885
5884
|
this.target = target;
|
|
5886
5885
|
this._fg = options.fg;
|
|
5887
5886
|
this._bg = options.bg;
|
|
5888
|
-
this.
|
|
5889
|
-
this._paddingRight = options.paddingRight;
|
|
5887
|
+
this._layout = options.layout;
|
|
5890
5888
|
this._lineColorsGutter = options.lineColorsGutter;
|
|
5891
5889
|
this._lineColorsContent = options.lineColorsContent;
|
|
5892
5890
|
this._lineSigns = options.lineSigns;
|
|
@@ -5940,9 +5938,15 @@ class GutterRenderable extends Renderable2 {
|
|
|
5940
5938
|
this.invalidateIntrinsicSize();
|
|
5941
5939
|
this.requestRender();
|
|
5942
5940
|
}
|
|
5941
|
+
setLayout(layout) {
|
|
5942
|
+
this._layout = layout;
|
|
5943
|
+
this.calculateSignWidths();
|
|
5944
|
+
this.invalidateIntrinsicSize();
|
|
5945
|
+
this.requestRender();
|
|
5946
|
+
}
|
|
5943
5947
|
calculateSignWidths() {
|
|
5944
5948
|
this._maxBeforeWidth = 0;
|
|
5945
|
-
this._maxAfterWidth =
|
|
5949
|
+
this._maxAfterWidth = this._layout.minAfterWidth;
|
|
5946
5950
|
for (const sign of this._lineSigns.values()) {
|
|
5947
5951
|
if (sign.before) {
|
|
5948
5952
|
const width = stringWidth(sign.before);
|
|
@@ -5962,8 +5966,8 @@ class GutterRenderable extends Renderable2 {
|
|
|
5962
5966
|
maxLineNumber = Math.max(maxLineNumber, customLineNum);
|
|
5963
5967
|
}
|
|
5964
5968
|
}
|
|
5965
|
-
const digits = maxLineNumber > 0 ? Math.floor(Math.log10(maxLineNumber)) + 1 : 1;
|
|
5966
|
-
const baseWidth = Math.max(this.
|
|
5969
|
+
const digits = Math.max(maxLineNumber > 0 ? Math.floor(Math.log10(maxLineNumber)) + 1 : 1, this._layout.minDigits);
|
|
5970
|
+
const baseWidth = Math.max(this._layout.minWidth, digits + this._layout.paddingLeft + this._layout.paddingRight);
|
|
5967
5971
|
return baseWidth + this._maxBeforeWidth + this._maxAfterWidth;
|
|
5968
5972
|
}
|
|
5969
5973
|
setLineColors(lineColorsGutter, lineColorsContent) {
|
|
@@ -6068,14 +6072,13 @@ class GutterRenderable extends Renderable2 {
|
|
|
6068
6072
|
const lineNum = customLineNum !== undefined ? customLineNum : logicalLine + 1 + this._lineNumberOffset;
|
|
6069
6073
|
const lineNumStr = lineNum.toString();
|
|
6070
6074
|
const lineNumWidth = lineNumStr.length;
|
|
6071
|
-
const
|
|
6072
|
-
|
|
6073
|
-
if (lineNumX >= this._maxBeforeWidth + 1) {
|
|
6075
|
+
const lineNumX = this.width - this._maxAfterWidth - this._layout.paddingRight - lineNumWidth;
|
|
6076
|
+
if (lineNumX >= this._maxBeforeWidth + this._layout.paddingLeft) {
|
|
6074
6077
|
buffer.drawText(lineNumStr, lineNumX, i, this._fg, lineBg);
|
|
6075
6078
|
}
|
|
6076
6079
|
}
|
|
6077
6080
|
if (sign?.after) {
|
|
6078
|
-
const afterX = this.width - this.
|
|
6081
|
+
const afterX = this.width - this._layout.paddingRight - this._maxAfterWidth;
|
|
6079
6082
|
const afterColor = sign.afterColor ? parseColor2(sign.afterColor) : this._fg;
|
|
6080
6083
|
buffer.drawText(sign.after, afterX, i, afterColor, lineBg);
|
|
6081
6084
|
}
|
|
@@ -6101,8 +6104,7 @@ class LineNumberRenderable extends Renderable2 {
|
|
|
6101
6104
|
_lineSigns;
|
|
6102
6105
|
_fg;
|
|
6103
6106
|
_bg;
|
|
6104
|
-
|
|
6105
|
-
_paddingRight;
|
|
6107
|
+
_layout;
|
|
6106
6108
|
_lineNumberOffset;
|
|
6107
6109
|
_hideLineNumbers;
|
|
6108
6110
|
_lineNumbers;
|
|
@@ -6137,8 +6139,13 @@ class LineNumberRenderable extends Renderable2 {
|
|
|
6137
6139
|
try {
|
|
6138
6140
|
this._fg = RGBA2.clone(parseColor2(options.fg ?? DEFAULT_GUTTER_FG));
|
|
6139
6141
|
this._bg = RGBA2.clone(parseColor2(options.bg ?? DEFAULT_GUTTER_BG));
|
|
6140
|
-
this.
|
|
6141
|
-
|
|
6142
|
+
this._layout = {
|
|
6143
|
+
minWidth: options.minWidth ?? 3,
|
|
6144
|
+
paddingLeft: 1,
|
|
6145
|
+
paddingRight: options.paddingRight ?? 1,
|
|
6146
|
+
minDigits: 0,
|
|
6147
|
+
minAfterWidth: 0
|
|
6148
|
+
};
|
|
6142
6149
|
this._lineNumberOffset = options.lineNumberOffset ?? 0;
|
|
6143
6150
|
this._hideLineNumbers = options.hideLineNumbers ?? new Set;
|
|
6144
6151
|
this._lineNumbers = options.lineNumbers ?? new Map;
|
|
@@ -6174,8 +6181,7 @@ class LineNumberRenderable extends Renderable2 {
|
|
|
6174
6181
|
this.gutter = new GutterRenderable(this.ctx, target, {
|
|
6175
6182
|
fg: this._fg,
|
|
6176
6183
|
bg: this._bg,
|
|
6177
|
-
|
|
6178
|
-
paddingRight: this._paddingRight,
|
|
6184
|
+
layout: this._layout,
|
|
6179
6185
|
lineColorsGutter: this._lineColorsGutter,
|
|
6180
6186
|
lineColorsContent: this._lineColorsContent,
|
|
6181
6187
|
lineSigns: this._lineSigns,
|
|
@@ -6379,6 +6385,15 @@ class LineNumberRenderable extends Renderable2 {
|
|
|
6379
6385
|
getLineSigns() {
|
|
6380
6386
|
return new Map(Array.from(this._lineSigns, ([line, sign]) => [line, cloneLineSign(sign)]));
|
|
6381
6387
|
}
|
|
6388
|
+
getGutterLayout() {
|
|
6389
|
+
return { ...this._layout };
|
|
6390
|
+
}
|
|
6391
|
+
setGutterLayout(layout) {
|
|
6392
|
+
if (layout.minWidth === this._layout.minWidth && layout.paddingLeft === this._layout.paddingLeft && layout.paddingRight === this._layout.paddingRight && layout.minDigits === this._layout.minDigits && layout.minAfterWidth === this._layout.minAfterWidth)
|
|
6393
|
+
return;
|
|
6394
|
+
this._layout = { ...layout };
|
|
6395
|
+
this.gutter?.setLayout(this._layout);
|
|
6396
|
+
}
|
|
6382
6397
|
set lineNumberOffset(value) {
|
|
6383
6398
|
if (this._lineNumberOffset !== value) {
|
|
6384
6399
|
this._lineNumberOffset = value;
|
|
@@ -6756,6 +6771,7 @@ function parsePatch(uniDiff) {
|
|
|
6756
6771
|
return list;
|
|
6757
6772
|
}
|
|
6758
6773
|
// src/renderables/Diff.ts
|
|
6774
|
+
var SIGN_WIDTH = 2;
|
|
6759
6775
|
var defaultColors = {
|
|
6760
6776
|
lineNumberFg: "#888888",
|
|
6761
6777
|
lineNumberBg: "transparent",
|
|
@@ -6792,6 +6808,7 @@ class DiffRenderable extends Renderable2 {
|
|
|
6792
6808
|
_showLineNumbers;
|
|
6793
6809
|
_lineNumberFg;
|
|
6794
6810
|
_lineNumberBg;
|
|
6811
|
+
_gutter;
|
|
6795
6812
|
_addedBg;
|
|
6796
6813
|
_removedBg;
|
|
6797
6814
|
_contextBg;
|
|
@@ -6834,6 +6851,7 @@ class DiffRenderable extends Renderable2 {
|
|
|
6834
6851
|
this._showLineNumbers = options.showLineNumbers ?? true;
|
|
6835
6852
|
this._lineNumberFg = RGBA2.clone(parseColor2(options.lineNumberFg ?? defaultColors.lineNumberFg));
|
|
6836
6853
|
this._lineNumberBg = RGBA2.clone(parseColor2(options.lineNumberBg ?? defaultColors.lineNumberBg));
|
|
6854
|
+
this._gutter = { ...options.gutter };
|
|
6837
6855
|
this._addedBg = RGBA2.clone(parseColor2(options.addedBg ?? defaultColors.addedBg));
|
|
6838
6856
|
this._removedBg = RGBA2.clone(parseColor2(options.removedBg ?? defaultColors.removedBg));
|
|
6839
6857
|
this._contextBg = RGBA2.clone(parseColor2(options.contextBg ?? defaultColors.contextBg));
|
|
@@ -7134,6 +7152,7 @@ class DiffRenderable extends Renderable2 {
|
|
|
7134
7152
|
height: "100%"
|
|
7135
7153
|
});
|
|
7136
7154
|
newSide.showLineNumbers = this._showLineNumbers;
|
|
7155
|
+
newSide.setGutterLayout(this.gutterLayout());
|
|
7137
7156
|
super.add(newSide);
|
|
7138
7157
|
if (side === "left") {
|
|
7139
7158
|
this.leftSide = newSide;
|
|
@@ -7146,6 +7165,7 @@ class DiffRenderable extends Renderable2 {
|
|
|
7146
7165
|
sideRef.width = width;
|
|
7147
7166
|
sideRef.fg = this._lineNumberFg;
|
|
7148
7167
|
sideRef.bg = this._lineNumberBg;
|
|
7168
|
+
sideRef.setGutterLayout(this.gutterLayout());
|
|
7149
7169
|
sideRef.setLineColors(lineColors);
|
|
7150
7170
|
const padding = sideRef.getLineSigns().get(-1);
|
|
7151
7171
|
if (padding)
|
|
@@ -7163,6 +7183,15 @@ class DiffRenderable extends Renderable2 {
|
|
|
7163
7183
|
}
|
|
7164
7184
|
}
|
|
7165
7185
|
}
|
|
7186
|
+
gutterLayout() {
|
|
7187
|
+
return {
|
|
7188
|
+
minWidth: 0,
|
|
7189
|
+
paddingLeft: this._gutter.paddingLeft ?? 1,
|
|
7190
|
+
paddingRight: this._gutter.paddingRight ?? 1,
|
|
7191
|
+
minDigits: this._gutter.minDigits ?? 0,
|
|
7192
|
+
minAfterWidth: this._gutter.minDigits === undefined ? 0 : SIGN_WIDTH
|
|
7193
|
+
};
|
|
7194
|
+
}
|
|
7166
7195
|
buildUnifiedView() {
|
|
7167
7196
|
if (!this._parsedDiff)
|
|
7168
7197
|
return;
|
|
@@ -7669,6 +7698,16 @@ class DiffRenderable extends Renderable2 {
|
|
|
7669
7698
|
this._lineNumberBg = RGBA2.clone(parseColor2(value ?? defaultColors.lineNumberBg));
|
|
7670
7699
|
this.rebuildView();
|
|
7671
7700
|
}
|
|
7701
|
+
get gutter() {
|
|
7702
|
+
return { ...this._gutter };
|
|
7703
|
+
}
|
|
7704
|
+
set gutter(value) {
|
|
7705
|
+
const next = { ...value };
|
|
7706
|
+
if (next.paddingLeft === this._gutter.paddingLeft && next.paddingRight === this._gutter.paddingRight && next.minDigits === this._gutter.minDigits)
|
|
7707
|
+
return;
|
|
7708
|
+
this._gutter = next;
|
|
7709
|
+
this.rebuildView();
|
|
7710
|
+
}
|
|
7672
7711
|
get addedContentBg() {
|
|
7673
7712
|
return this._addedContentBg ? RGBA2.clone(this._addedContentBg) : null;
|
|
7674
7713
|
}
|
|
@@ -15462,5 +15501,5 @@ export {
|
|
|
15462
15501
|
yellow2 as yellow
|
|
15463
15502
|
};
|
|
15464
15503
|
|
|
15465
|
-
//# debugId=
|
|
15504
|
+
//# debugId=7177BFBAA0B78F6664756E2164756E21
|
|
15466
15505
|
//# sourceMappingURL=index.bun.js.map
|