@opentui/core 0.5.10 → 0.5.11
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 +2 -0
- package/audio.d.ts +6 -1
- package/{chunk-bun-9gqvxy8c.js → chunk-bun-37s3zwb6.js} +1181 -1036
- package/{chunk-bun-9gqvxy8c.js.map → chunk-bun-37s3zwb6.js.map} +7 -7
- package/{chunk-bun-bb3k0yt8.js → chunk-bun-bwjmgnxw.js} +647 -582
- package/chunk-bun-bwjmgnxw.js.map +32 -0
- package/{chunk-node-6bg8r2m7.js → chunk-node-54dhb2fr.js} +647 -582
- package/chunk-node-54dhb2fr.js.map +32 -0
- package/{chunk-node-f647ts9q.js → chunk-node-70eg2nhg.js} +1188 -1040
- package/{chunk-node-f647ts9q.js.map → chunk-node-70eg2nhg.js.map} +7 -7
- package/index.bun.js +1571 -1377
- package/index.bun.js.map +7 -7
- package/index.node.js +1571 -1377
- package/index.node.js.map +7 -7
- package/lib/detect-links.d.ts +5 -0
- package/lib/tree-sitter/update-assets.js +4 -4
- package/lib/tree-sitter/update-assets.js.map +2 -2
- package/lib/tree-sitter-styled-text.d.ts +4 -0
- package/package.json +13 -9
- package/parser.worker.js +7 -10
- package/parser.worker.js.map +2 -2
- package/renderables/Code.d.ts +6 -0
- package/renderables/Diff.d.ts +1 -2
- package/renderables/Markdown.d.ts +6 -0
- package/renderables/TextBufferRenderable.d.ts +2 -0
- package/renderer.d.ts +2 -0
- package/testing.bun.js +23 -23
- package/testing.bun.js.map +2 -2
- package/testing.js +23 -23
- package/testing.js.map +2 -2
- package/text-buffer-view.d.ts +1 -0
- package/types.d.ts +1 -0
- package/yoga.bun.js +187 -187
- package/yoga.bun.js.map +1 -1
- package/yoga.js +187 -187
- package/yoga.js.map +1 -1
- package/zig-structs.d.ts +8 -1
- package/zig.d.ts +4 -0
- package/chunk-bun-bb3k0yt8.js.map +0 -32
- package/chunk-node-6bg8r2m7.js.map +0 -32
|
@@ -13,104 +13,103 @@ var __export = (target, all) => {
|
|
|
13
13
|
set: __exportSetter.bind(all, name)
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
-
var __require = import.meta.require;
|
|
17
16
|
|
|
18
17
|
// src/yoga.ts
|
|
19
18
|
var exports_yoga = {};
|
|
20
19
|
__export(exports_yoga, {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
FLEX_DIRECTION_ROW: () =>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
20
|
+
ALIGN_AUTO: () => ALIGN_AUTO2,
|
|
21
|
+
ALIGN_BASELINE: () => ALIGN_BASELINE2,
|
|
22
|
+
ALIGN_CENTER: () => ALIGN_CENTER2,
|
|
23
|
+
ALIGN_FLEX_END: () => ALIGN_FLEX_END2,
|
|
24
|
+
ALIGN_FLEX_START: () => ALIGN_FLEX_START2,
|
|
25
|
+
ALIGN_SPACE_AROUND: () => ALIGN_SPACE_AROUND2,
|
|
26
|
+
ALIGN_SPACE_BETWEEN: () => ALIGN_SPACE_BETWEEN2,
|
|
27
|
+
ALIGN_SPACE_EVENLY: () => ALIGN_SPACE_EVENLY2,
|
|
28
|
+
ALIGN_STRETCH: () => ALIGN_STRETCH2,
|
|
29
|
+
Align: () => Align2,
|
|
30
|
+
BOX_SIZING_BORDER_BOX: () => BOX_SIZING_BORDER_BOX2,
|
|
31
|
+
BOX_SIZING_CONTENT_BOX: () => BOX_SIZING_CONTENT_BOX2,
|
|
32
|
+
BoxSizing: () => BoxSizing2,
|
|
33
|
+
Config: () => Config2,
|
|
34
|
+
DIMENSION_HEIGHT: () => DIMENSION_HEIGHT2,
|
|
35
|
+
DIMENSION_WIDTH: () => DIMENSION_WIDTH2,
|
|
36
|
+
DIRECTION_INHERIT: () => DIRECTION_INHERIT2,
|
|
37
|
+
DIRECTION_LTR: () => DIRECTION_LTR2,
|
|
38
|
+
DIRECTION_RTL: () => DIRECTION_RTL2,
|
|
39
|
+
DISPLAY_CONTENTS: () => DISPLAY_CONTENTS2,
|
|
40
|
+
DISPLAY_FLEX: () => DISPLAY_FLEX2,
|
|
41
|
+
DISPLAY_NONE: () => DISPLAY_NONE2,
|
|
42
|
+
Dimension: () => Dimension2,
|
|
43
|
+
Direction: () => Direction2,
|
|
44
|
+
Display: () => Display2,
|
|
45
|
+
EDGE_ALL: () => EDGE_ALL2,
|
|
46
|
+
EDGE_BOTTOM: () => EDGE_BOTTOM2,
|
|
47
|
+
EDGE_END: () => EDGE_END2,
|
|
48
|
+
EDGE_HORIZONTAL: () => EDGE_HORIZONTAL2,
|
|
49
|
+
EDGE_LEFT: () => EDGE_LEFT2,
|
|
50
|
+
EDGE_RIGHT: () => EDGE_RIGHT2,
|
|
51
|
+
EDGE_START: () => EDGE_START2,
|
|
52
|
+
EDGE_TOP: () => EDGE_TOP2,
|
|
53
|
+
EDGE_VERTICAL: () => EDGE_VERTICAL2,
|
|
54
|
+
ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE: () => ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE2,
|
|
55
|
+
ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING: () => ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING2,
|
|
56
|
+
ERRATA_ALL: () => ERRATA_ALL2,
|
|
57
|
+
ERRATA_CLASSIC: () => ERRATA_CLASSIC2,
|
|
58
|
+
ERRATA_NONE: () => ERRATA_NONE2,
|
|
59
|
+
ERRATA_STRETCH_FLEX_BASIS: () => ERRATA_STRETCH_FLEX_BASIS2,
|
|
60
|
+
EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS: () => EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS2,
|
|
61
|
+
Edge: () => Edge2,
|
|
62
|
+
Errata: () => Errata2,
|
|
63
|
+
ExperimentalFeature: () => ExperimentalFeature2,
|
|
64
|
+
FLEX_DIRECTION_COLUMN: () => FLEX_DIRECTION_COLUMN2,
|
|
65
|
+
FLEX_DIRECTION_COLUMN_REVERSE: () => FLEX_DIRECTION_COLUMN_REVERSE2,
|
|
66
|
+
FLEX_DIRECTION_ROW: () => FLEX_DIRECTION_ROW2,
|
|
67
|
+
FLEX_DIRECTION_ROW_REVERSE: () => FLEX_DIRECTION_ROW_REVERSE2,
|
|
68
|
+
FlexDirection: () => FlexDirection2,
|
|
69
|
+
GUTTER_ALL: () => GUTTER_ALL2,
|
|
70
|
+
GUTTER_COLUMN: () => GUTTER_COLUMN2,
|
|
71
|
+
GUTTER_ROW: () => GUTTER_ROW2,
|
|
72
|
+
Gutter: () => Gutter2,
|
|
73
|
+
JUSTIFY_CENTER: () => JUSTIFY_CENTER2,
|
|
74
|
+
JUSTIFY_FLEX_END: () => JUSTIFY_FLEX_END2,
|
|
75
|
+
JUSTIFY_FLEX_START: () => JUSTIFY_FLEX_START2,
|
|
76
|
+
JUSTIFY_SPACE_AROUND: () => JUSTIFY_SPACE_AROUND2,
|
|
77
|
+
JUSTIFY_SPACE_BETWEEN: () => JUSTIFY_SPACE_BETWEEN2,
|
|
78
|
+
JUSTIFY_SPACE_EVENLY: () => JUSTIFY_SPACE_EVENLY2,
|
|
79
|
+
Justify: () => Justify2,
|
|
80
|
+
LOG_LEVEL_DEBUG: () => LOG_LEVEL_DEBUG2,
|
|
81
|
+
LOG_LEVEL_ERROR: () => LOG_LEVEL_ERROR2,
|
|
82
|
+
LOG_LEVEL_FATAL: () => LOG_LEVEL_FATAL2,
|
|
83
|
+
LOG_LEVEL_INFO: () => LOG_LEVEL_INFO2,
|
|
84
|
+
LOG_LEVEL_VERBOSE: () => LOG_LEVEL_VERBOSE2,
|
|
85
|
+
LOG_LEVEL_WARN: () => LOG_LEVEL_WARN2,
|
|
86
|
+
LogLevel: () => LogLevel3,
|
|
87
|
+
MEASURE_MODE_AT_MOST: () => MEASURE_MODE_AT_MOST2,
|
|
88
|
+
MEASURE_MODE_EXACTLY: () => MEASURE_MODE_EXACTLY2,
|
|
89
|
+
MEASURE_MODE_UNDEFINED: () => MEASURE_MODE_UNDEFINED2,
|
|
90
|
+
MeasureMode: () => MeasureMode2,
|
|
91
|
+
NODE_TYPE_DEFAULT: () => NODE_TYPE_DEFAULT2,
|
|
92
|
+
NODE_TYPE_TEXT: () => NODE_TYPE_TEXT2,
|
|
93
|
+
Node: () => Node2,
|
|
94
|
+
NodeType: () => NodeType2,
|
|
95
|
+
OVERFLOW_HIDDEN: () => OVERFLOW_HIDDEN2,
|
|
96
|
+
OVERFLOW_SCROLL: () => OVERFLOW_SCROLL2,
|
|
97
|
+
OVERFLOW_VISIBLE: () => OVERFLOW_VISIBLE2,
|
|
98
|
+
Overflow: () => Overflow2,
|
|
99
|
+
POSITION_TYPE_ABSOLUTE: () => POSITION_TYPE_ABSOLUTE2,
|
|
100
|
+
POSITION_TYPE_RELATIVE: () => POSITION_TYPE_RELATIVE2,
|
|
101
|
+
POSITION_TYPE_STATIC: () => POSITION_TYPE_STATIC2,
|
|
102
|
+
PositionType: () => PositionType2,
|
|
103
|
+
UNIT_AUTO: () => UNIT_AUTO2,
|
|
104
|
+
UNIT_PERCENT: () => UNIT_PERCENT2,
|
|
105
|
+
UNIT_POINT: () => UNIT_POINT2,
|
|
106
|
+
UNIT_UNDEFINED: () => UNIT_UNDEFINED2,
|
|
107
|
+
Unit: () => Unit2,
|
|
108
|
+
WRAP_NO_WRAP: () => WRAP_NO_WRAP2,
|
|
109
|
+
WRAP_WRAP: () => WRAP_WRAP2,
|
|
110
|
+
WRAP_WRAP_REVERSE: () => WRAP_WRAP_REVERSE2,
|
|
111
|
+
Wrap: () => Wrap2,
|
|
112
|
+
default: () => yoga_default
|
|
114
113
|
});
|
|
115
114
|
|
|
116
115
|
// src/platform/ffi.ts
|
|
@@ -664,7 +663,7 @@ var emoji_regex_default = () => {
|
|
|
664
663
|
// ../../node_modules/.bun/string-width@7.2.0/node_modules/string-width/index.js
|
|
665
664
|
var segmenter = new Intl.Segmenter;
|
|
666
665
|
var defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
667
|
-
function
|
|
666
|
+
function stringWidth2(string, options = {}) {
|
|
668
667
|
if (typeof string !== "string" || string.length === 0) {
|
|
669
668
|
return 0;
|
|
670
669
|
}
|
|
@@ -735,16 +734,16 @@ function destroySingleton(key) {
|
|
|
735
734
|
}
|
|
736
735
|
|
|
737
736
|
// src/lib/env.ts
|
|
738
|
-
var
|
|
739
|
-
function
|
|
740
|
-
const existing =
|
|
737
|
+
var envRegistry2 = singleton("env-registry", () => ({}));
|
|
738
|
+
function registerEnvVar2(config) {
|
|
739
|
+
const existing = envRegistry2[config.name];
|
|
741
740
|
if (existing) {
|
|
742
741
|
if (existing.description !== config.description || existing.type !== config.type || existing.default !== config.default || existing.required !== config.required) {
|
|
743
742
|
throw new Error(`Environment variable "${config.name}" is already registered with different configuration. ` + `Existing: ${JSON.stringify(existing)}, New: ${JSON.stringify(config)}`);
|
|
744
743
|
}
|
|
745
744
|
return;
|
|
746
745
|
}
|
|
747
|
-
|
|
746
|
+
envRegistry2[config.name] = config;
|
|
748
747
|
}
|
|
749
748
|
function normalizeBoolean(value) {
|
|
750
749
|
const lowerValue = value.toLowerCase();
|
|
@@ -782,11 +781,11 @@ class EnvStore {
|
|
|
782
781
|
if (this.parsedValues.has(key)) {
|
|
783
782
|
return this.parsedValues.get(key);
|
|
784
783
|
}
|
|
785
|
-
if (!(key in
|
|
784
|
+
if (!(key in envRegistry2)) {
|
|
786
785
|
throw new Error(`Environment variable ${key} is not registered.`);
|
|
787
786
|
}
|
|
788
787
|
try {
|
|
789
|
-
const value = parseEnvValue(
|
|
788
|
+
const value = parseEnvValue(envRegistry2[key]);
|
|
790
789
|
this.parsedValues.set(key, value);
|
|
791
790
|
return value;
|
|
792
791
|
} catch (error) {
|
|
@@ -794,18 +793,18 @@ class EnvStore {
|
|
|
794
793
|
}
|
|
795
794
|
}
|
|
796
795
|
has(key) {
|
|
797
|
-
return key in
|
|
796
|
+
return key in envRegistry2;
|
|
798
797
|
}
|
|
799
798
|
clearCache() {
|
|
800
799
|
this.parsedValues.clear();
|
|
801
800
|
}
|
|
802
801
|
}
|
|
803
802
|
var envStore = singleton("env-store", () => new EnvStore);
|
|
804
|
-
function
|
|
803
|
+
function clearEnvCache2() {
|
|
805
804
|
envStore.clearCache();
|
|
806
805
|
}
|
|
807
|
-
function
|
|
808
|
-
const configs = Object.values(
|
|
806
|
+
function generateEnvMarkdown2() {
|
|
807
|
+
const configs = Object.values(envRegistry2);
|
|
809
808
|
if (configs.length === 0) {
|
|
810
809
|
return `# Environment Variables
|
|
811
810
|
|
|
@@ -840,8 +839,8 @@ No environment variables registered.
|
|
|
840
839
|
}
|
|
841
840
|
return markdown;
|
|
842
841
|
}
|
|
843
|
-
function
|
|
844
|
-
const configs = Object.values(
|
|
842
|
+
function generateEnvColored2() {
|
|
843
|
+
const configs = Object.values(envRegistry2);
|
|
845
844
|
if (configs.length === 0) {
|
|
846
845
|
return `\x1B[1;36mEnvironment Variables\x1B[0m
|
|
847
846
|
|
|
@@ -874,7 +873,7 @@ No environment variables registered.
|
|
|
874
873
|
}
|
|
875
874
|
return output;
|
|
876
875
|
}
|
|
877
|
-
var
|
|
876
|
+
var env2 = new Proxy({}, {
|
|
878
877
|
get(target, prop) {
|
|
879
878
|
if (typeof prop !== "string") {
|
|
880
879
|
return;
|
|
@@ -885,7 +884,7 @@ var env = new Proxy({}, {
|
|
|
885
884
|
return envStore.has(prop);
|
|
886
885
|
},
|
|
887
886
|
ownKeys() {
|
|
888
|
-
return Object.keys(
|
|
887
|
+
return Object.keys(envRegistry2);
|
|
889
888
|
},
|
|
890
889
|
getOwnPropertyDescriptor(target, prop) {
|
|
891
890
|
if (envStore.has(prop)) {
|
|
@@ -900,7 +899,7 @@ var env = new Proxy({}, {
|
|
|
900
899
|
});
|
|
901
900
|
|
|
902
901
|
// src/platform/assets.ts
|
|
903
|
-
|
|
902
|
+
registerEnvVar2({
|
|
904
903
|
name: "OTUI_ASSET_ROOT",
|
|
905
904
|
description: "Absolute directory containing relocatable OpenTUI runtime assets",
|
|
906
905
|
type: "string",
|
|
@@ -947,10 +946,10 @@ function validateAssetKey(key) {
|
|
|
947
946
|
var TEXT_ENCODER = new TextEncoder;
|
|
948
947
|
var bun = globalThis.Bun;
|
|
949
948
|
var sleep = bun?.sleep ?? standardSleep;
|
|
950
|
-
var
|
|
949
|
+
var stringWidth = bun?.stringWidth ?? stringWidth2;
|
|
951
950
|
var stripANSI = bun?.stripANSI ?? stripAnsi;
|
|
952
951
|
var writeFile = bun?.write ?? writeFilePortable;
|
|
953
|
-
async function
|
|
952
|
+
async function resolveBundledFilePath2(key, loadBundledFile, fallbackPath, metaUrl, options = {}) {
|
|
954
953
|
if (options.useAssetRoot ?? true) {
|
|
955
954
|
const configuredPath = resolveAssetRootPath(key);
|
|
956
955
|
if (configuredPath !== undefined) {
|
|
@@ -1009,7 +1008,7 @@ function extractBundledImportSpecifier(loadBundledFile) {
|
|
|
1009
1008
|
}
|
|
1010
1009
|
function standardSleep(msOrDate) {
|
|
1011
1010
|
const ms = msOrDate instanceof Date ? msOrDate.getTime() - Date.now() : msOrDate;
|
|
1012
|
-
return new Promise((
|
|
1011
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1013
1012
|
}
|
|
1014
1013
|
async function writeFilePortable(destination, data, options) {
|
|
1015
1014
|
const destinationPath = destination instanceof URL ? fileURLToPath3(destination) : destination;
|
|
@@ -1026,8 +1025,8 @@ import { existsSync as existsSync3, writeFileSync } from "fs";
|
|
|
1026
1025
|
import { EventEmitter as EventEmitter4 } from "events";
|
|
1027
1026
|
|
|
1028
1027
|
// src/lib/RGBA.ts
|
|
1029
|
-
var
|
|
1030
|
-
var
|
|
1028
|
+
var DEFAULT_FOREGROUND_RGB2 = [255, 255, 255];
|
|
1029
|
+
var DEFAULT_BACKGROUND_RGB2 = [0, 0, 0];
|
|
1031
1030
|
var INTENT_RGB = 0;
|
|
1032
1031
|
var INTENT_INDEXED = 1;
|
|
1033
1032
|
var INTENT_DEFAULT = 2;
|
|
@@ -1068,17 +1067,17 @@ function packRGBA8(r, g, b, a, meta) {
|
|
|
1068
1067
|
]);
|
|
1069
1068
|
}
|
|
1070
1069
|
function rgbaForAnsi256Index(index) {
|
|
1071
|
-
const [r, g, b] =
|
|
1072
|
-
return
|
|
1070
|
+
const [r, g, b] = ansi256IndexToRgb2(index);
|
|
1071
|
+
return RGBA2.fromInts(r, g, b);
|
|
1073
1072
|
}
|
|
1074
|
-
function
|
|
1073
|
+
function normalizeIndexedColorIndex2(index) {
|
|
1075
1074
|
if (!Number.isInteger(index) || index < 0 || index > 255) {
|
|
1076
1075
|
throw new RangeError(`Indexed color must be an integer in the range 0..255, got ${index}`);
|
|
1077
1076
|
}
|
|
1078
1077
|
return index;
|
|
1079
1078
|
}
|
|
1080
|
-
function
|
|
1081
|
-
const normalizedIndex =
|
|
1079
|
+
function ansi256IndexToRgb2(index) {
|
|
1080
|
+
const normalizedIndex = normalizeIndexedColorIndex2(index);
|
|
1082
1081
|
if (normalizedIndex < ANSI16_RGB.length) {
|
|
1083
1082
|
return ANSI16_RGB[normalizedIndex];
|
|
1084
1083
|
}
|
|
@@ -1093,42 +1092,42 @@ function ansi256IndexToRgb(index) {
|
|
|
1093
1092
|
return [value, value, value];
|
|
1094
1093
|
}
|
|
1095
1094
|
|
|
1096
|
-
class
|
|
1095
|
+
class RGBA2 {
|
|
1097
1096
|
buffer;
|
|
1098
1097
|
constructor(buffer) {
|
|
1099
1098
|
this.buffer = new Uint16Array(4);
|
|
1100
1099
|
this.buffer.set(buffer.subarray(0, 4));
|
|
1101
1100
|
}
|
|
1102
1101
|
static fromArray(array) {
|
|
1103
|
-
return new
|
|
1102
|
+
return new RGBA2(array);
|
|
1104
1103
|
}
|
|
1105
1104
|
static fromValues(r, g, b, a = 1) {
|
|
1106
|
-
return new
|
|
1105
|
+
return new RGBA2(packRGBA8(toU8(r), toU8(g), toU8(b), toU8(a), packMeta(INTENT_RGB)));
|
|
1107
1106
|
}
|
|
1108
1107
|
static clone(rgba) {
|
|
1109
|
-
return new
|
|
1108
|
+
return new RGBA2(rgba.buffer);
|
|
1110
1109
|
}
|
|
1111
1110
|
static fromInts(r, g, b, a = 255) {
|
|
1112
|
-
return new
|
|
1111
|
+
return new RGBA2(packRGBA8(r, g, b, a, packMeta(INTENT_RGB)));
|
|
1113
1112
|
}
|
|
1114
1113
|
static fromHex(hex) {
|
|
1115
|
-
return
|
|
1114
|
+
return hexToRgb2(hex);
|
|
1116
1115
|
}
|
|
1117
1116
|
static fromIndex(index, snapshot) {
|
|
1118
|
-
const normalized =
|
|
1119
|
-
const rgba = snapshot ?
|
|
1117
|
+
const normalized = normalizeIndexedColorIndex2(index);
|
|
1118
|
+
const rgba = snapshot ? parseColor2(snapshot) : rgbaForAnsi256Index(normalized);
|
|
1120
1119
|
const [r, g, b, a] = rgba.toInts();
|
|
1121
|
-
return new
|
|
1120
|
+
return new RGBA2(packRGBA8(r, g, b, a, packMeta(INTENT_INDEXED, normalized)));
|
|
1122
1121
|
}
|
|
1123
1122
|
static defaultForeground(snapshot) {
|
|
1124
|
-
const rgba = snapshot ?
|
|
1123
|
+
const rgba = snapshot ? parseColor2(snapshot) : RGBA2.fromInts(...DEFAULT_FOREGROUND_RGB2);
|
|
1125
1124
|
const [r, g, b, a] = rgba.toInts();
|
|
1126
|
-
return new
|
|
1125
|
+
return new RGBA2(packRGBA8(r, g, b, a, packMeta(INTENT_DEFAULT)));
|
|
1127
1126
|
}
|
|
1128
1127
|
static defaultBackground(snapshot) {
|
|
1129
|
-
const rgba = snapshot ?
|
|
1128
|
+
const rgba = snapshot ? parseColor2(snapshot) : RGBA2.fromInts(...DEFAULT_BACKGROUND_RGB2);
|
|
1130
1129
|
const [r, g, b, a] = rgba.toInts();
|
|
1131
|
-
return new
|
|
1130
|
+
return new RGBA2(packRGBA8(r, g, b, a, packMeta(INTENT_DEFAULT)));
|
|
1132
1131
|
}
|
|
1133
1132
|
toInts() {
|
|
1134
1133
|
return [this.buffer[0] & 255, this.buffer[1] & 255, this.buffer[2] & 255, this.buffer[3] & 255];
|
|
@@ -1185,12 +1184,12 @@ class RGBA {
|
|
|
1185
1184
|
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];
|
|
1186
1185
|
}
|
|
1187
1186
|
}
|
|
1188
|
-
function
|
|
1187
|
+
function normalizeColorValue2(value) {
|
|
1189
1188
|
if (value == null)
|
|
1190
1189
|
return null;
|
|
1191
|
-
return { rgba:
|
|
1190
|
+
return { rgba: parseColor2(value) };
|
|
1192
1191
|
}
|
|
1193
|
-
function
|
|
1192
|
+
function hexToRgb2(hex) {
|
|
1194
1193
|
hex = hex.replace(/^#/, "");
|
|
1195
1194
|
if (hex.length === 3) {
|
|
1196
1195
|
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
@@ -1199,20 +1198,20 @@ function hexToRgb(hex) {
|
|
|
1199
1198
|
}
|
|
1200
1199
|
if (!/^[0-9A-Fa-f]{6}$/.test(hex) && !/^[0-9A-Fa-f]{8}$/.test(hex)) {
|
|
1201
1200
|
console.warn(`Invalid hex color: ${hex}, defaulting to magenta`);
|
|
1202
|
-
return
|
|
1201
|
+
return RGBA2.fromValues(1, 0, 1, 1);
|
|
1203
1202
|
}
|
|
1204
1203
|
const r = parseInt(hex.substring(0, 2), 16);
|
|
1205
1204
|
const g = parseInt(hex.substring(2, 4), 16);
|
|
1206
1205
|
const b = parseInt(hex.substring(4, 6), 16);
|
|
1207
1206
|
const a = hex.length === 8 ? parseInt(hex.substring(6, 8), 16) : 255;
|
|
1208
|
-
return
|
|
1207
|
+
return RGBA2.fromInts(r, g, b, a);
|
|
1209
1208
|
}
|
|
1210
|
-
function
|
|
1209
|
+
function rgbToHex2(rgb) {
|
|
1211
1210
|
const [r, g, b, a] = rgb.toInts();
|
|
1212
1211
|
const components = a === 255 ? [r, g, b] : [r, g, b, a];
|
|
1213
1212
|
return "#" + components.map((x) => x.toString(16).padStart(2, "0")).join("");
|
|
1214
1213
|
}
|
|
1215
|
-
function
|
|
1214
|
+
function hsvToRgb2(h, s, v) {
|
|
1216
1215
|
let r = 0, g = 0, b = 0;
|
|
1217
1216
|
const i = Math.floor(h / 60) % 6;
|
|
1218
1217
|
const f = h / 60 - Math.floor(h / 60);
|
|
@@ -1251,7 +1250,7 @@ function hsvToRgb(h, s, v) {
|
|
|
1251
1250
|
b = q;
|
|
1252
1251
|
break;
|
|
1253
1252
|
}
|
|
1254
|
-
return
|
|
1253
|
+
return RGBA2.fromValues(r, g, b, 1);
|
|
1255
1254
|
}
|
|
1256
1255
|
var CSS_COLOR_NAMES = {
|
|
1257
1256
|
black: "#000000",
|
|
@@ -1283,27 +1282,27 @@ var CSS_COLOR_NAMES = {
|
|
|
1283
1282
|
brightmagenta: "#FF66FF",
|
|
1284
1283
|
brightwhite: "#FFFFFF"
|
|
1285
1284
|
};
|
|
1286
|
-
function
|
|
1285
|
+
function parseColor2(color) {
|
|
1287
1286
|
if (typeof color === "string") {
|
|
1288
1287
|
const lowerColor = color.toLowerCase();
|
|
1289
1288
|
if (lowerColor === "transparent") {
|
|
1290
|
-
return
|
|
1289
|
+
return RGBA2.fromValues(0, 0, 0, 0);
|
|
1291
1290
|
}
|
|
1292
1291
|
if (CSS_COLOR_NAMES[lowerColor]) {
|
|
1293
|
-
return
|
|
1292
|
+
return hexToRgb2(CSS_COLOR_NAMES[lowerColor]);
|
|
1294
1293
|
}
|
|
1295
|
-
return
|
|
1294
|
+
return hexToRgb2(color);
|
|
1296
1295
|
}
|
|
1297
1296
|
return color;
|
|
1298
1297
|
}
|
|
1299
1298
|
|
|
1300
1299
|
// src/lib/border.ts
|
|
1301
1300
|
var VALID_BORDER_STYLES = ["single", "double", "rounded", "heavy"];
|
|
1302
|
-
function
|
|
1301
|
+
function isValidBorderStyle2(value) {
|
|
1303
1302
|
return typeof value === "string" && VALID_BORDER_STYLES.includes(value);
|
|
1304
1303
|
}
|
|
1305
|
-
function
|
|
1306
|
-
if (
|
|
1304
|
+
function parseBorderStyle2(value, fallback = "single") {
|
|
1305
|
+
if (isValidBorderStyle2(value)) {
|
|
1307
1306
|
return value;
|
|
1308
1307
|
}
|
|
1309
1308
|
if (value !== undefined && value !== null) {
|
|
@@ -1311,7 +1310,7 @@ function parseBorderStyle(value, fallback = "single") {
|
|
|
1311
1310
|
}
|
|
1312
1311
|
return fallback;
|
|
1313
1312
|
}
|
|
1314
|
-
var
|
|
1313
|
+
var BorderChars2 = {
|
|
1315
1314
|
single: {
|
|
1316
1315
|
topLeft: "\u250C",
|
|
1317
1316
|
topRight: "\u2510",
|
|
@@ -1365,7 +1364,7 @@ var BorderChars = {
|
|
|
1365
1364
|
cross: "\u254B"
|
|
1366
1365
|
}
|
|
1367
1366
|
};
|
|
1368
|
-
function
|
|
1367
|
+
function getBorderFromSides2(sides) {
|
|
1369
1368
|
const result = [];
|
|
1370
1369
|
if (sides.top)
|
|
1371
1370
|
result.push("top");
|
|
@@ -1377,7 +1376,7 @@ function getBorderFromSides(sides) {
|
|
|
1377
1376
|
result.push("left");
|
|
1378
1377
|
return result.length > 0 ? result : false;
|
|
1379
1378
|
}
|
|
1380
|
-
function
|
|
1379
|
+
function getBorderSides2(border) {
|
|
1381
1380
|
return border === true ? { top: true, right: true, bottom: true, left: true } : Array.isArray(border) ? {
|
|
1382
1381
|
top: border.includes("top"),
|
|
1383
1382
|
right: border.includes("right"),
|
|
@@ -1385,7 +1384,7 @@ function getBorderSides(border) {
|
|
|
1385
1384
|
left: border.includes("left")
|
|
1386
1385
|
} : { top: false, right: false, bottom: false, left: false };
|
|
1387
1386
|
}
|
|
1388
|
-
function
|
|
1387
|
+
function borderCharsToArray2(chars) {
|
|
1389
1388
|
const array = new Uint32Array(11);
|
|
1390
1389
|
array[0] = chars.topLeft.codePointAt(0);
|
|
1391
1390
|
array[1] = chars.topRight.codePointAt(0);
|
|
@@ -1400,16 +1399,16 @@ function borderCharsToArray(chars) {
|
|
|
1400
1399
|
array[10] = chars.cross.codePointAt(0);
|
|
1401
1400
|
return array;
|
|
1402
1401
|
}
|
|
1403
|
-
var
|
|
1404
|
-
single:
|
|
1405
|
-
double:
|
|
1406
|
-
rounded:
|
|
1407
|
-
heavy:
|
|
1402
|
+
var BorderCharArrays2 = {
|
|
1403
|
+
single: borderCharsToArray2(BorderChars2.single),
|
|
1404
|
+
double: borderCharsToArray2(BorderChars2.double),
|
|
1405
|
+
rounded: borderCharsToArray2(BorderChars2.rounded),
|
|
1406
|
+
heavy: borderCharsToArray2(BorderChars2.heavy)
|
|
1408
1407
|
};
|
|
1409
1408
|
// src/lib/KeyHandler.ts
|
|
1410
1409
|
import { EventEmitter } from "events";
|
|
1411
1410
|
|
|
1412
|
-
class
|
|
1411
|
+
class KeyEvent2 {
|
|
1413
1412
|
name;
|
|
1414
1413
|
ctrl;
|
|
1415
1414
|
meta;
|
|
@@ -1462,7 +1461,7 @@ class KeyEvent {
|
|
|
1462
1461
|
}
|
|
1463
1462
|
}
|
|
1464
1463
|
|
|
1465
|
-
class
|
|
1464
|
+
class PasteEvent2 {
|
|
1466
1465
|
type = "paste";
|
|
1467
1466
|
bytes;
|
|
1468
1467
|
metadata;
|
|
@@ -1486,18 +1485,18 @@ class PasteEvent {
|
|
|
1486
1485
|
}
|
|
1487
1486
|
}
|
|
1488
1487
|
|
|
1489
|
-
class
|
|
1488
|
+
class KeyHandler2 extends EventEmitter {
|
|
1490
1489
|
processParsedKey(parsedKey) {
|
|
1491
1490
|
try {
|
|
1492
1491
|
switch (parsedKey.eventType) {
|
|
1493
1492
|
case "press":
|
|
1494
|
-
this.emit("keypress", new
|
|
1493
|
+
this.emit("keypress", new KeyEvent2(parsedKey));
|
|
1495
1494
|
break;
|
|
1496
1495
|
case "release":
|
|
1497
|
-
this.emit("keyrelease", new
|
|
1496
|
+
this.emit("keyrelease", new KeyEvent2(parsedKey));
|
|
1498
1497
|
break;
|
|
1499
1498
|
default:
|
|
1500
|
-
this.emit("keypress", new
|
|
1499
|
+
this.emit("keypress", new KeyEvent2(parsedKey));
|
|
1501
1500
|
break;
|
|
1502
1501
|
}
|
|
1503
1502
|
} catch (error) {
|
|
@@ -1508,14 +1507,14 @@ class KeyHandler extends EventEmitter {
|
|
|
1508
1507
|
}
|
|
1509
1508
|
processPaste(bytes, metadata) {
|
|
1510
1509
|
try {
|
|
1511
|
-
this.emit("paste", new
|
|
1510
|
+
this.emit("paste", new PasteEvent2(bytes, metadata));
|
|
1512
1511
|
} catch (error) {
|
|
1513
1512
|
console.error(`[KeyHandler] Error processing paste:`, error);
|
|
1514
1513
|
}
|
|
1515
1514
|
}
|
|
1516
1515
|
}
|
|
1517
1516
|
|
|
1518
|
-
class
|
|
1517
|
+
class InternalKeyHandler2 extends KeyHandler2 {
|
|
1519
1518
|
renderableHandlers = new Map;
|
|
1520
1519
|
emit(event, ...args) {
|
|
1521
1520
|
return this.emitWithPriority(event, ...args);
|
|
@@ -4295,7 +4294,7 @@ var pallet_default = {
|
|
|
4295
4294
|
};
|
|
4296
4295
|
|
|
4297
4296
|
// src/lib/ascii.font.ts
|
|
4298
|
-
var
|
|
4297
|
+
var fonts2 = {
|
|
4299
4298
|
tiny: tiny_default,
|
|
4300
4299
|
block: block_default,
|
|
4301
4300
|
shade: shade_default,
|
|
@@ -4333,7 +4332,7 @@ function parseColorTags(text) {
|
|
|
4333
4332
|
}
|
|
4334
4333
|
function getParsedFont(fontKey) {
|
|
4335
4334
|
if (!parsedFonts[fontKey]) {
|
|
4336
|
-
const fontDef =
|
|
4335
|
+
const fontDef = fonts2[fontKey];
|
|
4337
4336
|
const parsedChars = {};
|
|
4338
4337
|
for (const [char, lines] of Object.entries(fontDef.chars)) {
|
|
4339
4338
|
parsedChars[char] = lines.map((line) => parseColorTags(line));
|
|
@@ -4346,7 +4345,7 @@ function getParsedFont(fontKey) {
|
|
|
4346
4345
|
}
|
|
4347
4346
|
return parsedFonts[fontKey];
|
|
4348
4347
|
}
|
|
4349
|
-
function
|
|
4348
|
+
function measureText2({ text, font = "tiny" }) {
|
|
4350
4349
|
const fontDef = getParsedFont(font);
|
|
4351
4350
|
if (!fontDef) {
|
|
4352
4351
|
console.warn(`Font '${font}' not found`);
|
|
@@ -4385,7 +4384,7 @@ function measureText({ text, font = "tiny" }) {
|
|
|
4385
4384
|
height: fontDef.lines
|
|
4386
4385
|
};
|
|
4387
4386
|
}
|
|
4388
|
-
function
|
|
4387
|
+
function getCharacterPositions2(text, font = "tiny") {
|
|
4389
4388
|
const fontDef = getParsedFont(font);
|
|
4390
4389
|
if (!fontDef) {
|
|
4391
4390
|
return [0];
|
|
@@ -4418,8 +4417,8 @@ function getCharacterPositions(text, font = "tiny") {
|
|
|
4418
4417
|
}
|
|
4419
4418
|
return positions;
|
|
4420
4419
|
}
|
|
4421
|
-
function
|
|
4422
|
-
const positions =
|
|
4420
|
+
function coordinateToCharacterIndex2(x, text, font = "tiny") {
|
|
4421
|
+
const positions = getCharacterPositions2(text, font);
|
|
4423
4422
|
if (x < 0) {
|
|
4424
4423
|
return 0;
|
|
4425
4424
|
}
|
|
@@ -4436,12 +4435,12 @@ function coordinateToCharacterIndex(x, text, font = "tiny") {
|
|
|
4436
4435
|
}
|
|
4437
4436
|
return 0;
|
|
4438
4437
|
}
|
|
4439
|
-
function
|
|
4438
|
+
function renderFontToFrameBuffer2(buffer, {
|
|
4440
4439
|
text,
|
|
4441
4440
|
x = 0,
|
|
4442
4441
|
y = 0,
|
|
4443
|
-
color = [
|
|
4444
|
-
backgroundColor =
|
|
4442
|
+
color = [RGBA2.fromInts(255, 255, 255, 255)],
|
|
4443
|
+
backgroundColor = RGBA2.fromInts(0, 0, 0, 255),
|
|
4445
4444
|
font = "tiny"
|
|
4446
4445
|
}) {
|
|
4447
4446
|
const width = buffer.width;
|
|
@@ -4497,7 +4496,7 @@ function renderFontToFrameBuffer(buffer, {
|
|
|
4497
4496
|
if (renderX >= 0 && renderX < width) {
|
|
4498
4497
|
const fontChar = segment.text[charIdx];
|
|
4499
4498
|
if (fontChar !== " ") {
|
|
4500
|
-
buffer.setCellWithAlphaBlending(renderX, renderY, fontChar,
|
|
4499
|
+
buffer.setCellWithAlphaBlending(renderX, renderY, fontChar, parseColor2(segmentColor), parseColor2(backgroundColor));
|
|
4501
4500
|
}
|
|
4502
4501
|
}
|
|
4503
4502
|
}
|
|
@@ -4516,7 +4515,7 @@ function renderFontToFrameBuffer(buffer, {
|
|
|
4516
4515
|
};
|
|
4517
4516
|
}
|
|
4518
4517
|
// src/types.ts
|
|
4519
|
-
var
|
|
4518
|
+
var TextAttributes2 = {
|
|
4520
4519
|
NONE: 0,
|
|
4521
4520
|
BOLD: 1 << 0,
|
|
4522
4521
|
DIM: 1 << 1,
|
|
@@ -4527,27 +4526,27 @@ var TextAttributes = {
|
|
|
4527
4526
|
HIDDEN: 1 << 6,
|
|
4528
4527
|
STRIKETHROUGH: 1 << 7
|
|
4529
4528
|
};
|
|
4530
|
-
var
|
|
4531
|
-
var
|
|
4532
|
-
function
|
|
4533
|
-
return attr &
|
|
4534
|
-
}
|
|
4535
|
-
var
|
|
4536
|
-
((
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
})(
|
|
4542
|
-
var
|
|
4543
|
-
((
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
})(
|
|
4529
|
+
var ATTRIBUTE_BASE_BITS2 = 8;
|
|
4530
|
+
var ATTRIBUTE_BASE_MASK2 = 255;
|
|
4531
|
+
function getBaseAttributes2(attr) {
|
|
4532
|
+
return attr & ATTRIBUTE_BASE_MASK2;
|
|
4533
|
+
}
|
|
4534
|
+
var DebugOverlayCorner2;
|
|
4535
|
+
((DebugOverlayCorner) => {
|
|
4536
|
+
DebugOverlayCorner[DebugOverlayCorner["topLeft"] = 0] = "topLeft";
|
|
4537
|
+
DebugOverlayCorner[DebugOverlayCorner["topRight"] = 1] = "topRight";
|
|
4538
|
+
DebugOverlayCorner[DebugOverlayCorner["bottomLeft"] = 2] = "bottomLeft";
|
|
4539
|
+
DebugOverlayCorner[DebugOverlayCorner["bottomRight"] = 3] = "bottomRight";
|
|
4540
|
+
})(DebugOverlayCorner2 ||= {});
|
|
4541
|
+
var TargetChannel2;
|
|
4542
|
+
((TargetChannel) => {
|
|
4543
|
+
TargetChannel[TargetChannel["FG"] = 1] = "FG";
|
|
4544
|
+
TargetChannel[TargetChannel["BG"] = 2] = "BG";
|
|
4545
|
+
TargetChannel[TargetChannel["Both"] = 3] = "Both";
|
|
4546
|
+
})(TargetChannel2 ||= {});
|
|
4548
4547
|
|
|
4549
4548
|
// src/utils.ts
|
|
4550
|
-
function
|
|
4549
|
+
function createTextAttributes2({
|
|
4551
4550
|
bold = false,
|
|
4552
4551
|
italic = false,
|
|
4553
4552
|
underline = false,
|
|
@@ -4558,37 +4557,37 @@ function createTextAttributes({
|
|
|
4558
4557
|
hidden = false,
|
|
4559
4558
|
strikethrough = false
|
|
4560
4559
|
} = {}) {
|
|
4561
|
-
let attributes =
|
|
4560
|
+
let attributes = TextAttributes2.NONE;
|
|
4562
4561
|
if (bold)
|
|
4563
|
-
attributes |=
|
|
4562
|
+
attributes |= TextAttributes2.BOLD;
|
|
4564
4563
|
if (italic)
|
|
4565
|
-
attributes |=
|
|
4564
|
+
attributes |= TextAttributes2.ITALIC;
|
|
4566
4565
|
if (underline)
|
|
4567
|
-
attributes |=
|
|
4566
|
+
attributes |= TextAttributes2.UNDERLINE;
|
|
4568
4567
|
if (dim)
|
|
4569
|
-
attributes |=
|
|
4568
|
+
attributes |= TextAttributes2.DIM;
|
|
4570
4569
|
if (blink)
|
|
4571
|
-
attributes |=
|
|
4570
|
+
attributes |= TextAttributes2.BLINK;
|
|
4572
4571
|
if (inverse || reverse)
|
|
4573
|
-
attributes |=
|
|
4572
|
+
attributes |= TextAttributes2.INVERSE;
|
|
4574
4573
|
if (hidden)
|
|
4575
|
-
attributes |=
|
|
4574
|
+
attributes |= TextAttributes2.HIDDEN;
|
|
4576
4575
|
if (strikethrough)
|
|
4577
|
-
attributes |=
|
|
4576
|
+
attributes |= TextAttributes2.STRIKETHROUGH;
|
|
4578
4577
|
return attributes;
|
|
4579
4578
|
}
|
|
4580
|
-
var
|
|
4579
|
+
var ATTRIBUTE_BASE_MASK = 255;
|
|
4581
4580
|
var LINK_ID_SHIFT = 8;
|
|
4582
4581
|
var LINK_ID_PAYLOAD_MASK = 16777215;
|
|
4583
|
-
function
|
|
4584
|
-
const base = baseAttributes &
|
|
4582
|
+
function attributesWithLink2(baseAttributes, linkId) {
|
|
4583
|
+
const base = baseAttributes & ATTRIBUTE_BASE_MASK;
|
|
4585
4584
|
const linkBits = (linkId & LINK_ID_PAYLOAD_MASK) << LINK_ID_SHIFT;
|
|
4586
4585
|
return base | linkBits;
|
|
4587
4586
|
}
|
|
4588
|
-
function
|
|
4587
|
+
function getLinkId2(attributes) {
|
|
4589
4588
|
return attributes >>> LINK_ID_SHIFT & LINK_ID_PAYLOAD_MASK;
|
|
4590
4589
|
}
|
|
4591
|
-
function
|
|
4590
|
+
function visualizeRenderableTree2(renderable, maxDepth = 10) {
|
|
4592
4591
|
function buildTreeLines(node, prefix = "", parentPrefix = "", isLastChild = true, depth = 0) {
|
|
4593
4592
|
if (depth >= maxDepth) {
|
|
4594
4593
|
return [`${prefix}${node.id} ... (max depth reached)`];
|
|
@@ -4616,30 +4615,30 @@ function visualizeRenderableTree(renderable, maxDepth = 10) {
|
|
|
4616
4615
|
|
|
4617
4616
|
// src/lib/styled-text.ts
|
|
4618
4617
|
var BrandedStyledText = Symbol.for("@opentui/core/StyledText");
|
|
4619
|
-
function
|
|
4618
|
+
function isStyledText2(obj) {
|
|
4620
4619
|
return obj && obj[BrandedStyledText];
|
|
4621
4620
|
}
|
|
4622
4621
|
|
|
4623
|
-
class
|
|
4622
|
+
class StyledText2 {
|
|
4624
4623
|
[BrandedStyledText] = true;
|
|
4625
4624
|
chunks;
|
|
4626
4625
|
constructor(chunks) {
|
|
4627
4626
|
this.chunks = chunks;
|
|
4628
4627
|
}
|
|
4629
4628
|
}
|
|
4630
|
-
function
|
|
4629
|
+
function stringToStyledText2(content) {
|
|
4631
4630
|
const chunk = {
|
|
4632
4631
|
__isChunk: true,
|
|
4633
4632
|
text: content
|
|
4634
4633
|
};
|
|
4635
|
-
return new
|
|
4634
|
+
return new StyledText2([chunk]);
|
|
4636
4635
|
}
|
|
4637
4636
|
function applyStyle(input, style) {
|
|
4638
4637
|
if (typeof input === "object" && "__isChunk" in input) {
|
|
4639
4638
|
const existingChunk = input;
|
|
4640
|
-
const fg = style.fg ?
|
|
4641
|
-
const bg = style.bg ?
|
|
4642
|
-
const newAttrs =
|
|
4639
|
+
const fg = style.fg ? parseColor2(style.fg) : existingChunk.fg;
|
|
4640
|
+
const bg = style.bg ? parseColor2(style.bg) : existingChunk.bg;
|
|
4641
|
+
const newAttrs = createTextAttributes2(style);
|
|
4643
4642
|
const mergedAttrs = existingChunk.attributes ? existingChunk.attributes | newAttrs : newAttrs;
|
|
4644
4643
|
return {
|
|
4645
4644
|
__isChunk: true,
|
|
@@ -4651,9 +4650,9 @@ function applyStyle(input, style) {
|
|
|
4651
4650
|
};
|
|
4652
4651
|
} else {
|
|
4653
4652
|
const plainTextStr = String(input);
|
|
4654
|
-
const fg = style.fg ?
|
|
4655
|
-
const bg = style.bg ?
|
|
4656
|
-
const attributes =
|
|
4653
|
+
const fg = style.fg ? parseColor2(style.fg) : undefined;
|
|
4654
|
+
const bg = style.bg ? parseColor2(style.bg) : undefined;
|
|
4655
|
+
const attributes = createTextAttributes2(style);
|
|
4657
4656
|
return {
|
|
4658
4657
|
__isChunk: true,
|
|
4659
4658
|
text: plainTextStr,
|
|
@@ -4663,40 +4662,40 @@ function applyStyle(input, style) {
|
|
|
4663
4662
|
};
|
|
4664
4663
|
}
|
|
4665
4664
|
}
|
|
4666
|
-
var
|
|
4667
|
-
var
|
|
4668
|
-
var
|
|
4669
|
-
var
|
|
4670
|
-
var
|
|
4671
|
-
var
|
|
4672
|
-
var
|
|
4673
|
-
var
|
|
4674
|
-
var
|
|
4675
|
-
var
|
|
4676
|
-
var
|
|
4677
|
-
var
|
|
4678
|
-
var
|
|
4679
|
-
var
|
|
4680
|
-
var
|
|
4681
|
-
var
|
|
4682
|
-
var
|
|
4683
|
-
var
|
|
4684
|
-
var
|
|
4685
|
-
var
|
|
4686
|
-
var
|
|
4687
|
-
var
|
|
4688
|
-
var
|
|
4689
|
-
var
|
|
4690
|
-
var
|
|
4691
|
-
var
|
|
4692
|
-
var
|
|
4693
|
-
var
|
|
4694
|
-
var
|
|
4695
|
-
var
|
|
4696
|
-
var
|
|
4697
|
-
var
|
|
4698
|
-
var
|
|
4699
|
-
var
|
|
4665
|
+
var black2 = (input) => applyStyle(input, { fg: "black" });
|
|
4666
|
+
var red2 = (input) => applyStyle(input, { fg: "red" });
|
|
4667
|
+
var green2 = (input) => applyStyle(input, { fg: "green" });
|
|
4668
|
+
var yellow2 = (input) => applyStyle(input, { fg: "yellow" });
|
|
4669
|
+
var blue2 = (input) => applyStyle(input, { fg: "blue" });
|
|
4670
|
+
var magenta2 = (input) => applyStyle(input, { fg: "magenta" });
|
|
4671
|
+
var cyan2 = (input) => applyStyle(input, { fg: "cyan" });
|
|
4672
|
+
var white2 = (input) => applyStyle(input, { fg: "white" });
|
|
4673
|
+
var brightBlack2 = (input) => applyStyle(input, { fg: "brightBlack" });
|
|
4674
|
+
var brightRed2 = (input) => applyStyle(input, { fg: "brightRed" });
|
|
4675
|
+
var brightGreen2 = (input) => applyStyle(input, { fg: "brightGreen" });
|
|
4676
|
+
var brightYellow2 = (input) => applyStyle(input, { fg: "brightYellow" });
|
|
4677
|
+
var brightBlue2 = (input) => applyStyle(input, { fg: "brightBlue" });
|
|
4678
|
+
var brightMagenta2 = (input) => applyStyle(input, { fg: "brightMagenta" });
|
|
4679
|
+
var brightCyan2 = (input) => applyStyle(input, { fg: "brightCyan" });
|
|
4680
|
+
var brightWhite2 = (input) => applyStyle(input, { fg: "brightWhite" });
|
|
4681
|
+
var bgBlack2 = (input) => applyStyle(input, { bg: "black" });
|
|
4682
|
+
var bgRed2 = (input) => applyStyle(input, { bg: "red" });
|
|
4683
|
+
var bgGreen2 = (input) => applyStyle(input, { bg: "green" });
|
|
4684
|
+
var bgYellow2 = (input) => applyStyle(input, { bg: "yellow" });
|
|
4685
|
+
var bgBlue2 = (input) => applyStyle(input, { bg: "blue" });
|
|
4686
|
+
var bgMagenta2 = (input) => applyStyle(input, { bg: "magenta" });
|
|
4687
|
+
var bgCyan2 = (input) => applyStyle(input, { bg: "cyan" });
|
|
4688
|
+
var bgWhite2 = (input) => applyStyle(input, { bg: "white" });
|
|
4689
|
+
var bold2 = (input) => applyStyle(input, { bold: true });
|
|
4690
|
+
var italic2 = (input) => applyStyle(input, { italic: true });
|
|
4691
|
+
var underline2 = (input) => applyStyle(input, { underline: true });
|
|
4692
|
+
var strikethrough2 = (input) => applyStyle(input, { strikethrough: true });
|
|
4693
|
+
var dim2 = (input) => applyStyle(input, { dim: true });
|
|
4694
|
+
var reverse2 = (input) => applyStyle(input, { reverse: true });
|
|
4695
|
+
var blink2 = (input) => applyStyle(input, { blink: true });
|
|
4696
|
+
var fg2 = (color) => (input) => applyStyle(input, { fg: color });
|
|
4697
|
+
var bg2 = (color) => (input) => applyStyle(input, { bg: color });
|
|
4698
|
+
var link2 = (url) => (input) => {
|
|
4700
4699
|
const chunk = typeof input === "object" && "__isChunk" in input ? input : {
|
|
4701
4700
|
__isChunk: true,
|
|
4702
4701
|
text: String(input)
|
|
@@ -4706,7 +4705,7 @@ var link = (url) => (input) => {
|
|
|
4706
4705
|
link: { url }
|
|
4707
4706
|
};
|
|
4708
4707
|
};
|
|
4709
|
-
function
|
|
4708
|
+
function t2(strings, ...values) {
|
|
4710
4709
|
const chunks = [];
|
|
4711
4710
|
for (let i = 0;i < strings.length; i++) {
|
|
4712
4711
|
const raw = strings[i];
|
|
@@ -4729,7 +4728,7 @@ function t(strings, ...values) {
|
|
|
4729
4728
|
});
|
|
4730
4729
|
}
|
|
4731
4730
|
}
|
|
4732
|
-
return new
|
|
4731
|
+
return new StyledText2(chunks);
|
|
4733
4732
|
}
|
|
4734
4733
|
|
|
4735
4734
|
// src/lib/hast-styled-text.ts
|
|
@@ -4759,12 +4758,12 @@ function hastToTextChunks(node, syntaxStyle, parentStyles = []) {
|
|
|
4759
4758
|
}
|
|
4760
4759
|
return chunks;
|
|
4761
4760
|
}
|
|
4762
|
-
function
|
|
4761
|
+
function hastToStyledText2(hast, syntaxStyle) {
|
|
4763
4762
|
const chunks = hastToTextChunks(hast, syntaxStyle);
|
|
4764
|
-
return new
|
|
4763
|
+
return new StyledText2(chunks);
|
|
4765
4764
|
}
|
|
4766
4765
|
// src/lib/clock.ts
|
|
4767
|
-
class
|
|
4766
|
+
class SystemClock2 {
|
|
4768
4767
|
now() {
|
|
4769
4768
|
if (!globalThis.performance || typeof globalThis.performance.now !== "function") {
|
|
4770
4769
|
throw new Error("SystemClock requires globalThis.performance.now()");
|
|
@@ -5269,9 +5268,9 @@ var keyName = {
|
|
|
5269
5268
|
"[8^": "end",
|
|
5270
5269
|
"[Z": "tab"
|
|
5271
5270
|
};
|
|
5272
|
-
var
|
|
5273
|
-
var
|
|
5274
|
-
...new Set(["return", "linefeed", "tab", "escape", "space", ...
|
|
5271
|
+
var nonAlphanumericKeys2 = [...Object.values(keyName), "backspace"];
|
|
5272
|
+
var terminalNamedSingleStrokeKeys2 = [
|
|
5273
|
+
...new Set(["return", "linefeed", "tab", "escape", "space", ...nonAlphanumericKeys2, ...kittyNamedSingleStrokeKeys])
|
|
5275
5274
|
];
|
|
5276
5275
|
var isShiftKey = (code) => {
|
|
5277
5276
|
return ["[a", "[b", "[c", "[d", "[e", "[2$", "[3$", "[5$", "[6$", "[7$", "[8$", "[Z"].includes(code);
|
|
@@ -5311,7 +5310,7 @@ var ss3NumpadPrintable = {
|
|
|
5311
5310
|
OX: "="
|
|
5312
5311
|
};
|
|
5313
5312
|
var modifyOtherKeysRe = /^\x1b\[27;(\d+);(\d+)~$/;
|
|
5314
|
-
var
|
|
5313
|
+
var parseKeypress2 = (s = "", options = {}) => {
|
|
5315
5314
|
let parts;
|
|
5316
5315
|
if (Buffer2.isBuffer(s)) {
|
|
5317
5316
|
if (s[0] > 127 && s[1] === undefined) {
|
|
@@ -5501,14 +5500,14 @@ var parseKeypress = (s = "", options = {}) => {
|
|
|
5501
5500
|
return key;
|
|
5502
5501
|
};
|
|
5503
5502
|
// src/lib/scroll-acceleration.ts
|
|
5504
|
-
class
|
|
5503
|
+
class LinearScrollAccel2 {
|
|
5505
5504
|
tick(_now) {
|
|
5506
5505
|
return 1;
|
|
5507
5506
|
}
|
|
5508
5507
|
reset() {}
|
|
5509
5508
|
}
|
|
5510
5509
|
|
|
5511
|
-
class
|
|
5510
|
+
class MacOSScrollAccel2 {
|
|
5512
5511
|
opts;
|
|
5513
5512
|
lastTickTime = 0;
|
|
5514
5513
|
velocityHistory = [];
|
|
@@ -5549,7 +5548,7 @@ class MacOSScrollAccel {
|
|
|
5549
5548
|
}
|
|
5550
5549
|
}
|
|
5551
5550
|
// src/lib/yoga.options.ts
|
|
5552
|
-
function
|
|
5551
|
+
function parseAlign2(value) {
|
|
5553
5552
|
if (value == null) {
|
|
5554
5553
|
return 0 /* Auto */;
|
|
5555
5554
|
}
|
|
@@ -5576,7 +5575,7 @@ function parseAlign(value) {
|
|
|
5576
5575
|
return 0 /* Auto */;
|
|
5577
5576
|
}
|
|
5578
5577
|
}
|
|
5579
|
-
function
|
|
5578
|
+
function parseAlignItems2(value) {
|
|
5580
5579
|
if (value == null) {
|
|
5581
5580
|
return 4 /* Stretch */;
|
|
5582
5581
|
}
|
|
@@ -5603,7 +5602,7 @@ function parseAlignItems(value) {
|
|
|
5603
5602
|
return 4 /* Stretch */;
|
|
5604
5603
|
}
|
|
5605
5604
|
}
|
|
5606
|
-
function
|
|
5605
|
+
function parseBoxSizing2(value) {
|
|
5607
5606
|
if (value == null) {
|
|
5608
5607
|
return 0 /* BorderBox */;
|
|
5609
5608
|
}
|
|
@@ -5616,7 +5615,7 @@ function parseBoxSizing(value) {
|
|
|
5616
5615
|
return 0 /* BorderBox */;
|
|
5617
5616
|
}
|
|
5618
5617
|
}
|
|
5619
|
-
function
|
|
5618
|
+
function parseDimension2(value) {
|
|
5620
5619
|
if (value == null) {
|
|
5621
5620
|
return 0 /* Width */;
|
|
5622
5621
|
}
|
|
@@ -5629,7 +5628,7 @@ function parseDimension(value) {
|
|
|
5629
5628
|
return 0 /* Width */;
|
|
5630
5629
|
}
|
|
5631
5630
|
}
|
|
5632
|
-
function
|
|
5631
|
+
function parseDirection2(value) {
|
|
5633
5632
|
if (value == null) {
|
|
5634
5633
|
return 1 /* LTR */;
|
|
5635
5634
|
}
|
|
@@ -5644,7 +5643,7 @@ function parseDirection(value) {
|
|
|
5644
5643
|
return 1 /* LTR */;
|
|
5645
5644
|
}
|
|
5646
5645
|
}
|
|
5647
|
-
function
|
|
5646
|
+
function parseDisplay2(value) {
|
|
5648
5647
|
if (value == null) {
|
|
5649
5648
|
return 0 /* Flex */;
|
|
5650
5649
|
}
|
|
@@ -5659,7 +5658,7 @@ function parseDisplay(value) {
|
|
|
5659
5658
|
return 0 /* Flex */;
|
|
5660
5659
|
}
|
|
5661
5660
|
}
|
|
5662
|
-
function
|
|
5661
|
+
function parseEdge2(value) {
|
|
5663
5662
|
if (value == null) {
|
|
5664
5663
|
return 8 /* All */;
|
|
5665
5664
|
}
|
|
@@ -5686,7 +5685,7 @@ function parseEdge(value) {
|
|
|
5686
5685
|
return 8 /* All */;
|
|
5687
5686
|
}
|
|
5688
5687
|
}
|
|
5689
|
-
function
|
|
5688
|
+
function parseFlexDirection2(value) {
|
|
5690
5689
|
if (value == null) {
|
|
5691
5690
|
return 0 /* Column */;
|
|
5692
5691
|
}
|
|
@@ -5703,7 +5702,7 @@ function parseFlexDirection(value) {
|
|
|
5703
5702
|
return 0 /* Column */;
|
|
5704
5703
|
}
|
|
5705
5704
|
}
|
|
5706
|
-
function
|
|
5705
|
+
function parseGutter2(value) {
|
|
5707
5706
|
if (value == null) {
|
|
5708
5707
|
return 2 /* All */;
|
|
5709
5708
|
}
|
|
@@ -5718,7 +5717,7 @@ function parseGutter(value) {
|
|
|
5718
5717
|
return 2 /* All */;
|
|
5719
5718
|
}
|
|
5720
5719
|
}
|
|
5721
|
-
function
|
|
5720
|
+
function parseJustify2(value) {
|
|
5722
5721
|
if (value == null) {
|
|
5723
5722
|
return 0 /* FlexStart */;
|
|
5724
5723
|
}
|
|
@@ -5739,7 +5738,7 @@ function parseJustify(value) {
|
|
|
5739
5738
|
return 0 /* FlexStart */;
|
|
5740
5739
|
}
|
|
5741
5740
|
}
|
|
5742
|
-
function
|
|
5741
|
+
function parseLogLevel2(value) {
|
|
5743
5742
|
if (value == null) {
|
|
5744
5743
|
return 2 /* Info */;
|
|
5745
5744
|
}
|
|
@@ -5760,7 +5759,7 @@ function parseLogLevel(value) {
|
|
|
5760
5759
|
return 2 /* Info */;
|
|
5761
5760
|
}
|
|
5762
5761
|
}
|
|
5763
|
-
function
|
|
5762
|
+
function parseMeasureMode2(value) {
|
|
5764
5763
|
if (value == null) {
|
|
5765
5764
|
return 0 /* Undefined */;
|
|
5766
5765
|
}
|
|
@@ -5775,7 +5774,7 @@ function parseMeasureMode(value) {
|
|
|
5775
5774
|
return 0 /* Undefined */;
|
|
5776
5775
|
}
|
|
5777
5776
|
}
|
|
5778
|
-
function
|
|
5777
|
+
function parseOverflow2(value) {
|
|
5779
5778
|
if (value == null) {
|
|
5780
5779
|
return 0 /* Visible */;
|
|
5781
5780
|
}
|
|
@@ -5790,7 +5789,7 @@ function parseOverflow(value) {
|
|
|
5790
5789
|
return 0 /* Visible */;
|
|
5791
5790
|
}
|
|
5792
5791
|
}
|
|
5793
|
-
function
|
|
5792
|
+
function parsePositionType2(value) {
|
|
5794
5793
|
if (value == null) {
|
|
5795
5794
|
return 1 /* Relative */;
|
|
5796
5795
|
}
|
|
@@ -5805,7 +5804,7 @@ function parsePositionType(value) {
|
|
|
5805
5804
|
return 0 /* Static */;
|
|
5806
5805
|
}
|
|
5807
5806
|
}
|
|
5808
|
-
function
|
|
5807
|
+
function parseUnit2(value) {
|
|
5809
5808
|
if (value == null) {
|
|
5810
5809
|
return 1 /* Point */;
|
|
5811
5810
|
}
|
|
@@ -5822,7 +5821,7 @@ function parseUnit(value) {
|
|
|
5822
5821
|
return 1 /* Point */;
|
|
5823
5822
|
}
|
|
5824
5823
|
}
|
|
5825
|
-
function
|
|
5824
|
+
function parseWrap2(value) {
|
|
5826
5825
|
if (value == null) {
|
|
5827
5826
|
return 0 /* NoWrap */;
|
|
5828
5827
|
}
|
|
@@ -5838,7 +5837,7 @@ function parseWrap(value) {
|
|
|
5838
5837
|
}
|
|
5839
5838
|
}
|
|
5840
5839
|
// src/lib/parse.mouse.ts
|
|
5841
|
-
class
|
|
5840
|
+
class MouseParser2 {
|
|
5842
5841
|
mouseButtonsPressed = new Set;
|
|
5843
5842
|
static SCROLL_DIRECTIONS = {
|
|
5844
5843
|
0: "up",
|
|
@@ -5936,7 +5935,7 @@ class MouseParser {
|
|
|
5936
5935
|
decodeSgrEvent(rawButtonCode, wireX, wireY, pressRelease) {
|
|
5937
5936
|
const button = rawButtonCode & 3;
|
|
5938
5937
|
const isScroll = (rawButtonCode & 64) !== 0;
|
|
5939
|
-
const scrollDirection = !isScroll ? undefined :
|
|
5938
|
+
const scrollDirection = !isScroll ? undefined : MouseParser2.SCROLL_DIRECTIONS[button];
|
|
5940
5939
|
const isMotion = (rawButtonCode & 32) !== 0;
|
|
5941
5940
|
const modifiers = {
|
|
5942
5941
|
shift: (rawButtonCode & 4) !== 0,
|
|
@@ -5981,7 +5980,7 @@ class MouseParser {
|
|
|
5981
5980
|
const button = buttonByte & 3;
|
|
5982
5981
|
const isScroll = (buttonByte & 64) !== 0;
|
|
5983
5982
|
const isMotion = (buttonByte & 32) !== 0;
|
|
5984
|
-
const scrollDirection = !isScroll ? undefined :
|
|
5983
|
+
const scrollDirection = !isScroll ? undefined : MouseParser2.SCROLL_DIRECTIONS[button];
|
|
5985
5984
|
const modifiers = {
|
|
5986
5985
|
shift: (buttonByte & 4) !== 0,
|
|
5987
5986
|
alt: (buttonByte & 8) !== 0,
|
|
@@ -6032,7 +6031,7 @@ class SelectionAnchor {
|
|
|
6032
6031
|
}
|
|
6033
6032
|
}
|
|
6034
6033
|
|
|
6035
|
-
class
|
|
6034
|
+
class Selection2 {
|
|
6036
6035
|
_anchor;
|
|
6037
6036
|
_focus;
|
|
6038
6037
|
_selectedRenderables = [];
|
|
@@ -6126,7 +6125,7 @@ class Selection {
|
|
|
6126
6125
|
`);
|
|
6127
6126
|
}
|
|
6128
6127
|
}
|
|
6129
|
-
function
|
|
6128
|
+
function convertGlobalToLocalSelection2(globalSelection, localX, localY) {
|
|
6130
6129
|
if (!globalSelection?.isActive) {
|
|
6131
6130
|
return null;
|
|
6132
6131
|
}
|
|
@@ -6140,7 +6139,7 @@ function convertGlobalToLocalSelection(globalSelection, localX, localY) {
|
|
|
6140
6139
|
};
|
|
6141
6140
|
}
|
|
6142
6141
|
|
|
6143
|
-
class
|
|
6142
|
+
class ASCIIFontSelectionHelper2 {
|
|
6144
6143
|
getText;
|
|
6145
6144
|
getFont;
|
|
6146
6145
|
localSelection = null;
|
|
@@ -6160,7 +6159,7 @@ class ASCIIFontSelectionHelper {
|
|
|
6160
6159
|
}
|
|
6161
6160
|
const text = this.getText();
|
|
6162
6161
|
const font = this.getFont();
|
|
6163
|
-
const charIndex =
|
|
6162
|
+
const charIndex = coordinateToCharacterIndex2(localX, text, font);
|
|
6164
6163
|
return charIndex >= 0 && charIndex <= text.length;
|
|
6165
6164
|
}
|
|
6166
6165
|
onLocalSelectionChanged(localSelection, width, height) {
|
|
@@ -6171,7 +6170,7 @@ class ASCIIFontSelectionHelper {
|
|
|
6171
6170
|
}
|
|
6172
6171
|
const text = this.getText();
|
|
6173
6172
|
const font = this.getFont();
|
|
6174
|
-
const positions =
|
|
6173
|
+
const positions = getCharacterPositions2(text, font);
|
|
6175
6174
|
const minY = Math.min(localSelection.anchorY, localSelection.focusY);
|
|
6176
6175
|
const maxY = Math.max(localSelection.anchorY, localSelection.focusY);
|
|
6177
6176
|
if (maxY < 0 || minY > height - 1) {
|
|
@@ -6225,7 +6224,7 @@ var DEFAULT_PROTOCOL_CONTEXT = {
|
|
|
6225
6224
|
startupCursorCprActive: false
|
|
6226
6225
|
};
|
|
6227
6226
|
var RXVT_DOLLAR_CSI_RE = /^\x1b\[\d+\$$/;
|
|
6228
|
-
var SYSTEM_CLOCK = new
|
|
6227
|
+
var SYSTEM_CLOCK = new SystemClock2;
|
|
6229
6228
|
|
|
6230
6229
|
class ByteQueue {
|
|
6231
6230
|
buf;
|
|
@@ -6423,8 +6422,8 @@ function canStillBePixelResolution(state) {
|
|
|
6423
6422
|
function canStillBePixelResolutionPrefix(bytes) {
|
|
6424
6423
|
const fixedPrefix = [ESC, 91, 52, 59];
|
|
6425
6424
|
const fixedLength = Math.min(bytes.length, fixedPrefix.length);
|
|
6426
|
-
for (let
|
|
6427
|
-
if (bytes[
|
|
6425
|
+
for (let index = 0;index < fixedLength; index += 1) {
|
|
6426
|
+
if (bytes[index] !== fixedPrefix[index])
|
|
6428
6427
|
return false;
|
|
6429
6428
|
}
|
|
6430
6429
|
if (bytes.length <= fixedPrefix.length)
|
|
@@ -6553,7 +6552,7 @@ function joinPasteBytes(parts, totalLength) {
|
|
|
6553
6552
|
return bytes;
|
|
6554
6553
|
}
|
|
6555
6554
|
|
|
6556
|
-
class
|
|
6555
|
+
class StdinParser2 {
|
|
6557
6556
|
pending = new ByteQueue(INITIAL_PENDING_CAPACITY);
|
|
6558
6557
|
events = [];
|
|
6559
6558
|
timeoutMs;
|
|
@@ -6561,7 +6560,7 @@ class StdinParser {
|
|
|
6561
6560
|
armTimeouts;
|
|
6562
6561
|
onTimeoutFlush;
|
|
6563
6562
|
useKittyKeyboard;
|
|
6564
|
-
mouseParser = new
|
|
6563
|
+
mouseParser = new MouseParser2;
|
|
6565
6564
|
clock;
|
|
6566
6565
|
protocolContext;
|
|
6567
6566
|
timeoutId = null;
|
|
@@ -7529,7 +7528,7 @@ class StdinParser {
|
|
|
7529
7528
|
}
|
|
7530
7529
|
}
|
|
7531
7530
|
emitKeyOrResponse(protocol, raw) {
|
|
7532
|
-
const parsed =
|
|
7531
|
+
const parsed = parseKeypress2(raw, { useKittyKeyboard: this.useKittyKeyboard });
|
|
7533
7532
|
if (parsed) {
|
|
7534
7533
|
this.events.push({
|
|
7535
7534
|
type: "key",
|
|
@@ -7558,7 +7557,7 @@ class StdinParser {
|
|
|
7558
7557
|
});
|
|
7559
7558
|
}
|
|
7560
7559
|
emitLegacyHighByte(byte) {
|
|
7561
|
-
const parsed =
|
|
7560
|
+
const parsed = parseKeypress2(Buffer3.from([byte]), { useKittyKeyboard: this.useKittyKeyboard });
|
|
7562
7561
|
if (parsed) {
|
|
7563
7562
|
this.events.push({
|
|
7564
7563
|
type: "key",
|
|
@@ -7709,7 +7708,7 @@ class StdinParser {
|
|
|
7709
7708
|
}
|
|
7710
7709
|
}
|
|
7711
7710
|
// src/lib/tree-sitter-styled-text.ts
|
|
7712
|
-
|
|
7711
|
+
registerEnvVar2({ name: "OTUI_TS_STYLE_WARN", default: false, description: "Enable warnings for missing syntax styles" });
|
|
7713
7712
|
function getSpecificity(group) {
|
|
7714
7713
|
return group.split(".").length;
|
|
7715
7714
|
}
|
|
@@ -7719,8 +7718,9 @@ function shouldSuppressInInjection(group, meta) {
|
|
|
7719
7718
|
}
|
|
7720
7719
|
return group === "markup.raw.block";
|
|
7721
7720
|
}
|
|
7722
|
-
function
|
|
7721
|
+
function treeSitterToTextChunks2(content, highlights, syntaxStyle, options) {
|
|
7723
7722
|
const chunks = [];
|
|
7723
|
+
const ranges = options?.ranges;
|
|
7724
7724
|
const defaultStyle = syntaxStyle.getStyle("default");
|
|
7725
7725
|
const concealEnabled = options?.enabled ?? true;
|
|
7726
7726
|
const baseStyle = options?.baseHighlight ? syntaxStyle.getStyle(options.baseHighlight) : undefined;
|
|
@@ -7770,13 +7770,14 @@ function treeSitterToTextChunks(content, highlights, syntaxStyle, options) {
|
|
|
7770
7770
|
text: replacementText,
|
|
7771
7771
|
fg: defaultStyle?.fg,
|
|
7772
7772
|
bg: defaultStyle?.bg,
|
|
7773
|
-
attributes: defaultStyle ?
|
|
7773
|
+
attributes: defaultStyle ? createTextAttributes2({
|
|
7774
7774
|
bold: defaultStyle.bold,
|
|
7775
7775
|
italic: defaultStyle.italic,
|
|
7776
7776
|
underline: defaultStyle.underline,
|
|
7777
7777
|
dim: defaultStyle.dim
|
|
7778
7778
|
}) : 0
|
|
7779
7779
|
});
|
|
7780
|
+
ranges?.push({ start: currentOffset, end: boundary.offset });
|
|
7780
7781
|
}
|
|
7781
7782
|
} else {
|
|
7782
7783
|
const insideInjectionContainer = injectionContainerRanges.some((range) => currentOffset >= range.start && currentOffset < range.end);
|
|
@@ -7816,11 +7817,11 @@ function treeSitterToTextChunks(content, highlights, syntaxStyle, options) {
|
|
|
7816
7817
|
} else {
|
|
7817
7818
|
if (group.includes(".")) {
|
|
7818
7819
|
const baseName = group.split(".")[0];
|
|
7819
|
-
if (
|
|
7820
|
+
if (env2.OTUI_TS_STYLE_WARN) {
|
|
7820
7821
|
console.warn(`Syntax style not found for group "${group}" or base scope "${baseName}", using default style`);
|
|
7821
7822
|
}
|
|
7822
7823
|
} else {
|
|
7823
|
-
if (
|
|
7824
|
+
if (env2.OTUI_TS_STYLE_WARN) {
|
|
7824
7825
|
console.warn(`Syntax style not found for group "${group}", using default style`);
|
|
7825
7826
|
}
|
|
7826
7827
|
}
|
|
@@ -7832,13 +7833,14 @@ function treeSitterToTextChunks(content, highlights, syntaxStyle, options) {
|
|
|
7832
7833
|
text: segmentText,
|
|
7833
7834
|
fg: finalStyle?.fg,
|
|
7834
7835
|
bg: finalStyle?.bg,
|
|
7835
|
-
attributes: finalStyle ?
|
|
7836
|
+
attributes: finalStyle ? createTextAttributes2({
|
|
7836
7837
|
bold: finalStyle.bold,
|
|
7837
7838
|
italic: finalStyle.italic,
|
|
7838
7839
|
underline: finalStyle.underline,
|
|
7839
7840
|
dim: finalStyle.dim
|
|
7840
7841
|
}) : 0
|
|
7841
7842
|
});
|
|
7843
|
+
ranges?.push({ start: currentOffset, end: boundary.offset });
|
|
7842
7844
|
}
|
|
7843
7845
|
} else if (currentOffset < boundary.offset) {
|
|
7844
7846
|
const text = content.slice(currentOffset, boundary.offset);
|
|
@@ -7848,13 +7850,14 @@ function treeSitterToTextChunks(content, highlights, syntaxStyle, options) {
|
|
|
7848
7850
|
text,
|
|
7849
7851
|
fg: style?.fg,
|
|
7850
7852
|
bg: style?.bg,
|
|
7851
|
-
attributes: style ?
|
|
7853
|
+
attributes: style ? createTextAttributes2({
|
|
7852
7854
|
bold: style.bold,
|
|
7853
7855
|
italic: style.italic,
|
|
7854
7856
|
underline: style.underline,
|
|
7855
7857
|
dim: style.dim
|
|
7856
7858
|
}) : 0
|
|
7857
7859
|
});
|
|
7860
|
+
ranges?.push({ start: currentOffset, end: boundary.offset });
|
|
7858
7861
|
}
|
|
7859
7862
|
if (boundary.type === "start") {
|
|
7860
7863
|
activeHighlights.add(boundary.highlightIndex);
|
|
@@ -7894,24 +7897,25 @@ function treeSitterToTextChunks(content, highlights, syntaxStyle, options) {
|
|
|
7894
7897
|
text,
|
|
7895
7898
|
fg: style?.fg,
|
|
7896
7899
|
bg: style?.bg,
|
|
7897
|
-
attributes: style ?
|
|
7900
|
+
attributes: style ? createTextAttributes2({
|
|
7898
7901
|
bold: style.bold,
|
|
7899
7902
|
italic: style.italic,
|
|
7900
7903
|
underline: style.underline,
|
|
7901
7904
|
dim: style.dim
|
|
7902
7905
|
}) : 0
|
|
7903
7906
|
});
|
|
7907
|
+
ranges?.push({ start: currentOffset, end: content.length });
|
|
7904
7908
|
}
|
|
7905
7909
|
return chunks;
|
|
7906
7910
|
}
|
|
7907
|
-
async function
|
|
7911
|
+
async function treeSitterToStyledText2(content, filetype, syntaxStyle, client, options) {
|
|
7908
7912
|
const result = await client.highlightOnce(content, filetype);
|
|
7909
7913
|
if (result.highlights && result.highlights.length > 0 || options?.baseHighlight) {
|
|
7910
|
-
const chunks =
|
|
7914
|
+
const chunks = treeSitterToTextChunks2(content, result.highlights ?? [], syntaxStyle, {
|
|
7911
7915
|
enabled: options?.conceal?.enabled ?? true,
|
|
7912
7916
|
baseHighlight: options?.baseHighlight
|
|
7913
7917
|
});
|
|
7914
|
-
return new
|
|
7918
|
+
return new StyledText2(chunks);
|
|
7915
7919
|
} else {
|
|
7916
7920
|
const defaultStyle = syntaxStyle.mergeStyles("default");
|
|
7917
7921
|
const chunks = [
|
|
@@ -7923,7 +7927,7 @@ async function treeSitterToStyledText(content, filetype, syntaxStyle, client, op
|
|
|
7923
7927
|
attributes: defaultStyle.attributes
|
|
7924
7928
|
}
|
|
7925
7929
|
];
|
|
7926
|
-
return new
|
|
7930
|
+
return new StyledText2(chunks);
|
|
7927
7931
|
}
|
|
7928
7932
|
}
|
|
7929
7933
|
// src/lib/tree-sitter/client.ts
|
|
@@ -7942,13 +7946,13 @@ class DebounceController {
|
|
|
7942
7946
|
}
|
|
7943
7947
|
debounce(id, ms, fn) {
|
|
7944
7948
|
const scopeMap = TIMERS_MAP.get(this.scopeId);
|
|
7945
|
-
return new Promise((
|
|
7949
|
+
return new Promise((resolve, reject) => {
|
|
7946
7950
|
if (scopeMap.has(id)) {
|
|
7947
7951
|
clearTimeout(scopeMap.get(id));
|
|
7948
7952
|
}
|
|
7949
7953
|
const timerId = setTimeout(() => {
|
|
7950
7954
|
try {
|
|
7951
|
-
|
|
7955
|
+
resolve(fn());
|
|
7952
7956
|
} catch (error) {
|
|
7953
7957
|
reject(error);
|
|
7954
7958
|
}
|
|
@@ -8052,7 +8056,7 @@ function resolveBundledDefaultParserAsset(relativePath, fallbackPath) {
|
|
|
8052
8056
|
if (!loadBundledFile) {
|
|
8053
8057
|
throw new Error(`Unknown OpenTUI default parser asset: ${JSON.stringify(relativePath)}`);
|
|
8054
8058
|
}
|
|
8055
|
-
return
|
|
8059
|
+
return resolveBundledFilePath2(`@opentui/core/${relativePath}`, loadBundledFile, fallbackPath, import.meta.url);
|
|
8056
8060
|
}
|
|
8057
8061
|
|
|
8058
8062
|
// src/node-asset-target.ts
|
|
@@ -8096,7 +8100,7 @@ function getCurrentNodeAssetTarget() {
|
|
|
8096
8100
|
var CORE_ASSET_PREFIX = "@opentui/core/";
|
|
8097
8101
|
var PARSER_WORKER_ASSET_KEY = `${CORE_ASSET_PREFIX}parser.worker.js`;
|
|
8098
8102
|
var TREE_SITTER_WASM_ASSET_KEY = "web-tree-sitter/tree-sitter.wasm";
|
|
8099
|
-
var bundledTreeSitterWorkerPath = await
|
|
8103
|
+
var bundledTreeSitterWorkerPath = await resolveBundledFilePath2(PARSER_WORKER_ASSET_KEY, () => import("@opentui/core/parser.worker", { with: { type: "file" } }), new URL("../lib/tree-sitter/parser.worker.js", import.meta.url), import.meta.url, { useAssetRoot: false });
|
|
8100
8104
|
function resolveDefaultParserAsset(relativePath, fallbackPath) {
|
|
8101
8105
|
return resolveBundledDefaultParserAsset(relativePath, fallbackPath);
|
|
8102
8106
|
}
|
|
@@ -8104,7 +8108,7 @@ function resolveDefaultTreeSitterWorkerPath(_fallbackPath) {
|
|
|
8104
8108
|
return resolveAssetPath(PARSER_WORKER_ASSET_KEY, bundledTreeSitterWorkerPath);
|
|
8105
8109
|
}
|
|
8106
8110
|
function resolveTreeSitterWasm() {
|
|
8107
|
-
return
|
|
8111
|
+
return resolveBundledFilePath2(TREE_SITTER_WASM_ASSET_KEY, () => import("web-tree-sitter/tree-sitter.wasm", { with: { type: "wasm" } }), () => import.meta.resolve(TREE_SITTER_WASM_ASSET_KEY), import.meta.url);
|
|
8108
8112
|
}
|
|
8109
8113
|
async function resolveNativeLibraryPath() {
|
|
8110
8114
|
const asset = getNativeAssetDescriptor(getCurrentNodeAssetTarget());
|
|
@@ -8493,14 +8497,14 @@ function setGlobalWorkerMessageHandler(handler) {
|
|
|
8493
8497
|
}
|
|
8494
8498
|
|
|
8495
8499
|
// src/lib/tree-sitter/client.ts
|
|
8496
|
-
|
|
8500
|
+
registerEnvVar2({
|
|
8497
8501
|
name: "OTUI_TREE_SITTER_WORKER_PATH",
|
|
8498
8502
|
description: "Path to the TreeSitter worker entry script",
|
|
8499
8503
|
type: "string",
|
|
8500
8504
|
default: ""
|
|
8501
8505
|
});
|
|
8502
8506
|
var DEFAULT_PARSER_OVERRIDES = [];
|
|
8503
|
-
function
|
|
8507
|
+
function addDefaultParsers2(parsers) {
|
|
8504
8508
|
for (const parser of parsers) {
|
|
8505
8509
|
DEFAULT_PARSER_OVERRIDES = [
|
|
8506
8510
|
...DEFAULT_PARSER_OVERRIDES.filter((existingParser) => existingParser.filetype !== parser.filetype),
|
|
@@ -8510,7 +8514,7 @@ function addDefaultParsers(parsers) {
|
|
|
8510
8514
|
}
|
|
8511
8515
|
var isUrl = (path) => path.startsWith("http://") || path.startsWith("https://");
|
|
8512
8516
|
|
|
8513
|
-
class
|
|
8517
|
+
class TreeSitterClient2 extends EventEmitter2 {
|
|
8514
8518
|
initialized = false;
|
|
8515
8519
|
worker;
|
|
8516
8520
|
buffers = new Map;
|
|
@@ -8618,8 +8622,8 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8618
8622
|
if (this.options.workerPath) {
|
|
8619
8623
|
return this.options.workerPath;
|
|
8620
8624
|
}
|
|
8621
|
-
if (
|
|
8622
|
-
return
|
|
8625
|
+
if (env2.OTUI_TREE_SITTER_WORKER_PATH) {
|
|
8626
|
+
return env2.OTUI_TREE_SITTER_WORKER_PATH;
|
|
8623
8627
|
}
|
|
8624
8628
|
if (typeof OTUI_TREE_SITTER_WORKER_PATH !== "undefined") {
|
|
8625
8629
|
return OTUI_TREE_SITTER_WORKER_PATH;
|
|
@@ -8704,7 +8708,7 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8704
8708
|
async initializeClient(generation, worker) {
|
|
8705
8709
|
const treeSitterWasmPath = await resolveTreeSitterWasm();
|
|
8706
8710
|
this.assertCurrentInitialization(generation, worker);
|
|
8707
|
-
await new Promise((
|
|
8711
|
+
await new Promise((resolve, reject) => {
|
|
8708
8712
|
const timeoutMs = this.options.initTimeout ?? 1e4;
|
|
8709
8713
|
const timeoutId = setTimeout(() => {
|
|
8710
8714
|
const error = new Error("Worker initialization timed out");
|
|
@@ -8712,7 +8716,7 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8712
8716
|
this.initializeResolvers = undefined;
|
|
8713
8717
|
reject(error);
|
|
8714
8718
|
}, timeoutMs);
|
|
8715
|
-
this.initializeResolvers = { resolve
|
|
8719
|
+
this.initializeResolvers = { resolve, reject, timeoutId };
|
|
8716
8720
|
this.sendWorkerMessage({
|
|
8717
8721
|
type: "INIT",
|
|
8718
8722
|
dataPath: this.options.dataPath,
|
|
@@ -8729,7 +8733,7 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8729
8733
|
this.assertCurrentInitialization(generation, worker);
|
|
8730
8734
|
const overriddenFiletypes = new Set(DEFAULT_PARSER_OVERRIDES.map((parser) => parser.filetype));
|
|
8731
8735
|
for (const parser of [
|
|
8732
|
-
...defaultParsers.filter((
|
|
8736
|
+
...defaultParsers.filter((parser) => !overriddenFiletypes.has(parser.filetype)),
|
|
8733
8737
|
...DEFAULT_PARSER_OVERRIDES
|
|
8734
8738
|
]) {
|
|
8735
8739
|
worker.postMessage({ type: "ADD_FILETYPE_PARSER", filetypeParser: this.resolveFiletypeParser(parser) });
|
|
@@ -8763,8 +8767,8 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8763
8767
|
}
|
|
8764
8768
|
async getPerformance() {
|
|
8765
8769
|
const messageId = `performance_${this.messageIdCounter++}`;
|
|
8766
|
-
return new Promise((
|
|
8767
|
-
this.messageCallbacks.set(messageId, { resolve
|
|
8770
|
+
return new Promise((resolve, reject) => {
|
|
8771
|
+
this.messageCallbacks.set(messageId, { resolve, reject });
|
|
8768
8772
|
try {
|
|
8769
8773
|
this.sendWorkerMessage({ type: "GET_PERFORMANCE", messageId });
|
|
8770
8774
|
} catch (error) {
|
|
@@ -8782,8 +8786,8 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8782
8786
|
}
|
|
8783
8787
|
}
|
|
8784
8788
|
const messageId = `oneshot_${this.messageIdCounter++}`;
|
|
8785
|
-
return new Promise((
|
|
8786
|
-
this.messageCallbacks.set(messageId, { resolve
|
|
8789
|
+
return new Promise((resolve, reject) => {
|
|
8790
|
+
this.messageCallbacks.set(messageId, { resolve, reject });
|
|
8787
8791
|
try {
|
|
8788
8792
|
this.sendWorkerMessage({
|
|
8789
8793
|
type: "ONESHOT_HIGHLIGHT",
|
|
@@ -8906,8 +8910,8 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8906
8910
|
}
|
|
8907
8911
|
async preloadParser(filetype) {
|
|
8908
8912
|
const messageId = `has_parser_${this.messageIdCounter++}`;
|
|
8909
|
-
const response = await new Promise((
|
|
8910
|
-
this.messageCallbacks.set(messageId, { resolve
|
|
8913
|
+
const response = await new Promise((resolve, reject) => {
|
|
8914
|
+
this.messageCallbacks.set(messageId, { resolve, reject });
|
|
8911
8915
|
try {
|
|
8912
8916
|
this.sendWorkerMessage({
|
|
8913
8917
|
type: "PRELOAD_PARSER",
|
|
@@ -8939,8 +8943,8 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8939
8943
|
}
|
|
8940
8944
|
this.buffers.set(id, { id, content, filetype, version, hasParser: false });
|
|
8941
8945
|
const messageId = `init_${this.messageIdCounter++}`;
|
|
8942
|
-
const response = await new Promise((
|
|
8943
|
-
this.messageCallbacks.set(messageId, { resolve
|
|
8946
|
+
const response = await new Promise((resolve, reject) => {
|
|
8947
|
+
this.messageCallbacks.set(messageId, { resolve, reject });
|
|
8944
8948
|
try {
|
|
8945
8949
|
this.sendWorkerMessage({
|
|
8946
8950
|
type: "INITIALIZE_PARSER",
|
|
@@ -9001,9 +9005,9 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
9001
9005
|
this.editQueues.delete(bufferId);
|
|
9002
9006
|
}
|
|
9003
9007
|
if (this.worker) {
|
|
9004
|
-
await new Promise((
|
|
9008
|
+
await new Promise((resolve, reject) => {
|
|
9005
9009
|
const messageId = `dispose_${bufferId}`;
|
|
9006
|
-
this.messageCallbacks.set(messageId, { resolve
|
|
9010
|
+
this.messageCallbacks.set(messageId, { resolve, reject });
|
|
9007
9011
|
try {
|
|
9008
9012
|
this.sendWorkerMessage({
|
|
9009
9013
|
type: "DISPOSE_BUFFER",
|
|
@@ -9012,13 +9016,13 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
9012
9016
|
} catch (error) {
|
|
9013
9017
|
console.error("Error disposing buffer", error);
|
|
9014
9018
|
this.messageCallbacks.delete(messageId);
|
|
9015
|
-
|
|
9019
|
+
resolve(false);
|
|
9016
9020
|
}
|
|
9017
9021
|
setTimeout(() => {
|
|
9018
9022
|
if (this.messageCallbacks.has(messageId)) {
|
|
9019
9023
|
this.messageCallbacks.delete(messageId);
|
|
9020
9024
|
console.warn({ bufferId }, "Timed out waiting for buffer to be disposed");
|
|
9021
|
-
|
|
9025
|
+
resolve(false);
|
|
9022
9026
|
}
|
|
9023
9027
|
}, 3000);
|
|
9024
9028
|
});
|
|
@@ -9031,8 +9035,8 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
9031
9035
|
}
|
|
9032
9036
|
let resolveDestroy;
|
|
9033
9037
|
let rejectDestroy;
|
|
9034
|
-
const destroyPromise = new Promise((
|
|
9035
|
-
resolveDestroy =
|
|
9038
|
+
const destroyPromise = new Promise((resolve, reject) => {
|
|
9039
|
+
resolveDestroy = resolve;
|
|
9036
9040
|
rejectDestroy = reject;
|
|
9037
9041
|
});
|
|
9038
9042
|
this.destroyPromise = destroyPromise;
|
|
@@ -9097,13 +9101,13 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
9097
9101
|
this.options.dataPath = dataPath;
|
|
9098
9102
|
if (this.initialized && this.worker) {
|
|
9099
9103
|
const messageId = `update_datapath_${this.messageIdCounter++}`;
|
|
9100
|
-
return new Promise((
|
|
9104
|
+
return new Promise((resolve, reject) => {
|
|
9101
9105
|
this.messageCallbacks.set(messageId, {
|
|
9102
9106
|
resolve: (response) => {
|
|
9103
9107
|
if (response.error) {
|
|
9104
9108
|
reject(new Error(response.error));
|
|
9105
9109
|
} else {
|
|
9106
|
-
|
|
9110
|
+
resolve();
|
|
9107
9111
|
}
|
|
9108
9112
|
},
|
|
9109
9113
|
reject
|
|
@@ -9126,13 +9130,13 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
9126
9130
|
throw new Error("Cannot clear cache: client is not initialized");
|
|
9127
9131
|
}
|
|
9128
9132
|
const messageId = `clear_cache_${this.messageIdCounter++}`;
|
|
9129
|
-
return new Promise((
|
|
9133
|
+
return new Promise((resolve, reject) => {
|
|
9130
9134
|
this.messageCallbacks.set(messageId, {
|
|
9131
9135
|
resolve: (response) => {
|
|
9132
9136
|
if (response.error) {
|
|
9133
9137
|
reject(new Error(response.error));
|
|
9134
9138
|
} else {
|
|
9135
|
-
|
|
9139
|
+
resolve();
|
|
9136
9140
|
}
|
|
9137
9141
|
},
|
|
9138
9142
|
reject
|
|
@@ -9204,20 +9208,20 @@ function isValidDirectoryName(name) {
|
|
|
9204
9208
|
}
|
|
9205
9209
|
|
|
9206
9210
|
// src/lib/data-paths.ts
|
|
9207
|
-
|
|
9211
|
+
registerEnvVar2({
|
|
9208
9212
|
name: "XDG_CONFIG_HOME",
|
|
9209
9213
|
description: "Base directory for user-specific configuration files",
|
|
9210
9214
|
type: "string",
|
|
9211
9215
|
default: ""
|
|
9212
9216
|
});
|
|
9213
|
-
|
|
9217
|
+
registerEnvVar2({
|
|
9214
9218
|
name: "XDG_DATA_HOME",
|
|
9215
9219
|
description: "Base directory for user-specific data files",
|
|
9216
9220
|
type: "string",
|
|
9217
9221
|
default: ""
|
|
9218
9222
|
});
|
|
9219
9223
|
|
|
9220
|
-
class
|
|
9224
|
+
class DataPathsManager2 extends EventEmitter3 {
|
|
9221
9225
|
_appName;
|
|
9222
9226
|
_globalConfigPath;
|
|
9223
9227
|
_globalConfigFile;
|
|
@@ -9246,7 +9250,7 @@ class DataPathsManager extends EventEmitter3 {
|
|
|
9246
9250
|
get globalConfigPath() {
|
|
9247
9251
|
if (this._globalConfigPath === undefined) {
|
|
9248
9252
|
const homeDir = os.homedir();
|
|
9249
|
-
const xdgConfigHome =
|
|
9253
|
+
const xdgConfigHome = env2.XDG_CONFIG_HOME;
|
|
9250
9254
|
const baseConfigDir = xdgConfigHome || path.join(homeDir, ".config");
|
|
9251
9255
|
this._globalConfigPath = path.join(baseConfigDir, this._appName);
|
|
9252
9256
|
}
|
|
@@ -9267,7 +9271,7 @@ class DataPathsManager extends EventEmitter3 {
|
|
|
9267
9271
|
get globalDataPath() {
|
|
9268
9272
|
if (this._globalDataPath === undefined) {
|
|
9269
9273
|
const homeDir = os.homedir();
|
|
9270
|
-
const xdgDataHome =
|
|
9274
|
+
const xdgDataHome = env2.XDG_DATA_HOME;
|
|
9271
9275
|
const baseDataDir = xdgDataHome || path.join(homeDir, ".local/share");
|
|
9272
9276
|
this._globalDataPath = path.join(baseDataDir, this._appName);
|
|
9273
9277
|
}
|
|
@@ -9282,12 +9286,12 @@ class DataPathsManager extends EventEmitter3 {
|
|
|
9282
9286
|
};
|
|
9283
9287
|
}
|
|
9284
9288
|
}
|
|
9285
|
-
function
|
|
9286
|
-
return singleton("data-paths-opentui", () => new
|
|
9289
|
+
function getDataPaths2() {
|
|
9290
|
+
return singleton("data-paths-opentui", () => new DataPathsManager2);
|
|
9287
9291
|
}
|
|
9288
9292
|
// src/lib/tree-sitter/resolve-ft.ts
|
|
9289
9293
|
import path2 from "path";
|
|
9290
|
-
var
|
|
9294
|
+
var extensionToFiletype2 = new Map([
|
|
9291
9295
|
["astro", "astro"],
|
|
9292
9296
|
["bash", "bash"],
|
|
9293
9297
|
["c", "c"],
|
|
@@ -9385,7 +9389,7 @@ var extensionToFiletype = new Map([
|
|
|
9385
9389
|
["java", "java"],
|
|
9386
9390
|
["css", "css"]
|
|
9387
9391
|
]);
|
|
9388
|
-
var
|
|
9392
|
+
var basenameToFiletype2 = new Map([
|
|
9389
9393
|
[".bash_aliases", "bash"],
|
|
9390
9394
|
[".bash_logout", "bash"],
|
|
9391
9395
|
[".bash_profile", "bash"],
|
|
@@ -9423,43 +9427,43 @@ function getBasename(value) {
|
|
|
9423
9427
|
const normalizedValue = value.trim().replaceAll("\\", "/");
|
|
9424
9428
|
if (!normalizedValue)
|
|
9425
9429
|
return;
|
|
9426
|
-
const
|
|
9427
|
-
return
|
|
9430
|
+
const basename = path2.posix.basename(normalizedValue).toLowerCase();
|
|
9431
|
+
return basename || undefined;
|
|
9428
9432
|
}
|
|
9429
|
-
function
|
|
9433
|
+
function extToFiletype2(extension) {
|
|
9430
9434
|
const normalizedExtension = normalizeFiletypeToken(extension);
|
|
9431
9435
|
if (!normalizedExtension)
|
|
9432
9436
|
return;
|
|
9433
|
-
return
|
|
9437
|
+
return extensionToFiletype2.get(normalizedExtension);
|
|
9434
9438
|
}
|
|
9435
|
-
function
|
|
9436
|
-
if (typeof
|
|
9439
|
+
function pathToFiletype2(path) {
|
|
9440
|
+
if (typeof path !== "string")
|
|
9437
9441
|
return;
|
|
9438
|
-
const
|
|
9439
|
-
if (!
|
|
9442
|
+
const basename = getBasename(path);
|
|
9443
|
+
if (!basename)
|
|
9440
9444
|
return;
|
|
9441
|
-
const basenameFiletype =
|
|
9445
|
+
const basenameFiletype = basenameToFiletype2.get(basename);
|
|
9442
9446
|
if (basenameFiletype) {
|
|
9443
9447
|
return basenameFiletype;
|
|
9444
9448
|
}
|
|
9445
|
-
const lastDot =
|
|
9446
|
-
if (lastDot === -1 || lastDot ===
|
|
9449
|
+
const lastDot = basename.lastIndexOf(".");
|
|
9450
|
+
if (lastDot === -1 || lastDot === basename.length - 1) {
|
|
9447
9451
|
return;
|
|
9448
9452
|
}
|
|
9449
|
-
const extension =
|
|
9450
|
-
return
|
|
9453
|
+
const extension = basename.substring(lastDot + 1);
|
|
9454
|
+
return extToFiletype2(extension);
|
|
9451
9455
|
}
|
|
9452
|
-
function
|
|
9456
|
+
function infoStringToFiletype2(infoString) {
|
|
9453
9457
|
if (typeof infoString !== "string")
|
|
9454
9458
|
return;
|
|
9455
9459
|
const token = infoString.trim().split(/\s+/, 1)[0];
|
|
9456
|
-
const directBasenameMatch =
|
|
9460
|
+
const directBasenameMatch = basenameToFiletype2.get(token.toLowerCase());
|
|
9457
9461
|
if (directBasenameMatch)
|
|
9458
9462
|
return directBasenameMatch;
|
|
9459
9463
|
const normalizedToken = normalizeFiletypeToken(token);
|
|
9460
9464
|
if (!normalizedToken)
|
|
9461
9465
|
return;
|
|
9462
|
-
return
|
|
9466
|
+
return basenameToFiletype2.get(normalizedToken) ?? pathToFiletype2(normalizedToken) ?? extToFiletype2(normalizedToken) ?? normalizedToken;
|
|
9463
9467
|
}
|
|
9464
9468
|
|
|
9465
9469
|
// src/lib/tree-sitter/index.ts
|
|
@@ -9468,17 +9472,17 @@ var TREE_SITTER_CLIENT_LISTENER_STATE_KEY = "tree-sitter-client-listener-state";
|
|
|
9468
9472
|
function getTreeSitterClientListenerState() {
|
|
9469
9473
|
return singleton(TREE_SITTER_CLIENT_LISTENER_STATE_KEY, () => ({}));
|
|
9470
9474
|
}
|
|
9471
|
-
function
|
|
9475
|
+
function getTreeSitterClient2() {
|
|
9472
9476
|
const existingClient = getSingleton(TREE_SITTER_CLIENT_KEY);
|
|
9473
9477
|
if (existingClient) {
|
|
9474
9478
|
return existingClient;
|
|
9475
9479
|
}
|
|
9476
|
-
const dataPathsManager =
|
|
9480
|
+
const dataPathsManager = getDataPaths2();
|
|
9477
9481
|
const defaultOptions = {
|
|
9478
9482
|
dataPath: dataPathsManager.globalDataPath
|
|
9479
9483
|
};
|
|
9480
9484
|
return singleton(TREE_SITTER_CLIENT_KEY, () => {
|
|
9481
|
-
const client2 = new
|
|
9485
|
+
const client2 = new TreeSitterClient2(defaultOptions);
|
|
9482
9486
|
const listenerState = getTreeSitterClientListenerState();
|
|
9483
9487
|
const handlePathsChanged = (paths) => {
|
|
9484
9488
|
client2.setDataPath(paths.globalDataPath).catch((error) => {
|
|
@@ -9500,7 +9504,7 @@ function getTreeSitterClient() {
|
|
|
9500
9504
|
return client2;
|
|
9501
9505
|
});
|
|
9502
9506
|
}
|
|
9503
|
-
async function
|
|
9507
|
+
async function destroyTreeSitterClient2() {
|
|
9504
9508
|
const client2 = getSingleton(TREE_SITTER_CLIENT_KEY);
|
|
9505
9509
|
if (!client2) {
|
|
9506
9510
|
const listenerState = getSingleton(TREE_SITTER_CLIENT_LISTENER_STATE_KEY);
|
|
@@ -9554,7 +9558,7 @@ class ExtmarksHistory {
|
|
|
9554
9558
|
}
|
|
9555
9559
|
|
|
9556
9560
|
// src/lib/extmarks.ts
|
|
9557
|
-
class
|
|
9561
|
+
class ExtmarksController2 {
|
|
9558
9562
|
editBuffer;
|
|
9559
9563
|
editorView;
|
|
9560
9564
|
extmarks = new Map;
|
|
@@ -9761,11 +9765,11 @@ class ExtmarksController {
|
|
|
9761
9765
|
if (virtualExtmark && currentOffset === virtualExtmark.end) {
|
|
9762
9766
|
const startCursor = this.offsetToPosition(virtualExtmark.start);
|
|
9763
9767
|
const endCursor = this.offsetToPosition(virtualExtmark.end);
|
|
9764
|
-
const
|
|
9765
|
-
const
|
|
9768
|
+
const deleteOffset = virtualExtmark.start;
|
|
9769
|
+
const deleteLength = virtualExtmark.end - virtualExtmark.start;
|
|
9766
9770
|
this.deleteExtmarkById(virtualExtmark.id);
|
|
9767
9771
|
this.originalDeleteRange(startCursor.row, startCursor.col, endCursor.row, endCursor.col);
|
|
9768
|
-
this.adjustExtmarksAfterDeletion(
|
|
9772
|
+
this.adjustExtmarksAfterDeletion(deleteOffset, deleteLength);
|
|
9769
9773
|
this.updateHighlights();
|
|
9770
9774
|
return;
|
|
9771
9775
|
}
|
|
@@ -9794,10 +9798,10 @@ class ExtmarksController {
|
|
|
9794
9798
|
const startCursor = this.offsetToPosition(virtualExtmark.start);
|
|
9795
9799
|
const endCursor = this.offsetToPosition(virtualExtmark.end);
|
|
9796
9800
|
const deleteOffset = virtualExtmark.start;
|
|
9797
|
-
const
|
|
9801
|
+
const deleteLength = virtualExtmark.end - virtualExtmark.start;
|
|
9798
9802
|
this.deleteExtmarkById(virtualExtmark.id);
|
|
9799
9803
|
this.originalDeleteRange(startCursor.row, startCursor.col, endCursor.row, endCursor.col);
|
|
9800
|
-
this.adjustExtmarksAfterDeletion(deleteOffset,
|
|
9804
|
+
this.adjustExtmarksAfterDeletion(deleteOffset, deleteLength);
|
|
9801
9805
|
this.updateHighlights();
|
|
9802
9806
|
return;
|
|
9803
9807
|
}
|
|
@@ -10043,13 +10047,13 @@ class ExtmarksController {
|
|
|
10043
10047
|
j++;
|
|
10044
10048
|
}
|
|
10045
10049
|
const chunk = text.substring(i, j);
|
|
10046
|
-
const chunkWidth =
|
|
10050
|
+
const chunkWidth = stringWidth(chunk);
|
|
10047
10051
|
if (displayWidthSoFar + chunkWidth < offset) {
|
|
10048
10052
|
displayWidthSoFar += chunkWidth;
|
|
10049
10053
|
i = j;
|
|
10050
10054
|
} else {
|
|
10051
10055
|
for (let k = i;k < j && displayWidthSoFar < offset; k++) {
|
|
10052
|
-
const charWidth =
|
|
10056
|
+
const charWidth = stringWidth(text[k]);
|
|
10053
10057
|
displayWidthSoFar += charWidth;
|
|
10054
10058
|
}
|
|
10055
10059
|
break;
|
|
@@ -10232,12 +10236,12 @@ class ExtmarksController {
|
|
|
10232
10236
|
this.destroyed = true;
|
|
10233
10237
|
}
|
|
10234
10238
|
}
|
|
10235
|
-
function
|
|
10236
|
-
return new
|
|
10239
|
+
function createExtmarksController2(editBuffer, editorView) {
|
|
10240
|
+
return new ExtmarksController2(editBuffer, editorView);
|
|
10237
10241
|
}
|
|
10238
10242
|
// src/lib/terminal-palette.ts
|
|
10239
|
-
var SYSTEM_CLOCK2 = new
|
|
10240
|
-
|
|
10243
|
+
var SYSTEM_CLOCK2 = new SystemClock2;
|
|
10244
|
+
registerEnvVar2({
|
|
10241
10245
|
name: "OTUI_PALETTE_IDLE_TIMEOUT_MS",
|
|
10242
10246
|
description: "Milliseconds of silence after palette queries before using fallback colors.",
|
|
10243
10247
|
type: "number",
|
|
@@ -10262,7 +10266,7 @@ function wrapForTmux(osc) {
|
|
|
10262
10266
|
return `\x1BPtmux;${escaped}\x1B\\`;
|
|
10263
10267
|
}
|
|
10264
10268
|
|
|
10265
|
-
class
|
|
10269
|
+
class TerminalPalette2 {
|
|
10266
10270
|
stdin;
|
|
10267
10271
|
stdout;
|
|
10268
10272
|
writeFn;
|
|
@@ -10355,7 +10359,7 @@ class TerminalPalette {
|
|
|
10355
10359
|
const out = this.stdout;
|
|
10356
10360
|
if (!out.isTTY || !this.stdin.isTTY)
|
|
10357
10361
|
return false;
|
|
10358
|
-
return new Promise((
|
|
10362
|
+
return new Promise((resolve) => {
|
|
10359
10363
|
const session = this.createQuerySession();
|
|
10360
10364
|
let buffer = "";
|
|
10361
10365
|
let settled = false;
|
|
@@ -10364,7 +10368,7 @@ class TerminalPalette {
|
|
|
10364
10368
|
return;
|
|
10365
10369
|
settled = true;
|
|
10366
10370
|
session.cleanup();
|
|
10367
|
-
|
|
10371
|
+
resolve(supported);
|
|
10368
10372
|
};
|
|
10369
10373
|
const onData = (chunk) => {
|
|
10370
10374
|
buffer += chunk.toString();
|
|
@@ -10380,14 +10384,14 @@ class TerminalPalette {
|
|
|
10380
10384
|
this.writeOsc("\x1B]4;0;?\x07", true);
|
|
10381
10385
|
});
|
|
10382
10386
|
}
|
|
10383
|
-
async queryPalette(indices, timeoutMs = 1200, idleTimeoutMs =
|
|
10387
|
+
async queryPalette(indices, timeoutMs = 1200, idleTimeoutMs = env2.OTUI_PALETTE_IDLE_TIMEOUT_MS) {
|
|
10384
10388
|
const out = this.stdout;
|
|
10385
10389
|
const results = new Map;
|
|
10386
10390
|
indices.forEach((i) => results.set(i, null));
|
|
10387
10391
|
if (!out.isTTY || !this.stdin.isTTY) {
|
|
10388
10392
|
return results;
|
|
10389
10393
|
}
|
|
10390
|
-
return new Promise((
|
|
10394
|
+
return new Promise((resolve) => {
|
|
10391
10395
|
const session = this.createQuerySession();
|
|
10392
10396
|
let buffer = "";
|
|
10393
10397
|
let idleTimer = null;
|
|
@@ -10397,7 +10401,7 @@ class TerminalPalette {
|
|
|
10397
10401
|
return;
|
|
10398
10402
|
settled = true;
|
|
10399
10403
|
session.cleanup();
|
|
10400
|
-
|
|
10404
|
+
resolve(results);
|
|
10401
10405
|
};
|
|
10402
10406
|
const onData = (chunk) => {
|
|
10403
10407
|
buffer += chunk.toString();
|
|
@@ -10423,7 +10427,7 @@ class TerminalPalette {
|
|
|
10423
10427
|
idleTimer = session.resetTimer(idleTimer, finish, idleTimeoutMs);
|
|
10424
10428
|
});
|
|
10425
10429
|
}
|
|
10426
|
-
async querySpecialColors(timeoutMs = 1200, idleTimeoutMs =
|
|
10430
|
+
async querySpecialColors(timeoutMs = 1200, idleTimeoutMs = env2.OTUI_PALETTE_IDLE_TIMEOUT_MS) {
|
|
10427
10431
|
const out = this.stdout;
|
|
10428
10432
|
const results = {
|
|
10429
10433
|
10: null,
|
|
@@ -10440,7 +10444,7 @@ class TerminalPalette {
|
|
|
10440
10444
|
if (!out.isTTY || !this.stdin.isTTY) {
|
|
10441
10445
|
return results;
|
|
10442
10446
|
}
|
|
10443
|
-
return new Promise((
|
|
10447
|
+
return new Promise((resolve) => {
|
|
10444
10448
|
const session = this.createQuerySession();
|
|
10445
10449
|
let buffer = "";
|
|
10446
10450
|
let idleTimer = null;
|
|
@@ -10450,7 +10454,7 @@ class TerminalPalette {
|
|
|
10450
10454
|
return;
|
|
10451
10455
|
settled = true;
|
|
10452
10456
|
session.cleanup();
|
|
10453
|
-
|
|
10457
|
+
resolve(results);
|
|
10454
10458
|
};
|
|
10455
10459
|
const onData = (chunk) => {
|
|
10456
10460
|
buffer += chunk.toString();
|
|
@@ -10498,7 +10502,7 @@ class TerminalPalette {
|
|
|
10498
10502
|
};
|
|
10499
10503
|
}
|
|
10500
10504
|
const indicesToQuery = [...Array(size).keys()];
|
|
10501
|
-
const idleTimeout =
|
|
10505
|
+
const idleTimeout = env2.OTUI_PALETTE_IDLE_TIMEOUT_MS;
|
|
10502
10506
|
const [paletteResults, specialColors] = await Promise.all([
|
|
10503
10507
|
this.queryPalette(indicesToQuery, timeout, idleTimeout),
|
|
10504
10508
|
this.querySpecialColors(timeout, idleTimeout)
|
|
@@ -10517,34 +10521,34 @@ class TerminalPalette {
|
|
|
10517
10521
|
};
|
|
10518
10522
|
}
|
|
10519
10523
|
}
|
|
10520
|
-
function
|
|
10521
|
-
return new
|
|
10524
|
+
function createTerminalPalette2(options) {
|
|
10525
|
+
return new TerminalPalette2(options);
|
|
10522
10526
|
}
|
|
10523
|
-
var DEFAULT_FOREGROUND_FALLBACK =
|
|
10524
|
-
var DEFAULT_BACKGROUND_FALLBACK =
|
|
10527
|
+
var DEFAULT_FOREGROUND_FALLBACK = RGBA2.fromInts(...DEFAULT_FOREGROUND_RGB2);
|
|
10528
|
+
var DEFAULT_BACKGROUND_FALLBACK = RGBA2.fromInts(...DEFAULT_BACKGROUND_RGB2);
|
|
10525
10529
|
var fallbackAnsi256Palette = null;
|
|
10526
10530
|
function getFallbackAnsi256Palette() {
|
|
10527
10531
|
if (!fallbackAnsi256Palette) {
|
|
10528
10532
|
fallbackAnsi256Palette = Array.from({ length: 256 }, (_, index) => {
|
|
10529
|
-
const [r, g, b] =
|
|
10530
|
-
return
|
|
10533
|
+
const [r, g, b] = ansi256IndexToRgb2(index);
|
|
10534
|
+
return RGBA2.fromInts(r, g, b);
|
|
10531
10535
|
});
|
|
10532
10536
|
}
|
|
10533
10537
|
return fallbackAnsi256Palette;
|
|
10534
10538
|
}
|
|
10535
|
-
function
|
|
10539
|
+
function normalizeTerminalPalette2(colors) {
|
|
10536
10540
|
const fallbackPalette = getFallbackAnsi256Palette();
|
|
10537
10541
|
return {
|
|
10538
10542
|
palette: Array.from({ length: 256 }, (_, index) => {
|
|
10539
10543
|
const detected = colors?.palette[index];
|
|
10540
|
-
return detected ?
|
|
10544
|
+
return detected ? RGBA2.fromHex(detected) : RGBA2.clone(fallbackPalette[index]);
|
|
10541
10545
|
}),
|
|
10542
|
-
defaultForeground: colors?.defaultForeground ?
|
|
10543
|
-
defaultBackground: colors?.defaultBackground ?
|
|
10546
|
+
defaultForeground: colors?.defaultForeground ? RGBA2.fromHex(colors.defaultForeground) : RGBA2.clone(DEFAULT_FOREGROUND_FALLBACK),
|
|
10547
|
+
defaultBackground: colors?.defaultBackground ? RGBA2.fromHex(colors.defaultBackground) : RGBA2.clone(DEFAULT_BACKGROUND_FALLBACK)
|
|
10544
10548
|
};
|
|
10545
10549
|
}
|
|
10546
|
-
function
|
|
10547
|
-
const normalized =
|
|
10550
|
+
function buildTerminalPaletteSignature2(colors) {
|
|
10551
|
+
const normalized = normalizeTerminalPalette2(colors);
|
|
10548
10552
|
const paletteSignature = normalized.palette.map((color) => color.toInts().join(",")).join(";");
|
|
10549
10553
|
return [
|
|
10550
10554
|
paletteSignature,
|
|
@@ -10554,10 +10558,10 @@ function buildTerminalPaletteSignature(colors) {
|
|
|
10554
10558
|
}
|
|
10555
10559
|
// src/lib/paste.ts
|
|
10556
10560
|
var PASTE_TEXT_DECODER = new TextDecoder;
|
|
10557
|
-
function
|
|
10561
|
+
function decodePasteBytes2(bytes) {
|
|
10558
10562
|
return PASTE_TEXT_DECODER.decode(bytes);
|
|
10559
10563
|
}
|
|
10560
|
-
function
|
|
10564
|
+
function stripAnsiSequences2(text) {
|
|
10561
10565
|
return stripANSI(text);
|
|
10562
10566
|
}
|
|
10563
10567
|
// src/lib/host-clipboard.internal.ts
|
|
@@ -10656,8 +10660,8 @@ var validateClipboardText = (text, maxWriteBytes) => {
|
|
|
10656
10660
|
var createActiveOperation = (callerSignal) => {
|
|
10657
10661
|
const controller = new AbortController;
|
|
10658
10662
|
let settle = () => {};
|
|
10659
|
-
const settled = new Promise((
|
|
10660
|
-
settle =
|
|
10663
|
+
const settled = new Promise((resolve) => {
|
|
10664
|
+
settle = resolve;
|
|
10661
10665
|
});
|
|
10662
10666
|
if (callerSignal) {
|
|
10663
10667
|
callerSignal.addEventListener("abort", () => controller.abort(callerSignal.reason), {
|
|
@@ -10684,7 +10688,7 @@ var runTrackedOperation = (active, callerSignal, operation) => {
|
|
|
10684
10688
|
};
|
|
10685
10689
|
var createHostClipboardWithBackend = (options, createBackend) => {
|
|
10686
10690
|
const config = normalizeOptions(options);
|
|
10687
|
-
const
|
|
10691
|
+
const backend = createBackend(config);
|
|
10688
10692
|
const active = new Set;
|
|
10689
10693
|
let disposed = false;
|
|
10690
10694
|
let disposePromise;
|
|
@@ -10704,7 +10708,7 @@ var createHostClipboardWithBackend = (options, createBackend) => {
|
|
|
10704
10708
|
if (config.timeoutMs === 0)
|
|
10705
10709
|
return Promise.resolve({ status: "timed-out" });
|
|
10706
10710
|
return runTrackedOperation(active, readOptions.signal, async (signal) => {
|
|
10707
|
-
const result = await
|
|
10711
|
+
const result = await backend.read({
|
|
10708
10712
|
preferredTypes,
|
|
10709
10713
|
selection,
|
|
10710
10714
|
maxBytes: config.maxReadBytes,
|
|
@@ -10730,7 +10734,7 @@ var createHostClipboardWithBackend = (options, createBackend) => {
|
|
|
10730
10734
|
return Promise.resolve({ status: "cancelled" });
|
|
10731
10735
|
if (config.timeoutMs === 0)
|
|
10732
10736
|
return Promise.resolve({ status: "timed-out" });
|
|
10733
|
-
return runTrackedOperation(active, operationOptions.signal, (signal) =>
|
|
10737
|
+
return runTrackedOperation(active, operationOptions.signal, (signal) => backend.writeText(text, { selection, timeoutMs: config.timeoutMs, signal }));
|
|
10734
10738
|
} catch (error) {
|
|
10735
10739
|
return Promise.reject(error);
|
|
10736
10740
|
}
|
|
@@ -10743,7 +10747,7 @@ var createHostClipboardWithBackend = (options, createBackend) => {
|
|
|
10743
10747
|
return Promise.resolve({ status: "cancelled" });
|
|
10744
10748
|
if (config.timeoutMs === 0)
|
|
10745
10749
|
return Promise.resolve({ status: "timed-out" });
|
|
10746
|
-
return runTrackedOperation(active, operationOptions.signal, (signal) =>
|
|
10750
|
+
return runTrackedOperation(active, operationOptions.signal, (signal) => backend.clear({ selection, timeoutMs: config.timeoutMs, signal }));
|
|
10747
10751
|
} catch (error) {
|
|
10748
10752
|
return Promise.reject(error);
|
|
10749
10753
|
}
|
|
@@ -10756,7 +10760,7 @@ var createHostClipboardWithBackend = (options, createBackend) => {
|
|
|
10756
10760
|
operation.controller.abort();
|
|
10757
10761
|
disposePromise = (async () => {
|
|
10758
10762
|
await Promise.all([...active].map((operation) => operation.settled));
|
|
10759
|
-
await
|
|
10763
|
+
await backend.dispose();
|
|
10760
10764
|
})();
|
|
10761
10765
|
return disposePromise;
|
|
10762
10766
|
}
|
|
@@ -10787,7 +10791,7 @@ var encodeReadRequest = (preferredTypes) => {
|
|
|
10787
10791
|
};
|
|
10788
10792
|
var startFailure = (status) => ({
|
|
10789
10793
|
status: "failed",
|
|
10790
|
-
error: new Error(`Native clipboard operation failed to start (${
|
|
10794
|
+
error: new Error(`Native clipboard operation failed to start (${NativeClipboardStartStatus2[status]})`)
|
|
10791
10795
|
});
|
|
10792
10796
|
|
|
10793
10797
|
class NativeClipboardBackend {
|
|
@@ -10804,7 +10808,7 @@ class NativeClipboardBackend {
|
|
|
10804
10808
|
constructor(maxImagePixels, maxConversionBytes, maxConcurrentOperations, maxProviderTransfers, waylandSeat) {
|
|
10805
10809
|
this.maxImagePixels = maxImagePixels;
|
|
10806
10810
|
this.maxConversionBytes = maxConversionBytes;
|
|
10807
|
-
this.library =
|
|
10811
|
+
this.library = resolveRenderLib2();
|
|
10808
10812
|
const service = this.library.clipboardServiceCreate(maxConcurrentOperations, maxProviderTransfers, waylandSeat);
|
|
10809
10813
|
if (!service)
|
|
10810
10814
|
throw new Error("Failed to create native clipboard service");
|
|
@@ -10836,8 +10840,8 @@ class NativeClipboardBackend {
|
|
|
10836
10840
|
if (started.status !== 0 /* Ok */ || !started.operation) {
|
|
10837
10841
|
return Promise.resolve(startFailure(started.status));
|
|
10838
10842
|
}
|
|
10839
|
-
return new Promise((
|
|
10840
|
-
const operation = { handle: started.operation, kind, signal, resolve
|
|
10843
|
+
return new Promise((resolve, reject) => {
|
|
10844
|
+
const operation = { handle: started.operation, kind, signal, resolve, reject };
|
|
10841
10845
|
this.pending.set(operation.handle, operation);
|
|
10842
10846
|
signal.addEventListener("abort", () => this.requestCancel(operation), { once: true });
|
|
10843
10847
|
this.ensureScheduled();
|
|
@@ -10910,14 +10914,14 @@ class NativeClipboardBackend {
|
|
|
10910
10914
|
try {
|
|
10911
10915
|
this.library.clipboardOperationCancel(operation.handle);
|
|
10912
10916
|
} catch {}
|
|
10913
|
-
const
|
|
10914
|
-
if (
|
|
10917
|
+
const status = this.library.clipboardOperationPoll(operation.handle);
|
|
10918
|
+
if (status === 0 /* Pending */) {
|
|
10915
10919
|
this.rotate(operation);
|
|
10916
10920
|
continue;
|
|
10917
10921
|
}
|
|
10918
10922
|
this.providerActive = true;
|
|
10919
|
-
const
|
|
10920
|
-
if (
|
|
10923
|
+
const destroyed = this.library.clipboardOperationDestroy(operation.handle);
|
|
10924
|
+
if (destroyed === 1 /* NotReady */) {
|
|
10921
10925
|
this.rotate(operation);
|
|
10922
10926
|
continue;
|
|
10923
10927
|
}
|
|
@@ -10982,7 +10986,7 @@ class NativeClipboardBackend {
|
|
|
10982
10986
|
invalidResult(kind, status) {
|
|
10983
10987
|
return {
|
|
10984
10988
|
status: "failed",
|
|
10985
|
-
error: new Error(`Native clipboard ${kind} returned inapplicable status ${
|
|
10989
|
+
error: new Error(`Native clipboard ${kind} returned inapplicable status ${NativeClipboardOperationStatus2[status]}`)
|
|
10986
10990
|
};
|
|
10987
10991
|
}
|
|
10988
10992
|
readRepresentation(handle) {
|
|
@@ -11014,7 +11018,7 @@ class NativeClipboardBackend {
|
|
|
11014
11018
|
this.clearPollTimer();
|
|
11015
11019
|
let status = this.library.clipboardServiceBeginShutdown(this.service);
|
|
11016
11020
|
while (status === 0 /* Pending */) {
|
|
11017
|
-
await new Promise((
|
|
11021
|
+
await new Promise((resolve) => setTimeout(resolve, SHUTDOWN_POLL_INTERVAL_MS));
|
|
11018
11022
|
status = this.library.clipboardServicePollShutdown(this.service);
|
|
11019
11023
|
}
|
|
11020
11024
|
if (status !== 1 /* Ready */)
|
|
@@ -11038,13 +11042,13 @@ var validateSelection = (selection) => {
|
|
|
11038
11042
|
}
|
|
11039
11043
|
return normalized;
|
|
11040
11044
|
};
|
|
11041
|
-
var
|
|
11045
|
+
var createHostClipboard2 = (options = {}) => createHostClipboardWithBackend(options, createNativeHostClipboardBackend);
|
|
11042
11046
|
var validateDestination = (destination) => {
|
|
11043
11047
|
if (destination !== "terminal-only" && destination !== "host-only" && destination !== "best-available" && destination !== "all-available") {
|
|
11044
11048
|
throw new TypeError("destination is not a supported clipboard policy");
|
|
11045
11049
|
}
|
|
11046
11050
|
};
|
|
11047
|
-
var
|
|
11051
|
+
var createClipboard2 = ({ host, terminal }) => {
|
|
11048
11052
|
const active = new Set;
|
|
11049
11053
|
let disposed = false;
|
|
11050
11054
|
let disposePromise;
|
|
@@ -11066,8 +11070,8 @@ var createClipboard = ({ host, terminal }) => {
|
|
|
11066
11070
|
return { host: { status: "not-attempted" }, terminal: terminalOperation() };
|
|
11067
11071
|
}
|
|
11068
11072
|
const hostResult = await hostOperation();
|
|
11069
|
-
const
|
|
11070
|
-
return { host: hostResult, terminal:
|
|
11073
|
+
const terminalResult = !signal.aborted && (hostResult.status === "unsupported" || hostResult.status === "failed") ? terminalOperation() : NOT_ATTEMPTED_TERMINAL;
|
|
11074
|
+
return { host: hostResult, terminal: terminalResult };
|
|
11071
11075
|
}
|
|
11072
11076
|
const hostPromise = canUseRemoteHost(options) ? hostOperation() : Promise.resolve({ status: "not-attempted" });
|
|
11073
11077
|
const terminalResult = terminalOperation();
|
|
@@ -11129,14 +11133,14 @@ var createClipboard = ({ host, terminal }) => {
|
|
|
11129
11133
|
}
|
|
11130
11134
|
};
|
|
11131
11135
|
};
|
|
11132
|
-
var
|
|
11133
|
-
((
|
|
11134
|
-
|
|
11135
|
-
|
|
11136
|
-
|
|
11137
|
-
|
|
11138
|
-
})(
|
|
11139
|
-
var
|
|
11136
|
+
var ClipboardTarget2;
|
|
11137
|
+
((ClipboardTarget) => {
|
|
11138
|
+
ClipboardTarget[ClipboardTarget["Clipboard"] = 0] = "Clipboard";
|
|
11139
|
+
ClipboardTarget[ClipboardTarget["Primary"] = 1] = "Primary";
|
|
11140
|
+
ClipboardTarget[ClipboardTarget["Select"] = 2] = "Select";
|
|
11141
|
+
ClipboardTarget[ClipboardTarget["Secondary"] = 3] = "Secondary";
|
|
11142
|
+
})(ClipboardTarget2 ||= {});
|
|
11143
|
+
var createRendererClipboardAdapter2 = (renderer) => {
|
|
11140
11144
|
const targetFor = (selection) => selection === "primary" ? 1 /* Primary */ : 0 /* Clipboard */;
|
|
11141
11145
|
const capability = () => renderer.capabilities?.osc52_support ?? "unknown";
|
|
11142
11146
|
return {
|
|
@@ -11164,7 +11168,7 @@ var createRendererClipboardAdapter = (renderer) => {
|
|
|
11164
11168
|
};
|
|
11165
11169
|
};
|
|
11166
11170
|
|
|
11167
|
-
class
|
|
11171
|
+
class Clipboard2 {
|
|
11168
11172
|
lib;
|
|
11169
11173
|
rendererPtr;
|
|
11170
11174
|
constructor(lib, rendererPtr) {
|
|
@@ -11191,44 +11195,163 @@ class Clipboard {
|
|
|
11191
11195
|
}
|
|
11192
11196
|
// src/lib/detect-links.ts
|
|
11193
11197
|
var URL_SCOPES = ["markup.link.url", "string.special.url"];
|
|
11194
|
-
|
|
11198
|
+
var HTTP_URL_PREFIX = /https?:\/\//i;
|
|
11199
|
+
var BARE_URL = /https?:\/\/[^\s<>"`]+/gi;
|
|
11200
|
+
function normalizeMarkdownLinkTarget(destination) {
|
|
11201
|
+
return destination.replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g, "$1");
|
|
11202
|
+
}
|
|
11203
|
+
function detectLinks2(chunks, context) {
|
|
11195
11204
|
const content = context.content;
|
|
11196
11205
|
const highlights = context.highlights;
|
|
11206
|
+
const hasBareUrl = HTTP_URL_PREFIX.test(content);
|
|
11207
|
+
if (!hasBareUrl && !highlights.some(([, , group]) => URL_SCOPES.includes(group)))
|
|
11208
|
+
return chunks;
|
|
11197
11209
|
const ranges = [];
|
|
11210
|
+
const rawRanges = [];
|
|
11211
|
+
const labels = new Map;
|
|
11212
|
+
const concealedDelimiters = new Map;
|
|
11198
11213
|
for (let i = 0;i < highlights.length; i++) {
|
|
11199
|
-
const [start, end, group] = highlights[i];
|
|
11214
|
+
const [start, end, group, meta] = highlights[i];
|
|
11215
|
+
if (group === "conceal" && meta?.conceal === "" && /^[*_~]+$/.test(content.slice(start, end))) {
|
|
11216
|
+
concealedDelimiters.set(end, start);
|
|
11217
|
+
}
|
|
11218
|
+
if (group === "markup.raw" || group.startsWith("markup.raw.")) {
|
|
11219
|
+
rawRanges.push({ start, end });
|
|
11220
|
+
}
|
|
11221
|
+
if (group === "markup.link.label") {
|
|
11222
|
+
const existing = labels.get(end);
|
|
11223
|
+
if (!existing || start < existing.start)
|
|
11224
|
+
labels.set(end, { start, end });
|
|
11225
|
+
}
|
|
11200
11226
|
if (!URL_SCOPES.includes(group))
|
|
11201
11227
|
continue;
|
|
11202
11228
|
const url = content.slice(start, end);
|
|
11229
|
+
if (!url)
|
|
11230
|
+
continue;
|
|
11203
11231
|
ranges.push({ start, end, url });
|
|
11204
|
-
|
|
11205
|
-
|
|
11206
|
-
|
|
11207
|
-
|
|
11208
|
-
|
|
11232
|
+
}
|
|
11233
|
+
const highlightedCount = ranges.length;
|
|
11234
|
+
for (let index = 0;index < highlightedCount; index++) {
|
|
11235
|
+
const range = ranges[index];
|
|
11236
|
+
let labelEnd = range.start;
|
|
11237
|
+
if (content[labelEnd - 1] === "<")
|
|
11238
|
+
labelEnd--;
|
|
11239
|
+
while (labelEnd > 0 && /\s/.test(content[labelEnd - 1]))
|
|
11240
|
+
labelEnd--;
|
|
11241
|
+
if (content[labelEnd - 1] !== "(" || content[labelEnd - 2] !== "]")
|
|
11242
|
+
continue;
|
|
11243
|
+
const label = labels.get(labelEnd - 2);
|
|
11244
|
+
if (!label)
|
|
11245
|
+
continue;
|
|
11246
|
+
range.url = normalizeMarkdownLinkTarget(range.url);
|
|
11247
|
+
ranges.push({ ...label, url: range.url, label: true });
|
|
11248
|
+
}
|
|
11249
|
+
if (hasBareUrl) {
|
|
11250
|
+
rawRanges.sort((a, b) => a.start - b.start || b.end - a.end);
|
|
11251
|
+
ranges.sort((a, b) => a.start - b.start || b.end - a.end);
|
|
11252
|
+
let rawIndex = 0;
|
|
11253
|
+
let highlightedIndex = 0;
|
|
11254
|
+
for (const match of content.matchAll(BARE_URL)) {
|
|
11255
|
+
const start = match.index;
|
|
11256
|
+
let url = match[0];
|
|
11257
|
+
let openParens = 0;
|
|
11258
|
+
let closeParens = 0;
|
|
11259
|
+
for (const character of url) {
|
|
11260
|
+
if (character === "(")
|
|
11261
|
+
openParens++;
|
|
11262
|
+
if (character === ")")
|
|
11263
|
+
closeParens++;
|
|
11209
11264
|
}
|
|
11210
|
-
|
|
11211
|
-
|
|
11265
|
+
while (url.length > 0) {
|
|
11266
|
+
const delimiterStart = concealedDelimiters.get(start + url.length);
|
|
11267
|
+
if (delimiterStart !== undefined && delimiterStart >= start) {
|
|
11268
|
+
url = url.slice(0, delimiterStart - start);
|
|
11269
|
+
continue;
|
|
11270
|
+
}
|
|
11271
|
+
const last = url[url.length - 1];
|
|
11272
|
+
if (last === ")" && closeParens > openParens) {
|
|
11273
|
+
closeParens--;
|
|
11274
|
+
} else if (!".,!?;:]}'".includes(last)) {
|
|
11275
|
+
break;
|
|
11276
|
+
}
|
|
11277
|
+
url = url.slice(0, -1);
|
|
11278
|
+
}
|
|
11279
|
+
const end = start + url.length;
|
|
11280
|
+
if (!url)
|
|
11281
|
+
continue;
|
|
11282
|
+
while (rawIndex < rawRanges.length && rawRanges[rawIndex].end <= start)
|
|
11283
|
+
rawIndex++;
|
|
11284
|
+
if (rawIndex < rawRanges.length && rawRanges[rawIndex].start < end)
|
|
11285
|
+
continue;
|
|
11286
|
+
while (highlightedIndex < ranges.length && ranges[highlightedIndex].end <= start)
|
|
11287
|
+
highlightedIndex++;
|
|
11288
|
+
if (highlightedIndex < ranges.length && ranges[highlightedIndex].start < end)
|
|
11289
|
+
continue;
|
|
11290
|
+
ranges.push({ start, end, url });
|
|
11212
11291
|
}
|
|
11213
11292
|
}
|
|
11214
11293
|
if (ranges.length === 0)
|
|
11215
11294
|
return chunks;
|
|
11295
|
+
ranges.sort((a, b) => a.start - b.start || b.end - a.end || Number(b.label ?? false) - Number(a.label ?? false));
|
|
11296
|
+
const linkedChunks = [];
|
|
11216
11297
|
let contentPos = 0;
|
|
11217
|
-
|
|
11218
|
-
|
|
11298
|
+
let rangeIndex = 0;
|
|
11299
|
+
for (let index = 0;index < chunks.length; index++) {
|
|
11300
|
+
const chunk = chunks[index];
|
|
11301
|
+
if (!chunk.text || chunk.link) {
|
|
11302
|
+
linkedChunks.push(chunk);
|
|
11219
11303
|
continue;
|
|
11220
|
-
|
|
11221
|
-
|
|
11304
|
+
}
|
|
11305
|
+
const providedRange = context.sourceRanges?.[index];
|
|
11306
|
+
const start = providedRange?.start ?? content.indexOf(chunk.text, contentPos);
|
|
11307
|
+
if (start < 0) {
|
|
11308
|
+
linkedChunks.push(chunk);
|
|
11222
11309
|
continue;
|
|
11223
|
-
|
|
11224
|
-
|
|
11310
|
+
}
|
|
11311
|
+
const end = providedRange?.end ?? start + chunk.text.length;
|
|
11312
|
+
contentPos = end;
|
|
11313
|
+
while (rangeIndex < ranges.length && ranges[rangeIndex].end <= start)
|
|
11314
|
+
rangeIndex++;
|
|
11315
|
+
if (content.slice(start, end) !== chunk.text) {
|
|
11316
|
+
const range = ranges[rangeIndex];
|
|
11317
|
+
if (range?.label && range.start < end)
|
|
11225
11318
|
chunk.link = { url: range.url };
|
|
11319
|
+
linkedChunks.push(chunk);
|
|
11320
|
+
continue;
|
|
11321
|
+
}
|
|
11322
|
+
let position = start;
|
|
11323
|
+
for (;rangeIndex < ranges.length; rangeIndex++) {
|
|
11324
|
+
const range = ranges[rangeIndex];
|
|
11325
|
+
if (range.end <= position)
|
|
11326
|
+
continue;
|
|
11327
|
+
if (range.start >= end)
|
|
11226
11328
|
break;
|
|
11329
|
+
const linkStart = Math.max(position, range.start);
|
|
11330
|
+
const linkEnd = Math.min(end, range.end);
|
|
11331
|
+
if (linkStart > position) {
|
|
11332
|
+
linkedChunks.push({ ...chunk, text: chunk.text.slice(position - start, linkStart - start) });
|
|
11227
11333
|
}
|
|
11334
|
+
if (linkStart === start && linkEnd === end) {
|
|
11335
|
+
chunk.link = { url: range.url };
|
|
11336
|
+
linkedChunks.push(chunk);
|
|
11337
|
+
} else {
|
|
11338
|
+
linkedChunks.push({
|
|
11339
|
+
...chunk,
|
|
11340
|
+
text: chunk.text.slice(linkStart - start, linkEnd - start),
|
|
11341
|
+
link: { url: range.url }
|
|
11342
|
+
});
|
|
11343
|
+
}
|
|
11344
|
+
position = linkEnd;
|
|
11345
|
+
if (position === end)
|
|
11346
|
+
break;
|
|
11347
|
+
}
|
|
11348
|
+
if (position === start) {
|
|
11349
|
+
linkedChunks.push(chunk);
|
|
11350
|
+
} else if (position < end) {
|
|
11351
|
+
linkedChunks.push({ ...chunk, text: chunk.text.slice(position - start) });
|
|
11228
11352
|
}
|
|
11229
|
-
contentPos = idx + chunk.text.length;
|
|
11230
11353
|
}
|
|
11231
|
-
return
|
|
11354
|
+
return linkedChunks;
|
|
11232
11355
|
}
|
|
11233
11356
|
// src/buffer.ts
|
|
11234
11357
|
function requireInteger(value, name, min, max) {
|
|
@@ -11236,18 +11359,18 @@ function requireInteger(value, name, min, max) {
|
|
|
11236
11359
|
throw new RangeError(`${name} must be an integer from ${min} to ${max}`);
|
|
11237
11360
|
}
|
|
11238
11361
|
}
|
|
11239
|
-
function packDrawOptions(
|
|
11362
|
+
function packDrawOptions(border, shouldFill, titleAlignment, bottomTitleAlignment) {
|
|
11240
11363
|
let packed = 0;
|
|
11241
|
-
if (
|
|
11364
|
+
if (border === true) {
|
|
11242
11365
|
packed |= 15;
|
|
11243
|
-
} else if (Array.isArray(
|
|
11244
|
-
if (
|
|
11366
|
+
} else if (Array.isArray(border)) {
|
|
11367
|
+
if (border.includes("top"))
|
|
11245
11368
|
packed |= 8;
|
|
11246
|
-
if (
|
|
11369
|
+
if (border.includes("right"))
|
|
11247
11370
|
packed |= 4;
|
|
11248
|
-
if (
|
|
11371
|
+
if (border.includes("bottom"))
|
|
11249
11372
|
packed |= 2;
|
|
11250
|
-
if (
|
|
11373
|
+
if (border.includes("left"))
|
|
11251
11374
|
packed |= 1;
|
|
11252
11375
|
}
|
|
11253
11376
|
if (shouldFill) {
|
|
@@ -11265,7 +11388,7 @@ function packDrawOptions(border2, shouldFill, titleAlignment, bottomTitleAlignme
|
|
|
11265
11388
|
return packed;
|
|
11266
11389
|
}
|
|
11267
11390
|
|
|
11268
|
-
class
|
|
11391
|
+
class OptimizedBuffer2 {
|
|
11269
11392
|
static fbIdCounter = 0;
|
|
11270
11393
|
id;
|
|
11271
11394
|
lib;
|
|
@@ -11304,17 +11427,17 @@ class OptimizedBuffer {
|
|
|
11304
11427
|
this.ensureRawBufferViews();
|
|
11305
11428
|
return this._rawBuffers;
|
|
11306
11429
|
}
|
|
11307
|
-
constructor(lib,
|
|
11308
|
-
this.id = options.id || `fb_${
|
|
11430
|
+
constructor(lib, ptr, width, height, options) {
|
|
11431
|
+
this.id = options.id || `fb_${OptimizedBuffer2.fbIdCounter++}`;
|
|
11309
11432
|
this.lib = lib;
|
|
11310
11433
|
this.respectAlpha = options.respectAlpha || false;
|
|
11311
11434
|
this._width = width;
|
|
11312
11435
|
this._height = height;
|
|
11313
11436
|
this._widthMethod = options.widthMethod || "unicode";
|
|
11314
|
-
this.bufferPtr =
|
|
11437
|
+
this.bufferPtr = ptr;
|
|
11315
11438
|
}
|
|
11316
11439
|
static create(width, height, widthMethod, options = {}) {
|
|
11317
|
-
const lib =
|
|
11440
|
+
const lib = resolveRenderLib2();
|
|
11318
11441
|
const respectAlpha = options.respectAlpha || false;
|
|
11319
11442
|
const id = options.id && options.id.trim() !== "" ? options.id : "unnamed buffer";
|
|
11320
11443
|
const buffer = lib.createOptimizedBuffer(width, height, widthMethod, respectAlpha, id);
|
|
@@ -11347,7 +11470,7 @@ class OptimizedBuffer {
|
|
|
11347
11470
|
}
|
|
11348
11471
|
getSpanLines() {
|
|
11349
11472
|
this.guard();
|
|
11350
|
-
const { char, fg
|
|
11473
|
+
const { char, fg, bg, attributes } = this.buffers;
|
|
11351
11474
|
const lines = [];
|
|
11352
11475
|
const CHAR_FLAG_CONTINUATION = 3221225472 | 0;
|
|
11353
11476
|
const CHAR_FLAG_MASK = 3221225472 | 0;
|
|
@@ -11362,8 +11485,8 @@ class OptimizedBuffer {
|
|
|
11362
11485
|
for (let x = 0;x < this._width; x++) {
|
|
11363
11486
|
const i = y * this._width + x;
|
|
11364
11487
|
const cp = char[i];
|
|
11365
|
-
const cellFg =
|
|
11366
|
-
const cellBg =
|
|
11488
|
+
const cellFg = RGBA2.fromArray(fg.slice(i * 4, i * 4 + 4));
|
|
11489
|
+
const cellBg = RGBA2.fromArray(bg.slice(i * 4, i * 4 + 4));
|
|
11367
11490
|
const cellAttrs = attributes[i] & 255;
|
|
11368
11491
|
const isContinuation = (cp & CHAR_FLAG_MASK) === CHAR_FLAG_CONTINUATION;
|
|
11369
11492
|
const cellChar = isContinuation ? "" : lineChars[charIdx++] ?? " ";
|
|
@@ -11390,38 +11513,38 @@ class OptimizedBuffer {
|
|
|
11390
11513
|
}
|
|
11391
11514
|
return lines;
|
|
11392
11515
|
}
|
|
11393
|
-
clear(
|
|
11516
|
+
clear(bg = RGBA2.fromValues(0, 0, 0, 1)) {
|
|
11394
11517
|
this.guard();
|
|
11395
|
-
this.lib.bufferClear(this.bufferPtr,
|
|
11518
|
+
this.lib.bufferClear(this.bufferPtr, bg);
|
|
11396
11519
|
}
|
|
11397
|
-
setCell(x, y, char,
|
|
11520
|
+
setCell(x, y, char, fg, bg, attributes = 0) {
|
|
11398
11521
|
this.guard();
|
|
11399
|
-
this.lib.bufferSetCell(this.bufferPtr, x, y, char,
|
|
11522
|
+
this.lib.bufferSetCell(this.bufferPtr, x, y, char, fg, bg, attributes);
|
|
11400
11523
|
}
|
|
11401
|
-
setCellWithAlphaBlending(x, y, char,
|
|
11524
|
+
setCellWithAlphaBlending(x, y, char, fg, bg, attributes = 0) {
|
|
11402
11525
|
this.guard();
|
|
11403
|
-
this.lib.bufferSetCellWithAlphaBlending(this.bufferPtr, x, y, char,
|
|
11526
|
+
this.lib.bufferSetCellWithAlphaBlending(this.bufferPtr, x, y, char, fg, bg, attributes);
|
|
11404
11527
|
}
|
|
11405
|
-
drawText(text, x, y,
|
|
11528
|
+
drawText(text, x, y, fg, bg, attributes = 0, selection) {
|
|
11406
11529
|
this.guard();
|
|
11407
|
-
if (!
|
|
11408
|
-
this.lib.bufferDrawText(this.bufferPtr, text, x, y,
|
|
11530
|
+
if (!selection) {
|
|
11531
|
+
this.lib.bufferDrawText(this.bufferPtr, text, x, y, fg, bg, attributes);
|
|
11409
11532
|
return;
|
|
11410
11533
|
}
|
|
11411
|
-
const { start, end } =
|
|
11534
|
+
const { start, end } = selection;
|
|
11412
11535
|
let selectionBg;
|
|
11413
11536
|
let selectionFg;
|
|
11414
|
-
if (
|
|
11415
|
-
selectionBg =
|
|
11416
|
-
selectionFg =
|
|
11537
|
+
if (selection.bgColor) {
|
|
11538
|
+
selectionBg = selection.bgColor;
|
|
11539
|
+
selectionFg = selection.fgColor || fg;
|
|
11417
11540
|
} else {
|
|
11418
|
-
const defaultBg =
|
|
11419
|
-
selectionFg = defaultBg.a > 0 ? defaultBg :
|
|
11420
|
-
selectionBg =
|
|
11541
|
+
const defaultBg = bg || RGBA2.fromValues(0, 0, 0, 0);
|
|
11542
|
+
selectionFg = defaultBg.a > 0 ? defaultBg : RGBA2.fromValues(0, 0, 0, 1);
|
|
11543
|
+
selectionBg = fg;
|
|
11421
11544
|
}
|
|
11422
11545
|
if (start > 0) {
|
|
11423
11546
|
const beforeText = text.slice(0, start);
|
|
11424
|
-
this.lib.bufferDrawText(this.bufferPtr, beforeText, x, y,
|
|
11547
|
+
this.lib.bufferDrawText(this.bufferPtr, beforeText, x, y, fg, bg, attributes);
|
|
11425
11548
|
}
|
|
11426
11549
|
if (end > start) {
|
|
11427
11550
|
const selectedText = text.slice(start, end);
|
|
@@ -11429,12 +11552,12 @@ class OptimizedBuffer {
|
|
|
11429
11552
|
}
|
|
11430
11553
|
if (end < text.length) {
|
|
11431
11554
|
const afterText = text.slice(end);
|
|
11432
|
-
this.lib.bufferDrawText(this.bufferPtr, afterText, x + end, y,
|
|
11555
|
+
this.lib.bufferDrawText(this.bufferPtr, afterText, x + end, y, fg, bg, attributes);
|
|
11433
11556
|
}
|
|
11434
11557
|
}
|
|
11435
|
-
fillRect(x, y, width, height,
|
|
11558
|
+
fillRect(x, y, width, height, bg) {
|
|
11436
11559
|
this.guard();
|
|
11437
|
-
this.lib.bufferFillRect(this.bufferPtr, x, y, width, height,
|
|
11560
|
+
this.lib.bufferFillRect(this.bufferPtr, x, y, width, height, bg);
|
|
11438
11561
|
}
|
|
11439
11562
|
colorMatrix(matrix, cellMask, strength = 1, target = 3 /* Both */) {
|
|
11440
11563
|
this.guard();
|
|
@@ -11495,13 +11618,13 @@ class OptimizedBuffer {
|
|
|
11495
11618
|
this.guard();
|
|
11496
11619
|
this.lib.bufferDrawPackedBuffer(this.bufferPtr, typeof data === "number" || typeof data === "bigint" ? toPointer(data) : data, dataLen, posX, posY, terminalWidthCells, terminalHeightCells);
|
|
11497
11620
|
}
|
|
11498
|
-
drawGrayscaleBuffer(posX, posY, intensities, srcWidth, srcHeight,
|
|
11621
|
+
drawGrayscaleBuffer(posX, posY, intensities, srcWidth, srcHeight, fg = null, bg = null) {
|
|
11499
11622
|
this.guard();
|
|
11500
|
-
this.lib.bufferDrawGrayscaleBuffer(this.bufferPtr, posX, posY, intensities, srcWidth, srcHeight,
|
|
11623
|
+
this.lib.bufferDrawGrayscaleBuffer(this.bufferPtr, posX, posY, intensities, srcWidth, srcHeight, fg, bg);
|
|
11501
11624
|
}
|
|
11502
|
-
drawGrayscaleBufferSupersampled(posX, posY, intensities, srcWidth, srcHeight,
|
|
11625
|
+
drawGrayscaleBufferSupersampled(posX, posY, intensities, srcWidth, srcHeight, fg = null, bg = null) {
|
|
11503
11626
|
this.guard();
|
|
11504
|
-
this.lib.bufferDrawGrayscaleBufferSupersampled(this.bufferPtr, posX, posY, intensities, srcWidth, srcHeight,
|
|
11627
|
+
this.lib.bufferDrawGrayscaleBufferSupersampled(this.bufferPtr, posX, posY, intensities, srcWidth, srcHeight, fg, bg);
|
|
11505
11628
|
}
|
|
11506
11629
|
resize(width, height) {
|
|
11507
11630
|
this.guard();
|
|
@@ -11514,8 +11637,8 @@ class OptimizedBuffer {
|
|
|
11514
11637
|
}
|
|
11515
11638
|
drawBox(options) {
|
|
11516
11639
|
this.guard();
|
|
11517
|
-
const style =
|
|
11518
|
-
const borderChars = options.customBorderChars ??
|
|
11640
|
+
const style = parseBorderStyle2(options.borderStyle, "single");
|
|
11641
|
+
const borderChars = options.customBorderChars ?? BorderCharArrays2[style];
|
|
11519
11642
|
const packedOptions = packDrawOptions(options.border, options.shouldFill ?? false, options.titleAlignment || "left", options.bottomTitleAlignment || "left");
|
|
11520
11643
|
this.lib.bufferDrawBox(this.bufferPtr, options.x, options.y, options.width, options.height, borderChars, packedOptions, options.borderColor, options.backgroundColor, options.titleColor ?? options.borderColor, options.title ?? null, options.bottomTitle ?? null);
|
|
11521
11644
|
}
|
|
@@ -11564,14 +11687,14 @@ class OptimizedBuffer {
|
|
|
11564
11687
|
drawOuter: options.drawOuter
|
|
11565
11688
|
});
|
|
11566
11689
|
}
|
|
11567
|
-
drawChar(char, x, y,
|
|
11690
|
+
drawChar(char, x, y, fg, bg, attributes = 0) {
|
|
11568
11691
|
this.guard();
|
|
11569
|
-
this.lib.bufferDrawChar(this.bufferPtr, char, x, y,
|
|
11692
|
+
this.lib.bufferDrawChar(this.bufferPtr, char, x, y, fg, bg, attributes);
|
|
11570
11693
|
}
|
|
11571
11694
|
}
|
|
11572
11695
|
|
|
11573
11696
|
// src/text-buffer.ts
|
|
11574
|
-
class
|
|
11697
|
+
class TextBuffer2 {
|
|
11575
11698
|
lib;
|
|
11576
11699
|
bufferPtr;
|
|
11577
11700
|
_length = 0;
|
|
@@ -11581,12 +11704,12 @@ class TextBuffer {
|
|
|
11581
11704
|
_textBytes;
|
|
11582
11705
|
_memId;
|
|
11583
11706
|
_appendedChunks = [];
|
|
11584
|
-
constructor(lib,
|
|
11707
|
+
constructor(lib, ptr) {
|
|
11585
11708
|
this.lib = lib;
|
|
11586
|
-
this.bufferPtr =
|
|
11709
|
+
this.bufferPtr = ptr;
|
|
11587
11710
|
}
|
|
11588
11711
|
static create(widthMethod) {
|
|
11589
|
-
const lib =
|
|
11712
|
+
const lib = resolveRenderLib2();
|
|
11590
11713
|
return lib.createTextBuffer(widthMethod);
|
|
11591
11714
|
}
|
|
11592
11715
|
guard() {
|
|
@@ -11614,11 +11737,11 @@ class TextBuffer {
|
|
|
11614
11737
|
this._length = this.lib.textBufferGetLength(this.bufferPtr);
|
|
11615
11738
|
this._byteSize = this.lib.textBufferGetByteSize(this.bufferPtr);
|
|
11616
11739
|
}
|
|
11617
|
-
loadFile(
|
|
11740
|
+
loadFile(path) {
|
|
11618
11741
|
this.guard();
|
|
11619
|
-
const success = this.lib.textBufferLoadFile(this.bufferPtr,
|
|
11742
|
+
const success = this.lib.textBufferLoadFile(this.bufferPtr, path);
|
|
11620
11743
|
if (!success) {
|
|
11621
|
-
throw new Error(`Failed to load file: ${
|
|
11744
|
+
throw new Error(`Failed to load file: ${path}`);
|
|
11622
11745
|
}
|
|
11623
11746
|
this._length = this.lib.textBufferGetLength(this.bufferPtr);
|
|
11624
11747
|
this._byteSize = this.lib.textBufferGetByteSize(this.bufferPtr);
|
|
@@ -11630,13 +11753,13 @@ class TextBuffer {
|
|
|
11630
11753
|
this._length = this.lib.textBufferGetLength(this.bufferPtr);
|
|
11631
11754
|
this._byteSize = this.lib.textBufferGetByteSize(this.bufferPtr);
|
|
11632
11755
|
}
|
|
11633
|
-
setDefaultFg(
|
|
11756
|
+
setDefaultFg(fg) {
|
|
11634
11757
|
this.guard();
|
|
11635
|
-
this.lib.textBufferSetDefaultFg(this.bufferPtr,
|
|
11758
|
+
this.lib.textBufferSetDefaultFg(this.bufferPtr, fg);
|
|
11636
11759
|
}
|
|
11637
|
-
setDefaultBg(
|
|
11760
|
+
setDefaultBg(bg) {
|
|
11638
11761
|
this.guard();
|
|
11639
|
-
this.lib.textBufferSetDefaultBg(this.bufferPtr,
|
|
11762
|
+
this.lib.textBufferSetDefaultBg(this.bufferPtr, bg);
|
|
11640
11763
|
}
|
|
11641
11764
|
setDefaultAttributes(attributes) {
|
|
11642
11765
|
this.guard();
|
|
@@ -11785,11 +11908,11 @@ async function loadBackend2() {
|
|
|
11785
11908
|
function importModule(specifier) {
|
|
11786
11909
|
return import(specifier).then((module) => module.default ?? module);
|
|
11787
11910
|
}
|
|
11788
|
-
function createBunBackend2(
|
|
11911
|
+
function createBunBackend2(bun) {
|
|
11789
11912
|
return {
|
|
11790
|
-
ptr:
|
|
11913
|
+
ptr: bun.ptr,
|
|
11791
11914
|
toArrayBuffer(pointer, offset, length) {
|
|
11792
|
-
return
|
|
11915
|
+
return bun.toArrayBuffer(toBunPointer2(pointer), offset, length);
|
|
11793
11916
|
}
|
|
11794
11917
|
};
|
|
11795
11918
|
}
|
|
@@ -11892,7 +12015,7 @@ function enumTypeError(value) {
|
|
|
11892
12015
|
throw new TypeError(`Invalid enum value: ${value}`);
|
|
11893
12016
|
}
|
|
11894
12017
|
function defineEnum(mapping, base = "u32") {
|
|
11895
|
-
const
|
|
12018
|
+
const reverse = Object.fromEntries(Object.entries(mapping).map(([k, v]) => [v, k]));
|
|
11896
12019
|
return {
|
|
11897
12020
|
__type: "enum",
|
|
11898
12021
|
type: base,
|
|
@@ -11900,7 +12023,7 @@ function defineEnum(mapping, base = "u32") {
|
|
|
11900
12023
|
return typeof value === "number" ? value : mapping[value] ?? enumTypeError(String(value));
|
|
11901
12024
|
},
|
|
11902
12025
|
from(value) {
|
|
11903
|
-
return
|
|
12026
|
+
return reverse[value] ?? enumTypeError(String(value));
|
|
11904
12027
|
},
|
|
11905
12028
|
enum: mapping
|
|
11906
12029
|
};
|
|
@@ -13051,7 +13174,7 @@ function defineStruct(fields, structDefOptions) {
|
|
|
13051
13174
|
|
|
13052
13175
|
// src/zig-structs.ts
|
|
13053
13176
|
var rgbaPackTransform = (rgba) => rgba?.buffer ?? null;
|
|
13054
|
-
var rgbaUnpackTransform = (
|
|
13177
|
+
var rgbaUnpackTransform = (ptr) => ptr ? RGBA2.fromArray(new Uint16Array(toArrayBuffer(ptr, 0, 8))) : undefined;
|
|
13055
13178
|
var StyledChunkStruct = defineStruct([
|
|
13056
13179
|
["text", "char*"],
|
|
13057
13180
|
["text_len", "u64", { lengthOf: "text" }],
|
|
@@ -13078,8 +13201,8 @@ var StyledChunkStruct = defineStruct([
|
|
|
13078
13201
|
["link_len", "u64", { lengthOf: "link" }]
|
|
13079
13202
|
], {
|
|
13080
13203
|
mapValue: (chunk) => {
|
|
13081
|
-
const normalizedFg =
|
|
13082
|
-
const normalizedBg =
|
|
13204
|
+
const normalizedFg = normalizeColorValue2(chunk.fg ?? null);
|
|
13205
|
+
const normalizedBg = normalizeColorValue2(chunk.bg ?? null);
|
|
13083
13206
|
if (!chunk.link || typeof chunk.link === "string") {
|
|
13084
13207
|
return {
|
|
13085
13208
|
...chunk,
|
|
@@ -13300,11 +13423,12 @@ var ReserveInfoStruct = defineStruct([
|
|
|
13300
13423
|
len: value.len
|
|
13301
13424
|
})
|
|
13302
13425
|
});
|
|
13303
|
-
var
|
|
13426
|
+
var NativeAudioStreamFormat2 = {
|
|
13304
13427
|
Mp3: 1,
|
|
13305
|
-
Flac: 2
|
|
13428
|
+
Flac: 2,
|
|
13429
|
+
Pcm: 3
|
|
13306
13430
|
};
|
|
13307
|
-
var
|
|
13431
|
+
var NativeAudioStreamState2 = {
|
|
13308
13432
|
Initializing: 0,
|
|
13309
13433
|
Buffering: 1,
|
|
13310
13434
|
Playing: 2,
|
|
@@ -13322,7 +13446,7 @@ var NativeAudioStreamStateNames = [
|
|
|
13322
13446
|
"disposed",
|
|
13323
13447
|
"reconnecting"
|
|
13324
13448
|
];
|
|
13325
|
-
var
|
|
13449
|
+
var NativeAudioStreamCloseReason2 = {
|
|
13326
13450
|
PreserveNativeTerminal: 0,
|
|
13327
13451
|
TransportError: 1,
|
|
13328
13452
|
Disposed: 2
|
|
@@ -13362,7 +13486,9 @@ var AudioStreamCreateOptionsStruct = defineStruct([
|
|
|
13362
13486
|
["pan", "f32"],
|
|
13363
13487
|
["groupId", "u32"],
|
|
13364
13488
|
["maxProbeBytes", "u32"],
|
|
13365
|
-
["format", "u32"]
|
|
13489
|
+
["format", "u32"],
|
|
13490
|
+
["sampleRate", "u32", { default: 0 }],
|
|
13491
|
+
["channels", "u32", { default: 0 }]
|
|
13366
13492
|
]);
|
|
13367
13493
|
var AudioStreamStatsStruct = defineStruct([
|
|
13368
13494
|
["bytesReceived", "u64"],
|
|
@@ -13396,64 +13522,69 @@ var AudioStatsStruct = defineStruct([
|
|
|
13396
13522
|
]);
|
|
13397
13523
|
|
|
13398
13524
|
// src/zig.ts
|
|
13399
|
-
var
|
|
13400
|
-
var
|
|
13401
|
-
var
|
|
13402
|
-
|
|
13525
|
+
var NativeAudioStreamState3 = NativeAudioStreamState2;
|
|
13526
|
+
var NativeAudioStreamCloseReason3 = NativeAudioStreamCloseReason2;
|
|
13527
|
+
var NativeAudioStreamFormat3 = NativeAudioStreamFormat2;
|
|
13528
|
+
var MAX_LINK_URL_BYTES2 = 512;
|
|
13529
|
+
function allocFFIStruct(structDefinition) {
|
|
13530
|
+
const storage = allocStruct(structDefinition);
|
|
13531
|
+
return { ...storage, ffiView: new Uint8Array(storage.buffer) };
|
|
13532
|
+
}
|
|
13533
|
+
registerEnvVar2({
|
|
13403
13534
|
name: "OPENTUI_LIBC",
|
|
13404
13535
|
description: "Select Linux native libc package. Supported values: glibc, musl.",
|
|
13405
13536
|
type: "string",
|
|
13406
13537
|
default: ""
|
|
13407
13538
|
});
|
|
13408
|
-
var
|
|
13409
|
-
((
|
|
13410
|
-
|
|
13411
|
-
|
|
13412
|
-
|
|
13413
|
-
|
|
13414
|
-
|
|
13415
|
-
|
|
13416
|
-
|
|
13417
|
-
|
|
13418
|
-
|
|
13419
|
-
|
|
13420
|
-
|
|
13421
|
-
})(
|
|
13422
|
-
var
|
|
13423
|
-
((
|
|
13424
|
-
|
|
13425
|
-
|
|
13426
|
-
|
|
13427
|
-
|
|
13428
|
-
|
|
13429
|
-
|
|
13430
|
-
})(
|
|
13431
|
-
var
|
|
13432
|
-
((
|
|
13433
|
-
|
|
13434
|
-
|
|
13435
|
-
|
|
13436
|
-
})(
|
|
13437
|
-
var
|
|
13438
|
-
((
|
|
13439
|
-
|
|
13440
|
-
|
|
13441
|
-
|
|
13442
|
-
|
|
13443
|
-
|
|
13444
|
-
})(
|
|
13445
|
-
var
|
|
13446
|
-
((
|
|
13447
|
-
|
|
13448
|
-
|
|
13449
|
-
|
|
13450
|
-
})(
|
|
13451
|
-
var
|
|
13452
|
-
((
|
|
13453
|
-
|
|
13454
|
-
|
|
13455
|
-
|
|
13456
|
-
})(
|
|
13539
|
+
var NativeClipboardOperationStatus2;
|
|
13540
|
+
((NativeClipboardOperationStatus) => {
|
|
13541
|
+
NativeClipboardOperationStatus[NativeClipboardOperationStatus["Pending"] = 0] = "Pending";
|
|
13542
|
+
NativeClipboardOperationStatus[NativeClipboardOperationStatus["Read"] = 1] = "Read";
|
|
13543
|
+
NativeClipboardOperationStatus[NativeClipboardOperationStatus["Empty"] = 2] = "Empty";
|
|
13544
|
+
NativeClipboardOperationStatus[NativeClipboardOperationStatus["Written"] = 3] = "Written";
|
|
13545
|
+
NativeClipboardOperationStatus[NativeClipboardOperationStatus["Cleared"] = 4] = "Cleared";
|
|
13546
|
+
NativeClipboardOperationStatus[NativeClipboardOperationStatus["Unsupported"] = 5] = "Unsupported";
|
|
13547
|
+
NativeClipboardOperationStatus[NativeClipboardOperationStatus["Cancelled"] = 6] = "Cancelled";
|
|
13548
|
+
NativeClipboardOperationStatus[NativeClipboardOperationStatus["TimedOut"] = 7] = "TimedOut";
|
|
13549
|
+
NativeClipboardOperationStatus[NativeClipboardOperationStatus["LimitExceeded"] = 8] = "LimitExceeded";
|
|
13550
|
+
NativeClipboardOperationStatus[NativeClipboardOperationStatus["Failed"] = 9] = "Failed";
|
|
13551
|
+
NativeClipboardOperationStatus[NativeClipboardOperationStatus["InvalidHandle"] = 10] = "InvalidHandle";
|
|
13552
|
+
})(NativeClipboardOperationStatus2 ||= {});
|
|
13553
|
+
var NativeClipboardStartStatus2;
|
|
13554
|
+
((NativeClipboardStartStatus) => {
|
|
13555
|
+
NativeClipboardStartStatus[NativeClipboardStartStatus["Ok"] = 0] = "Ok";
|
|
13556
|
+
NativeClipboardStartStatus[NativeClipboardStartStatus["InvalidService"] = 1] = "InvalidService";
|
|
13557
|
+
NativeClipboardStartStatus[NativeClipboardStartStatus["ShuttingDown"] = 2] = "ShuttingDown";
|
|
13558
|
+
NativeClipboardStartStatus[NativeClipboardStartStatus["LimitExceeded"] = 3] = "LimitExceeded";
|
|
13559
|
+
NativeClipboardStartStatus[NativeClipboardStartStatus["InvalidArgument"] = 4] = "InvalidArgument";
|
|
13560
|
+
NativeClipboardStartStatus[NativeClipboardStartStatus["OutOfMemory"] = 5] = "OutOfMemory";
|
|
13561
|
+
})(NativeClipboardStartStatus2 ||= {});
|
|
13562
|
+
var NativeClipboardCancelStatus2;
|
|
13563
|
+
((NativeClipboardCancelStatus) => {
|
|
13564
|
+
NativeClipboardCancelStatus[NativeClipboardCancelStatus["Requested"] = 0] = "Requested";
|
|
13565
|
+
NativeClipboardCancelStatus[NativeClipboardCancelStatus["AlreadyTerminal"] = 1] = "AlreadyTerminal";
|
|
13566
|
+
NativeClipboardCancelStatus[NativeClipboardCancelStatus["InvalidHandle"] = 2] = "InvalidHandle";
|
|
13567
|
+
})(NativeClipboardCancelStatus2 ||= {});
|
|
13568
|
+
var NativeClipboardCopyStatus2;
|
|
13569
|
+
((NativeClipboardCopyStatus) => {
|
|
13570
|
+
NativeClipboardCopyStatus[NativeClipboardCopyStatus["Ok"] = 0] = "Ok";
|
|
13571
|
+
NativeClipboardCopyStatus[NativeClipboardCopyStatus["BufferTooSmall"] = 1] = "BufferTooSmall";
|
|
13572
|
+
NativeClipboardCopyStatus[NativeClipboardCopyStatus["InvalidHandle"] = 2] = "InvalidHandle";
|
|
13573
|
+
NativeClipboardCopyStatus[NativeClipboardCopyStatus["InvalidState"] = 3] = "InvalidState";
|
|
13574
|
+
NativeClipboardCopyStatus[NativeClipboardCopyStatus["InvalidArgument"] = 4] = "InvalidArgument";
|
|
13575
|
+
})(NativeClipboardCopyStatus2 ||= {});
|
|
13576
|
+
var NativeClipboardDestroyStatus2;
|
|
13577
|
+
((NativeClipboardDestroyStatus) => {
|
|
13578
|
+
NativeClipboardDestroyStatus[NativeClipboardDestroyStatus["Destroyed"] = 0] = "Destroyed";
|
|
13579
|
+
NativeClipboardDestroyStatus[NativeClipboardDestroyStatus["NotReady"] = 1] = "NotReady";
|
|
13580
|
+
NativeClipboardDestroyStatus[NativeClipboardDestroyStatus["InvalidHandle"] = 2] = "InvalidHandle";
|
|
13581
|
+
})(NativeClipboardDestroyStatus2 ||= {});
|
|
13582
|
+
var NativeClipboardShutdownStatus2;
|
|
13583
|
+
((NativeClipboardShutdownStatus) => {
|
|
13584
|
+
NativeClipboardShutdownStatus[NativeClipboardShutdownStatus["Pending"] = 0] = "Pending";
|
|
13585
|
+
NativeClipboardShutdownStatus[NativeClipboardShutdownStatus["Ready"] = 1] = "Ready";
|
|
13586
|
+
NativeClipboardShutdownStatus[NativeClipboardShutdownStatus["InvalidHandle"] = 2] = "InvalidHandle";
|
|
13587
|
+
})(NativeClipboardShutdownStatus2 ||= {});
|
|
13457
13588
|
var targetLibPath;
|
|
13458
13589
|
var targetLibError;
|
|
13459
13590
|
try {
|
|
@@ -13467,43 +13598,43 @@ try {
|
|
|
13467
13598
|
} catch (error) {
|
|
13468
13599
|
targetLibError = error instanceof Error ? error : new Error(String(error));
|
|
13469
13600
|
}
|
|
13470
|
-
|
|
13601
|
+
registerEnvVar2({
|
|
13471
13602
|
name: "OTUI_DEBUG_FFI",
|
|
13472
13603
|
description: "Enable debug logging for the FFI bindings.",
|
|
13473
13604
|
type: "boolean",
|
|
13474
13605
|
default: false
|
|
13475
13606
|
});
|
|
13476
|
-
|
|
13607
|
+
registerEnvVar2({
|
|
13477
13608
|
name: "OTUI_TRACE_FFI",
|
|
13478
13609
|
description: "Enable tracing for the FFI bindings.",
|
|
13479
13610
|
type: "boolean",
|
|
13480
13611
|
default: false
|
|
13481
13612
|
});
|
|
13482
|
-
|
|
13613
|
+
registerEnvVar2({
|
|
13483
13614
|
name: "OPENTUI_FORCE_WCWIDTH",
|
|
13484
13615
|
description: "Use wcwidth for character width calculations when the variable is present",
|
|
13485
13616
|
type: "string",
|
|
13486
13617
|
required: false
|
|
13487
13618
|
});
|
|
13488
|
-
|
|
13619
|
+
registerEnvVar2({
|
|
13489
13620
|
name: "OPENTUI_FORCE_UNICODE",
|
|
13490
13621
|
description: "Force Mode 2026 Unicode support when the variable is present",
|
|
13491
13622
|
type: "string",
|
|
13492
13623
|
required: false
|
|
13493
13624
|
});
|
|
13494
|
-
|
|
13625
|
+
registerEnvVar2({
|
|
13495
13626
|
name: "OPENTUI_GRAPHICS",
|
|
13496
13627
|
description: "Control Kitty and Sixel graphics detection with the exact value true, 1, false, or 0",
|
|
13497
13628
|
type: "string",
|
|
13498
13629
|
required: false
|
|
13499
13630
|
});
|
|
13500
|
-
|
|
13631
|
+
registerEnvVar2({
|
|
13501
13632
|
name: "OPENTUI_IMAGE_PROTOCOL",
|
|
13502
13633
|
description: "Override image rendering protocol: auto, kitty, sixel, or blocks",
|
|
13503
13634
|
type: "string",
|
|
13504
13635
|
default: "auto"
|
|
13505
13636
|
});
|
|
13506
|
-
|
|
13637
|
+
registerEnvVar2({
|
|
13507
13638
|
name: "OPENTUI_FORCE_NOZWJ",
|
|
13508
13639
|
description: "Use no_zwj width mode when the variable is present",
|
|
13509
13640
|
type: "string",
|
|
@@ -13671,11 +13802,11 @@ function getOpenTUILib(libPath) {
|
|
|
13671
13802
|
returns: "i32"
|
|
13672
13803
|
},
|
|
13673
13804
|
embeddedTerminalCursor: {
|
|
13674
|
-
args: ["u32", "
|
|
13805
|
+
args: ["u32", "buffer"],
|
|
13675
13806
|
returns: "i32"
|
|
13676
13807
|
},
|
|
13677
13808
|
embeddedTerminalEncodeKey: {
|
|
13678
|
-
args: ["u32", "
|
|
13809
|
+
args: ["u32", "buffer", "ptr", "u32", "ptr", "u32", "ptr", "u32", "ptr"],
|
|
13679
13810
|
returns: "i32"
|
|
13680
13811
|
},
|
|
13681
13812
|
embeddedTerminalEncodeMouse: {
|
|
@@ -14015,7 +14146,7 @@ function getOpenTUILib(libPath) {
|
|
|
14015
14146
|
returns: "void"
|
|
14016
14147
|
},
|
|
14017
14148
|
bufferDrawImage: {
|
|
14018
|
-
args: ["u32", "u32", "
|
|
14149
|
+
args: ["u32", "u32", "buffer"],
|
|
14019
14150
|
returns: "u8"
|
|
14020
14151
|
},
|
|
14021
14152
|
bufferDrawPackedBuffer: {
|
|
@@ -14031,7 +14162,7 @@ function getOpenTUILib(libPath) {
|
|
|
14031
14162
|
returns: "void"
|
|
14032
14163
|
},
|
|
14033
14164
|
bufferDrawGrid: {
|
|
14034
|
-
args: ["u32", "buffer", "buffer", "buffer", "buffer", "u32", "buffer", "u32", "
|
|
14165
|
+
args: ["u32", "buffer", "buffer", "buffer", "buffer", "u32", "buffer", "u32", "buffer"],
|
|
14035
14166
|
returns: "void"
|
|
14036
14167
|
},
|
|
14037
14168
|
bufferDrawBox: {
|
|
@@ -14398,7 +14529,7 @@ function getOpenTUILib(libPath) {
|
|
|
14398
14529
|
returns: "void"
|
|
14399
14530
|
},
|
|
14400
14531
|
textBufferViewMeasureForDimensions: {
|
|
14401
|
-
args: ["u32", "u32", "u32", "
|
|
14532
|
+
args: ["u32", "u32", "u32", "buffer"],
|
|
14402
14533
|
returns: "bool"
|
|
14403
14534
|
},
|
|
14404
14535
|
bufferDrawTextBufferView: {
|
|
@@ -14546,7 +14677,7 @@ function getOpenTUILib(libPath) {
|
|
|
14546
14677
|
returns: "void"
|
|
14547
14678
|
},
|
|
14548
14679
|
editBufferGetCursorPosition: {
|
|
14549
|
-
args: ["u32", "
|
|
14680
|
+
args: ["u32", "buffer"],
|
|
14550
14681
|
returns: "void"
|
|
14551
14682
|
},
|
|
14552
14683
|
editBufferGetId: {
|
|
@@ -14590,19 +14721,19 @@ function getOpenTUILib(libPath) {
|
|
|
14590
14721
|
returns: "void"
|
|
14591
14722
|
},
|
|
14592
14723
|
editBufferGetNextWordBoundary: {
|
|
14593
|
-
args: ["u32", "
|
|
14724
|
+
args: ["u32", "buffer"],
|
|
14594
14725
|
returns: "void"
|
|
14595
14726
|
},
|
|
14596
14727
|
editBufferGetPrevWordBoundary: {
|
|
14597
|
-
args: ["u32", "
|
|
14728
|
+
args: ["u32", "buffer"],
|
|
14598
14729
|
returns: "void"
|
|
14599
14730
|
},
|
|
14600
14731
|
editBufferGetEOL: {
|
|
14601
|
-
args: ["u32", "
|
|
14732
|
+
args: ["u32", "buffer"],
|
|
14602
14733
|
returns: "void"
|
|
14603
14734
|
},
|
|
14604
14735
|
editBufferOffsetToPosition: {
|
|
14605
|
-
args: ["u32", "u32", "
|
|
14736
|
+
args: ["u32", "u32", "buffer"],
|
|
14606
14737
|
returns: "bool"
|
|
14607
14738
|
},
|
|
14608
14739
|
editBufferPositionToOffset: {
|
|
@@ -14678,7 +14809,7 @@ function getOpenTUILib(libPath) {
|
|
|
14678
14809
|
returns: "u32"
|
|
14679
14810
|
},
|
|
14680
14811
|
editorViewGetVisualCursor: {
|
|
14681
|
-
args: ["u32", "
|
|
14812
|
+
args: ["u32", "buffer"],
|
|
14682
14813
|
returns: "void"
|
|
14683
14814
|
},
|
|
14684
14815
|
editorViewMoveUpVisual: {
|
|
@@ -14698,23 +14829,23 @@ function getOpenTUILib(libPath) {
|
|
|
14698
14829
|
returns: "void"
|
|
14699
14830
|
},
|
|
14700
14831
|
editorViewGetNextWordBoundary: {
|
|
14701
|
-
args: ["u32", "
|
|
14832
|
+
args: ["u32", "buffer"],
|
|
14702
14833
|
returns: "void"
|
|
14703
14834
|
},
|
|
14704
14835
|
editorViewGetPrevWordBoundary: {
|
|
14705
|
-
args: ["u32", "
|
|
14836
|
+
args: ["u32", "buffer"],
|
|
14706
14837
|
returns: "void"
|
|
14707
14838
|
},
|
|
14708
14839
|
editorViewGetEOL: {
|
|
14709
|
-
args: ["u32", "
|
|
14840
|
+
args: ["u32", "buffer"],
|
|
14710
14841
|
returns: "void"
|
|
14711
14842
|
},
|
|
14712
14843
|
editorViewGetVisualSOL: {
|
|
14713
|
-
args: ["u32", "
|
|
14844
|
+
args: ["u32", "buffer"],
|
|
14714
14845
|
returns: "void"
|
|
14715
14846
|
},
|
|
14716
14847
|
editorViewGetVisualEOL: {
|
|
14717
|
-
args: ["u32", "
|
|
14848
|
+
args: ["u32", "buffer"],
|
|
14718
14849
|
returns: "void"
|
|
14719
14850
|
},
|
|
14720
14851
|
editorViewGotoVisualLineEnd: {
|
|
@@ -15100,7 +15231,7 @@ function getOpenTUILib(libPath) {
|
|
|
15100
15231
|
returns: "i32"
|
|
15101
15232
|
},
|
|
15102
15233
|
audioCreateStream: {
|
|
15103
|
-
args: ["u32", "
|
|
15234
|
+
args: ["u32", "buffer", "buffer"],
|
|
15104
15235
|
returns: "i32"
|
|
15105
15236
|
},
|
|
15106
15237
|
audioWriteStream: {
|
|
@@ -15128,11 +15259,11 @@ function getOpenTUILib(libPath) {
|
|
|
15128
15259
|
returns: "i32"
|
|
15129
15260
|
},
|
|
15130
15261
|
audioGetStreamStats: {
|
|
15131
|
-
args: ["u32", "u32", "
|
|
15262
|
+
args: ["u32", "u32", "buffer"],
|
|
15132
15263
|
returns: "i32"
|
|
15133
15264
|
},
|
|
15134
15265
|
audioCloseStream: {
|
|
15135
|
-
args: ["u32", "u32", "u32", "
|
|
15266
|
+
args: ["u32", "u32", "u32", "buffer"],
|
|
15136
15267
|
returns: "i32"
|
|
15137
15268
|
},
|
|
15138
15269
|
audioLoad: {
|
|
@@ -15232,7 +15363,7 @@ function getOpenTUILib(libPath) {
|
|
|
15232
15363
|
returns: "void"
|
|
15233
15364
|
}
|
|
15234
15365
|
});
|
|
15235
|
-
if (
|
|
15366
|
+
if (env2.OTUI_DEBUG_FFI || env2.OTUI_TRACE_FFI) {
|
|
15236
15367
|
return {
|
|
15237
15368
|
...rawSymbols,
|
|
15238
15369
|
symbols: convertToDebugSymbols(rawSymbols.symbols)
|
|
@@ -15244,7 +15375,7 @@ function convertToDebugSymbols(symbols) {
|
|
|
15244
15375
|
if (!globalTraceSymbols) {
|
|
15245
15376
|
globalTraceSymbols = {};
|
|
15246
15377
|
}
|
|
15247
|
-
if (
|
|
15378
|
+
if (env2.OTUI_DEBUG_FFI && !globalFFILogPath) {
|
|
15248
15379
|
const now = new Date;
|
|
15249
15380
|
const timestamp = now.toISOString().replace(/[:.]/g, "-").replace(/T/, "_").split("Z")[0];
|
|
15250
15381
|
globalFFILogPath = `ffi_otui_debug_${timestamp}.log`;
|
|
@@ -15254,7 +15385,7 @@ function convertToDebugSymbols(symbols) {
|
|
|
15254
15385
|
Object.entries(symbols).forEach(([key, value]) => {
|
|
15255
15386
|
debugSymbols[key] = value;
|
|
15256
15387
|
});
|
|
15257
|
-
if (
|
|
15388
|
+
if (env2.OTUI_DEBUG_FFI && globalFFILogPath) {
|
|
15258
15389
|
const logPath = globalFFILogPath;
|
|
15259
15390
|
const writeSync = (msg) => {
|
|
15260
15391
|
writeFileSync(logPath, msg + `
|
|
@@ -15271,7 +15402,7 @@ function convertToDebugSymbols(symbols) {
|
|
|
15271
15402
|
}
|
|
15272
15403
|
});
|
|
15273
15404
|
}
|
|
15274
|
-
if (
|
|
15405
|
+
if (env2.OTUI_TRACE_FFI) {
|
|
15275
15406
|
hasTracing = true;
|
|
15276
15407
|
Object.entries(symbols).forEach(([key, value]) => {
|
|
15277
15408
|
if (typeof value === "function") {
|
|
@@ -15289,7 +15420,7 @@ function convertToDebugSymbols(symbols) {
|
|
|
15289
15420
|
}
|
|
15290
15421
|
});
|
|
15291
15422
|
}
|
|
15292
|
-
if ((
|
|
15423
|
+
if ((env2.OTUI_DEBUG_FFI || env2.OTUI_TRACE_FFI) && !exitHandlerRegistered) {
|
|
15293
15424
|
exitHandlerRegistered = true;
|
|
15294
15425
|
process.on("exit", () => {
|
|
15295
15426
|
if (globalTraceSymbols) {
|
|
@@ -15300,7 +15431,7 @@ function convertToDebugSymbols(symbols) {
|
|
|
15300
15431
|
}
|
|
15301
15432
|
const sortedTimings = [...timings].sort((a, b) => a - b);
|
|
15302
15433
|
const count = sortedTimings.length;
|
|
15303
|
-
const total = sortedTimings.reduce((acc,
|
|
15434
|
+
const total = sortedTimings.reduce((acc, t) => acc + t, 0);
|
|
15304
15435
|
const average = total / count;
|
|
15305
15436
|
const min = sortedTimings[0];
|
|
15306
15437
|
const max = sortedTimings[count - 1];
|
|
@@ -15375,13 +15506,13 @@ function convertToDebugSymbols(symbols) {
|
|
|
15375
15506
|
return debugSymbols;
|
|
15376
15507
|
}
|
|
15377
15508
|
var LogLevel2;
|
|
15378
|
-
((
|
|
15379
|
-
|
|
15380
|
-
|
|
15381
|
-
|
|
15382
|
-
|
|
15509
|
+
((LogLevel) => {
|
|
15510
|
+
LogLevel[LogLevel["Error"] = 0] = "Error";
|
|
15511
|
+
LogLevel[LogLevel["Warn"] = 1] = "Warn";
|
|
15512
|
+
LogLevel[LogLevel["Info"] = 2] = "Info";
|
|
15513
|
+
LogLevel[LogLevel["Debug"] = 3] = "Debug";
|
|
15383
15514
|
})(LogLevel2 ||= {});
|
|
15384
|
-
var
|
|
15515
|
+
var NativeMeasureTargetKind2 = {
|
|
15385
15516
|
None: 0,
|
|
15386
15517
|
TextBufferView: 1,
|
|
15387
15518
|
EditorView: 2
|
|
@@ -15393,11 +15524,11 @@ class FFIRenderLib {
|
|
|
15393
15524
|
yogaLayout = new Float32Array(6);
|
|
15394
15525
|
ffiStructStorage = {
|
|
15395
15526
|
logicalCursor: {
|
|
15396
|
-
...
|
|
15527
|
+
...allocFFIStruct(LogicalCursorStruct),
|
|
15397
15528
|
result: { row: 0, col: 0, offset: 0 }
|
|
15398
15529
|
},
|
|
15399
15530
|
visualCursor: {
|
|
15400
|
-
...
|
|
15531
|
+
...allocFFIStruct(VisualCursorStruct),
|
|
15401
15532
|
result: {
|
|
15402
15533
|
visualRow: 0,
|
|
15403
15534
|
visualCol: 0,
|
|
@@ -15407,13 +15538,13 @@ class FFIRenderLib {
|
|
|
15407
15538
|
}
|
|
15408
15539
|
},
|
|
15409
15540
|
measureResult: {
|
|
15410
|
-
...
|
|
15541
|
+
...allocFFIStruct(MeasureResultStruct),
|
|
15411
15542
|
result: { lineCount: 0, widthColsMax: 0 }
|
|
15412
15543
|
},
|
|
15413
|
-
embeddedTerminalCursor:
|
|
15414
|
-
embeddedTerminalKeyOptions:
|
|
15544
|
+
embeddedTerminalCursor: allocFFIStruct(EmbeddedTerminalCursorStruct),
|
|
15545
|
+
embeddedTerminalKeyOptions: allocFFIStruct(EmbeddedTerminalKeyOptionsStruct),
|
|
15415
15546
|
audioStreamStats: {
|
|
15416
|
-
...
|
|
15547
|
+
...allocFFIStruct(AudioStreamStatsStruct),
|
|
15417
15548
|
result: {
|
|
15418
15549
|
bytesReceived: 0n,
|
|
15419
15550
|
framesDecoded: 0n,
|
|
@@ -15428,8 +15559,8 @@ class FFIRenderLib {
|
|
|
15428
15559
|
readyGeneration: 0
|
|
15429
15560
|
}
|
|
15430
15561
|
},
|
|
15431
|
-
imageDrawOptions:
|
|
15432
|
-
gridDrawOptions:
|
|
15562
|
+
imageDrawOptions: allocFFIStruct(ImageDrawOptionsStruct),
|
|
15563
|
+
gridDrawOptions: allocFFIStruct(GridDrawOptionsStruct)
|
|
15433
15564
|
};
|
|
15434
15565
|
disposed = false;
|
|
15435
15566
|
clipboardServices = new Set;
|
|
@@ -15492,7 +15623,7 @@ class FFIRenderLib {
|
|
|
15492
15623
|
}
|
|
15493
15624
|
embeddedTerminalGetSelectedText(handle) {
|
|
15494
15625
|
const required = new Uint32Array(1);
|
|
15495
|
-
const read = (
|
|
15626
|
+
const read = (output) => this.opentui.symbols.embeddedTerminalGetSelectedText(handle, viewOrNull(output), output.byteLength, required);
|
|
15496
15627
|
const initial = new Uint8Array(256);
|
|
15497
15628
|
const status = read(initial);
|
|
15498
15629
|
if (status >= 0)
|
|
@@ -15508,7 +15639,7 @@ class FFIRenderLib {
|
|
|
15508
15639
|
}
|
|
15509
15640
|
embeddedTerminalCursor(handle) {
|
|
15510
15641
|
const storage = this.ffiStructStorage.embeddedTerminalCursor;
|
|
15511
|
-
embeddedTerminalResult(this.opentui.symbols.embeddedTerminalCursor(handle, storage.
|
|
15642
|
+
embeddedTerminalResult(this.opentui.symbols.embeddedTerminalCursor(handle, storage.ffiView), "cursor query");
|
|
15512
15643
|
const result = EmbeddedTerminalCursorStruct.unpack(storage.buffer);
|
|
15513
15644
|
return {
|
|
15514
15645
|
x: result.x,
|
|
@@ -15536,7 +15667,7 @@ class FFIRenderLib {
|
|
|
15536
15667
|
const text = key.text ? this.encoder.encode(key.text) : new Uint8Array;
|
|
15537
15668
|
const textLength = toSafeFFIU32Length(text.byteLength, "Embedded terminal key text length");
|
|
15538
15669
|
const required = new Uint32Array(1);
|
|
15539
|
-
const encode = (
|
|
15670
|
+
const encode = (output) => this.opentui.symbols.embeddedTerminalEncodeKey(handle, options.ffiView, keyCodeLength === 0 ? null : keyCode, keyCodeLength, textLength === 0 ? null : text, textLength, output, output.byteLength, required);
|
|
15540
15671
|
const initial = new Uint8Array(Math.max(64, textLength));
|
|
15541
15672
|
const status = encode(initial);
|
|
15542
15673
|
if (status >= 0)
|
|
@@ -15798,7 +15929,7 @@ class FFIRenderLib {
|
|
|
15798
15929
|
const width = this.opentui.symbols.getBufferWidth(bufferPtr);
|
|
15799
15930
|
const height = this.opentui.symbols.getBufferHeight(bufferPtr);
|
|
15800
15931
|
const widthMethod = widthMethodFromCode(this.opentui.symbols.getBufferWidthMethod(bufferPtr));
|
|
15801
|
-
return new
|
|
15932
|
+
return new OptimizedBuffer2(this, bufferPtr, width, height, { id: "next buffer", widthMethod });
|
|
15802
15933
|
}
|
|
15803
15934
|
getCurrentBuffer(renderer) {
|
|
15804
15935
|
const bufferPtr = this.opentui.symbols.getCurrentBuffer(renderer);
|
|
@@ -15808,7 +15939,7 @@ class FFIRenderLib {
|
|
|
15808
15939
|
const width = this.opentui.symbols.getBufferWidth(bufferPtr);
|
|
15809
15940
|
const height = this.opentui.symbols.getBufferHeight(bufferPtr);
|
|
15810
15941
|
const widthMethod = widthMethodFromCode(this.opentui.symbols.getBufferWidthMethod(bufferPtr));
|
|
15811
|
-
return new
|
|
15942
|
+
return new OptimizedBuffer2(this, bufferPtr, width, height, { id: "current buffer", widthMethod });
|
|
15812
15943
|
}
|
|
15813
15944
|
rendererSetPaletteState(renderer, palette, defaultForeground, defaultBackground, paletteEpoch) {
|
|
15814
15945
|
const paletteBuffer = new Uint16Array(palette.length * 4);
|
|
@@ -15818,32 +15949,32 @@ class FFIRenderLib {
|
|
|
15818
15949
|
this.opentui.symbols.rendererSetPaletteState(renderer, paletteBuffer, palette.length, rgbaBuffer(defaultForeground), rgbaBuffer(defaultBackground), paletteEpoch >>> 0);
|
|
15819
15950
|
}
|
|
15820
15951
|
bufferGetCharPtr(buffer) {
|
|
15821
|
-
const
|
|
15822
|
-
if (!
|
|
15952
|
+
const ptr = this.opentui.symbols.bufferGetCharPtr(buffer);
|
|
15953
|
+
if (!ptr) {
|
|
15823
15954
|
throw new Error("Failed to get char pointer");
|
|
15824
15955
|
}
|
|
15825
|
-
return
|
|
15956
|
+
return ptr;
|
|
15826
15957
|
}
|
|
15827
15958
|
bufferGetFgPtr(buffer) {
|
|
15828
|
-
const
|
|
15829
|
-
if (!
|
|
15959
|
+
const ptr = this.opentui.symbols.bufferGetFgPtr(buffer);
|
|
15960
|
+
if (!ptr) {
|
|
15830
15961
|
throw new Error("Failed to get fg pointer");
|
|
15831
15962
|
}
|
|
15832
|
-
return
|
|
15963
|
+
return ptr;
|
|
15833
15964
|
}
|
|
15834
15965
|
bufferGetBgPtr(buffer) {
|
|
15835
|
-
const
|
|
15836
|
-
if (!
|
|
15966
|
+
const ptr = this.opentui.symbols.bufferGetBgPtr(buffer);
|
|
15967
|
+
if (!ptr) {
|
|
15837
15968
|
throw new Error("Failed to get bg pointer");
|
|
15838
15969
|
}
|
|
15839
|
-
return
|
|
15970
|
+
return ptr;
|
|
15840
15971
|
}
|
|
15841
15972
|
bufferGetAttributesPtr(buffer) {
|
|
15842
|
-
const
|
|
15843
|
-
if (!
|
|
15973
|
+
const ptr = this.opentui.symbols.bufferGetAttributesPtr(buffer);
|
|
15974
|
+
if (!ptr) {
|
|
15844
15975
|
throw new Error("Failed to get attributes pointer");
|
|
15845
15976
|
}
|
|
15846
|
-
return
|
|
15977
|
+
return ptr;
|
|
15847
15978
|
}
|
|
15848
15979
|
bufferGetRespectAlpha(buffer) {
|
|
15849
15980
|
return this.opentui.symbols.bufferGetRespectAlpha(buffer);
|
|
@@ -15874,25 +16005,25 @@ class FFIRenderLib {
|
|
|
15874
16005
|
}
|
|
15875
16006
|
bufferDrawText(buffer, text, x, y, color, bgColor, attributes) {
|
|
15876
16007
|
const textBytes = this.encoder.encode(text);
|
|
15877
|
-
const
|
|
15878
|
-
const
|
|
15879
|
-
this.opentui.symbols.bufferDrawText(buffer, viewOrNull(textBytes), textBytes.byteLength, x, y,
|
|
16008
|
+
const bg = optionalRgbaBuffer(bgColor);
|
|
16009
|
+
const fg = rgbaBuffer(color);
|
|
16010
|
+
this.opentui.symbols.bufferDrawText(buffer, viewOrNull(textBytes), textBytes.byteLength, x, y, fg, bg, attributes ?? 0);
|
|
15880
16011
|
}
|
|
15881
16012
|
bufferSetCellWithAlphaBlending(buffer, x, y, char, color, bgColor, attributes) {
|
|
15882
16013
|
const charPtr = char.codePointAt(0) ?? " ".codePointAt(0);
|
|
15883
|
-
const
|
|
15884
|
-
const
|
|
15885
|
-
this.opentui.symbols.bufferSetCellWithAlphaBlending(buffer, x, y, charPtr,
|
|
16014
|
+
const bg = rgbaBuffer(bgColor);
|
|
16015
|
+
const fg = rgbaBuffer(color);
|
|
16016
|
+
this.opentui.symbols.bufferSetCellWithAlphaBlending(buffer, x, y, charPtr, fg, bg, attributes ?? 0);
|
|
15886
16017
|
}
|
|
15887
16018
|
bufferSetCell(buffer, x, y, char, color, bgColor, attributes) {
|
|
15888
16019
|
const charPtr = char.codePointAt(0) ?? " ".codePointAt(0);
|
|
15889
|
-
const
|
|
15890
|
-
const
|
|
15891
|
-
this.opentui.symbols.bufferSetCell(buffer, x, y, charPtr,
|
|
16020
|
+
const bg = rgbaBuffer(bgColor);
|
|
16021
|
+
const fg = rgbaBuffer(color);
|
|
16022
|
+
this.opentui.symbols.bufferSetCell(buffer, x, y, charPtr, fg, bg, attributes ?? 0);
|
|
15892
16023
|
}
|
|
15893
16024
|
bufferFillRect(buffer, x, y, width, height, color) {
|
|
15894
|
-
const
|
|
15895
|
-
this.opentui.symbols.bufferFillRect(buffer, x, y, width, height,
|
|
16025
|
+
const bg = rgbaBuffer(color);
|
|
16026
|
+
this.opentui.symbols.bufferFillRect(buffer, x, y, width, height, bg);
|
|
15896
16027
|
}
|
|
15897
16028
|
bufferColorMatrix(buffer, matrix, cellMask, cellMaskCount, strength, target) {
|
|
15898
16029
|
this.opentui.symbols.bufferColorMatrix(buffer, matrix, cellMask, cellMaskCount, strength, target);
|
|
@@ -15920,20 +16051,20 @@ class FFIRenderLib {
|
|
|
15920
16051
|
sourceHeight,
|
|
15921
16052
|
protocol: protocolId
|
|
15922
16053
|
}, storage.view, 0);
|
|
15923
|
-
return Boolean(this.opentui.symbols.bufferDrawImage(buffer, image, storage.
|
|
16054
|
+
return Boolean(this.opentui.symbols.bufferDrawImage(buffer, image, storage.ffiView));
|
|
15924
16055
|
}
|
|
15925
16056
|
bufferDrawPackedBuffer(buffer, data, dataLen, posX, posY, terminalWidthCells, terminalHeightCells) {
|
|
15926
16057
|
this.opentui.symbols.bufferDrawPackedBuffer(buffer, data, dataLen, posX, posY, terminalWidthCells, terminalHeightCells);
|
|
15927
16058
|
}
|
|
15928
|
-
bufferDrawGrayscaleBuffer(buffer, posX, posY, intensities, srcWidth, srcHeight,
|
|
15929
|
-
this.opentui.symbols.bufferDrawGrayscaleBuffer(buffer, posX, posY, intensities, srcWidth, srcHeight, optionalRgbaBuffer(
|
|
16059
|
+
bufferDrawGrayscaleBuffer(buffer, posX, posY, intensities, srcWidth, srcHeight, fg, bg) {
|
|
16060
|
+
this.opentui.symbols.bufferDrawGrayscaleBuffer(buffer, posX, posY, intensities, srcWidth, srcHeight, optionalRgbaBuffer(fg), optionalRgbaBuffer(bg));
|
|
15930
16061
|
}
|
|
15931
|
-
bufferDrawGrayscaleBufferSupersampled(buffer, posX, posY, intensities, srcWidth, srcHeight,
|
|
15932
|
-
this.opentui.symbols.bufferDrawGrayscaleBufferSupersampled(buffer, posX, posY, intensities, srcWidth, srcHeight, optionalRgbaBuffer(
|
|
16062
|
+
bufferDrawGrayscaleBufferSupersampled(buffer, posX, posY, intensities, srcWidth, srcHeight, fg, bg) {
|
|
16063
|
+
this.opentui.symbols.bufferDrawGrayscaleBufferSupersampled(buffer, posX, posY, intensities, srcWidth, srcHeight, optionalRgbaBuffer(fg), optionalRgbaBuffer(bg));
|
|
15933
16064
|
}
|
|
15934
16065
|
bufferDrawGrid(buffer, borderChars, borderFg, borderBg, columnOffsets, columnCount, rowOffsets, rowCount, options) {
|
|
15935
16066
|
GridDrawOptionsStruct.packInto({ drawInner: options.drawInner, drawOuter: options.drawOuter }, this.ffiStructStorage.gridDrawOptions.view, 0);
|
|
15936
|
-
this.opentui.symbols.bufferDrawGrid(buffer, borderChars, rgbaBuffer(borderFg), rgbaBuffer(borderBg), columnOffsets, columnCount, rowOffsets, rowCount, this.ffiStructStorage.gridDrawOptions.
|
|
16067
|
+
this.opentui.symbols.bufferDrawGrid(buffer, borderChars, rgbaBuffer(borderFg), rgbaBuffer(borderBg), columnOffsets, columnCount, rowOffsets, rowCount, this.ffiStructStorage.gridDrawOptions.ffiView);
|
|
15937
16068
|
}
|
|
15938
16069
|
bufferDrawBox(buffer, x, y, width, height, borderChars, packedOptions, borderColor, backgroundColor, titleColor, title, bottomTitle) {
|
|
15939
16070
|
const titleBytes = title ? this.encoder.encode(title) : null;
|
|
@@ -15951,7 +16082,7 @@ class FFIRenderLib {
|
|
|
15951
16082
|
const urlBytes = this.encoder.encode(url);
|
|
15952
16083
|
return this.opentui.symbols.linkAlloc(viewOrNull(urlBytes), urlBytes.byteLength);
|
|
15953
16084
|
}
|
|
15954
|
-
linkGetUrl(linkId, maxLen =
|
|
16085
|
+
linkGetUrl(linkId, maxLen = MAX_LINK_URL_BYTES2) {
|
|
15955
16086
|
const outBuffer = new Uint8Array(maxLen);
|
|
15956
16087
|
const actualLen = this.opentui.symbols.linkGetUrl(linkId, viewOrNull(outBuffer), maxLen);
|
|
15957
16088
|
return this.decoder.decode(outBuffer.slice(0, actualLen));
|
|
@@ -15981,7 +16112,7 @@ class FFIRenderLib {
|
|
|
15981
16112
|
visible: struct.visible,
|
|
15982
16113
|
style: CURSOR_ID_TO_STYLE[struct.style] ?? "block",
|
|
15983
16114
|
blinking: struct.blinking,
|
|
15984
|
-
color:
|
|
16115
|
+
color: RGBA2.fromValues(struct.r, struct.g, struct.b, struct.a)
|
|
15985
16116
|
};
|
|
15986
16117
|
}
|
|
15987
16118
|
setCursorStyleOptions(renderer, options) {
|
|
@@ -16018,7 +16149,7 @@ class FFIRenderLib {
|
|
|
16018
16149
|
if (!bufferPtr) {
|
|
16019
16150
|
throw new Error(`Failed to create optimized buffer: ${width}x${height}`);
|
|
16020
16151
|
}
|
|
16021
|
-
return new
|
|
16152
|
+
return new OptimizedBuffer2(this, bufferPtr, width, height, { respectAlpha, id, widthMethod });
|
|
16022
16153
|
}
|
|
16023
16154
|
destroyOptimizedBuffer(bufferPtr) {
|
|
16024
16155
|
this.opentui.symbols.destroyOptimizedBuffer(bufferPtr);
|
|
@@ -16086,19 +16217,19 @@ class FFIRenderLib {
|
|
|
16086
16217
|
operation: output[0] === 0 ? null : output[0]
|
|
16087
16218
|
};
|
|
16088
16219
|
}
|
|
16089
|
-
clipboardReadOperationStart(service, request,
|
|
16220
|
+
clipboardReadOperationStart(service, request, selection, maxBytes, maxImagePixels, maxConversionBytes, timeoutMs) {
|
|
16090
16221
|
const output = new Uint32Array(1);
|
|
16091
|
-
const status = this.opentui.symbols.clipboardReadOperationStart(service, request, toSafeFFIU32Length(request.byteLength, "clipboard read request"),
|
|
16222
|
+
const status = this.opentui.symbols.clipboardReadOperationStart(service, request, toSafeFFIU32Length(request.byteLength, "clipboard read request"), selection, toSafeFFIU32Length(maxBytes, "clipboard read byte limit"), toSafeFFIU32Length(maxImagePixels, "clipboard image pixel limit"), toSafeFFIU32Length(maxConversionBytes, "clipboard conversion byte limit"), toSafeFFIU32Length(timeoutMs, "clipboard read timeout"), output);
|
|
16092
16223
|
return this.clipboardStartResult(status, output);
|
|
16093
16224
|
}
|
|
16094
|
-
clipboardWriteOperationStart(service, textUtf8,
|
|
16225
|
+
clipboardWriteOperationStart(service, textUtf8, selection, timeoutMs) {
|
|
16095
16226
|
const output = new Uint32Array(1);
|
|
16096
|
-
const status = this.opentui.symbols.clipboardWriteOperationStart(service, textUtf8, toSafeFFIU32Length(textUtf8.byteLength, "clipboard write text"),
|
|
16227
|
+
const status = this.opentui.symbols.clipboardWriteOperationStart(service, textUtf8, toSafeFFIU32Length(textUtf8.byteLength, "clipboard write text"), selection, toSafeFFIU32Length(timeoutMs, "clipboard write timeout"), output);
|
|
16097
16228
|
return this.clipboardStartResult(status, output);
|
|
16098
16229
|
}
|
|
16099
|
-
clipboardClearOperationStart(service,
|
|
16230
|
+
clipboardClearOperationStart(service, selection, timeoutMs) {
|
|
16100
16231
|
const output = new Uint32Array(1);
|
|
16101
|
-
const status = this.opentui.symbols.clipboardClearOperationStart(service,
|
|
16232
|
+
const status = this.opentui.symbols.clipboardClearOperationStart(service, selection, toSafeFFIU32Length(timeoutMs, "clipboard clear timeout"), output);
|
|
16102
16233
|
return this.clipboardStartResult(status, output);
|
|
16103
16234
|
}
|
|
16104
16235
|
clipboardOperationPoll(operation) {
|
|
@@ -16355,8 +16486,8 @@ class FFIRenderLib {
|
|
|
16355
16486
|
yogaNodeStyleGetFloat(node, kind) {
|
|
16356
16487
|
return this.opentui.symbols.yogaNodeStyleGetFloat(node, kind);
|
|
16357
16488
|
}
|
|
16358
|
-
yogaNodeStyleSetBorder(node, edge,
|
|
16359
|
-
this.opentui.symbols.yogaNodeStyleSetBorder(node, edge,
|
|
16489
|
+
yogaNodeStyleSetBorder(node, edge, border) {
|
|
16490
|
+
this.opentui.symbols.yogaNodeStyleSetBorder(node, edge, border);
|
|
16360
16491
|
}
|
|
16361
16492
|
yogaNodeStyleGetBorder(node, edge) {
|
|
16362
16493
|
return this.opentui.symbols.yogaNodeStyleGetBorder(node, edge);
|
|
@@ -16408,7 +16539,7 @@ class FFIRenderLib {
|
|
|
16408
16539
|
if (!bufferPtr) {
|
|
16409
16540
|
throw new Error(`Failed to create TextBuffer`);
|
|
16410
16541
|
}
|
|
16411
|
-
return new
|
|
16542
|
+
return new TextBuffer2(this, bufferPtr);
|
|
16412
16543
|
}
|
|
16413
16544
|
destroyTextBuffer(buffer) {
|
|
16414
16545
|
this.opentui.symbols.destroyTextBuffer(buffer);
|
|
@@ -16425,12 +16556,12 @@ class FFIRenderLib {
|
|
|
16425
16556
|
textBufferClear(buffer) {
|
|
16426
16557
|
this.opentui.symbols.textBufferClear(buffer);
|
|
16427
16558
|
}
|
|
16428
|
-
textBufferSetDefaultFg(buffer,
|
|
16429
|
-
const fgBuffer = optionalRgbaBuffer(
|
|
16559
|
+
textBufferSetDefaultFg(buffer, fg) {
|
|
16560
|
+
const fgBuffer = optionalRgbaBuffer(fg);
|
|
16430
16561
|
this.opentui.symbols.textBufferSetDefaultFg(buffer, fgBuffer);
|
|
16431
16562
|
}
|
|
16432
|
-
textBufferSetDefaultBg(buffer,
|
|
16433
|
-
const bgBuffer = optionalRgbaBuffer(
|
|
16563
|
+
textBufferSetDefaultBg(buffer, bg) {
|
|
16564
|
+
const bgBuffer = optionalRgbaBuffer(bg);
|
|
16434
16565
|
this.opentui.symbols.textBufferSetDefaultBg(buffer, bgBuffer);
|
|
16435
16566
|
}
|
|
16436
16567
|
textBufferSetDefaultAttributes(buffer, attributes) {
|
|
@@ -16468,8 +16599,8 @@ class FFIRenderLib {
|
|
|
16468
16599
|
textBufferAppendFromMemId(buffer, memId) {
|
|
16469
16600
|
this.opentui.symbols.textBufferAppendFromMemId(buffer, memId);
|
|
16470
16601
|
}
|
|
16471
|
-
textBufferLoadFile(buffer,
|
|
16472
|
-
const pathBytes = this.encoder.encode(
|
|
16602
|
+
textBufferLoadFile(buffer, path) {
|
|
16603
|
+
const pathBytes = this.encoder.encode(path);
|
|
16473
16604
|
return this.opentui.symbols.textBufferLoadFile(buffer, viewOrNull(pathBytes), pathBytes.byteLength);
|
|
16474
16605
|
}
|
|
16475
16606
|
textBufferSetStyledText(buffer, chunks) {
|
|
@@ -16523,39 +16654,39 @@ class FFIRenderLib {
|
|
|
16523
16654
|
this.opentui.symbols.destroyTextBufferView(view);
|
|
16524
16655
|
}
|
|
16525
16656
|
textBufferViewSetSelection(view, start, end, bgColor, fgColor) {
|
|
16526
|
-
const
|
|
16527
|
-
const
|
|
16528
|
-
this.opentui.symbols.textBufferViewSetSelection(view, start, end,
|
|
16657
|
+
const bg = optionalRgbaBuffer(bgColor);
|
|
16658
|
+
const fg = optionalRgbaBuffer(fgColor);
|
|
16659
|
+
this.opentui.symbols.textBufferViewSetSelection(view, start, end, bg, fg);
|
|
16529
16660
|
}
|
|
16530
16661
|
textBufferViewResetSelection(view) {
|
|
16531
16662
|
this.opentui.symbols.textBufferViewResetSelection(view);
|
|
16532
16663
|
}
|
|
16533
16664
|
textBufferViewGetSelection(view) {
|
|
16534
16665
|
const packedInfo = this.textBufferViewGetSelectionInfo(view);
|
|
16535
|
-
if (packedInfo ===
|
|
16666
|
+
if (packedInfo === 0xffffffffffffffffn) {
|
|
16536
16667
|
return null;
|
|
16537
16668
|
}
|
|
16538
16669
|
const start = Number(packedInfo >> 32n);
|
|
16539
|
-
const end = Number(packedInfo &
|
|
16670
|
+
const end = Number(packedInfo & 0xffffffffn);
|
|
16540
16671
|
return { start, end };
|
|
16541
16672
|
}
|
|
16542
16673
|
textBufferViewGetSelectionInfo(view) {
|
|
16543
16674
|
return this.opentui.symbols.textBufferViewGetSelectionInfo(view);
|
|
16544
16675
|
}
|
|
16545
16676
|
textBufferViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, behavior) {
|
|
16546
|
-
const
|
|
16547
|
-
const
|
|
16548
|
-
return Boolean(this.opentui.symbols.textBufferViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY,
|
|
16677
|
+
const bg = optionalRgbaBuffer(bgColor);
|
|
16678
|
+
const fg = optionalRgbaBuffer(fgColor);
|
|
16679
|
+
return Boolean(this.opentui.symbols.textBufferViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bg, fg, selectionBehaviorByte(behavior)));
|
|
16549
16680
|
}
|
|
16550
16681
|
textBufferViewUpdateSelection(view, end, bgColor, fgColor) {
|
|
16551
|
-
const
|
|
16552
|
-
const
|
|
16553
|
-
this.opentui.symbols.textBufferViewUpdateSelection(view, end,
|
|
16682
|
+
const bg = optionalRgbaBuffer(bgColor);
|
|
16683
|
+
const fg = optionalRgbaBuffer(fgColor);
|
|
16684
|
+
this.opentui.symbols.textBufferViewUpdateSelection(view, end, bg, fg);
|
|
16554
16685
|
}
|
|
16555
16686
|
textBufferViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, behavior) {
|
|
16556
|
-
const
|
|
16557
|
-
const
|
|
16558
|
-
return Boolean(this.opentui.symbols.textBufferViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY,
|
|
16687
|
+
const bg = optionalRgbaBuffer(bgColor);
|
|
16688
|
+
const fg = optionalRgbaBuffer(fgColor);
|
|
16689
|
+
return Boolean(this.opentui.symbols.textBufferViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bg, fg, selectionBehaviorByte(behavior)));
|
|
16559
16690
|
}
|
|
16560
16691
|
textBufferViewResetLocalSelection(view) {
|
|
16561
16692
|
this.opentui.symbols.textBufferViewResetLocalSelection(view);
|
|
@@ -16615,6 +16746,20 @@ class FFIRenderLib {
|
|
|
16615
16746
|
textBufferViewGetVirtualLineCount(view) {
|
|
16616
16747
|
return this.opentui.symbols.textBufferViewGetVirtualLineCount(view);
|
|
16617
16748
|
}
|
|
16749
|
+
textBufferViewGetLineSources(view, startLine, lineCount) {
|
|
16750
|
+
toSafeFFIU32Length(startLine, "visual row start");
|
|
16751
|
+
toSafeFFIU32Length(lineCount, "visual row count");
|
|
16752
|
+
if (lineCount === 0)
|
|
16753
|
+
return [];
|
|
16754
|
+
const outBuffer = new ArrayBuffer(LineInfoStruct.size);
|
|
16755
|
+
this.textBufferViewGetLogicalLineInfoDirect(view, outBuffer);
|
|
16756
|
+
const data = new DataView(outBuffer);
|
|
16757
|
+
const sources = LineInfoStruct.arrayFields.get("sources");
|
|
16758
|
+
const count = Math.max(0, Math.min(lineCount, data.getUint32(sources.lengthOffset, true) - startLine));
|
|
16759
|
+
if (count === 0)
|
|
16760
|
+
return [];
|
|
16761
|
+
return Array.from(new Uint32Array(toArrayBuffer(toPointer(data.getBigUint64(sources.arrayOffset, true)), startLine * 4, count * 4)));
|
|
16762
|
+
}
|
|
16618
16763
|
textBufferViewGetLineInfoDirect(view, outBuffer) {
|
|
16619
16764
|
this.opentui.symbols.textBufferViewGetLineInfoDirect(view, outBuffer);
|
|
16620
16765
|
}
|
|
@@ -16654,7 +16799,7 @@ class FFIRenderLib {
|
|
|
16654
16799
|
}
|
|
16655
16800
|
textBufferViewMeasureForDimensions(view, width, height) {
|
|
16656
16801
|
const storage = this.ffiStructStorage.measureResult;
|
|
16657
|
-
const success = this.opentui.symbols.textBufferViewMeasureForDimensions(view, width, height, storage.
|
|
16802
|
+
const success = this.opentui.symbols.textBufferViewMeasureForDimensions(view, width, height, storage.ffiView);
|
|
16658
16803
|
if (!success)
|
|
16659
16804
|
return null;
|
|
16660
16805
|
const result = MeasureResultStruct.unpackInto(storage.view, storage.result);
|
|
@@ -16884,7 +17029,7 @@ class FFIRenderLib {
|
|
|
16884
17029
|
}
|
|
16885
17030
|
editBufferGetCursorPosition(buffer) {
|
|
16886
17031
|
const storage = this.ffiStructStorage.logicalCursor;
|
|
16887
|
-
this.opentui.symbols.editBufferGetCursorPosition(buffer, storage.
|
|
17032
|
+
this.opentui.symbols.editBufferGetCursorPosition(buffer, storage.ffiView);
|
|
16888
17033
|
const cursor = LogicalCursorStruct.unpackInto(storage.view, storage.result);
|
|
16889
17034
|
return { row: cursor.row, col: cursor.col, offset: cursor.offset };
|
|
16890
17035
|
}
|
|
@@ -16934,25 +17079,25 @@ class FFIRenderLib {
|
|
|
16934
17079
|
}
|
|
16935
17080
|
editBufferGetNextWordBoundary(buffer) {
|
|
16936
17081
|
const storage = this.ffiStructStorage.logicalCursor;
|
|
16937
|
-
this.opentui.symbols.editBufferGetNextWordBoundary(buffer, storage.
|
|
17082
|
+
this.opentui.symbols.editBufferGetNextWordBoundary(buffer, storage.ffiView);
|
|
16938
17083
|
const cursor = LogicalCursorStruct.unpackInto(storage.view, storage.result);
|
|
16939
17084
|
return { row: cursor.row, col: cursor.col, offset: cursor.offset };
|
|
16940
17085
|
}
|
|
16941
17086
|
editBufferGetPrevWordBoundary(buffer) {
|
|
16942
17087
|
const storage = this.ffiStructStorage.logicalCursor;
|
|
16943
|
-
this.opentui.symbols.editBufferGetPrevWordBoundary(buffer, storage.
|
|
17088
|
+
this.opentui.symbols.editBufferGetPrevWordBoundary(buffer, storage.ffiView);
|
|
16944
17089
|
const cursor = LogicalCursorStruct.unpackInto(storage.view, storage.result);
|
|
16945
17090
|
return { row: cursor.row, col: cursor.col, offset: cursor.offset };
|
|
16946
17091
|
}
|
|
16947
17092
|
editBufferGetEOL(buffer) {
|
|
16948
17093
|
const storage = this.ffiStructStorage.logicalCursor;
|
|
16949
|
-
this.opentui.symbols.editBufferGetEOL(buffer, storage.
|
|
17094
|
+
this.opentui.symbols.editBufferGetEOL(buffer, storage.ffiView);
|
|
16950
17095
|
const cursor = LogicalCursorStruct.unpackInto(storage.view, storage.result);
|
|
16951
17096
|
return { row: cursor.row, col: cursor.col, offset: cursor.offset };
|
|
16952
17097
|
}
|
|
16953
17098
|
editBufferOffsetToPosition(buffer, offset) {
|
|
16954
17099
|
const storage = this.ffiStructStorage.logicalCursor;
|
|
16955
|
-
const success = this.opentui.symbols.editBufferOffsetToPosition(buffer, offset, storage.
|
|
17100
|
+
const success = this.opentui.symbols.editBufferOffsetToPosition(buffer, offset, storage.ffiView);
|
|
16956
17101
|
if (!success)
|
|
16957
17102
|
return null;
|
|
16958
17103
|
const cursor = LogicalCursorStruct.unpackInto(storage.view, storage.result);
|
|
@@ -16981,36 +17126,36 @@ class FFIRenderLib {
|
|
|
16981
17126
|
return usesBunFFI ? outBuffer.slice(0, len) : trimNodeFFIOutputBytes(outBuffer, len);
|
|
16982
17127
|
}
|
|
16983
17128
|
editorViewSetSelection(view, start, end, bgColor, fgColor) {
|
|
16984
|
-
const
|
|
16985
|
-
const
|
|
16986
|
-
this.opentui.symbols.editorViewSetSelection(view, start, end,
|
|
17129
|
+
const bg = optionalRgbaBuffer(bgColor);
|
|
17130
|
+
const fg = optionalRgbaBuffer(fgColor);
|
|
17131
|
+
this.opentui.symbols.editorViewSetSelection(view, start, end, bg, fg);
|
|
16987
17132
|
}
|
|
16988
17133
|
editorViewResetSelection(view) {
|
|
16989
17134
|
this.opentui.symbols.editorViewResetSelection(view);
|
|
16990
17135
|
}
|
|
16991
17136
|
editorViewGetSelection(view) {
|
|
16992
17137
|
const packedInfo = this.opentui.symbols.editorViewGetSelection(view);
|
|
16993
|
-
if (packedInfo ===
|
|
17138
|
+
if (packedInfo === 0xffffffffffffffffn) {
|
|
16994
17139
|
return null;
|
|
16995
17140
|
}
|
|
16996
17141
|
const start = Number(packedInfo >> 32n);
|
|
16997
|
-
const end = Number(packedInfo &
|
|
17142
|
+
const end = Number(packedInfo & 0xffffffffn);
|
|
16998
17143
|
return { start, end };
|
|
16999
17144
|
}
|
|
17000
17145
|
editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, updateCursor, followCursor, behavior) {
|
|
17001
|
-
const
|
|
17002
|
-
const
|
|
17003
|
-
return Boolean(this.opentui.symbols.editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY,
|
|
17146
|
+
const bg = optionalRgbaBuffer(bgColor);
|
|
17147
|
+
const fg = optionalRgbaBuffer(fgColor);
|
|
17148
|
+
return Boolean(this.opentui.symbols.editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bg, fg, editorLocalSelectionFlags(updateCursor, followCursor, behavior)));
|
|
17004
17149
|
}
|
|
17005
17150
|
editorViewUpdateSelection(view, end, bgColor, fgColor) {
|
|
17006
|
-
const
|
|
17007
|
-
const
|
|
17008
|
-
this.opentui.symbols.editorViewUpdateSelection(view, end,
|
|
17151
|
+
const bg = optionalRgbaBuffer(bgColor);
|
|
17152
|
+
const fg = optionalRgbaBuffer(fgColor);
|
|
17153
|
+
this.opentui.symbols.editorViewUpdateSelection(view, end, bg, fg);
|
|
17009
17154
|
}
|
|
17010
17155
|
editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, updateCursor, followCursor, behavior) {
|
|
17011
|
-
const
|
|
17012
|
-
const
|
|
17013
|
-
return Boolean(this.opentui.symbols.editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY,
|
|
17156
|
+
const bg = optionalRgbaBuffer(bgColor);
|
|
17157
|
+
const fg = optionalRgbaBuffer(fgColor);
|
|
17158
|
+
return Boolean(this.opentui.symbols.editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bg, fg, editorLocalSelectionFlags(updateCursor, followCursor, behavior)));
|
|
17014
17159
|
}
|
|
17015
17160
|
editorViewResetLocalSelection(view) {
|
|
17016
17161
|
this.opentui.symbols.editorViewResetLocalSelection(view);
|
|
@@ -17022,14 +17167,14 @@ class FFIRenderLib {
|
|
|
17022
17167
|
this.opentui.symbols.editorViewSetSelectionOccupancy(view, occupancy === "boundary" ? 1 : 0);
|
|
17023
17168
|
}
|
|
17024
17169
|
editorViewSetSelectionInclusive(view, start, end, bgColor, fgColor) {
|
|
17025
|
-
const
|
|
17026
|
-
const
|
|
17027
|
-
this.opentui.symbols.editorViewSetSelectionInclusive(view, start, end,
|
|
17170
|
+
const bg = optionalRgbaBuffer(bgColor);
|
|
17171
|
+
const fg = optionalRgbaBuffer(fgColor);
|
|
17172
|
+
this.opentui.symbols.editorViewSetSelectionInclusive(view, start, end, bg, fg);
|
|
17028
17173
|
}
|
|
17029
17174
|
editorViewSetSelectionColors(view, bgColor, fgColor) {
|
|
17030
|
-
const
|
|
17031
|
-
const
|
|
17032
|
-
this.opentui.symbols.editorViewSetSelectionColors(view,
|
|
17175
|
+
const bg = optionalRgbaBuffer(bgColor);
|
|
17176
|
+
const fg = optionalRgbaBuffer(fgColor);
|
|
17177
|
+
this.opentui.symbols.editorViewSetSelectionColors(view, bg, fg);
|
|
17033
17178
|
}
|
|
17034
17179
|
editorViewGetSelectedTextBytes(view, maxLength) {
|
|
17035
17180
|
const outBuffer = new Uint8Array(maxLength);
|
|
@@ -17055,7 +17200,7 @@ class FFIRenderLib {
|
|
|
17055
17200
|
}
|
|
17056
17201
|
editorViewGetVisualCursor(view) {
|
|
17057
17202
|
const storage = this.ffiStructStorage.visualCursor;
|
|
17058
|
-
this.opentui.symbols.editorViewGetVisualCursor(view, storage.
|
|
17203
|
+
this.opentui.symbols.editorViewGetVisualCursor(view, storage.ffiView);
|
|
17059
17204
|
const cursor = VisualCursorStruct.unpackInto(storage.view, storage.result);
|
|
17060
17205
|
return { ...cursor };
|
|
17061
17206
|
}
|
|
@@ -17073,31 +17218,31 @@ class FFIRenderLib {
|
|
|
17073
17218
|
}
|
|
17074
17219
|
editorViewGetNextWordBoundary(view) {
|
|
17075
17220
|
const storage = this.ffiStructStorage.visualCursor;
|
|
17076
|
-
this.opentui.symbols.editorViewGetNextWordBoundary(view, storage.
|
|
17221
|
+
this.opentui.symbols.editorViewGetNextWordBoundary(view, storage.ffiView);
|
|
17077
17222
|
const cursor = VisualCursorStruct.unpackInto(storage.view, storage.result);
|
|
17078
17223
|
return { ...cursor };
|
|
17079
17224
|
}
|
|
17080
17225
|
editorViewGetPrevWordBoundary(view) {
|
|
17081
17226
|
const storage = this.ffiStructStorage.visualCursor;
|
|
17082
|
-
this.opentui.symbols.editorViewGetPrevWordBoundary(view, storage.
|
|
17227
|
+
this.opentui.symbols.editorViewGetPrevWordBoundary(view, storage.ffiView);
|
|
17083
17228
|
const cursor = VisualCursorStruct.unpackInto(storage.view, storage.result);
|
|
17084
17229
|
return { ...cursor };
|
|
17085
17230
|
}
|
|
17086
17231
|
editorViewGetEOL(view) {
|
|
17087
17232
|
const storage = this.ffiStructStorage.visualCursor;
|
|
17088
|
-
this.opentui.symbols.editorViewGetEOL(view, storage.
|
|
17233
|
+
this.opentui.symbols.editorViewGetEOL(view, storage.ffiView);
|
|
17089
17234
|
const cursor = VisualCursorStruct.unpackInto(storage.view, storage.result);
|
|
17090
17235
|
return { ...cursor };
|
|
17091
17236
|
}
|
|
17092
17237
|
editorViewGetVisualSOL(view) {
|
|
17093
17238
|
const storage = this.ffiStructStorage.visualCursor;
|
|
17094
|
-
this.opentui.symbols.editorViewGetVisualSOL(view, storage.
|
|
17239
|
+
this.opentui.symbols.editorViewGetVisualSOL(view, storage.ffiView);
|
|
17095
17240
|
const cursor = VisualCursorStruct.unpackInto(storage.view, storage.result);
|
|
17096
17241
|
return { ...cursor };
|
|
17097
17242
|
}
|
|
17098
17243
|
editorViewGetVisualEOL(view) {
|
|
17099
17244
|
const storage = this.ffiStructStorage.visualCursor;
|
|
17100
|
-
this.opentui.symbols.editorViewGetVisualEOL(view, storage.
|
|
17245
|
+
this.opentui.symbols.editorViewGetVisualEOL(view, storage.ffiView);
|
|
17101
17246
|
const cursor = VisualCursorStruct.unpackInto(storage.view, storage.result);
|
|
17102
17247
|
return { ...cursor };
|
|
17103
17248
|
}
|
|
@@ -17203,8 +17348,8 @@ class FFIRenderLib {
|
|
|
17203
17348
|
freeUnicode(encoded) {
|
|
17204
17349
|
this.opentui.symbols.freeUnicode(encoded.ptr, encoded.data.length);
|
|
17205
17350
|
}
|
|
17206
|
-
bufferDrawChar(buffer, char, x, y,
|
|
17207
|
-
this.opentui.symbols.bufferDrawChar(buffer, char, x, y, rgbaBuffer(
|
|
17351
|
+
bufferDrawChar(buffer, char, x, y, fg, bg, attributes = 0) {
|
|
17352
|
+
this.opentui.symbols.bufferDrawChar(buffer, char, x, y, rgbaBuffer(fg), rgbaBuffer(bg), attributes);
|
|
17208
17353
|
}
|
|
17209
17354
|
createAudioEngine(options) {
|
|
17210
17355
|
const optionsBuffer = options == null ? null : AudioCreateOptionsStruct.pack(options);
|
|
@@ -17321,15 +17466,15 @@ class FFIRenderLib {
|
|
|
17321
17466
|
return this.opentui.symbols.audioStop(engine);
|
|
17322
17467
|
}
|
|
17323
17468
|
audioCreateStream(engine, options) {
|
|
17324
|
-
if (!isFFIU32(options.groupId) || options.
|
|
17469
|
+
if (!isFFIU32(options.groupId) || !isFFIU32(options.sampleRate ?? 0) || !isFFIU32(options.channels ?? 0) || !Object.values(NativeAudioStreamFormat3).includes(options.format)) {
|
|
17325
17470
|
return { status: -1, streamId: null };
|
|
17326
17471
|
}
|
|
17327
|
-
const optionsBuffer = AudioStreamCreateOptionsStruct.pack(options);
|
|
17328
|
-
const outBuffer = new
|
|
17472
|
+
const optionsBuffer = new Uint8Array(AudioStreamCreateOptionsStruct.pack(options));
|
|
17473
|
+
const outBuffer = new Uint32Array(1);
|
|
17329
17474
|
const status = this.opentui.symbols.audioCreateStream(engine, optionsBuffer, outBuffer);
|
|
17330
17475
|
if (status !== 0)
|
|
17331
17476
|
return { status, streamId: null };
|
|
17332
|
-
return { status, streamId:
|
|
17477
|
+
return { status, streamId: outBuffer[0] ?? null };
|
|
17333
17478
|
}
|
|
17334
17479
|
audioWriteStream(engine, streamId, data) {
|
|
17335
17480
|
const dataLength = toSafeFFIU32Length(data.byteLength, "Audio stream data length");
|
|
@@ -17354,7 +17499,7 @@ class FFIRenderLib {
|
|
|
17354
17499
|
}
|
|
17355
17500
|
audioGetStreamStats(engine, streamId) {
|
|
17356
17501
|
const storage = this.ffiStructStorage.audioStreamStats;
|
|
17357
|
-
const status = this.opentui.symbols.audioGetStreamStats(engine, streamId, storage.
|
|
17502
|
+
const status = this.opentui.symbols.audioGetStreamStats(engine, streamId, storage.ffiView);
|
|
17358
17503
|
if (status !== 0)
|
|
17359
17504
|
return null;
|
|
17360
17505
|
const stats = AudioStreamStatsStruct.unpackInto(storage.view, storage.result);
|
|
@@ -17362,7 +17507,7 @@ class FFIRenderLib {
|
|
|
17362
17507
|
}
|
|
17363
17508
|
audioCloseStream(engine, streamId, reason) {
|
|
17364
17509
|
const storage = this.ffiStructStorage.audioStreamStats;
|
|
17365
|
-
const status = this.opentui.symbols.audioCloseStream(engine, streamId, reason, storage.
|
|
17510
|
+
const status = this.opentui.symbols.audioCloseStream(engine, streamId, reason, storage.ffiView);
|
|
17366
17511
|
if (status !== 0)
|
|
17367
17512
|
return { status, stats: null };
|
|
17368
17513
|
const stats = AudioStreamStatsStruct.unpackInto(storage.view, storage.result);
|
|
@@ -17526,10 +17671,10 @@ class FFIRenderLib {
|
|
|
17526
17671
|
destroySyntaxStyle(style) {
|
|
17527
17672
|
this.opentui.symbols.destroySyntaxStyle(style);
|
|
17528
17673
|
}
|
|
17529
|
-
syntaxStyleRegister(style, name,
|
|
17674
|
+
syntaxStyleRegister(style, name, fg, bg, attributes) {
|
|
17530
17675
|
const nameBytes = this.encoder.encode(name);
|
|
17531
|
-
const fgBuffer = optionalRgbaBuffer(
|
|
17532
|
-
const bgBuffer = optionalRgbaBuffer(
|
|
17676
|
+
const fgBuffer = optionalRgbaBuffer(fg);
|
|
17677
|
+
const bgBuffer = optionalRgbaBuffer(bg);
|
|
17533
17678
|
return this.opentui.symbols.syntaxStyleRegister(style, viewOrNull(nameBytes), nameBytes.byteLength, fgBuffer, bgBuffer, attributes);
|
|
17534
17679
|
}
|
|
17535
17680
|
syntaxStyleResolveByName(style, name) {
|
|
@@ -17658,7 +17803,7 @@ class FFIRenderLib {
|
|
|
17658
17803
|
var opentuiLibPath;
|
|
17659
17804
|
var opentuiLib;
|
|
17660
17805
|
var renderLibResolved = false;
|
|
17661
|
-
function
|
|
17806
|
+
function setRenderLibPath2(libPath) {
|
|
17662
17807
|
if (opentuiLibPath !== libPath) {
|
|
17663
17808
|
if (renderLibResolved) {
|
|
17664
17809
|
throw new Error("setRenderLibPath() must be called before resolveRenderLib()");
|
|
@@ -17670,7 +17815,7 @@ function setRenderLibPath(libPath) {
|
|
|
17670
17815
|
opentuiLib = undefined;
|
|
17671
17816
|
}
|
|
17672
17817
|
}
|
|
17673
|
-
function
|
|
17818
|
+
function resolveRenderLib2() {
|
|
17674
17819
|
if (!opentuiLib) {
|
|
17675
17820
|
try {
|
|
17676
17821
|
opentuiLib = new FFIRenderLib(opentuiLibPath);
|
|
@@ -17686,204 +17831,204 @@ try {
|
|
|
17686
17831
|
} catch (error) {}
|
|
17687
17832
|
|
|
17688
17833
|
// src/yoga.ts
|
|
17689
|
-
var
|
|
17690
|
-
((
|
|
17691
|
-
|
|
17692
|
-
|
|
17693
|
-
|
|
17694
|
-
|
|
17695
|
-
|
|
17696
|
-
|
|
17697
|
-
|
|
17698
|
-
|
|
17699
|
-
|
|
17700
|
-
})(
|
|
17701
|
-
var
|
|
17702
|
-
((
|
|
17703
|
-
|
|
17704
|
-
|
|
17705
|
-
})(
|
|
17706
|
-
var
|
|
17707
|
-
((
|
|
17708
|
-
|
|
17709
|
-
|
|
17710
|
-
})(
|
|
17711
|
-
var
|
|
17712
|
-
((
|
|
17713
|
-
|
|
17714
|
-
|
|
17715
|
-
|
|
17716
|
-
})(
|
|
17717
|
-
var
|
|
17718
|
-
((
|
|
17719
|
-
|
|
17720
|
-
|
|
17721
|
-
|
|
17722
|
-
})(
|
|
17723
|
-
var
|
|
17724
|
-
((
|
|
17725
|
-
|
|
17726
|
-
|
|
17727
|
-
|
|
17728
|
-
|
|
17729
|
-
|
|
17730
|
-
|
|
17731
|
-
|
|
17732
|
-
|
|
17733
|
-
|
|
17734
|
-
})(
|
|
17735
|
-
var
|
|
17736
|
-
((
|
|
17737
|
-
|
|
17738
|
-
|
|
17739
|
-
|
|
17740
|
-
|
|
17741
|
-
|
|
17742
|
-
|
|
17743
|
-
})(
|
|
17744
|
-
var
|
|
17745
|
-
((
|
|
17746
|
-
|
|
17747
|
-
})(
|
|
17748
|
-
var
|
|
17749
|
-
((
|
|
17750
|
-
|
|
17751
|
-
|
|
17752
|
-
|
|
17753
|
-
|
|
17754
|
-
})(
|
|
17755
|
-
var
|
|
17756
|
-
((
|
|
17757
|
-
|
|
17758
|
-
|
|
17759
|
-
|
|
17760
|
-
})(
|
|
17761
|
-
var
|
|
17762
|
-
((
|
|
17763
|
-
|
|
17764
|
-
|
|
17765
|
-
|
|
17766
|
-
|
|
17767
|
-
|
|
17768
|
-
|
|
17769
|
-
})(
|
|
17770
|
-
var
|
|
17771
|
-
((
|
|
17772
|
-
|
|
17773
|
-
|
|
17774
|
-
|
|
17775
|
-
|
|
17776
|
-
|
|
17777
|
-
|
|
17778
|
-
})(
|
|
17779
|
-
var
|
|
17780
|
-
((
|
|
17781
|
-
|
|
17782
|
-
|
|
17783
|
-
|
|
17784
|
-
})(
|
|
17785
|
-
var
|
|
17786
|
-
((
|
|
17787
|
-
|
|
17788
|
-
|
|
17789
|
-
})(
|
|
17790
|
-
var
|
|
17791
|
-
((
|
|
17792
|
-
|
|
17793
|
-
|
|
17794
|
-
|
|
17795
|
-
})(
|
|
17796
|
-
var
|
|
17797
|
-
((
|
|
17798
|
-
|
|
17799
|
-
|
|
17800
|
-
|
|
17801
|
-
})(
|
|
17802
|
-
var
|
|
17803
|
-
((
|
|
17804
|
-
|
|
17805
|
-
|
|
17806
|
-
|
|
17807
|
-
|
|
17808
|
-
})(
|
|
17809
|
-
var
|
|
17834
|
+
var Align2;
|
|
17835
|
+
((Align) => {
|
|
17836
|
+
Align[Align["Auto"] = 0] = "Auto";
|
|
17837
|
+
Align[Align["FlexStart"] = 1] = "FlexStart";
|
|
17838
|
+
Align[Align["Center"] = 2] = "Center";
|
|
17839
|
+
Align[Align["FlexEnd"] = 3] = "FlexEnd";
|
|
17840
|
+
Align[Align["Stretch"] = 4] = "Stretch";
|
|
17841
|
+
Align[Align["Baseline"] = 5] = "Baseline";
|
|
17842
|
+
Align[Align["SpaceBetween"] = 6] = "SpaceBetween";
|
|
17843
|
+
Align[Align["SpaceAround"] = 7] = "SpaceAround";
|
|
17844
|
+
Align[Align["SpaceEvenly"] = 8] = "SpaceEvenly";
|
|
17845
|
+
})(Align2 ||= {});
|
|
17846
|
+
var BoxSizing2;
|
|
17847
|
+
((BoxSizing) => {
|
|
17848
|
+
BoxSizing[BoxSizing["BorderBox"] = 0] = "BorderBox";
|
|
17849
|
+
BoxSizing[BoxSizing["ContentBox"] = 1] = "ContentBox";
|
|
17850
|
+
})(BoxSizing2 ||= {});
|
|
17851
|
+
var Dimension2;
|
|
17852
|
+
((Dimension) => {
|
|
17853
|
+
Dimension[Dimension["Width"] = 0] = "Width";
|
|
17854
|
+
Dimension[Dimension["Height"] = 1] = "Height";
|
|
17855
|
+
})(Dimension2 ||= {});
|
|
17856
|
+
var Direction2;
|
|
17857
|
+
((Direction) => {
|
|
17858
|
+
Direction[Direction["Inherit"] = 0] = "Inherit";
|
|
17859
|
+
Direction[Direction["LTR"] = 1] = "LTR";
|
|
17860
|
+
Direction[Direction["RTL"] = 2] = "RTL";
|
|
17861
|
+
})(Direction2 ||= {});
|
|
17862
|
+
var Display2;
|
|
17863
|
+
((Display) => {
|
|
17864
|
+
Display[Display["Flex"] = 0] = "Flex";
|
|
17865
|
+
Display[Display["None"] = 1] = "None";
|
|
17866
|
+
Display[Display["Contents"] = 2] = "Contents";
|
|
17867
|
+
})(Display2 ||= {});
|
|
17868
|
+
var Edge2;
|
|
17869
|
+
((Edge) => {
|
|
17870
|
+
Edge[Edge["Left"] = 0] = "Left";
|
|
17871
|
+
Edge[Edge["Top"] = 1] = "Top";
|
|
17872
|
+
Edge[Edge["Right"] = 2] = "Right";
|
|
17873
|
+
Edge[Edge["Bottom"] = 3] = "Bottom";
|
|
17874
|
+
Edge[Edge["Start"] = 4] = "Start";
|
|
17875
|
+
Edge[Edge["End"] = 5] = "End";
|
|
17876
|
+
Edge[Edge["Horizontal"] = 6] = "Horizontal";
|
|
17877
|
+
Edge[Edge["Vertical"] = 7] = "Vertical";
|
|
17878
|
+
Edge[Edge["All"] = 8] = "All";
|
|
17879
|
+
})(Edge2 ||= {});
|
|
17880
|
+
var Errata2;
|
|
17881
|
+
((Errata) => {
|
|
17882
|
+
Errata[Errata["None"] = 0] = "None";
|
|
17883
|
+
Errata[Errata["StretchFlexBasis"] = 1] = "StretchFlexBasis";
|
|
17884
|
+
Errata[Errata["AbsolutePositionWithoutInsetsExcludesPadding"] = 2] = "AbsolutePositionWithoutInsetsExcludesPadding";
|
|
17885
|
+
Errata[Errata["AbsolutePercentAgainstInnerSize"] = 4] = "AbsolutePercentAgainstInnerSize";
|
|
17886
|
+
Errata[Errata["All"] = 2147483647] = "All";
|
|
17887
|
+
Errata[Errata["Classic"] = 2147483646] = "Classic";
|
|
17888
|
+
})(Errata2 ||= {});
|
|
17889
|
+
var ExperimentalFeature2;
|
|
17890
|
+
((ExperimentalFeature) => {
|
|
17891
|
+
ExperimentalFeature[ExperimentalFeature["WebFlexBasis"] = 0] = "WebFlexBasis";
|
|
17892
|
+
})(ExperimentalFeature2 ||= {});
|
|
17893
|
+
var FlexDirection2;
|
|
17894
|
+
((FlexDirection) => {
|
|
17895
|
+
FlexDirection[FlexDirection["Column"] = 0] = "Column";
|
|
17896
|
+
FlexDirection[FlexDirection["ColumnReverse"] = 1] = "ColumnReverse";
|
|
17897
|
+
FlexDirection[FlexDirection["Row"] = 2] = "Row";
|
|
17898
|
+
FlexDirection[FlexDirection["RowReverse"] = 3] = "RowReverse";
|
|
17899
|
+
})(FlexDirection2 ||= {});
|
|
17900
|
+
var Gutter2;
|
|
17901
|
+
((Gutter) => {
|
|
17902
|
+
Gutter[Gutter["Column"] = 0] = "Column";
|
|
17903
|
+
Gutter[Gutter["Row"] = 1] = "Row";
|
|
17904
|
+
Gutter[Gutter["All"] = 2] = "All";
|
|
17905
|
+
})(Gutter2 ||= {});
|
|
17906
|
+
var Justify2;
|
|
17907
|
+
((Justify) => {
|
|
17908
|
+
Justify[Justify["FlexStart"] = 0] = "FlexStart";
|
|
17909
|
+
Justify[Justify["Center"] = 1] = "Center";
|
|
17910
|
+
Justify[Justify["FlexEnd"] = 2] = "FlexEnd";
|
|
17911
|
+
Justify[Justify["SpaceBetween"] = 3] = "SpaceBetween";
|
|
17912
|
+
Justify[Justify["SpaceAround"] = 4] = "SpaceAround";
|
|
17913
|
+
Justify[Justify["SpaceEvenly"] = 5] = "SpaceEvenly";
|
|
17914
|
+
})(Justify2 ||= {});
|
|
17915
|
+
var LogLevel3;
|
|
17916
|
+
((LogLevel) => {
|
|
17917
|
+
LogLevel[LogLevel["Error"] = 0] = "Error";
|
|
17918
|
+
LogLevel[LogLevel["Warn"] = 1] = "Warn";
|
|
17919
|
+
LogLevel[LogLevel["Info"] = 2] = "Info";
|
|
17920
|
+
LogLevel[LogLevel["Debug"] = 3] = "Debug";
|
|
17921
|
+
LogLevel[LogLevel["Verbose"] = 4] = "Verbose";
|
|
17922
|
+
LogLevel[LogLevel["Fatal"] = 5] = "Fatal";
|
|
17923
|
+
})(LogLevel3 ||= {});
|
|
17924
|
+
var MeasureMode2;
|
|
17925
|
+
((MeasureMode) => {
|
|
17926
|
+
MeasureMode[MeasureMode["Undefined"] = 0] = "Undefined";
|
|
17927
|
+
MeasureMode[MeasureMode["Exactly"] = 1] = "Exactly";
|
|
17928
|
+
MeasureMode[MeasureMode["AtMost"] = 2] = "AtMost";
|
|
17929
|
+
})(MeasureMode2 ||= {});
|
|
17930
|
+
var NodeType2;
|
|
17931
|
+
((NodeType) => {
|
|
17932
|
+
NodeType[NodeType["Default"] = 0] = "Default";
|
|
17933
|
+
NodeType[NodeType["Text"] = 1] = "Text";
|
|
17934
|
+
})(NodeType2 ||= {});
|
|
17935
|
+
var Overflow2;
|
|
17936
|
+
((Overflow) => {
|
|
17937
|
+
Overflow[Overflow["Visible"] = 0] = "Visible";
|
|
17938
|
+
Overflow[Overflow["Hidden"] = 1] = "Hidden";
|
|
17939
|
+
Overflow[Overflow["Scroll"] = 2] = "Scroll";
|
|
17940
|
+
})(Overflow2 ||= {});
|
|
17941
|
+
var PositionType2;
|
|
17942
|
+
((PositionType) => {
|
|
17943
|
+
PositionType[PositionType["Static"] = 0] = "Static";
|
|
17944
|
+
PositionType[PositionType["Relative"] = 1] = "Relative";
|
|
17945
|
+
PositionType[PositionType["Absolute"] = 2] = "Absolute";
|
|
17946
|
+
})(PositionType2 ||= {});
|
|
17947
|
+
var Unit2;
|
|
17948
|
+
((Unit) => {
|
|
17949
|
+
Unit[Unit["Undefined"] = 0] = "Undefined";
|
|
17950
|
+
Unit[Unit["Point"] = 1] = "Point";
|
|
17951
|
+
Unit[Unit["Percent"] = 2] = "Percent";
|
|
17952
|
+
Unit[Unit["Auto"] = 3] = "Auto";
|
|
17953
|
+
})(Unit2 ||= {});
|
|
17954
|
+
var Wrap2;
|
|
17810
17955
|
((_Wrap) => {
|
|
17811
17956
|
_Wrap[_Wrap["NoWrap"] = 0] = "NoWrap";
|
|
17812
17957
|
_Wrap[_Wrap["Wrap"] = 1] = "Wrap";
|
|
17813
17958
|
_Wrap[_Wrap["WrapReverse"] = 2] = "WrapReverse";
|
|
17814
|
-
})(
|
|
17815
|
-
var
|
|
17816
|
-
var
|
|
17817
|
-
var
|
|
17818
|
-
var
|
|
17819
|
-
var
|
|
17820
|
-
var
|
|
17821
|
-
var
|
|
17822
|
-
var
|
|
17823
|
-
var
|
|
17824
|
-
var
|
|
17825
|
-
var
|
|
17826
|
-
var
|
|
17827
|
-
var
|
|
17828
|
-
var
|
|
17829
|
-
var
|
|
17830
|
-
var
|
|
17831
|
-
var
|
|
17832
|
-
var
|
|
17833
|
-
var
|
|
17834
|
-
var
|
|
17835
|
-
var
|
|
17836
|
-
var
|
|
17837
|
-
var
|
|
17838
|
-
var
|
|
17839
|
-
var
|
|
17840
|
-
var
|
|
17841
|
-
var
|
|
17842
|
-
var
|
|
17843
|
-
var
|
|
17844
|
-
var
|
|
17845
|
-
var
|
|
17846
|
-
var
|
|
17847
|
-
var
|
|
17848
|
-
var
|
|
17849
|
-
var
|
|
17850
|
-
var
|
|
17851
|
-
var
|
|
17852
|
-
var
|
|
17853
|
-
var
|
|
17854
|
-
var
|
|
17855
|
-
var
|
|
17856
|
-
var
|
|
17857
|
-
var
|
|
17858
|
-
var
|
|
17859
|
-
var
|
|
17860
|
-
var
|
|
17861
|
-
var
|
|
17862
|
-
var
|
|
17863
|
-
var
|
|
17864
|
-
var
|
|
17865
|
-
var
|
|
17866
|
-
var
|
|
17867
|
-
var
|
|
17868
|
-
var
|
|
17869
|
-
var
|
|
17870
|
-
var
|
|
17871
|
-
var
|
|
17872
|
-
var
|
|
17873
|
-
var
|
|
17874
|
-
var
|
|
17875
|
-
var
|
|
17876
|
-
var
|
|
17877
|
-
var
|
|
17878
|
-
var
|
|
17879
|
-
var
|
|
17880
|
-
var
|
|
17881
|
-
var
|
|
17882
|
-
var
|
|
17883
|
-
var
|
|
17884
|
-
var
|
|
17885
|
-
var
|
|
17886
|
-
var
|
|
17959
|
+
})(Wrap2 ||= {});
|
|
17960
|
+
var ALIGN_AUTO2 = 0 /* Auto */;
|
|
17961
|
+
var ALIGN_FLEX_START2 = 1 /* FlexStart */;
|
|
17962
|
+
var ALIGN_CENTER2 = 2 /* Center */;
|
|
17963
|
+
var ALIGN_FLEX_END2 = 3 /* FlexEnd */;
|
|
17964
|
+
var ALIGN_STRETCH2 = 4 /* Stretch */;
|
|
17965
|
+
var ALIGN_BASELINE2 = 5 /* Baseline */;
|
|
17966
|
+
var ALIGN_SPACE_BETWEEN2 = 6 /* SpaceBetween */;
|
|
17967
|
+
var ALIGN_SPACE_AROUND2 = 7 /* SpaceAround */;
|
|
17968
|
+
var ALIGN_SPACE_EVENLY2 = 8 /* SpaceEvenly */;
|
|
17969
|
+
var BOX_SIZING_BORDER_BOX2 = 0 /* BorderBox */;
|
|
17970
|
+
var BOX_SIZING_CONTENT_BOX2 = 1 /* ContentBox */;
|
|
17971
|
+
var DIMENSION_WIDTH2 = 0 /* Width */;
|
|
17972
|
+
var DIMENSION_HEIGHT2 = 1 /* Height */;
|
|
17973
|
+
var DIRECTION_INHERIT2 = 0 /* Inherit */;
|
|
17974
|
+
var DIRECTION_LTR2 = 1 /* LTR */;
|
|
17975
|
+
var DIRECTION_RTL2 = 2 /* RTL */;
|
|
17976
|
+
var DISPLAY_FLEX2 = 0 /* Flex */;
|
|
17977
|
+
var DISPLAY_NONE2 = 1 /* None */;
|
|
17978
|
+
var DISPLAY_CONTENTS2 = 2 /* Contents */;
|
|
17979
|
+
var EDGE_LEFT2 = 0 /* Left */;
|
|
17980
|
+
var EDGE_TOP2 = 1 /* Top */;
|
|
17981
|
+
var EDGE_RIGHT2 = 2 /* Right */;
|
|
17982
|
+
var EDGE_BOTTOM2 = 3 /* Bottom */;
|
|
17983
|
+
var EDGE_START2 = 4 /* Start */;
|
|
17984
|
+
var EDGE_END2 = 5 /* End */;
|
|
17985
|
+
var EDGE_HORIZONTAL2 = 6 /* Horizontal */;
|
|
17986
|
+
var EDGE_VERTICAL2 = 7 /* Vertical */;
|
|
17987
|
+
var EDGE_ALL2 = 8 /* All */;
|
|
17988
|
+
var ERRATA_NONE2 = 0 /* None */;
|
|
17989
|
+
var ERRATA_STRETCH_FLEX_BASIS2 = 1 /* StretchFlexBasis */;
|
|
17990
|
+
var ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING2 = 2 /* AbsolutePositionWithoutInsetsExcludesPadding */;
|
|
17991
|
+
var ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE2 = 4 /* AbsolutePercentAgainstInnerSize */;
|
|
17992
|
+
var ERRATA_ALL2 = 2147483647 /* All */;
|
|
17993
|
+
var ERRATA_CLASSIC2 = 2147483646 /* Classic */;
|
|
17994
|
+
var EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS2 = 0 /* WebFlexBasis */;
|
|
17995
|
+
var FLEX_DIRECTION_COLUMN2 = 0 /* Column */;
|
|
17996
|
+
var FLEX_DIRECTION_COLUMN_REVERSE2 = 1 /* ColumnReverse */;
|
|
17997
|
+
var FLEX_DIRECTION_ROW2 = 2 /* Row */;
|
|
17998
|
+
var FLEX_DIRECTION_ROW_REVERSE2 = 3 /* RowReverse */;
|
|
17999
|
+
var GUTTER_COLUMN2 = 0 /* Column */;
|
|
18000
|
+
var GUTTER_ROW2 = 1 /* Row */;
|
|
18001
|
+
var GUTTER_ALL2 = 2 /* All */;
|
|
18002
|
+
var JUSTIFY_FLEX_START2 = 0 /* FlexStart */;
|
|
18003
|
+
var JUSTIFY_CENTER2 = 1 /* Center */;
|
|
18004
|
+
var JUSTIFY_FLEX_END2 = 2 /* FlexEnd */;
|
|
18005
|
+
var JUSTIFY_SPACE_BETWEEN2 = 3 /* SpaceBetween */;
|
|
18006
|
+
var JUSTIFY_SPACE_AROUND2 = 4 /* SpaceAround */;
|
|
18007
|
+
var JUSTIFY_SPACE_EVENLY2 = 5 /* SpaceEvenly */;
|
|
18008
|
+
var LOG_LEVEL_ERROR2 = 0 /* Error */;
|
|
18009
|
+
var LOG_LEVEL_WARN2 = 1 /* Warn */;
|
|
18010
|
+
var LOG_LEVEL_INFO2 = 2 /* Info */;
|
|
18011
|
+
var LOG_LEVEL_DEBUG2 = 3 /* Debug */;
|
|
18012
|
+
var LOG_LEVEL_VERBOSE2 = 4 /* Verbose */;
|
|
18013
|
+
var LOG_LEVEL_FATAL2 = 5 /* Fatal */;
|
|
18014
|
+
var MEASURE_MODE_UNDEFINED2 = 0 /* Undefined */;
|
|
18015
|
+
var MEASURE_MODE_EXACTLY2 = 1 /* Exactly */;
|
|
18016
|
+
var MEASURE_MODE_AT_MOST2 = 2 /* AtMost */;
|
|
18017
|
+
var NODE_TYPE_DEFAULT2 = 0 /* Default */;
|
|
18018
|
+
var NODE_TYPE_TEXT2 = 1 /* Text */;
|
|
18019
|
+
var OVERFLOW_VISIBLE2 = 0 /* Visible */;
|
|
18020
|
+
var OVERFLOW_HIDDEN2 = 1 /* Hidden */;
|
|
18021
|
+
var OVERFLOW_SCROLL2 = 2 /* Scroll */;
|
|
18022
|
+
var POSITION_TYPE_STATIC2 = 0 /* Static */;
|
|
18023
|
+
var POSITION_TYPE_RELATIVE2 = 1 /* Relative */;
|
|
18024
|
+
var POSITION_TYPE_ABSOLUTE2 = 2 /* Absolute */;
|
|
18025
|
+
var UNIT_UNDEFINED2 = 0 /* Undefined */;
|
|
18026
|
+
var UNIT_POINT2 = 1 /* Point */;
|
|
18027
|
+
var UNIT_PERCENT2 = 2 /* Percent */;
|
|
18028
|
+
var UNIT_AUTO2 = 3 /* Auto */;
|
|
18029
|
+
var WRAP_NO_WRAP2 = 0 /* NoWrap */;
|
|
18030
|
+
var WRAP_WRAP2 = 1 /* Wrap */;
|
|
18031
|
+
var WRAP_WRAP_REVERSE2 = 2 /* WrapReverse */;
|
|
17887
18032
|
var YogaEnumKind = {
|
|
17888
18033
|
Direction: 0,
|
|
17889
18034
|
FlexDirection: 1,
|
|
@@ -17930,7 +18075,7 @@ var measureCallbackLib = null;
|
|
|
17930
18075
|
var dirtiedCallback = null;
|
|
17931
18076
|
var dirtiedCallbackLib = null;
|
|
17932
18077
|
function lib() {
|
|
17933
|
-
return
|
|
18078
|
+
return resolveRenderLib2();
|
|
17934
18079
|
}
|
|
17935
18080
|
function ensureMeasureCallback() {
|
|
17936
18081
|
const renderLib = lib();
|
|
@@ -18008,14 +18153,14 @@ function normalizeLayoutInput(value) {
|
|
|
18008
18153
|
return value === undefined || value === "auto" ? NaN : value;
|
|
18009
18154
|
}
|
|
18010
18155
|
|
|
18011
|
-
class
|
|
18156
|
+
class Config2 {
|
|
18012
18157
|
ptr;
|
|
18013
18158
|
freed = false;
|
|
18014
|
-
constructor(
|
|
18015
|
-
this.ptr =
|
|
18159
|
+
constructor(ptr) {
|
|
18160
|
+
this.ptr = ptr;
|
|
18016
18161
|
}
|
|
18017
18162
|
static create() {
|
|
18018
|
-
return new
|
|
18163
|
+
return new Config2(lib().yogaConfigCreate());
|
|
18019
18164
|
}
|
|
18020
18165
|
static destroy(config) {
|
|
18021
18166
|
config.free();
|
|
@@ -18068,33 +18213,33 @@ class Config {
|
|
|
18068
18213
|
}
|
|
18069
18214
|
}
|
|
18070
18215
|
|
|
18071
|
-
class
|
|
18216
|
+
class Node2 {
|
|
18072
18217
|
ptr;
|
|
18073
18218
|
freed = false;
|
|
18074
|
-
constructor(
|
|
18075
|
-
this.ptr =
|
|
18076
|
-
nodeRegistry.set(
|
|
18219
|
+
constructor(ptr) {
|
|
18220
|
+
this.ptr = ptr;
|
|
18221
|
+
nodeRegistry.set(ptr, this);
|
|
18077
18222
|
}
|
|
18078
18223
|
static create(config) {
|
|
18079
|
-
return
|
|
18224
|
+
return Node2.fromPointer(config ? lib().yogaNodeCreateWithConfig(config.ptr) : lib().yogaNodeCreate());
|
|
18080
18225
|
}
|
|
18081
18226
|
static createForOpenTUI() {
|
|
18082
|
-
return
|
|
18227
|
+
return Node2.fromPointer(lib().yogaNodeCreateForOpenTUI());
|
|
18083
18228
|
}
|
|
18084
18229
|
static createDefault() {
|
|
18085
|
-
return
|
|
18230
|
+
return Node2.create();
|
|
18086
18231
|
}
|
|
18087
18232
|
static createWithConfig(config) {
|
|
18088
|
-
return
|
|
18233
|
+
return Node2.create(config);
|
|
18089
18234
|
}
|
|
18090
18235
|
static destroy(node) {
|
|
18091
18236
|
node.free();
|
|
18092
18237
|
}
|
|
18093
|
-
static fromPointer(
|
|
18094
|
-
const existing = nodeRegistry.get(
|
|
18238
|
+
static fromPointer(ptr) {
|
|
18239
|
+
const existing = nodeRegistry.get(ptr);
|
|
18095
18240
|
if (existing)
|
|
18096
18241
|
return existing;
|
|
18097
|
-
return new
|
|
18242
|
+
return new Node2(ptr);
|
|
18098
18243
|
}
|
|
18099
18244
|
isFreed() {
|
|
18100
18245
|
return this.freed;
|
|
@@ -18150,7 +18295,7 @@ class Node {
|
|
|
18150
18295
|
if (this.freed)
|
|
18151
18296
|
return null;
|
|
18152
18297
|
const child = lib().yogaNodeGetChild(this.ptr, index);
|
|
18153
|
-
return child ?
|
|
18298
|
+
return child ? Node2.fromPointer(child) : null;
|
|
18154
18299
|
}
|
|
18155
18300
|
getChildCount() {
|
|
18156
18301
|
if (this.freed)
|
|
@@ -18161,7 +18306,7 @@ class Node {
|
|
|
18161
18306
|
if (this.freed)
|
|
18162
18307
|
return null;
|
|
18163
18308
|
const parent = lib().yogaNodeGetParent(this.ptr);
|
|
18164
|
-
return parent ?
|
|
18309
|
+
return parent ? Node2.fromPointer(parent) : null;
|
|
18165
18310
|
}
|
|
18166
18311
|
calculateLayout(width, height, direction = 1 /* LTR */) {
|
|
18167
18312
|
if (this.freed)
|
|
@@ -18430,10 +18575,10 @@ class Node {
|
|
|
18430
18575
|
getGap(gutter) {
|
|
18431
18576
|
return this.getValue(YogaValueKind.Gap, gutter);
|
|
18432
18577
|
}
|
|
18433
|
-
setBorder(edge,
|
|
18578
|
+
setBorder(edge, border) {
|
|
18434
18579
|
if (this.freed)
|
|
18435
18580
|
return;
|
|
18436
|
-
lib().yogaNodeStyleSetBorder(this.ptr, edge,
|
|
18581
|
+
lib().yogaNodeStyleSetBorder(this.ptr, edge, border ?? NaN);
|
|
18437
18582
|
}
|
|
18438
18583
|
getBorder(edge) {
|
|
18439
18584
|
if (this.freed)
|
|
@@ -18546,102 +18691,102 @@ class Node {
|
|
|
18546
18691
|
}
|
|
18547
18692
|
}
|
|
18548
18693
|
var Yoga = {
|
|
18549
|
-
Config,
|
|
18550
|
-
Node,
|
|
18551
|
-
Align,
|
|
18552
|
-
BoxSizing,
|
|
18553
|
-
Dimension,
|
|
18554
|
-
Direction,
|
|
18555
|
-
Display,
|
|
18556
|
-
Edge,
|
|
18557
|
-
Errata,
|
|
18558
|
-
ExperimentalFeature,
|
|
18559
|
-
FlexDirection,
|
|
18560
|
-
Gutter,
|
|
18561
|
-
Justify,
|
|
18562
|
-
LogLevel,
|
|
18563
|
-
MeasureMode,
|
|
18564
|
-
NodeType,
|
|
18565
|
-
Overflow,
|
|
18566
|
-
PositionType,
|
|
18567
|
-
Unit,
|
|
18568
|
-
Wrap,
|
|
18569
|
-
ALIGN_AUTO,
|
|
18570
|
-
ALIGN_FLEX_START,
|
|
18571
|
-
ALIGN_CENTER,
|
|
18572
|
-
ALIGN_FLEX_END,
|
|
18573
|
-
ALIGN_STRETCH,
|
|
18574
|
-
ALIGN_BASELINE,
|
|
18575
|
-
ALIGN_SPACE_BETWEEN,
|
|
18576
|
-
ALIGN_SPACE_AROUND,
|
|
18577
|
-
ALIGN_SPACE_EVENLY,
|
|
18578
|
-
BOX_SIZING_BORDER_BOX,
|
|
18579
|
-
BOX_SIZING_CONTENT_BOX,
|
|
18580
|
-
DIMENSION_WIDTH,
|
|
18581
|
-
DIMENSION_HEIGHT,
|
|
18582
|
-
DIRECTION_INHERIT,
|
|
18583
|
-
DIRECTION_LTR,
|
|
18584
|
-
DIRECTION_RTL,
|
|
18585
|
-
DISPLAY_FLEX,
|
|
18586
|
-
DISPLAY_NONE,
|
|
18587
|
-
DISPLAY_CONTENTS,
|
|
18588
|
-
EDGE_LEFT,
|
|
18589
|
-
EDGE_TOP,
|
|
18590
|
-
EDGE_RIGHT,
|
|
18591
|
-
EDGE_BOTTOM,
|
|
18592
|
-
EDGE_START,
|
|
18593
|
-
EDGE_END,
|
|
18594
|
-
EDGE_HORIZONTAL,
|
|
18595
|
-
EDGE_VERTICAL,
|
|
18596
|
-
EDGE_ALL,
|
|
18597
|
-
ERRATA_NONE,
|
|
18598
|
-
ERRATA_STRETCH_FLEX_BASIS,
|
|
18599
|
-
ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING,
|
|
18600
|
-
ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE,
|
|
18601
|
-
ERRATA_ALL,
|
|
18602
|
-
ERRATA_CLASSIC,
|
|
18603
|
-
EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS,
|
|
18604
|
-
FLEX_DIRECTION_COLUMN,
|
|
18605
|
-
FLEX_DIRECTION_COLUMN_REVERSE,
|
|
18606
|
-
FLEX_DIRECTION_ROW,
|
|
18607
|
-
FLEX_DIRECTION_ROW_REVERSE,
|
|
18608
|
-
GUTTER_COLUMN,
|
|
18609
|
-
GUTTER_ROW,
|
|
18610
|
-
GUTTER_ALL,
|
|
18611
|
-
JUSTIFY_FLEX_START,
|
|
18612
|
-
JUSTIFY_CENTER,
|
|
18613
|
-
JUSTIFY_FLEX_END,
|
|
18614
|
-
JUSTIFY_SPACE_BETWEEN,
|
|
18615
|
-
JUSTIFY_SPACE_AROUND,
|
|
18616
|
-
JUSTIFY_SPACE_EVENLY,
|
|
18617
|
-
LOG_LEVEL_ERROR,
|
|
18618
|
-
LOG_LEVEL_WARN,
|
|
18619
|
-
LOG_LEVEL_INFO,
|
|
18620
|
-
LOG_LEVEL_DEBUG,
|
|
18621
|
-
LOG_LEVEL_VERBOSE,
|
|
18622
|
-
LOG_LEVEL_FATAL,
|
|
18623
|
-
MEASURE_MODE_UNDEFINED,
|
|
18624
|
-
MEASURE_MODE_EXACTLY,
|
|
18625
|
-
MEASURE_MODE_AT_MOST,
|
|
18626
|
-
NODE_TYPE_DEFAULT,
|
|
18627
|
-
NODE_TYPE_TEXT,
|
|
18628
|
-
OVERFLOW_VISIBLE,
|
|
18629
|
-
OVERFLOW_HIDDEN,
|
|
18630
|
-
OVERFLOW_SCROLL,
|
|
18631
|
-
POSITION_TYPE_STATIC,
|
|
18632
|
-
POSITION_TYPE_RELATIVE,
|
|
18633
|
-
POSITION_TYPE_ABSOLUTE,
|
|
18634
|
-
UNIT_UNDEFINED,
|
|
18635
|
-
UNIT_POINT,
|
|
18636
|
-
UNIT_PERCENT,
|
|
18637
|
-
UNIT_AUTO,
|
|
18638
|
-
WRAP_NO_WRAP,
|
|
18639
|
-
WRAP_WRAP,
|
|
18640
|
-
WRAP_WRAP_REVERSE
|
|
18694
|
+
Config: Config2,
|
|
18695
|
+
Node: Node2,
|
|
18696
|
+
Align: Align2,
|
|
18697
|
+
BoxSizing: BoxSizing2,
|
|
18698
|
+
Dimension: Dimension2,
|
|
18699
|
+
Direction: Direction2,
|
|
18700
|
+
Display: Display2,
|
|
18701
|
+
Edge: Edge2,
|
|
18702
|
+
Errata: Errata2,
|
|
18703
|
+
ExperimentalFeature: ExperimentalFeature2,
|
|
18704
|
+
FlexDirection: FlexDirection2,
|
|
18705
|
+
Gutter: Gutter2,
|
|
18706
|
+
Justify: Justify2,
|
|
18707
|
+
LogLevel: LogLevel3,
|
|
18708
|
+
MeasureMode: MeasureMode2,
|
|
18709
|
+
NodeType: NodeType2,
|
|
18710
|
+
Overflow: Overflow2,
|
|
18711
|
+
PositionType: PositionType2,
|
|
18712
|
+
Unit: Unit2,
|
|
18713
|
+
Wrap: Wrap2,
|
|
18714
|
+
ALIGN_AUTO: ALIGN_AUTO2,
|
|
18715
|
+
ALIGN_FLEX_START: ALIGN_FLEX_START2,
|
|
18716
|
+
ALIGN_CENTER: ALIGN_CENTER2,
|
|
18717
|
+
ALIGN_FLEX_END: ALIGN_FLEX_END2,
|
|
18718
|
+
ALIGN_STRETCH: ALIGN_STRETCH2,
|
|
18719
|
+
ALIGN_BASELINE: ALIGN_BASELINE2,
|
|
18720
|
+
ALIGN_SPACE_BETWEEN: ALIGN_SPACE_BETWEEN2,
|
|
18721
|
+
ALIGN_SPACE_AROUND: ALIGN_SPACE_AROUND2,
|
|
18722
|
+
ALIGN_SPACE_EVENLY: ALIGN_SPACE_EVENLY2,
|
|
18723
|
+
BOX_SIZING_BORDER_BOX: BOX_SIZING_BORDER_BOX2,
|
|
18724
|
+
BOX_SIZING_CONTENT_BOX: BOX_SIZING_CONTENT_BOX2,
|
|
18725
|
+
DIMENSION_WIDTH: DIMENSION_WIDTH2,
|
|
18726
|
+
DIMENSION_HEIGHT: DIMENSION_HEIGHT2,
|
|
18727
|
+
DIRECTION_INHERIT: DIRECTION_INHERIT2,
|
|
18728
|
+
DIRECTION_LTR: DIRECTION_LTR2,
|
|
18729
|
+
DIRECTION_RTL: DIRECTION_RTL2,
|
|
18730
|
+
DISPLAY_FLEX: DISPLAY_FLEX2,
|
|
18731
|
+
DISPLAY_NONE: DISPLAY_NONE2,
|
|
18732
|
+
DISPLAY_CONTENTS: DISPLAY_CONTENTS2,
|
|
18733
|
+
EDGE_LEFT: EDGE_LEFT2,
|
|
18734
|
+
EDGE_TOP: EDGE_TOP2,
|
|
18735
|
+
EDGE_RIGHT: EDGE_RIGHT2,
|
|
18736
|
+
EDGE_BOTTOM: EDGE_BOTTOM2,
|
|
18737
|
+
EDGE_START: EDGE_START2,
|
|
18738
|
+
EDGE_END: EDGE_END2,
|
|
18739
|
+
EDGE_HORIZONTAL: EDGE_HORIZONTAL2,
|
|
18740
|
+
EDGE_VERTICAL: EDGE_VERTICAL2,
|
|
18741
|
+
EDGE_ALL: EDGE_ALL2,
|
|
18742
|
+
ERRATA_NONE: ERRATA_NONE2,
|
|
18743
|
+
ERRATA_STRETCH_FLEX_BASIS: ERRATA_STRETCH_FLEX_BASIS2,
|
|
18744
|
+
ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING: ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING2,
|
|
18745
|
+
ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE: ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE2,
|
|
18746
|
+
ERRATA_ALL: ERRATA_ALL2,
|
|
18747
|
+
ERRATA_CLASSIC: ERRATA_CLASSIC2,
|
|
18748
|
+
EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS: EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS2,
|
|
18749
|
+
FLEX_DIRECTION_COLUMN: FLEX_DIRECTION_COLUMN2,
|
|
18750
|
+
FLEX_DIRECTION_COLUMN_REVERSE: FLEX_DIRECTION_COLUMN_REVERSE2,
|
|
18751
|
+
FLEX_DIRECTION_ROW: FLEX_DIRECTION_ROW2,
|
|
18752
|
+
FLEX_DIRECTION_ROW_REVERSE: FLEX_DIRECTION_ROW_REVERSE2,
|
|
18753
|
+
GUTTER_COLUMN: GUTTER_COLUMN2,
|
|
18754
|
+
GUTTER_ROW: GUTTER_ROW2,
|
|
18755
|
+
GUTTER_ALL: GUTTER_ALL2,
|
|
18756
|
+
JUSTIFY_FLEX_START: JUSTIFY_FLEX_START2,
|
|
18757
|
+
JUSTIFY_CENTER: JUSTIFY_CENTER2,
|
|
18758
|
+
JUSTIFY_FLEX_END: JUSTIFY_FLEX_END2,
|
|
18759
|
+
JUSTIFY_SPACE_BETWEEN: JUSTIFY_SPACE_BETWEEN2,
|
|
18760
|
+
JUSTIFY_SPACE_AROUND: JUSTIFY_SPACE_AROUND2,
|
|
18761
|
+
JUSTIFY_SPACE_EVENLY: JUSTIFY_SPACE_EVENLY2,
|
|
18762
|
+
LOG_LEVEL_ERROR: LOG_LEVEL_ERROR2,
|
|
18763
|
+
LOG_LEVEL_WARN: LOG_LEVEL_WARN2,
|
|
18764
|
+
LOG_LEVEL_INFO: LOG_LEVEL_INFO2,
|
|
18765
|
+
LOG_LEVEL_DEBUG: LOG_LEVEL_DEBUG2,
|
|
18766
|
+
LOG_LEVEL_VERBOSE: LOG_LEVEL_VERBOSE2,
|
|
18767
|
+
LOG_LEVEL_FATAL: LOG_LEVEL_FATAL2,
|
|
18768
|
+
MEASURE_MODE_UNDEFINED: MEASURE_MODE_UNDEFINED2,
|
|
18769
|
+
MEASURE_MODE_EXACTLY: MEASURE_MODE_EXACTLY2,
|
|
18770
|
+
MEASURE_MODE_AT_MOST: MEASURE_MODE_AT_MOST2,
|
|
18771
|
+
NODE_TYPE_DEFAULT: NODE_TYPE_DEFAULT2,
|
|
18772
|
+
NODE_TYPE_TEXT: NODE_TYPE_TEXT2,
|
|
18773
|
+
OVERFLOW_VISIBLE: OVERFLOW_VISIBLE2,
|
|
18774
|
+
OVERFLOW_HIDDEN: OVERFLOW_HIDDEN2,
|
|
18775
|
+
OVERFLOW_SCROLL: OVERFLOW_SCROLL2,
|
|
18776
|
+
POSITION_TYPE_STATIC: POSITION_TYPE_STATIC2,
|
|
18777
|
+
POSITION_TYPE_RELATIVE: POSITION_TYPE_RELATIVE2,
|
|
18778
|
+
POSITION_TYPE_ABSOLUTE: POSITION_TYPE_ABSOLUTE2,
|
|
18779
|
+
UNIT_UNDEFINED: UNIT_UNDEFINED2,
|
|
18780
|
+
UNIT_POINT: UNIT_POINT2,
|
|
18781
|
+
UNIT_PERCENT: UNIT_PERCENT2,
|
|
18782
|
+
UNIT_AUTO: UNIT_AUTO2,
|
|
18783
|
+
WRAP_NO_WRAP: WRAP_NO_WRAP2,
|
|
18784
|
+
WRAP_WRAP: WRAP_WRAP2,
|
|
18785
|
+
WRAP_WRAP_REVERSE: WRAP_WRAP_REVERSE2
|
|
18641
18786
|
};
|
|
18642
18787
|
var yoga_default = Yoga;
|
|
18643
18788
|
|
|
18644
|
-
export { toArrayBuffer, singleton,
|
|
18789
|
+
export { toArrayBuffer, singleton, envRegistry2, registerEnvVar2, clearEnvCache2, generateEnvMarkdown2, generateEnvColored2, env2, sleep, stringWidth, resolveBundledFilePath2, DEFAULT_FOREGROUND_RGB2, DEFAULT_BACKGROUND_RGB2, normalizeIndexedColorIndex2, ansi256IndexToRgb2, RGBA2, normalizeColorValue2, hexToRgb2, rgbToHex2, hsvToRgb2, parseColor2, isValidBorderStyle2, parseBorderStyle2, BorderChars2, getBorderFromSides2, getBorderSides2, borderCharsToArray2, BorderCharArrays2, KeyEvent2, PasteEvent2, KeyHandler2, InternalKeyHandler2, fonts2, measureText2, getCharacterPositions2, coordinateToCharacterIndex2, renderFontToFrameBuffer2, TextAttributes2, ATTRIBUTE_BASE_BITS2, ATTRIBUTE_BASE_MASK2, getBaseAttributes2, DebugOverlayCorner2, TargetChannel2, createTextAttributes2, attributesWithLink2, getLinkId2, visualizeRenderableTree2, isStyledText2, StyledText2, stringToStyledText2, black2, red2, green2, yellow2, blue2, magenta2, cyan2, white2, brightBlack2, brightRed2, brightGreen2, brightYellow2, brightBlue2, brightMagenta2, brightCyan2, brightWhite2, bgBlack2, bgRed2, bgGreen2, bgYellow2, bgBlue2, bgMagenta2, bgCyan2, bgWhite2, bold2, italic2, underline2, strikethrough2, dim2, reverse2, blink2, fg2, bg2, link2, t2, hastToStyledText2, SystemClock2, nonAlphanumericKeys2, terminalNamedSingleStrokeKeys2, parseKeypress2, LinearScrollAccel2, MacOSScrollAccel2, parseAlign2, parseAlignItems2, parseBoxSizing2, parseDimension2, parseDirection2, parseDisplay2, parseEdge2, parseFlexDirection2, parseGutter2, parseJustify2, parseLogLevel2, parseMeasureMode2, parseOverflow2, parsePositionType2, parseUnit2, parseWrap2, MouseParser2, Selection2, convertGlobalToLocalSelection2, ASCIIFontSelectionHelper2, StdinParser2, addDefaultParsers2, TreeSitterClient2, treeSitterToTextChunks2, treeSitterToStyledText2, DataPathsManager2, getDataPaths2, extensionToFiletype2, basenameToFiletype2, extToFiletype2, pathToFiletype2, infoStringToFiletype2, getTreeSitterClient2, destroyTreeSitterClient2, ExtmarksController2, createExtmarksController2, TerminalPalette2, createTerminalPalette2, normalizeTerminalPalette2, buildTerminalPaletteSignature2, decodePasteBytes2, stripAnsiSequences2, createHostClipboard2, createClipboard2, ClipboardTarget2, createRendererClipboardAdapter2, Clipboard2, normalizeMarkdownLinkTarget, detectLinks2, OptimizedBuffer2, TextBuffer2, SpanInfoStruct, NativeAudioStreamFormat2, NativeAudioStreamState2, NativeAudioStreamStateNames, NativeAudioStreamCloseReason2, NativeAudioStreamState3, NativeAudioStreamCloseReason3, NativeAudioStreamFormat3, MAX_LINK_URL_BYTES2, NativeClipboardOperationStatus2, NativeClipboardStartStatus2, NativeClipboardCancelStatus2, NativeClipboardCopyStatus2, NativeClipboardDestroyStatus2, NativeClipboardShutdownStatus2, LogLevel2, NativeMeasureTargetKind2, setRenderLibPath2, resolveRenderLib2, Align2, BoxSizing2, Dimension2, Direction2, Display2, Edge2, Errata2, ExperimentalFeature2, FlexDirection2, Gutter2, Justify2, LogLevel3, MeasureMode2, NodeType2, Overflow2, PositionType2, Unit2, Wrap2, ALIGN_AUTO2, ALIGN_FLEX_START2, ALIGN_CENTER2, ALIGN_FLEX_END2, ALIGN_STRETCH2, ALIGN_BASELINE2, ALIGN_SPACE_BETWEEN2, ALIGN_SPACE_AROUND2, ALIGN_SPACE_EVENLY2, BOX_SIZING_BORDER_BOX2, BOX_SIZING_CONTENT_BOX2, DIMENSION_WIDTH2, DIMENSION_HEIGHT2, DIRECTION_INHERIT2, DIRECTION_LTR2, DIRECTION_RTL2, DISPLAY_FLEX2, DISPLAY_NONE2, DISPLAY_CONTENTS2, EDGE_LEFT2, EDGE_TOP2, EDGE_RIGHT2, EDGE_BOTTOM2, EDGE_START2, EDGE_END2, EDGE_HORIZONTAL2, EDGE_VERTICAL2, EDGE_ALL2, ERRATA_NONE2, ERRATA_STRETCH_FLEX_BASIS2, ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING2, ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE2, ERRATA_ALL2, ERRATA_CLASSIC2, EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS2, FLEX_DIRECTION_COLUMN2, FLEX_DIRECTION_COLUMN_REVERSE2, FLEX_DIRECTION_ROW2, FLEX_DIRECTION_ROW_REVERSE2, GUTTER_COLUMN2, GUTTER_ROW2, GUTTER_ALL2, JUSTIFY_FLEX_START2, JUSTIFY_CENTER2, JUSTIFY_FLEX_END2, JUSTIFY_SPACE_BETWEEN2, JUSTIFY_SPACE_AROUND2, JUSTIFY_SPACE_EVENLY2, LOG_LEVEL_ERROR2, LOG_LEVEL_WARN2, LOG_LEVEL_INFO2, LOG_LEVEL_DEBUG2, LOG_LEVEL_VERBOSE2, LOG_LEVEL_FATAL2, MEASURE_MODE_UNDEFINED2, MEASURE_MODE_EXACTLY2, MEASURE_MODE_AT_MOST2, NODE_TYPE_DEFAULT2, NODE_TYPE_TEXT2, OVERFLOW_VISIBLE2, OVERFLOW_HIDDEN2, OVERFLOW_SCROLL2, POSITION_TYPE_STATIC2, POSITION_TYPE_RELATIVE2, POSITION_TYPE_ABSOLUTE2, UNIT_UNDEFINED2, UNIT_POINT2, UNIT_PERCENT2, UNIT_AUTO2, WRAP_NO_WRAP2, WRAP_WRAP2, WRAP_WRAP_REVERSE2, Config2, Node2, exports_yoga, yoga_default };
|
|
18645
18790
|
|
|
18646
|
-
//# debugId=
|
|
18647
|
-
//# sourceMappingURL=chunk-bun-
|
|
18791
|
+
//# debugId=C2AA7ABE4C3E076964756E2164756E21
|
|
18792
|
+
//# sourceMappingURL=chunk-bun-37s3zwb6.js.map
|