@opentui/core 0.5.10 → 0.5.12
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-8f4q4e2m.js} +1234 -1039
- package/{chunk-bun-9gqvxy8c.js.map → chunk-bun-8f4q4e2m.js.map} +8 -8
- package/{chunk-bun-bb3k0yt8.js → chunk-bun-91mz470w.js} +680 -585
- package/chunk-bun-91mz470w.js.map +32 -0
- package/{chunk-node-f647ts9q.js → chunk-node-1zjyxy5y.js} +1241 -1043
- package/chunk-node-1zjyxy5y.js.map +63 -0
- package/{chunk-node-6bg8r2m7.js → chunk-node-fyb4fckk.js} +680 -585
- package/chunk-node-fyb4fckk.js.map +32 -0
- package/editor-view.d.ts +1 -0
- package/index.bun.js +1603 -1377
- package/index.bun.js.map +8 -8
- package/index.node.js +1603 -1377
- package/index.node.js.map +8 -8
- 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/node-assets.js +6 -2
- package/node-assets.js.map +3 -3
- package/package.json +13 -9
- package/parser.worker.js +7 -12
- package/parser.worker.js.map +3 -3
- package/renderables/Code.d.ts +6 -0
- package/renderables/Diff.d.ts +1 -2
- package/renderables/EmbeddedTerminal.d.ts +4 -0
- package/renderables/Markdown.d.ts +6 -0
- package/renderables/TextBufferRenderable.d.ts +7 -0
- package/renderables/TextTable.d.ts +2 -0
- package/renderer.d.ts +2 -0
- package/runtime-plugin.js +15 -4
- package/runtime-plugin.js.map +1 -1
- 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 +2 -0
- package/types.d.ts +2 -1
- 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 +6 -0
- package/chunk-bun-bb3k0yt8.js.map +0 -32
- package/chunk-node-6bg8r2m7.js.map +0 -32
- package/chunk-node-f647ts9q.js.map +0 -63
|
@@ -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());
|
|
@@ -8315,11 +8319,9 @@ function createNodeWorkerConstructor(node) {
|
|
|
8315
8319
|
return this.terminationPromise;
|
|
8316
8320
|
}
|
|
8317
8321
|
this.worker.off("message", this.handleMessage);
|
|
8318
|
-
this.worker.off("error", this.handleError);
|
|
8319
8322
|
const termination = this.worker.terminate().catch((error) => {
|
|
8320
8323
|
this.terminationPromise = undefined;
|
|
8321
8324
|
this.worker.on("message", this.handleMessage);
|
|
8322
|
-
this.worker.on("error", this.handleError);
|
|
8323
8325
|
throw error;
|
|
8324
8326
|
});
|
|
8325
8327
|
this.terminationPromise = termination;
|
|
@@ -8493,14 +8495,14 @@ function setGlobalWorkerMessageHandler(handler) {
|
|
|
8493
8495
|
}
|
|
8494
8496
|
|
|
8495
8497
|
// src/lib/tree-sitter/client.ts
|
|
8496
|
-
|
|
8498
|
+
registerEnvVar2({
|
|
8497
8499
|
name: "OTUI_TREE_SITTER_WORKER_PATH",
|
|
8498
8500
|
description: "Path to the TreeSitter worker entry script",
|
|
8499
8501
|
type: "string",
|
|
8500
8502
|
default: ""
|
|
8501
8503
|
});
|
|
8502
8504
|
var DEFAULT_PARSER_OVERRIDES = [];
|
|
8503
|
-
function
|
|
8505
|
+
function addDefaultParsers2(parsers) {
|
|
8504
8506
|
for (const parser of parsers) {
|
|
8505
8507
|
DEFAULT_PARSER_OVERRIDES = [
|
|
8506
8508
|
...DEFAULT_PARSER_OVERRIDES.filter((existingParser) => existingParser.filetype !== parser.filetype),
|
|
@@ -8510,7 +8512,7 @@ function addDefaultParsers(parsers) {
|
|
|
8510
8512
|
}
|
|
8511
8513
|
var isUrl = (path) => path.startsWith("http://") || path.startsWith("https://");
|
|
8512
8514
|
|
|
8513
|
-
class
|
|
8515
|
+
class TreeSitterClient2 extends EventEmitter2 {
|
|
8514
8516
|
initialized = false;
|
|
8515
8517
|
worker;
|
|
8516
8518
|
buffers = new Map;
|
|
@@ -8618,8 +8620,8 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8618
8620
|
if (this.options.workerPath) {
|
|
8619
8621
|
return this.options.workerPath;
|
|
8620
8622
|
}
|
|
8621
|
-
if (
|
|
8622
|
-
return
|
|
8623
|
+
if (env2.OTUI_TREE_SITTER_WORKER_PATH) {
|
|
8624
|
+
return env2.OTUI_TREE_SITTER_WORKER_PATH;
|
|
8623
8625
|
}
|
|
8624
8626
|
if (typeof OTUI_TREE_SITTER_WORKER_PATH !== "undefined") {
|
|
8625
8627
|
return OTUI_TREE_SITTER_WORKER_PATH;
|
|
@@ -8704,7 +8706,7 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8704
8706
|
async initializeClient(generation, worker) {
|
|
8705
8707
|
const treeSitterWasmPath = await resolveTreeSitterWasm();
|
|
8706
8708
|
this.assertCurrentInitialization(generation, worker);
|
|
8707
|
-
await new Promise((
|
|
8709
|
+
await new Promise((resolve, reject) => {
|
|
8708
8710
|
const timeoutMs = this.options.initTimeout ?? 1e4;
|
|
8709
8711
|
const timeoutId = setTimeout(() => {
|
|
8710
8712
|
const error = new Error("Worker initialization timed out");
|
|
@@ -8712,7 +8714,7 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8712
8714
|
this.initializeResolvers = undefined;
|
|
8713
8715
|
reject(error);
|
|
8714
8716
|
}, timeoutMs);
|
|
8715
|
-
this.initializeResolvers = { resolve
|
|
8717
|
+
this.initializeResolvers = { resolve, reject, timeoutId };
|
|
8716
8718
|
this.sendWorkerMessage({
|
|
8717
8719
|
type: "INIT",
|
|
8718
8720
|
dataPath: this.options.dataPath,
|
|
@@ -8729,7 +8731,7 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8729
8731
|
this.assertCurrentInitialization(generation, worker);
|
|
8730
8732
|
const overriddenFiletypes = new Set(DEFAULT_PARSER_OVERRIDES.map((parser) => parser.filetype));
|
|
8731
8733
|
for (const parser of [
|
|
8732
|
-
...defaultParsers.filter((
|
|
8734
|
+
...defaultParsers.filter((parser) => !overriddenFiletypes.has(parser.filetype)),
|
|
8733
8735
|
...DEFAULT_PARSER_OVERRIDES
|
|
8734
8736
|
]) {
|
|
8735
8737
|
worker.postMessage({ type: "ADD_FILETYPE_PARSER", filetypeParser: this.resolveFiletypeParser(parser) });
|
|
@@ -8763,8 +8765,8 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8763
8765
|
}
|
|
8764
8766
|
async getPerformance() {
|
|
8765
8767
|
const messageId = `performance_${this.messageIdCounter++}`;
|
|
8766
|
-
return new Promise((
|
|
8767
|
-
this.messageCallbacks.set(messageId, { resolve
|
|
8768
|
+
return new Promise((resolve, reject) => {
|
|
8769
|
+
this.messageCallbacks.set(messageId, { resolve, reject });
|
|
8768
8770
|
try {
|
|
8769
8771
|
this.sendWorkerMessage({ type: "GET_PERFORMANCE", messageId });
|
|
8770
8772
|
} catch (error) {
|
|
@@ -8782,8 +8784,8 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8782
8784
|
}
|
|
8783
8785
|
}
|
|
8784
8786
|
const messageId = `oneshot_${this.messageIdCounter++}`;
|
|
8785
|
-
return new Promise((
|
|
8786
|
-
this.messageCallbacks.set(messageId, { resolve
|
|
8787
|
+
return new Promise((resolve, reject) => {
|
|
8788
|
+
this.messageCallbacks.set(messageId, { resolve, reject });
|
|
8787
8789
|
try {
|
|
8788
8790
|
this.sendWorkerMessage({
|
|
8789
8791
|
type: "ONESHOT_HIGHLIGHT",
|
|
@@ -8906,8 +8908,8 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8906
8908
|
}
|
|
8907
8909
|
async preloadParser(filetype) {
|
|
8908
8910
|
const messageId = `has_parser_${this.messageIdCounter++}`;
|
|
8909
|
-
const response = await new Promise((
|
|
8910
|
-
this.messageCallbacks.set(messageId, { resolve
|
|
8911
|
+
const response = await new Promise((resolve, reject) => {
|
|
8912
|
+
this.messageCallbacks.set(messageId, { resolve, reject });
|
|
8911
8913
|
try {
|
|
8912
8914
|
this.sendWorkerMessage({
|
|
8913
8915
|
type: "PRELOAD_PARSER",
|
|
@@ -8939,8 +8941,8 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8939
8941
|
}
|
|
8940
8942
|
this.buffers.set(id, { id, content, filetype, version, hasParser: false });
|
|
8941
8943
|
const messageId = `init_${this.messageIdCounter++}`;
|
|
8942
|
-
const response = await new Promise((
|
|
8943
|
-
this.messageCallbacks.set(messageId, { resolve
|
|
8944
|
+
const response = await new Promise((resolve, reject) => {
|
|
8945
|
+
this.messageCallbacks.set(messageId, { resolve, reject });
|
|
8944
8946
|
try {
|
|
8945
8947
|
this.sendWorkerMessage({
|
|
8946
8948
|
type: "INITIALIZE_PARSER",
|
|
@@ -9001,9 +9003,9 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
9001
9003
|
this.editQueues.delete(bufferId);
|
|
9002
9004
|
}
|
|
9003
9005
|
if (this.worker) {
|
|
9004
|
-
await new Promise((
|
|
9006
|
+
await new Promise((resolve, reject) => {
|
|
9005
9007
|
const messageId = `dispose_${bufferId}`;
|
|
9006
|
-
this.messageCallbacks.set(messageId, { resolve
|
|
9008
|
+
this.messageCallbacks.set(messageId, { resolve, reject });
|
|
9007
9009
|
try {
|
|
9008
9010
|
this.sendWorkerMessage({
|
|
9009
9011
|
type: "DISPOSE_BUFFER",
|
|
@@ -9012,13 +9014,13 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
9012
9014
|
} catch (error) {
|
|
9013
9015
|
console.error("Error disposing buffer", error);
|
|
9014
9016
|
this.messageCallbacks.delete(messageId);
|
|
9015
|
-
|
|
9017
|
+
resolve(false);
|
|
9016
9018
|
}
|
|
9017
9019
|
setTimeout(() => {
|
|
9018
9020
|
if (this.messageCallbacks.has(messageId)) {
|
|
9019
9021
|
this.messageCallbacks.delete(messageId);
|
|
9020
9022
|
console.warn({ bufferId }, "Timed out waiting for buffer to be disposed");
|
|
9021
|
-
|
|
9023
|
+
resolve(false);
|
|
9022
9024
|
}
|
|
9023
9025
|
}, 3000);
|
|
9024
9026
|
});
|
|
@@ -9031,8 +9033,8 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
9031
9033
|
}
|
|
9032
9034
|
let resolveDestroy;
|
|
9033
9035
|
let rejectDestroy;
|
|
9034
|
-
const destroyPromise = new Promise((
|
|
9035
|
-
resolveDestroy =
|
|
9036
|
+
const destroyPromise = new Promise((resolve, reject) => {
|
|
9037
|
+
resolveDestroy = resolve;
|
|
9036
9038
|
rejectDestroy = reject;
|
|
9037
9039
|
});
|
|
9038
9040
|
this.destroyPromise = destroyPromise;
|
|
@@ -9097,13 +9099,13 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
9097
9099
|
this.options.dataPath = dataPath;
|
|
9098
9100
|
if (this.initialized && this.worker) {
|
|
9099
9101
|
const messageId = `update_datapath_${this.messageIdCounter++}`;
|
|
9100
|
-
return new Promise((
|
|
9102
|
+
return new Promise((resolve, reject) => {
|
|
9101
9103
|
this.messageCallbacks.set(messageId, {
|
|
9102
9104
|
resolve: (response) => {
|
|
9103
9105
|
if (response.error) {
|
|
9104
9106
|
reject(new Error(response.error));
|
|
9105
9107
|
} else {
|
|
9106
|
-
|
|
9108
|
+
resolve();
|
|
9107
9109
|
}
|
|
9108
9110
|
},
|
|
9109
9111
|
reject
|
|
@@ -9126,13 +9128,13 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
9126
9128
|
throw new Error("Cannot clear cache: client is not initialized");
|
|
9127
9129
|
}
|
|
9128
9130
|
const messageId = `clear_cache_${this.messageIdCounter++}`;
|
|
9129
|
-
return new Promise((
|
|
9131
|
+
return new Promise((resolve, reject) => {
|
|
9130
9132
|
this.messageCallbacks.set(messageId, {
|
|
9131
9133
|
resolve: (response) => {
|
|
9132
9134
|
if (response.error) {
|
|
9133
9135
|
reject(new Error(response.error));
|
|
9134
9136
|
} else {
|
|
9135
|
-
|
|
9137
|
+
resolve();
|
|
9136
9138
|
}
|
|
9137
9139
|
},
|
|
9138
9140
|
reject
|
|
@@ -9204,20 +9206,20 @@ function isValidDirectoryName(name) {
|
|
|
9204
9206
|
}
|
|
9205
9207
|
|
|
9206
9208
|
// src/lib/data-paths.ts
|
|
9207
|
-
|
|
9209
|
+
registerEnvVar2({
|
|
9208
9210
|
name: "XDG_CONFIG_HOME",
|
|
9209
9211
|
description: "Base directory for user-specific configuration files",
|
|
9210
9212
|
type: "string",
|
|
9211
9213
|
default: ""
|
|
9212
9214
|
});
|
|
9213
|
-
|
|
9215
|
+
registerEnvVar2({
|
|
9214
9216
|
name: "XDG_DATA_HOME",
|
|
9215
9217
|
description: "Base directory for user-specific data files",
|
|
9216
9218
|
type: "string",
|
|
9217
9219
|
default: ""
|
|
9218
9220
|
});
|
|
9219
9221
|
|
|
9220
|
-
class
|
|
9222
|
+
class DataPathsManager2 extends EventEmitter3 {
|
|
9221
9223
|
_appName;
|
|
9222
9224
|
_globalConfigPath;
|
|
9223
9225
|
_globalConfigFile;
|
|
@@ -9246,7 +9248,7 @@ class DataPathsManager extends EventEmitter3 {
|
|
|
9246
9248
|
get globalConfigPath() {
|
|
9247
9249
|
if (this._globalConfigPath === undefined) {
|
|
9248
9250
|
const homeDir = os.homedir();
|
|
9249
|
-
const xdgConfigHome =
|
|
9251
|
+
const xdgConfigHome = env2.XDG_CONFIG_HOME;
|
|
9250
9252
|
const baseConfigDir = xdgConfigHome || path.join(homeDir, ".config");
|
|
9251
9253
|
this._globalConfigPath = path.join(baseConfigDir, this._appName);
|
|
9252
9254
|
}
|
|
@@ -9267,7 +9269,7 @@ class DataPathsManager extends EventEmitter3 {
|
|
|
9267
9269
|
get globalDataPath() {
|
|
9268
9270
|
if (this._globalDataPath === undefined) {
|
|
9269
9271
|
const homeDir = os.homedir();
|
|
9270
|
-
const xdgDataHome =
|
|
9272
|
+
const xdgDataHome = env2.XDG_DATA_HOME;
|
|
9271
9273
|
const baseDataDir = xdgDataHome || path.join(homeDir, ".local/share");
|
|
9272
9274
|
this._globalDataPath = path.join(baseDataDir, this._appName);
|
|
9273
9275
|
}
|
|
@@ -9282,12 +9284,12 @@ class DataPathsManager extends EventEmitter3 {
|
|
|
9282
9284
|
};
|
|
9283
9285
|
}
|
|
9284
9286
|
}
|
|
9285
|
-
function
|
|
9286
|
-
return singleton("data-paths-opentui", () => new
|
|
9287
|
+
function getDataPaths2() {
|
|
9288
|
+
return singleton("data-paths-opentui", () => new DataPathsManager2);
|
|
9287
9289
|
}
|
|
9288
9290
|
// src/lib/tree-sitter/resolve-ft.ts
|
|
9289
9291
|
import path2 from "path";
|
|
9290
|
-
var
|
|
9292
|
+
var extensionToFiletype2 = new Map([
|
|
9291
9293
|
["astro", "astro"],
|
|
9292
9294
|
["bash", "bash"],
|
|
9293
9295
|
["c", "c"],
|
|
@@ -9385,7 +9387,7 @@ var extensionToFiletype = new Map([
|
|
|
9385
9387
|
["java", "java"],
|
|
9386
9388
|
["css", "css"]
|
|
9387
9389
|
]);
|
|
9388
|
-
var
|
|
9390
|
+
var basenameToFiletype2 = new Map([
|
|
9389
9391
|
[".bash_aliases", "bash"],
|
|
9390
9392
|
[".bash_logout", "bash"],
|
|
9391
9393
|
[".bash_profile", "bash"],
|
|
@@ -9423,43 +9425,43 @@ function getBasename(value) {
|
|
|
9423
9425
|
const normalizedValue = value.trim().replaceAll("\\", "/");
|
|
9424
9426
|
if (!normalizedValue)
|
|
9425
9427
|
return;
|
|
9426
|
-
const
|
|
9427
|
-
return
|
|
9428
|
+
const basename = path2.posix.basename(normalizedValue).toLowerCase();
|
|
9429
|
+
return basename || undefined;
|
|
9428
9430
|
}
|
|
9429
|
-
function
|
|
9431
|
+
function extToFiletype2(extension) {
|
|
9430
9432
|
const normalizedExtension = normalizeFiletypeToken(extension);
|
|
9431
9433
|
if (!normalizedExtension)
|
|
9432
9434
|
return;
|
|
9433
|
-
return
|
|
9435
|
+
return extensionToFiletype2.get(normalizedExtension);
|
|
9434
9436
|
}
|
|
9435
|
-
function
|
|
9436
|
-
if (typeof
|
|
9437
|
+
function pathToFiletype2(path) {
|
|
9438
|
+
if (typeof path !== "string")
|
|
9437
9439
|
return;
|
|
9438
|
-
const
|
|
9439
|
-
if (!
|
|
9440
|
+
const basename = getBasename(path);
|
|
9441
|
+
if (!basename)
|
|
9440
9442
|
return;
|
|
9441
|
-
const basenameFiletype =
|
|
9443
|
+
const basenameFiletype = basenameToFiletype2.get(basename);
|
|
9442
9444
|
if (basenameFiletype) {
|
|
9443
9445
|
return basenameFiletype;
|
|
9444
9446
|
}
|
|
9445
|
-
const lastDot =
|
|
9446
|
-
if (lastDot === -1 || lastDot ===
|
|
9447
|
+
const lastDot = basename.lastIndexOf(".");
|
|
9448
|
+
if (lastDot === -1 || lastDot === basename.length - 1) {
|
|
9447
9449
|
return;
|
|
9448
9450
|
}
|
|
9449
|
-
const extension =
|
|
9450
|
-
return
|
|
9451
|
+
const extension = basename.substring(lastDot + 1);
|
|
9452
|
+
return extToFiletype2(extension);
|
|
9451
9453
|
}
|
|
9452
|
-
function
|
|
9454
|
+
function infoStringToFiletype2(infoString) {
|
|
9453
9455
|
if (typeof infoString !== "string")
|
|
9454
9456
|
return;
|
|
9455
9457
|
const token = infoString.trim().split(/\s+/, 1)[0];
|
|
9456
|
-
const directBasenameMatch =
|
|
9458
|
+
const directBasenameMatch = basenameToFiletype2.get(token.toLowerCase());
|
|
9457
9459
|
if (directBasenameMatch)
|
|
9458
9460
|
return directBasenameMatch;
|
|
9459
9461
|
const normalizedToken = normalizeFiletypeToken(token);
|
|
9460
9462
|
if (!normalizedToken)
|
|
9461
9463
|
return;
|
|
9462
|
-
return
|
|
9464
|
+
return basenameToFiletype2.get(normalizedToken) ?? pathToFiletype2(normalizedToken) ?? extToFiletype2(normalizedToken) ?? normalizedToken;
|
|
9463
9465
|
}
|
|
9464
9466
|
|
|
9465
9467
|
// src/lib/tree-sitter/index.ts
|
|
@@ -9468,17 +9470,17 @@ var TREE_SITTER_CLIENT_LISTENER_STATE_KEY = "tree-sitter-client-listener-state";
|
|
|
9468
9470
|
function getTreeSitterClientListenerState() {
|
|
9469
9471
|
return singleton(TREE_SITTER_CLIENT_LISTENER_STATE_KEY, () => ({}));
|
|
9470
9472
|
}
|
|
9471
|
-
function
|
|
9473
|
+
function getTreeSitterClient2() {
|
|
9472
9474
|
const existingClient = getSingleton(TREE_SITTER_CLIENT_KEY);
|
|
9473
9475
|
if (existingClient) {
|
|
9474
9476
|
return existingClient;
|
|
9475
9477
|
}
|
|
9476
|
-
const dataPathsManager =
|
|
9478
|
+
const dataPathsManager = getDataPaths2();
|
|
9477
9479
|
const defaultOptions = {
|
|
9478
9480
|
dataPath: dataPathsManager.globalDataPath
|
|
9479
9481
|
};
|
|
9480
9482
|
return singleton(TREE_SITTER_CLIENT_KEY, () => {
|
|
9481
|
-
const client2 = new
|
|
9483
|
+
const client2 = new TreeSitterClient2(defaultOptions);
|
|
9482
9484
|
const listenerState = getTreeSitterClientListenerState();
|
|
9483
9485
|
const handlePathsChanged = (paths) => {
|
|
9484
9486
|
client2.setDataPath(paths.globalDataPath).catch((error) => {
|
|
@@ -9500,7 +9502,7 @@ function getTreeSitterClient() {
|
|
|
9500
9502
|
return client2;
|
|
9501
9503
|
});
|
|
9502
9504
|
}
|
|
9503
|
-
async function
|
|
9505
|
+
async function destroyTreeSitterClient2() {
|
|
9504
9506
|
const client2 = getSingleton(TREE_SITTER_CLIENT_KEY);
|
|
9505
9507
|
if (!client2) {
|
|
9506
9508
|
const listenerState = getSingleton(TREE_SITTER_CLIENT_LISTENER_STATE_KEY);
|
|
@@ -9554,7 +9556,7 @@ class ExtmarksHistory {
|
|
|
9554
9556
|
}
|
|
9555
9557
|
|
|
9556
9558
|
// src/lib/extmarks.ts
|
|
9557
|
-
class
|
|
9559
|
+
class ExtmarksController2 {
|
|
9558
9560
|
editBuffer;
|
|
9559
9561
|
editorView;
|
|
9560
9562
|
extmarks = new Map;
|
|
@@ -9761,11 +9763,11 @@ class ExtmarksController {
|
|
|
9761
9763
|
if (virtualExtmark && currentOffset === virtualExtmark.end) {
|
|
9762
9764
|
const startCursor = this.offsetToPosition(virtualExtmark.start);
|
|
9763
9765
|
const endCursor = this.offsetToPosition(virtualExtmark.end);
|
|
9764
|
-
const
|
|
9765
|
-
const
|
|
9766
|
+
const deleteOffset = virtualExtmark.start;
|
|
9767
|
+
const deleteLength = virtualExtmark.end - virtualExtmark.start;
|
|
9766
9768
|
this.deleteExtmarkById(virtualExtmark.id);
|
|
9767
9769
|
this.originalDeleteRange(startCursor.row, startCursor.col, endCursor.row, endCursor.col);
|
|
9768
|
-
this.adjustExtmarksAfterDeletion(
|
|
9770
|
+
this.adjustExtmarksAfterDeletion(deleteOffset, deleteLength);
|
|
9769
9771
|
this.updateHighlights();
|
|
9770
9772
|
return;
|
|
9771
9773
|
}
|
|
@@ -9794,10 +9796,10 @@ class ExtmarksController {
|
|
|
9794
9796
|
const startCursor = this.offsetToPosition(virtualExtmark.start);
|
|
9795
9797
|
const endCursor = this.offsetToPosition(virtualExtmark.end);
|
|
9796
9798
|
const deleteOffset = virtualExtmark.start;
|
|
9797
|
-
const
|
|
9799
|
+
const deleteLength = virtualExtmark.end - virtualExtmark.start;
|
|
9798
9800
|
this.deleteExtmarkById(virtualExtmark.id);
|
|
9799
9801
|
this.originalDeleteRange(startCursor.row, startCursor.col, endCursor.row, endCursor.col);
|
|
9800
|
-
this.adjustExtmarksAfterDeletion(deleteOffset,
|
|
9802
|
+
this.adjustExtmarksAfterDeletion(deleteOffset, deleteLength);
|
|
9801
9803
|
this.updateHighlights();
|
|
9802
9804
|
return;
|
|
9803
9805
|
}
|
|
@@ -10043,13 +10045,13 @@ class ExtmarksController {
|
|
|
10043
10045
|
j++;
|
|
10044
10046
|
}
|
|
10045
10047
|
const chunk = text.substring(i, j);
|
|
10046
|
-
const chunkWidth =
|
|
10048
|
+
const chunkWidth = stringWidth(chunk);
|
|
10047
10049
|
if (displayWidthSoFar + chunkWidth < offset) {
|
|
10048
10050
|
displayWidthSoFar += chunkWidth;
|
|
10049
10051
|
i = j;
|
|
10050
10052
|
} else {
|
|
10051
10053
|
for (let k = i;k < j && displayWidthSoFar < offset; k++) {
|
|
10052
|
-
const charWidth =
|
|
10054
|
+
const charWidth = stringWidth(text[k]);
|
|
10053
10055
|
displayWidthSoFar += charWidth;
|
|
10054
10056
|
}
|
|
10055
10057
|
break;
|
|
@@ -10232,12 +10234,12 @@ class ExtmarksController {
|
|
|
10232
10234
|
this.destroyed = true;
|
|
10233
10235
|
}
|
|
10234
10236
|
}
|
|
10235
|
-
function
|
|
10236
|
-
return new
|
|
10237
|
+
function createExtmarksController2(editBuffer, editorView) {
|
|
10238
|
+
return new ExtmarksController2(editBuffer, editorView);
|
|
10237
10239
|
}
|
|
10238
10240
|
// src/lib/terminal-palette.ts
|
|
10239
|
-
var SYSTEM_CLOCK2 = new
|
|
10240
|
-
|
|
10241
|
+
var SYSTEM_CLOCK2 = new SystemClock2;
|
|
10242
|
+
registerEnvVar2({
|
|
10241
10243
|
name: "OTUI_PALETTE_IDLE_TIMEOUT_MS",
|
|
10242
10244
|
description: "Milliseconds of silence after palette queries before using fallback colors.",
|
|
10243
10245
|
type: "number",
|
|
@@ -10262,7 +10264,7 @@ function wrapForTmux(osc) {
|
|
|
10262
10264
|
return `\x1BPtmux;${escaped}\x1B\\`;
|
|
10263
10265
|
}
|
|
10264
10266
|
|
|
10265
|
-
class
|
|
10267
|
+
class TerminalPalette2 {
|
|
10266
10268
|
stdin;
|
|
10267
10269
|
stdout;
|
|
10268
10270
|
writeFn;
|
|
@@ -10355,7 +10357,7 @@ class TerminalPalette {
|
|
|
10355
10357
|
const out = this.stdout;
|
|
10356
10358
|
if (!out.isTTY || !this.stdin.isTTY)
|
|
10357
10359
|
return false;
|
|
10358
|
-
return new Promise((
|
|
10360
|
+
return new Promise((resolve) => {
|
|
10359
10361
|
const session = this.createQuerySession();
|
|
10360
10362
|
let buffer = "";
|
|
10361
10363
|
let settled = false;
|
|
@@ -10364,7 +10366,7 @@ class TerminalPalette {
|
|
|
10364
10366
|
return;
|
|
10365
10367
|
settled = true;
|
|
10366
10368
|
session.cleanup();
|
|
10367
|
-
|
|
10369
|
+
resolve(supported);
|
|
10368
10370
|
};
|
|
10369
10371
|
const onData = (chunk) => {
|
|
10370
10372
|
buffer += chunk.toString();
|
|
@@ -10380,14 +10382,14 @@ class TerminalPalette {
|
|
|
10380
10382
|
this.writeOsc("\x1B]4;0;?\x07", true);
|
|
10381
10383
|
});
|
|
10382
10384
|
}
|
|
10383
|
-
async queryPalette(indices, timeoutMs = 1200, idleTimeoutMs =
|
|
10385
|
+
async queryPalette(indices, timeoutMs = 1200, idleTimeoutMs = env2.OTUI_PALETTE_IDLE_TIMEOUT_MS) {
|
|
10384
10386
|
const out = this.stdout;
|
|
10385
10387
|
const results = new Map;
|
|
10386
10388
|
indices.forEach((i) => results.set(i, null));
|
|
10387
10389
|
if (!out.isTTY || !this.stdin.isTTY) {
|
|
10388
10390
|
return results;
|
|
10389
10391
|
}
|
|
10390
|
-
return new Promise((
|
|
10392
|
+
return new Promise((resolve) => {
|
|
10391
10393
|
const session = this.createQuerySession();
|
|
10392
10394
|
let buffer = "";
|
|
10393
10395
|
let idleTimer = null;
|
|
@@ -10397,7 +10399,7 @@ class TerminalPalette {
|
|
|
10397
10399
|
return;
|
|
10398
10400
|
settled = true;
|
|
10399
10401
|
session.cleanup();
|
|
10400
|
-
|
|
10402
|
+
resolve(results);
|
|
10401
10403
|
};
|
|
10402
10404
|
const onData = (chunk) => {
|
|
10403
10405
|
buffer += chunk.toString();
|
|
@@ -10423,7 +10425,7 @@ class TerminalPalette {
|
|
|
10423
10425
|
idleTimer = session.resetTimer(idleTimer, finish, idleTimeoutMs);
|
|
10424
10426
|
});
|
|
10425
10427
|
}
|
|
10426
|
-
async querySpecialColors(timeoutMs = 1200, idleTimeoutMs =
|
|
10428
|
+
async querySpecialColors(timeoutMs = 1200, idleTimeoutMs = env2.OTUI_PALETTE_IDLE_TIMEOUT_MS) {
|
|
10427
10429
|
const out = this.stdout;
|
|
10428
10430
|
const results = {
|
|
10429
10431
|
10: null,
|
|
@@ -10440,7 +10442,7 @@ class TerminalPalette {
|
|
|
10440
10442
|
if (!out.isTTY || !this.stdin.isTTY) {
|
|
10441
10443
|
return results;
|
|
10442
10444
|
}
|
|
10443
|
-
return new Promise((
|
|
10445
|
+
return new Promise((resolve) => {
|
|
10444
10446
|
const session = this.createQuerySession();
|
|
10445
10447
|
let buffer = "";
|
|
10446
10448
|
let idleTimer = null;
|
|
@@ -10450,7 +10452,7 @@ class TerminalPalette {
|
|
|
10450
10452
|
return;
|
|
10451
10453
|
settled = true;
|
|
10452
10454
|
session.cleanup();
|
|
10453
|
-
|
|
10455
|
+
resolve(results);
|
|
10454
10456
|
};
|
|
10455
10457
|
const onData = (chunk) => {
|
|
10456
10458
|
buffer += chunk.toString();
|
|
@@ -10498,7 +10500,7 @@ class TerminalPalette {
|
|
|
10498
10500
|
};
|
|
10499
10501
|
}
|
|
10500
10502
|
const indicesToQuery = [...Array(size).keys()];
|
|
10501
|
-
const idleTimeout =
|
|
10503
|
+
const idleTimeout = env2.OTUI_PALETTE_IDLE_TIMEOUT_MS;
|
|
10502
10504
|
const [paletteResults, specialColors] = await Promise.all([
|
|
10503
10505
|
this.queryPalette(indicesToQuery, timeout, idleTimeout),
|
|
10504
10506
|
this.querySpecialColors(timeout, idleTimeout)
|
|
@@ -10517,34 +10519,34 @@ class TerminalPalette {
|
|
|
10517
10519
|
};
|
|
10518
10520
|
}
|
|
10519
10521
|
}
|
|
10520
|
-
function
|
|
10521
|
-
return new
|
|
10522
|
+
function createTerminalPalette2(options) {
|
|
10523
|
+
return new TerminalPalette2(options);
|
|
10522
10524
|
}
|
|
10523
|
-
var DEFAULT_FOREGROUND_FALLBACK =
|
|
10524
|
-
var DEFAULT_BACKGROUND_FALLBACK =
|
|
10525
|
+
var DEFAULT_FOREGROUND_FALLBACK = RGBA2.fromInts(...DEFAULT_FOREGROUND_RGB2);
|
|
10526
|
+
var DEFAULT_BACKGROUND_FALLBACK = RGBA2.fromInts(...DEFAULT_BACKGROUND_RGB2);
|
|
10525
10527
|
var fallbackAnsi256Palette = null;
|
|
10526
10528
|
function getFallbackAnsi256Palette() {
|
|
10527
10529
|
if (!fallbackAnsi256Palette) {
|
|
10528
10530
|
fallbackAnsi256Palette = Array.from({ length: 256 }, (_, index) => {
|
|
10529
|
-
const [r, g, b] =
|
|
10530
|
-
return
|
|
10531
|
+
const [r, g, b] = ansi256IndexToRgb2(index);
|
|
10532
|
+
return RGBA2.fromInts(r, g, b);
|
|
10531
10533
|
});
|
|
10532
10534
|
}
|
|
10533
10535
|
return fallbackAnsi256Palette;
|
|
10534
10536
|
}
|
|
10535
|
-
function
|
|
10537
|
+
function normalizeTerminalPalette2(colors) {
|
|
10536
10538
|
const fallbackPalette = getFallbackAnsi256Palette();
|
|
10537
10539
|
return {
|
|
10538
10540
|
palette: Array.from({ length: 256 }, (_, index) => {
|
|
10539
10541
|
const detected = colors?.palette[index];
|
|
10540
|
-
return detected ?
|
|
10542
|
+
return detected ? RGBA2.fromHex(detected) : RGBA2.clone(fallbackPalette[index]);
|
|
10541
10543
|
}),
|
|
10542
|
-
defaultForeground: colors?.defaultForeground ?
|
|
10543
|
-
defaultBackground: colors?.defaultBackground ?
|
|
10544
|
+
defaultForeground: colors?.defaultForeground ? RGBA2.fromHex(colors.defaultForeground) : RGBA2.clone(DEFAULT_FOREGROUND_FALLBACK),
|
|
10545
|
+
defaultBackground: colors?.defaultBackground ? RGBA2.fromHex(colors.defaultBackground) : RGBA2.clone(DEFAULT_BACKGROUND_FALLBACK)
|
|
10544
10546
|
};
|
|
10545
10547
|
}
|
|
10546
|
-
function
|
|
10547
|
-
const normalized =
|
|
10548
|
+
function buildTerminalPaletteSignature2(colors) {
|
|
10549
|
+
const normalized = normalizeTerminalPalette2(colors);
|
|
10548
10550
|
const paletteSignature = normalized.palette.map((color) => color.toInts().join(",")).join(";");
|
|
10549
10551
|
return [
|
|
10550
10552
|
paletteSignature,
|
|
@@ -10554,10 +10556,10 @@ function buildTerminalPaletteSignature(colors) {
|
|
|
10554
10556
|
}
|
|
10555
10557
|
// src/lib/paste.ts
|
|
10556
10558
|
var PASTE_TEXT_DECODER = new TextDecoder;
|
|
10557
|
-
function
|
|
10559
|
+
function decodePasteBytes2(bytes) {
|
|
10558
10560
|
return PASTE_TEXT_DECODER.decode(bytes);
|
|
10559
10561
|
}
|
|
10560
|
-
function
|
|
10562
|
+
function stripAnsiSequences2(text) {
|
|
10561
10563
|
return stripANSI(text);
|
|
10562
10564
|
}
|
|
10563
10565
|
// src/lib/host-clipboard.internal.ts
|
|
@@ -10656,8 +10658,8 @@ var validateClipboardText = (text, maxWriteBytes) => {
|
|
|
10656
10658
|
var createActiveOperation = (callerSignal) => {
|
|
10657
10659
|
const controller = new AbortController;
|
|
10658
10660
|
let settle = () => {};
|
|
10659
|
-
const settled = new Promise((
|
|
10660
|
-
settle =
|
|
10661
|
+
const settled = new Promise((resolve) => {
|
|
10662
|
+
settle = resolve;
|
|
10661
10663
|
});
|
|
10662
10664
|
if (callerSignal) {
|
|
10663
10665
|
callerSignal.addEventListener("abort", () => controller.abort(callerSignal.reason), {
|
|
@@ -10684,7 +10686,7 @@ var runTrackedOperation = (active, callerSignal, operation) => {
|
|
|
10684
10686
|
};
|
|
10685
10687
|
var createHostClipboardWithBackend = (options, createBackend) => {
|
|
10686
10688
|
const config = normalizeOptions(options);
|
|
10687
|
-
const
|
|
10689
|
+
const backend = createBackend(config);
|
|
10688
10690
|
const active = new Set;
|
|
10689
10691
|
let disposed = false;
|
|
10690
10692
|
let disposePromise;
|
|
@@ -10704,7 +10706,7 @@ var createHostClipboardWithBackend = (options, createBackend) => {
|
|
|
10704
10706
|
if (config.timeoutMs === 0)
|
|
10705
10707
|
return Promise.resolve({ status: "timed-out" });
|
|
10706
10708
|
return runTrackedOperation(active, readOptions.signal, async (signal) => {
|
|
10707
|
-
const result = await
|
|
10709
|
+
const result = await backend.read({
|
|
10708
10710
|
preferredTypes,
|
|
10709
10711
|
selection,
|
|
10710
10712
|
maxBytes: config.maxReadBytes,
|
|
@@ -10730,7 +10732,7 @@ var createHostClipboardWithBackend = (options, createBackend) => {
|
|
|
10730
10732
|
return Promise.resolve({ status: "cancelled" });
|
|
10731
10733
|
if (config.timeoutMs === 0)
|
|
10732
10734
|
return Promise.resolve({ status: "timed-out" });
|
|
10733
|
-
return runTrackedOperation(active, operationOptions.signal, (signal) =>
|
|
10735
|
+
return runTrackedOperation(active, operationOptions.signal, (signal) => backend.writeText(text, { selection, timeoutMs: config.timeoutMs, signal }));
|
|
10734
10736
|
} catch (error) {
|
|
10735
10737
|
return Promise.reject(error);
|
|
10736
10738
|
}
|
|
@@ -10743,7 +10745,7 @@ var createHostClipboardWithBackend = (options, createBackend) => {
|
|
|
10743
10745
|
return Promise.resolve({ status: "cancelled" });
|
|
10744
10746
|
if (config.timeoutMs === 0)
|
|
10745
10747
|
return Promise.resolve({ status: "timed-out" });
|
|
10746
|
-
return runTrackedOperation(active, operationOptions.signal, (signal) =>
|
|
10748
|
+
return runTrackedOperation(active, operationOptions.signal, (signal) => backend.clear({ selection, timeoutMs: config.timeoutMs, signal }));
|
|
10747
10749
|
} catch (error) {
|
|
10748
10750
|
return Promise.reject(error);
|
|
10749
10751
|
}
|
|
@@ -10756,7 +10758,7 @@ var createHostClipboardWithBackend = (options, createBackend) => {
|
|
|
10756
10758
|
operation.controller.abort();
|
|
10757
10759
|
disposePromise = (async () => {
|
|
10758
10760
|
await Promise.all([...active].map((operation) => operation.settled));
|
|
10759
|
-
await
|
|
10761
|
+
await backend.dispose();
|
|
10760
10762
|
})();
|
|
10761
10763
|
return disposePromise;
|
|
10762
10764
|
}
|
|
@@ -10787,7 +10789,7 @@ var encodeReadRequest = (preferredTypes) => {
|
|
|
10787
10789
|
};
|
|
10788
10790
|
var startFailure = (status) => ({
|
|
10789
10791
|
status: "failed",
|
|
10790
|
-
error: new Error(`Native clipboard operation failed to start (${
|
|
10792
|
+
error: new Error(`Native clipboard operation failed to start (${NativeClipboardStartStatus2[status]})`)
|
|
10791
10793
|
});
|
|
10792
10794
|
|
|
10793
10795
|
class NativeClipboardBackend {
|
|
@@ -10804,7 +10806,7 @@ class NativeClipboardBackend {
|
|
|
10804
10806
|
constructor(maxImagePixels, maxConversionBytes, maxConcurrentOperations, maxProviderTransfers, waylandSeat) {
|
|
10805
10807
|
this.maxImagePixels = maxImagePixels;
|
|
10806
10808
|
this.maxConversionBytes = maxConversionBytes;
|
|
10807
|
-
this.library =
|
|
10809
|
+
this.library = resolveRenderLib2();
|
|
10808
10810
|
const service = this.library.clipboardServiceCreate(maxConcurrentOperations, maxProviderTransfers, waylandSeat);
|
|
10809
10811
|
if (!service)
|
|
10810
10812
|
throw new Error("Failed to create native clipboard service");
|
|
@@ -10836,8 +10838,8 @@ class NativeClipboardBackend {
|
|
|
10836
10838
|
if (started.status !== 0 /* Ok */ || !started.operation) {
|
|
10837
10839
|
return Promise.resolve(startFailure(started.status));
|
|
10838
10840
|
}
|
|
10839
|
-
return new Promise((
|
|
10840
|
-
const operation = { handle: started.operation, kind, signal, resolve
|
|
10841
|
+
return new Promise((resolve, reject) => {
|
|
10842
|
+
const operation = { handle: started.operation, kind, signal, resolve, reject };
|
|
10841
10843
|
this.pending.set(operation.handle, operation);
|
|
10842
10844
|
signal.addEventListener("abort", () => this.requestCancel(operation), { once: true });
|
|
10843
10845
|
this.ensureScheduled();
|
|
@@ -10910,14 +10912,14 @@ class NativeClipboardBackend {
|
|
|
10910
10912
|
try {
|
|
10911
10913
|
this.library.clipboardOperationCancel(operation.handle);
|
|
10912
10914
|
} catch {}
|
|
10913
|
-
const
|
|
10914
|
-
if (
|
|
10915
|
+
const status = this.library.clipboardOperationPoll(operation.handle);
|
|
10916
|
+
if (status === 0 /* Pending */) {
|
|
10915
10917
|
this.rotate(operation);
|
|
10916
10918
|
continue;
|
|
10917
10919
|
}
|
|
10918
10920
|
this.providerActive = true;
|
|
10919
|
-
const
|
|
10920
|
-
if (
|
|
10921
|
+
const destroyed = this.library.clipboardOperationDestroy(operation.handle);
|
|
10922
|
+
if (destroyed === 1 /* NotReady */) {
|
|
10921
10923
|
this.rotate(operation);
|
|
10922
10924
|
continue;
|
|
10923
10925
|
}
|
|
@@ -10982,7 +10984,7 @@ class NativeClipboardBackend {
|
|
|
10982
10984
|
invalidResult(kind, status) {
|
|
10983
10985
|
return {
|
|
10984
10986
|
status: "failed",
|
|
10985
|
-
error: new Error(`Native clipboard ${kind} returned inapplicable status ${
|
|
10987
|
+
error: new Error(`Native clipboard ${kind} returned inapplicable status ${NativeClipboardOperationStatus2[status]}`)
|
|
10986
10988
|
};
|
|
10987
10989
|
}
|
|
10988
10990
|
readRepresentation(handle) {
|
|
@@ -11014,7 +11016,7 @@ class NativeClipboardBackend {
|
|
|
11014
11016
|
this.clearPollTimer();
|
|
11015
11017
|
let status = this.library.clipboardServiceBeginShutdown(this.service);
|
|
11016
11018
|
while (status === 0 /* Pending */) {
|
|
11017
|
-
await new Promise((
|
|
11019
|
+
await new Promise((resolve) => setTimeout(resolve, SHUTDOWN_POLL_INTERVAL_MS));
|
|
11018
11020
|
status = this.library.clipboardServicePollShutdown(this.service);
|
|
11019
11021
|
}
|
|
11020
11022
|
if (status !== 1 /* Ready */)
|
|
@@ -11038,13 +11040,13 @@ var validateSelection = (selection) => {
|
|
|
11038
11040
|
}
|
|
11039
11041
|
return normalized;
|
|
11040
11042
|
};
|
|
11041
|
-
var
|
|
11043
|
+
var createHostClipboard2 = (options = {}) => createHostClipboardWithBackend(options, createNativeHostClipboardBackend);
|
|
11042
11044
|
var validateDestination = (destination) => {
|
|
11043
11045
|
if (destination !== "terminal-only" && destination !== "host-only" && destination !== "best-available" && destination !== "all-available") {
|
|
11044
11046
|
throw new TypeError("destination is not a supported clipboard policy");
|
|
11045
11047
|
}
|
|
11046
11048
|
};
|
|
11047
|
-
var
|
|
11049
|
+
var createClipboard2 = ({ host, terminal }) => {
|
|
11048
11050
|
const active = new Set;
|
|
11049
11051
|
let disposed = false;
|
|
11050
11052
|
let disposePromise;
|
|
@@ -11066,8 +11068,8 @@ var createClipboard = ({ host, terminal }) => {
|
|
|
11066
11068
|
return { host: { status: "not-attempted" }, terminal: terminalOperation() };
|
|
11067
11069
|
}
|
|
11068
11070
|
const hostResult = await hostOperation();
|
|
11069
|
-
const
|
|
11070
|
-
return { host: hostResult, terminal:
|
|
11071
|
+
const terminalResult = !signal.aborted && (hostResult.status === "unsupported" || hostResult.status === "failed") ? terminalOperation() : NOT_ATTEMPTED_TERMINAL;
|
|
11072
|
+
return { host: hostResult, terminal: terminalResult };
|
|
11071
11073
|
}
|
|
11072
11074
|
const hostPromise = canUseRemoteHost(options) ? hostOperation() : Promise.resolve({ status: "not-attempted" });
|
|
11073
11075
|
const terminalResult = terminalOperation();
|
|
@@ -11129,14 +11131,14 @@ var createClipboard = ({ host, terminal }) => {
|
|
|
11129
11131
|
}
|
|
11130
11132
|
};
|
|
11131
11133
|
};
|
|
11132
|
-
var
|
|
11133
|
-
((
|
|
11134
|
-
|
|
11135
|
-
|
|
11136
|
-
|
|
11137
|
-
|
|
11138
|
-
})(
|
|
11139
|
-
var
|
|
11134
|
+
var ClipboardTarget2;
|
|
11135
|
+
((ClipboardTarget) => {
|
|
11136
|
+
ClipboardTarget[ClipboardTarget["Clipboard"] = 0] = "Clipboard";
|
|
11137
|
+
ClipboardTarget[ClipboardTarget["Primary"] = 1] = "Primary";
|
|
11138
|
+
ClipboardTarget[ClipboardTarget["Select"] = 2] = "Select";
|
|
11139
|
+
ClipboardTarget[ClipboardTarget["Secondary"] = 3] = "Secondary";
|
|
11140
|
+
})(ClipboardTarget2 ||= {});
|
|
11141
|
+
var createRendererClipboardAdapter2 = (renderer) => {
|
|
11140
11142
|
const targetFor = (selection) => selection === "primary" ? 1 /* Primary */ : 0 /* Clipboard */;
|
|
11141
11143
|
const capability = () => renderer.capabilities?.osc52_support ?? "unknown";
|
|
11142
11144
|
return {
|
|
@@ -11164,7 +11166,7 @@ var createRendererClipboardAdapter = (renderer) => {
|
|
|
11164
11166
|
};
|
|
11165
11167
|
};
|
|
11166
11168
|
|
|
11167
|
-
class
|
|
11169
|
+
class Clipboard2 {
|
|
11168
11170
|
lib;
|
|
11169
11171
|
rendererPtr;
|
|
11170
11172
|
constructor(lib, rendererPtr) {
|
|
@@ -11191,44 +11193,163 @@ class Clipboard {
|
|
|
11191
11193
|
}
|
|
11192
11194
|
// src/lib/detect-links.ts
|
|
11193
11195
|
var URL_SCOPES = ["markup.link.url", "string.special.url"];
|
|
11194
|
-
|
|
11196
|
+
var HTTP_URL_PREFIX = /https?:\/\//i;
|
|
11197
|
+
var BARE_URL = /https?:\/\/[^\s<>"`]+/gi;
|
|
11198
|
+
function normalizeMarkdownLinkTarget(destination) {
|
|
11199
|
+
return destination.replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g, "$1");
|
|
11200
|
+
}
|
|
11201
|
+
function detectLinks2(chunks, context) {
|
|
11195
11202
|
const content = context.content;
|
|
11196
11203
|
const highlights = context.highlights;
|
|
11204
|
+
const hasBareUrl = HTTP_URL_PREFIX.test(content);
|
|
11205
|
+
if (!hasBareUrl && !highlights.some(([, , group]) => URL_SCOPES.includes(group)))
|
|
11206
|
+
return chunks;
|
|
11197
11207
|
const ranges = [];
|
|
11208
|
+
const rawRanges = [];
|
|
11209
|
+
const labels = new Map;
|
|
11210
|
+
const concealedDelimiters = new Map;
|
|
11198
11211
|
for (let i = 0;i < highlights.length; i++) {
|
|
11199
|
-
const [start, end, group] = highlights[i];
|
|
11212
|
+
const [start, end, group, meta] = highlights[i];
|
|
11213
|
+
if (group === "conceal" && meta?.conceal === "" && /^[*_~]+$/.test(content.slice(start, end))) {
|
|
11214
|
+
concealedDelimiters.set(end, start);
|
|
11215
|
+
}
|
|
11216
|
+
if (group === "markup.raw" || group.startsWith("markup.raw.")) {
|
|
11217
|
+
rawRanges.push({ start, end });
|
|
11218
|
+
}
|
|
11219
|
+
if (group === "markup.link.label") {
|
|
11220
|
+
const existing = labels.get(end);
|
|
11221
|
+
if (!existing || start < existing.start)
|
|
11222
|
+
labels.set(end, { start, end });
|
|
11223
|
+
}
|
|
11200
11224
|
if (!URL_SCOPES.includes(group))
|
|
11201
11225
|
continue;
|
|
11202
11226
|
const url = content.slice(start, end);
|
|
11227
|
+
if (!url)
|
|
11228
|
+
continue;
|
|
11203
11229
|
ranges.push({ start, end, url });
|
|
11204
|
-
|
|
11205
|
-
|
|
11206
|
-
|
|
11207
|
-
|
|
11208
|
-
|
|
11230
|
+
}
|
|
11231
|
+
const highlightedCount = ranges.length;
|
|
11232
|
+
for (let index = 0;index < highlightedCount; index++) {
|
|
11233
|
+
const range = ranges[index];
|
|
11234
|
+
let labelEnd = range.start;
|
|
11235
|
+
if (content[labelEnd - 1] === "<")
|
|
11236
|
+
labelEnd--;
|
|
11237
|
+
while (labelEnd > 0 && /\s/.test(content[labelEnd - 1]))
|
|
11238
|
+
labelEnd--;
|
|
11239
|
+
if (content[labelEnd - 1] !== "(" || content[labelEnd - 2] !== "]")
|
|
11240
|
+
continue;
|
|
11241
|
+
const label = labels.get(labelEnd - 2);
|
|
11242
|
+
if (!label)
|
|
11243
|
+
continue;
|
|
11244
|
+
range.url = normalizeMarkdownLinkTarget(range.url);
|
|
11245
|
+
ranges.push({ ...label, url: range.url, label: true });
|
|
11246
|
+
}
|
|
11247
|
+
if (hasBareUrl) {
|
|
11248
|
+
rawRanges.sort((a, b) => a.start - b.start || b.end - a.end);
|
|
11249
|
+
ranges.sort((a, b) => a.start - b.start || b.end - a.end);
|
|
11250
|
+
let rawIndex = 0;
|
|
11251
|
+
let highlightedIndex = 0;
|
|
11252
|
+
for (const match of content.matchAll(BARE_URL)) {
|
|
11253
|
+
const start = match.index;
|
|
11254
|
+
let url = match[0];
|
|
11255
|
+
let openParens = 0;
|
|
11256
|
+
let closeParens = 0;
|
|
11257
|
+
for (const character of url) {
|
|
11258
|
+
if (character === "(")
|
|
11259
|
+
openParens++;
|
|
11260
|
+
if (character === ")")
|
|
11261
|
+
closeParens++;
|
|
11209
11262
|
}
|
|
11210
|
-
|
|
11211
|
-
|
|
11263
|
+
while (url.length > 0) {
|
|
11264
|
+
const delimiterStart = concealedDelimiters.get(start + url.length);
|
|
11265
|
+
if (delimiterStart !== undefined && delimiterStart >= start) {
|
|
11266
|
+
url = url.slice(0, delimiterStart - start);
|
|
11267
|
+
continue;
|
|
11268
|
+
}
|
|
11269
|
+
const last = url[url.length - 1];
|
|
11270
|
+
if (last === ")" && closeParens > openParens) {
|
|
11271
|
+
closeParens--;
|
|
11272
|
+
} else if (!".,!?;:]}'".includes(last)) {
|
|
11273
|
+
break;
|
|
11274
|
+
}
|
|
11275
|
+
url = url.slice(0, -1);
|
|
11276
|
+
}
|
|
11277
|
+
const end = start + url.length;
|
|
11278
|
+
if (!url)
|
|
11279
|
+
continue;
|
|
11280
|
+
while (rawIndex < rawRanges.length && rawRanges[rawIndex].end <= start)
|
|
11281
|
+
rawIndex++;
|
|
11282
|
+
if (rawIndex < rawRanges.length && rawRanges[rawIndex].start < end)
|
|
11283
|
+
continue;
|
|
11284
|
+
while (highlightedIndex < ranges.length && ranges[highlightedIndex].end <= start)
|
|
11285
|
+
highlightedIndex++;
|
|
11286
|
+
if (highlightedIndex < ranges.length && ranges[highlightedIndex].start < end)
|
|
11287
|
+
continue;
|
|
11288
|
+
ranges.push({ start, end, url });
|
|
11212
11289
|
}
|
|
11213
11290
|
}
|
|
11214
11291
|
if (ranges.length === 0)
|
|
11215
11292
|
return chunks;
|
|
11293
|
+
ranges.sort((a, b) => a.start - b.start || b.end - a.end || Number(b.label ?? false) - Number(a.label ?? false));
|
|
11294
|
+
const linkedChunks = [];
|
|
11216
11295
|
let contentPos = 0;
|
|
11217
|
-
|
|
11218
|
-
|
|
11296
|
+
let rangeIndex = 0;
|
|
11297
|
+
for (let index = 0;index < chunks.length; index++) {
|
|
11298
|
+
const chunk = chunks[index];
|
|
11299
|
+
if (!chunk.text || chunk.link) {
|
|
11300
|
+
linkedChunks.push(chunk);
|
|
11219
11301
|
continue;
|
|
11220
|
-
|
|
11221
|
-
|
|
11302
|
+
}
|
|
11303
|
+
const providedRange = context.sourceRanges?.[index];
|
|
11304
|
+
const start = providedRange?.start ?? content.indexOf(chunk.text, contentPos);
|
|
11305
|
+
if (start < 0) {
|
|
11306
|
+
linkedChunks.push(chunk);
|
|
11222
11307
|
continue;
|
|
11223
|
-
|
|
11224
|
-
|
|
11308
|
+
}
|
|
11309
|
+
const end = providedRange?.end ?? start + chunk.text.length;
|
|
11310
|
+
contentPos = end;
|
|
11311
|
+
while (rangeIndex < ranges.length && ranges[rangeIndex].end <= start)
|
|
11312
|
+
rangeIndex++;
|
|
11313
|
+
if (content.slice(start, end) !== chunk.text) {
|
|
11314
|
+
const range = ranges[rangeIndex];
|
|
11315
|
+
if (range?.label && range.start < end)
|
|
11225
11316
|
chunk.link = { url: range.url };
|
|
11317
|
+
linkedChunks.push(chunk);
|
|
11318
|
+
continue;
|
|
11319
|
+
}
|
|
11320
|
+
let position = start;
|
|
11321
|
+
for (;rangeIndex < ranges.length; rangeIndex++) {
|
|
11322
|
+
const range = ranges[rangeIndex];
|
|
11323
|
+
if (range.end <= position)
|
|
11324
|
+
continue;
|
|
11325
|
+
if (range.start >= end)
|
|
11226
11326
|
break;
|
|
11327
|
+
const linkStart = Math.max(position, range.start);
|
|
11328
|
+
const linkEnd = Math.min(end, range.end);
|
|
11329
|
+
if (linkStart > position) {
|
|
11330
|
+
linkedChunks.push({ ...chunk, text: chunk.text.slice(position - start, linkStart - start) });
|
|
11227
11331
|
}
|
|
11332
|
+
if (linkStart === start && linkEnd === end) {
|
|
11333
|
+
chunk.link = { url: range.url };
|
|
11334
|
+
linkedChunks.push(chunk);
|
|
11335
|
+
} else {
|
|
11336
|
+
linkedChunks.push({
|
|
11337
|
+
...chunk,
|
|
11338
|
+
text: chunk.text.slice(linkStart - start, linkEnd - start),
|
|
11339
|
+
link: { url: range.url }
|
|
11340
|
+
});
|
|
11341
|
+
}
|
|
11342
|
+
position = linkEnd;
|
|
11343
|
+
if (position === end)
|
|
11344
|
+
break;
|
|
11345
|
+
}
|
|
11346
|
+
if (position === start) {
|
|
11347
|
+
linkedChunks.push(chunk);
|
|
11348
|
+
} else if (position < end) {
|
|
11349
|
+
linkedChunks.push({ ...chunk, text: chunk.text.slice(position - start) });
|
|
11228
11350
|
}
|
|
11229
|
-
contentPos = idx + chunk.text.length;
|
|
11230
11351
|
}
|
|
11231
|
-
return
|
|
11352
|
+
return linkedChunks;
|
|
11232
11353
|
}
|
|
11233
11354
|
// src/buffer.ts
|
|
11234
11355
|
function requireInteger(value, name, min, max) {
|
|
@@ -11236,18 +11357,18 @@ function requireInteger(value, name, min, max) {
|
|
|
11236
11357
|
throw new RangeError(`${name} must be an integer from ${min} to ${max}`);
|
|
11237
11358
|
}
|
|
11238
11359
|
}
|
|
11239
|
-
function packDrawOptions(
|
|
11360
|
+
function packDrawOptions(border, shouldFill, titleAlignment, bottomTitleAlignment) {
|
|
11240
11361
|
let packed = 0;
|
|
11241
|
-
if (
|
|
11362
|
+
if (border === true) {
|
|
11242
11363
|
packed |= 15;
|
|
11243
|
-
} else if (Array.isArray(
|
|
11244
|
-
if (
|
|
11364
|
+
} else if (Array.isArray(border)) {
|
|
11365
|
+
if (border.includes("top"))
|
|
11245
11366
|
packed |= 8;
|
|
11246
|
-
if (
|
|
11367
|
+
if (border.includes("right"))
|
|
11247
11368
|
packed |= 4;
|
|
11248
|
-
if (
|
|
11369
|
+
if (border.includes("bottom"))
|
|
11249
11370
|
packed |= 2;
|
|
11250
|
-
if (
|
|
11371
|
+
if (border.includes("left"))
|
|
11251
11372
|
packed |= 1;
|
|
11252
11373
|
}
|
|
11253
11374
|
if (shouldFill) {
|
|
@@ -11265,7 +11386,7 @@ function packDrawOptions(border2, shouldFill, titleAlignment, bottomTitleAlignme
|
|
|
11265
11386
|
return packed;
|
|
11266
11387
|
}
|
|
11267
11388
|
|
|
11268
|
-
class
|
|
11389
|
+
class OptimizedBuffer2 {
|
|
11269
11390
|
static fbIdCounter = 0;
|
|
11270
11391
|
id;
|
|
11271
11392
|
lib;
|
|
@@ -11304,17 +11425,17 @@ class OptimizedBuffer {
|
|
|
11304
11425
|
this.ensureRawBufferViews();
|
|
11305
11426
|
return this._rawBuffers;
|
|
11306
11427
|
}
|
|
11307
|
-
constructor(lib,
|
|
11308
|
-
this.id = options.id || `fb_${
|
|
11428
|
+
constructor(lib, ptr, width, height, options) {
|
|
11429
|
+
this.id = options.id || `fb_${OptimizedBuffer2.fbIdCounter++}`;
|
|
11309
11430
|
this.lib = lib;
|
|
11310
11431
|
this.respectAlpha = options.respectAlpha || false;
|
|
11311
11432
|
this._width = width;
|
|
11312
11433
|
this._height = height;
|
|
11313
11434
|
this._widthMethod = options.widthMethod || "unicode";
|
|
11314
|
-
this.bufferPtr =
|
|
11435
|
+
this.bufferPtr = ptr;
|
|
11315
11436
|
}
|
|
11316
11437
|
static create(width, height, widthMethod, options = {}) {
|
|
11317
|
-
const lib =
|
|
11438
|
+
const lib = resolveRenderLib2();
|
|
11318
11439
|
const respectAlpha = options.respectAlpha || false;
|
|
11319
11440
|
const id = options.id && options.id.trim() !== "" ? options.id : "unnamed buffer";
|
|
11320
11441
|
const buffer = lib.createOptimizedBuffer(width, height, widthMethod, respectAlpha, id);
|
|
@@ -11347,7 +11468,7 @@ class OptimizedBuffer {
|
|
|
11347
11468
|
}
|
|
11348
11469
|
getSpanLines() {
|
|
11349
11470
|
this.guard();
|
|
11350
|
-
const { char, fg
|
|
11471
|
+
const { char, fg, bg, attributes } = this.buffers;
|
|
11351
11472
|
const lines = [];
|
|
11352
11473
|
const CHAR_FLAG_CONTINUATION = 3221225472 | 0;
|
|
11353
11474
|
const CHAR_FLAG_MASK = 3221225472 | 0;
|
|
@@ -11362,8 +11483,8 @@ class OptimizedBuffer {
|
|
|
11362
11483
|
for (let x = 0;x < this._width; x++) {
|
|
11363
11484
|
const i = y * this._width + x;
|
|
11364
11485
|
const cp = char[i];
|
|
11365
|
-
const cellFg =
|
|
11366
|
-
const cellBg =
|
|
11486
|
+
const cellFg = RGBA2.fromArray(fg.slice(i * 4, i * 4 + 4));
|
|
11487
|
+
const cellBg = RGBA2.fromArray(bg.slice(i * 4, i * 4 + 4));
|
|
11367
11488
|
const cellAttrs = attributes[i] & 255;
|
|
11368
11489
|
const isContinuation = (cp & CHAR_FLAG_MASK) === CHAR_FLAG_CONTINUATION;
|
|
11369
11490
|
const cellChar = isContinuation ? "" : lineChars[charIdx++] ?? " ";
|
|
@@ -11390,38 +11511,38 @@ class OptimizedBuffer {
|
|
|
11390
11511
|
}
|
|
11391
11512
|
return lines;
|
|
11392
11513
|
}
|
|
11393
|
-
clear(
|
|
11514
|
+
clear(bg = RGBA2.fromValues(0, 0, 0, 1)) {
|
|
11394
11515
|
this.guard();
|
|
11395
|
-
this.lib.bufferClear(this.bufferPtr,
|
|
11516
|
+
this.lib.bufferClear(this.bufferPtr, bg);
|
|
11396
11517
|
}
|
|
11397
|
-
setCell(x, y, char,
|
|
11518
|
+
setCell(x, y, char, fg, bg, attributes = 0) {
|
|
11398
11519
|
this.guard();
|
|
11399
|
-
this.lib.bufferSetCell(this.bufferPtr, x, y, char,
|
|
11520
|
+
this.lib.bufferSetCell(this.bufferPtr, x, y, char, fg, bg, attributes);
|
|
11400
11521
|
}
|
|
11401
|
-
setCellWithAlphaBlending(x, y, char,
|
|
11522
|
+
setCellWithAlphaBlending(x, y, char, fg, bg, attributes = 0) {
|
|
11402
11523
|
this.guard();
|
|
11403
|
-
this.lib.bufferSetCellWithAlphaBlending(this.bufferPtr, x, y, char,
|
|
11524
|
+
this.lib.bufferSetCellWithAlphaBlending(this.bufferPtr, x, y, char, fg, bg, attributes);
|
|
11404
11525
|
}
|
|
11405
|
-
drawText(text, x, y,
|
|
11526
|
+
drawText(text, x, y, fg, bg, attributes = 0, selection) {
|
|
11406
11527
|
this.guard();
|
|
11407
|
-
if (!
|
|
11408
|
-
this.lib.bufferDrawText(this.bufferPtr, text, x, y,
|
|
11528
|
+
if (!selection) {
|
|
11529
|
+
this.lib.bufferDrawText(this.bufferPtr, text, x, y, fg, bg, attributes);
|
|
11409
11530
|
return;
|
|
11410
11531
|
}
|
|
11411
|
-
const { start, end } =
|
|
11532
|
+
const { start, end } = selection;
|
|
11412
11533
|
let selectionBg;
|
|
11413
11534
|
let selectionFg;
|
|
11414
|
-
if (
|
|
11415
|
-
selectionBg =
|
|
11416
|
-
selectionFg =
|
|
11535
|
+
if (selection.bgColor) {
|
|
11536
|
+
selectionBg = selection.bgColor;
|
|
11537
|
+
selectionFg = selection.fgColor || fg;
|
|
11417
11538
|
} else {
|
|
11418
|
-
const defaultBg =
|
|
11419
|
-
selectionFg = defaultBg.a > 0 ? defaultBg :
|
|
11420
|
-
selectionBg =
|
|
11539
|
+
const defaultBg = bg || RGBA2.fromValues(0, 0, 0, 0);
|
|
11540
|
+
selectionFg = defaultBg.a > 0 ? defaultBg : RGBA2.fromValues(0, 0, 0, 1);
|
|
11541
|
+
selectionBg = fg;
|
|
11421
11542
|
}
|
|
11422
11543
|
if (start > 0) {
|
|
11423
11544
|
const beforeText = text.slice(0, start);
|
|
11424
|
-
this.lib.bufferDrawText(this.bufferPtr, beforeText, x, y,
|
|
11545
|
+
this.lib.bufferDrawText(this.bufferPtr, beforeText, x, y, fg, bg, attributes);
|
|
11425
11546
|
}
|
|
11426
11547
|
if (end > start) {
|
|
11427
11548
|
const selectedText = text.slice(start, end);
|
|
@@ -11429,12 +11550,12 @@ class OptimizedBuffer {
|
|
|
11429
11550
|
}
|
|
11430
11551
|
if (end < text.length) {
|
|
11431
11552
|
const afterText = text.slice(end);
|
|
11432
|
-
this.lib.bufferDrawText(this.bufferPtr, afterText, x + end, y,
|
|
11553
|
+
this.lib.bufferDrawText(this.bufferPtr, afterText, x + end, y, fg, bg, attributes);
|
|
11433
11554
|
}
|
|
11434
11555
|
}
|
|
11435
|
-
fillRect(x, y, width, height,
|
|
11556
|
+
fillRect(x, y, width, height, bg) {
|
|
11436
11557
|
this.guard();
|
|
11437
|
-
this.lib.bufferFillRect(this.bufferPtr, x, y, width, height,
|
|
11558
|
+
this.lib.bufferFillRect(this.bufferPtr, x, y, width, height, bg);
|
|
11438
11559
|
}
|
|
11439
11560
|
colorMatrix(matrix, cellMask, strength = 1, target = 3 /* Both */) {
|
|
11440
11561
|
this.guard();
|
|
@@ -11495,13 +11616,13 @@ class OptimizedBuffer {
|
|
|
11495
11616
|
this.guard();
|
|
11496
11617
|
this.lib.bufferDrawPackedBuffer(this.bufferPtr, typeof data === "number" || typeof data === "bigint" ? toPointer(data) : data, dataLen, posX, posY, terminalWidthCells, terminalHeightCells);
|
|
11497
11618
|
}
|
|
11498
|
-
drawGrayscaleBuffer(posX, posY, intensities, srcWidth, srcHeight,
|
|
11619
|
+
drawGrayscaleBuffer(posX, posY, intensities, srcWidth, srcHeight, fg = null, bg = null) {
|
|
11499
11620
|
this.guard();
|
|
11500
|
-
this.lib.bufferDrawGrayscaleBuffer(this.bufferPtr, posX, posY, intensities, srcWidth, srcHeight,
|
|
11621
|
+
this.lib.bufferDrawGrayscaleBuffer(this.bufferPtr, posX, posY, intensities, srcWidth, srcHeight, fg, bg);
|
|
11501
11622
|
}
|
|
11502
|
-
drawGrayscaleBufferSupersampled(posX, posY, intensities, srcWidth, srcHeight,
|
|
11623
|
+
drawGrayscaleBufferSupersampled(posX, posY, intensities, srcWidth, srcHeight, fg = null, bg = null) {
|
|
11503
11624
|
this.guard();
|
|
11504
|
-
this.lib.bufferDrawGrayscaleBufferSupersampled(this.bufferPtr, posX, posY, intensities, srcWidth, srcHeight,
|
|
11625
|
+
this.lib.bufferDrawGrayscaleBufferSupersampled(this.bufferPtr, posX, posY, intensities, srcWidth, srcHeight, fg, bg);
|
|
11505
11626
|
}
|
|
11506
11627
|
resize(width, height) {
|
|
11507
11628
|
this.guard();
|
|
@@ -11514,8 +11635,8 @@ class OptimizedBuffer {
|
|
|
11514
11635
|
}
|
|
11515
11636
|
drawBox(options) {
|
|
11516
11637
|
this.guard();
|
|
11517
|
-
const style =
|
|
11518
|
-
const borderChars = options.customBorderChars ??
|
|
11638
|
+
const style = parseBorderStyle2(options.borderStyle, "single");
|
|
11639
|
+
const borderChars = options.customBorderChars ?? BorderCharArrays2[style];
|
|
11519
11640
|
const packedOptions = packDrawOptions(options.border, options.shouldFill ?? false, options.titleAlignment || "left", options.bottomTitleAlignment || "left");
|
|
11520
11641
|
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
11642
|
}
|
|
@@ -11564,14 +11685,14 @@ class OptimizedBuffer {
|
|
|
11564
11685
|
drawOuter: options.drawOuter
|
|
11565
11686
|
});
|
|
11566
11687
|
}
|
|
11567
|
-
drawChar(char, x, y,
|
|
11688
|
+
drawChar(char, x, y, fg, bg, attributes = 0) {
|
|
11568
11689
|
this.guard();
|
|
11569
|
-
this.lib.bufferDrawChar(this.bufferPtr, char, x, y,
|
|
11690
|
+
this.lib.bufferDrawChar(this.bufferPtr, char, x, y, fg, bg, attributes);
|
|
11570
11691
|
}
|
|
11571
11692
|
}
|
|
11572
11693
|
|
|
11573
11694
|
// src/text-buffer.ts
|
|
11574
|
-
class
|
|
11695
|
+
class TextBuffer2 {
|
|
11575
11696
|
lib;
|
|
11576
11697
|
bufferPtr;
|
|
11577
11698
|
_length = 0;
|
|
@@ -11581,12 +11702,12 @@ class TextBuffer {
|
|
|
11581
11702
|
_textBytes;
|
|
11582
11703
|
_memId;
|
|
11583
11704
|
_appendedChunks = [];
|
|
11584
|
-
constructor(lib,
|
|
11705
|
+
constructor(lib, ptr) {
|
|
11585
11706
|
this.lib = lib;
|
|
11586
|
-
this.bufferPtr =
|
|
11707
|
+
this.bufferPtr = ptr;
|
|
11587
11708
|
}
|
|
11588
11709
|
static create(widthMethod) {
|
|
11589
|
-
const lib =
|
|
11710
|
+
const lib = resolveRenderLib2();
|
|
11590
11711
|
return lib.createTextBuffer(widthMethod);
|
|
11591
11712
|
}
|
|
11592
11713
|
guard() {
|
|
@@ -11614,11 +11735,11 @@ class TextBuffer {
|
|
|
11614
11735
|
this._length = this.lib.textBufferGetLength(this.bufferPtr);
|
|
11615
11736
|
this._byteSize = this.lib.textBufferGetByteSize(this.bufferPtr);
|
|
11616
11737
|
}
|
|
11617
|
-
loadFile(
|
|
11738
|
+
loadFile(path) {
|
|
11618
11739
|
this.guard();
|
|
11619
|
-
const success = this.lib.textBufferLoadFile(this.bufferPtr,
|
|
11740
|
+
const success = this.lib.textBufferLoadFile(this.bufferPtr, path);
|
|
11620
11741
|
if (!success) {
|
|
11621
|
-
throw new Error(`Failed to load file: ${
|
|
11742
|
+
throw new Error(`Failed to load file: ${path}`);
|
|
11622
11743
|
}
|
|
11623
11744
|
this._length = this.lib.textBufferGetLength(this.bufferPtr);
|
|
11624
11745
|
this._byteSize = this.lib.textBufferGetByteSize(this.bufferPtr);
|
|
@@ -11630,13 +11751,13 @@ class TextBuffer {
|
|
|
11630
11751
|
this._length = this.lib.textBufferGetLength(this.bufferPtr);
|
|
11631
11752
|
this._byteSize = this.lib.textBufferGetByteSize(this.bufferPtr);
|
|
11632
11753
|
}
|
|
11633
|
-
setDefaultFg(
|
|
11754
|
+
setDefaultFg(fg) {
|
|
11634
11755
|
this.guard();
|
|
11635
|
-
this.lib.textBufferSetDefaultFg(this.bufferPtr,
|
|
11756
|
+
this.lib.textBufferSetDefaultFg(this.bufferPtr, fg);
|
|
11636
11757
|
}
|
|
11637
|
-
setDefaultBg(
|
|
11758
|
+
setDefaultBg(bg) {
|
|
11638
11759
|
this.guard();
|
|
11639
|
-
this.lib.textBufferSetDefaultBg(this.bufferPtr,
|
|
11760
|
+
this.lib.textBufferSetDefaultBg(this.bufferPtr, bg);
|
|
11640
11761
|
}
|
|
11641
11762
|
setDefaultAttributes(attributes) {
|
|
11642
11763
|
this.guard();
|
|
@@ -11785,11 +11906,11 @@ async function loadBackend2() {
|
|
|
11785
11906
|
function importModule(specifier) {
|
|
11786
11907
|
return import(specifier).then((module) => module.default ?? module);
|
|
11787
11908
|
}
|
|
11788
|
-
function createBunBackend2(
|
|
11909
|
+
function createBunBackend2(bun) {
|
|
11789
11910
|
return {
|
|
11790
|
-
ptr:
|
|
11911
|
+
ptr: bun.ptr,
|
|
11791
11912
|
toArrayBuffer(pointer, offset, length) {
|
|
11792
|
-
return
|
|
11913
|
+
return bun.toArrayBuffer(toBunPointer2(pointer), offset, length);
|
|
11793
11914
|
}
|
|
11794
11915
|
};
|
|
11795
11916
|
}
|
|
@@ -11892,7 +12013,7 @@ function enumTypeError(value) {
|
|
|
11892
12013
|
throw new TypeError(`Invalid enum value: ${value}`);
|
|
11893
12014
|
}
|
|
11894
12015
|
function defineEnum(mapping, base = "u32") {
|
|
11895
|
-
const
|
|
12016
|
+
const reverse = Object.fromEntries(Object.entries(mapping).map(([k, v]) => [v, k]));
|
|
11896
12017
|
return {
|
|
11897
12018
|
__type: "enum",
|
|
11898
12019
|
type: base,
|
|
@@ -11900,7 +12021,7 @@ function defineEnum(mapping, base = "u32") {
|
|
|
11900
12021
|
return typeof value === "number" ? value : mapping[value] ?? enumTypeError(String(value));
|
|
11901
12022
|
},
|
|
11902
12023
|
from(value) {
|
|
11903
|
-
return
|
|
12024
|
+
return reverse[value] ?? enumTypeError(String(value));
|
|
11904
12025
|
},
|
|
11905
12026
|
enum: mapping
|
|
11906
12027
|
};
|
|
@@ -13051,7 +13172,7 @@ function defineStruct(fields, structDefOptions) {
|
|
|
13051
13172
|
|
|
13052
13173
|
// src/zig-structs.ts
|
|
13053
13174
|
var rgbaPackTransform = (rgba) => rgba?.buffer ?? null;
|
|
13054
|
-
var rgbaUnpackTransform = (
|
|
13175
|
+
var rgbaUnpackTransform = (ptr) => ptr ? RGBA2.fromArray(new Uint16Array(toArrayBuffer(ptr, 0, 8))) : undefined;
|
|
13055
13176
|
var StyledChunkStruct = defineStruct([
|
|
13056
13177
|
["text", "char*"],
|
|
13057
13178
|
["text_len", "u64", { lengthOf: "text" }],
|
|
@@ -13078,8 +13199,8 @@ var StyledChunkStruct = defineStruct([
|
|
|
13078
13199
|
["link_len", "u64", { lengthOf: "link" }]
|
|
13079
13200
|
], {
|
|
13080
13201
|
mapValue: (chunk) => {
|
|
13081
|
-
const normalizedFg =
|
|
13082
|
-
const normalizedBg =
|
|
13202
|
+
const normalizedFg = normalizeColorValue2(chunk.fg ?? null);
|
|
13203
|
+
const normalizedBg = normalizeColorValue2(chunk.bg ?? null);
|
|
13083
13204
|
if (!chunk.link || typeof chunk.link === "string") {
|
|
13084
13205
|
return {
|
|
13085
13206
|
...chunk,
|
|
@@ -13300,11 +13421,12 @@ var ReserveInfoStruct = defineStruct([
|
|
|
13300
13421
|
len: value.len
|
|
13301
13422
|
})
|
|
13302
13423
|
});
|
|
13303
|
-
var
|
|
13424
|
+
var NativeAudioStreamFormat2 = {
|
|
13304
13425
|
Mp3: 1,
|
|
13305
|
-
Flac: 2
|
|
13426
|
+
Flac: 2,
|
|
13427
|
+
Pcm: 3
|
|
13306
13428
|
};
|
|
13307
|
-
var
|
|
13429
|
+
var NativeAudioStreamState2 = {
|
|
13308
13430
|
Initializing: 0,
|
|
13309
13431
|
Buffering: 1,
|
|
13310
13432
|
Playing: 2,
|
|
@@ -13322,7 +13444,7 @@ var NativeAudioStreamStateNames = [
|
|
|
13322
13444
|
"disposed",
|
|
13323
13445
|
"reconnecting"
|
|
13324
13446
|
];
|
|
13325
|
-
var
|
|
13447
|
+
var NativeAudioStreamCloseReason2 = {
|
|
13326
13448
|
PreserveNativeTerminal: 0,
|
|
13327
13449
|
TransportError: 1,
|
|
13328
13450
|
Disposed: 2
|
|
@@ -13362,7 +13484,9 @@ var AudioStreamCreateOptionsStruct = defineStruct([
|
|
|
13362
13484
|
["pan", "f32"],
|
|
13363
13485
|
["groupId", "u32"],
|
|
13364
13486
|
["maxProbeBytes", "u32"],
|
|
13365
|
-
["format", "u32"]
|
|
13487
|
+
["format", "u32"],
|
|
13488
|
+
["sampleRate", "u32", { default: 0 }],
|
|
13489
|
+
["channels", "u32", { default: 0 }]
|
|
13366
13490
|
]);
|
|
13367
13491
|
var AudioStreamStatsStruct = defineStruct([
|
|
13368
13492
|
["bytesReceived", "u64"],
|
|
@@ -13396,64 +13520,69 @@ var AudioStatsStruct = defineStruct([
|
|
|
13396
13520
|
]);
|
|
13397
13521
|
|
|
13398
13522
|
// src/zig.ts
|
|
13399
|
-
var
|
|
13400
|
-
var
|
|
13401
|
-
var
|
|
13402
|
-
|
|
13523
|
+
var NativeAudioStreamState3 = NativeAudioStreamState2;
|
|
13524
|
+
var NativeAudioStreamCloseReason3 = NativeAudioStreamCloseReason2;
|
|
13525
|
+
var NativeAudioStreamFormat3 = NativeAudioStreamFormat2;
|
|
13526
|
+
var MAX_LINK_URL_BYTES2 = 512;
|
|
13527
|
+
function allocFFIStruct(structDefinition) {
|
|
13528
|
+
const storage = allocStruct(structDefinition);
|
|
13529
|
+
return { ...storage, ffiView: new Uint8Array(storage.buffer) };
|
|
13530
|
+
}
|
|
13531
|
+
registerEnvVar2({
|
|
13403
13532
|
name: "OPENTUI_LIBC",
|
|
13404
13533
|
description: "Select Linux native libc package. Supported values: glibc, musl.",
|
|
13405
13534
|
type: "string",
|
|
13406
13535
|
default: ""
|
|
13407
13536
|
});
|
|
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
|
-
})(
|
|
13537
|
+
var NativeClipboardOperationStatus2;
|
|
13538
|
+
((NativeClipboardOperationStatus) => {
|
|
13539
|
+
NativeClipboardOperationStatus[NativeClipboardOperationStatus["Pending"] = 0] = "Pending";
|
|
13540
|
+
NativeClipboardOperationStatus[NativeClipboardOperationStatus["Read"] = 1] = "Read";
|
|
13541
|
+
NativeClipboardOperationStatus[NativeClipboardOperationStatus["Empty"] = 2] = "Empty";
|
|
13542
|
+
NativeClipboardOperationStatus[NativeClipboardOperationStatus["Written"] = 3] = "Written";
|
|
13543
|
+
NativeClipboardOperationStatus[NativeClipboardOperationStatus["Cleared"] = 4] = "Cleared";
|
|
13544
|
+
NativeClipboardOperationStatus[NativeClipboardOperationStatus["Unsupported"] = 5] = "Unsupported";
|
|
13545
|
+
NativeClipboardOperationStatus[NativeClipboardOperationStatus["Cancelled"] = 6] = "Cancelled";
|
|
13546
|
+
NativeClipboardOperationStatus[NativeClipboardOperationStatus["TimedOut"] = 7] = "TimedOut";
|
|
13547
|
+
NativeClipboardOperationStatus[NativeClipboardOperationStatus["LimitExceeded"] = 8] = "LimitExceeded";
|
|
13548
|
+
NativeClipboardOperationStatus[NativeClipboardOperationStatus["Failed"] = 9] = "Failed";
|
|
13549
|
+
NativeClipboardOperationStatus[NativeClipboardOperationStatus["InvalidHandle"] = 10] = "InvalidHandle";
|
|
13550
|
+
})(NativeClipboardOperationStatus2 ||= {});
|
|
13551
|
+
var NativeClipboardStartStatus2;
|
|
13552
|
+
((NativeClipboardStartStatus) => {
|
|
13553
|
+
NativeClipboardStartStatus[NativeClipboardStartStatus["Ok"] = 0] = "Ok";
|
|
13554
|
+
NativeClipboardStartStatus[NativeClipboardStartStatus["InvalidService"] = 1] = "InvalidService";
|
|
13555
|
+
NativeClipboardStartStatus[NativeClipboardStartStatus["ShuttingDown"] = 2] = "ShuttingDown";
|
|
13556
|
+
NativeClipboardStartStatus[NativeClipboardStartStatus["LimitExceeded"] = 3] = "LimitExceeded";
|
|
13557
|
+
NativeClipboardStartStatus[NativeClipboardStartStatus["InvalidArgument"] = 4] = "InvalidArgument";
|
|
13558
|
+
NativeClipboardStartStatus[NativeClipboardStartStatus["OutOfMemory"] = 5] = "OutOfMemory";
|
|
13559
|
+
})(NativeClipboardStartStatus2 ||= {});
|
|
13560
|
+
var NativeClipboardCancelStatus2;
|
|
13561
|
+
((NativeClipboardCancelStatus) => {
|
|
13562
|
+
NativeClipboardCancelStatus[NativeClipboardCancelStatus["Requested"] = 0] = "Requested";
|
|
13563
|
+
NativeClipboardCancelStatus[NativeClipboardCancelStatus["AlreadyTerminal"] = 1] = "AlreadyTerminal";
|
|
13564
|
+
NativeClipboardCancelStatus[NativeClipboardCancelStatus["InvalidHandle"] = 2] = "InvalidHandle";
|
|
13565
|
+
})(NativeClipboardCancelStatus2 ||= {});
|
|
13566
|
+
var NativeClipboardCopyStatus2;
|
|
13567
|
+
((NativeClipboardCopyStatus) => {
|
|
13568
|
+
NativeClipboardCopyStatus[NativeClipboardCopyStatus["Ok"] = 0] = "Ok";
|
|
13569
|
+
NativeClipboardCopyStatus[NativeClipboardCopyStatus["BufferTooSmall"] = 1] = "BufferTooSmall";
|
|
13570
|
+
NativeClipboardCopyStatus[NativeClipboardCopyStatus["InvalidHandle"] = 2] = "InvalidHandle";
|
|
13571
|
+
NativeClipboardCopyStatus[NativeClipboardCopyStatus["InvalidState"] = 3] = "InvalidState";
|
|
13572
|
+
NativeClipboardCopyStatus[NativeClipboardCopyStatus["InvalidArgument"] = 4] = "InvalidArgument";
|
|
13573
|
+
})(NativeClipboardCopyStatus2 ||= {});
|
|
13574
|
+
var NativeClipboardDestroyStatus2;
|
|
13575
|
+
((NativeClipboardDestroyStatus) => {
|
|
13576
|
+
NativeClipboardDestroyStatus[NativeClipboardDestroyStatus["Destroyed"] = 0] = "Destroyed";
|
|
13577
|
+
NativeClipboardDestroyStatus[NativeClipboardDestroyStatus["NotReady"] = 1] = "NotReady";
|
|
13578
|
+
NativeClipboardDestroyStatus[NativeClipboardDestroyStatus["InvalidHandle"] = 2] = "InvalidHandle";
|
|
13579
|
+
})(NativeClipboardDestroyStatus2 ||= {});
|
|
13580
|
+
var NativeClipboardShutdownStatus2;
|
|
13581
|
+
((NativeClipboardShutdownStatus) => {
|
|
13582
|
+
NativeClipboardShutdownStatus[NativeClipboardShutdownStatus["Pending"] = 0] = "Pending";
|
|
13583
|
+
NativeClipboardShutdownStatus[NativeClipboardShutdownStatus["Ready"] = 1] = "Ready";
|
|
13584
|
+
NativeClipboardShutdownStatus[NativeClipboardShutdownStatus["InvalidHandle"] = 2] = "InvalidHandle";
|
|
13585
|
+
})(NativeClipboardShutdownStatus2 ||= {});
|
|
13457
13586
|
var targetLibPath;
|
|
13458
13587
|
var targetLibError;
|
|
13459
13588
|
try {
|
|
@@ -13467,43 +13596,43 @@ try {
|
|
|
13467
13596
|
} catch (error) {
|
|
13468
13597
|
targetLibError = error instanceof Error ? error : new Error(String(error));
|
|
13469
13598
|
}
|
|
13470
|
-
|
|
13599
|
+
registerEnvVar2({
|
|
13471
13600
|
name: "OTUI_DEBUG_FFI",
|
|
13472
13601
|
description: "Enable debug logging for the FFI bindings.",
|
|
13473
13602
|
type: "boolean",
|
|
13474
13603
|
default: false
|
|
13475
13604
|
});
|
|
13476
|
-
|
|
13605
|
+
registerEnvVar2({
|
|
13477
13606
|
name: "OTUI_TRACE_FFI",
|
|
13478
13607
|
description: "Enable tracing for the FFI bindings.",
|
|
13479
13608
|
type: "boolean",
|
|
13480
13609
|
default: false
|
|
13481
13610
|
});
|
|
13482
|
-
|
|
13611
|
+
registerEnvVar2({
|
|
13483
13612
|
name: "OPENTUI_FORCE_WCWIDTH",
|
|
13484
13613
|
description: "Use wcwidth for character width calculations when the variable is present",
|
|
13485
13614
|
type: "string",
|
|
13486
13615
|
required: false
|
|
13487
13616
|
});
|
|
13488
|
-
|
|
13617
|
+
registerEnvVar2({
|
|
13489
13618
|
name: "OPENTUI_FORCE_UNICODE",
|
|
13490
13619
|
description: "Force Mode 2026 Unicode support when the variable is present",
|
|
13491
13620
|
type: "string",
|
|
13492
13621
|
required: false
|
|
13493
13622
|
});
|
|
13494
|
-
|
|
13623
|
+
registerEnvVar2({
|
|
13495
13624
|
name: "OPENTUI_GRAPHICS",
|
|
13496
13625
|
description: "Control Kitty and Sixel graphics detection with the exact value true, 1, false, or 0",
|
|
13497
13626
|
type: "string",
|
|
13498
13627
|
required: false
|
|
13499
13628
|
});
|
|
13500
|
-
|
|
13629
|
+
registerEnvVar2({
|
|
13501
13630
|
name: "OPENTUI_IMAGE_PROTOCOL",
|
|
13502
13631
|
description: "Override image rendering protocol: auto, kitty, sixel, or blocks",
|
|
13503
13632
|
type: "string",
|
|
13504
13633
|
default: "auto"
|
|
13505
13634
|
});
|
|
13506
|
-
|
|
13635
|
+
registerEnvVar2({
|
|
13507
13636
|
name: "OPENTUI_FORCE_NOZWJ",
|
|
13508
13637
|
description: "Use no_zwj width mode when the variable is present",
|
|
13509
13638
|
type: "string",
|
|
@@ -13511,7 +13640,44 @@ registerEnvVar({
|
|
|
13511
13640
|
});
|
|
13512
13641
|
var CURSOR_STYLE_TO_ID = { block: 0, line: 1, underline: 2, default: 3 };
|
|
13513
13642
|
var CURSOR_ID_TO_STYLE = ["block", "line", "underline", "default"];
|
|
13514
|
-
var MOUSE_STYLE_TO_ID = {
|
|
13643
|
+
var MOUSE_STYLE_TO_ID = {
|
|
13644
|
+
auto: 0,
|
|
13645
|
+
default: 1,
|
|
13646
|
+
none: 2,
|
|
13647
|
+
"context-menu": 3,
|
|
13648
|
+
help: 4,
|
|
13649
|
+
pointer: 5,
|
|
13650
|
+
progress: 6,
|
|
13651
|
+
wait: 7,
|
|
13652
|
+
cell: 8,
|
|
13653
|
+
crosshair: 9,
|
|
13654
|
+
text: 10,
|
|
13655
|
+
"vertical-text": 11,
|
|
13656
|
+
alias: 12,
|
|
13657
|
+
copy: 13,
|
|
13658
|
+
move: 14,
|
|
13659
|
+
"no-drop": 15,
|
|
13660
|
+
"not-allowed": 16,
|
|
13661
|
+
grab: 17,
|
|
13662
|
+
grabbing: 18,
|
|
13663
|
+
"all-scroll": 19,
|
|
13664
|
+
"col-resize": 20,
|
|
13665
|
+
"row-resize": 21,
|
|
13666
|
+
"n-resize": 22,
|
|
13667
|
+
"e-resize": 23,
|
|
13668
|
+
"s-resize": 24,
|
|
13669
|
+
"w-resize": 25,
|
|
13670
|
+
"ne-resize": 26,
|
|
13671
|
+
"nw-resize": 27,
|
|
13672
|
+
"se-resize": 28,
|
|
13673
|
+
"sw-resize": 29,
|
|
13674
|
+
"ew-resize": 30,
|
|
13675
|
+
"ns-resize": 31,
|
|
13676
|
+
"nesw-resize": 32,
|
|
13677
|
+
"nwse-resize": 33,
|
|
13678
|
+
"zoom-in": 34,
|
|
13679
|
+
"zoom-out": 35
|
|
13680
|
+
};
|
|
13515
13681
|
var MAX_FFI_U32 = 4294967295;
|
|
13516
13682
|
var globalTraceSymbols = null;
|
|
13517
13683
|
var globalFFILogPath = null;
|
|
@@ -13650,6 +13816,10 @@ function getOpenTUILib(libPath) {
|
|
|
13650
13816
|
args: ["u32"],
|
|
13651
13817
|
returns: "i32"
|
|
13652
13818
|
},
|
|
13819
|
+
embeddedTerminalSetTransparentBackground: {
|
|
13820
|
+
args: ["u32", "u8"],
|
|
13821
|
+
returns: "i32"
|
|
13822
|
+
},
|
|
13653
13823
|
embeddedTerminalScroll: {
|
|
13654
13824
|
args: ["u32", "i32"],
|
|
13655
13825
|
returns: "i32"
|
|
@@ -13671,11 +13841,11 @@ function getOpenTUILib(libPath) {
|
|
|
13671
13841
|
returns: "i32"
|
|
13672
13842
|
},
|
|
13673
13843
|
embeddedTerminalCursor: {
|
|
13674
|
-
args: ["u32", "
|
|
13844
|
+
args: ["u32", "buffer"],
|
|
13675
13845
|
returns: "i32"
|
|
13676
13846
|
},
|
|
13677
13847
|
embeddedTerminalEncodeKey: {
|
|
13678
|
-
args: ["u32", "
|
|
13848
|
+
args: ["u32", "buffer", "ptr", "u32", "ptr", "u32", "ptr", "u32", "ptr"],
|
|
13679
13849
|
returns: "i32"
|
|
13680
13850
|
},
|
|
13681
13851
|
embeddedTerminalEncodeMouse: {
|
|
@@ -14015,7 +14185,7 @@ function getOpenTUILib(libPath) {
|
|
|
14015
14185
|
returns: "void"
|
|
14016
14186
|
},
|
|
14017
14187
|
bufferDrawImage: {
|
|
14018
|
-
args: ["u32", "u32", "
|
|
14188
|
+
args: ["u32", "u32", "buffer"],
|
|
14019
14189
|
returns: "u8"
|
|
14020
14190
|
},
|
|
14021
14191
|
bufferDrawPackedBuffer: {
|
|
@@ -14031,7 +14201,7 @@ function getOpenTUILib(libPath) {
|
|
|
14031
14201
|
returns: "void"
|
|
14032
14202
|
},
|
|
14033
14203
|
bufferDrawGrid: {
|
|
14034
|
-
args: ["u32", "buffer", "buffer", "buffer", "buffer", "u32", "buffer", "u32", "
|
|
14204
|
+
args: ["u32", "buffer", "buffer", "buffer", "buffer", "u32", "buffer", "u32", "buffer"],
|
|
14035
14205
|
returns: "void"
|
|
14036
14206
|
},
|
|
14037
14207
|
bufferDrawBox: {
|
|
@@ -14353,6 +14523,10 @@ function getOpenTUILib(libPath) {
|
|
|
14353
14523
|
args: ["u32", "u8"],
|
|
14354
14524
|
returns: "void"
|
|
14355
14525
|
},
|
|
14526
|
+
textBufferViewSetTextAlign: {
|
|
14527
|
+
args: ["u32", "u8"],
|
|
14528
|
+
returns: "void"
|
|
14529
|
+
},
|
|
14356
14530
|
textBufferViewSetFirstLineOffset: {
|
|
14357
14531
|
args: ["u32", "u32"],
|
|
14358
14532
|
returns: "void"
|
|
@@ -14398,7 +14572,7 @@ function getOpenTUILib(libPath) {
|
|
|
14398
14572
|
returns: "void"
|
|
14399
14573
|
},
|
|
14400
14574
|
textBufferViewMeasureForDimensions: {
|
|
14401
|
-
args: ["u32", "u32", "u32", "
|
|
14575
|
+
args: ["u32", "u32", "u32", "buffer"],
|
|
14402
14576
|
returns: "bool"
|
|
14403
14577
|
},
|
|
14404
14578
|
bufferDrawTextBufferView: {
|
|
@@ -14546,7 +14720,7 @@ function getOpenTUILib(libPath) {
|
|
|
14546
14720
|
returns: "void"
|
|
14547
14721
|
},
|
|
14548
14722
|
editBufferGetCursorPosition: {
|
|
14549
|
-
args: ["u32", "
|
|
14723
|
+
args: ["u32", "buffer"],
|
|
14550
14724
|
returns: "void"
|
|
14551
14725
|
},
|
|
14552
14726
|
editBufferGetId: {
|
|
@@ -14590,19 +14764,19 @@ function getOpenTUILib(libPath) {
|
|
|
14590
14764
|
returns: "void"
|
|
14591
14765
|
},
|
|
14592
14766
|
editBufferGetNextWordBoundary: {
|
|
14593
|
-
args: ["u32", "
|
|
14767
|
+
args: ["u32", "buffer"],
|
|
14594
14768
|
returns: "void"
|
|
14595
14769
|
},
|
|
14596
14770
|
editBufferGetPrevWordBoundary: {
|
|
14597
|
-
args: ["u32", "
|
|
14771
|
+
args: ["u32", "buffer"],
|
|
14598
14772
|
returns: "void"
|
|
14599
14773
|
},
|
|
14600
14774
|
editBufferGetEOL: {
|
|
14601
|
-
args: ["u32", "
|
|
14775
|
+
args: ["u32", "buffer"],
|
|
14602
14776
|
returns: "void"
|
|
14603
14777
|
},
|
|
14604
14778
|
editBufferOffsetToPosition: {
|
|
14605
|
-
args: ["u32", "u32", "
|
|
14779
|
+
args: ["u32", "u32", "buffer"],
|
|
14606
14780
|
returns: "bool"
|
|
14607
14781
|
},
|
|
14608
14782
|
editBufferPositionToOffset: {
|
|
@@ -14678,7 +14852,7 @@ function getOpenTUILib(libPath) {
|
|
|
14678
14852
|
returns: "u32"
|
|
14679
14853
|
},
|
|
14680
14854
|
editorViewGetVisualCursor: {
|
|
14681
|
-
args: ["u32", "
|
|
14855
|
+
args: ["u32", "buffer"],
|
|
14682
14856
|
returns: "void"
|
|
14683
14857
|
},
|
|
14684
14858
|
editorViewMoveUpVisual: {
|
|
@@ -14698,23 +14872,23 @@ function getOpenTUILib(libPath) {
|
|
|
14698
14872
|
returns: "void"
|
|
14699
14873
|
},
|
|
14700
14874
|
editorViewGetNextWordBoundary: {
|
|
14701
|
-
args: ["u32", "
|
|
14875
|
+
args: ["u32", "buffer"],
|
|
14702
14876
|
returns: "void"
|
|
14703
14877
|
},
|
|
14704
14878
|
editorViewGetPrevWordBoundary: {
|
|
14705
|
-
args: ["u32", "
|
|
14879
|
+
args: ["u32", "buffer"],
|
|
14706
14880
|
returns: "void"
|
|
14707
14881
|
},
|
|
14708
14882
|
editorViewGetEOL: {
|
|
14709
|
-
args: ["u32", "
|
|
14883
|
+
args: ["u32", "buffer"],
|
|
14710
14884
|
returns: "void"
|
|
14711
14885
|
},
|
|
14712
14886
|
editorViewGetVisualSOL: {
|
|
14713
|
-
args: ["u32", "
|
|
14887
|
+
args: ["u32", "buffer"],
|
|
14714
14888
|
returns: "void"
|
|
14715
14889
|
},
|
|
14716
14890
|
editorViewGetVisualEOL: {
|
|
14717
|
-
args: ["u32", "
|
|
14891
|
+
args: ["u32", "buffer"],
|
|
14718
14892
|
returns: "void"
|
|
14719
14893
|
},
|
|
14720
14894
|
editorViewGotoVisualLineEnd: {
|
|
@@ -15100,7 +15274,7 @@ function getOpenTUILib(libPath) {
|
|
|
15100
15274
|
returns: "i32"
|
|
15101
15275
|
},
|
|
15102
15276
|
audioCreateStream: {
|
|
15103
|
-
args: ["u32", "
|
|
15277
|
+
args: ["u32", "buffer", "buffer"],
|
|
15104
15278
|
returns: "i32"
|
|
15105
15279
|
},
|
|
15106
15280
|
audioWriteStream: {
|
|
@@ -15128,11 +15302,11 @@ function getOpenTUILib(libPath) {
|
|
|
15128
15302
|
returns: "i32"
|
|
15129
15303
|
},
|
|
15130
15304
|
audioGetStreamStats: {
|
|
15131
|
-
args: ["u32", "u32", "
|
|
15305
|
+
args: ["u32", "u32", "buffer"],
|
|
15132
15306
|
returns: "i32"
|
|
15133
15307
|
},
|
|
15134
15308
|
audioCloseStream: {
|
|
15135
|
-
args: ["u32", "u32", "u32", "
|
|
15309
|
+
args: ["u32", "u32", "u32", "buffer"],
|
|
15136
15310
|
returns: "i32"
|
|
15137
15311
|
},
|
|
15138
15312
|
audioLoad: {
|
|
@@ -15232,7 +15406,7 @@ function getOpenTUILib(libPath) {
|
|
|
15232
15406
|
returns: "void"
|
|
15233
15407
|
}
|
|
15234
15408
|
});
|
|
15235
|
-
if (
|
|
15409
|
+
if (env2.OTUI_DEBUG_FFI || env2.OTUI_TRACE_FFI) {
|
|
15236
15410
|
return {
|
|
15237
15411
|
...rawSymbols,
|
|
15238
15412
|
symbols: convertToDebugSymbols(rawSymbols.symbols)
|
|
@@ -15244,7 +15418,7 @@ function convertToDebugSymbols(symbols) {
|
|
|
15244
15418
|
if (!globalTraceSymbols) {
|
|
15245
15419
|
globalTraceSymbols = {};
|
|
15246
15420
|
}
|
|
15247
|
-
if (
|
|
15421
|
+
if (env2.OTUI_DEBUG_FFI && !globalFFILogPath) {
|
|
15248
15422
|
const now = new Date;
|
|
15249
15423
|
const timestamp = now.toISOString().replace(/[:.]/g, "-").replace(/T/, "_").split("Z")[0];
|
|
15250
15424
|
globalFFILogPath = `ffi_otui_debug_${timestamp}.log`;
|
|
@@ -15254,7 +15428,7 @@ function convertToDebugSymbols(symbols) {
|
|
|
15254
15428
|
Object.entries(symbols).forEach(([key, value]) => {
|
|
15255
15429
|
debugSymbols[key] = value;
|
|
15256
15430
|
});
|
|
15257
|
-
if (
|
|
15431
|
+
if (env2.OTUI_DEBUG_FFI && globalFFILogPath) {
|
|
15258
15432
|
const logPath = globalFFILogPath;
|
|
15259
15433
|
const writeSync = (msg) => {
|
|
15260
15434
|
writeFileSync(logPath, msg + `
|
|
@@ -15271,7 +15445,7 @@ function convertToDebugSymbols(symbols) {
|
|
|
15271
15445
|
}
|
|
15272
15446
|
});
|
|
15273
15447
|
}
|
|
15274
|
-
if (
|
|
15448
|
+
if (env2.OTUI_TRACE_FFI) {
|
|
15275
15449
|
hasTracing = true;
|
|
15276
15450
|
Object.entries(symbols).forEach(([key, value]) => {
|
|
15277
15451
|
if (typeof value === "function") {
|
|
@@ -15289,7 +15463,7 @@ function convertToDebugSymbols(symbols) {
|
|
|
15289
15463
|
}
|
|
15290
15464
|
});
|
|
15291
15465
|
}
|
|
15292
|
-
if ((
|
|
15466
|
+
if ((env2.OTUI_DEBUG_FFI || env2.OTUI_TRACE_FFI) && !exitHandlerRegistered) {
|
|
15293
15467
|
exitHandlerRegistered = true;
|
|
15294
15468
|
process.on("exit", () => {
|
|
15295
15469
|
if (globalTraceSymbols) {
|
|
@@ -15300,7 +15474,7 @@ function convertToDebugSymbols(symbols) {
|
|
|
15300
15474
|
}
|
|
15301
15475
|
const sortedTimings = [...timings].sort((a, b) => a - b);
|
|
15302
15476
|
const count = sortedTimings.length;
|
|
15303
|
-
const total = sortedTimings.reduce((acc,
|
|
15477
|
+
const total = sortedTimings.reduce((acc, t) => acc + t, 0);
|
|
15304
15478
|
const average = total / count;
|
|
15305
15479
|
const min = sortedTimings[0];
|
|
15306
15480
|
const max = sortedTimings[count - 1];
|
|
@@ -15375,13 +15549,13 @@ function convertToDebugSymbols(symbols) {
|
|
|
15375
15549
|
return debugSymbols;
|
|
15376
15550
|
}
|
|
15377
15551
|
var LogLevel2;
|
|
15378
|
-
((
|
|
15379
|
-
|
|
15380
|
-
|
|
15381
|
-
|
|
15382
|
-
|
|
15552
|
+
((LogLevel) => {
|
|
15553
|
+
LogLevel[LogLevel["Error"] = 0] = "Error";
|
|
15554
|
+
LogLevel[LogLevel["Warn"] = 1] = "Warn";
|
|
15555
|
+
LogLevel[LogLevel["Info"] = 2] = "Info";
|
|
15556
|
+
LogLevel[LogLevel["Debug"] = 3] = "Debug";
|
|
15383
15557
|
})(LogLevel2 ||= {});
|
|
15384
|
-
var
|
|
15558
|
+
var NativeMeasureTargetKind2 = {
|
|
15385
15559
|
None: 0,
|
|
15386
15560
|
TextBufferView: 1,
|
|
15387
15561
|
EditorView: 2
|
|
@@ -15393,11 +15567,11 @@ class FFIRenderLib {
|
|
|
15393
15567
|
yogaLayout = new Float32Array(6);
|
|
15394
15568
|
ffiStructStorage = {
|
|
15395
15569
|
logicalCursor: {
|
|
15396
|
-
...
|
|
15570
|
+
...allocFFIStruct(LogicalCursorStruct),
|
|
15397
15571
|
result: { row: 0, col: 0, offset: 0 }
|
|
15398
15572
|
},
|
|
15399
15573
|
visualCursor: {
|
|
15400
|
-
...
|
|
15574
|
+
...allocFFIStruct(VisualCursorStruct),
|
|
15401
15575
|
result: {
|
|
15402
15576
|
visualRow: 0,
|
|
15403
15577
|
visualCol: 0,
|
|
@@ -15407,13 +15581,13 @@ class FFIRenderLib {
|
|
|
15407
15581
|
}
|
|
15408
15582
|
},
|
|
15409
15583
|
measureResult: {
|
|
15410
|
-
...
|
|
15584
|
+
...allocFFIStruct(MeasureResultStruct),
|
|
15411
15585
|
result: { lineCount: 0, widthColsMax: 0 }
|
|
15412
15586
|
},
|
|
15413
|
-
embeddedTerminalCursor:
|
|
15414
|
-
embeddedTerminalKeyOptions:
|
|
15587
|
+
embeddedTerminalCursor: allocFFIStruct(EmbeddedTerminalCursorStruct),
|
|
15588
|
+
embeddedTerminalKeyOptions: allocFFIStruct(EmbeddedTerminalKeyOptionsStruct),
|
|
15415
15589
|
audioStreamStats: {
|
|
15416
|
-
...
|
|
15590
|
+
...allocFFIStruct(AudioStreamStatsStruct),
|
|
15417
15591
|
result: {
|
|
15418
15592
|
bytesReceived: 0n,
|
|
15419
15593
|
framesDecoded: 0n,
|
|
@@ -15428,8 +15602,8 @@ class FFIRenderLib {
|
|
|
15428
15602
|
readyGeneration: 0
|
|
15429
15603
|
}
|
|
15430
15604
|
},
|
|
15431
|
-
imageDrawOptions:
|
|
15432
|
-
gridDrawOptions:
|
|
15605
|
+
imageDrawOptions: allocFFIStruct(ImageDrawOptionsStruct),
|
|
15606
|
+
gridDrawOptions: allocFFIStruct(GridDrawOptionsStruct)
|
|
15433
15607
|
};
|
|
15434
15608
|
disposed = false;
|
|
15435
15609
|
clipboardServices = new Set;
|
|
@@ -15481,6 +15655,9 @@ class FFIRenderLib {
|
|
|
15481
15655
|
embeddedTerminalInvalidate(handle) {
|
|
15482
15656
|
embeddedTerminalResult(this.opentui.symbols.embeddedTerminalInvalidate(handle), "invalidation");
|
|
15483
15657
|
}
|
|
15658
|
+
embeddedTerminalSetTransparentBackground(handle, transparent) {
|
|
15659
|
+
embeddedTerminalResult(this.opentui.symbols.embeddedTerminalSetTransparentBackground(handle, transparent ? 1 : 0), "transparent background update");
|
|
15660
|
+
}
|
|
15484
15661
|
embeddedTerminalScroll(handle, delta) {
|
|
15485
15662
|
embeddedTerminalResult(this.opentui.symbols.embeddedTerminalScroll(handle, embeddedTerminalI32(delta, "scroll delta")), "scroll");
|
|
15486
15663
|
}
|
|
@@ -15492,7 +15669,7 @@ class FFIRenderLib {
|
|
|
15492
15669
|
}
|
|
15493
15670
|
embeddedTerminalGetSelectedText(handle) {
|
|
15494
15671
|
const required = new Uint32Array(1);
|
|
15495
|
-
const read = (
|
|
15672
|
+
const read = (output) => this.opentui.symbols.embeddedTerminalGetSelectedText(handle, viewOrNull(output), output.byteLength, required);
|
|
15496
15673
|
const initial = new Uint8Array(256);
|
|
15497
15674
|
const status = read(initial);
|
|
15498
15675
|
if (status >= 0)
|
|
@@ -15508,7 +15685,7 @@ class FFIRenderLib {
|
|
|
15508
15685
|
}
|
|
15509
15686
|
embeddedTerminalCursor(handle) {
|
|
15510
15687
|
const storage = this.ffiStructStorage.embeddedTerminalCursor;
|
|
15511
|
-
embeddedTerminalResult(this.opentui.symbols.embeddedTerminalCursor(handle, storage.
|
|
15688
|
+
embeddedTerminalResult(this.opentui.symbols.embeddedTerminalCursor(handle, storage.ffiView), "cursor query");
|
|
15512
15689
|
const result = EmbeddedTerminalCursorStruct.unpack(storage.buffer);
|
|
15513
15690
|
return {
|
|
15514
15691
|
x: result.x,
|
|
@@ -15536,7 +15713,7 @@ class FFIRenderLib {
|
|
|
15536
15713
|
const text = key.text ? this.encoder.encode(key.text) : new Uint8Array;
|
|
15537
15714
|
const textLength = toSafeFFIU32Length(text.byteLength, "Embedded terminal key text length");
|
|
15538
15715
|
const required = new Uint32Array(1);
|
|
15539
|
-
const encode = (
|
|
15716
|
+
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
15717
|
const initial = new Uint8Array(Math.max(64, textLength));
|
|
15541
15718
|
const status = encode(initial);
|
|
15542
15719
|
if (status >= 0)
|
|
@@ -15798,7 +15975,7 @@ class FFIRenderLib {
|
|
|
15798
15975
|
const width = this.opentui.symbols.getBufferWidth(bufferPtr);
|
|
15799
15976
|
const height = this.opentui.symbols.getBufferHeight(bufferPtr);
|
|
15800
15977
|
const widthMethod = widthMethodFromCode(this.opentui.symbols.getBufferWidthMethod(bufferPtr));
|
|
15801
|
-
return new
|
|
15978
|
+
return new OptimizedBuffer2(this, bufferPtr, width, height, { id: "next buffer", widthMethod });
|
|
15802
15979
|
}
|
|
15803
15980
|
getCurrentBuffer(renderer) {
|
|
15804
15981
|
const bufferPtr = this.opentui.symbols.getCurrentBuffer(renderer);
|
|
@@ -15808,7 +15985,7 @@ class FFIRenderLib {
|
|
|
15808
15985
|
const width = this.opentui.symbols.getBufferWidth(bufferPtr);
|
|
15809
15986
|
const height = this.opentui.symbols.getBufferHeight(bufferPtr);
|
|
15810
15987
|
const widthMethod = widthMethodFromCode(this.opentui.symbols.getBufferWidthMethod(bufferPtr));
|
|
15811
|
-
return new
|
|
15988
|
+
return new OptimizedBuffer2(this, bufferPtr, width, height, { id: "current buffer", widthMethod });
|
|
15812
15989
|
}
|
|
15813
15990
|
rendererSetPaletteState(renderer, palette, defaultForeground, defaultBackground, paletteEpoch) {
|
|
15814
15991
|
const paletteBuffer = new Uint16Array(palette.length * 4);
|
|
@@ -15818,32 +15995,32 @@ class FFIRenderLib {
|
|
|
15818
15995
|
this.opentui.symbols.rendererSetPaletteState(renderer, paletteBuffer, palette.length, rgbaBuffer(defaultForeground), rgbaBuffer(defaultBackground), paletteEpoch >>> 0);
|
|
15819
15996
|
}
|
|
15820
15997
|
bufferGetCharPtr(buffer) {
|
|
15821
|
-
const
|
|
15822
|
-
if (!
|
|
15998
|
+
const ptr = this.opentui.symbols.bufferGetCharPtr(buffer);
|
|
15999
|
+
if (!ptr) {
|
|
15823
16000
|
throw new Error("Failed to get char pointer");
|
|
15824
16001
|
}
|
|
15825
|
-
return
|
|
16002
|
+
return ptr;
|
|
15826
16003
|
}
|
|
15827
16004
|
bufferGetFgPtr(buffer) {
|
|
15828
|
-
const
|
|
15829
|
-
if (!
|
|
16005
|
+
const ptr = this.opentui.symbols.bufferGetFgPtr(buffer);
|
|
16006
|
+
if (!ptr) {
|
|
15830
16007
|
throw new Error("Failed to get fg pointer");
|
|
15831
16008
|
}
|
|
15832
|
-
return
|
|
16009
|
+
return ptr;
|
|
15833
16010
|
}
|
|
15834
16011
|
bufferGetBgPtr(buffer) {
|
|
15835
|
-
const
|
|
15836
|
-
if (!
|
|
16012
|
+
const ptr = this.opentui.symbols.bufferGetBgPtr(buffer);
|
|
16013
|
+
if (!ptr) {
|
|
15837
16014
|
throw new Error("Failed to get bg pointer");
|
|
15838
16015
|
}
|
|
15839
|
-
return
|
|
16016
|
+
return ptr;
|
|
15840
16017
|
}
|
|
15841
16018
|
bufferGetAttributesPtr(buffer) {
|
|
15842
|
-
const
|
|
15843
|
-
if (!
|
|
16019
|
+
const ptr = this.opentui.symbols.bufferGetAttributesPtr(buffer);
|
|
16020
|
+
if (!ptr) {
|
|
15844
16021
|
throw new Error("Failed to get attributes pointer");
|
|
15845
16022
|
}
|
|
15846
|
-
return
|
|
16023
|
+
return ptr;
|
|
15847
16024
|
}
|
|
15848
16025
|
bufferGetRespectAlpha(buffer) {
|
|
15849
16026
|
return this.opentui.symbols.bufferGetRespectAlpha(buffer);
|
|
@@ -15874,25 +16051,25 @@ class FFIRenderLib {
|
|
|
15874
16051
|
}
|
|
15875
16052
|
bufferDrawText(buffer, text, x, y, color, bgColor, attributes) {
|
|
15876
16053
|
const textBytes = this.encoder.encode(text);
|
|
15877
|
-
const
|
|
15878
|
-
const
|
|
15879
|
-
this.opentui.symbols.bufferDrawText(buffer, viewOrNull(textBytes), textBytes.byteLength, x, y,
|
|
16054
|
+
const bg = optionalRgbaBuffer(bgColor);
|
|
16055
|
+
const fg = rgbaBuffer(color);
|
|
16056
|
+
this.opentui.symbols.bufferDrawText(buffer, viewOrNull(textBytes), textBytes.byteLength, x, y, fg, bg, attributes ?? 0);
|
|
15880
16057
|
}
|
|
15881
16058
|
bufferSetCellWithAlphaBlending(buffer, x, y, char, color, bgColor, attributes) {
|
|
15882
16059
|
const charPtr = char.codePointAt(0) ?? " ".codePointAt(0);
|
|
15883
|
-
const
|
|
15884
|
-
const
|
|
15885
|
-
this.opentui.symbols.bufferSetCellWithAlphaBlending(buffer, x, y, charPtr,
|
|
16060
|
+
const bg = rgbaBuffer(bgColor);
|
|
16061
|
+
const fg = rgbaBuffer(color);
|
|
16062
|
+
this.opentui.symbols.bufferSetCellWithAlphaBlending(buffer, x, y, charPtr, fg, bg, attributes ?? 0);
|
|
15886
16063
|
}
|
|
15887
16064
|
bufferSetCell(buffer, x, y, char, color, bgColor, attributes) {
|
|
15888
16065
|
const charPtr = char.codePointAt(0) ?? " ".codePointAt(0);
|
|
15889
|
-
const
|
|
15890
|
-
const
|
|
15891
|
-
this.opentui.symbols.bufferSetCell(buffer, x, y, charPtr,
|
|
16066
|
+
const bg = rgbaBuffer(bgColor);
|
|
16067
|
+
const fg = rgbaBuffer(color);
|
|
16068
|
+
this.opentui.symbols.bufferSetCell(buffer, x, y, charPtr, fg, bg, attributes ?? 0);
|
|
15892
16069
|
}
|
|
15893
16070
|
bufferFillRect(buffer, x, y, width, height, color) {
|
|
15894
|
-
const
|
|
15895
|
-
this.opentui.symbols.bufferFillRect(buffer, x, y, width, height,
|
|
16071
|
+
const bg = rgbaBuffer(color);
|
|
16072
|
+
this.opentui.symbols.bufferFillRect(buffer, x, y, width, height, bg);
|
|
15896
16073
|
}
|
|
15897
16074
|
bufferColorMatrix(buffer, matrix, cellMask, cellMaskCount, strength, target) {
|
|
15898
16075
|
this.opentui.symbols.bufferColorMatrix(buffer, matrix, cellMask, cellMaskCount, strength, target);
|
|
@@ -15920,20 +16097,20 @@ class FFIRenderLib {
|
|
|
15920
16097
|
sourceHeight,
|
|
15921
16098
|
protocol: protocolId
|
|
15922
16099
|
}, storage.view, 0);
|
|
15923
|
-
return Boolean(this.opentui.symbols.bufferDrawImage(buffer, image, storage.
|
|
16100
|
+
return Boolean(this.opentui.symbols.bufferDrawImage(buffer, image, storage.ffiView));
|
|
15924
16101
|
}
|
|
15925
16102
|
bufferDrawPackedBuffer(buffer, data, dataLen, posX, posY, terminalWidthCells, terminalHeightCells) {
|
|
15926
16103
|
this.opentui.symbols.bufferDrawPackedBuffer(buffer, data, dataLen, posX, posY, terminalWidthCells, terminalHeightCells);
|
|
15927
16104
|
}
|
|
15928
|
-
bufferDrawGrayscaleBuffer(buffer, posX, posY, intensities, srcWidth, srcHeight,
|
|
15929
|
-
this.opentui.symbols.bufferDrawGrayscaleBuffer(buffer, posX, posY, intensities, srcWidth, srcHeight, optionalRgbaBuffer(
|
|
16105
|
+
bufferDrawGrayscaleBuffer(buffer, posX, posY, intensities, srcWidth, srcHeight, fg, bg) {
|
|
16106
|
+
this.opentui.symbols.bufferDrawGrayscaleBuffer(buffer, posX, posY, intensities, srcWidth, srcHeight, optionalRgbaBuffer(fg), optionalRgbaBuffer(bg));
|
|
15930
16107
|
}
|
|
15931
|
-
bufferDrawGrayscaleBufferSupersampled(buffer, posX, posY, intensities, srcWidth, srcHeight,
|
|
15932
|
-
this.opentui.symbols.bufferDrawGrayscaleBufferSupersampled(buffer, posX, posY, intensities, srcWidth, srcHeight, optionalRgbaBuffer(
|
|
16108
|
+
bufferDrawGrayscaleBufferSupersampled(buffer, posX, posY, intensities, srcWidth, srcHeight, fg, bg) {
|
|
16109
|
+
this.opentui.symbols.bufferDrawGrayscaleBufferSupersampled(buffer, posX, posY, intensities, srcWidth, srcHeight, optionalRgbaBuffer(fg), optionalRgbaBuffer(bg));
|
|
15933
16110
|
}
|
|
15934
16111
|
bufferDrawGrid(buffer, borderChars, borderFg, borderBg, columnOffsets, columnCount, rowOffsets, rowCount, options) {
|
|
15935
16112
|
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.
|
|
16113
|
+
this.opentui.symbols.bufferDrawGrid(buffer, borderChars, rgbaBuffer(borderFg), rgbaBuffer(borderBg), columnOffsets, columnCount, rowOffsets, rowCount, this.ffiStructStorage.gridDrawOptions.ffiView);
|
|
15937
16114
|
}
|
|
15938
16115
|
bufferDrawBox(buffer, x, y, width, height, borderChars, packedOptions, borderColor, backgroundColor, titleColor, title, bottomTitle) {
|
|
15939
16116
|
const titleBytes = title ? this.encoder.encode(title) : null;
|
|
@@ -15951,7 +16128,7 @@ class FFIRenderLib {
|
|
|
15951
16128
|
const urlBytes = this.encoder.encode(url);
|
|
15952
16129
|
return this.opentui.symbols.linkAlloc(viewOrNull(urlBytes), urlBytes.byteLength);
|
|
15953
16130
|
}
|
|
15954
|
-
linkGetUrl(linkId, maxLen =
|
|
16131
|
+
linkGetUrl(linkId, maxLen = MAX_LINK_URL_BYTES2) {
|
|
15955
16132
|
const outBuffer = new Uint8Array(maxLen);
|
|
15956
16133
|
const actualLen = this.opentui.symbols.linkGetUrl(linkId, viewOrNull(outBuffer), maxLen);
|
|
15957
16134
|
return this.decoder.decode(outBuffer.slice(0, actualLen));
|
|
@@ -15981,7 +16158,7 @@ class FFIRenderLib {
|
|
|
15981
16158
|
visible: struct.visible,
|
|
15982
16159
|
style: CURSOR_ID_TO_STYLE[struct.style] ?? "block",
|
|
15983
16160
|
blinking: struct.blinking,
|
|
15984
|
-
color:
|
|
16161
|
+
color: RGBA2.fromValues(struct.r, struct.g, struct.b, struct.a)
|
|
15985
16162
|
};
|
|
15986
16163
|
}
|
|
15987
16164
|
setCursorStyleOptions(renderer, options) {
|
|
@@ -16018,7 +16195,7 @@ class FFIRenderLib {
|
|
|
16018
16195
|
if (!bufferPtr) {
|
|
16019
16196
|
throw new Error(`Failed to create optimized buffer: ${width}x${height}`);
|
|
16020
16197
|
}
|
|
16021
|
-
return new
|
|
16198
|
+
return new OptimizedBuffer2(this, bufferPtr, width, height, { respectAlpha, id, widthMethod });
|
|
16022
16199
|
}
|
|
16023
16200
|
destroyOptimizedBuffer(bufferPtr) {
|
|
16024
16201
|
this.opentui.symbols.destroyOptimizedBuffer(bufferPtr);
|
|
@@ -16086,19 +16263,19 @@ class FFIRenderLib {
|
|
|
16086
16263
|
operation: output[0] === 0 ? null : output[0]
|
|
16087
16264
|
};
|
|
16088
16265
|
}
|
|
16089
|
-
clipboardReadOperationStart(service, request,
|
|
16266
|
+
clipboardReadOperationStart(service, request, selection, maxBytes, maxImagePixels, maxConversionBytes, timeoutMs) {
|
|
16090
16267
|
const output = new Uint32Array(1);
|
|
16091
|
-
const status = this.opentui.symbols.clipboardReadOperationStart(service, request, toSafeFFIU32Length(request.byteLength, "clipboard read request"),
|
|
16268
|
+
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
16269
|
return this.clipboardStartResult(status, output);
|
|
16093
16270
|
}
|
|
16094
|
-
clipboardWriteOperationStart(service, textUtf8,
|
|
16271
|
+
clipboardWriteOperationStart(service, textUtf8, selection, timeoutMs) {
|
|
16095
16272
|
const output = new Uint32Array(1);
|
|
16096
|
-
const status = this.opentui.symbols.clipboardWriteOperationStart(service, textUtf8, toSafeFFIU32Length(textUtf8.byteLength, "clipboard write text"),
|
|
16273
|
+
const status = this.opentui.symbols.clipboardWriteOperationStart(service, textUtf8, toSafeFFIU32Length(textUtf8.byteLength, "clipboard write text"), selection, toSafeFFIU32Length(timeoutMs, "clipboard write timeout"), output);
|
|
16097
16274
|
return this.clipboardStartResult(status, output);
|
|
16098
16275
|
}
|
|
16099
|
-
clipboardClearOperationStart(service,
|
|
16276
|
+
clipboardClearOperationStart(service, selection, timeoutMs) {
|
|
16100
16277
|
const output = new Uint32Array(1);
|
|
16101
|
-
const status = this.opentui.symbols.clipboardClearOperationStart(service,
|
|
16278
|
+
const status = this.opentui.symbols.clipboardClearOperationStart(service, selection, toSafeFFIU32Length(timeoutMs, "clipboard clear timeout"), output);
|
|
16102
16279
|
return this.clipboardStartResult(status, output);
|
|
16103
16280
|
}
|
|
16104
16281
|
clipboardOperationPoll(operation) {
|
|
@@ -16355,8 +16532,8 @@ class FFIRenderLib {
|
|
|
16355
16532
|
yogaNodeStyleGetFloat(node, kind) {
|
|
16356
16533
|
return this.opentui.symbols.yogaNodeStyleGetFloat(node, kind);
|
|
16357
16534
|
}
|
|
16358
|
-
yogaNodeStyleSetBorder(node, edge,
|
|
16359
|
-
this.opentui.symbols.yogaNodeStyleSetBorder(node, edge,
|
|
16535
|
+
yogaNodeStyleSetBorder(node, edge, border) {
|
|
16536
|
+
this.opentui.symbols.yogaNodeStyleSetBorder(node, edge, border);
|
|
16360
16537
|
}
|
|
16361
16538
|
yogaNodeStyleGetBorder(node, edge) {
|
|
16362
16539
|
return this.opentui.symbols.yogaNodeStyleGetBorder(node, edge);
|
|
@@ -16408,7 +16585,7 @@ class FFIRenderLib {
|
|
|
16408
16585
|
if (!bufferPtr) {
|
|
16409
16586
|
throw new Error(`Failed to create TextBuffer`);
|
|
16410
16587
|
}
|
|
16411
|
-
return new
|
|
16588
|
+
return new TextBuffer2(this, bufferPtr);
|
|
16412
16589
|
}
|
|
16413
16590
|
destroyTextBuffer(buffer) {
|
|
16414
16591
|
this.opentui.symbols.destroyTextBuffer(buffer);
|
|
@@ -16425,12 +16602,12 @@ class FFIRenderLib {
|
|
|
16425
16602
|
textBufferClear(buffer) {
|
|
16426
16603
|
this.opentui.symbols.textBufferClear(buffer);
|
|
16427
16604
|
}
|
|
16428
|
-
textBufferSetDefaultFg(buffer,
|
|
16429
|
-
const fgBuffer = optionalRgbaBuffer(
|
|
16605
|
+
textBufferSetDefaultFg(buffer, fg) {
|
|
16606
|
+
const fgBuffer = optionalRgbaBuffer(fg);
|
|
16430
16607
|
this.opentui.symbols.textBufferSetDefaultFg(buffer, fgBuffer);
|
|
16431
16608
|
}
|
|
16432
|
-
textBufferSetDefaultBg(buffer,
|
|
16433
|
-
const bgBuffer = optionalRgbaBuffer(
|
|
16609
|
+
textBufferSetDefaultBg(buffer, bg) {
|
|
16610
|
+
const bgBuffer = optionalRgbaBuffer(bg);
|
|
16434
16611
|
this.opentui.symbols.textBufferSetDefaultBg(buffer, bgBuffer);
|
|
16435
16612
|
}
|
|
16436
16613
|
textBufferSetDefaultAttributes(buffer, attributes) {
|
|
@@ -16468,8 +16645,8 @@ class FFIRenderLib {
|
|
|
16468
16645
|
textBufferAppendFromMemId(buffer, memId) {
|
|
16469
16646
|
this.opentui.symbols.textBufferAppendFromMemId(buffer, memId);
|
|
16470
16647
|
}
|
|
16471
|
-
textBufferLoadFile(buffer,
|
|
16472
|
-
const pathBytes = this.encoder.encode(
|
|
16648
|
+
textBufferLoadFile(buffer, path) {
|
|
16649
|
+
const pathBytes = this.encoder.encode(path);
|
|
16473
16650
|
return this.opentui.symbols.textBufferLoadFile(buffer, viewOrNull(pathBytes), pathBytes.byteLength);
|
|
16474
16651
|
}
|
|
16475
16652
|
textBufferSetStyledText(buffer, chunks) {
|
|
@@ -16523,39 +16700,39 @@ class FFIRenderLib {
|
|
|
16523
16700
|
this.opentui.symbols.destroyTextBufferView(view);
|
|
16524
16701
|
}
|
|
16525
16702
|
textBufferViewSetSelection(view, start, end, bgColor, fgColor) {
|
|
16526
|
-
const
|
|
16527
|
-
const
|
|
16528
|
-
this.opentui.symbols.textBufferViewSetSelection(view, start, end,
|
|
16703
|
+
const bg = optionalRgbaBuffer(bgColor);
|
|
16704
|
+
const fg = optionalRgbaBuffer(fgColor);
|
|
16705
|
+
this.opentui.symbols.textBufferViewSetSelection(view, start, end, bg, fg);
|
|
16529
16706
|
}
|
|
16530
16707
|
textBufferViewResetSelection(view) {
|
|
16531
16708
|
this.opentui.symbols.textBufferViewResetSelection(view);
|
|
16532
16709
|
}
|
|
16533
16710
|
textBufferViewGetSelection(view) {
|
|
16534
16711
|
const packedInfo = this.textBufferViewGetSelectionInfo(view);
|
|
16535
|
-
if (packedInfo ===
|
|
16712
|
+
if (packedInfo === 0xffffffffffffffffn) {
|
|
16536
16713
|
return null;
|
|
16537
16714
|
}
|
|
16538
16715
|
const start = Number(packedInfo >> 32n);
|
|
16539
|
-
const end = Number(packedInfo &
|
|
16716
|
+
const end = Number(packedInfo & 0xffffffffn);
|
|
16540
16717
|
return { start, end };
|
|
16541
16718
|
}
|
|
16542
16719
|
textBufferViewGetSelectionInfo(view) {
|
|
16543
16720
|
return this.opentui.symbols.textBufferViewGetSelectionInfo(view);
|
|
16544
16721
|
}
|
|
16545
16722
|
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,
|
|
16723
|
+
const bg = optionalRgbaBuffer(bgColor);
|
|
16724
|
+
const fg = optionalRgbaBuffer(fgColor);
|
|
16725
|
+
return Boolean(this.opentui.symbols.textBufferViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bg, fg, selectionBehaviorByte(behavior)));
|
|
16549
16726
|
}
|
|
16550
16727
|
textBufferViewUpdateSelection(view, end, bgColor, fgColor) {
|
|
16551
|
-
const
|
|
16552
|
-
const
|
|
16553
|
-
this.opentui.symbols.textBufferViewUpdateSelection(view, end,
|
|
16728
|
+
const bg = optionalRgbaBuffer(bgColor);
|
|
16729
|
+
const fg = optionalRgbaBuffer(fgColor);
|
|
16730
|
+
this.opentui.symbols.textBufferViewUpdateSelection(view, end, bg, fg);
|
|
16554
16731
|
}
|
|
16555
16732
|
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,
|
|
16733
|
+
const bg = optionalRgbaBuffer(bgColor);
|
|
16734
|
+
const fg = optionalRgbaBuffer(fgColor);
|
|
16735
|
+
return Boolean(this.opentui.symbols.textBufferViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bg, fg, selectionBehaviorByte(behavior)));
|
|
16559
16736
|
}
|
|
16560
16737
|
textBufferViewResetLocalSelection(view) {
|
|
16561
16738
|
this.opentui.symbols.textBufferViewResetLocalSelection(view);
|
|
@@ -16573,6 +16750,10 @@ class FFIRenderLib {
|
|
|
16573
16750
|
const modeValue = mode === "none" ? 0 : mode === "char" ? 1 : 2;
|
|
16574
16751
|
this.opentui.symbols.textBufferViewSetWrapMode(view, modeValue);
|
|
16575
16752
|
}
|
|
16753
|
+
textBufferViewSetTextAlign(view, alignment) {
|
|
16754
|
+
const alignValue = alignment === "left" ? 0 : alignment === "center" ? 1 : 2;
|
|
16755
|
+
this.opentui.symbols.textBufferViewSetTextAlign(view, alignValue);
|
|
16756
|
+
}
|
|
16576
16757
|
textBufferViewSetFirstLineOffset(view, offset) {
|
|
16577
16758
|
this.opentui.symbols.textBufferViewSetFirstLineOffset(view, offset);
|
|
16578
16759
|
}
|
|
@@ -16615,6 +16796,20 @@ class FFIRenderLib {
|
|
|
16615
16796
|
textBufferViewGetVirtualLineCount(view) {
|
|
16616
16797
|
return this.opentui.symbols.textBufferViewGetVirtualLineCount(view);
|
|
16617
16798
|
}
|
|
16799
|
+
textBufferViewGetLineSources(view, startLine, lineCount) {
|
|
16800
|
+
toSafeFFIU32Length(startLine, "visual row start");
|
|
16801
|
+
toSafeFFIU32Length(lineCount, "visual row count");
|
|
16802
|
+
if (lineCount === 0)
|
|
16803
|
+
return [];
|
|
16804
|
+
const outBuffer = new ArrayBuffer(LineInfoStruct.size);
|
|
16805
|
+
this.textBufferViewGetLogicalLineInfoDirect(view, outBuffer);
|
|
16806
|
+
const data = new DataView(outBuffer);
|
|
16807
|
+
const sources = LineInfoStruct.arrayFields.get("sources");
|
|
16808
|
+
const count = Math.max(0, Math.min(lineCount, data.getUint32(sources.lengthOffset, true) - startLine));
|
|
16809
|
+
if (count === 0)
|
|
16810
|
+
return [];
|
|
16811
|
+
return Array.from(new Uint32Array(toArrayBuffer(toPointer(data.getBigUint64(sources.arrayOffset, true)), startLine * 4, count * 4)));
|
|
16812
|
+
}
|
|
16618
16813
|
textBufferViewGetLineInfoDirect(view, outBuffer) {
|
|
16619
16814
|
this.opentui.symbols.textBufferViewGetLineInfoDirect(view, outBuffer);
|
|
16620
16815
|
}
|
|
@@ -16654,7 +16849,7 @@ class FFIRenderLib {
|
|
|
16654
16849
|
}
|
|
16655
16850
|
textBufferViewMeasureForDimensions(view, width, height) {
|
|
16656
16851
|
const storage = this.ffiStructStorage.measureResult;
|
|
16657
|
-
const success = this.opentui.symbols.textBufferViewMeasureForDimensions(view, width, height, storage.
|
|
16852
|
+
const success = this.opentui.symbols.textBufferViewMeasureForDimensions(view, width, height, storage.ffiView);
|
|
16658
16853
|
if (!success)
|
|
16659
16854
|
return null;
|
|
16660
16855
|
const result = MeasureResultStruct.unpackInto(storage.view, storage.result);
|
|
@@ -16884,7 +17079,7 @@ class FFIRenderLib {
|
|
|
16884
17079
|
}
|
|
16885
17080
|
editBufferGetCursorPosition(buffer) {
|
|
16886
17081
|
const storage = this.ffiStructStorage.logicalCursor;
|
|
16887
|
-
this.opentui.symbols.editBufferGetCursorPosition(buffer, storage.
|
|
17082
|
+
this.opentui.symbols.editBufferGetCursorPosition(buffer, storage.ffiView);
|
|
16888
17083
|
const cursor = LogicalCursorStruct.unpackInto(storage.view, storage.result);
|
|
16889
17084
|
return { row: cursor.row, col: cursor.col, offset: cursor.offset };
|
|
16890
17085
|
}
|
|
@@ -16934,25 +17129,25 @@ class FFIRenderLib {
|
|
|
16934
17129
|
}
|
|
16935
17130
|
editBufferGetNextWordBoundary(buffer) {
|
|
16936
17131
|
const storage = this.ffiStructStorage.logicalCursor;
|
|
16937
|
-
this.opentui.symbols.editBufferGetNextWordBoundary(buffer, storage.
|
|
17132
|
+
this.opentui.symbols.editBufferGetNextWordBoundary(buffer, storage.ffiView);
|
|
16938
17133
|
const cursor = LogicalCursorStruct.unpackInto(storage.view, storage.result);
|
|
16939
17134
|
return { row: cursor.row, col: cursor.col, offset: cursor.offset };
|
|
16940
17135
|
}
|
|
16941
17136
|
editBufferGetPrevWordBoundary(buffer) {
|
|
16942
17137
|
const storage = this.ffiStructStorage.logicalCursor;
|
|
16943
|
-
this.opentui.symbols.editBufferGetPrevWordBoundary(buffer, storage.
|
|
17138
|
+
this.opentui.symbols.editBufferGetPrevWordBoundary(buffer, storage.ffiView);
|
|
16944
17139
|
const cursor = LogicalCursorStruct.unpackInto(storage.view, storage.result);
|
|
16945
17140
|
return { row: cursor.row, col: cursor.col, offset: cursor.offset };
|
|
16946
17141
|
}
|
|
16947
17142
|
editBufferGetEOL(buffer) {
|
|
16948
17143
|
const storage = this.ffiStructStorage.logicalCursor;
|
|
16949
|
-
this.opentui.symbols.editBufferGetEOL(buffer, storage.
|
|
17144
|
+
this.opentui.symbols.editBufferGetEOL(buffer, storage.ffiView);
|
|
16950
17145
|
const cursor = LogicalCursorStruct.unpackInto(storage.view, storage.result);
|
|
16951
17146
|
return { row: cursor.row, col: cursor.col, offset: cursor.offset };
|
|
16952
17147
|
}
|
|
16953
17148
|
editBufferOffsetToPosition(buffer, offset) {
|
|
16954
17149
|
const storage = this.ffiStructStorage.logicalCursor;
|
|
16955
|
-
const success = this.opentui.symbols.editBufferOffsetToPosition(buffer, offset, storage.
|
|
17150
|
+
const success = this.opentui.symbols.editBufferOffsetToPosition(buffer, offset, storage.ffiView);
|
|
16956
17151
|
if (!success)
|
|
16957
17152
|
return null;
|
|
16958
17153
|
const cursor = LogicalCursorStruct.unpackInto(storage.view, storage.result);
|
|
@@ -16981,36 +17176,36 @@ class FFIRenderLib {
|
|
|
16981
17176
|
return usesBunFFI ? outBuffer.slice(0, len) : trimNodeFFIOutputBytes(outBuffer, len);
|
|
16982
17177
|
}
|
|
16983
17178
|
editorViewSetSelection(view, start, end, bgColor, fgColor) {
|
|
16984
|
-
const
|
|
16985
|
-
const
|
|
16986
|
-
this.opentui.symbols.editorViewSetSelection(view, start, end,
|
|
17179
|
+
const bg = optionalRgbaBuffer(bgColor);
|
|
17180
|
+
const fg = optionalRgbaBuffer(fgColor);
|
|
17181
|
+
this.opentui.symbols.editorViewSetSelection(view, start, end, bg, fg);
|
|
16987
17182
|
}
|
|
16988
17183
|
editorViewResetSelection(view) {
|
|
16989
17184
|
this.opentui.symbols.editorViewResetSelection(view);
|
|
16990
17185
|
}
|
|
16991
17186
|
editorViewGetSelection(view) {
|
|
16992
17187
|
const packedInfo = this.opentui.symbols.editorViewGetSelection(view);
|
|
16993
|
-
if (packedInfo ===
|
|
17188
|
+
if (packedInfo === 0xffffffffffffffffn) {
|
|
16994
17189
|
return null;
|
|
16995
17190
|
}
|
|
16996
17191
|
const start = Number(packedInfo >> 32n);
|
|
16997
|
-
const end = Number(packedInfo &
|
|
17192
|
+
const end = Number(packedInfo & 0xffffffffn);
|
|
16998
17193
|
return { start, end };
|
|
16999
17194
|
}
|
|
17000
17195
|
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,
|
|
17196
|
+
const bg = optionalRgbaBuffer(bgColor);
|
|
17197
|
+
const fg = optionalRgbaBuffer(fgColor);
|
|
17198
|
+
return Boolean(this.opentui.symbols.editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bg, fg, editorLocalSelectionFlags(updateCursor, followCursor, behavior)));
|
|
17004
17199
|
}
|
|
17005
17200
|
editorViewUpdateSelection(view, end, bgColor, fgColor) {
|
|
17006
|
-
const
|
|
17007
|
-
const
|
|
17008
|
-
this.opentui.symbols.editorViewUpdateSelection(view, end,
|
|
17201
|
+
const bg = optionalRgbaBuffer(bgColor);
|
|
17202
|
+
const fg = optionalRgbaBuffer(fgColor);
|
|
17203
|
+
this.opentui.symbols.editorViewUpdateSelection(view, end, bg, fg);
|
|
17009
17204
|
}
|
|
17010
17205
|
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,
|
|
17206
|
+
const bg = optionalRgbaBuffer(bgColor);
|
|
17207
|
+
const fg = optionalRgbaBuffer(fgColor);
|
|
17208
|
+
return Boolean(this.opentui.symbols.editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bg, fg, editorLocalSelectionFlags(updateCursor, followCursor, behavior)));
|
|
17014
17209
|
}
|
|
17015
17210
|
editorViewResetLocalSelection(view) {
|
|
17016
17211
|
this.opentui.symbols.editorViewResetLocalSelection(view);
|
|
@@ -17022,14 +17217,14 @@ class FFIRenderLib {
|
|
|
17022
17217
|
this.opentui.symbols.editorViewSetSelectionOccupancy(view, occupancy === "boundary" ? 1 : 0);
|
|
17023
17218
|
}
|
|
17024
17219
|
editorViewSetSelectionInclusive(view, start, end, bgColor, fgColor) {
|
|
17025
|
-
const
|
|
17026
|
-
const
|
|
17027
|
-
this.opentui.symbols.editorViewSetSelectionInclusive(view, start, end,
|
|
17220
|
+
const bg = optionalRgbaBuffer(bgColor);
|
|
17221
|
+
const fg = optionalRgbaBuffer(fgColor);
|
|
17222
|
+
this.opentui.symbols.editorViewSetSelectionInclusive(view, start, end, bg, fg);
|
|
17028
17223
|
}
|
|
17029
17224
|
editorViewSetSelectionColors(view, bgColor, fgColor) {
|
|
17030
|
-
const
|
|
17031
|
-
const
|
|
17032
|
-
this.opentui.symbols.editorViewSetSelectionColors(view,
|
|
17225
|
+
const bg = optionalRgbaBuffer(bgColor);
|
|
17226
|
+
const fg = optionalRgbaBuffer(fgColor);
|
|
17227
|
+
this.opentui.symbols.editorViewSetSelectionColors(view, bg, fg);
|
|
17033
17228
|
}
|
|
17034
17229
|
editorViewGetSelectedTextBytes(view, maxLength) {
|
|
17035
17230
|
const outBuffer = new Uint8Array(maxLength);
|
|
@@ -17055,7 +17250,7 @@ class FFIRenderLib {
|
|
|
17055
17250
|
}
|
|
17056
17251
|
editorViewGetVisualCursor(view) {
|
|
17057
17252
|
const storage = this.ffiStructStorage.visualCursor;
|
|
17058
|
-
this.opentui.symbols.editorViewGetVisualCursor(view, storage.
|
|
17253
|
+
this.opentui.symbols.editorViewGetVisualCursor(view, storage.ffiView);
|
|
17059
17254
|
const cursor = VisualCursorStruct.unpackInto(storage.view, storage.result);
|
|
17060
17255
|
return { ...cursor };
|
|
17061
17256
|
}
|
|
@@ -17073,31 +17268,31 @@ class FFIRenderLib {
|
|
|
17073
17268
|
}
|
|
17074
17269
|
editorViewGetNextWordBoundary(view) {
|
|
17075
17270
|
const storage = this.ffiStructStorage.visualCursor;
|
|
17076
|
-
this.opentui.symbols.editorViewGetNextWordBoundary(view, storage.
|
|
17271
|
+
this.opentui.symbols.editorViewGetNextWordBoundary(view, storage.ffiView);
|
|
17077
17272
|
const cursor = VisualCursorStruct.unpackInto(storage.view, storage.result);
|
|
17078
17273
|
return { ...cursor };
|
|
17079
17274
|
}
|
|
17080
17275
|
editorViewGetPrevWordBoundary(view) {
|
|
17081
17276
|
const storage = this.ffiStructStorage.visualCursor;
|
|
17082
|
-
this.opentui.symbols.editorViewGetPrevWordBoundary(view, storage.
|
|
17277
|
+
this.opentui.symbols.editorViewGetPrevWordBoundary(view, storage.ffiView);
|
|
17083
17278
|
const cursor = VisualCursorStruct.unpackInto(storage.view, storage.result);
|
|
17084
17279
|
return { ...cursor };
|
|
17085
17280
|
}
|
|
17086
17281
|
editorViewGetEOL(view) {
|
|
17087
17282
|
const storage = this.ffiStructStorage.visualCursor;
|
|
17088
|
-
this.opentui.symbols.editorViewGetEOL(view, storage.
|
|
17283
|
+
this.opentui.symbols.editorViewGetEOL(view, storage.ffiView);
|
|
17089
17284
|
const cursor = VisualCursorStruct.unpackInto(storage.view, storage.result);
|
|
17090
17285
|
return { ...cursor };
|
|
17091
17286
|
}
|
|
17092
17287
|
editorViewGetVisualSOL(view) {
|
|
17093
17288
|
const storage = this.ffiStructStorage.visualCursor;
|
|
17094
|
-
this.opentui.symbols.editorViewGetVisualSOL(view, storage.
|
|
17289
|
+
this.opentui.symbols.editorViewGetVisualSOL(view, storage.ffiView);
|
|
17095
17290
|
const cursor = VisualCursorStruct.unpackInto(storage.view, storage.result);
|
|
17096
17291
|
return { ...cursor };
|
|
17097
17292
|
}
|
|
17098
17293
|
editorViewGetVisualEOL(view) {
|
|
17099
17294
|
const storage = this.ffiStructStorage.visualCursor;
|
|
17100
|
-
this.opentui.symbols.editorViewGetVisualEOL(view, storage.
|
|
17295
|
+
this.opentui.symbols.editorViewGetVisualEOL(view, storage.ffiView);
|
|
17101
17296
|
const cursor = VisualCursorStruct.unpackInto(storage.view, storage.result);
|
|
17102
17297
|
return { ...cursor };
|
|
17103
17298
|
}
|
|
@@ -17203,8 +17398,8 @@ class FFIRenderLib {
|
|
|
17203
17398
|
freeUnicode(encoded) {
|
|
17204
17399
|
this.opentui.symbols.freeUnicode(encoded.ptr, encoded.data.length);
|
|
17205
17400
|
}
|
|
17206
|
-
bufferDrawChar(buffer, char, x, y,
|
|
17207
|
-
this.opentui.symbols.bufferDrawChar(buffer, char, x, y, rgbaBuffer(
|
|
17401
|
+
bufferDrawChar(buffer, char, x, y, fg, bg, attributes = 0) {
|
|
17402
|
+
this.opentui.symbols.bufferDrawChar(buffer, char, x, y, rgbaBuffer(fg), rgbaBuffer(bg), attributes);
|
|
17208
17403
|
}
|
|
17209
17404
|
createAudioEngine(options) {
|
|
17210
17405
|
const optionsBuffer = options == null ? null : AudioCreateOptionsStruct.pack(options);
|
|
@@ -17321,15 +17516,15 @@ class FFIRenderLib {
|
|
|
17321
17516
|
return this.opentui.symbols.audioStop(engine);
|
|
17322
17517
|
}
|
|
17323
17518
|
audioCreateStream(engine, options) {
|
|
17324
|
-
if (!isFFIU32(options.groupId) || options.
|
|
17519
|
+
if (!isFFIU32(options.groupId) || !isFFIU32(options.sampleRate ?? 0) || !isFFIU32(options.channels ?? 0) || !Object.values(NativeAudioStreamFormat3).includes(options.format)) {
|
|
17325
17520
|
return { status: -1, streamId: null };
|
|
17326
17521
|
}
|
|
17327
|
-
const optionsBuffer = AudioStreamCreateOptionsStruct.pack(options);
|
|
17328
|
-
const outBuffer = new
|
|
17522
|
+
const optionsBuffer = new Uint8Array(AudioStreamCreateOptionsStruct.pack(options));
|
|
17523
|
+
const outBuffer = new Uint32Array(1);
|
|
17329
17524
|
const status = this.opentui.symbols.audioCreateStream(engine, optionsBuffer, outBuffer);
|
|
17330
17525
|
if (status !== 0)
|
|
17331
17526
|
return { status, streamId: null };
|
|
17332
|
-
return { status, streamId:
|
|
17527
|
+
return { status, streamId: outBuffer[0] ?? null };
|
|
17333
17528
|
}
|
|
17334
17529
|
audioWriteStream(engine, streamId, data) {
|
|
17335
17530
|
const dataLength = toSafeFFIU32Length(data.byteLength, "Audio stream data length");
|
|
@@ -17354,7 +17549,7 @@ class FFIRenderLib {
|
|
|
17354
17549
|
}
|
|
17355
17550
|
audioGetStreamStats(engine, streamId) {
|
|
17356
17551
|
const storage = this.ffiStructStorage.audioStreamStats;
|
|
17357
|
-
const status = this.opentui.symbols.audioGetStreamStats(engine, streamId, storage.
|
|
17552
|
+
const status = this.opentui.symbols.audioGetStreamStats(engine, streamId, storage.ffiView);
|
|
17358
17553
|
if (status !== 0)
|
|
17359
17554
|
return null;
|
|
17360
17555
|
const stats = AudioStreamStatsStruct.unpackInto(storage.view, storage.result);
|
|
@@ -17362,7 +17557,7 @@ class FFIRenderLib {
|
|
|
17362
17557
|
}
|
|
17363
17558
|
audioCloseStream(engine, streamId, reason) {
|
|
17364
17559
|
const storage = this.ffiStructStorage.audioStreamStats;
|
|
17365
|
-
const status = this.opentui.symbols.audioCloseStream(engine, streamId, reason, storage.
|
|
17560
|
+
const status = this.opentui.symbols.audioCloseStream(engine, streamId, reason, storage.ffiView);
|
|
17366
17561
|
if (status !== 0)
|
|
17367
17562
|
return { status, stats: null };
|
|
17368
17563
|
const stats = AudioStreamStatsStruct.unpackInto(storage.view, storage.result);
|
|
@@ -17526,10 +17721,10 @@ class FFIRenderLib {
|
|
|
17526
17721
|
destroySyntaxStyle(style) {
|
|
17527
17722
|
this.opentui.symbols.destroySyntaxStyle(style);
|
|
17528
17723
|
}
|
|
17529
|
-
syntaxStyleRegister(style, name,
|
|
17724
|
+
syntaxStyleRegister(style, name, fg, bg, attributes) {
|
|
17530
17725
|
const nameBytes = this.encoder.encode(name);
|
|
17531
|
-
const fgBuffer = optionalRgbaBuffer(
|
|
17532
|
-
const bgBuffer = optionalRgbaBuffer(
|
|
17726
|
+
const fgBuffer = optionalRgbaBuffer(fg);
|
|
17727
|
+
const bgBuffer = optionalRgbaBuffer(bg);
|
|
17533
17728
|
return this.opentui.symbols.syntaxStyleRegister(style, viewOrNull(nameBytes), nameBytes.byteLength, fgBuffer, bgBuffer, attributes);
|
|
17534
17729
|
}
|
|
17535
17730
|
syntaxStyleResolveByName(style, name) {
|
|
@@ -17658,7 +17853,7 @@ class FFIRenderLib {
|
|
|
17658
17853
|
var opentuiLibPath;
|
|
17659
17854
|
var opentuiLib;
|
|
17660
17855
|
var renderLibResolved = false;
|
|
17661
|
-
function
|
|
17856
|
+
function setRenderLibPath2(libPath) {
|
|
17662
17857
|
if (opentuiLibPath !== libPath) {
|
|
17663
17858
|
if (renderLibResolved) {
|
|
17664
17859
|
throw new Error("setRenderLibPath() must be called before resolveRenderLib()");
|
|
@@ -17670,7 +17865,7 @@ function setRenderLibPath(libPath) {
|
|
|
17670
17865
|
opentuiLib = undefined;
|
|
17671
17866
|
}
|
|
17672
17867
|
}
|
|
17673
|
-
function
|
|
17868
|
+
function resolveRenderLib2() {
|
|
17674
17869
|
if (!opentuiLib) {
|
|
17675
17870
|
try {
|
|
17676
17871
|
opentuiLib = new FFIRenderLib(opentuiLibPath);
|
|
@@ -17686,204 +17881,204 @@ try {
|
|
|
17686
17881
|
} catch (error) {}
|
|
17687
17882
|
|
|
17688
17883
|
// 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
|
|
17884
|
+
var Align2;
|
|
17885
|
+
((Align) => {
|
|
17886
|
+
Align[Align["Auto"] = 0] = "Auto";
|
|
17887
|
+
Align[Align["FlexStart"] = 1] = "FlexStart";
|
|
17888
|
+
Align[Align["Center"] = 2] = "Center";
|
|
17889
|
+
Align[Align["FlexEnd"] = 3] = "FlexEnd";
|
|
17890
|
+
Align[Align["Stretch"] = 4] = "Stretch";
|
|
17891
|
+
Align[Align["Baseline"] = 5] = "Baseline";
|
|
17892
|
+
Align[Align["SpaceBetween"] = 6] = "SpaceBetween";
|
|
17893
|
+
Align[Align["SpaceAround"] = 7] = "SpaceAround";
|
|
17894
|
+
Align[Align["SpaceEvenly"] = 8] = "SpaceEvenly";
|
|
17895
|
+
})(Align2 ||= {});
|
|
17896
|
+
var BoxSizing2;
|
|
17897
|
+
((BoxSizing) => {
|
|
17898
|
+
BoxSizing[BoxSizing["BorderBox"] = 0] = "BorderBox";
|
|
17899
|
+
BoxSizing[BoxSizing["ContentBox"] = 1] = "ContentBox";
|
|
17900
|
+
})(BoxSizing2 ||= {});
|
|
17901
|
+
var Dimension2;
|
|
17902
|
+
((Dimension) => {
|
|
17903
|
+
Dimension[Dimension["Width"] = 0] = "Width";
|
|
17904
|
+
Dimension[Dimension["Height"] = 1] = "Height";
|
|
17905
|
+
})(Dimension2 ||= {});
|
|
17906
|
+
var Direction2;
|
|
17907
|
+
((Direction) => {
|
|
17908
|
+
Direction[Direction["Inherit"] = 0] = "Inherit";
|
|
17909
|
+
Direction[Direction["LTR"] = 1] = "LTR";
|
|
17910
|
+
Direction[Direction["RTL"] = 2] = "RTL";
|
|
17911
|
+
})(Direction2 ||= {});
|
|
17912
|
+
var Display2;
|
|
17913
|
+
((Display) => {
|
|
17914
|
+
Display[Display["Flex"] = 0] = "Flex";
|
|
17915
|
+
Display[Display["None"] = 1] = "None";
|
|
17916
|
+
Display[Display["Contents"] = 2] = "Contents";
|
|
17917
|
+
})(Display2 ||= {});
|
|
17918
|
+
var Edge2;
|
|
17919
|
+
((Edge) => {
|
|
17920
|
+
Edge[Edge["Left"] = 0] = "Left";
|
|
17921
|
+
Edge[Edge["Top"] = 1] = "Top";
|
|
17922
|
+
Edge[Edge["Right"] = 2] = "Right";
|
|
17923
|
+
Edge[Edge["Bottom"] = 3] = "Bottom";
|
|
17924
|
+
Edge[Edge["Start"] = 4] = "Start";
|
|
17925
|
+
Edge[Edge["End"] = 5] = "End";
|
|
17926
|
+
Edge[Edge["Horizontal"] = 6] = "Horizontal";
|
|
17927
|
+
Edge[Edge["Vertical"] = 7] = "Vertical";
|
|
17928
|
+
Edge[Edge["All"] = 8] = "All";
|
|
17929
|
+
})(Edge2 ||= {});
|
|
17930
|
+
var Errata2;
|
|
17931
|
+
((Errata) => {
|
|
17932
|
+
Errata[Errata["None"] = 0] = "None";
|
|
17933
|
+
Errata[Errata["StretchFlexBasis"] = 1] = "StretchFlexBasis";
|
|
17934
|
+
Errata[Errata["AbsolutePositionWithoutInsetsExcludesPadding"] = 2] = "AbsolutePositionWithoutInsetsExcludesPadding";
|
|
17935
|
+
Errata[Errata["AbsolutePercentAgainstInnerSize"] = 4] = "AbsolutePercentAgainstInnerSize";
|
|
17936
|
+
Errata[Errata["All"] = 2147483647] = "All";
|
|
17937
|
+
Errata[Errata["Classic"] = 2147483646] = "Classic";
|
|
17938
|
+
})(Errata2 ||= {});
|
|
17939
|
+
var ExperimentalFeature2;
|
|
17940
|
+
((ExperimentalFeature) => {
|
|
17941
|
+
ExperimentalFeature[ExperimentalFeature["WebFlexBasis"] = 0] = "WebFlexBasis";
|
|
17942
|
+
})(ExperimentalFeature2 ||= {});
|
|
17943
|
+
var FlexDirection2;
|
|
17944
|
+
((FlexDirection) => {
|
|
17945
|
+
FlexDirection[FlexDirection["Column"] = 0] = "Column";
|
|
17946
|
+
FlexDirection[FlexDirection["ColumnReverse"] = 1] = "ColumnReverse";
|
|
17947
|
+
FlexDirection[FlexDirection["Row"] = 2] = "Row";
|
|
17948
|
+
FlexDirection[FlexDirection["RowReverse"] = 3] = "RowReverse";
|
|
17949
|
+
})(FlexDirection2 ||= {});
|
|
17950
|
+
var Gutter2;
|
|
17951
|
+
((Gutter) => {
|
|
17952
|
+
Gutter[Gutter["Column"] = 0] = "Column";
|
|
17953
|
+
Gutter[Gutter["Row"] = 1] = "Row";
|
|
17954
|
+
Gutter[Gutter["All"] = 2] = "All";
|
|
17955
|
+
})(Gutter2 ||= {});
|
|
17956
|
+
var Justify2;
|
|
17957
|
+
((Justify) => {
|
|
17958
|
+
Justify[Justify["FlexStart"] = 0] = "FlexStart";
|
|
17959
|
+
Justify[Justify["Center"] = 1] = "Center";
|
|
17960
|
+
Justify[Justify["FlexEnd"] = 2] = "FlexEnd";
|
|
17961
|
+
Justify[Justify["SpaceBetween"] = 3] = "SpaceBetween";
|
|
17962
|
+
Justify[Justify["SpaceAround"] = 4] = "SpaceAround";
|
|
17963
|
+
Justify[Justify["SpaceEvenly"] = 5] = "SpaceEvenly";
|
|
17964
|
+
})(Justify2 ||= {});
|
|
17965
|
+
var LogLevel3;
|
|
17966
|
+
((LogLevel) => {
|
|
17967
|
+
LogLevel[LogLevel["Error"] = 0] = "Error";
|
|
17968
|
+
LogLevel[LogLevel["Warn"] = 1] = "Warn";
|
|
17969
|
+
LogLevel[LogLevel["Info"] = 2] = "Info";
|
|
17970
|
+
LogLevel[LogLevel["Debug"] = 3] = "Debug";
|
|
17971
|
+
LogLevel[LogLevel["Verbose"] = 4] = "Verbose";
|
|
17972
|
+
LogLevel[LogLevel["Fatal"] = 5] = "Fatal";
|
|
17973
|
+
})(LogLevel3 ||= {});
|
|
17974
|
+
var MeasureMode2;
|
|
17975
|
+
((MeasureMode) => {
|
|
17976
|
+
MeasureMode[MeasureMode["Undefined"] = 0] = "Undefined";
|
|
17977
|
+
MeasureMode[MeasureMode["Exactly"] = 1] = "Exactly";
|
|
17978
|
+
MeasureMode[MeasureMode["AtMost"] = 2] = "AtMost";
|
|
17979
|
+
})(MeasureMode2 ||= {});
|
|
17980
|
+
var NodeType2;
|
|
17981
|
+
((NodeType) => {
|
|
17982
|
+
NodeType[NodeType["Default"] = 0] = "Default";
|
|
17983
|
+
NodeType[NodeType["Text"] = 1] = "Text";
|
|
17984
|
+
})(NodeType2 ||= {});
|
|
17985
|
+
var Overflow2;
|
|
17986
|
+
((Overflow) => {
|
|
17987
|
+
Overflow[Overflow["Visible"] = 0] = "Visible";
|
|
17988
|
+
Overflow[Overflow["Hidden"] = 1] = "Hidden";
|
|
17989
|
+
Overflow[Overflow["Scroll"] = 2] = "Scroll";
|
|
17990
|
+
})(Overflow2 ||= {});
|
|
17991
|
+
var PositionType2;
|
|
17992
|
+
((PositionType) => {
|
|
17993
|
+
PositionType[PositionType["Static"] = 0] = "Static";
|
|
17994
|
+
PositionType[PositionType["Relative"] = 1] = "Relative";
|
|
17995
|
+
PositionType[PositionType["Absolute"] = 2] = "Absolute";
|
|
17996
|
+
})(PositionType2 ||= {});
|
|
17997
|
+
var Unit2;
|
|
17998
|
+
((Unit) => {
|
|
17999
|
+
Unit[Unit["Undefined"] = 0] = "Undefined";
|
|
18000
|
+
Unit[Unit["Point"] = 1] = "Point";
|
|
18001
|
+
Unit[Unit["Percent"] = 2] = "Percent";
|
|
18002
|
+
Unit[Unit["Auto"] = 3] = "Auto";
|
|
18003
|
+
})(Unit2 ||= {});
|
|
18004
|
+
var Wrap2;
|
|
17810
18005
|
((_Wrap) => {
|
|
17811
18006
|
_Wrap[_Wrap["NoWrap"] = 0] = "NoWrap";
|
|
17812
18007
|
_Wrap[_Wrap["Wrap"] = 1] = "Wrap";
|
|
17813
18008
|
_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
|
|
18009
|
+
})(Wrap2 ||= {});
|
|
18010
|
+
var ALIGN_AUTO2 = 0 /* Auto */;
|
|
18011
|
+
var ALIGN_FLEX_START2 = 1 /* FlexStart */;
|
|
18012
|
+
var ALIGN_CENTER2 = 2 /* Center */;
|
|
18013
|
+
var ALIGN_FLEX_END2 = 3 /* FlexEnd */;
|
|
18014
|
+
var ALIGN_STRETCH2 = 4 /* Stretch */;
|
|
18015
|
+
var ALIGN_BASELINE2 = 5 /* Baseline */;
|
|
18016
|
+
var ALIGN_SPACE_BETWEEN2 = 6 /* SpaceBetween */;
|
|
18017
|
+
var ALIGN_SPACE_AROUND2 = 7 /* SpaceAround */;
|
|
18018
|
+
var ALIGN_SPACE_EVENLY2 = 8 /* SpaceEvenly */;
|
|
18019
|
+
var BOX_SIZING_BORDER_BOX2 = 0 /* BorderBox */;
|
|
18020
|
+
var BOX_SIZING_CONTENT_BOX2 = 1 /* ContentBox */;
|
|
18021
|
+
var DIMENSION_WIDTH2 = 0 /* Width */;
|
|
18022
|
+
var DIMENSION_HEIGHT2 = 1 /* Height */;
|
|
18023
|
+
var DIRECTION_INHERIT2 = 0 /* Inherit */;
|
|
18024
|
+
var DIRECTION_LTR2 = 1 /* LTR */;
|
|
18025
|
+
var DIRECTION_RTL2 = 2 /* RTL */;
|
|
18026
|
+
var DISPLAY_FLEX2 = 0 /* Flex */;
|
|
18027
|
+
var DISPLAY_NONE2 = 1 /* None */;
|
|
18028
|
+
var DISPLAY_CONTENTS2 = 2 /* Contents */;
|
|
18029
|
+
var EDGE_LEFT2 = 0 /* Left */;
|
|
18030
|
+
var EDGE_TOP2 = 1 /* Top */;
|
|
18031
|
+
var EDGE_RIGHT2 = 2 /* Right */;
|
|
18032
|
+
var EDGE_BOTTOM2 = 3 /* Bottom */;
|
|
18033
|
+
var EDGE_START2 = 4 /* Start */;
|
|
18034
|
+
var EDGE_END2 = 5 /* End */;
|
|
18035
|
+
var EDGE_HORIZONTAL2 = 6 /* Horizontal */;
|
|
18036
|
+
var EDGE_VERTICAL2 = 7 /* Vertical */;
|
|
18037
|
+
var EDGE_ALL2 = 8 /* All */;
|
|
18038
|
+
var ERRATA_NONE2 = 0 /* None */;
|
|
18039
|
+
var ERRATA_STRETCH_FLEX_BASIS2 = 1 /* StretchFlexBasis */;
|
|
18040
|
+
var ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING2 = 2 /* AbsolutePositionWithoutInsetsExcludesPadding */;
|
|
18041
|
+
var ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE2 = 4 /* AbsolutePercentAgainstInnerSize */;
|
|
18042
|
+
var ERRATA_ALL2 = 2147483647 /* All */;
|
|
18043
|
+
var ERRATA_CLASSIC2 = 2147483646 /* Classic */;
|
|
18044
|
+
var EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS2 = 0 /* WebFlexBasis */;
|
|
18045
|
+
var FLEX_DIRECTION_COLUMN2 = 0 /* Column */;
|
|
18046
|
+
var FLEX_DIRECTION_COLUMN_REVERSE2 = 1 /* ColumnReverse */;
|
|
18047
|
+
var FLEX_DIRECTION_ROW2 = 2 /* Row */;
|
|
18048
|
+
var FLEX_DIRECTION_ROW_REVERSE2 = 3 /* RowReverse */;
|
|
18049
|
+
var GUTTER_COLUMN2 = 0 /* Column */;
|
|
18050
|
+
var GUTTER_ROW2 = 1 /* Row */;
|
|
18051
|
+
var GUTTER_ALL2 = 2 /* All */;
|
|
18052
|
+
var JUSTIFY_FLEX_START2 = 0 /* FlexStart */;
|
|
18053
|
+
var JUSTIFY_CENTER2 = 1 /* Center */;
|
|
18054
|
+
var JUSTIFY_FLEX_END2 = 2 /* FlexEnd */;
|
|
18055
|
+
var JUSTIFY_SPACE_BETWEEN2 = 3 /* SpaceBetween */;
|
|
18056
|
+
var JUSTIFY_SPACE_AROUND2 = 4 /* SpaceAround */;
|
|
18057
|
+
var JUSTIFY_SPACE_EVENLY2 = 5 /* SpaceEvenly */;
|
|
18058
|
+
var LOG_LEVEL_ERROR2 = 0 /* Error */;
|
|
18059
|
+
var LOG_LEVEL_WARN2 = 1 /* Warn */;
|
|
18060
|
+
var LOG_LEVEL_INFO2 = 2 /* Info */;
|
|
18061
|
+
var LOG_LEVEL_DEBUG2 = 3 /* Debug */;
|
|
18062
|
+
var LOG_LEVEL_VERBOSE2 = 4 /* Verbose */;
|
|
18063
|
+
var LOG_LEVEL_FATAL2 = 5 /* Fatal */;
|
|
18064
|
+
var MEASURE_MODE_UNDEFINED2 = 0 /* Undefined */;
|
|
18065
|
+
var MEASURE_MODE_EXACTLY2 = 1 /* Exactly */;
|
|
18066
|
+
var MEASURE_MODE_AT_MOST2 = 2 /* AtMost */;
|
|
18067
|
+
var NODE_TYPE_DEFAULT2 = 0 /* Default */;
|
|
18068
|
+
var NODE_TYPE_TEXT2 = 1 /* Text */;
|
|
18069
|
+
var OVERFLOW_VISIBLE2 = 0 /* Visible */;
|
|
18070
|
+
var OVERFLOW_HIDDEN2 = 1 /* Hidden */;
|
|
18071
|
+
var OVERFLOW_SCROLL2 = 2 /* Scroll */;
|
|
18072
|
+
var POSITION_TYPE_STATIC2 = 0 /* Static */;
|
|
18073
|
+
var POSITION_TYPE_RELATIVE2 = 1 /* Relative */;
|
|
18074
|
+
var POSITION_TYPE_ABSOLUTE2 = 2 /* Absolute */;
|
|
18075
|
+
var UNIT_UNDEFINED2 = 0 /* Undefined */;
|
|
18076
|
+
var UNIT_POINT2 = 1 /* Point */;
|
|
18077
|
+
var UNIT_PERCENT2 = 2 /* Percent */;
|
|
18078
|
+
var UNIT_AUTO2 = 3 /* Auto */;
|
|
18079
|
+
var WRAP_NO_WRAP2 = 0 /* NoWrap */;
|
|
18080
|
+
var WRAP_WRAP2 = 1 /* Wrap */;
|
|
18081
|
+
var WRAP_WRAP_REVERSE2 = 2 /* WrapReverse */;
|
|
17887
18082
|
var YogaEnumKind = {
|
|
17888
18083
|
Direction: 0,
|
|
17889
18084
|
FlexDirection: 1,
|
|
@@ -17930,7 +18125,7 @@ var measureCallbackLib = null;
|
|
|
17930
18125
|
var dirtiedCallback = null;
|
|
17931
18126
|
var dirtiedCallbackLib = null;
|
|
17932
18127
|
function lib() {
|
|
17933
|
-
return
|
|
18128
|
+
return resolveRenderLib2();
|
|
17934
18129
|
}
|
|
17935
18130
|
function ensureMeasureCallback() {
|
|
17936
18131
|
const renderLib = lib();
|
|
@@ -18008,14 +18203,14 @@ function normalizeLayoutInput(value) {
|
|
|
18008
18203
|
return value === undefined || value === "auto" ? NaN : value;
|
|
18009
18204
|
}
|
|
18010
18205
|
|
|
18011
|
-
class
|
|
18206
|
+
class Config2 {
|
|
18012
18207
|
ptr;
|
|
18013
18208
|
freed = false;
|
|
18014
|
-
constructor(
|
|
18015
|
-
this.ptr =
|
|
18209
|
+
constructor(ptr) {
|
|
18210
|
+
this.ptr = ptr;
|
|
18016
18211
|
}
|
|
18017
18212
|
static create() {
|
|
18018
|
-
return new
|
|
18213
|
+
return new Config2(lib().yogaConfigCreate());
|
|
18019
18214
|
}
|
|
18020
18215
|
static destroy(config) {
|
|
18021
18216
|
config.free();
|
|
@@ -18068,33 +18263,33 @@ class Config {
|
|
|
18068
18263
|
}
|
|
18069
18264
|
}
|
|
18070
18265
|
|
|
18071
|
-
class
|
|
18266
|
+
class Node2 {
|
|
18072
18267
|
ptr;
|
|
18073
18268
|
freed = false;
|
|
18074
|
-
constructor(
|
|
18075
|
-
this.ptr =
|
|
18076
|
-
nodeRegistry.set(
|
|
18269
|
+
constructor(ptr) {
|
|
18270
|
+
this.ptr = ptr;
|
|
18271
|
+
nodeRegistry.set(ptr, this);
|
|
18077
18272
|
}
|
|
18078
18273
|
static create(config) {
|
|
18079
|
-
return
|
|
18274
|
+
return Node2.fromPointer(config ? lib().yogaNodeCreateWithConfig(config.ptr) : lib().yogaNodeCreate());
|
|
18080
18275
|
}
|
|
18081
18276
|
static createForOpenTUI() {
|
|
18082
|
-
return
|
|
18277
|
+
return Node2.fromPointer(lib().yogaNodeCreateForOpenTUI());
|
|
18083
18278
|
}
|
|
18084
18279
|
static createDefault() {
|
|
18085
|
-
return
|
|
18280
|
+
return Node2.create();
|
|
18086
18281
|
}
|
|
18087
18282
|
static createWithConfig(config) {
|
|
18088
|
-
return
|
|
18283
|
+
return Node2.create(config);
|
|
18089
18284
|
}
|
|
18090
18285
|
static destroy(node) {
|
|
18091
18286
|
node.free();
|
|
18092
18287
|
}
|
|
18093
|
-
static fromPointer(
|
|
18094
|
-
const existing = nodeRegistry.get(
|
|
18288
|
+
static fromPointer(ptr) {
|
|
18289
|
+
const existing = nodeRegistry.get(ptr);
|
|
18095
18290
|
if (existing)
|
|
18096
18291
|
return existing;
|
|
18097
|
-
return new
|
|
18292
|
+
return new Node2(ptr);
|
|
18098
18293
|
}
|
|
18099
18294
|
isFreed() {
|
|
18100
18295
|
return this.freed;
|
|
@@ -18150,7 +18345,7 @@ class Node {
|
|
|
18150
18345
|
if (this.freed)
|
|
18151
18346
|
return null;
|
|
18152
18347
|
const child = lib().yogaNodeGetChild(this.ptr, index);
|
|
18153
|
-
return child ?
|
|
18348
|
+
return child ? Node2.fromPointer(child) : null;
|
|
18154
18349
|
}
|
|
18155
18350
|
getChildCount() {
|
|
18156
18351
|
if (this.freed)
|
|
@@ -18161,7 +18356,7 @@ class Node {
|
|
|
18161
18356
|
if (this.freed)
|
|
18162
18357
|
return null;
|
|
18163
18358
|
const parent = lib().yogaNodeGetParent(this.ptr);
|
|
18164
|
-
return parent ?
|
|
18359
|
+
return parent ? Node2.fromPointer(parent) : null;
|
|
18165
18360
|
}
|
|
18166
18361
|
calculateLayout(width, height, direction = 1 /* LTR */) {
|
|
18167
18362
|
if (this.freed)
|
|
@@ -18430,10 +18625,10 @@ class Node {
|
|
|
18430
18625
|
getGap(gutter) {
|
|
18431
18626
|
return this.getValue(YogaValueKind.Gap, gutter);
|
|
18432
18627
|
}
|
|
18433
|
-
setBorder(edge,
|
|
18628
|
+
setBorder(edge, border) {
|
|
18434
18629
|
if (this.freed)
|
|
18435
18630
|
return;
|
|
18436
|
-
lib().yogaNodeStyleSetBorder(this.ptr, edge,
|
|
18631
|
+
lib().yogaNodeStyleSetBorder(this.ptr, edge, border ?? NaN);
|
|
18437
18632
|
}
|
|
18438
18633
|
getBorder(edge) {
|
|
18439
18634
|
if (this.freed)
|
|
@@ -18546,102 +18741,102 @@ class Node {
|
|
|
18546
18741
|
}
|
|
18547
18742
|
}
|
|
18548
18743
|
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
|
|
18744
|
+
Config: Config2,
|
|
18745
|
+
Node: Node2,
|
|
18746
|
+
Align: Align2,
|
|
18747
|
+
BoxSizing: BoxSizing2,
|
|
18748
|
+
Dimension: Dimension2,
|
|
18749
|
+
Direction: Direction2,
|
|
18750
|
+
Display: Display2,
|
|
18751
|
+
Edge: Edge2,
|
|
18752
|
+
Errata: Errata2,
|
|
18753
|
+
ExperimentalFeature: ExperimentalFeature2,
|
|
18754
|
+
FlexDirection: FlexDirection2,
|
|
18755
|
+
Gutter: Gutter2,
|
|
18756
|
+
Justify: Justify2,
|
|
18757
|
+
LogLevel: LogLevel3,
|
|
18758
|
+
MeasureMode: MeasureMode2,
|
|
18759
|
+
NodeType: NodeType2,
|
|
18760
|
+
Overflow: Overflow2,
|
|
18761
|
+
PositionType: PositionType2,
|
|
18762
|
+
Unit: Unit2,
|
|
18763
|
+
Wrap: Wrap2,
|
|
18764
|
+
ALIGN_AUTO: ALIGN_AUTO2,
|
|
18765
|
+
ALIGN_FLEX_START: ALIGN_FLEX_START2,
|
|
18766
|
+
ALIGN_CENTER: ALIGN_CENTER2,
|
|
18767
|
+
ALIGN_FLEX_END: ALIGN_FLEX_END2,
|
|
18768
|
+
ALIGN_STRETCH: ALIGN_STRETCH2,
|
|
18769
|
+
ALIGN_BASELINE: ALIGN_BASELINE2,
|
|
18770
|
+
ALIGN_SPACE_BETWEEN: ALIGN_SPACE_BETWEEN2,
|
|
18771
|
+
ALIGN_SPACE_AROUND: ALIGN_SPACE_AROUND2,
|
|
18772
|
+
ALIGN_SPACE_EVENLY: ALIGN_SPACE_EVENLY2,
|
|
18773
|
+
BOX_SIZING_BORDER_BOX: BOX_SIZING_BORDER_BOX2,
|
|
18774
|
+
BOX_SIZING_CONTENT_BOX: BOX_SIZING_CONTENT_BOX2,
|
|
18775
|
+
DIMENSION_WIDTH: DIMENSION_WIDTH2,
|
|
18776
|
+
DIMENSION_HEIGHT: DIMENSION_HEIGHT2,
|
|
18777
|
+
DIRECTION_INHERIT: DIRECTION_INHERIT2,
|
|
18778
|
+
DIRECTION_LTR: DIRECTION_LTR2,
|
|
18779
|
+
DIRECTION_RTL: DIRECTION_RTL2,
|
|
18780
|
+
DISPLAY_FLEX: DISPLAY_FLEX2,
|
|
18781
|
+
DISPLAY_NONE: DISPLAY_NONE2,
|
|
18782
|
+
DISPLAY_CONTENTS: DISPLAY_CONTENTS2,
|
|
18783
|
+
EDGE_LEFT: EDGE_LEFT2,
|
|
18784
|
+
EDGE_TOP: EDGE_TOP2,
|
|
18785
|
+
EDGE_RIGHT: EDGE_RIGHT2,
|
|
18786
|
+
EDGE_BOTTOM: EDGE_BOTTOM2,
|
|
18787
|
+
EDGE_START: EDGE_START2,
|
|
18788
|
+
EDGE_END: EDGE_END2,
|
|
18789
|
+
EDGE_HORIZONTAL: EDGE_HORIZONTAL2,
|
|
18790
|
+
EDGE_VERTICAL: EDGE_VERTICAL2,
|
|
18791
|
+
EDGE_ALL: EDGE_ALL2,
|
|
18792
|
+
ERRATA_NONE: ERRATA_NONE2,
|
|
18793
|
+
ERRATA_STRETCH_FLEX_BASIS: ERRATA_STRETCH_FLEX_BASIS2,
|
|
18794
|
+
ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING: ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING2,
|
|
18795
|
+
ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE: ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE2,
|
|
18796
|
+
ERRATA_ALL: ERRATA_ALL2,
|
|
18797
|
+
ERRATA_CLASSIC: ERRATA_CLASSIC2,
|
|
18798
|
+
EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS: EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS2,
|
|
18799
|
+
FLEX_DIRECTION_COLUMN: FLEX_DIRECTION_COLUMN2,
|
|
18800
|
+
FLEX_DIRECTION_COLUMN_REVERSE: FLEX_DIRECTION_COLUMN_REVERSE2,
|
|
18801
|
+
FLEX_DIRECTION_ROW: FLEX_DIRECTION_ROW2,
|
|
18802
|
+
FLEX_DIRECTION_ROW_REVERSE: FLEX_DIRECTION_ROW_REVERSE2,
|
|
18803
|
+
GUTTER_COLUMN: GUTTER_COLUMN2,
|
|
18804
|
+
GUTTER_ROW: GUTTER_ROW2,
|
|
18805
|
+
GUTTER_ALL: GUTTER_ALL2,
|
|
18806
|
+
JUSTIFY_FLEX_START: JUSTIFY_FLEX_START2,
|
|
18807
|
+
JUSTIFY_CENTER: JUSTIFY_CENTER2,
|
|
18808
|
+
JUSTIFY_FLEX_END: JUSTIFY_FLEX_END2,
|
|
18809
|
+
JUSTIFY_SPACE_BETWEEN: JUSTIFY_SPACE_BETWEEN2,
|
|
18810
|
+
JUSTIFY_SPACE_AROUND: JUSTIFY_SPACE_AROUND2,
|
|
18811
|
+
JUSTIFY_SPACE_EVENLY: JUSTIFY_SPACE_EVENLY2,
|
|
18812
|
+
LOG_LEVEL_ERROR: LOG_LEVEL_ERROR2,
|
|
18813
|
+
LOG_LEVEL_WARN: LOG_LEVEL_WARN2,
|
|
18814
|
+
LOG_LEVEL_INFO: LOG_LEVEL_INFO2,
|
|
18815
|
+
LOG_LEVEL_DEBUG: LOG_LEVEL_DEBUG2,
|
|
18816
|
+
LOG_LEVEL_VERBOSE: LOG_LEVEL_VERBOSE2,
|
|
18817
|
+
LOG_LEVEL_FATAL: LOG_LEVEL_FATAL2,
|
|
18818
|
+
MEASURE_MODE_UNDEFINED: MEASURE_MODE_UNDEFINED2,
|
|
18819
|
+
MEASURE_MODE_EXACTLY: MEASURE_MODE_EXACTLY2,
|
|
18820
|
+
MEASURE_MODE_AT_MOST: MEASURE_MODE_AT_MOST2,
|
|
18821
|
+
NODE_TYPE_DEFAULT: NODE_TYPE_DEFAULT2,
|
|
18822
|
+
NODE_TYPE_TEXT: NODE_TYPE_TEXT2,
|
|
18823
|
+
OVERFLOW_VISIBLE: OVERFLOW_VISIBLE2,
|
|
18824
|
+
OVERFLOW_HIDDEN: OVERFLOW_HIDDEN2,
|
|
18825
|
+
OVERFLOW_SCROLL: OVERFLOW_SCROLL2,
|
|
18826
|
+
POSITION_TYPE_STATIC: POSITION_TYPE_STATIC2,
|
|
18827
|
+
POSITION_TYPE_RELATIVE: POSITION_TYPE_RELATIVE2,
|
|
18828
|
+
POSITION_TYPE_ABSOLUTE: POSITION_TYPE_ABSOLUTE2,
|
|
18829
|
+
UNIT_UNDEFINED: UNIT_UNDEFINED2,
|
|
18830
|
+
UNIT_POINT: UNIT_POINT2,
|
|
18831
|
+
UNIT_PERCENT: UNIT_PERCENT2,
|
|
18832
|
+
UNIT_AUTO: UNIT_AUTO2,
|
|
18833
|
+
WRAP_NO_WRAP: WRAP_NO_WRAP2,
|
|
18834
|
+
WRAP_WRAP: WRAP_WRAP2,
|
|
18835
|
+
WRAP_WRAP_REVERSE: WRAP_WRAP_REVERSE2
|
|
18641
18836
|
};
|
|
18642
18837
|
var yoga_default = Yoga;
|
|
18643
18838
|
|
|
18644
|
-
export { toArrayBuffer, singleton,
|
|
18839
|
+
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
18840
|
|
|
18646
|
-
//# debugId=
|
|
18647
|
-
//# sourceMappingURL=chunk-bun-
|
|
18841
|
+
//# debugId=1D4925856A3AFEEC64756E2164756E21
|
|
18842
|
+
//# sourceMappingURL=chunk-bun-8f4q4e2m.js.map
|