@opentui/core 0.1.105 → 0.1.107
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 +2 -1
- package/buffer.d.ts +2 -4
- package/console.d.ts +3 -1
- package/{index-exz3nyks.js → index-epp5y71w.js} +3 -3
- package/{index-3dgzz9vb.js → index-mch6dv67.js} +85 -60
- package/{index-3dgzz9vb.js.map → index-mch6dv67.js.map} +8 -8
- package/{index-07knw1vn.js → index-mw2x3082.js} +154 -186
- package/index-mw2x3082.js.map +76 -0
- package/index.js +7 -9
- package/index.js.map +1 -1
- package/lib/RGBA.d.ts +10 -17
- package/lib/parse.keypress-kitty.d.ts +1 -0
- package/lib/parse.keypress.d.ts +1 -0
- package/package.json +11 -8
- package/platform/ffi.d.ts +64 -0
- package/platform/runtime.d.ts +8 -0
- package/platform/worker.d.ts +4 -0
- package/renderables/Select.d.ts +3 -1
- package/renderables/TabSelect.d.ts +3 -1
- package/renderables/Textarea.d.ts +5 -3
- package/renderer.d.ts +1 -0
- package/runtime-plugin-support.js +3 -3
- package/runtime-plugin.js +3 -3
- package/syntax-style.d.ts +10 -2
- package/testing/test-recorder.d.ts +2 -2
- package/testing.js +4 -4
- package/testing.js.map +3 -3
- package/types.d.ts +1 -0
- package/zig-structs.d.ts +0 -6
- package/zig.d.ts +0 -2
- package/index-07knw1vn.js.map +0 -76
- /package/{index-exz3nyks.js.map → index-epp5y71w.js.map} +0 -0
- /package/lib/{keymapping.d.ts → keybinding.internal.d.ts} +0 -0
|
@@ -1969,11 +1969,11 @@ class InternalKeyHandler extends KeyHandler {
|
|
|
1969
1969
|
}
|
|
1970
1970
|
|
|
1971
1971
|
// src/lib/RGBA.ts
|
|
1972
|
-
var COLOR_TAG_RGB = 256;
|
|
1973
|
-
var COLOR_TAG_DEFAULT = 257;
|
|
1974
1972
|
var DEFAULT_FOREGROUND_RGB = [255, 255, 255];
|
|
1975
1973
|
var DEFAULT_BACKGROUND_RGB = [0, 0, 0];
|
|
1976
|
-
var
|
|
1974
|
+
var INTENT_RGB = 0;
|
|
1975
|
+
var INTENT_INDEXED = 1;
|
|
1976
|
+
var INTENT_DEFAULT = 2;
|
|
1977
1977
|
var ANSI16_RGB = [
|
|
1978
1978
|
[0, 0, 0],
|
|
1979
1979
|
[128, 0, 0],
|
|
@@ -1993,33 +1993,22 @@ var ANSI16_RGB = [
|
|
|
1993
1993
|
[255, 255, 255]
|
|
1994
1994
|
];
|
|
1995
1995
|
var ANSI_256_CUBE_LEVELS = [0, 95, 135, 175, 215, 255];
|
|
1996
|
-
function
|
|
1997
|
-
|
|
1998
|
-
if (normalizedTag === COLOR_TAG_RGB || normalizedTag === COLOR_TAG_DEFAULT) {
|
|
1999
|
-
return normalizedTag;
|
|
2000
|
-
}
|
|
2001
|
-
if (Number.isInteger(normalizedTag) && normalizedTag >= 0 && normalizedTag <= 255) {
|
|
2002
|
-
return normalizedTag;
|
|
2003
|
-
}
|
|
2004
|
-
return COLOR_TAG_RGB;
|
|
1996
|
+
function packMeta(intent, slot = 0) {
|
|
1997
|
+
return (slot & 255 | (intent & 255) << 8) >>> 0;
|
|
2005
1998
|
}
|
|
2006
|
-
function
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
const normalized = new Float32Array(RGBA_BUFFER_STRIDE);
|
|
2012
|
-
normalized[0] = buffer[0] ?? 0;
|
|
2013
|
-
normalized[1] = buffer[1] ?? 0;
|
|
2014
|
-
normalized[2] = buffer[2] ?? 0;
|
|
2015
|
-
normalized[3] = buffer[3] ?? 0;
|
|
2016
|
-
normalized[4] = COLOR_TAG_RGB;
|
|
2017
|
-
return normalized;
|
|
1999
|
+
function toU8(value) {
|
|
2000
|
+
return Math.round(Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * 255);
|
|
2001
|
+
}
|
|
2002
|
+
function toByte(value) {
|
|
2003
|
+
return Math.round(Math.max(0, Math.min(255, Number.isFinite(value) ? value : 0)));
|
|
2018
2004
|
}
|
|
2019
|
-
function
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2005
|
+
function packRGBA8(r, g, b, a, meta) {
|
|
2006
|
+
return new Uint16Array([
|
|
2007
|
+
toByte(r) & 255 | (meta >>> 0 & 255) << 8,
|
|
2008
|
+
toByte(g) & 255 | (meta >>> 8 & 255) << 8,
|
|
2009
|
+
toByte(b) & 255 | (meta >>> 16 & 255) << 8,
|
|
2010
|
+
toByte(a) & 255 | (meta >>> 24 & 255) << 8
|
|
2011
|
+
]);
|
|
2023
2012
|
}
|
|
2024
2013
|
function rgbaForAnsi256Index(index) {
|
|
2025
2014
|
const [r, g, b] = ansi256IndexToRgb(index);
|
|
@@ -2046,81 +2035,86 @@ function ansi256IndexToRgb(index) {
|
|
|
2046
2035
|
const value = 8 + (normalizedIndex - 232) * 10;
|
|
2047
2036
|
return [value, value, value];
|
|
2048
2037
|
}
|
|
2049
|
-
function decodeColorTag(tag) {
|
|
2050
|
-
if (tag === COLOR_TAG_DEFAULT) {
|
|
2051
|
-
return { kind: "default" };
|
|
2052
|
-
}
|
|
2053
|
-
if (tag === COLOR_TAG_RGB) {
|
|
2054
|
-
return { kind: "rgb" };
|
|
2055
|
-
}
|
|
2056
|
-
return { kind: "indexed", index: normalizeIndexedColorIndex(tag) };
|
|
2057
|
-
}
|
|
2058
2038
|
|
|
2059
2039
|
class RGBA {
|
|
2060
2040
|
buffer;
|
|
2061
2041
|
constructor(buffer) {
|
|
2062
|
-
this.buffer =
|
|
2042
|
+
this.buffer = new Uint16Array(4);
|
|
2043
|
+
this.buffer.set(buffer.subarray(0, 4));
|
|
2063
2044
|
}
|
|
2064
2045
|
static fromArray(array) {
|
|
2065
2046
|
return new RGBA(array);
|
|
2066
2047
|
}
|
|
2067
|
-
static fromValues(r, g, b, a = 1
|
|
2068
|
-
return new RGBA(
|
|
2048
|
+
static fromValues(r, g, b, a = 1) {
|
|
2049
|
+
return new RGBA(packRGBA8(toU8(r), toU8(g), toU8(b), toU8(a), packMeta(INTENT_RGB)));
|
|
2069
2050
|
}
|
|
2070
2051
|
static clone(rgba) {
|
|
2071
|
-
return RGBA
|
|
2052
|
+
return new RGBA(rgba.buffer);
|
|
2072
2053
|
}
|
|
2073
|
-
static fromInts(r, g, b, a = 255
|
|
2074
|
-
return new RGBA(
|
|
2054
|
+
static fromInts(r, g, b, a = 255) {
|
|
2055
|
+
return new RGBA(packRGBA8(r, g, b, a, packMeta(INTENT_RGB)));
|
|
2075
2056
|
}
|
|
2076
2057
|
static fromHex(hex) {
|
|
2077
2058
|
return hexToRgb(hex);
|
|
2078
2059
|
}
|
|
2079
2060
|
static fromIndex(index, snapshot) {
|
|
2080
|
-
const
|
|
2081
|
-
|
|
2061
|
+
const normalized = normalizeIndexedColorIndex(index);
|
|
2062
|
+
const rgba = snapshot ? parseColor(snapshot) : rgbaForAnsi256Index(normalized);
|
|
2063
|
+
const [r, g, b, a] = rgba.toInts();
|
|
2064
|
+
return new RGBA(packRGBA8(r, g, b, a, packMeta(INTENT_INDEXED, normalized)));
|
|
2082
2065
|
}
|
|
2083
2066
|
static defaultForeground(snapshot) {
|
|
2084
|
-
|
|
2067
|
+
const rgba = snapshot ? parseColor(snapshot) : RGBA.fromInts(...DEFAULT_FOREGROUND_RGB);
|
|
2068
|
+
const [r, g, b, a] = rgba.toInts();
|
|
2069
|
+
return new RGBA(packRGBA8(r, g, b, a, packMeta(INTENT_DEFAULT)));
|
|
2085
2070
|
}
|
|
2086
2071
|
static defaultBackground(snapshot) {
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
return rgba.tag;
|
|
2072
|
+
const rgba = snapshot ? parseColor(snapshot) : RGBA.fromInts(...DEFAULT_BACKGROUND_RGB);
|
|
2073
|
+
const [r, g, b, a] = rgba.toInts();
|
|
2074
|
+
return new RGBA(packRGBA8(r, g, b, a, packMeta(INTENT_DEFAULT)));
|
|
2091
2075
|
}
|
|
2092
2076
|
toInts() {
|
|
2093
|
-
return [
|
|
2077
|
+
return [this.buffer[0] & 255, this.buffer[1] & 255, this.buffer[2] & 255, this.buffer[3] & 255];
|
|
2094
2078
|
}
|
|
2095
2079
|
get r() {
|
|
2096
|
-
return this.buffer[0];
|
|
2080
|
+
return (this.buffer[0] & 255) / 255;
|
|
2097
2081
|
}
|
|
2098
2082
|
set r(value) {
|
|
2099
|
-
this.buffer[0] = value;
|
|
2083
|
+
this.buffer[0] = this.buffer[0] & 65280 | toU8(value);
|
|
2100
2084
|
}
|
|
2101
2085
|
get g() {
|
|
2102
|
-
return this.buffer[1];
|
|
2086
|
+
return (this.buffer[1] & 255) / 255;
|
|
2103
2087
|
}
|
|
2104
2088
|
set g(value) {
|
|
2105
|
-
this.buffer[1] = value;
|
|
2089
|
+
this.buffer[1] = this.buffer[1] & 65280 | toU8(value);
|
|
2106
2090
|
}
|
|
2107
2091
|
get b() {
|
|
2108
|
-
return this.buffer[2];
|
|
2092
|
+
return (this.buffer[2] & 255) / 255;
|
|
2109
2093
|
}
|
|
2110
2094
|
set b(value) {
|
|
2111
|
-
this.buffer[2] = value;
|
|
2095
|
+
this.buffer[2] = this.buffer[2] & 65280 | toU8(value);
|
|
2112
2096
|
}
|
|
2113
2097
|
get a() {
|
|
2114
|
-
return this.buffer[3];
|
|
2098
|
+
return (this.buffer[3] & 255) / 255;
|
|
2115
2099
|
}
|
|
2116
2100
|
set a(value) {
|
|
2117
|
-
this.buffer[3] = value;
|
|
2101
|
+
this.buffer[3] = this.buffer[3] & 65280 | toU8(value);
|
|
2102
|
+
}
|
|
2103
|
+
get meta() {
|
|
2104
|
+
return (this.buffer[0] >>> 8 | this.buffer[1] >>> 8 << 8 | this.buffer[2] >>> 8 << 16 | this.buffer[3] >>> 8 << 24) >>> 0;
|
|
2118
2105
|
}
|
|
2119
|
-
get
|
|
2120
|
-
|
|
2106
|
+
get intent() {
|
|
2107
|
+
switch (this.meta >>> 8 & 255) {
|
|
2108
|
+
case INTENT_INDEXED:
|
|
2109
|
+
return "indexed";
|
|
2110
|
+
case INTENT_DEFAULT:
|
|
2111
|
+
return "default";
|
|
2112
|
+
default:
|
|
2113
|
+
return "rgb";
|
|
2114
|
+
}
|
|
2121
2115
|
}
|
|
2122
|
-
|
|
2123
|
-
this.
|
|
2116
|
+
get slot() {
|
|
2117
|
+
return this.meta & 255;
|
|
2124
2118
|
}
|
|
2125
2119
|
map(fn) {
|
|
2126
2120
|
return [fn(this.r), fn(this.g), fn(this.b), fn(this.a)];
|
|
@@ -2131,14 +2125,13 @@ class RGBA {
|
|
|
2131
2125
|
equals(other) {
|
|
2132
2126
|
if (!other)
|
|
2133
2127
|
return false;
|
|
2134
|
-
return this.
|
|
2128
|
+
return this.buffer[0] === other.buffer[0] && this.buffer[1] === other.buffer[1] && this.buffer[2] === other.buffer[2] && this.buffer[3] === other.buffer[3];
|
|
2135
2129
|
}
|
|
2136
2130
|
}
|
|
2137
2131
|
function normalizeColorValue(value) {
|
|
2138
2132
|
if (value == null)
|
|
2139
2133
|
return null;
|
|
2140
|
-
|
|
2141
|
-
return { rgba, tag: rgba.tag };
|
|
2134
|
+
return { rgba: parseColor(value) };
|
|
2142
2135
|
}
|
|
2143
2136
|
function hexToRgb(hex) {
|
|
2144
2137
|
hex = hex.replace(/^#/, "");
|
|
@@ -2151,18 +2144,16 @@ function hexToRgb(hex) {
|
|
|
2151
2144
|
console.warn(`Invalid hex color: ${hex}, defaulting to magenta`);
|
|
2152
2145
|
return RGBA.fromValues(1, 0, 1, 1);
|
|
2153
2146
|
}
|
|
2154
|
-
const r = parseInt(hex.substring(0, 2), 16)
|
|
2155
|
-
const g = parseInt(hex.substring(2, 4), 16)
|
|
2156
|
-
const b = parseInt(hex.substring(4, 6), 16)
|
|
2157
|
-
const a = hex.length === 8 ? parseInt(hex.substring(6, 8), 16)
|
|
2158
|
-
return RGBA.
|
|
2147
|
+
const r = parseInt(hex.substring(0, 2), 16);
|
|
2148
|
+
const g = parseInt(hex.substring(2, 4), 16);
|
|
2149
|
+
const b = parseInt(hex.substring(4, 6), 16);
|
|
2150
|
+
const a = hex.length === 8 ? parseInt(hex.substring(6, 8), 16) : 255;
|
|
2151
|
+
return RGBA.fromInts(r, g, b, a);
|
|
2159
2152
|
}
|
|
2160
2153
|
function rgbToHex(rgb) {
|
|
2161
|
-
const
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
return hex.length === 1 ? "0" + hex : hex;
|
|
2165
|
-
}).join("");
|
|
2154
|
+
const [r, g, b, a] = rgb.toInts();
|
|
2155
|
+
const components = a === 255 ? [r, g, b] : [r, g, b, a];
|
|
2156
|
+
return "#" + components.map((x) => x.toString(16).padStart(2, "0")).join("");
|
|
2166
2157
|
}
|
|
2167
2158
|
function hsvToRgb(h, s, v) {
|
|
2168
2159
|
let r = 0, g = 0, b = 0;
|
|
@@ -5575,6 +5566,7 @@ var kittyKeyMap = {
|
|
|
5575
5566
|
57453: "iso_level3_shift",
|
|
5576
5567
|
57454: "iso_level5_shift"
|
|
5577
5568
|
};
|
|
5569
|
+
var kittyNamedSingleStrokeKeys = [...new Set(Object.values(kittyKeyMap))];
|
|
5578
5570
|
function fromKittyMods(mod) {
|
|
5579
5571
|
return {
|
|
5580
5572
|
shift: !!(mod & 1),
|
|
@@ -5897,6 +5889,9 @@ var keyName = {
|
|
|
5897
5889
|
"[Z": "tab"
|
|
5898
5890
|
};
|
|
5899
5891
|
var nonAlphanumericKeys = [...Object.values(keyName), "backspace"];
|
|
5892
|
+
var terminalNamedSingleStrokeKeys = [
|
|
5893
|
+
...new Set(["return", "linefeed", "tab", "escape", "space", ...nonAlphanumericKeys, ...kittyNamedSingleStrokeKeys])
|
|
5894
|
+
];
|
|
5900
5895
|
var isShiftKey = (code) => {
|
|
5901
5896
|
return ["[a", "[b", "[c", "[d", "[e", "[2$", "[3$", "[5$", "[6$", "[7$", "[8$", "[Z"].includes(code);
|
|
5902
5897
|
};
|
|
@@ -10907,7 +10902,6 @@ class OptimizedBuffer {
|
|
|
10907
10902
|
_widthMethod;
|
|
10908
10903
|
respectAlpha = false;
|
|
10909
10904
|
_rawBuffers = null;
|
|
10910
|
-
_rawColorTags = null;
|
|
10911
10905
|
_destroyed = false;
|
|
10912
10906
|
get ptr() {
|
|
10913
10907
|
return this.bufferPtr;
|
|
@@ -10917,37 +10911,26 @@ class OptimizedBuffer {
|
|
|
10917
10911
|
throw new Error(`Buffer ${this.id} is destroyed`);
|
|
10918
10912
|
}
|
|
10919
10913
|
ensureRawBufferViews() {
|
|
10920
|
-
if (this._rawBuffers !== null
|
|
10914
|
+
if (this._rawBuffers !== null) {
|
|
10921
10915
|
return;
|
|
10922
10916
|
}
|
|
10923
10917
|
const size = this._width * this._height;
|
|
10924
10918
|
const charPtr = this.lib.bufferGetCharPtr(this.bufferPtr);
|
|
10925
10919
|
const fgPtr = this.lib.bufferGetFgPtr(this.bufferPtr);
|
|
10926
10920
|
const bgPtr = this.lib.bufferGetBgPtr(this.bufferPtr);
|
|
10927
|
-
const fgTagPtr = this.lib.bufferGetFgTagPtr(this.bufferPtr);
|
|
10928
|
-
const bgTagPtr = this.lib.bufferGetBgTagPtr(this.bufferPtr);
|
|
10929
10921
|
const attributesPtr = this.lib.bufferGetAttributesPtr(this.bufferPtr);
|
|
10930
10922
|
this._rawBuffers = {
|
|
10931
10923
|
char: new Uint32Array(toArrayBuffer(charPtr, 0, size * 4)),
|
|
10932
|
-
fg: new
|
|
10933
|
-
bg: new
|
|
10924
|
+
fg: new Uint16Array(toArrayBuffer(fgPtr, 0, size * 4 * 2)),
|
|
10925
|
+
bg: new Uint16Array(toArrayBuffer(bgPtr, 0, size * 4 * 2)),
|
|
10934
10926
|
attributes: new Uint32Array(toArrayBuffer(attributesPtr, 0, size * 4))
|
|
10935
10927
|
};
|
|
10936
|
-
this._rawColorTags = {
|
|
10937
|
-
fg: new Uint16Array(toArrayBuffer(fgTagPtr, 0, size * 2)),
|
|
10938
|
-
bg: new Uint16Array(toArrayBuffer(bgTagPtr, 0, size * 2))
|
|
10939
|
-
};
|
|
10940
10928
|
}
|
|
10941
10929
|
get buffers() {
|
|
10942
10930
|
this.guard();
|
|
10943
10931
|
this.ensureRawBufferViews();
|
|
10944
10932
|
return this._rawBuffers;
|
|
10945
10933
|
}
|
|
10946
|
-
get rawColorTags() {
|
|
10947
|
-
this.guard();
|
|
10948
|
-
this.ensureRawBufferViews();
|
|
10949
|
-
return this._rawColorTags;
|
|
10950
|
-
}
|
|
10951
10934
|
constructor(lib, ptr2, width, height, options) {
|
|
10952
10935
|
this.id = options.id || `fb_${OptimizedBuffer.fbIdCounter++}`;
|
|
10953
10936
|
this.lib = lib;
|
|
@@ -10992,7 +10975,6 @@ class OptimizedBuffer {
|
|
|
10992
10975
|
getSpanLines() {
|
|
10993
10976
|
this.guard();
|
|
10994
10977
|
const { char, fg: fg2, bg: bg2, attributes } = this.buffers;
|
|
10995
|
-
const { fg: fgTag, bg: bgTag } = this.rawColorTags;
|
|
10996
10978
|
const lines = [];
|
|
10997
10979
|
const CHAR_FLAG_CONTINUATION = 3221225472 | 0;
|
|
10998
10980
|
const CHAR_FLAG_MASK = 3221225472 | 0;
|
|
@@ -11007,8 +10989,8 @@ class OptimizedBuffer {
|
|
|
11007
10989
|
for (let x = 0;x < this._width; x++) {
|
|
11008
10990
|
const i = y * this._width + x;
|
|
11009
10991
|
const cp = char[i];
|
|
11010
|
-
const cellFg = RGBA.
|
|
11011
|
-
const cellBg = RGBA.
|
|
10992
|
+
const cellFg = RGBA.fromArray(fg2.slice(i * 4, i * 4 + 4));
|
|
10993
|
+
const cellBg = RGBA.fromArray(bg2.slice(i * 4, i * 4 + 4));
|
|
11012
10994
|
const cellAttrs = attributes[i] & 255;
|
|
11013
10995
|
const isContinuation = (cp & CHAR_FLAG_MASK) === CHAR_FLAG_CONTINUATION;
|
|
11014
10996
|
const cellChar = isContinuation ? "" : lineChars[charIdx++] ?? " ";
|
|
@@ -11136,7 +11118,6 @@ class OptimizedBuffer {
|
|
|
11136
11118
|
this._width = width;
|
|
11137
11119
|
this._height = height;
|
|
11138
11120
|
this._rawBuffers = null;
|
|
11139
|
-
this._rawColorTags = null;
|
|
11140
11121
|
this.lib.bufferResize(this.bufferPtr, width, height);
|
|
11141
11122
|
}
|
|
11142
11123
|
drawBox(options) {
|
|
@@ -11808,7 +11789,7 @@ function defineStruct(fields, structDefOptions) {
|
|
|
11808
11789
|
// src/zig-structs.ts
|
|
11809
11790
|
import { ptr as ptr3, toArrayBuffer as toArrayBuffer3 } from "bun:ffi";
|
|
11810
11791
|
var rgbaPackTransform = (rgba) => rgba ? ptr3(rgba.buffer) : null;
|
|
11811
|
-
var rgbaUnpackTransform = (ptr4) => ptr4 ? RGBA.fromArray(new
|
|
11792
|
+
var rgbaUnpackTransform = (ptr4) => ptr4 ? RGBA.fromArray(new Uint16Array(toArrayBuffer3(ptr4, 0, 8))) : undefined;
|
|
11812
11793
|
var StyledChunkStruct = defineStruct([
|
|
11813
11794
|
["text", "char*"],
|
|
11814
11795
|
["text_len", "u64", { lengthOf: "text" }],
|
|
@@ -11830,8 +11811,6 @@ var StyledChunkStruct = defineStruct([
|
|
|
11830
11811
|
unpackTransform: rgbaUnpackTransform
|
|
11831
11812
|
}
|
|
11832
11813
|
],
|
|
11833
|
-
["fg_tag", "u16", { default: COLOR_TAG_RGB }],
|
|
11834
|
-
["bg_tag", "u16", { default: COLOR_TAG_RGB }],
|
|
11835
11814
|
["attributes", "u32", { default: 0 }],
|
|
11836
11815
|
["link", "char*", { default: "" }],
|
|
11837
11816
|
["link_len", "u64", { lengthOf: "link" }]
|
|
@@ -11843,17 +11822,13 @@ var StyledChunkStruct = defineStruct([
|
|
|
11843
11822
|
return {
|
|
11844
11823
|
...chunk,
|
|
11845
11824
|
fg: normalizedFg?.rgba ?? null,
|
|
11846
|
-
bg: normalizedBg?.rgba ?? null
|
|
11847
|
-
fg_tag: normalizedFg?.tag ?? COLOR_TAG_RGB,
|
|
11848
|
-
bg_tag: normalizedBg?.tag ?? COLOR_TAG_RGB
|
|
11825
|
+
bg: normalizedBg?.rgba ?? null
|
|
11849
11826
|
};
|
|
11850
11827
|
}
|
|
11851
11828
|
return {
|
|
11852
11829
|
...chunk,
|
|
11853
11830
|
fg: normalizedFg?.rgba ?? null,
|
|
11854
11831
|
bg: normalizedBg?.rgba ?? null,
|
|
11855
|
-
fg_tag: normalizedFg?.tag ?? COLOR_TAG_RGB,
|
|
11856
|
-
bg_tag: normalizedBg?.tag ?? COLOR_TAG_RGB,
|
|
11857
11832
|
link: chunk.link.url
|
|
11858
11833
|
};
|
|
11859
11834
|
}
|
|
@@ -12063,6 +12038,12 @@ function toPointer(value) {
|
|
|
12063
12038
|
function toNumber(value) {
|
|
12064
12039
|
return typeof value === "bigint" ? Number(value) : value;
|
|
12065
12040
|
}
|
|
12041
|
+
function rgbaPtr(value) {
|
|
12042
|
+
return ptr4(value.buffer);
|
|
12043
|
+
}
|
|
12044
|
+
function optionalRgbaPtr(value) {
|
|
12045
|
+
return value ? rgbaPtr(value) : null;
|
|
12046
|
+
}
|
|
12066
12047
|
function getOpenTUILib(libPath) {
|
|
12067
12048
|
const resolvedLibPath = libPath || targetLibPath;
|
|
12068
12049
|
const rawSymbols = dlopen(resolvedLibPath, {
|
|
@@ -12194,14 +12175,6 @@ function getOpenTUILib(libPath) {
|
|
|
12194
12175
|
args: ["ptr"],
|
|
12195
12176
|
returns: "ptr"
|
|
12196
12177
|
},
|
|
12197
|
-
bufferGetFgTagPtr: {
|
|
12198
|
-
args: ["ptr"],
|
|
12199
|
-
returns: "ptr"
|
|
12200
|
-
},
|
|
12201
|
-
bufferGetBgTagPtr: {
|
|
12202
|
-
args: ["ptr"],
|
|
12203
|
-
returns: "ptr"
|
|
12204
|
-
},
|
|
12205
12178
|
bufferGetAttributesPtr: {
|
|
12206
12179
|
args: ["ptr"],
|
|
12207
12180
|
returns: "ptr"
|
|
@@ -13371,7 +13344,7 @@ class FFIRenderLib {
|
|
|
13371
13344
|
this.opentui.symbols.setClearOnShutdown(renderer, clear);
|
|
13372
13345
|
}
|
|
13373
13346
|
setBackgroundColor(renderer, color) {
|
|
13374
|
-
this.opentui.symbols.setBackgroundColor(renderer, color
|
|
13347
|
+
this.opentui.symbols.setBackgroundColor(renderer, rgbaPtr(color));
|
|
13375
13348
|
}
|
|
13376
13349
|
setRenderOffset(renderer, offset) {
|
|
13377
13350
|
this.opentui.symbols.setRenderOffset(renderer, offset);
|
|
@@ -13413,16 +13386,11 @@ class FFIRenderLib {
|
|
|
13413
13386
|
return new OptimizedBuffer(this, bufferPtr, width, height, { id: "current buffer", widthMethod: "unicode" });
|
|
13414
13387
|
}
|
|
13415
13388
|
rendererSetPaletteState(renderer, palette, defaultForeground, defaultBackground, paletteEpoch) {
|
|
13416
|
-
const paletteBuffer = new
|
|
13389
|
+
const paletteBuffer = new Uint16Array(palette.length * 4);
|
|
13417
13390
|
for (let index = 0;index < palette.length; index++) {
|
|
13418
|
-
|
|
13419
|
-
const base = index * 4;
|
|
13420
|
-
paletteBuffer[base] = color.r;
|
|
13421
|
-
paletteBuffer[base + 1] = color.g;
|
|
13422
|
-
paletteBuffer[base + 2] = color.b;
|
|
13423
|
-
paletteBuffer[base + 3] = color.a;
|
|
13391
|
+
paletteBuffer.set(palette[index].buffer, index * 4);
|
|
13424
13392
|
}
|
|
13425
|
-
this.opentui.symbols.rendererSetPaletteState(renderer, paletteBuffer, palette.length, defaultForeground
|
|
13393
|
+
this.opentui.symbols.rendererSetPaletteState(renderer, ptr4(paletteBuffer), palette.length, rgbaPtr(defaultForeground), rgbaPtr(defaultBackground), paletteEpoch >>> 0);
|
|
13426
13394
|
}
|
|
13427
13395
|
bufferGetCharPtr(buffer) {
|
|
13428
13396
|
const ptr5 = this.opentui.symbols.bufferGetCharPtr(buffer);
|
|
@@ -13445,20 +13413,6 @@ class FFIRenderLib {
|
|
|
13445
13413
|
}
|
|
13446
13414
|
return ptr5;
|
|
13447
13415
|
}
|
|
13448
|
-
bufferGetFgTagPtr(buffer) {
|
|
13449
|
-
const ptr5 = this.opentui.symbols.bufferGetFgTagPtr(buffer);
|
|
13450
|
-
if (!ptr5) {
|
|
13451
|
-
throw new Error("Failed to get fg tag pointer");
|
|
13452
|
-
}
|
|
13453
|
-
return ptr5;
|
|
13454
|
-
}
|
|
13455
|
-
bufferGetBgTagPtr(buffer) {
|
|
13456
|
-
const ptr5 = this.opentui.symbols.bufferGetBgTagPtr(buffer);
|
|
13457
|
-
if (!ptr5) {
|
|
13458
|
-
throw new Error("Failed to get bg tag pointer");
|
|
13459
|
-
}
|
|
13460
|
-
return ptr5;
|
|
13461
|
-
}
|
|
13462
13416
|
bufferGetAttributesPtr(buffer) {
|
|
13463
13417
|
const ptr5 = this.opentui.symbols.bufferGetAttributesPtr(buffer);
|
|
13464
13418
|
if (!ptr5) {
|
|
@@ -13493,29 +13447,29 @@ class FFIRenderLib {
|
|
|
13493
13447
|
return this.opentui.symbols.getBufferHeight(buffer);
|
|
13494
13448
|
}
|
|
13495
13449
|
bufferClear(buffer, color) {
|
|
13496
|
-
this.opentui.symbols.bufferClear(buffer, color
|
|
13450
|
+
this.opentui.symbols.bufferClear(buffer, rgbaPtr(color));
|
|
13497
13451
|
}
|
|
13498
13452
|
bufferDrawText(buffer, text, x, y, color, bgColor, attributes) {
|
|
13499
13453
|
const textBytes = this.encoder.encode(text);
|
|
13500
13454
|
const textLength = textBytes.byteLength;
|
|
13501
|
-
const bg2 = bgColor
|
|
13502
|
-
const fg2 = color
|
|
13455
|
+
const bg2 = optionalRgbaPtr(bgColor);
|
|
13456
|
+
const fg2 = rgbaPtr(color);
|
|
13503
13457
|
this.opentui.symbols.bufferDrawText(buffer, textBytes, textLength, x, y, fg2, bg2, attributes ?? 0);
|
|
13504
13458
|
}
|
|
13505
13459
|
bufferSetCellWithAlphaBlending(buffer, x, y, char, color, bgColor, attributes) {
|
|
13506
13460
|
const charPtr = char.codePointAt(0) ?? " ".codePointAt(0);
|
|
13507
|
-
const bg2 = bgColor
|
|
13508
|
-
const fg2 = color
|
|
13461
|
+
const bg2 = rgbaPtr(bgColor);
|
|
13462
|
+
const fg2 = rgbaPtr(color);
|
|
13509
13463
|
this.opentui.symbols.bufferSetCellWithAlphaBlending(buffer, x, y, charPtr, fg2, bg2, attributes ?? 0);
|
|
13510
13464
|
}
|
|
13511
13465
|
bufferSetCell(buffer, x, y, char, color, bgColor, attributes) {
|
|
13512
13466
|
const charPtr = char.codePointAt(0) ?? " ".codePointAt(0);
|
|
13513
|
-
const bg2 = bgColor
|
|
13514
|
-
const fg2 = color
|
|
13467
|
+
const bg2 = rgbaPtr(bgColor);
|
|
13468
|
+
const fg2 = rgbaPtr(color);
|
|
13515
13469
|
this.opentui.symbols.bufferSetCell(buffer, x, y, charPtr, fg2, bg2, attributes ?? 0);
|
|
13516
13470
|
}
|
|
13517
13471
|
bufferFillRect(buffer, x, y, width, height, color) {
|
|
13518
|
-
const bg2 = color
|
|
13472
|
+
const bg2 = rgbaPtr(color);
|
|
13519
13473
|
this.opentui.symbols.bufferFillRect(buffer, x, y, width, height, bg2);
|
|
13520
13474
|
}
|
|
13521
13475
|
bufferColorMatrix(buffer, matrixPtr, cellMaskPtr, cellMaskCount, strength, target) {
|
|
@@ -13532,17 +13486,17 @@ class FFIRenderLib {
|
|
|
13532
13486
|
this.opentui.symbols.bufferDrawPackedBuffer(buffer, dataPtr, dataLen, posX, posY, terminalWidthCells, terminalHeightCells);
|
|
13533
13487
|
}
|
|
13534
13488
|
bufferDrawGrayscaleBuffer(buffer, posX, posY, intensitiesPtr, srcWidth, srcHeight, fg2, bg2) {
|
|
13535
|
-
this.opentui.symbols.bufferDrawGrayscaleBuffer(buffer, posX, posY, intensitiesPtr, srcWidth, srcHeight, fg2
|
|
13489
|
+
this.opentui.symbols.bufferDrawGrayscaleBuffer(buffer, posX, posY, intensitiesPtr, srcWidth, srcHeight, optionalRgbaPtr(fg2), optionalRgbaPtr(bg2));
|
|
13536
13490
|
}
|
|
13537
13491
|
bufferDrawGrayscaleBufferSupersampled(buffer, posX, posY, intensitiesPtr, srcWidth, srcHeight, fg2, bg2) {
|
|
13538
|
-
this.opentui.symbols.bufferDrawGrayscaleBufferSupersampled(buffer, posX, posY, intensitiesPtr, srcWidth, srcHeight, fg2
|
|
13492
|
+
this.opentui.symbols.bufferDrawGrayscaleBufferSupersampled(buffer, posX, posY, intensitiesPtr, srcWidth, srcHeight, optionalRgbaPtr(fg2), optionalRgbaPtr(bg2));
|
|
13539
13493
|
}
|
|
13540
13494
|
bufferDrawGrid(buffer, borderChars, borderFg, borderBg, columnOffsets, columnCount, rowOffsets, rowCount, options) {
|
|
13541
13495
|
const optionsBuffer = GridDrawOptionsStruct.pack({
|
|
13542
13496
|
drawInner: options.drawInner,
|
|
13543
13497
|
drawOuter: options.drawOuter
|
|
13544
13498
|
});
|
|
13545
|
-
this.opentui.symbols.bufferDrawGrid(buffer, borderChars, borderFg
|
|
13499
|
+
this.opentui.symbols.bufferDrawGrid(buffer, borderChars, rgbaPtr(borderFg), rgbaPtr(borderBg), columnOffsets, columnCount, rowOffsets, rowCount, ptr4(optionsBuffer));
|
|
13546
13500
|
}
|
|
13547
13501
|
bufferDrawBox(buffer, x, y, width, height, borderChars, packedOptions, borderColor, backgroundColor, title, bottomTitle) {
|
|
13548
13502
|
const titleBytes = title ? this.encoder.encode(title) : null;
|
|
@@ -13551,7 +13505,7 @@ class FFIRenderLib {
|
|
|
13551
13505
|
const bottomTitleBytes = bottomTitle ? this.encoder.encode(bottomTitle) : null;
|
|
13552
13506
|
const bottomTitleLen = bottomTitle ? bottomTitleBytes.length : 0;
|
|
13553
13507
|
const bottomTitlePtr = bottomTitle ? bottomTitleBytes : null;
|
|
13554
|
-
this.opentui.symbols.bufferDrawBox(buffer, x, y, width, height, borderChars, packedOptions, borderColor
|
|
13508
|
+
this.opentui.symbols.bufferDrawBox(buffer, x, y, width, height, borderChars, packedOptions, rgbaPtr(borderColor), rgbaPtr(backgroundColor), titlePtr, titleLen, bottomTitlePtr, bottomTitleLen);
|
|
13555
13509
|
}
|
|
13556
13510
|
bufferResize(buffer, width, height) {
|
|
13557
13511
|
this.opentui.symbols.bufferResize(buffer, width, height);
|
|
@@ -13578,7 +13532,7 @@ class FFIRenderLib {
|
|
|
13578
13532
|
this.opentui.symbols.setCursorPosition(renderer, x, y, visible);
|
|
13579
13533
|
}
|
|
13580
13534
|
setCursorColor(renderer, color) {
|
|
13581
|
-
this.opentui.symbols.setCursorColor(renderer, color
|
|
13535
|
+
this.opentui.symbols.setCursorColor(renderer, rgbaPtr(color));
|
|
13582
13536
|
}
|
|
13583
13537
|
getCursorState(renderer) {
|
|
13584
13538
|
const cursorBuffer = new ArrayBuffer(CursorStateStruct.size);
|
|
@@ -13749,11 +13703,11 @@ class FFIRenderLib {
|
|
|
13749
13703
|
this.opentui.symbols.textBufferClear(buffer);
|
|
13750
13704
|
}
|
|
13751
13705
|
textBufferSetDefaultFg(buffer, fg2) {
|
|
13752
|
-
const fgPtr = fg2
|
|
13706
|
+
const fgPtr = optionalRgbaPtr(fg2);
|
|
13753
13707
|
this.opentui.symbols.textBufferSetDefaultFg(buffer, fgPtr);
|
|
13754
13708
|
}
|
|
13755
13709
|
textBufferSetDefaultBg(buffer, bg2) {
|
|
13756
|
-
const bgPtr = bg2
|
|
13710
|
+
const bgPtr = optionalRgbaPtr(bg2);
|
|
13757
13711
|
this.opentui.symbols.textBufferSetDefaultBg(buffer, bgPtr);
|
|
13758
13712
|
}
|
|
13759
13713
|
textBufferSetDefaultAttributes(buffer, attributes) {
|
|
@@ -13847,8 +13801,8 @@ class FFIRenderLib {
|
|
|
13847
13801
|
this.opentui.symbols.destroyTextBufferView(view);
|
|
13848
13802
|
}
|
|
13849
13803
|
textBufferViewSetSelection(view, start, end, bgColor, fgColor) {
|
|
13850
|
-
const bg2 = bgColor
|
|
13851
|
-
const fg2 = fgColor
|
|
13804
|
+
const bg2 = optionalRgbaPtr(bgColor);
|
|
13805
|
+
const fg2 = optionalRgbaPtr(fgColor);
|
|
13852
13806
|
this.opentui.symbols.textBufferViewSetSelection(view, start, end, bg2, fg2);
|
|
13853
13807
|
}
|
|
13854
13808
|
textBufferViewResetSelection(view) {
|
|
@@ -13867,18 +13821,18 @@ class FFIRenderLib {
|
|
|
13867
13821
|
return this.opentui.symbols.textBufferViewGetSelectionInfo(view);
|
|
13868
13822
|
}
|
|
13869
13823
|
textBufferViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor) {
|
|
13870
|
-
const bg2 = bgColor
|
|
13871
|
-
const fg2 = fgColor
|
|
13824
|
+
const bg2 = optionalRgbaPtr(bgColor);
|
|
13825
|
+
const fg2 = optionalRgbaPtr(fgColor);
|
|
13872
13826
|
return this.opentui.symbols.textBufferViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2);
|
|
13873
13827
|
}
|
|
13874
13828
|
textBufferViewUpdateSelection(view, end, bgColor, fgColor) {
|
|
13875
|
-
const bg2 = bgColor
|
|
13876
|
-
const fg2 = fgColor
|
|
13829
|
+
const bg2 = optionalRgbaPtr(bgColor);
|
|
13830
|
+
const fg2 = optionalRgbaPtr(fgColor);
|
|
13877
13831
|
this.opentui.symbols.textBufferViewUpdateSelection(view, end, bg2, fg2);
|
|
13878
13832
|
}
|
|
13879
13833
|
textBufferViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor) {
|
|
13880
|
-
const bg2 = bgColor
|
|
13881
|
-
const fg2 = fgColor
|
|
13834
|
+
const bg2 = optionalRgbaPtr(bgColor);
|
|
13835
|
+
const fg2 = optionalRgbaPtr(fgColor);
|
|
13882
13836
|
return this.opentui.symbols.textBufferViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2);
|
|
13883
13837
|
}
|
|
13884
13838
|
textBufferViewResetLocalSelection(view) {
|
|
@@ -13967,7 +13921,7 @@ class FFIRenderLib {
|
|
|
13967
13921
|
this.opentui.symbols.textBufferViewSetTabIndicator(view, indicator);
|
|
13968
13922
|
}
|
|
13969
13923
|
textBufferViewSetTabIndicatorColor(view, color) {
|
|
13970
|
-
this.opentui.symbols.textBufferViewSetTabIndicatorColor(view, color
|
|
13924
|
+
this.opentui.symbols.textBufferViewSetTabIndicatorColor(view, rgbaPtr(color));
|
|
13971
13925
|
}
|
|
13972
13926
|
textBufferViewSetTruncate(view, truncate) {
|
|
13973
13927
|
this.opentui.symbols.textBufferViewSetTruncate(view, truncate);
|
|
@@ -14296,8 +14250,8 @@ class FFIRenderLib {
|
|
|
14296
14250
|
return outBuffer.slice(0, len);
|
|
14297
14251
|
}
|
|
14298
14252
|
editorViewSetSelection(view, start, end, bgColor, fgColor) {
|
|
14299
|
-
const bg2 = bgColor
|
|
14300
|
-
const fg2 = fgColor
|
|
14253
|
+
const bg2 = optionalRgbaPtr(bgColor);
|
|
14254
|
+
const fg2 = optionalRgbaPtr(fgColor);
|
|
14301
14255
|
this.opentui.symbols.editorViewSetSelection(view, start, end, bg2, fg2);
|
|
14302
14256
|
}
|
|
14303
14257
|
editorViewResetSelection(view) {
|
|
@@ -14313,18 +14267,18 @@ class FFIRenderLib {
|
|
|
14313
14267
|
return { start, end };
|
|
14314
14268
|
}
|
|
14315
14269
|
editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, updateCursor, followCursor) {
|
|
14316
|
-
const bg2 = bgColor
|
|
14317
|
-
const fg2 = fgColor
|
|
14270
|
+
const bg2 = optionalRgbaPtr(bgColor);
|
|
14271
|
+
const fg2 = optionalRgbaPtr(fgColor);
|
|
14318
14272
|
return this.opentui.symbols.editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2, updateCursor, followCursor);
|
|
14319
14273
|
}
|
|
14320
14274
|
editorViewUpdateSelection(view, end, bgColor, fgColor) {
|
|
14321
|
-
const bg2 = bgColor
|
|
14322
|
-
const fg2 = fgColor
|
|
14275
|
+
const bg2 = optionalRgbaPtr(bgColor);
|
|
14276
|
+
const fg2 = optionalRgbaPtr(fgColor);
|
|
14323
14277
|
this.opentui.symbols.editorViewUpdateSelection(view, end, bg2, fg2);
|
|
14324
14278
|
}
|
|
14325
14279
|
editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, updateCursor, followCursor) {
|
|
14326
|
-
const bg2 = bgColor
|
|
14327
|
-
const fg2 = fgColor
|
|
14280
|
+
const bg2 = optionalRgbaPtr(bgColor);
|
|
14281
|
+
const fg2 = optionalRgbaPtr(fgColor);
|
|
14328
14282
|
return this.opentui.symbols.editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2, updateCursor, followCursor);
|
|
14329
14283
|
}
|
|
14330
14284
|
editorViewResetLocalSelection(view) {
|
|
@@ -14472,7 +14426,7 @@ class FFIRenderLib {
|
|
|
14472
14426
|
this.opentui.symbols.freeUnicode(encoded.ptr, encoded.data.length);
|
|
14473
14427
|
}
|
|
14474
14428
|
bufferDrawChar(buffer, char, x, y, fg2, bg2, attributes = 0) {
|
|
14475
|
-
this.opentui.symbols.bufferDrawChar(buffer, char, x, y, fg2
|
|
14429
|
+
this.opentui.symbols.bufferDrawChar(buffer, char, x, y, rgbaPtr(fg2), rgbaPtr(bg2), attributes);
|
|
14476
14430
|
}
|
|
14477
14431
|
registerNativeSpanFeedStream(stream, handler) {
|
|
14478
14432
|
const callback = this.ensureNativeSpanFeedCallback();
|
|
@@ -14553,8 +14507,8 @@ class FFIRenderLib {
|
|
|
14553
14507
|
}
|
|
14554
14508
|
syntaxStyleRegister(style, name, fg2, bg2, attributes) {
|
|
14555
14509
|
const nameBytes = this.encoder.encode(name);
|
|
14556
|
-
const fgPtr = fg2
|
|
14557
|
-
const bgPtr = bg2
|
|
14510
|
+
const fgPtr = optionalRgbaPtr(fg2);
|
|
14511
|
+
const bgPtr = optionalRgbaPtr(bg2);
|
|
14558
14512
|
return this.opentui.symbols.syntaxStyleRegister(style, nameBytes, nameBytes.length, fgPtr, bgPtr, attributes);
|
|
14559
14513
|
}
|
|
14560
14514
|
syntaxStyleResolveByName(style, name) {
|
|
@@ -14579,7 +14533,7 @@ class FFIRenderLib {
|
|
|
14579
14533
|
this.opentui.symbols.editorViewSetTabIndicator(view, indicator);
|
|
14580
14534
|
}
|
|
14581
14535
|
editorViewSetTabIndicatorColor(view, color) {
|
|
14582
|
-
this.opentui.symbols.editorViewSetTabIndicatorColor(view, color
|
|
14536
|
+
this.opentui.symbols.editorViewSetTabIndicatorColor(view, rgbaPtr(color));
|
|
14583
14537
|
}
|
|
14584
14538
|
onNativeEvent(name, handler) {
|
|
14585
14539
|
this._nativeEvents.on(name, handler);
|
|
@@ -14894,6 +14848,7 @@ var RenderableEvents;
|
|
|
14894
14848
|
((RenderableEvents2) => {
|
|
14895
14849
|
RenderableEvents2["FOCUSED"] = "focused";
|
|
14896
14850
|
RenderableEvents2["BLURRED"] = "blurred";
|
|
14851
|
+
RenderableEvents2["DESTROYED"] = "destroyed";
|
|
14897
14852
|
})(RenderableEvents ||= {});
|
|
14898
14853
|
function isRenderable(obj) {
|
|
14899
14854
|
return !!obj?.[BrandedRenderable];
|
|
@@ -15086,8 +15041,8 @@ class Renderable extends BaseRenderable {
|
|
|
15086
15041
|
focus() {
|
|
15087
15042
|
if (this._isDestroyed || this._focused || !this._focusable)
|
|
15088
15043
|
return;
|
|
15089
|
-
this._ctx.focusRenderable(this);
|
|
15090
15044
|
this._focused = true;
|
|
15045
|
+
this._ctx.focusRenderable(this);
|
|
15091
15046
|
this.requestRender();
|
|
15092
15047
|
this.keypressHandler = (key) => {
|
|
15093
15048
|
if (this._isDestroyed)
|
|
@@ -15970,6 +15925,7 @@ class Renderable extends BaseRenderable {
|
|
|
15970
15925
|
return;
|
|
15971
15926
|
}
|
|
15972
15927
|
this._isDestroyed = true;
|
|
15928
|
+
this.emit("destroyed" /* DESTROYED */);
|
|
15973
15929
|
if (this.parent) {
|
|
15974
15930
|
this.parent.remove(this.id);
|
|
15975
15931
|
}
|
|
@@ -17058,9 +17014,11 @@ class SyntaxStyle {
|
|
|
17058
17014
|
underline: style.underline,
|
|
17059
17015
|
dim: style.dim
|
|
17060
17016
|
});
|
|
17061
|
-
const
|
|
17017
|
+
const fg2 = style.fg ? parseColor(style.fg) : null;
|
|
17018
|
+
const bg2 = style.bg ? parseColor(style.bg) : null;
|
|
17019
|
+
const id = this.lib.syntaxStyleRegister(this.stylePtr, name, fg2, bg2, attributes);
|
|
17062
17020
|
this.nameCache.set(name, id);
|
|
17063
|
-
this.styleDefs.set(name, style);
|
|
17021
|
+
this.styleDefs.set(name, { ...style, fg: fg2 ?? undefined, bg: bg2 ?? undefined });
|
|
17064
17022
|
return id;
|
|
17065
17023
|
}
|
|
17066
17024
|
resolveStyleId(name) {
|
|
@@ -18475,7 +18433,7 @@ class CapturedWritableStream extends Writable {
|
|
|
18475
18433
|
}
|
|
18476
18434
|
}
|
|
18477
18435
|
|
|
18478
|
-
// src/lib/
|
|
18436
|
+
// src/lib/keybinding.internal.ts
|
|
18479
18437
|
var defaultKeyAliases = {
|
|
18480
18438
|
enter: "return",
|
|
18481
18439
|
esc: "escape",
|
|
@@ -21124,6 +21082,7 @@ var CliRenderEvents;
|
|
|
21124
21082
|
CliRenderEvents2["RESIZE"] = "resize";
|
|
21125
21083
|
CliRenderEvents2["FOCUS"] = "focus";
|
|
21126
21084
|
CliRenderEvents2["BLUR"] = "blur";
|
|
21085
|
+
CliRenderEvents2["FOCUSED_RENDERABLE"] = "focused_renderable";
|
|
21127
21086
|
CliRenderEvents2["FOCUSED_EDITOR"] = "focused_editor";
|
|
21128
21087
|
CliRenderEvents2["THEME_MODE"] = "theme_mode";
|
|
21129
21088
|
CliRenderEvents2["CAPABILITIES"] = "capabilities";
|
|
@@ -21521,20 +21480,29 @@ Captured external output:
|
|
|
21521
21480
|
return Math.max(now - then, 0);
|
|
21522
21481
|
}
|
|
21523
21482
|
focusRenderable(renderable) {
|
|
21524
|
-
if (this._currentFocusedRenderable === renderable)
|
|
21483
|
+
if (this._currentFocusedRenderable === renderable) {
|
|
21525
21484
|
return;
|
|
21526
|
-
|
|
21527
|
-
this._currentFocusedRenderable
|
|
21485
|
+
}
|
|
21486
|
+
const previousRenderable = this._currentFocusedRenderable;
|
|
21487
|
+
const previousEditor = this.currentFocusedEditor;
|
|
21528
21488
|
this._currentFocusedRenderable = renderable;
|
|
21529
|
-
|
|
21530
|
-
|
|
21531
|
-
|
|
21489
|
+
previousRenderable?.blur();
|
|
21490
|
+
const currentEditor = this.currentFocusedEditor;
|
|
21491
|
+
if (previousEditor !== currentEditor) {
|
|
21492
|
+
this.emit("focused_editor" /* FOCUSED_EDITOR */, currentEditor, previousEditor);
|
|
21532
21493
|
}
|
|
21494
|
+
this.emit("focused_renderable" /* FOCUSED_RENDERABLE */, renderable, previousRenderable);
|
|
21533
21495
|
}
|
|
21534
21496
|
blurRenderable(renderable) {
|
|
21535
|
-
if (this._currentFocusedRenderable
|
|
21536
|
-
|
|
21497
|
+
if (this._currentFocusedRenderable !== renderable) {
|
|
21498
|
+
return;
|
|
21499
|
+
}
|
|
21500
|
+
const previousEditor = this.currentFocusedEditor;
|
|
21501
|
+
this._currentFocusedRenderable = null;
|
|
21502
|
+
if (previousEditor !== null) {
|
|
21503
|
+
this.emit("focused_editor" /* FOCUSED_EDITOR */, null, previousEditor);
|
|
21537
21504
|
}
|
|
21505
|
+
this.emit("focused_renderable" /* FOCUSED_RENDERABLE */, null, renderable);
|
|
21538
21506
|
}
|
|
21539
21507
|
setCapturedRenderable(renderable) {
|
|
21540
21508
|
if (this.capturedRenderable === renderable) {
|
|
@@ -23652,7 +23620,7 @@ Captured external output:
|
|
|
23652
23620
|
}
|
|
23653
23621
|
syncNativePaletteState(colors) {
|
|
23654
23622
|
const signature = buildTerminalPaletteSignature(colors);
|
|
23655
|
-
if (this._publishedPaletteSignature !==
|
|
23623
|
+
if (this._publishedPaletteSignature !== signature) {
|
|
23656
23624
|
this._paletteEpoch = this._paletteEpoch + 1 >>> 0;
|
|
23657
23625
|
}
|
|
23658
23626
|
this._publishedPaletteSignature = signature;
|
|
@@ -23737,7 +23705,7 @@ Captured external output:
|
|
|
23737
23705
|
}
|
|
23738
23706
|
}
|
|
23739
23707
|
|
|
23740
|
-
export { __toESM, __commonJS, __export, __require, MeasureMode, exports_src, isValidBorderStyle, parseBorderStyle, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler,
|
|
23708
|
+
export { __toESM, __commonJS, __export, __require, MeasureMode, exports_src, isValidBorderStyle, parseBorderStyle, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, DEFAULT_FOREGROUND_RGB, DEFAULT_BACKGROUND_RGB, normalizeIndexedColorIndex, ansi256IndexToRgb, RGBA, normalizeColorValue, hexToRgb, rgbToHex, hsvToRgb, parseColor, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, ATTRIBUTE_BASE_BITS, ATTRIBUTE_BASE_MASK, getBaseAttributes, DebugOverlayCorner, TargetChannel, createTextAttributes, attributesWithLink, getLinkId, visualizeRenderableTree, isStyledText, StyledText, stringToStyledText, black, red, green, yellow, blue, magenta, cyan, white, brightBlack, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bold, italic, underline, strikethrough, dim, reverse, blink, fg, bg, link, t, hastToStyledText, SystemClock, nonAlphanumericKeys, terminalNamedSingleStrokeKeys, parseKeypress, LinearScrollAccel, MacOSScrollAccel, parseAlign, parseAlignItems, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, StdinParser, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extensionToFiletype, basenameToFiletype, extToFiletype, pathToFiletype, infoStringToFiletype, main, getTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, normalizeTerminalPalette, buildTerminalPaletteSignature, decodePasteBytes, stripAnsiSequences, detectLinks, TextBuffer, SpanInfoStruct, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, OptimizedBuffer, h, isVNode, maybeMakeRenderable, wrapWithDelegates, instantiate, delegate, LayoutEvents, RenderableEvents, isRenderable, BaseRenderable, Renderable, RootRenderable, TextBufferView, EditBuffer, EditorView, convertThemeToStyles, SyntaxStyle, ANSI, BoxRenderable, TextBufferRenderable, CodeRenderable, isTextNodeRenderable, TextNodeRenderable, RootTextNodeRenderable, TextRenderable, defaultKeyAliases, mergeKeyAliases, mergeKeyBindings, getKeyBindingAction, buildKeyBindingsMap, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, EditBufferRenderableEvents, isEditBufferRenderable, EditBufferRenderable, calculateRenderGeometry, buildKittyKeyboardFlags, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
|
|
23741
23709
|
|
|
23742
|
-
//# debugId=
|
|
23743
|
-
//# sourceMappingURL=index-
|
|
23710
|
+
//# debugId=9856AC3785612B6364756E2164756E21
|
|
23711
|
+
//# sourceMappingURL=index-mw2x3082.js.map
|