@gridland/web 0.2.27 → 0.2.29
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/dist/core-shims.js +2932 -62
- package/dist/core-shims.js.map +4 -4
- package/dist/index.js +11 -6
- package/dist/index.js.map +3 -3
- package/dist/next-plugin.cjs +10 -16
- package/dist/next-plugin.cjs.map +1 -1
- package/dist/next-plugin.d.cts +4 -2
- package/dist/next-plugin.d.ts +4 -2
- package/dist/next-plugin.js +10 -16
- package/dist/next-plugin.js.map +1 -1
- package/dist/next.js +11 -6
- package/dist/next.js.map +3 -3
- package/dist/vite-plugin.d.ts +11 -6
- package/dist/vite-plugin.js +27 -46
- package/dist/vite-plugin.js.map +1 -1
- package/package.json +2 -2
- package/src/shims/zig-stub.ts +0 -20
package/dist/core-shims.js
CHANGED
|
@@ -572,21 +572,21 @@ var require_scheduler_development = __commonJS({
|
|
|
572
572
|
|
|
573
573
|
// ../../node_modules/.bun/scheduler@0.27.0/node_modules/scheduler/index.js
|
|
574
574
|
var require_scheduler = __commonJS({
|
|
575
|
-
"../../node_modules/.bun/scheduler@0.27.0/node_modules/scheduler/index.js"(exports,
|
|
575
|
+
"../../node_modules/.bun/scheduler@0.27.0/node_modules/scheduler/index.js"(exports, module2) {
|
|
576
576
|
"use strict";
|
|
577
577
|
if (process.env.NODE_ENV === "production") {
|
|
578
|
-
|
|
578
|
+
module2.exports = require_scheduler_production();
|
|
579
579
|
} else {
|
|
580
|
-
|
|
580
|
+
module2.exports = require_scheduler_development();
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
583
|
});
|
|
584
584
|
|
|
585
585
|
// ../../node_modules/.bun/react-reconciler@0.33.0+b1ab299f0a400331/node_modules/react-reconciler/cjs/react-reconciler.production.js
|
|
586
586
|
var require_react_reconciler_production = __commonJS({
|
|
587
|
-
"../../node_modules/.bun/react-reconciler@0.33.0+b1ab299f0a400331/node_modules/react-reconciler/cjs/react-reconciler.production.js"(exports,
|
|
587
|
+
"../../node_modules/.bun/react-reconciler@0.33.0+b1ab299f0a400331/node_modules/react-reconciler/cjs/react-reconciler.production.js"(exports, module2) {
|
|
588
588
|
"use strict";
|
|
589
|
-
|
|
589
|
+
module2.exports = function($$$config) {
|
|
590
590
|
function createFiber(tag, pendingProps, key, mode) {
|
|
591
591
|
return new FiberNode(tag, pendingProps, key, mode);
|
|
592
592
|
}
|
|
@@ -8756,16 +8756,16 @@ var require_react_reconciler_production = __commonJS({
|
|
|
8756
8756
|
};
|
|
8757
8757
|
return exports2;
|
|
8758
8758
|
};
|
|
8759
|
-
|
|
8760
|
-
Object.defineProperty(
|
|
8759
|
+
module2.exports.default = module2.exports;
|
|
8760
|
+
Object.defineProperty(module2.exports, "__esModule", { value: true });
|
|
8761
8761
|
}
|
|
8762
8762
|
});
|
|
8763
8763
|
|
|
8764
8764
|
// ../../node_modules/.bun/react-reconciler@0.33.0+b1ab299f0a400331/node_modules/react-reconciler/cjs/react-reconciler.development.js
|
|
8765
8765
|
var require_react_reconciler_development = __commonJS({
|
|
8766
|
-
"../../node_modules/.bun/react-reconciler@0.33.0+b1ab299f0a400331/node_modules/react-reconciler/cjs/react-reconciler.development.js"(exports,
|
|
8766
|
+
"../../node_modules/.bun/react-reconciler@0.33.0+b1ab299f0a400331/node_modules/react-reconciler/cjs/react-reconciler.development.js"(exports, module2) {
|
|
8767
8767
|
"use strict";
|
|
8768
|
-
"production" !== process.env.NODE_ENV && (
|
|
8768
|
+
"production" !== process.env.NODE_ENV && (module2.exports = function($$$config) {
|
|
8769
8769
|
function findHook(fiber, id) {
|
|
8770
8770
|
for (fiber = fiber.memoizedState; null !== fiber && 0 < id; )
|
|
8771
8771
|
fiber = fiber.next, id--;
|
|
@@ -22530,18 +22530,18 @@ var require_react_reconciler_development = __commonJS({
|
|
|
22530
22530
|
};
|
|
22531
22531
|
exports2.updateContainerSync = updateContainerSync;
|
|
22532
22532
|
return exports2;
|
|
22533
|
-
},
|
|
22533
|
+
}, module2.exports.default = module2.exports, Object.defineProperty(module2.exports, "__esModule", { value: true }));
|
|
22534
22534
|
}
|
|
22535
22535
|
});
|
|
22536
22536
|
|
|
22537
22537
|
// node_modules/react-reconciler/index.js
|
|
22538
22538
|
var require_react_reconciler = __commonJS({
|
|
22539
|
-
"node_modules/react-reconciler/index.js"(exports,
|
|
22539
|
+
"node_modules/react-reconciler/index.js"(exports, module2) {
|
|
22540
22540
|
"use strict";
|
|
22541
22541
|
if (process.env.NODE_ENV === "production") {
|
|
22542
|
-
|
|
22542
|
+
module2.exports = require_react_reconciler_production();
|
|
22543
22543
|
} else {
|
|
22544
|
-
|
|
22544
|
+
module2.exports = require_react_reconciler_development();
|
|
22545
22545
|
}
|
|
22546
22546
|
}
|
|
22547
22547
|
});
|
|
@@ -22570,12 +22570,12 @@ var require_react_reconciler_constants_development = __commonJS({
|
|
|
22570
22570
|
|
|
22571
22571
|
// node_modules/react-reconciler/constants.js
|
|
22572
22572
|
var require_constants = __commonJS({
|
|
22573
|
-
"node_modules/react-reconciler/constants.js"(exports,
|
|
22573
|
+
"node_modules/react-reconciler/constants.js"(exports, module2) {
|
|
22574
22574
|
"use strict";
|
|
22575
22575
|
if (process.env.NODE_ENV === "production") {
|
|
22576
|
-
|
|
22576
|
+
module2.exports = require_react_reconciler_constants_production();
|
|
22577
22577
|
} else {
|
|
22578
|
-
|
|
22578
|
+
module2.exports = require_react_reconciler_constants_development();
|
|
22579
22579
|
}
|
|
22580
22580
|
}
|
|
22581
22581
|
});
|
|
@@ -24165,14 +24165,14 @@ var Justify = /* @__PURE__ */ (function(Justify3) {
|
|
|
24165
24165
|
Justify3[Justify3["SpaceEvenly"] = 5] = "SpaceEvenly";
|
|
24166
24166
|
return Justify3;
|
|
24167
24167
|
})({});
|
|
24168
|
-
var
|
|
24169
|
-
|
|
24170
|
-
|
|
24171
|
-
|
|
24172
|
-
|
|
24173
|
-
|
|
24174
|
-
|
|
24175
|
-
return
|
|
24168
|
+
var LogLevel2 = /* @__PURE__ */ (function(LogLevel4) {
|
|
24169
|
+
LogLevel4[LogLevel4["Error"] = 0] = "Error";
|
|
24170
|
+
LogLevel4[LogLevel4["Warn"] = 1] = "Warn";
|
|
24171
|
+
LogLevel4[LogLevel4["Info"] = 2] = "Info";
|
|
24172
|
+
LogLevel4[LogLevel4["Debug"] = 3] = "Debug";
|
|
24173
|
+
LogLevel4[LogLevel4["Verbose"] = 4] = "Verbose";
|
|
24174
|
+
LogLevel4[LogLevel4["Fatal"] = 5] = "Fatal";
|
|
24175
|
+
return LogLevel4;
|
|
24176
24176
|
})({});
|
|
24177
24177
|
var MeasureMode = /* @__PURE__ */ (function(MeasureMode4) {
|
|
24178
24178
|
MeasureMode4[MeasureMode4["Undefined"] = 0] = "Undefined";
|
|
@@ -24259,12 +24259,12 @@ var constants = {
|
|
|
24259
24259
|
JUSTIFY_SPACE_BETWEEN: Justify.SpaceBetween,
|
|
24260
24260
|
JUSTIFY_SPACE_AROUND: Justify.SpaceAround,
|
|
24261
24261
|
JUSTIFY_SPACE_EVENLY: Justify.SpaceEvenly,
|
|
24262
|
-
LOG_LEVEL_ERROR:
|
|
24263
|
-
LOG_LEVEL_WARN:
|
|
24264
|
-
LOG_LEVEL_INFO:
|
|
24265
|
-
LOG_LEVEL_DEBUG:
|
|
24266
|
-
LOG_LEVEL_VERBOSE:
|
|
24267
|
-
LOG_LEVEL_FATAL:
|
|
24262
|
+
LOG_LEVEL_ERROR: LogLevel2.Error,
|
|
24263
|
+
LOG_LEVEL_WARN: LogLevel2.Warn,
|
|
24264
|
+
LOG_LEVEL_INFO: LogLevel2.Info,
|
|
24265
|
+
LOG_LEVEL_DEBUG: LogLevel2.Debug,
|
|
24266
|
+
LOG_LEVEL_VERBOSE: LogLevel2.Verbose,
|
|
24267
|
+
LOG_LEVEL_FATAL: LogLevel2.Fatal,
|
|
24268
24268
|
MEASURE_MODE_UNDEFINED: MeasureMode.Undefined,
|
|
24269
24269
|
MEASURE_MODE_EXACTLY: MeasureMode.Exactly,
|
|
24270
24270
|
MEASURE_MODE_AT_MOST: MeasureMode.AtMost,
|
|
@@ -31236,23 +31236,6 @@ function detectLinks(chunks, context) {
|
|
|
31236
31236
|
return chunks;
|
|
31237
31237
|
}
|
|
31238
31238
|
|
|
31239
|
-
// src/shims/renderer-stub.ts
|
|
31240
|
-
var CliRenderEvents = /* @__PURE__ */ ((CliRenderEvents2) => {
|
|
31241
|
-
CliRenderEvents2["DESTROY"] = "destroy";
|
|
31242
|
-
CliRenderEvents2["DEBUG_OVERLAY_TOGGLE"] = "debug_overlay_toggle";
|
|
31243
|
-
return CliRenderEvents2;
|
|
31244
|
-
})(CliRenderEvents || {});
|
|
31245
|
-
var CliRenderer = class extends EventEmitter {
|
|
31246
|
-
root = null;
|
|
31247
|
-
keyInput = new EventEmitter();
|
|
31248
|
-
destroy() {
|
|
31249
|
-
this.emit("destroy" /* DESTROY */);
|
|
31250
|
-
}
|
|
31251
|
-
};
|
|
31252
|
-
function createCliRenderer() {
|
|
31253
|
-
return Promise.resolve(new CliRenderer());
|
|
31254
|
-
}
|
|
31255
|
-
|
|
31256
31239
|
// ../../opentui/packages/core/src/renderables/FrameBuffer.ts
|
|
31257
31240
|
var FrameBufferRenderable = class extends Renderable {
|
|
31258
31241
|
frameBuffer;
|
|
@@ -40601,6 +40584,19 @@ var TabSelectRenderable = class extends Renderable {
|
|
|
40601
40584
|
}
|
|
40602
40585
|
};
|
|
40603
40586
|
|
|
40587
|
+
// ../../opentui/packages/core/src/zig-registry.ts
|
|
40588
|
+
var _renderLib;
|
|
40589
|
+
function registerRenderLib(lib) {
|
|
40590
|
+
_renderLib = lib;
|
|
40591
|
+
}
|
|
40592
|
+
if (typeof globalThis.Bun !== "undefined") {
|
|
40593
|
+
const zigPath = "./zig";
|
|
40594
|
+
try {
|
|
40595
|
+
await import(zigPath);
|
|
40596
|
+
} catch {
|
|
40597
|
+
}
|
|
40598
|
+
}
|
|
40599
|
+
|
|
40604
40600
|
// ../../opentui/packages/core/src/lib/selection.ts
|
|
40605
40601
|
var SelectionAnchor = class {
|
|
40606
40602
|
constructor(renderable, absoluteX, absoluteY) {
|
|
@@ -40811,6 +40807,23 @@ var BrowserInternalKeyHandler = class extends BrowserKeyHandler {
|
|
|
40811
40807
|
}
|
|
40812
40808
|
};
|
|
40813
40809
|
|
|
40810
|
+
// src/shims/renderer-stub.ts
|
|
40811
|
+
var CliRenderEvents = /* @__PURE__ */ ((CliRenderEvents2) => {
|
|
40812
|
+
CliRenderEvents2["DESTROY"] = "destroy";
|
|
40813
|
+
CliRenderEvents2["DEBUG_OVERLAY_TOGGLE"] = "debug_overlay_toggle";
|
|
40814
|
+
return CliRenderEvents2;
|
|
40815
|
+
})(CliRenderEvents || {});
|
|
40816
|
+
var CliRenderer = class extends EventEmitter {
|
|
40817
|
+
root = null;
|
|
40818
|
+
keyInput = new EventEmitter();
|
|
40819
|
+
destroy() {
|
|
40820
|
+
this.emit("destroy" /* DESTROY */);
|
|
40821
|
+
}
|
|
40822
|
+
};
|
|
40823
|
+
function createCliRenderer() {
|
|
40824
|
+
return Promise.resolve(new CliRenderer());
|
|
40825
|
+
}
|
|
40826
|
+
|
|
40814
40827
|
// ../../node_modules/.bun/yoga-layout@3.2.1/node_modules/yoga-layout/dist/src/index.js
|
|
40815
40828
|
var src_exports2 = {};
|
|
40816
40829
|
__export(src_exports2, {
|
|
@@ -40825,7 +40838,7 @@ __export(src_exports2, {
|
|
|
40825
40838
|
FlexDirection: () => FlexDirection2,
|
|
40826
40839
|
Gutter: () => Gutter2,
|
|
40827
40840
|
Justify: () => Justify2,
|
|
40828
|
-
LogLevel: () =>
|
|
40841
|
+
LogLevel: () => LogLevel3,
|
|
40829
40842
|
MeasureMode: () => MeasureMode3,
|
|
40830
40843
|
NodeType: () => NodeType2,
|
|
40831
40844
|
Overflow: () => Overflow2,
|
|
@@ -42148,14 +42161,14 @@ var Justify2 = /* @__PURE__ */ (function(Justify3) {
|
|
|
42148
42161
|
Justify3[Justify3["SpaceEvenly"] = 5] = "SpaceEvenly";
|
|
42149
42162
|
return Justify3;
|
|
42150
42163
|
})({});
|
|
42151
|
-
var
|
|
42152
|
-
|
|
42153
|
-
|
|
42154
|
-
|
|
42155
|
-
|
|
42156
|
-
|
|
42157
|
-
|
|
42158
|
-
return
|
|
42164
|
+
var LogLevel3 = /* @__PURE__ */ (function(LogLevel4) {
|
|
42165
|
+
LogLevel4[LogLevel4["Error"] = 0] = "Error";
|
|
42166
|
+
LogLevel4[LogLevel4["Warn"] = 1] = "Warn";
|
|
42167
|
+
LogLevel4[LogLevel4["Info"] = 2] = "Info";
|
|
42168
|
+
LogLevel4[LogLevel4["Debug"] = 3] = "Debug";
|
|
42169
|
+
LogLevel4[LogLevel4["Verbose"] = 4] = "Verbose";
|
|
42170
|
+
LogLevel4[LogLevel4["Fatal"] = 5] = "Fatal";
|
|
42171
|
+
return LogLevel4;
|
|
42159
42172
|
})({});
|
|
42160
42173
|
var MeasureMode3 = /* @__PURE__ */ (function(MeasureMode4) {
|
|
42161
42174
|
MeasureMode4[MeasureMode4["Undefined"] = 0] = "Undefined";
|
|
@@ -42242,12 +42255,12 @@ var constants2 = {
|
|
|
42242
42255
|
JUSTIFY_SPACE_BETWEEN: Justify2.SpaceBetween,
|
|
42243
42256
|
JUSTIFY_SPACE_AROUND: Justify2.SpaceAround,
|
|
42244
42257
|
JUSTIFY_SPACE_EVENLY: Justify2.SpaceEvenly,
|
|
42245
|
-
LOG_LEVEL_ERROR:
|
|
42246
|
-
LOG_LEVEL_WARN:
|
|
42247
|
-
LOG_LEVEL_INFO:
|
|
42248
|
-
LOG_LEVEL_DEBUG:
|
|
42249
|
-
LOG_LEVEL_VERBOSE:
|
|
42250
|
-
LOG_LEVEL_FATAL:
|
|
42258
|
+
LOG_LEVEL_ERROR: LogLevel3.Error,
|
|
42259
|
+
LOG_LEVEL_WARN: LogLevel3.Warn,
|
|
42260
|
+
LOG_LEVEL_INFO: LogLevel3.Info,
|
|
42261
|
+
LOG_LEVEL_DEBUG: LogLevel3.Debug,
|
|
42262
|
+
LOG_LEVEL_VERBOSE: LogLevel3.Verbose,
|
|
42263
|
+
LOG_LEVEL_FATAL: LogLevel3.Fatal,
|
|
42251
42264
|
MEASURE_MODE_UNDEFINED: MeasureMode3.Undefined,
|
|
42252
42265
|
MEASURE_MODE_EXACTLY: MeasureMode3.Exactly,
|
|
42253
42266
|
MEASURE_MODE_AT_MOST: MeasureMode3.AtMost,
|
|
@@ -42608,6 +42621,2863 @@ var useTimeline = (options = {}) => {
|
|
|
42608
42621
|
return timeline;
|
|
42609
42622
|
};
|
|
42610
42623
|
|
|
42624
|
+
// src/shims/bun-ffi.ts
|
|
42625
|
+
function toArrayBuffer(_ptr, _offset, _size) {
|
|
42626
|
+
return new ArrayBuffer(0);
|
|
42627
|
+
}
|
|
42628
|
+
function ptr(_buf) {
|
|
42629
|
+
return 0;
|
|
42630
|
+
}
|
|
42631
|
+
function dlopen(_path, _symbols) {
|
|
42632
|
+
return { symbols: {}, close() {
|
|
42633
|
+
} };
|
|
42634
|
+
}
|
|
42635
|
+
var JSCallback = class {
|
|
42636
|
+
ptr = 0;
|
|
42637
|
+
constructor(_fn, _options) {
|
|
42638
|
+
}
|
|
42639
|
+
close() {
|
|
42640
|
+
}
|
|
42641
|
+
};
|
|
42642
|
+
|
|
42643
|
+
// src/shims/node-fs.ts
|
|
42644
|
+
function existsSync(_path) {
|
|
42645
|
+
return false;
|
|
42646
|
+
}
|
|
42647
|
+
|
|
42648
|
+
// src/shims/bun-ffi-structs.ts
|
|
42649
|
+
function defineStruct(_def) {
|
|
42650
|
+
return class StubStruct {
|
|
42651
|
+
constructor(..._args) {
|
|
42652
|
+
}
|
|
42653
|
+
};
|
|
42654
|
+
}
|
|
42655
|
+
function defineEnum(_def) {
|
|
42656
|
+
return {};
|
|
42657
|
+
}
|
|
42658
|
+
|
|
42659
|
+
// ../../opentui/packages/core/src/zig-structs.ts
|
|
42660
|
+
var rgbaPackTransform = (rgba) => rgba ? ptr(rgba.buffer) : null;
|
|
42661
|
+
var rgbaUnpackTransform = (ptr2) => ptr2 ? RGBA2.fromArray(new Float32Array(toArrayBuffer(ptr2))) : void 0;
|
|
42662
|
+
var StyledChunkStruct = defineStruct(
|
|
42663
|
+
[
|
|
42664
|
+
["text", "char*"],
|
|
42665
|
+
["text_len", "u64", { lengthOf: "text" }],
|
|
42666
|
+
[
|
|
42667
|
+
"fg",
|
|
42668
|
+
"pointer",
|
|
42669
|
+
{
|
|
42670
|
+
optional: true,
|
|
42671
|
+
packTransform: rgbaPackTransform,
|
|
42672
|
+
unpackTransform: rgbaUnpackTransform
|
|
42673
|
+
}
|
|
42674
|
+
],
|
|
42675
|
+
[
|
|
42676
|
+
"bg",
|
|
42677
|
+
"pointer",
|
|
42678
|
+
{
|
|
42679
|
+
optional: true,
|
|
42680
|
+
packTransform: rgbaPackTransform,
|
|
42681
|
+
unpackTransform: rgbaUnpackTransform
|
|
42682
|
+
}
|
|
42683
|
+
],
|
|
42684
|
+
["attributes", "u32", { default: 0 }],
|
|
42685
|
+
["link", "char*", { default: "" }],
|
|
42686
|
+
["link_len", "u64", { lengthOf: "link" }]
|
|
42687
|
+
],
|
|
42688
|
+
{
|
|
42689
|
+
mapValue: (chunk) => {
|
|
42690
|
+
if (!chunk.link || typeof chunk.link === "string") {
|
|
42691
|
+
return chunk;
|
|
42692
|
+
}
|
|
42693
|
+
return {
|
|
42694
|
+
...chunk,
|
|
42695
|
+
link: chunk.link.url
|
|
42696
|
+
};
|
|
42697
|
+
}
|
|
42698
|
+
}
|
|
42699
|
+
);
|
|
42700
|
+
var HighlightStruct = defineStruct([
|
|
42701
|
+
["start", "u32"],
|
|
42702
|
+
["end", "u32"],
|
|
42703
|
+
["styleId", "u32"],
|
|
42704
|
+
["priority", "u8", { default: 0 }],
|
|
42705
|
+
["hlRef", "u16", { default: 0 }]
|
|
42706
|
+
]);
|
|
42707
|
+
var LogicalCursorStruct = defineStruct([
|
|
42708
|
+
["row", "u32"],
|
|
42709
|
+
["col", "u32"],
|
|
42710
|
+
["offset", "u32"]
|
|
42711
|
+
]);
|
|
42712
|
+
var VisualCursorStruct = defineStruct([
|
|
42713
|
+
["visualRow", "u32"],
|
|
42714
|
+
["visualCol", "u32"],
|
|
42715
|
+
["logicalRow", "u32"],
|
|
42716
|
+
["logicalCol", "u32"],
|
|
42717
|
+
["offset", "u32"]
|
|
42718
|
+
]);
|
|
42719
|
+
var UnicodeMethodEnum = defineEnum({ wcwidth: 0, unicode: 1 }, "u8");
|
|
42720
|
+
var TerminalCapabilitiesStruct = defineStruct([
|
|
42721
|
+
["kitty_keyboard", "bool_u8"],
|
|
42722
|
+
["kitty_graphics", "bool_u8"],
|
|
42723
|
+
["rgb", "bool_u8"],
|
|
42724
|
+
["unicode", UnicodeMethodEnum],
|
|
42725
|
+
["sgr_pixels", "bool_u8"],
|
|
42726
|
+
["color_scheme_updates", "bool_u8"],
|
|
42727
|
+
["explicit_width", "bool_u8"],
|
|
42728
|
+
["scaled_text", "bool_u8"],
|
|
42729
|
+
["sixel", "bool_u8"],
|
|
42730
|
+
["focus_tracking", "bool_u8"],
|
|
42731
|
+
["sync", "bool_u8"],
|
|
42732
|
+
["bracketed_paste", "bool_u8"],
|
|
42733
|
+
["hyperlinks", "bool_u8"],
|
|
42734
|
+
["osc52", "bool_u8"],
|
|
42735
|
+
["explicit_cursor_positioning", "bool_u8"],
|
|
42736
|
+
["term_name", "char*"],
|
|
42737
|
+
["term_name_len", "u64", { lengthOf: "term_name" }],
|
|
42738
|
+
["term_version", "char*"],
|
|
42739
|
+
["term_version_len", "u64", { lengthOf: "term_version" }],
|
|
42740
|
+
["term_from_xtversion", "bool_u8"]
|
|
42741
|
+
]);
|
|
42742
|
+
var EncodedCharStruct = defineStruct([
|
|
42743
|
+
["width", "u8"],
|
|
42744
|
+
["char", "u32"]
|
|
42745
|
+
]);
|
|
42746
|
+
var LineInfoStruct = defineStruct([
|
|
42747
|
+
["starts", ["u32"]],
|
|
42748
|
+
["startsLen", "u32", { lengthOf: "starts" }],
|
|
42749
|
+
["widths", ["u32"]],
|
|
42750
|
+
["widthsLen", "u32", { lengthOf: "widths" }],
|
|
42751
|
+
["sources", ["u32"]],
|
|
42752
|
+
["sourcesLen", "u32", { lengthOf: "sources" }],
|
|
42753
|
+
["wraps", ["u32"]],
|
|
42754
|
+
["wrapsLen", "u32", { lengthOf: "wraps" }],
|
|
42755
|
+
["maxWidth", "u32"]
|
|
42756
|
+
]);
|
|
42757
|
+
var MeasureResultStruct = defineStruct([
|
|
42758
|
+
["lineCount", "u32"],
|
|
42759
|
+
["maxWidth", "u32"]
|
|
42760
|
+
]);
|
|
42761
|
+
var CursorStateStruct = defineStruct([
|
|
42762
|
+
["x", "u32"],
|
|
42763
|
+
["y", "u32"],
|
|
42764
|
+
["visible", "bool_u8"],
|
|
42765
|
+
["style", "u8"],
|
|
42766
|
+
["blinking", "bool_u8"],
|
|
42767
|
+
["r", "f32"],
|
|
42768
|
+
["g", "f32"],
|
|
42769
|
+
["b", "f32"],
|
|
42770
|
+
["a", "f32"]
|
|
42771
|
+
]);
|
|
42772
|
+
var CursorStyleOptionsStruct = defineStruct([
|
|
42773
|
+
["style", "u8", { default: 255 }],
|
|
42774
|
+
["blinking", "u8", { default: 255 }],
|
|
42775
|
+
[
|
|
42776
|
+
"color",
|
|
42777
|
+
"pointer",
|
|
42778
|
+
{
|
|
42779
|
+
optional: true,
|
|
42780
|
+
packTransform: rgbaPackTransform,
|
|
42781
|
+
unpackTransform: rgbaUnpackTransform
|
|
42782
|
+
}
|
|
42783
|
+
],
|
|
42784
|
+
["cursor", "u8", { default: 255 }]
|
|
42785
|
+
]);
|
|
42786
|
+
var GridDrawOptionsStruct = defineStruct([
|
|
42787
|
+
["drawInner", "bool_u8", { default: true }],
|
|
42788
|
+
["drawOuter", "bool_u8", { default: true }]
|
|
42789
|
+
]);
|
|
42790
|
+
var BuildOptionsStruct = defineStruct([
|
|
42791
|
+
["gpaSafeStats", "bool_u8"],
|
|
42792
|
+
["gpaMemoryLimitTracking", "bool_u8"]
|
|
42793
|
+
]);
|
|
42794
|
+
var AllocatorStatsStruct = defineStruct([
|
|
42795
|
+
["totalRequestedBytes", "u64"],
|
|
42796
|
+
["activeAllocations", "u64"],
|
|
42797
|
+
["smallAllocations", "u64"],
|
|
42798
|
+
["largeAllocations", "u64"],
|
|
42799
|
+
["requestedBytesValid", "bool_u8"]
|
|
42800
|
+
]);
|
|
42801
|
+
var GrowthPolicyEnum = defineEnum({ grow: 0, block: 1 }, "u8");
|
|
42802
|
+
var NativeSpanFeedOptionsStruct = defineStruct([
|
|
42803
|
+
["chunkSize", "u32", { default: 64 * 1024 }],
|
|
42804
|
+
["initialChunks", "u32", { default: 2 }],
|
|
42805
|
+
["maxBytes", "u64", { default: 0n }],
|
|
42806
|
+
["growthPolicy", GrowthPolicyEnum, { default: "grow" }],
|
|
42807
|
+
["autoCommitOnFull", "bool_u8", { default: true }],
|
|
42808
|
+
["spanQueueCapacity", "u32", { default: 0 }]
|
|
42809
|
+
]);
|
|
42810
|
+
var NativeSpanFeedStatsStruct = defineStruct([
|
|
42811
|
+
["bytesWritten", "u64"],
|
|
42812
|
+
["spansCommitted", "u64"],
|
|
42813
|
+
["chunks", "u32"],
|
|
42814
|
+
["pendingSpans", "u32"]
|
|
42815
|
+
]);
|
|
42816
|
+
var SpanInfoStruct = defineStruct(
|
|
42817
|
+
[
|
|
42818
|
+
["chunkPtr", "pointer"],
|
|
42819
|
+
["offset", "u32"],
|
|
42820
|
+
["len", "u32"],
|
|
42821
|
+
["chunkIndex", "u32"],
|
|
42822
|
+
["reserved", "u32", { default: 0 }]
|
|
42823
|
+
],
|
|
42824
|
+
{
|
|
42825
|
+
reduceValue: (value) => ({
|
|
42826
|
+
chunkPtr: value.chunkPtr,
|
|
42827
|
+
offset: value.offset,
|
|
42828
|
+
len: value.len,
|
|
42829
|
+
chunkIndex: value.chunkIndex
|
|
42830
|
+
})
|
|
42831
|
+
}
|
|
42832
|
+
);
|
|
42833
|
+
var ReserveInfoStruct = defineStruct(
|
|
42834
|
+
[
|
|
42835
|
+
["ptr", "pointer"],
|
|
42836
|
+
["len", "u32"],
|
|
42837
|
+
["reserved", "u32", { default: 0 }]
|
|
42838
|
+
],
|
|
42839
|
+
{
|
|
42840
|
+
reduceValue: (value) => ({
|
|
42841
|
+
ptr: value.ptr,
|
|
42842
|
+
len: value.len
|
|
42843
|
+
})
|
|
42844
|
+
}
|
|
42845
|
+
);
|
|
42846
|
+
|
|
42847
|
+
// ../../opentui/packages/core/src/lib/bunfs.ts
|
|
42848
|
+
function isBunfsPath(path) {
|
|
42849
|
+
return path.includes("$bunfs") || /^B:[\\/]~BUN/i.test(path);
|
|
42850
|
+
}
|
|
42851
|
+
|
|
42852
|
+
// ../../opentui/packages/core/src/zig.ts
|
|
42853
|
+
var module = await import(`@opentui/core-${process.platform}-${process.arch}/index.ts`);
|
|
42854
|
+
var targetLibPath = module.default;
|
|
42855
|
+
if (isBunfsPath(targetLibPath)) {
|
|
42856
|
+
targetLibPath = targetLibPath.replace("../", "");
|
|
42857
|
+
}
|
|
42858
|
+
if (!existsSync(targetLibPath)) {
|
|
42859
|
+
throw new Error(`opentui is not supported on the current platform: ${process.platform}-${process.arch}`);
|
|
42860
|
+
}
|
|
42861
|
+
registerEnvVar({
|
|
42862
|
+
name: "OTUI_DEBUG_FFI",
|
|
42863
|
+
description: "Enable debug logging for the FFI bindings.",
|
|
42864
|
+
type: "boolean",
|
|
42865
|
+
default: false
|
|
42866
|
+
});
|
|
42867
|
+
registerEnvVar({
|
|
42868
|
+
name: "OTUI_TRACE_FFI",
|
|
42869
|
+
description: "Enable tracing for the FFI bindings.",
|
|
42870
|
+
type: "boolean",
|
|
42871
|
+
default: false
|
|
42872
|
+
});
|
|
42873
|
+
registerEnvVar({
|
|
42874
|
+
name: "OPENTUI_FORCE_WCWIDTH",
|
|
42875
|
+
description: "Use wcwidth for character width calculations",
|
|
42876
|
+
type: "boolean",
|
|
42877
|
+
default: false
|
|
42878
|
+
});
|
|
42879
|
+
registerEnvVar({
|
|
42880
|
+
name: "OPENTUI_FORCE_UNICODE",
|
|
42881
|
+
description: "Force Mode 2026 Unicode support in terminal capabilities",
|
|
42882
|
+
type: "boolean",
|
|
42883
|
+
default: false
|
|
42884
|
+
});
|
|
42885
|
+
registerEnvVar({
|
|
42886
|
+
name: "OPENTUI_GRAPHICS",
|
|
42887
|
+
description: "Enable Kitty graphics protocol detection",
|
|
42888
|
+
type: "boolean",
|
|
42889
|
+
default: true
|
|
42890
|
+
});
|
|
42891
|
+
registerEnvVar({
|
|
42892
|
+
name: "OPENTUI_FORCE_NOZWJ",
|
|
42893
|
+
description: "Use no_zwj width method (Unicode without ZWJ joining)",
|
|
42894
|
+
type: "boolean",
|
|
42895
|
+
default: false
|
|
42896
|
+
});
|
|
42897
|
+
var CURSOR_STYLE_TO_ID = { block: 0, line: 1, underline: 2 };
|
|
42898
|
+
var CURSOR_ID_TO_STYLE = ["block", "line", "underline"];
|
|
42899
|
+
var MOUSE_STYLE_TO_ID = { default: 0, pointer: 1, text: 2, crosshair: 3, move: 4, "not-allowed": 5 };
|
|
42900
|
+
var globalTraceSymbols = null;
|
|
42901
|
+
var globalFFILogWriter = null;
|
|
42902
|
+
var exitHandlerRegistered = false;
|
|
42903
|
+
function toPointer(value) {
|
|
42904
|
+
if (typeof value === "bigint") {
|
|
42905
|
+
if (value > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
42906
|
+
throw new Error("Pointer exceeds safe integer range");
|
|
42907
|
+
}
|
|
42908
|
+
return Number(value);
|
|
42909
|
+
}
|
|
42910
|
+
return value;
|
|
42911
|
+
}
|
|
42912
|
+
function toNumber(value) {
|
|
42913
|
+
return typeof value === "bigint" ? Number(value) : value;
|
|
42914
|
+
}
|
|
42915
|
+
function getOpenTUILib(libPath) {
|
|
42916
|
+
const resolvedLibPath = libPath || targetLibPath;
|
|
42917
|
+
const rawSymbols = dlopen(resolvedLibPath, {
|
|
42918
|
+
// Logging
|
|
42919
|
+
setLogCallback: {
|
|
42920
|
+
args: ["ptr"],
|
|
42921
|
+
returns: "void"
|
|
42922
|
+
},
|
|
42923
|
+
// Event bus
|
|
42924
|
+
setEventCallback: {
|
|
42925
|
+
args: ["ptr"],
|
|
42926
|
+
returns: "void"
|
|
42927
|
+
},
|
|
42928
|
+
// Renderer management
|
|
42929
|
+
createRenderer: {
|
|
42930
|
+
args: ["u32", "u32", "bool", "bool"],
|
|
42931
|
+
returns: "ptr"
|
|
42932
|
+
},
|
|
42933
|
+
setTerminalEnvVar: {
|
|
42934
|
+
args: ["ptr", "ptr", "usize", "ptr", "usize"],
|
|
42935
|
+
returns: "bool"
|
|
42936
|
+
},
|
|
42937
|
+
destroyRenderer: {
|
|
42938
|
+
args: ["ptr"],
|
|
42939
|
+
returns: "void"
|
|
42940
|
+
},
|
|
42941
|
+
setUseThread: {
|
|
42942
|
+
args: ["ptr", "bool"],
|
|
42943
|
+
returns: "void"
|
|
42944
|
+
},
|
|
42945
|
+
setBackgroundColor: {
|
|
42946
|
+
args: ["ptr", "ptr"],
|
|
42947
|
+
returns: "void"
|
|
42948
|
+
},
|
|
42949
|
+
setRenderOffset: {
|
|
42950
|
+
args: ["ptr", "u32"],
|
|
42951
|
+
returns: "void"
|
|
42952
|
+
},
|
|
42953
|
+
updateStats: {
|
|
42954
|
+
args: ["ptr", "f64", "u32", "f64"],
|
|
42955
|
+
returns: "void"
|
|
42956
|
+
},
|
|
42957
|
+
updateMemoryStats: {
|
|
42958
|
+
args: ["ptr", "u32", "u32", "u32"],
|
|
42959
|
+
returns: "void"
|
|
42960
|
+
},
|
|
42961
|
+
render: {
|
|
42962
|
+
args: ["ptr", "bool"],
|
|
42963
|
+
returns: "void"
|
|
42964
|
+
},
|
|
42965
|
+
getNextBuffer: {
|
|
42966
|
+
args: ["ptr"],
|
|
42967
|
+
returns: "ptr"
|
|
42968
|
+
},
|
|
42969
|
+
getCurrentBuffer: {
|
|
42970
|
+
args: ["ptr"],
|
|
42971
|
+
returns: "ptr"
|
|
42972
|
+
},
|
|
42973
|
+
queryPixelResolution: {
|
|
42974
|
+
args: ["ptr"],
|
|
42975
|
+
returns: "void"
|
|
42976
|
+
},
|
|
42977
|
+
createOptimizedBuffer: {
|
|
42978
|
+
args: ["u32", "u32", "bool", "u8", "ptr", "usize"],
|
|
42979
|
+
returns: "ptr"
|
|
42980
|
+
},
|
|
42981
|
+
destroyOptimizedBuffer: {
|
|
42982
|
+
args: ["ptr"],
|
|
42983
|
+
returns: "void"
|
|
42984
|
+
},
|
|
42985
|
+
drawFrameBuffer: {
|
|
42986
|
+
args: ["ptr", "i32", "i32", "ptr", "u32", "u32", "u32", "u32"],
|
|
42987
|
+
returns: "void"
|
|
42988
|
+
},
|
|
42989
|
+
getBufferWidth: {
|
|
42990
|
+
args: ["ptr"],
|
|
42991
|
+
returns: "u32"
|
|
42992
|
+
},
|
|
42993
|
+
getBufferHeight: {
|
|
42994
|
+
args: ["ptr"],
|
|
42995
|
+
returns: "u32"
|
|
42996
|
+
},
|
|
42997
|
+
bufferClear: {
|
|
42998
|
+
args: ["ptr", "ptr"],
|
|
42999
|
+
returns: "void"
|
|
43000
|
+
},
|
|
43001
|
+
bufferGetCharPtr: {
|
|
43002
|
+
args: ["ptr"],
|
|
43003
|
+
returns: "ptr"
|
|
43004
|
+
},
|
|
43005
|
+
bufferGetFgPtr: {
|
|
43006
|
+
args: ["ptr"],
|
|
43007
|
+
returns: "ptr"
|
|
43008
|
+
},
|
|
43009
|
+
bufferGetBgPtr: {
|
|
43010
|
+
args: ["ptr"],
|
|
43011
|
+
returns: "ptr"
|
|
43012
|
+
},
|
|
43013
|
+
bufferGetAttributesPtr: {
|
|
43014
|
+
args: ["ptr"],
|
|
43015
|
+
returns: "ptr"
|
|
43016
|
+
},
|
|
43017
|
+
bufferGetRespectAlpha: {
|
|
43018
|
+
args: ["ptr"],
|
|
43019
|
+
returns: "bool"
|
|
43020
|
+
},
|
|
43021
|
+
bufferSetRespectAlpha: {
|
|
43022
|
+
args: ["ptr", "bool"],
|
|
43023
|
+
returns: "void"
|
|
43024
|
+
},
|
|
43025
|
+
bufferGetId: {
|
|
43026
|
+
args: ["ptr", "ptr", "usize"],
|
|
43027
|
+
returns: "usize"
|
|
43028
|
+
},
|
|
43029
|
+
bufferGetRealCharSize: {
|
|
43030
|
+
args: ["ptr"],
|
|
43031
|
+
returns: "u32"
|
|
43032
|
+
},
|
|
43033
|
+
bufferWriteResolvedChars: {
|
|
43034
|
+
args: ["ptr", "ptr", "usize", "bool"],
|
|
43035
|
+
returns: "u32"
|
|
43036
|
+
},
|
|
43037
|
+
bufferDrawText: {
|
|
43038
|
+
args: ["ptr", "ptr", "u32", "u32", "u32", "ptr", "ptr", "u32"],
|
|
43039
|
+
returns: "void"
|
|
43040
|
+
},
|
|
43041
|
+
bufferSetCellWithAlphaBlending: {
|
|
43042
|
+
args: ["ptr", "u32", "u32", "u32", "ptr", "ptr", "u32"],
|
|
43043
|
+
returns: "void"
|
|
43044
|
+
},
|
|
43045
|
+
bufferSetCell: {
|
|
43046
|
+
args: ["ptr", "u32", "u32", "u32", "ptr", "ptr", "u32"],
|
|
43047
|
+
returns: "void"
|
|
43048
|
+
},
|
|
43049
|
+
bufferFillRect: {
|
|
43050
|
+
args: ["ptr", "u32", "u32", "u32", "u32", "ptr"],
|
|
43051
|
+
returns: "void"
|
|
43052
|
+
},
|
|
43053
|
+
bufferResize: {
|
|
43054
|
+
args: ["ptr", "u32", "u32"],
|
|
43055
|
+
returns: "void"
|
|
43056
|
+
},
|
|
43057
|
+
// Link API
|
|
43058
|
+
linkAlloc: {
|
|
43059
|
+
args: ["ptr", "u32"],
|
|
43060
|
+
returns: "u32"
|
|
43061
|
+
},
|
|
43062
|
+
linkGetUrl: {
|
|
43063
|
+
args: ["u32", "ptr", "u32"],
|
|
43064
|
+
returns: "u32"
|
|
43065
|
+
},
|
|
43066
|
+
attributesWithLink: {
|
|
43067
|
+
args: ["u32", "u32"],
|
|
43068
|
+
returns: "u32"
|
|
43069
|
+
},
|
|
43070
|
+
attributesGetLinkId: {
|
|
43071
|
+
args: ["u32"],
|
|
43072
|
+
returns: "u32"
|
|
43073
|
+
},
|
|
43074
|
+
resizeRenderer: {
|
|
43075
|
+
args: ["ptr", "u32", "u32"],
|
|
43076
|
+
returns: "void"
|
|
43077
|
+
},
|
|
43078
|
+
// Cursor functions (now renderer-scoped)
|
|
43079
|
+
setCursorPosition: {
|
|
43080
|
+
args: ["ptr", "i32", "i32", "bool"],
|
|
43081
|
+
returns: "void"
|
|
43082
|
+
},
|
|
43083
|
+
setCursorColor: {
|
|
43084
|
+
args: ["ptr", "ptr"],
|
|
43085
|
+
returns: "void"
|
|
43086
|
+
},
|
|
43087
|
+
getCursorState: {
|
|
43088
|
+
args: ["ptr", "ptr"],
|
|
43089
|
+
returns: "void"
|
|
43090
|
+
},
|
|
43091
|
+
// Cursor and mouse pointer style (combined)
|
|
43092
|
+
setCursorStyleOptions: {
|
|
43093
|
+
args: ["ptr", "ptr"],
|
|
43094
|
+
returns: "void"
|
|
43095
|
+
},
|
|
43096
|
+
// Debug overlay
|
|
43097
|
+
setDebugOverlay: {
|
|
43098
|
+
args: ["ptr", "bool", "u8"],
|
|
43099
|
+
returns: "void"
|
|
43100
|
+
},
|
|
43101
|
+
// Terminal control
|
|
43102
|
+
clearTerminal: {
|
|
43103
|
+
args: ["ptr"],
|
|
43104
|
+
returns: "void"
|
|
43105
|
+
},
|
|
43106
|
+
setTerminalTitle: {
|
|
43107
|
+
args: ["ptr", "ptr", "usize"],
|
|
43108
|
+
returns: "void"
|
|
43109
|
+
},
|
|
43110
|
+
copyToClipboardOSC52: {
|
|
43111
|
+
args: ["ptr", "u8", "ptr", "usize"],
|
|
43112
|
+
returns: "bool"
|
|
43113
|
+
},
|
|
43114
|
+
clearClipboardOSC52: {
|
|
43115
|
+
args: ["ptr", "u8"],
|
|
43116
|
+
returns: "bool"
|
|
43117
|
+
},
|
|
43118
|
+
bufferDrawSuperSampleBuffer: {
|
|
43119
|
+
args: ["ptr", "u32", "u32", "ptr", "usize", "u8", "u32"],
|
|
43120
|
+
returns: "void"
|
|
43121
|
+
},
|
|
43122
|
+
bufferDrawPackedBuffer: {
|
|
43123
|
+
args: ["ptr", "ptr", "usize", "u32", "u32", "u32", "u32"],
|
|
43124
|
+
returns: "void"
|
|
43125
|
+
},
|
|
43126
|
+
bufferDrawGrayscaleBuffer: {
|
|
43127
|
+
args: ["ptr", "i32", "i32", "ptr", "u32", "u32", "ptr", "ptr"],
|
|
43128
|
+
returns: "void"
|
|
43129
|
+
},
|
|
43130
|
+
bufferDrawGrayscaleBufferSupersampled: {
|
|
43131
|
+
args: ["ptr", "i32", "i32", "ptr", "u32", "u32", "ptr", "ptr"],
|
|
43132
|
+
returns: "void"
|
|
43133
|
+
},
|
|
43134
|
+
bufferDrawGrid: {
|
|
43135
|
+
args: ["ptr", "ptr", "ptr", "ptr", "ptr", "u32", "ptr", "u32", "ptr"],
|
|
43136
|
+
returns: "void"
|
|
43137
|
+
},
|
|
43138
|
+
bufferDrawBox: {
|
|
43139
|
+
args: ["ptr", "i32", "i32", "u32", "u32", "ptr", "u32", "ptr", "ptr", "ptr", "u32"],
|
|
43140
|
+
returns: "void"
|
|
43141
|
+
},
|
|
43142
|
+
bufferPushScissorRect: {
|
|
43143
|
+
args: ["ptr", "i32", "i32", "u32", "u32"],
|
|
43144
|
+
returns: "void"
|
|
43145
|
+
},
|
|
43146
|
+
bufferPopScissorRect: {
|
|
43147
|
+
args: ["ptr"],
|
|
43148
|
+
returns: "void"
|
|
43149
|
+
},
|
|
43150
|
+
bufferClearScissorRects: {
|
|
43151
|
+
args: ["ptr"],
|
|
43152
|
+
returns: "void"
|
|
43153
|
+
},
|
|
43154
|
+
bufferPushOpacity: {
|
|
43155
|
+
args: ["ptr", "f32"],
|
|
43156
|
+
returns: "void"
|
|
43157
|
+
},
|
|
43158
|
+
bufferPopOpacity: {
|
|
43159
|
+
args: ["ptr"],
|
|
43160
|
+
returns: "void"
|
|
43161
|
+
},
|
|
43162
|
+
bufferGetCurrentOpacity: {
|
|
43163
|
+
args: ["ptr"],
|
|
43164
|
+
returns: "f32"
|
|
43165
|
+
},
|
|
43166
|
+
bufferClearOpacity: {
|
|
43167
|
+
args: ["ptr"],
|
|
43168
|
+
returns: "void"
|
|
43169
|
+
},
|
|
43170
|
+
addToHitGrid: {
|
|
43171
|
+
args: ["ptr", "i32", "i32", "u32", "u32", "u32"],
|
|
43172
|
+
returns: "void"
|
|
43173
|
+
},
|
|
43174
|
+
clearCurrentHitGrid: {
|
|
43175
|
+
args: ["ptr"],
|
|
43176
|
+
returns: "void"
|
|
43177
|
+
},
|
|
43178
|
+
hitGridPushScissorRect: {
|
|
43179
|
+
args: ["ptr", "i32", "i32", "u32", "u32"],
|
|
43180
|
+
returns: "void"
|
|
43181
|
+
},
|
|
43182
|
+
hitGridPopScissorRect: {
|
|
43183
|
+
args: ["ptr"],
|
|
43184
|
+
returns: "void"
|
|
43185
|
+
},
|
|
43186
|
+
hitGridClearScissorRects: {
|
|
43187
|
+
args: ["ptr"],
|
|
43188
|
+
returns: "void"
|
|
43189
|
+
},
|
|
43190
|
+
addToCurrentHitGridClipped: {
|
|
43191
|
+
args: ["ptr", "i32", "i32", "u32", "u32", "u32"],
|
|
43192
|
+
returns: "void"
|
|
43193
|
+
},
|
|
43194
|
+
checkHit: {
|
|
43195
|
+
args: ["ptr", "u32", "u32"],
|
|
43196
|
+
returns: "u32"
|
|
43197
|
+
},
|
|
43198
|
+
getHitGridDirty: {
|
|
43199
|
+
args: ["ptr"],
|
|
43200
|
+
returns: "bool"
|
|
43201
|
+
},
|
|
43202
|
+
dumpHitGrid: {
|
|
43203
|
+
args: ["ptr"],
|
|
43204
|
+
returns: "void"
|
|
43205
|
+
},
|
|
43206
|
+
dumpBuffers: {
|
|
43207
|
+
args: ["ptr", "i64"],
|
|
43208
|
+
returns: "void"
|
|
43209
|
+
},
|
|
43210
|
+
dumpStdoutBuffer: {
|
|
43211
|
+
args: ["ptr", "i64"],
|
|
43212
|
+
returns: "void"
|
|
43213
|
+
},
|
|
43214
|
+
restoreTerminalModes: {
|
|
43215
|
+
args: ["ptr"],
|
|
43216
|
+
returns: "void"
|
|
43217
|
+
},
|
|
43218
|
+
enableMouse: {
|
|
43219
|
+
args: ["ptr", "bool"],
|
|
43220
|
+
returns: "void"
|
|
43221
|
+
},
|
|
43222
|
+
disableMouse: {
|
|
43223
|
+
args: ["ptr"],
|
|
43224
|
+
returns: "void"
|
|
43225
|
+
},
|
|
43226
|
+
enableKittyKeyboard: {
|
|
43227
|
+
args: ["ptr", "u8"],
|
|
43228
|
+
returns: "void"
|
|
43229
|
+
},
|
|
43230
|
+
disableKittyKeyboard: {
|
|
43231
|
+
args: ["ptr"],
|
|
43232
|
+
returns: "void"
|
|
43233
|
+
},
|
|
43234
|
+
setKittyKeyboardFlags: {
|
|
43235
|
+
args: ["ptr", "u8"],
|
|
43236
|
+
returns: "void"
|
|
43237
|
+
},
|
|
43238
|
+
getKittyKeyboardFlags: {
|
|
43239
|
+
args: ["ptr"],
|
|
43240
|
+
returns: "u8"
|
|
43241
|
+
},
|
|
43242
|
+
setupTerminal: {
|
|
43243
|
+
args: ["ptr", "bool"],
|
|
43244
|
+
returns: "void"
|
|
43245
|
+
},
|
|
43246
|
+
suspendRenderer: {
|
|
43247
|
+
args: ["ptr"],
|
|
43248
|
+
returns: "void"
|
|
43249
|
+
},
|
|
43250
|
+
resumeRenderer: {
|
|
43251
|
+
args: ["ptr"],
|
|
43252
|
+
returns: "void"
|
|
43253
|
+
},
|
|
43254
|
+
writeOut: {
|
|
43255
|
+
args: ["ptr", "ptr", "u64"],
|
|
43256
|
+
returns: "void"
|
|
43257
|
+
},
|
|
43258
|
+
// TextBuffer functions
|
|
43259
|
+
createTextBuffer: {
|
|
43260
|
+
args: ["u8"],
|
|
43261
|
+
returns: "ptr"
|
|
43262
|
+
},
|
|
43263
|
+
destroyTextBuffer: {
|
|
43264
|
+
args: ["ptr"],
|
|
43265
|
+
returns: "void"
|
|
43266
|
+
},
|
|
43267
|
+
textBufferGetLength: {
|
|
43268
|
+
args: ["ptr"],
|
|
43269
|
+
returns: "u32"
|
|
43270
|
+
},
|
|
43271
|
+
textBufferGetByteSize: {
|
|
43272
|
+
args: ["ptr"],
|
|
43273
|
+
returns: "u32"
|
|
43274
|
+
},
|
|
43275
|
+
textBufferReset: {
|
|
43276
|
+
args: ["ptr"],
|
|
43277
|
+
returns: "void"
|
|
43278
|
+
},
|
|
43279
|
+
textBufferClear: {
|
|
43280
|
+
args: ["ptr"],
|
|
43281
|
+
returns: "void"
|
|
43282
|
+
},
|
|
43283
|
+
textBufferSetDefaultFg: {
|
|
43284
|
+
args: ["ptr", "ptr"],
|
|
43285
|
+
returns: "void"
|
|
43286
|
+
},
|
|
43287
|
+
textBufferSetDefaultBg: {
|
|
43288
|
+
args: ["ptr", "ptr"],
|
|
43289
|
+
returns: "void"
|
|
43290
|
+
},
|
|
43291
|
+
textBufferSetDefaultAttributes: {
|
|
43292
|
+
args: ["ptr", "ptr"],
|
|
43293
|
+
returns: "void"
|
|
43294
|
+
},
|
|
43295
|
+
textBufferResetDefaults: {
|
|
43296
|
+
args: ["ptr"],
|
|
43297
|
+
returns: "void"
|
|
43298
|
+
},
|
|
43299
|
+
textBufferGetTabWidth: {
|
|
43300
|
+
args: ["ptr"],
|
|
43301
|
+
returns: "u8"
|
|
43302
|
+
},
|
|
43303
|
+
textBufferSetTabWidth: {
|
|
43304
|
+
args: ["ptr", "u8"],
|
|
43305
|
+
returns: "void"
|
|
43306
|
+
},
|
|
43307
|
+
textBufferRegisterMemBuffer: {
|
|
43308
|
+
args: ["ptr", "ptr", "usize", "bool"],
|
|
43309
|
+
returns: "u16"
|
|
43310
|
+
},
|
|
43311
|
+
textBufferReplaceMemBuffer: {
|
|
43312
|
+
args: ["ptr", "u8", "ptr", "usize", "bool"],
|
|
43313
|
+
returns: "bool"
|
|
43314
|
+
},
|
|
43315
|
+
textBufferClearMemRegistry: {
|
|
43316
|
+
args: ["ptr"],
|
|
43317
|
+
returns: "void"
|
|
43318
|
+
},
|
|
43319
|
+
textBufferSetTextFromMem: {
|
|
43320
|
+
args: ["ptr", "u8"],
|
|
43321
|
+
returns: "void"
|
|
43322
|
+
},
|
|
43323
|
+
textBufferAppend: {
|
|
43324
|
+
args: ["ptr", "ptr", "usize"],
|
|
43325
|
+
returns: "void"
|
|
43326
|
+
},
|
|
43327
|
+
textBufferAppendFromMemId: {
|
|
43328
|
+
args: ["ptr", "u8"],
|
|
43329
|
+
returns: "void"
|
|
43330
|
+
},
|
|
43331
|
+
textBufferLoadFile: {
|
|
43332
|
+
args: ["ptr", "ptr", "usize"],
|
|
43333
|
+
returns: "bool"
|
|
43334
|
+
},
|
|
43335
|
+
textBufferSetStyledText: {
|
|
43336
|
+
args: ["ptr", "ptr", "usize"],
|
|
43337
|
+
returns: "void"
|
|
43338
|
+
},
|
|
43339
|
+
textBufferGetLineCount: {
|
|
43340
|
+
args: ["ptr"],
|
|
43341
|
+
returns: "u32"
|
|
43342
|
+
},
|
|
43343
|
+
textBufferGetPlainText: {
|
|
43344
|
+
args: ["ptr", "ptr", "usize"],
|
|
43345
|
+
returns: "usize"
|
|
43346
|
+
},
|
|
43347
|
+
textBufferAddHighlightByCharRange: {
|
|
43348
|
+
args: ["ptr", "ptr"],
|
|
43349
|
+
returns: "void"
|
|
43350
|
+
},
|
|
43351
|
+
textBufferAddHighlight: {
|
|
43352
|
+
args: ["ptr", "u32", "ptr"],
|
|
43353
|
+
returns: "void"
|
|
43354
|
+
},
|
|
43355
|
+
textBufferRemoveHighlightsByRef: {
|
|
43356
|
+
args: ["ptr", "u16"],
|
|
43357
|
+
returns: "void"
|
|
43358
|
+
},
|
|
43359
|
+
textBufferClearLineHighlights: {
|
|
43360
|
+
args: ["ptr", "u32"],
|
|
43361
|
+
returns: "void"
|
|
43362
|
+
},
|
|
43363
|
+
textBufferClearAllHighlights: {
|
|
43364
|
+
args: ["ptr"],
|
|
43365
|
+
returns: "void"
|
|
43366
|
+
},
|
|
43367
|
+
textBufferSetSyntaxStyle: {
|
|
43368
|
+
args: ["ptr", "ptr"],
|
|
43369
|
+
returns: "void"
|
|
43370
|
+
},
|
|
43371
|
+
textBufferGetLineHighlightsPtr: {
|
|
43372
|
+
args: ["ptr", "u32", "ptr"],
|
|
43373
|
+
returns: "ptr"
|
|
43374
|
+
},
|
|
43375
|
+
textBufferFreeLineHighlights: {
|
|
43376
|
+
args: ["ptr", "usize"],
|
|
43377
|
+
returns: "void"
|
|
43378
|
+
},
|
|
43379
|
+
textBufferGetHighlightCount: {
|
|
43380
|
+
args: ["ptr"],
|
|
43381
|
+
returns: "u32"
|
|
43382
|
+
},
|
|
43383
|
+
textBufferGetTextRange: {
|
|
43384
|
+
args: ["ptr", "u32", "u32", "ptr", "usize"],
|
|
43385
|
+
returns: "usize"
|
|
43386
|
+
},
|
|
43387
|
+
textBufferGetTextRangeByCoords: {
|
|
43388
|
+
args: ["ptr", "u32", "u32", "u32", "u32", "ptr", "usize"],
|
|
43389
|
+
returns: "usize"
|
|
43390
|
+
},
|
|
43391
|
+
// TextBufferView functions
|
|
43392
|
+
createTextBufferView: {
|
|
43393
|
+
args: ["ptr"],
|
|
43394
|
+
returns: "ptr"
|
|
43395
|
+
},
|
|
43396
|
+
destroyTextBufferView: {
|
|
43397
|
+
args: ["ptr"],
|
|
43398
|
+
returns: "void"
|
|
43399
|
+
},
|
|
43400
|
+
textBufferViewSetSelection: {
|
|
43401
|
+
args: ["ptr", "u32", "u32", "ptr", "ptr"],
|
|
43402
|
+
returns: "void"
|
|
43403
|
+
},
|
|
43404
|
+
textBufferViewResetSelection: {
|
|
43405
|
+
args: ["ptr"],
|
|
43406
|
+
returns: "void"
|
|
43407
|
+
},
|
|
43408
|
+
textBufferViewGetSelectionInfo: {
|
|
43409
|
+
args: ["ptr"],
|
|
43410
|
+
returns: "u64"
|
|
43411
|
+
},
|
|
43412
|
+
textBufferViewSetLocalSelection: {
|
|
43413
|
+
args: ["ptr", "i32", "i32", "i32", "i32", "ptr", "ptr"],
|
|
43414
|
+
returns: "bool"
|
|
43415
|
+
},
|
|
43416
|
+
textBufferViewUpdateSelection: {
|
|
43417
|
+
args: ["ptr", "u32", "ptr", "ptr"],
|
|
43418
|
+
returns: "void"
|
|
43419
|
+
},
|
|
43420
|
+
textBufferViewUpdateLocalSelection: {
|
|
43421
|
+
args: ["ptr", "i32", "i32", "i32", "i32", "ptr", "ptr"],
|
|
43422
|
+
returns: "bool"
|
|
43423
|
+
},
|
|
43424
|
+
textBufferViewResetLocalSelection: {
|
|
43425
|
+
args: ["ptr"],
|
|
43426
|
+
returns: "void"
|
|
43427
|
+
},
|
|
43428
|
+
textBufferViewSetWrapWidth: {
|
|
43429
|
+
args: ["ptr", "u32"],
|
|
43430
|
+
returns: "void"
|
|
43431
|
+
},
|
|
43432
|
+
textBufferViewSetWrapMode: {
|
|
43433
|
+
args: ["ptr", "u8"],
|
|
43434
|
+
returns: "void"
|
|
43435
|
+
},
|
|
43436
|
+
textBufferViewSetViewportSize: {
|
|
43437
|
+
args: ["ptr", "u32", "u32"],
|
|
43438
|
+
returns: "void"
|
|
43439
|
+
},
|
|
43440
|
+
textBufferViewSetViewport: {
|
|
43441
|
+
args: ["ptr", "u32", "u32", "u32", "u32"],
|
|
43442
|
+
returns: "void"
|
|
43443
|
+
},
|
|
43444
|
+
textBufferViewGetVirtualLineCount: {
|
|
43445
|
+
args: ["ptr"],
|
|
43446
|
+
returns: "u32"
|
|
43447
|
+
},
|
|
43448
|
+
textBufferViewGetLineInfoDirect: {
|
|
43449
|
+
args: ["ptr", "ptr"],
|
|
43450
|
+
returns: "void"
|
|
43451
|
+
},
|
|
43452
|
+
textBufferViewGetLogicalLineInfoDirect: {
|
|
43453
|
+
args: ["ptr", "ptr"],
|
|
43454
|
+
returns: "void"
|
|
43455
|
+
},
|
|
43456
|
+
textBufferViewGetSelectedText: {
|
|
43457
|
+
args: ["ptr", "ptr", "usize"],
|
|
43458
|
+
returns: "usize"
|
|
43459
|
+
},
|
|
43460
|
+
textBufferViewGetPlainText: {
|
|
43461
|
+
args: ["ptr", "ptr", "usize"],
|
|
43462
|
+
returns: "usize"
|
|
43463
|
+
},
|
|
43464
|
+
textBufferViewSetTabIndicator: {
|
|
43465
|
+
args: ["ptr", "u32"],
|
|
43466
|
+
returns: "void"
|
|
43467
|
+
},
|
|
43468
|
+
textBufferViewSetTabIndicatorColor: {
|
|
43469
|
+
args: ["ptr", "ptr"],
|
|
43470
|
+
returns: "void"
|
|
43471
|
+
},
|
|
43472
|
+
textBufferViewSetTruncate: {
|
|
43473
|
+
args: ["ptr", "bool"],
|
|
43474
|
+
returns: "void"
|
|
43475
|
+
},
|
|
43476
|
+
textBufferViewMeasureForDimensions: {
|
|
43477
|
+
args: ["ptr", "u32", "u32", "ptr"],
|
|
43478
|
+
returns: "bool"
|
|
43479
|
+
},
|
|
43480
|
+
bufferDrawTextBufferView: {
|
|
43481
|
+
args: ["ptr", "ptr", "i32", "i32"],
|
|
43482
|
+
returns: "void"
|
|
43483
|
+
},
|
|
43484
|
+
bufferDrawEditorView: {
|
|
43485
|
+
args: ["ptr", "ptr", "i32", "i32"],
|
|
43486
|
+
returns: "void"
|
|
43487
|
+
},
|
|
43488
|
+
// EditorView functions
|
|
43489
|
+
createEditorView: {
|
|
43490
|
+
args: ["ptr", "u32", "u32"],
|
|
43491
|
+
returns: "ptr"
|
|
43492
|
+
},
|
|
43493
|
+
destroyEditorView: {
|
|
43494
|
+
args: ["ptr"],
|
|
43495
|
+
returns: "void"
|
|
43496
|
+
},
|
|
43497
|
+
editorViewSetViewportSize: {
|
|
43498
|
+
args: ["ptr", "u32", "u32"],
|
|
43499
|
+
returns: "void"
|
|
43500
|
+
},
|
|
43501
|
+
editorViewSetViewport: {
|
|
43502
|
+
args: ["ptr", "u32", "u32", "u32", "u32", "bool"],
|
|
43503
|
+
returns: "void"
|
|
43504
|
+
},
|
|
43505
|
+
editorViewGetViewport: {
|
|
43506
|
+
args: ["ptr", "ptr", "ptr", "ptr", "ptr"],
|
|
43507
|
+
returns: "void"
|
|
43508
|
+
},
|
|
43509
|
+
editorViewSetScrollMargin: {
|
|
43510
|
+
args: ["ptr", "f32"],
|
|
43511
|
+
returns: "void"
|
|
43512
|
+
},
|
|
43513
|
+
editorViewSetWrapMode: {
|
|
43514
|
+
args: ["ptr", "u8"],
|
|
43515
|
+
returns: "void"
|
|
43516
|
+
},
|
|
43517
|
+
editorViewGetVirtualLineCount: {
|
|
43518
|
+
args: ["ptr"],
|
|
43519
|
+
returns: "u32"
|
|
43520
|
+
},
|
|
43521
|
+
editorViewGetTotalVirtualLineCount: {
|
|
43522
|
+
args: ["ptr"],
|
|
43523
|
+
returns: "u32"
|
|
43524
|
+
},
|
|
43525
|
+
editorViewGetTextBufferView: {
|
|
43526
|
+
args: ["ptr"],
|
|
43527
|
+
returns: "ptr"
|
|
43528
|
+
},
|
|
43529
|
+
editorViewGetLineInfoDirect: {
|
|
43530
|
+
args: ["ptr", "ptr"],
|
|
43531
|
+
returns: "void"
|
|
43532
|
+
},
|
|
43533
|
+
editorViewGetLogicalLineInfoDirect: {
|
|
43534
|
+
args: ["ptr", "ptr"],
|
|
43535
|
+
returns: "void"
|
|
43536
|
+
},
|
|
43537
|
+
// EditBuffer functions
|
|
43538
|
+
createEditBuffer: {
|
|
43539
|
+
args: ["u8"],
|
|
43540
|
+
returns: "ptr"
|
|
43541
|
+
},
|
|
43542
|
+
destroyEditBuffer: {
|
|
43543
|
+
args: ["ptr"],
|
|
43544
|
+
returns: "void"
|
|
43545
|
+
},
|
|
43546
|
+
editBufferSetText: {
|
|
43547
|
+
args: ["ptr", "ptr", "usize"],
|
|
43548
|
+
returns: "void"
|
|
43549
|
+
},
|
|
43550
|
+
editBufferSetTextFromMem: {
|
|
43551
|
+
args: ["ptr", "u8"],
|
|
43552
|
+
returns: "void"
|
|
43553
|
+
},
|
|
43554
|
+
editBufferReplaceText: {
|
|
43555
|
+
args: ["ptr", "ptr", "usize"],
|
|
43556
|
+
returns: "void"
|
|
43557
|
+
},
|
|
43558
|
+
editBufferReplaceTextFromMem: {
|
|
43559
|
+
args: ["ptr", "u8"],
|
|
43560
|
+
returns: "void"
|
|
43561
|
+
},
|
|
43562
|
+
editBufferGetText: {
|
|
43563
|
+
args: ["ptr", "ptr", "usize"],
|
|
43564
|
+
returns: "usize"
|
|
43565
|
+
},
|
|
43566
|
+
editBufferInsertChar: {
|
|
43567
|
+
args: ["ptr", "ptr", "usize"],
|
|
43568
|
+
returns: "void"
|
|
43569
|
+
},
|
|
43570
|
+
editBufferInsertText: {
|
|
43571
|
+
args: ["ptr", "ptr", "usize"],
|
|
43572
|
+
returns: "void"
|
|
43573
|
+
},
|
|
43574
|
+
editBufferDeleteChar: {
|
|
43575
|
+
args: ["ptr"],
|
|
43576
|
+
returns: "void"
|
|
43577
|
+
},
|
|
43578
|
+
editBufferDeleteCharBackward: {
|
|
43579
|
+
args: ["ptr"],
|
|
43580
|
+
returns: "void"
|
|
43581
|
+
},
|
|
43582
|
+
editBufferDeleteRange: {
|
|
43583
|
+
args: ["ptr", "u32", "u32", "u32", "u32"],
|
|
43584
|
+
returns: "void"
|
|
43585
|
+
},
|
|
43586
|
+
editBufferNewLine: {
|
|
43587
|
+
args: ["ptr"],
|
|
43588
|
+
returns: "void"
|
|
43589
|
+
},
|
|
43590
|
+
editBufferDeleteLine: {
|
|
43591
|
+
args: ["ptr"],
|
|
43592
|
+
returns: "void"
|
|
43593
|
+
},
|
|
43594
|
+
editBufferMoveCursorLeft: {
|
|
43595
|
+
args: ["ptr"],
|
|
43596
|
+
returns: "void"
|
|
43597
|
+
},
|
|
43598
|
+
editBufferMoveCursorRight: {
|
|
43599
|
+
args: ["ptr"],
|
|
43600
|
+
returns: "void"
|
|
43601
|
+
},
|
|
43602
|
+
editBufferMoveCursorUp: {
|
|
43603
|
+
args: ["ptr"],
|
|
43604
|
+
returns: "void"
|
|
43605
|
+
},
|
|
43606
|
+
editBufferMoveCursorDown: {
|
|
43607
|
+
args: ["ptr"],
|
|
43608
|
+
returns: "void"
|
|
43609
|
+
},
|
|
43610
|
+
editBufferGotoLine: {
|
|
43611
|
+
args: ["ptr", "u32"],
|
|
43612
|
+
returns: "void"
|
|
43613
|
+
},
|
|
43614
|
+
editBufferSetCursor: {
|
|
43615
|
+
args: ["ptr", "u32", "u32"],
|
|
43616
|
+
returns: "void"
|
|
43617
|
+
},
|
|
43618
|
+
editBufferSetCursorToLineCol: {
|
|
43619
|
+
args: ["ptr", "u32", "u32"],
|
|
43620
|
+
returns: "void"
|
|
43621
|
+
},
|
|
43622
|
+
editBufferSetCursorByOffset: {
|
|
43623
|
+
args: ["ptr", "u32"],
|
|
43624
|
+
returns: "void"
|
|
43625
|
+
},
|
|
43626
|
+
editBufferGetCursorPosition: {
|
|
43627
|
+
args: ["ptr", "ptr"],
|
|
43628
|
+
returns: "void"
|
|
43629
|
+
},
|
|
43630
|
+
editBufferGetId: {
|
|
43631
|
+
args: ["ptr"],
|
|
43632
|
+
returns: "u16"
|
|
43633
|
+
},
|
|
43634
|
+
editBufferGetTextBuffer: {
|
|
43635
|
+
args: ["ptr"],
|
|
43636
|
+
returns: "ptr"
|
|
43637
|
+
},
|
|
43638
|
+
editBufferDebugLogRope: {
|
|
43639
|
+
args: ["ptr"],
|
|
43640
|
+
returns: "void"
|
|
43641
|
+
},
|
|
43642
|
+
editBufferUndo: {
|
|
43643
|
+
args: ["ptr", "ptr", "usize"],
|
|
43644
|
+
returns: "usize"
|
|
43645
|
+
},
|
|
43646
|
+
editBufferRedo: {
|
|
43647
|
+
args: ["ptr", "ptr", "usize"],
|
|
43648
|
+
returns: "usize"
|
|
43649
|
+
},
|
|
43650
|
+
editBufferCanUndo: {
|
|
43651
|
+
args: ["ptr"],
|
|
43652
|
+
returns: "bool"
|
|
43653
|
+
},
|
|
43654
|
+
editBufferCanRedo: {
|
|
43655
|
+
args: ["ptr"],
|
|
43656
|
+
returns: "bool"
|
|
43657
|
+
},
|
|
43658
|
+
editBufferClearHistory: {
|
|
43659
|
+
args: ["ptr"],
|
|
43660
|
+
returns: "void"
|
|
43661
|
+
},
|
|
43662
|
+
editBufferClear: {
|
|
43663
|
+
args: ["ptr"],
|
|
43664
|
+
returns: "void"
|
|
43665
|
+
},
|
|
43666
|
+
editBufferGetNextWordBoundary: {
|
|
43667
|
+
args: ["ptr", "ptr"],
|
|
43668
|
+
returns: "void"
|
|
43669
|
+
},
|
|
43670
|
+
editBufferGetPrevWordBoundary: {
|
|
43671
|
+
args: ["ptr", "ptr"],
|
|
43672
|
+
returns: "void"
|
|
43673
|
+
},
|
|
43674
|
+
editBufferGetEOL: {
|
|
43675
|
+
args: ["ptr", "ptr"],
|
|
43676
|
+
returns: "void"
|
|
43677
|
+
},
|
|
43678
|
+
editBufferOffsetToPosition: {
|
|
43679
|
+
args: ["ptr", "u32", "ptr"],
|
|
43680
|
+
returns: "bool"
|
|
43681
|
+
},
|
|
43682
|
+
editBufferPositionToOffset: {
|
|
43683
|
+
args: ["ptr", "u32", "u32"],
|
|
43684
|
+
returns: "u32"
|
|
43685
|
+
},
|
|
43686
|
+
editBufferGetLineStartOffset: {
|
|
43687
|
+
args: ["ptr", "u32"],
|
|
43688
|
+
returns: "u32"
|
|
43689
|
+
},
|
|
43690
|
+
editBufferGetTextRange: {
|
|
43691
|
+
args: ["ptr", "u32", "u32", "ptr", "usize"],
|
|
43692
|
+
returns: "usize"
|
|
43693
|
+
},
|
|
43694
|
+
editBufferGetTextRangeByCoords: {
|
|
43695
|
+
args: ["ptr", "u32", "u32", "u32", "u32", "ptr", "usize"],
|
|
43696
|
+
returns: "usize"
|
|
43697
|
+
},
|
|
43698
|
+
// EditorView selection and editing methods
|
|
43699
|
+
editorViewSetSelection: {
|
|
43700
|
+
args: ["ptr", "u32", "u32", "ptr", "ptr"],
|
|
43701
|
+
returns: "void"
|
|
43702
|
+
},
|
|
43703
|
+
editorViewResetSelection: {
|
|
43704
|
+
args: ["ptr"],
|
|
43705
|
+
returns: "void"
|
|
43706
|
+
},
|
|
43707
|
+
editorViewGetSelection: {
|
|
43708
|
+
args: ["ptr"],
|
|
43709
|
+
returns: "u64"
|
|
43710
|
+
},
|
|
43711
|
+
editorViewSetLocalSelection: {
|
|
43712
|
+
args: ["ptr", "i32", "i32", "i32", "i32", "ptr", "ptr", "bool", "bool"],
|
|
43713
|
+
returns: "bool"
|
|
43714
|
+
},
|
|
43715
|
+
editorViewUpdateSelection: {
|
|
43716
|
+
args: ["ptr", "u32", "ptr", "ptr"],
|
|
43717
|
+
returns: "void"
|
|
43718
|
+
},
|
|
43719
|
+
editorViewUpdateLocalSelection: {
|
|
43720
|
+
args: ["ptr", "i32", "i32", "i32", "i32", "ptr", "ptr", "bool", "bool"],
|
|
43721
|
+
returns: "bool"
|
|
43722
|
+
},
|
|
43723
|
+
editorViewResetLocalSelection: {
|
|
43724
|
+
args: ["ptr"],
|
|
43725
|
+
returns: "void"
|
|
43726
|
+
},
|
|
43727
|
+
editorViewGetSelectedTextBytes: {
|
|
43728
|
+
args: ["ptr", "ptr", "usize"],
|
|
43729
|
+
returns: "usize"
|
|
43730
|
+
},
|
|
43731
|
+
editorViewGetCursor: {
|
|
43732
|
+
args: ["ptr", "ptr", "ptr"],
|
|
43733
|
+
returns: "void"
|
|
43734
|
+
},
|
|
43735
|
+
editorViewGetText: {
|
|
43736
|
+
args: ["ptr", "ptr", "usize"],
|
|
43737
|
+
returns: "usize"
|
|
43738
|
+
},
|
|
43739
|
+
// EditorView VisualCursor methods
|
|
43740
|
+
editorViewGetVisualCursor: {
|
|
43741
|
+
args: ["ptr", "ptr"],
|
|
43742
|
+
returns: "void"
|
|
43743
|
+
},
|
|
43744
|
+
editorViewMoveUpVisual: {
|
|
43745
|
+
args: ["ptr"],
|
|
43746
|
+
returns: "void"
|
|
43747
|
+
},
|
|
43748
|
+
editorViewMoveDownVisual: {
|
|
43749
|
+
args: ["ptr"],
|
|
43750
|
+
returns: "void"
|
|
43751
|
+
},
|
|
43752
|
+
editorViewDeleteSelectedText: {
|
|
43753
|
+
args: ["ptr"],
|
|
43754
|
+
returns: "void"
|
|
43755
|
+
},
|
|
43756
|
+
editorViewSetCursorByOffset: {
|
|
43757
|
+
args: ["ptr", "u32"],
|
|
43758
|
+
returns: "void"
|
|
43759
|
+
},
|
|
43760
|
+
editorViewGetNextWordBoundary: {
|
|
43761
|
+
args: ["ptr", "ptr"],
|
|
43762
|
+
returns: "void"
|
|
43763
|
+
},
|
|
43764
|
+
editorViewGetPrevWordBoundary: {
|
|
43765
|
+
args: ["ptr", "ptr"],
|
|
43766
|
+
returns: "void"
|
|
43767
|
+
},
|
|
43768
|
+
editorViewGetEOL: {
|
|
43769
|
+
args: ["ptr", "ptr"],
|
|
43770
|
+
returns: "void"
|
|
43771
|
+
},
|
|
43772
|
+
editorViewGetVisualSOL: {
|
|
43773
|
+
args: ["ptr", "ptr"],
|
|
43774
|
+
returns: "void"
|
|
43775
|
+
},
|
|
43776
|
+
editorViewGetVisualEOL: {
|
|
43777
|
+
args: ["ptr", "ptr"],
|
|
43778
|
+
returns: "void"
|
|
43779
|
+
},
|
|
43780
|
+
editorViewSetPlaceholderStyledText: {
|
|
43781
|
+
args: ["ptr", "ptr", "usize"],
|
|
43782
|
+
returns: "void"
|
|
43783
|
+
},
|
|
43784
|
+
editorViewSetTabIndicator: {
|
|
43785
|
+
args: ["ptr", "u32"],
|
|
43786
|
+
returns: "void"
|
|
43787
|
+
},
|
|
43788
|
+
editorViewSetTabIndicatorColor: {
|
|
43789
|
+
args: ["ptr", "ptr"],
|
|
43790
|
+
returns: "void"
|
|
43791
|
+
},
|
|
43792
|
+
getArenaAllocatedBytes: {
|
|
43793
|
+
args: [],
|
|
43794
|
+
returns: "usize"
|
|
43795
|
+
},
|
|
43796
|
+
getBuildOptions: {
|
|
43797
|
+
args: ["ptr"],
|
|
43798
|
+
returns: "void"
|
|
43799
|
+
},
|
|
43800
|
+
getAllocatorStats: {
|
|
43801
|
+
args: ["ptr"],
|
|
43802
|
+
returns: "void"
|
|
43803
|
+
},
|
|
43804
|
+
// SyntaxStyle functions
|
|
43805
|
+
createSyntaxStyle: {
|
|
43806
|
+
args: [],
|
|
43807
|
+
returns: "ptr"
|
|
43808
|
+
},
|
|
43809
|
+
destroySyntaxStyle: {
|
|
43810
|
+
args: ["ptr"],
|
|
43811
|
+
returns: "void"
|
|
43812
|
+
},
|
|
43813
|
+
syntaxStyleRegister: {
|
|
43814
|
+
args: ["ptr", "ptr", "usize", "ptr", "ptr", "u8"],
|
|
43815
|
+
returns: "u32"
|
|
43816
|
+
},
|
|
43817
|
+
syntaxStyleResolveByName: {
|
|
43818
|
+
args: ["ptr", "ptr", "usize"],
|
|
43819
|
+
returns: "u32"
|
|
43820
|
+
},
|
|
43821
|
+
syntaxStyleGetStyleCount: {
|
|
43822
|
+
args: ["ptr"],
|
|
43823
|
+
returns: "usize"
|
|
43824
|
+
},
|
|
43825
|
+
// Terminal capability functions
|
|
43826
|
+
getTerminalCapabilities: {
|
|
43827
|
+
args: ["ptr", "ptr"],
|
|
43828
|
+
returns: "void"
|
|
43829
|
+
},
|
|
43830
|
+
processCapabilityResponse: {
|
|
43831
|
+
args: ["ptr", "ptr", "usize"],
|
|
43832
|
+
returns: "void"
|
|
43833
|
+
},
|
|
43834
|
+
// Unicode encoding API
|
|
43835
|
+
encodeUnicode: {
|
|
43836
|
+
args: ["ptr", "usize", "ptr", "ptr", "u8"],
|
|
43837
|
+
returns: "bool"
|
|
43838
|
+
},
|
|
43839
|
+
freeUnicode: {
|
|
43840
|
+
args: ["ptr", "usize"],
|
|
43841
|
+
returns: "void"
|
|
43842
|
+
},
|
|
43843
|
+
bufferDrawChar: {
|
|
43844
|
+
args: ["ptr", "u32", "u32", "u32", "ptr", "ptr", "u32"],
|
|
43845
|
+
returns: "void"
|
|
43846
|
+
},
|
|
43847
|
+
// NativeSpanFeed
|
|
43848
|
+
createNativeSpanFeed: {
|
|
43849
|
+
args: ["ptr"],
|
|
43850
|
+
returns: "ptr"
|
|
43851
|
+
},
|
|
43852
|
+
attachNativeSpanFeed: {
|
|
43853
|
+
args: ["ptr"],
|
|
43854
|
+
returns: "i32"
|
|
43855
|
+
},
|
|
43856
|
+
destroyNativeSpanFeed: {
|
|
43857
|
+
args: ["ptr"],
|
|
43858
|
+
returns: "void"
|
|
43859
|
+
},
|
|
43860
|
+
streamWrite: {
|
|
43861
|
+
args: ["ptr", "ptr", "u64"],
|
|
43862
|
+
returns: "i32"
|
|
43863
|
+
},
|
|
43864
|
+
streamCommit: {
|
|
43865
|
+
args: ["ptr"],
|
|
43866
|
+
returns: "i32"
|
|
43867
|
+
},
|
|
43868
|
+
streamDrainSpans: {
|
|
43869
|
+
args: ["ptr", "ptr", "u32"],
|
|
43870
|
+
returns: "u32"
|
|
43871
|
+
},
|
|
43872
|
+
streamClose: {
|
|
43873
|
+
args: ["ptr"],
|
|
43874
|
+
returns: "i32"
|
|
43875
|
+
},
|
|
43876
|
+
streamReserve: {
|
|
43877
|
+
args: ["ptr", "u32", "ptr"],
|
|
43878
|
+
returns: "i32"
|
|
43879
|
+
},
|
|
43880
|
+
streamCommitReserved: {
|
|
43881
|
+
args: ["ptr", "u32"],
|
|
43882
|
+
returns: "i32"
|
|
43883
|
+
},
|
|
43884
|
+
streamSetOptions: {
|
|
43885
|
+
args: ["ptr", "ptr"],
|
|
43886
|
+
returns: "i32"
|
|
43887
|
+
},
|
|
43888
|
+
streamGetStats: {
|
|
43889
|
+
args: ["ptr", "ptr"],
|
|
43890
|
+
returns: "i32"
|
|
43891
|
+
},
|
|
43892
|
+
streamSetCallback: {
|
|
43893
|
+
args: ["ptr", "ptr"],
|
|
43894
|
+
returns: "void"
|
|
43895
|
+
}
|
|
43896
|
+
});
|
|
43897
|
+
if (env.OTUI_DEBUG_FFI || env.OTUI_TRACE_FFI) {
|
|
43898
|
+
return {
|
|
43899
|
+
symbols: convertToDebugSymbols(rawSymbols.symbols)
|
|
43900
|
+
};
|
|
43901
|
+
}
|
|
43902
|
+
return rawSymbols;
|
|
43903
|
+
}
|
|
43904
|
+
function convertToDebugSymbols(symbols) {
|
|
43905
|
+
if (!globalTraceSymbols) {
|
|
43906
|
+
globalTraceSymbols = {};
|
|
43907
|
+
}
|
|
43908
|
+
if (env.OTUI_DEBUG_FFI && !globalFFILogWriter) {
|
|
43909
|
+
const now = /* @__PURE__ */ new Date();
|
|
43910
|
+
const timestamp = now.toISOString().replace(/[:.]/g, "-").replace(/T/, "_").split("Z")[0];
|
|
43911
|
+
const logFilePath = `ffi_otui_debug_${timestamp}.log`;
|
|
43912
|
+
globalFFILogWriter = Bun.file(logFilePath).writer();
|
|
43913
|
+
}
|
|
43914
|
+
const debugSymbols = {};
|
|
43915
|
+
let hasTracing = false;
|
|
43916
|
+
Object.entries(symbols).forEach(([key, value]) => {
|
|
43917
|
+
debugSymbols[key] = value;
|
|
43918
|
+
});
|
|
43919
|
+
if (env.OTUI_DEBUG_FFI && globalFFILogWriter) {
|
|
43920
|
+
const writer = globalFFILogWriter;
|
|
43921
|
+
const writeSync = (msg) => {
|
|
43922
|
+
const buffer = new TextEncoder().encode(msg + "\n");
|
|
43923
|
+
writer.write(buffer);
|
|
43924
|
+
writer.flush();
|
|
43925
|
+
};
|
|
43926
|
+
Object.entries(symbols).forEach(([key, value]) => {
|
|
43927
|
+
if (typeof value === "function") {
|
|
43928
|
+
debugSymbols[key] = (...args) => {
|
|
43929
|
+
writeSync(`${key}(${args.map((arg) => String(arg)).join(", ")})`);
|
|
43930
|
+
const result = value(...args);
|
|
43931
|
+
writeSync(`${key} returned: ${String(result)}`);
|
|
43932
|
+
return result;
|
|
43933
|
+
};
|
|
43934
|
+
}
|
|
43935
|
+
});
|
|
43936
|
+
}
|
|
43937
|
+
if (env.OTUI_TRACE_FFI) {
|
|
43938
|
+
hasTracing = true;
|
|
43939
|
+
Object.entries(symbols).forEach(([key, value]) => {
|
|
43940
|
+
if (typeof value === "function") {
|
|
43941
|
+
if (!globalTraceSymbols[key]) {
|
|
43942
|
+
globalTraceSymbols[key] = [];
|
|
43943
|
+
}
|
|
43944
|
+
const originalFunc = debugSymbols[key];
|
|
43945
|
+
debugSymbols[key] = (...args) => {
|
|
43946
|
+
const start = performance.now();
|
|
43947
|
+
const result = originalFunc(...args);
|
|
43948
|
+
const end = performance.now();
|
|
43949
|
+
globalTraceSymbols[key].push(end - start);
|
|
43950
|
+
return result;
|
|
43951
|
+
};
|
|
43952
|
+
}
|
|
43953
|
+
});
|
|
43954
|
+
}
|
|
43955
|
+
if ((env.OTUI_DEBUG_FFI || env.OTUI_TRACE_FFI) && !exitHandlerRegistered) {
|
|
43956
|
+
exitHandlerRegistered = true;
|
|
43957
|
+
process.on("exit", () => {
|
|
43958
|
+
try {
|
|
43959
|
+
if (globalFFILogWriter) {
|
|
43960
|
+
globalFFILogWriter.end();
|
|
43961
|
+
}
|
|
43962
|
+
} catch (e) {
|
|
43963
|
+
}
|
|
43964
|
+
if (globalTraceSymbols) {
|
|
43965
|
+
const allStats = [];
|
|
43966
|
+
for (const [key, timings] of Object.entries(globalTraceSymbols)) {
|
|
43967
|
+
if (!Array.isArray(timings) || timings.length === 0) {
|
|
43968
|
+
continue;
|
|
43969
|
+
}
|
|
43970
|
+
const sortedTimings = [...timings].sort((a, b2) => a - b2);
|
|
43971
|
+
const count = sortedTimings.length;
|
|
43972
|
+
const total = sortedTimings.reduce((acc, t2) => acc + t2, 0);
|
|
43973
|
+
const average = total / count;
|
|
43974
|
+
const min = sortedTimings[0];
|
|
43975
|
+
const max = sortedTimings[count - 1];
|
|
43976
|
+
const medianIndex = Math.floor(count / 2);
|
|
43977
|
+
const p90Index = Math.floor(count * 0.9);
|
|
43978
|
+
const p99Index = Math.floor(count * 0.99);
|
|
43979
|
+
const median = sortedTimings[medianIndex];
|
|
43980
|
+
const p90 = sortedTimings[Math.min(p90Index, count - 1)];
|
|
43981
|
+
const p99 = sortedTimings[Math.min(p99Index, count - 1)];
|
|
43982
|
+
allStats.push({
|
|
43983
|
+
name: key,
|
|
43984
|
+
count,
|
|
43985
|
+
total,
|
|
43986
|
+
average,
|
|
43987
|
+
min,
|
|
43988
|
+
max,
|
|
43989
|
+
median,
|
|
43990
|
+
p90,
|
|
43991
|
+
p99
|
|
43992
|
+
});
|
|
43993
|
+
}
|
|
43994
|
+
allStats.sort((a, b2) => b2.total - a.total);
|
|
43995
|
+
const lines = [];
|
|
43996
|
+
lines.push("\n--- OpenTUI FFI Call Performance ---");
|
|
43997
|
+
lines.push("Sorted by total time spent (descending)");
|
|
43998
|
+
lines.push(
|
|
43999
|
+
"-------------------------------------------------------------------------------------------------------------------------"
|
|
44000
|
+
);
|
|
44001
|
+
if (allStats.length === 0) {
|
|
44002
|
+
lines.push("No trace data collected or all symbols had zero calls.");
|
|
44003
|
+
} else {
|
|
44004
|
+
const nameHeader = "Symbol";
|
|
44005
|
+
const callsHeader = "Calls";
|
|
44006
|
+
const totalHeader = "Total (ms)";
|
|
44007
|
+
const avgHeader = "Avg (ms)";
|
|
44008
|
+
const minHeader = "Min (ms)";
|
|
44009
|
+
const maxHeader = "Max (ms)";
|
|
44010
|
+
const medHeader = "Med (ms)";
|
|
44011
|
+
const p90Header = "P90 (ms)";
|
|
44012
|
+
const p99Header = "P99 (ms)";
|
|
44013
|
+
const nameWidth = Math.max(nameHeader.length, ...allStats.map((s) => s.name.length));
|
|
44014
|
+
const countWidth = Math.max(callsHeader.length, ...allStats.map((s) => String(s.count).length));
|
|
44015
|
+
const totalWidth = Math.max(totalHeader.length, ...allStats.map((s) => s.total.toFixed(2).length));
|
|
44016
|
+
const avgWidth = Math.max(avgHeader.length, ...allStats.map((s) => s.average.toFixed(2).length));
|
|
44017
|
+
const minWidth = Math.max(minHeader.length, ...allStats.map((s) => s.min.toFixed(2).length));
|
|
44018
|
+
const maxWidth = Math.max(maxHeader.length, ...allStats.map((s) => s.max.toFixed(2).length));
|
|
44019
|
+
const medianWidth = Math.max(medHeader.length, ...allStats.map((s) => s.median.toFixed(2).length));
|
|
44020
|
+
const p90Width = Math.max(p90Header.length, ...allStats.map((s) => s.p90.toFixed(2).length));
|
|
44021
|
+
const p99Width = Math.max(p99Header.length, ...allStats.map((s) => s.p99.toFixed(2).length));
|
|
44022
|
+
lines.push(
|
|
44023
|
+
`${nameHeader.padEnd(nameWidth)} | ${callsHeader.padStart(countWidth)} | ${totalHeader.padStart(totalWidth)} | ${avgHeader.padStart(avgWidth)} | ${minHeader.padStart(minWidth)} | ${maxHeader.padStart(maxWidth)} | ${medHeader.padStart(medianWidth)} | ${p90Header.padStart(p90Width)} | ${p99Header.padStart(p99Width)}`
|
|
44024
|
+
);
|
|
44025
|
+
lines.push(
|
|
44026
|
+
`${"-".repeat(nameWidth)}-+-${"-".repeat(countWidth)}-+-${"-".repeat(totalWidth)}-+-${"-".repeat(avgWidth)}-+-${"-".repeat(minWidth)}-+-${"-".repeat(maxWidth)}-+-${"-".repeat(medianWidth)}-+-${"-".repeat(p90Width)}-+-${"-".repeat(p99Width)}`
|
|
44027
|
+
);
|
|
44028
|
+
allStats.forEach((stat) => {
|
|
44029
|
+
lines.push(
|
|
44030
|
+
`${stat.name.padEnd(nameWidth)} | ${String(stat.count).padStart(countWidth)} | ${stat.total.toFixed(2).padStart(totalWidth)} | ${stat.average.toFixed(2).padStart(avgWidth)} | ${stat.min.toFixed(2).padStart(minWidth)} | ${stat.max.toFixed(2).padStart(maxWidth)} | ${stat.median.toFixed(2).padStart(medianWidth)} | ${stat.p90.toFixed(2).padStart(p90Width)} | ${stat.p99.toFixed(2).padStart(p99Width)}`
|
|
44031
|
+
);
|
|
44032
|
+
});
|
|
44033
|
+
}
|
|
44034
|
+
lines.push(
|
|
44035
|
+
"-------------------------------------------------------------------------------------------------------------------------"
|
|
44036
|
+
);
|
|
44037
|
+
const output = lines.join("\n");
|
|
44038
|
+
console.log(output);
|
|
44039
|
+
try {
|
|
44040
|
+
const now = /* @__PURE__ */ new Date();
|
|
44041
|
+
const timestamp = now.toISOString().replace(/[:.]/g, "-").replace(/T/, "_").split("Z")[0];
|
|
44042
|
+
const traceFilePath = `ffi_otui_trace_${timestamp}.log`;
|
|
44043
|
+
Bun.write(traceFilePath, output);
|
|
44044
|
+
} catch (e) {
|
|
44045
|
+
console.error("Failed to write FFI trace file:", e);
|
|
44046
|
+
}
|
|
44047
|
+
}
|
|
44048
|
+
});
|
|
44049
|
+
}
|
|
44050
|
+
return debugSymbols;
|
|
44051
|
+
}
|
|
44052
|
+
var FFIRenderLib = class {
|
|
44053
|
+
opentui;
|
|
44054
|
+
encoder = new TextEncoder();
|
|
44055
|
+
decoder = new TextDecoder();
|
|
44056
|
+
logCallbackWrapper;
|
|
44057
|
+
// Store the FFI callback wrapper
|
|
44058
|
+
eventCallbackWrapper;
|
|
44059
|
+
// Store the FFI event callback wrapper
|
|
44060
|
+
_nativeEvents = new EventEmitter();
|
|
44061
|
+
_anyEventHandlers = [];
|
|
44062
|
+
nativeSpanFeedCallbackWrapper = null;
|
|
44063
|
+
nativeSpanFeedHandlers = /* @__PURE__ */ new Map();
|
|
44064
|
+
constructor(libPath) {
|
|
44065
|
+
this.opentui = getOpenTUILib(libPath);
|
|
44066
|
+
this.setupLogging();
|
|
44067
|
+
this.setupEventBus();
|
|
44068
|
+
}
|
|
44069
|
+
setupLogging() {
|
|
44070
|
+
if (this.logCallbackWrapper) {
|
|
44071
|
+
return;
|
|
44072
|
+
}
|
|
44073
|
+
const logCallback = new JSCallback(
|
|
44074
|
+
(level, msgPtr, msgLenBigInt) => {
|
|
44075
|
+
try {
|
|
44076
|
+
const msgLen = typeof msgLenBigInt === "bigint" ? Number(msgLenBigInt) : msgLenBigInt;
|
|
44077
|
+
if (msgLen === 0 || !msgPtr) {
|
|
44078
|
+
return;
|
|
44079
|
+
}
|
|
44080
|
+
const msgBuffer = toArrayBuffer(msgPtr, 0, msgLen);
|
|
44081
|
+
const msgBytes = new Uint8Array(msgBuffer);
|
|
44082
|
+
const message = this.decoder.decode(msgBytes);
|
|
44083
|
+
switch (level) {
|
|
44084
|
+
case LogLevel.Error:
|
|
44085
|
+
console.error(message);
|
|
44086
|
+
break;
|
|
44087
|
+
case LogLevel.Warn:
|
|
44088
|
+
console.warn(message);
|
|
44089
|
+
break;
|
|
44090
|
+
case LogLevel.Info:
|
|
44091
|
+
console.info(message);
|
|
44092
|
+
break;
|
|
44093
|
+
case LogLevel.Debug:
|
|
44094
|
+
console.debug(message);
|
|
44095
|
+
break;
|
|
44096
|
+
default:
|
|
44097
|
+
console.log(message);
|
|
44098
|
+
}
|
|
44099
|
+
} catch (error) {
|
|
44100
|
+
console.error("Error in Zig log callback:", error);
|
|
44101
|
+
}
|
|
44102
|
+
},
|
|
44103
|
+
{
|
|
44104
|
+
args: ["u8", "ptr", "usize"],
|
|
44105
|
+
returns: "void"
|
|
44106
|
+
}
|
|
44107
|
+
);
|
|
44108
|
+
this.logCallbackWrapper = logCallback;
|
|
44109
|
+
if (!logCallback.ptr) {
|
|
44110
|
+
throw new Error("Failed to create log callback");
|
|
44111
|
+
}
|
|
44112
|
+
this.setLogCallback(logCallback.ptr);
|
|
44113
|
+
}
|
|
44114
|
+
setLogCallback(callbackPtr) {
|
|
44115
|
+
this.opentui.symbols.setLogCallback(callbackPtr);
|
|
44116
|
+
}
|
|
44117
|
+
setupEventBus() {
|
|
44118
|
+
if (this.eventCallbackWrapper) {
|
|
44119
|
+
return;
|
|
44120
|
+
}
|
|
44121
|
+
const eventCallback = new JSCallback(
|
|
44122
|
+
(namePtr, nameLenBigInt, dataPtr, dataLenBigInt) => {
|
|
44123
|
+
try {
|
|
44124
|
+
const nameLen = typeof nameLenBigInt === "bigint" ? Number(nameLenBigInt) : nameLenBigInt;
|
|
44125
|
+
const dataLen = typeof dataLenBigInt === "bigint" ? Number(dataLenBigInt) : dataLenBigInt;
|
|
44126
|
+
if (nameLen === 0 || !namePtr) {
|
|
44127
|
+
return;
|
|
44128
|
+
}
|
|
44129
|
+
const nameBuffer = toArrayBuffer(namePtr, 0, nameLen);
|
|
44130
|
+
const nameBytes = new Uint8Array(nameBuffer);
|
|
44131
|
+
const eventName = this.decoder.decode(nameBytes);
|
|
44132
|
+
let eventData;
|
|
44133
|
+
if (dataLen > 0 && dataPtr) {
|
|
44134
|
+
eventData = toArrayBuffer(dataPtr, 0, dataLen).slice();
|
|
44135
|
+
} else {
|
|
44136
|
+
eventData = new ArrayBuffer(0);
|
|
44137
|
+
}
|
|
44138
|
+
queueMicrotask(() => {
|
|
44139
|
+
this._nativeEvents.emit(eventName, eventData);
|
|
44140
|
+
for (const handler of this._anyEventHandlers) {
|
|
44141
|
+
handler(eventName, eventData);
|
|
44142
|
+
}
|
|
44143
|
+
});
|
|
44144
|
+
} catch (error) {
|
|
44145
|
+
console.error("Error in native event callback:", error);
|
|
44146
|
+
}
|
|
44147
|
+
},
|
|
44148
|
+
{
|
|
44149
|
+
args: ["ptr", "usize", "ptr", "usize"],
|
|
44150
|
+
returns: "void"
|
|
44151
|
+
}
|
|
44152
|
+
);
|
|
44153
|
+
this.eventCallbackWrapper = eventCallback;
|
|
44154
|
+
if (!eventCallback.ptr) {
|
|
44155
|
+
throw new Error("Failed to create event callback");
|
|
44156
|
+
}
|
|
44157
|
+
this.setEventCallback(eventCallback.ptr);
|
|
44158
|
+
}
|
|
44159
|
+
ensureNativeSpanFeedCallback() {
|
|
44160
|
+
if (this.nativeSpanFeedCallbackWrapper) {
|
|
44161
|
+
return this.nativeSpanFeedCallbackWrapper;
|
|
44162
|
+
}
|
|
44163
|
+
const callback = new JSCallback(
|
|
44164
|
+
(streamPtr, eventId, arg0, arg1) => {
|
|
44165
|
+
const handler = this.nativeSpanFeedHandlers.get(toPointer(streamPtr));
|
|
44166
|
+
if (handler) {
|
|
44167
|
+
handler(eventId, arg0, arg1);
|
|
44168
|
+
}
|
|
44169
|
+
},
|
|
44170
|
+
{
|
|
44171
|
+
args: ["ptr", "u32", "ptr", "u64"],
|
|
44172
|
+
returns: "void"
|
|
44173
|
+
}
|
|
44174
|
+
);
|
|
44175
|
+
this.nativeSpanFeedCallbackWrapper = callback;
|
|
44176
|
+
if (!callback.ptr) {
|
|
44177
|
+
throw new Error("Failed to create native span feed callback");
|
|
44178
|
+
}
|
|
44179
|
+
return callback;
|
|
44180
|
+
}
|
|
44181
|
+
setEventCallback(callbackPtr) {
|
|
44182
|
+
this.opentui.symbols.setEventCallback(callbackPtr);
|
|
44183
|
+
}
|
|
44184
|
+
createRenderer(width, height, options = {}) {
|
|
44185
|
+
const testing = options.testing ?? false;
|
|
44186
|
+
const remote = options.remote ?? false;
|
|
44187
|
+
return this.opentui.symbols.createRenderer(width, height, testing, remote);
|
|
44188
|
+
}
|
|
44189
|
+
setTerminalEnvVar(renderer, key, value) {
|
|
44190
|
+
const keyBytes = this.encoder.encode(key);
|
|
44191
|
+
const valueBytes = this.encoder.encode(value);
|
|
44192
|
+
return this.opentui.symbols.setTerminalEnvVar(renderer, keyBytes, keyBytes.length, valueBytes, valueBytes.length);
|
|
44193
|
+
}
|
|
44194
|
+
destroyRenderer(renderer) {
|
|
44195
|
+
this.opentui.symbols.destroyRenderer(renderer);
|
|
44196
|
+
}
|
|
44197
|
+
setUseThread(renderer, useThread) {
|
|
44198
|
+
this.opentui.symbols.setUseThread(renderer, useThread);
|
|
44199
|
+
}
|
|
44200
|
+
setBackgroundColor(renderer, color) {
|
|
44201
|
+
this.opentui.symbols.setBackgroundColor(renderer, color.buffer);
|
|
44202
|
+
}
|
|
44203
|
+
setRenderOffset(renderer, offset) {
|
|
44204
|
+
this.opentui.symbols.setRenderOffset(renderer, offset);
|
|
44205
|
+
}
|
|
44206
|
+
updateStats(renderer, time, fps, frameCallbackTime) {
|
|
44207
|
+
this.opentui.symbols.updateStats(renderer, time, fps, frameCallbackTime);
|
|
44208
|
+
}
|
|
44209
|
+
updateMemoryStats(renderer, heapUsed, heapTotal, arrayBuffers) {
|
|
44210
|
+
this.opentui.symbols.updateMemoryStats(renderer, heapUsed, heapTotal, arrayBuffers);
|
|
44211
|
+
}
|
|
44212
|
+
getNextBuffer(renderer) {
|
|
44213
|
+
const bufferPtr = this.opentui.symbols.getNextBuffer(renderer);
|
|
44214
|
+
if (!bufferPtr) {
|
|
44215
|
+
throw new Error("Failed to get next buffer");
|
|
44216
|
+
}
|
|
44217
|
+
const width = this.opentui.symbols.getBufferWidth(bufferPtr);
|
|
44218
|
+
const height = this.opentui.symbols.getBufferHeight(bufferPtr);
|
|
44219
|
+
return new BrowserBuffer(this, bufferPtr, width, height, { id: "next buffer", widthMethod: "unicode" });
|
|
44220
|
+
}
|
|
44221
|
+
getCurrentBuffer(renderer) {
|
|
44222
|
+
const bufferPtr = this.opentui.symbols.getCurrentBuffer(renderer);
|
|
44223
|
+
if (!bufferPtr) {
|
|
44224
|
+
throw new Error("Failed to get current buffer");
|
|
44225
|
+
}
|
|
44226
|
+
const width = this.opentui.symbols.getBufferWidth(bufferPtr);
|
|
44227
|
+
const height = this.opentui.symbols.getBufferHeight(bufferPtr);
|
|
44228
|
+
return new BrowserBuffer(this, bufferPtr, width, height, { id: "current buffer", widthMethod: "unicode" });
|
|
44229
|
+
}
|
|
44230
|
+
bufferGetCharPtr(buffer) {
|
|
44231
|
+
const ptr2 = this.opentui.symbols.bufferGetCharPtr(buffer);
|
|
44232
|
+
if (!ptr2) {
|
|
44233
|
+
throw new Error("Failed to get char pointer");
|
|
44234
|
+
}
|
|
44235
|
+
return ptr2;
|
|
44236
|
+
}
|
|
44237
|
+
bufferGetFgPtr(buffer) {
|
|
44238
|
+
const ptr2 = this.opentui.symbols.bufferGetFgPtr(buffer);
|
|
44239
|
+
if (!ptr2) {
|
|
44240
|
+
throw new Error("Failed to get fg pointer");
|
|
44241
|
+
}
|
|
44242
|
+
return ptr2;
|
|
44243
|
+
}
|
|
44244
|
+
bufferGetBgPtr(buffer) {
|
|
44245
|
+
const ptr2 = this.opentui.symbols.bufferGetBgPtr(buffer);
|
|
44246
|
+
if (!ptr2) {
|
|
44247
|
+
throw new Error("Failed to get bg pointer");
|
|
44248
|
+
}
|
|
44249
|
+
return ptr2;
|
|
44250
|
+
}
|
|
44251
|
+
bufferGetAttributesPtr(buffer) {
|
|
44252
|
+
const ptr2 = this.opentui.symbols.bufferGetAttributesPtr(buffer);
|
|
44253
|
+
if (!ptr2) {
|
|
44254
|
+
throw new Error("Failed to get attributes pointer");
|
|
44255
|
+
}
|
|
44256
|
+
return ptr2;
|
|
44257
|
+
}
|
|
44258
|
+
bufferGetRespectAlpha(buffer) {
|
|
44259
|
+
return this.opentui.symbols.bufferGetRespectAlpha(buffer);
|
|
44260
|
+
}
|
|
44261
|
+
bufferSetRespectAlpha(buffer, respectAlpha) {
|
|
44262
|
+
this.opentui.symbols.bufferSetRespectAlpha(buffer, respectAlpha);
|
|
44263
|
+
}
|
|
44264
|
+
bufferGetId(buffer) {
|
|
44265
|
+
const maxLen = 256;
|
|
44266
|
+
const outBuffer = new Uint8Array(maxLen);
|
|
44267
|
+
const actualLen = this.opentui.symbols.bufferGetId(buffer, outBuffer, maxLen);
|
|
44268
|
+
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
44269
|
+
return this.decoder.decode(outBuffer.slice(0, len));
|
|
44270
|
+
}
|
|
44271
|
+
bufferGetRealCharSize(buffer) {
|
|
44272
|
+
return this.opentui.symbols.bufferGetRealCharSize(buffer);
|
|
44273
|
+
}
|
|
44274
|
+
bufferWriteResolvedChars(buffer, outputBuffer, addLineBreaks) {
|
|
44275
|
+
const bytesWritten = this.opentui.symbols.bufferWriteResolvedChars(
|
|
44276
|
+
buffer,
|
|
44277
|
+
outputBuffer,
|
|
44278
|
+
outputBuffer.length,
|
|
44279
|
+
addLineBreaks
|
|
44280
|
+
);
|
|
44281
|
+
return typeof bytesWritten === "bigint" ? Number(bytesWritten) : bytesWritten;
|
|
44282
|
+
}
|
|
44283
|
+
getBufferWidth(buffer) {
|
|
44284
|
+
return this.opentui.symbols.getBufferWidth(buffer);
|
|
44285
|
+
}
|
|
44286
|
+
getBufferHeight(buffer) {
|
|
44287
|
+
return this.opentui.symbols.getBufferHeight(buffer);
|
|
44288
|
+
}
|
|
44289
|
+
bufferClear(buffer, color) {
|
|
44290
|
+
this.opentui.symbols.bufferClear(buffer, color.buffer);
|
|
44291
|
+
}
|
|
44292
|
+
bufferDrawText(buffer, text, x2, y2, color, bgColor, attributes) {
|
|
44293
|
+
const textBytes = this.encoder.encode(text);
|
|
44294
|
+
const textLength = textBytes.byteLength;
|
|
44295
|
+
const bg2 = bgColor ? bgColor.buffer : null;
|
|
44296
|
+
const fg2 = color.buffer;
|
|
44297
|
+
this.opentui.symbols.bufferDrawText(buffer, textBytes, textLength, x2, y2, fg2, bg2, attributes ?? 0);
|
|
44298
|
+
}
|
|
44299
|
+
bufferSetCellWithAlphaBlending(buffer, x2, y2, char, color, bgColor, attributes) {
|
|
44300
|
+
const charPtr = char.codePointAt(0) ?? " ".codePointAt(0);
|
|
44301
|
+
const bg2 = bgColor.buffer;
|
|
44302
|
+
const fg2 = color.buffer;
|
|
44303
|
+
this.opentui.symbols.bufferSetCellWithAlphaBlending(buffer, x2, y2, charPtr, fg2, bg2, attributes ?? 0);
|
|
44304
|
+
}
|
|
44305
|
+
bufferSetCell(buffer, x2, y2, char, color, bgColor, attributes) {
|
|
44306
|
+
const charPtr = char.codePointAt(0) ?? " ".codePointAt(0);
|
|
44307
|
+
const bg2 = bgColor.buffer;
|
|
44308
|
+
const fg2 = color.buffer;
|
|
44309
|
+
this.opentui.symbols.bufferSetCell(buffer, x2, y2, charPtr, fg2, bg2, attributes ?? 0);
|
|
44310
|
+
}
|
|
44311
|
+
bufferFillRect(buffer, x2, y2, width, height, color) {
|
|
44312
|
+
const bg2 = color.buffer;
|
|
44313
|
+
this.opentui.symbols.bufferFillRect(buffer, x2, y2, width, height, bg2);
|
|
44314
|
+
}
|
|
44315
|
+
bufferDrawSuperSampleBuffer(buffer, x2, y2, pixelDataPtr, pixelDataLength, format2, alignedBytesPerRow) {
|
|
44316
|
+
const formatId = format2 === "bgra8unorm" ? 0 : 1;
|
|
44317
|
+
this.opentui.symbols.bufferDrawSuperSampleBuffer(
|
|
44318
|
+
buffer,
|
|
44319
|
+
x2,
|
|
44320
|
+
y2,
|
|
44321
|
+
pixelDataPtr,
|
|
44322
|
+
pixelDataLength,
|
|
44323
|
+
formatId,
|
|
44324
|
+
alignedBytesPerRow
|
|
44325
|
+
);
|
|
44326
|
+
}
|
|
44327
|
+
bufferDrawPackedBuffer(buffer, dataPtr, dataLen, posX, posY, terminalWidthCells, terminalHeightCells) {
|
|
44328
|
+
this.opentui.symbols.bufferDrawPackedBuffer(
|
|
44329
|
+
buffer,
|
|
44330
|
+
dataPtr,
|
|
44331
|
+
dataLen,
|
|
44332
|
+
posX,
|
|
44333
|
+
posY,
|
|
44334
|
+
terminalWidthCells,
|
|
44335
|
+
terminalHeightCells
|
|
44336
|
+
);
|
|
44337
|
+
}
|
|
44338
|
+
bufferDrawGrayscaleBuffer(buffer, posX, posY, intensitiesPtr, srcWidth, srcHeight, fg2, bg2) {
|
|
44339
|
+
this.opentui.symbols.bufferDrawGrayscaleBuffer(
|
|
44340
|
+
buffer,
|
|
44341
|
+
posX,
|
|
44342
|
+
posY,
|
|
44343
|
+
intensitiesPtr,
|
|
44344
|
+
srcWidth,
|
|
44345
|
+
srcHeight,
|
|
44346
|
+
fg2?.buffer ?? null,
|
|
44347
|
+
bg2?.buffer ?? null
|
|
44348
|
+
);
|
|
44349
|
+
}
|
|
44350
|
+
bufferDrawGrayscaleBufferSupersampled(buffer, posX, posY, intensitiesPtr, srcWidth, srcHeight, fg2, bg2) {
|
|
44351
|
+
this.opentui.symbols.bufferDrawGrayscaleBufferSupersampled(
|
|
44352
|
+
buffer,
|
|
44353
|
+
posX,
|
|
44354
|
+
posY,
|
|
44355
|
+
intensitiesPtr,
|
|
44356
|
+
srcWidth,
|
|
44357
|
+
srcHeight,
|
|
44358
|
+
fg2?.buffer ?? null,
|
|
44359
|
+
bg2?.buffer ?? null
|
|
44360
|
+
);
|
|
44361
|
+
}
|
|
44362
|
+
bufferDrawGrid(buffer, borderChars, borderFg, borderBg, columnOffsets, columnCount, rowOffsets, rowCount, options) {
|
|
44363
|
+
const optionsBuffer = GridDrawOptionsStruct.pack({
|
|
44364
|
+
drawInner: options.drawInner,
|
|
44365
|
+
drawOuter: options.drawOuter
|
|
44366
|
+
});
|
|
44367
|
+
this.opentui.symbols.bufferDrawGrid(
|
|
44368
|
+
buffer,
|
|
44369
|
+
borderChars,
|
|
44370
|
+
borderFg.buffer,
|
|
44371
|
+
borderBg.buffer,
|
|
44372
|
+
columnOffsets,
|
|
44373
|
+
columnCount,
|
|
44374
|
+
rowOffsets,
|
|
44375
|
+
rowCount,
|
|
44376
|
+
ptr(optionsBuffer)
|
|
44377
|
+
);
|
|
44378
|
+
}
|
|
44379
|
+
bufferDrawBox(buffer, x2, y2, width, height, borderChars, packedOptions, borderColor, backgroundColor, title) {
|
|
44380
|
+
const titleBytes = title ? this.encoder.encode(title) : null;
|
|
44381
|
+
const titleLen = title ? titleBytes.length : 0;
|
|
44382
|
+
const titlePtr = title ? titleBytes : null;
|
|
44383
|
+
this.opentui.symbols.bufferDrawBox(
|
|
44384
|
+
buffer,
|
|
44385
|
+
x2,
|
|
44386
|
+
y2,
|
|
44387
|
+
width,
|
|
44388
|
+
height,
|
|
44389
|
+
borderChars,
|
|
44390
|
+
packedOptions,
|
|
44391
|
+
borderColor.buffer,
|
|
44392
|
+
backgroundColor.buffer,
|
|
44393
|
+
titlePtr,
|
|
44394
|
+
titleLen
|
|
44395
|
+
);
|
|
44396
|
+
}
|
|
44397
|
+
bufferResize(buffer, width, height) {
|
|
44398
|
+
this.opentui.symbols.bufferResize(buffer, width, height);
|
|
44399
|
+
}
|
|
44400
|
+
// Link API
|
|
44401
|
+
linkAlloc(url) {
|
|
44402
|
+
const urlBytes = this.encoder.encode(url);
|
|
44403
|
+
return this.opentui.symbols.linkAlloc(urlBytes, urlBytes.length);
|
|
44404
|
+
}
|
|
44405
|
+
linkGetUrl(linkId, maxLen = 512) {
|
|
44406
|
+
const outBuffer = new Uint8Array(maxLen);
|
|
44407
|
+
const actualLen = this.opentui.symbols.linkGetUrl(linkId, outBuffer, maxLen);
|
|
44408
|
+
return this.decoder.decode(outBuffer.slice(0, actualLen));
|
|
44409
|
+
}
|
|
44410
|
+
attributesWithLink(baseAttributes, linkId) {
|
|
44411
|
+
return this.opentui.symbols.attributesWithLink(baseAttributes, linkId);
|
|
44412
|
+
}
|
|
44413
|
+
attributesGetLinkId(attributes) {
|
|
44414
|
+
return this.opentui.symbols.attributesGetLinkId(attributes);
|
|
44415
|
+
}
|
|
44416
|
+
resizeRenderer(renderer, width, height) {
|
|
44417
|
+
this.opentui.symbols.resizeRenderer(renderer, width, height);
|
|
44418
|
+
}
|
|
44419
|
+
setCursorPosition(renderer, x2, y2, visible) {
|
|
44420
|
+
this.opentui.symbols.setCursorPosition(renderer, x2, y2, visible);
|
|
44421
|
+
}
|
|
44422
|
+
setCursorColor(renderer, color) {
|
|
44423
|
+
this.opentui.symbols.setCursorColor(renderer, color.buffer);
|
|
44424
|
+
}
|
|
44425
|
+
getCursorState(renderer) {
|
|
44426
|
+
const cursorBuffer = new ArrayBuffer(CursorStateStruct.size);
|
|
44427
|
+
this.opentui.symbols.getCursorState(renderer, ptr(cursorBuffer));
|
|
44428
|
+
const struct = CursorStateStruct.unpack(cursorBuffer);
|
|
44429
|
+
return {
|
|
44430
|
+
x: struct.x,
|
|
44431
|
+
y: struct.y,
|
|
44432
|
+
visible: struct.visible,
|
|
44433
|
+
style: CURSOR_ID_TO_STYLE[struct.style] ?? "block",
|
|
44434
|
+
blinking: struct.blinking,
|
|
44435
|
+
color: RGBA2.fromValues(struct.r, struct.g, struct.b, struct.a)
|
|
44436
|
+
};
|
|
44437
|
+
}
|
|
44438
|
+
setCursorStyleOptions(renderer, options) {
|
|
44439
|
+
const style = options.style != null ? CURSOR_STYLE_TO_ID[options.style] : 255;
|
|
44440
|
+
const blinking = options.blinking != null ? options.blinking ? 1 : 0 : 255;
|
|
44441
|
+
const cursor = options.cursor != null ? MOUSE_STYLE_TO_ID[options.cursor] : 255;
|
|
44442
|
+
const buffer = CursorStyleOptionsStruct.pack({ style, blinking, color: options.color, cursor });
|
|
44443
|
+
this.opentui.symbols.setCursorStyleOptions(renderer, ptr(buffer));
|
|
44444
|
+
}
|
|
44445
|
+
render(renderer, force) {
|
|
44446
|
+
this.opentui.symbols.render(renderer, force);
|
|
44447
|
+
}
|
|
44448
|
+
createOptimizedBuffer(width, height, widthMethod, respectAlpha = false, id) {
|
|
44449
|
+
if (Number.isNaN(width) || Number.isNaN(height)) {
|
|
44450
|
+
console.error(new Error(`Invalid dimensions for OptimizedBuffer: ${width}x${height}`).stack);
|
|
44451
|
+
}
|
|
44452
|
+
const widthMethodCode = widthMethod === "wcwidth" ? 0 : 1;
|
|
44453
|
+
const idToUse = id || "unnamed buffer";
|
|
44454
|
+
const idBytes = this.encoder.encode(idToUse);
|
|
44455
|
+
const bufferPtr = this.opentui.symbols.createOptimizedBuffer(
|
|
44456
|
+
width,
|
|
44457
|
+
height,
|
|
44458
|
+
respectAlpha,
|
|
44459
|
+
widthMethodCode,
|
|
44460
|
+
idBytes,
|
|
44461
|
+
idBytes.length
|
|
44462
|
+
);
|
|
44463
|
+
if (!bufferPtr) {
|
|
44464
|
+
throw new Error(`Failed to create optimized buffer: ${width}x${height}`);
|
|
44465
|
+
}
|
|
44466
|
+
return new BrowserBuffer(this, bufferPtr, width, height, { respectAlpha, id, widthMethod });
|
|
44467
|
+
}
|
|
44468
|
+
destroyOptimizedBuffer(bufferPtr) {
|
|
44469
|
+
this.opentui.symbols.destroyOptimizedBuffer(bufferPtr);
|
|
44470
|
+
}
|
|
44471
|
+
drawFrameBuffer(targetBufferPtr, destX, destY, bufferPtr, sourceX, sourceY, sourceWidth, sourceHeight) {
|
|
44472
|
+
const srcX = sourceX ?? 0;
|
|
44473
|
+
const srcY = sourceY ?? 0;
|
|
44474
|
+
const srcWidth = sourceWidth ?? 0;
|
|
44475
|
+
const srcHeight = sourceHeight ?? 0;
|
|
44476
|
+
this.opentui.symbols.drawFrameBuffer(targetBufferPtr, destX, destY, bufferPtr, srcX, srcY, srcWidth, srcHeight);
|
|
44477
|
+
}
|
|
44478
|
+
setDebugOverlay(renderer, enabled, corner) {
|
|
44479
|
+
this.opentui.symbols.setDebugOverlay(renderer, enabled, corner);
|
|
44480
|
+
}
|
|
44481
|
+
clearTerminal(renderer) {
|
|
44482
|
+
this.opentui.symbols.clearTerminal(renderer);
|
|
44483
|
+
}
|
|
44484
|
+
setTerminalTitle(renderer, title) {
|
|
44485
|
+
const titleBytes = this.encoder.encode(title);
|
|
44486
|
+
this.opentui.symbols.setTerminalTitle(renderer, titleBytes, titleBytes.length);
|
|
44487
|
+
}
|
|
44488
|
+
copyToClipboardOSC52(renderer, target, payload) {
|
|
44489
|
+
return this.opentui.symbols.copyToClipboardOSC52(renderer, target, payload, payload.length);
|
|
44490
|
+
}
|
|
44491
|
+
clearClipboardOSC52(renderer, target) {
|
|
44492
|
+
return this.opentui.symbols.clearClipboardOSC52(renderer, target);
|
|
44493
|
+
}
|
|
44494
|
+
addToHitGrid(renderer, x2, y2, width, height, id) {
|
|
44495
|
+
this.opentui.symbols.addToHitGrid(renderer, x2, y2, width, height, id);
|
|
44496
|
+
}
|
|
44497
|
+
clearCurrentHitGrid(renderer) {
|
|
44498
|
+
this.opentui.symbols.clearCurrentHitGrid(renderer);
|
|
44499
|
+
}
|
|
44500
|
+
hitGridPushScissorRect(renderer, x2, y2, width, height) {
|
|
44501
|
+
this.opentui.symbols.hitGridPushScissorRect(renderer, x2, y2, width, height);
|
|
44502
|
+
}
|
|
44503
|
+
hitGridPopScissorRect(renderer) {
|
|
44504
|
+
this.opentui.symbols.hitGridPopScissorRect(renderer);
|
|
44505
|
+
}
|
|
44506
|
+
hitGridClearScissorRects(renderer) {
|
|
44507
|
+
this.opentui.symbols.hitGridClearScissorRects(renderer);
|
|
44508
|
+
}
|
|
44509
|
+
addToCurrentHitGridClipped(renderer, x2, y2, width, height, id) {
|
|
44510
|
+
this.opentui.symbols.addToCurrentHitGridClipped(renderer, x2, y2, width, height, id);
|
|
44511
|
+
}
|
|
44512
|
+
checkHit(renderer, x2, y2) {
|
|
44513
|
+
return this.opentui.symbols.checkHit(renderer, x2, y2);
|
|
44514
|
+
}
|
|
44515
|
+
getHitGridDirty(renderer) {
|
|
44516
|
+
return this.opentui.symbols.getHitGridDirty(renderer);
|
|
44517
|
+
}
|
|
44518
|
+
dumpHitGrid(renderer) {
|
|
44519
|
+
this.opentui.symbols.dumpHitGrid(renderer);
|
|
44520
|
+
}
|
|
44521
|
+
dumpBuffers(renderer, timestamp) {
|
|
44522
|
+
const ts = timestamp ?? Date.now();
|
|
44523
|
+
this.opentui.symbols.dumpBuffers(renderer, ts);
|
|
44524
|
+
}
|
|
44525
|
+
dumpStdoutBuffer(renderer, timestamp) {
|
|
44526
|
+
const ts = timestamp ?? Date.now();
|
|
44527
|
+
this.opentui.symbols.dumpStdoutBuffer(renderer, ts);
|
|
44528
|
+
}
|
|
44529
|
+
restoreTerminalModes(renderer) {
|
|
44530
|
+
this.opentui.symbols.restoreTerminalModes(renderer);
|
|
44531
|
+
}
|
|
44532
|
+
enableMouse(renderer, enableMovement) {
|
|
44533
|
+
this.opentui.symbols.enableMouse(renderer, enableMovement);
|
|
44534
|
+
}
|
|
44535
|
+
disableMouse(renderer) {
|
|
44536
|
+
this.opentui.symbols.disableMouse(renderer);
|
|
44537
|
+
}
|
|
44538
|
+
enableKittyKeyboard(renderer, flags) {
|
|
44539
|
+
this.opentui.symbols.enableKittyKeyboard(renderer, flags);
|
|
44540
|
+
}
|
|
44541
|
+
disableKittyKeyboard(renderer) {
|
|
44542
|
+
this.opentui.symbols.disableKittyKeyboard(renderer);
|
|
44543
|
+
}
|
|
44544
|
+
setKittyKeyboardFlags(renderer, flags) {
|
|
44545
|
+
this.opentui.symbols.setKittyKeyboardFlags(renderer, flags);
|
|
44546
|
+
}
|
|
44547
|
+
getKittyKeyboardFlags(renderer) {
|
|
44548
|
+
return this.opentui.symbols.getKittyKeyboardFlags(renderer);
|
|
44549
|
+
}
|
|
44550
|
+
setupTerminal(renderer, useAlternateScreen) {
|
|
44551
|
+
this.opentui.symbols.setupTerminal(renderer, useAlternateScreen);
|
|
44552
|
+
}
|
|
44553
|
+
suspendRenderer(renderer) {
|
|
44554
|
+
this.opentui.symbols.suspendRenderer(renderer);
|
|
44555
|
+
}
|
|
44556
|
+
resumeRenderer(renderer) {
|
|
44557
|
+
this.opentui.symbols.resumeRenderer(renderer);
|
|
44558
|
+
}
|
|
44559
|
+
queryPixelResolution(renderer) {
|
|
44560
|
+
this.opentui.symbols.queryPixelResolution(renderer);
|
|
44561
|
+
}
|
|
44562
|
+
/**
|
|
44563
|
+
* Write data to stdout, synchronizing with the render thread if necessary.
|
|
44564
|
+
* This should be used for ALL stdout writes to avoid race conditions when
|
|
44565
|
+
* the render thread is active.
|
|
44566
|
+
*/
|
|
44567
|
+
writeOut(renderer, data) {
|
|
44568
|
+
const bytes = typeof data === "string" ? new TextEncoder().encode(data) : data;
|
|
44569
|
+
if (bytes.length === 0) return;
|
|
44570
|
+
this.opentui.symbols.writeOut(renderer, ptr(bytes), bytes.length);
|
|
44571
|
+
}
|
|
44572
|
+
// TextBuffer methods
|
|
44573
|
+
createTextBuffer(widthMethod) {
|
|
44574
|
+
const widthMethodCode = widthMethod === "wcwidth" ? 0 : 1;
|
|
44575
|
+
const bufferPtr = this.opentui.symbols.createTextBuffer(widthMethodCode);
|
|
44576
|
+
if (!bufferPtr) {
|
|
44577
|
+
throw new Error(`Failed to create TextBuffer`);
|
|
44578
|
+
}
|
|
44579
|
+
return new BrowserTextBuffer(this, bufferPtr);
|
|
44580
|
+
}
|
|
44581
|
+
destroyTextBuffer(buffer) {
|
|
44582
|
+
this.opentui.symbols.destroyTextBuffer(buffer);
|
|
44583
|
+
}
|
|
44584
|
+
textBufferGetLength(buffer) {
|
|
44585
|
+
return this.opentui.symbols.textBufferGetLength(buffer);
|
|
44586
|
+
}
|
|
44587
|
+
textBufferGetByteSize(buffer) {
|
|
44588
|
+
return this.opentui.symbols.textBufferGetByteSize(buffer);
|
|
44589
|
+
}
|
|
44590
|
+
textBufferReset(buffer) {
|
|
44591
|
+
this.opentui.symbols.textBufferReset(buffer);
|
|
44592
|
+
}
|
|
44593
|
+
textBufferClear(buffer) {
|
|
44594
|
+
this.opentui.symbols.textBufferClear(buffer);
|
|
44595
|
+
}
|
|
44596
|
+
textBufferSetDefaultFg(buffer, fg2) {
|
|
44597
|
+
const fgPtr = fg2 ? fg2.buffer : null;
|
|
44598
|
+
this.opentui.symbols.textBufferSetDefaultFg(buffer, fgPtr);
|
|
44599
|
+
}
|
|
44600
|
+
textBufferSetDefaultBg(buffer, bg2) {
|
|
44601
|
+
const bgPtr = bg2 ? bg2.buffer : null;
|
|
44602
|
+
this.opentui.symbols.textBufferSetDefaultBg(buffer, bgPtr);
|
|
44603
|
+
}
|
|
44604
|
+
textBufferSetDefaultAttributes(buffer, attributes) {
|
|
44605
|
+
const attrValue = attributes === null ? null : new Uint8Array([attributes]);
|
|
44606
|
+
this.opentui.symbols.textBufferSetDefaultAttributes(buffer, attrValue);
|
|
44607
|
+
}
|
|
44608
|
+
textBufferResetDefaults(buffer) {
|
|
44609
|
+
this.opentui.symbols.textBufferResetDefaults(buffer);
|
|
44610
|
+
}
|
|
44611
|
+
textBufferGetTabWidth(buffer) {
|
|
44612
|
+
return this.opentui.symbols.textBufferGetTabWidth(buffer);
|
|
44613
|
+
}
|
|
44614
|
+
textBufferSetTabWidth(buffer, width) {
|
|
44615
|
+
this.opentui.symbols.textBufferSetTabWidth(buffer, width);
|
|
44616
|
+
}
|
|
44617
|
+
textBufferRegisterMemBuffer(buffer, bytes, owned = false) {
|
|
44618
|
+
const result = this.opentui.symbols.textBufferRegisterMemBuffer(buffer, bytes, bytes.length, owned);
|
|
44619
|
+
if (result === 65535) {
|
|
44620
|
+
throw new Error("Failed to register memory buffer");
|
|
44621
|
+
}
|
|
44622
|
+
return result;
|
|
44623
|
+
}
|
|
44624
|
+
textBufferReplaceMemBuffer(buffer, memId, bytes, owned = false) {
|
|
44625
|
+
return this.opentui.symbols.textBufferReplaceMemBuffer(buffer, memId, bytes, bytes.length, owned);
|
|
44626
|
+
}
|
|
44627
|
+
textBufferClearMemRegistry(buffer) {
|
|
44628
|
+
this.opentui.symbols.textBufferClearMemRegistry(buffer);
|
|
44629
|
+
}
|
|
44630
|
+
textBufferSetTextFromMem(buffer, memId) {
|
|
44631
|
+
this.opentui.symbols.textBufferSetTextFromMem(buffer, memId);
|
|
44632
|
+
}
|
|
44633
|
+
textBufferAppend(buffer, bytes) {
|
|
44634
|
+
this.opentui.symbols.textBufferAppend(buffer, bytes, bytes.length);
|
|
44635
|
+
}
|
|
44636
|
+
textBufferAppendFromMemId(buffer, memId) {
|
|
44637
|
+
this.opentui.symbols.textBufferAppendFromMemId(buffer, memId);
|
|
44638
|
+
}
|
|
44639
|
+
textBufferLoadFile(buffer, path) {
|
|
44640
|
+
const pathBytes = this.encoder.encode(path);
|
|
44641
|
+
return this.opentui.symbols.textBufferLoadFile(buffer, pathBytes, pathBytes.length);
|
|
44642
|
+
}
|
|
44643
|
+
textBufferSetStyledText(buffer, chunks) {
|
|
44644
|
+
if (chunks.length === 0) {
|
|
44645
|
+
this.textBufferClear(buffer);
|
|
44646
|
+
return;
|
|
44647
|
+
}
|
|
44648
|
+
const chunksBuffer = StyledChunkStruct.packList(chunks);
|
|
44649
|
+
this.opentui.symbols.textBufferSetStyledText(buffer, ptr(chunksBuffer), chunks.length);
|
|
44650
|
+
}
|
|
44651
|
+
textBufferGetLineCount(buffer) {
|
|
44652
|
+
return this.opentui.symbols.textBufferGetLineCount(buffer);
|
|
44653
|
+
}
|
|
44654
|
+
textBufferGetPlainText(buffer, outPtr, maxLen) {
|
|
44655
|
+
const result = this.opentui.symbols.textBufferGetPlainText(buffer, outPtr, maxLen);
|
|
44656
|
+
return typeof result === "bigint" ? Number(result) : result;
|
|
44657
|
+
}
|
|
44658
|
+
getPlainTextBytes(buffer, maxLength) {
|
|
44659
|
+
const outBuffer = new Uint8Array(maxLength);
|
|
44660
|
+
const actualLen = this.textBufferGetPlainText(buffer, ptr(outBuffer), maxLength);
|
|
44661
|
+
if (actualLen === 0) {
|
|
44662
|
+
return null;
|
|
44663
|
+
}
|
|
44664
|
+
return outBuffer.slice(0, actualLen);
|
|
44665
|
+
}
|
|
44666
|
+
textBufferGetTextRange(buffer, startOffset, endOffset, maxLength) {
|
|
44667
|
+
const outBuffer = new Uint8Array(maxLength);
|
|
44668
|
+
const actualLen = this.opentui.symbols.textBufferGetTextRange(
|
|
44669
|
+
buffer,
|
|
44670
|
+
startOffset,
|
|
44671
|
+
endOffset,
|
|
44672
|
+
ptr(outBuffer),
|
|
44673
|
+
maxLength
|
|
44674
|
+
);
|
|
44675
|
+
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
44676
|
+
if (len === 0) {
|
|
44677
|
+
return null;
|
|
44678
|
+
}
|
|
44679
|
+
return outBuffer.slice(0, len);
|
|
44680
|
+
}
|
|
44681
|
+
textBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, maxLength) {
|
|
44682
|
+
const outBuffer = new Uint8Array(maxLength);
|
|
44683
|
+
const actualLen = this.opentui.symbols.textBufferGetTextRangeByCoords(
|
|
44684
|
+
buffer,
|
|
44685
|
+
startRow,
|
|
44686
|
+
startCol,
|
|
44687
|
+
endRow,
|
|
44688
|
+
endCol,
|
|
44689
|
+
ptr(outBuffer),
|
|
44690
|
+
maxLength
|
|
44691
|
+
);
|
|
44692
|
+
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
44693
|
+
if (len === 0) {
|
|
44694
|
+
return null;
|
|
44695
|
+
}
|
|
44696
|
+
return outBuffer.slice(0, len);
|
|
44697
|
+
}
|
|
44698
|
+
// TextBufferView methods
|
|
44699
|
+
createTextBufferView(textBuffer) {
|
|
44700
|
+
const viewPtr = this.opentui.symbols.createTextBufferView(textBuffer);
|
|
44701
|
+
if (!viewPtr) {
|
|
44702
|
+
throw new Error("Failed to create TextBufferView");
|
|
44703
|
+
}
|
|
44704
|
+
return viewPtr;
|
|
44705
|
+
}
|
|
44706
|
+
destroyTextBufferView(view) {
|
|
44707
|
+
this.opentui.symbols.destroyTextBufferView(view);
|
|
44708
|
+
}
|
|
44709
|
+
textBufferViewSetSelection(view, start, end, bgColor, fgColor) {
|
|
44710
|
+
const bg2 = bgColor ? bgColor.buffer : null;
|
|
44711
|
+
const fg2 = fgColor ? fgColor.buffer : null;
|
|
44712
|
+
this.opentui.symbols.textBufferViewSetSelection(view, start, end, bg2, fg2);
|
|
44713
|
+
}
|
|
44714
|
+
textBufferViewResetSelection(view) {
|
|
44715
|
+
this.opentui.symbols.textBufferViewResetSelection(view);
|
|
44716
|
+
}
|
|
44717
|
+
textBufferViewGetSelection(view) {
|
|
44718
|
+
const packedInfo = this.textBufferViewGetSelectionInfo(view);
|
|
44719
|
+
if (packedInfo === 0xffffffffffffffffn) {
|
|
44720
|
+
return null;
|
|
44721
|
+
}
|
|
44722
|
+
const start = Number(packedInfo >> 32n);
|
|
44723
|
+
const end = Number(packedInfo & 0xffffffffn);
|
|
44724
|
+
return { start, end };
|
|
44725
|
+
}
|
|
44726
|
+
textBufferViewGetSelectionInfo(view) {
|
|
44727
|
+
return this.opentui.symbols.textBufferViewGetSelectionInfo(view);
|
|
44728
|
+
}
|
|
44729
|
+
textBufferViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor) {
|
|
44730
|
+
const bg2 = bgColor ? bgColor.buffer : null;
|
|
44731
|
+
const fg2 = fgColor ? fgColor.buffer : null;
|
|
44732
|
+
return this.opentui.symbols.textBufferViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2);
|
|
44733
|
+
}
|
|
44734
|
+
textBufferViewUpdateSelection(view, end, bgColor, fgColor) {
|
|
44735
|
+
const bg2 = bgColor ? bgColor.buffer : null;
|
|
44736
|
+
const fg2 = fgColor ? fgColor.buffer : null;
|
|
44737
|
+
this.opentui.symbols.textBufferViewUpdateSelection(view, end, bg2, fg2);
|
|
44738
|
+
}
|
|
44739
|
+
textBufferViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor) {
|
|
44740
|
+
const bg2 = bgColor ? bgColor.buffer : null;
|
|
44741
|
+
const fg2 = fgColor ? fgColor.buffer : null;
|
|
44742
|
+
return this.opentui.symbols.textBufferViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2);
|
|
44743
|
+
}
|
|
44744
|
+
textBufferViewResetLocalSelection(view) {
|
|
44745
|
+
this.opentui.symbols.textBufferViewResetLocalSelection(view);
|
|
44746
|
+
}
|
|
44747
|
+
textBufferViewSetWrapWidth(view, width) {
|
|
44748
|
+
this.opentui.symbols.textBufferViewSetWrapWidth(view, width);
|
|
44749
|
+
}
|
|
44750
|
+
textBufferViewSetWrapMode(view, mode) {
|
|
44751
|
+
const modeValue = mode === "none" ? 0 : mode === "char" ? 1 : 2;
|
|
44752
|
+
this.opentui.symbols.textBufferViewSetWrapMode(view, modeValue);
|
|
44753
|
+
}
|
|
44754
|
+
textBufferViewSetViewportSize(view, width, height) {
|
|
44755
|
+
this.opentui.symbols.textBufferViewSetViewportSize(view, width, height);
|
|
44756
|
+
}
|
|
44757
|
+
textBufferViewSetViewport(view, x2, y2, width, height) {
|
|
44758
|
+
this.opentui.symbols.textBufferViewSetViewport(view, x2, y2, width, height);
|
|
44759
|
+
}
|
|
44760
|
+
textBufferViewGetLineInfo(view) {
|
|
44761
|
+
const outBuffer = new ArrayBuffer(LineInfoStruct.size);
|
|
44762
|
+
this.textBufferViewGetLineInfoDirect(view, ptr(outBuffer));
|
|
44763
|
+
const struct = LineInfoStruct.unpack(outBuffer);
|
|
44764
|
+
return {
|
|
44765
|
+
maxLineWidth: struct.maxWidth,
|
|
44766
|
+
lineStarts: struct.starts,
|
|
44767
|
+
lineWidths: struct.widths,
|
|
44768
|
+
lineSources: struct.sources,
|
|
44769
|
+
lineWraps: struct.wraps
|
|
44770
|
+
};
|
|
44771
|
+
}
|
|
44772
|
+
textBufferViewGetLogicalLineInfo(view) {
|
|
44773
|
+
const outBuffer = new ArrayBuffer(LineInfoStruct.size);
|
|
44774
|
+
this.textBufferViewGetLogicalLineInfoDirect(view, ptr(outBuffer));
|
|
44775
|
+
const struct = LineInfoStruct.unpack(outBuffer);
|
|
44776
|
+
return {
|
|
44777
|
+
maxLineWidth: struct.maxWidth,
|
|
44778
|
+
lineStarts: struct.starts,
|
|
44779
|
+
lineWidths: struct.widths,
|
|
44780
|
+
lineSources: struct.sources,
|
|
44781
|
+
lineWraps: struct.wraps
|
|
44782
|
+
};
|
|
44783
|
+
}
|
|
44784
|
+
textBufferViewGetVirtualLineCount(view) {
|
|
44785
|
+
return this.opentui.symbols.textBufferViewGetVirtualLineCount(view);
|
|
44786
|
+
}
|
|
44787
|
+
textBufferViewGetLineInfoDirect(view, outPtr) {
|
|
44788
|
+
this.opentui.symbols.textBufferViewGetLineInfoDirect(view, outPtr);
|
|
44789
|
+
}
|
|
44790
|
+
textBufferViewGetLogicalLineInfoDirect(view, outPtr) {
|
|
44791
|
+
this.opentui.symbols.textBufferViewGetLogicalLineInfoDirect(view, outPtr);
|
|
44792
|
+
}
|
|
44793
|
+
textBufferViewGetSelectedText(view, outPtr, maxLen) {
|
|
44794
|
+
const result = this.opentui.symbols.textBufferViewGetSelectedText(view, outPtr, maxLen);
|
|
44795
|
+
return typeof result === "bigint" ? Number(result) : result;
|
|
44796
|
+
}
|
|
44797
|
+
textBufferViewGetPlainText(view, outPtr, maxLen) {
|
|
44798
|
+
const result = this.opentui.symbols.textBufferViewGetPlainText(view, outPtr, maxLen);
|
|
44799
|
+
return typeof result === "bigint" ? Number(result) : result;
|
|
44800
|
+
}
|
|
44801
|
+
textBufferViewGetSelectedTextBytes(view, maxLength) {
|
|
44802
|
+
const outBuffer = new Uint8Array(maxLength);
|
|
44803
|
+
const actualLen = this.textBufferViewGetSelectedText(view, ptr(outBuffer), maxLength);
|
|
44804
|
+
if (actualLen === 0) {
|
|
44805
|
+
return null;
|
|
44806
|
+
}
|
|
44807
|
+
return outBuffer.slice(0, actualLen);
|
|
44808
|
+
}
|
|
44809
|
+
textBufferViewGetPlainTextBytes(view, maxLength) {
|
|
44810
|
+
const outBuffer = new Uint8Array(maxLength);
|
|
44811
|
+
const actualLen = this.textBufferViewGetPlainText(view, ptr(outBuffer), maxLength);
|
|
44812
|
+
if (actualLen === 0) {
|
|
44813
|
+
return null;
|
|
44814
|
+
}
|
|
44815
|
+
return outBuffer.slice(0, actualLen);
|
|
44816
|
+
}
|
|
44817
|
+
textBufferViewSetTabIndicator(view, indicator) {
|
|
44818
|
+
this.opentui.symbols.textBufferViewSetTabIndicator(view, indicator);
|
|
44819
|
+
}
|
|
44820
|
+
textBufferViewSetTabIndicatorColor(view, color) {
|
|
44821
|
+
this.opentui.symbols.textBufferViewSetTabIndicatorColor(view, color.buffer);
|
|
44822
|
+
}
|
|
44823
|
+
textBufferViewSetTruncate(view, truncate) {
|
|
44824
|
+
this.opentui.symbols.textBufferViewSetTruncate(view, truncate);
|
|
44825
|
+
}
|
|
44826
|
+
textBufferViewMeasureForDimensions(view, width, height) {
|
|
44827
|
+
const resultBuffer = new ArrayBuffer(MeasureResultStruct.size);
|
|
44828
|
+
const resultPtr = ptr(new Uint8Array(resultBuffer));
|
|
44829
|
+
const success = this.opentui.symbols.textBufferViewMeasureForDimensions(view, width, height, resultPtr);
|
|
44830
|
+
if (!success) {
|
|
44831
|
+
return null;
|
|
44832
|
+
}
|
|
44833
|
+
const result = MeasureResultStruct.unpack(resultBuffer);
|
|
44834
|
+
return result;
|
|
44835
|
+
}
|
|
44836
|
+
textBufferAddHighlightByCharRange(buffer, highlight) {
|
|
44837
|
+
const packedHighlight = HighlightStruct.pack(highlight);
|
|
44838
|
+
this.opentui.symbols.textBufferAddHighlightByCharRange(buffer, ptr(packedHighlight));
|
|
44839
|
+
}
|
|
44840
|
+
textBufferAddHighlight(buffer, lineIdx, highlight) {
|
|
44841
|
+
const packedHighlight = HighlightStruct.pack(highlight);
|
|
44842
|
+
this.opentui.symbols.textBufferAddHighlight(buffer, lineIdx, ptr(packedHighlight));
|
|
44843
|
+
}
|
|
44844
|
+
textBufferRemoveHighlightsByRef(buffer, hlRef) {
|
|
44845
|
+
this.opentui.symbols.textBufferRemoveHighlightsByRef(buffer, hlRef);
|
|
44846
|
+
}
|
|
44847
|
+
textBufferClearLineHighlights(buffer, lineIdx) {
|
|
44848
|
+
this.opentui.symbols.textBufferClearLineHighlights(buffer, lineIdx);
|
|
44849
|
+
}
|
|
44850
|
+
textBufferClearAllHighlights(buffer) {
|
|
44851
|
+
this.opentui.symbols.textBufferClearAllHighlights(buffer);
|
|
44852
|
+
}
|
|
44853
|
+
textBufferSetSyntaxStyle(buffer, style) {
|
|
44854
|
+
this.opentui.symbols.textBufferSetSyntaxStyle(buffer, style);
|
|
44855
|
+
}
|
|
44856
|
+
textBufferGetLineHighlights(buffer, lineIdx) {
|
|
44857
|
+
const outCountBuf = new BigUint64Array(1);
|
|
44858
|
+
const nativePtr = this.opentui.symbols.textBufferGetLineHighlightsPtr(buffer, lineIdx, ptr(outCountBuf));
|
|
44859
|
+
if (!nativePtr) return [];
|
|
44860
|
+
const count = Number(outCountBuf[0]);
|
|
44861
|
+
const byteLen = count * HighlightStruct.size;
|
|
44862
|
+
const raw = toArrayBuffer(nativePtr, 0, byteLen);
|
|
44863
|
+
const results = HighlightStruct.unpackList(raw, count);
|
|
44864
|
+
this.opentui.symbols.textBufferFreeLineHighlights(nativePtr, count);
|
|
44865
|
+
return results;
|
|
44866
|
+
}
|
|
44867
|
+
textBufferGetHighlightCount(buffer) {
|
|
44868
|
+
return this.opentui.symbols.textBufferGetHighlightCount(buffer);
|
|
44869
|
+
}
|
|
44870
|
+
getArenaAllocatedBytes() {
|
|
44871
|
+
const result = this.opentui.symbols.getArenaAllocatedBytes();
|
|
44872
|
+
return typeof result === "bigint" ? Number(result) : result;
|
|
44873
|
+
}
|
|
44874
|
+
getBuildOptions() {
|
|
44875
|
+
const optionsBuffer = new ArrayBuffer(BuildOptionsStruct.size);
|
|
44876
|
+
this.opentui.symbols.getBuildOptions(ptr(optionsBuffer));
|
|
44877
|
+
const options = BuildOptionsStruct.unpack(optionsBuffer);
|
|
44878
|
+
return {
|
|
44879
|
+
gpaSafeStats: !!options.gpaSafeStats,
|
|
44880
|
+
gpaMemoryLimitTracking: !!options.gpaMemoryLimitTracking
|
|
44881
|
+
};
|
|
44882
|
+
}
|
|
44883
|
+
getAllocatorStats() {
|
|
44884
|
+
const statsBuffer = new ArrayBuffer(AllocatorStatsStruct.size);
|
|
44885
|
+
this.opentui.symbols.getAllocatorStats(ptr(statsBuffer));
|
|
44886
|
+
const stats = AllocatorStatsStruct.unpack(statsBuffer);
|
|
44887
|
+
return {
|
|
44888
|
+
totalRequestedBytes: toNumber(stats.totalRequestedBytes),
|
|
44889
|
+
activeAllocations: toNumber(stats.activeAllocations),
|
|
44890
|
+
smallAllocations: toNumber(stats.smallAllocations),
|
|
44891
|
+
largeAllocations: toNumber(stats.largeAllocations),
|
|
44892
|
+
requestedBytesValid: !!stats.requestedBytesValid
|
|
44893
|
+
};
|
|
44894
|
+
}
|
|
44895
|
+
bufferDrawTextBufferView(buffer, view, x2, y2) {
|
|
44896
|
+
this.opentui.symbols.bufferDrawTextBufferView(buffer, view, x2, y2);
|
|
44897
|
+
}
|
|
44898
|
+
bufferDrawEditorView(buffer, view, x2, y2) {
|
|
44899
|
+
this.opentui.symbols.bufferDrawEditorView(buffer, view, x2, y2);
|
|
44900
|
+
}
|
|
44901
|
+
// EditorView methods
|
|
44902
|
+
createEditorView(editBufferPtr, viewportWidth, viewportHeight) {
|
|
44903
|
+
const viewPtr = this.opentui.symbols.createEditorView(editBufferPtr, viewportWidth, viewportHeight);
|
|
44904
|
+
if (!viewPtr) {
|
|
44905
|
+
throw new Error("Failed to create EditorView");
|
|
44906
|
+
}
|
|
44907
|
+
return viewPtr;
|
|
44908
|
+
}
|
|
44909
|
+
destroyEditorView(view) {
|
|
44910
|
+
this.opentui.symbols.destroyEditorView(view);
|
|
44911
|
+
}
|
|
44912
|
+
editorViewSetViewportSize(view, width, height) {
|
|
44913
|
+
this.opentui.symbols.editorViewSetViewportSize(view, width, height);
|
|
44914
|
+
}
|
|
44915
|
+
editorViewSetViewport(view, x2, y2, width, height, moveCursor) {
|
|
44916
|
+
this.opentui.symbols.editorViewSetViewport(view, x2, y2, width, height, moveCursor);
|
|
44917
|
+
}
|
|
44918
|
+
editorViewGetViewport(view) {
|
|
44919
|
+
const x2 = new Uint32Array(1);
|
|
44920
|
+
const y2 = new Uint32Array(1);
|
|
44921
|
+
const width = new Uint32Array(1);
|
|
44922
|
+
const height = new Uint32Array(1);
|
|
44923
|
+
this.opentui.symbols.editorViewGetViewport(view, ptr(x2), ptr(y2), ptr(width), ptr(height));
|
|
44924
|
+
return {
|
|
44925
|
+
offsetX: x2[0],
|
|
44926
|
+
offsetY: y2[0],
|
|
44927
|
+
width: width[0],
|
|
44928
|
+
height: height[0]
|
|
44929
|
+
};
|
|
44930
|
+
}
|
|
44931
|
+
editorViewSetScrollMargin(view, margin) {
|
|
44932
|
+
this.opentui.symbols.editorViewSetScrollMargin(view, margin);
|
|
44933
|
+
}
|
|
44934
|
+
editorViewSetWrapMode(view, mode) {
|
|
44935
|
+
const modeValue = mode === "none" ? 0 : mode === "char" ? 1 : 2;
|
|
44936
|
+
this.opentui.symbols.editorViewSetWrapMode(view, modeValue);
|
|
44937
|
+
}
|
|
44938
|
+
editorViewGetVirtualLineCount(view) {
|
|
44939
|
+
return this.opentui.symbols.editorViewGetVirtualLineCount(view);
|
|
44940
|
+
}
|
|
44941
|
+
editorViewGetTotalVirtualLineCount(view) {
|
|
44942
|
+
return this.opentui.symbols.editorViewGetTotalVirtualLineCount(view);
|
|
44943
|
+
}
|
|
44944
|
+
editorViewGetTextBufferView(view) {
|
|
44945
|
+
const result = this.opentui.symbols.editorViewGetTextBufferView(view);
|
|
44946
|
+
if (!result) {
|
|
44947
|
+
throw new Error("Failed to get TextBufferView from EditorView");
|
|
44948
|
+
}
|
|
44949
|
+
return result;
|
|
44950
|
+
}
|
|
44951
|
+
editorViewGetLineInfo(view) {
|
|
44952
|
+
const outBuffer = new ArrayBuffer(LineInfoStruct.size);
|
|
44953
|
+
this.opentui.symbols.editorViewGetLineInfoDirect(view, ptr(outBuffer));
|
|
44954
|
+
const struct = LineInfoStruct.unpack(outBuffer);
|
|
44955
|
+
return {
|
|
44956
|
+
maxLineWidth: struct.maxWidth,
|
|
44957
|
+
lineStarts: struct.starts,
|
|
44958
|
+
lineWidths: struct.widths,
|
|
44959
|
+
lineSources: struct.sources,
|
|
44960
|
+
lineWraps: struct.wraps
|
|
44961
|
+
};
|
|
44962
|
+
}
|
|
44963
|
+
editorViewGetLogicalLineInfo(view) {
|
|
44964
|
+
const outBuffer = new ArrayBuffer(LineInfoStruct.size);
|
|
44965
|
+
this.opentui.symbols.editorViewGetLogicalLineInfoDirect(view, ptr(outBuffer));
|
|
44966
|
+
const struct = LineInfoStruct.unpack(outBuffer);
|
|
44967
|
+
return {
|
|
44968
|
+
maxLineWidth: struct.maxWidth,
|
|
44969
|
+
lineStarts: struct.starts,
|
|
44970
|
+
lineWidths: struct.widths,
|
|
44971
|
+
lineSources: struct.sources,
|
|
44972
|
+
lineWraps: struct.wraps
|
|
44973
|
+
};
|
|
44974
|
+
}
|
|
44975
|
+
// EditBuffer implementations
|
|
44976
|
+
createEditBuffer(widthMethod) {
|
|
44977
|
+
const widthMethodCode = widthMethod === "wcwidth" ? 0 : 1;
|
|
44978
|
+
const bufferPtr = this.opentui.symbols.createEditBuffer(widthMethodCode);
|
|
44979
|
+
if (!bufferPtr) {
|
|
44980
|
+
throw new Error("Failed to create EditBuffer");
|
|
44981
|
+
}
|
|
44982
|
+
return bufferPtr;
|
|
44983
|
+
}
|
|
44984
|
+
destroyEditBuffer(buffer) {
|
|
44985
|
+
this.opentui.symbols.destroyEditBuffer(buffer);
|
|
44986
|
+
}
|
|
44987
|
+
editBufferSetText(buffer, textBytes) {
|
|
44988
|
+
this.opentui.symbols.editBufferSetText(buffer, textBytes, textBytes.length);
|
|
44989
|
+
}
|
|
44990
|
+
editBufferSetTextFromMem(buffer, memId) {
|
|
44991
|
+
this.opentui.symbols.editBufferSetTextFromMem(buffer, memId);
|
|
44992
|
+
}
|
|
44993
|
+
editBufferReplaceText(buffer, textBytes) {
|
|
44994
|
+
this.opentui.symbols.editBufferReplaceText(buffer, textBytes, textBytes.length);
|
|
44995
|
+
}
|
|
44996
|
+
editBufferReplaceTextFromMem(buffer, memId) {
|
|
44997
|
+
this.opentui.symbols.editBufferReplaceTextFromMem(buffer, memId);
|
|
44998
|
+
}
|
|
44999
|
+
editBufferGetText(buffer, maxLength) {
|
|
45000
|
+
const outBuffer = new Uint8Array(maxLength);
|
|
45001
|
+
const actualLen = this.opentui.symbols.editBufferGetText(buffer, ptr(outBuffer), maxLength);
|
|
45002
|
+
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
45003
|
+
if (len === 0) return null;
|
|
45004
|
+
return outBuffer.slice(0, len);
|
|
45005
|
+
}
|
|
45006
|
+
editBufferInsertChar(buffer, char) {
|
|
45007
|
+
const charBytes = this.encoder.encode(char);
|
|
45008
|
+
this.opentui.symbols.editBufferInsertChar(buffer, charBytes, charBytes.length);
|
|
45009
|
+
}
|
|
45010
|
+
editBufferInsertText(buffer, text) {
|
|
45011
|
+
const textBytes = this.encoder.encode(text);
|
|
45012
|
+
this.opentui.symbols.editBufferInsertText(buffer, textBytes, textBytes.length);
|
|
45013
|
+
}
|
|
45014
|
+
editBufferDeleteChar(buffer) {
|
|
45015
|
+
this.opentui.symbols.editBufferDeleteChar(buffer);
|
|
45016
|
+
}
|
|
45017
|
+
editBufferDeleteCharBackward(buffer) {
|
|
45018
|
+
this.opentui.symbols.editBufferDeleteCharBackward(buffer);
|
|
45019
|
+
}
|
|
45020
|
+
editBufferDeleteRange(buffer, startLine, startCol, endLine, endCol) {
|
|
45021
|
+
this.opentui.symbols.editBufferDeleteRange(buffer, startLine, startCol, endLine, endCol);
|
|
45022
|
+
}
|
|
45023
|
+
editBufferNewLine(buffer) {
|
|
45024
|
+
this.opentui.symbols.editBufferNewLine(buffer);
|
|
45025
|
+
}
|
|
45026
|
+
editBufferDeleteLine(buffer) {
|
|
45027
|
+
this.opentui.symbols.editBufferDeleteLine(buffer);
|
|
45028
|
+
}
|
|
45029
|
+
editBufferMoveCursorLeft(buffer) {
|
|
45030
|
+
this.opentui.symbols.editBufferMoveCursorLeft(buffer);
|
|
45031
|
+
}
|
|
45032
|
+
editBufferMoveCursorRight(buffer) {
|
|
45033
|
+
this.opentui.symbols.editBufferMoveCursorRight(buffer);
|
|
45034
|
+
}
|
|
45035
|
+
editBufferMoveCursorUp(buffer) {
|
|
45036
|
+
this.opentui.symbols.editBufferMoveCursorUp(buffer);
|
|
45037
|
+
}
|
|
45038
|
+
editBufferMoveCursorDown(buffer) {
|
|
45039
|
+
this.opentui.symbols.editBufferMoveCursorDown(buffer);
|
|
45040
|
+
}
|
|
45041
|
+
editBufferGotoLine(buffer, line) {
|
|
45042
|
+
this.opentui.symbols.editBufferGotoLine(buffer, line);
|
|
45043
|
+
}
|
|
45044
|
+
editBufferSetCursor(buffer, line, byteOffset) {
|
|
45045
|
+
this.opentui.symbols.editBufferSetCursor(buffer, line, byteOffset);
|
|
45046
|
+
}
|
|
45047
|
+
editBufferSetCursorToLineCol(buffer, line, col) {
|
|
45048
|
+
this.opentui.symbols.editBufferSetCursorToLineCol(buffer, line, col);
|
|
45049
|
+
}
|
|
45050
|
+
editBufferSetCursorByOffset(buffer, offset) {
|
|
45051
|
+
this.opentui.symbols.editBufferSetCursorByOffset(buffer, offset);
|
|
45052
|
+
}
|
|
45053
|
+
editBufferGetCursorPosition(buffer) {
|
|
45054
|
+
const cursorBuffer = new ArrayBuffer(LogicalCursorStruct.size);
|
|
45055
|
+
this.opentui.symbols.editBufferGetCursorPosition(buffer, ptr(cursorBuffer));
|
|
45056
|
+
return LogicalCursorStruct.unpack(cursorBuffer);
|
|
45057
|
+
}
|
|
45058
|
+
editBufferGetId(buffer) {
|
|
45059
|
+
return this.opentui.symbols.editBufferGetId(buffer);
|
|
45060
|
+
}
|
|
45061
|
+
editBufferGetTextBuffer(buffer) {
|
|
45062
|
+
const result = this.opentui.symbols.editBufferGetTextBuffer(buffer);
|
|
45063
|
+
if (!result) {
|
|
45064
|
+
throw new Error("Failed to get TextBuffer from EditBuffer");
|
|
45065
|
+
}
|
|
45066
|
+
return result;
|
|
45067
|
+
}
|
|
45068
|
+
editBufferDebugLogRope(buffer) {
|
|
45069
|
+
this.opentui.symbols.editBufferDebugLogRope(buffer);
|
|
45070
|
+
}
|
|
45071
|
+
editBufferUndo(buffer, maxLength) {
|
|
45072
|
+
const outBuffer = new Uint8Array(maxLength);
|
|
45073
|
+
const actualLen = this.opentui.symbols.editBufferUndo(buffer, ptr(outBuffer), maxLength);
|
|
45074
|
+
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
45075
|
+
if (len === 0) return null;
|
|
45076
|
+
return outBuffer.slice(0, len);
|
|
45077
|
+
}
|
|
45078
|
+
editBufferRedo(buffer, maxLength) {
|
|
45079
|
+
const outBuffer = new Uint8Array(maxLength);
|
|
45080
|
+
const actualLen = this.opentui.symbols.editBufferRedo(buffer, ptr(outBuffer), maxLength);
|
|
45081
|
+
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
45082
|
+
if (len === 0) return null;
|
|
45083
|
+
return outBuffer.slice(0, len);
|
|
45084
|
+
}
|
|
45085
|
+
editBufferCanUndo(buffer) {
|
|
45086
|
+
return this.opentui.symbols.editBufferCanUndo(buffer);
|
|
45087
|
+
}
|
|
45088
|
+
editBufferCanRedo(buffer) {
|
|
45089
|
+
return this.opentui.symbols.editBufferCanRedo(buffer);
|
|
45090
|
+
}
|
|
45091
|
+
editBufferClearHistory(buffer) {
|
|
45092
|
+
this.opentui.symbols.editBufferClearHistory(buffer);
|
|
45093
|
+
}
|
|
45094
|
+
editBufferClear(buffer) {
|
|
45095
|
+
this.opentui.symbols.editBufferClear(buffer);
|
|
45096
|
+
}
|
|
45097
|
+
editBufferGetNextWordBoundary(buffer) {
|
|
45098
|
+
const cursorBuffer = new ArrayBuffer(LogicalCursorStruct.size);
|
|
45099
|
+
this.opentui.symbols.editBufferGetNextWordBoundary(buffer, ptr(cursorBuffer));
|
|
45100
|
+
return LogicalCursorStruct.unpack(cursorBuffer);
|
|
45101
|
+
}
|
|
45102
|
+
editBufferGetPrevWordBoundary(buffer) {
|
|
45103
|
+
const cursorBuffer = new ArrayBuffer(LogicalCursorStruct.size);
|
|
45104
|
+
this.opentui.symbols.editBufferGetPrevWordBoundary(buffer, ptr(cursorBuffer));
|
|
45105
|
+
return LogicalCursorStruct.unpack(cursorBuffer);
|
|
45106
|
+
}
|
|
45107
|
+
editBufferGetEOL(buffer) {
|
|
45108
|
+
const cursorBuffer = new ArrayBuffer(LogicalCursorStruct.size);
|
|
45109
|
+
this.opentui.symbols.editBufferGetEOL(buffer, ptr(cursorBuffer));
|
|
45110
|
+
return LogicalCursorStruct.unpack(cursorBuffer);
|
|
45111
|
+
}
|
|
45112
|
+
editBufferOffsetToPosition(buffer, offset) {
|
|
45113
|
+
const cursorBuffer = new ArrayBuffer(LogicalCursorStruct.size);
|
|
45114
|
+
const success = this.opentui.symbols.editBufferOffsetToPosition(buffer, offset, ptr(cursorBuffer));
|
|
45115
|
+
if (!success) return null;
|
|
45116
|
+
return LogicalCursorStruct.unpack(cursorBuffer);
|
|
45117
|
+
}
|
|
45118
|
+
editBufferPositionToOffset(buffer, row, col) {
|
|
45119
|
+
return this.opentui.symbols.editBufferPositionToOffset(buffer, row, col);
|
|
45120
|
+
}
|
|
45121
|
+
editBufferGetLineStartOffset(buffer, row) {
|
|
45122
|
+
return this.opentui.symbols.editBufferGetLineStartOffset(buffer, row);
|
|
45123
|
+
}
|
|
45124
|
+
editBufferGetTextRange(buffer, startOffset, endOffset, maxLength) {
|
|
45125
|
+
const outBuffer = new Uint8Array(maxLength);
|
|
45126
|
+
const actualLen = this.opentui.symbols.editBufferGetTextRange(
|
|
45127
|
+
buffer,
|
|
45128
|
+
startOffset,
|
|
45129
|
+
endOffset,
|
|
45130
|
+
ptr(outBuffer),
|
|
45131
|
+
maxLength
|
|
45132
|
+
);
|
|
45133
|
+
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
45134
|
+
if (len === 0) return null;
|
|
45135
|
+
return outBuffer.slice(0, len);
|
|
45136
|
+
}
|
|
45137
|
+
editBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, maxLength) {
|
|
45138
|
+
const outBuffer = new Uint8Array(maxLength);
|
|
45139
|
+
const actualLen = this.opentui.symbols.editBufferGetTextRangeByCoords(
|
|
45140
|
+
buffer,
|
|
45141
|
+
startRow,
|
|
45142
|
+
startCol,
|
|
45143
|
+
endRow,
|
|
45144
|
+
endCol,
|
|
45145
|
+
ptr(outBuffer),
|
|
45146
|
+
maxLength
|
|
45147
|
+
);
|
|
45148
|
+
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
45149
|
+
if (len === 0) return null;
|
|
45150
|
+
return outBuffer.slice(0, len);
|
|
45151
|
+
}
|
|
45152
|
+
// EditorView selection and editing implementations
|
|
45153
|
+
editorViewSetSelection(view, start, end, bgColor, fgColor) {
|
|
45154
|
+
const bg2 = bgColor ? bgColor.buffer : null;
|
|
45155
|
+
const fg2 = fgColor ? fgColor.buffer : null;
|
|
45156
|
+
this.opentui.symbols.editorViewSetSelection(view, start, end, bg2, fg2);
|
|
45157
|
+
}
|
|
45158
|
+
editorViewResetSelection(view) {
|
|
45159
|
+
this.opentui.symbols.editorViewResetSelection(view);
|
|
45160
|
+
}
|
|
45161
|
+
editorViewGetSelection(view) {
|
|
45162
|
+
const packedInfo = this.opentui.symbols.editorViewGetSelection(view);
|
|
45163
|
+
if (packedInfo === 0xffffffffffffffffn) {
|
|
45164
|
+
return null;
|
|
45165
|
+
}
|
|
45166
|
+
const start = Number(packedInfo >> 32n);
|
|
45167
|
+
const end = Number(packedInfo & 0xffffffffn);
|
|
45168
|
+
return { start, end };
|
|
45169
|
+
}
|
|
45170
|
+
editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, updateCursor, followCursor) {
|
|
45171
|
+
const bg2 = bgColor ? bgColor.buffer : null;
|
|
45172
|
+
const fg2 = fgColor ? fgColor.buffer : null;
|
|
45173
|
+
return this.opentui.symbols.editorViewSetLocalSelection(
|
|
45174
|
+
view,
|
|
45175
|
+
anchorX,
|
|
45176
|
+
anchorY,
|
|
45177
|
+
focusX,
|
|
45178
|
+
focusY,
|
|
45179
|
+
bg2,
|
|
45180
|
+
fg2,
|
|
45181
|
+
updateCursor,
|
|
45182
|
+
followCursor
|
|
45183
|
+
);
|
|
45184
|
+
}
|
|
45185
|
+
editorViewUpdateSelection(view, end, bgColor, fgColor) {
|
|
45186
|
+
const bg2 = bgColor ? bgColor.buffer : null;
|
|
45187
|
+
const fg2 = fgColor ? fgColor.buffer : null;
|
|
45188
|
+
this.opentui.symbols.editorViewUpdateSelection(view, end, bg2, fg2);
|
|
45189
|
+
}
|
|
45190
|
+
editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, updateCursor, followCursor) {
|
|
45191
|
+
const bg2 = bgColor ? bgColor.buffer : null;
|
|
45192
|
+
const fg2 = fgColor ? fgColor.buffer : null;
|
|
45193
|
+
return this.opentui.symbols.editorViewUpdateLocalSelection(
|
|
45194
|
+
view,
|
|
45195
|
+
anchorX,
|
|
45196
|
+
anchorY,
|
|
45197
|
+
focusX,
|
|
45198
|
+
focusY,
|
|
45199
|
+
bg2,
|
|
45200
|
+
fg2,
|
|
45201
|
+
updateCursor,
|
|
45202
|
+
followCursor
|
|
45203
|
+
);
|
|
45204
|
+
}
|
|
45205
|
+
editorViewResetLocalSelection(view) {
|
|
45206
|
+
this.opentui.symbols.editorViewResetLocalSelection(view);
|
|
45207
|
+
}
|
|
45208
|
+
editorViewGetSelectedTextBytes(view, maxLength) {
|
|
45209
|
+
const outBuffer = new Uint8Array(maxLength);
|
|
45210
|
+
const actualLen = this.opentui.symbols.editorViewGetSelectedTextBytes(view, ptr(outBuffer), maxLength);
|
|
45211
|
+
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
45212
|
+
if (len === 0) return null;
|
|
45213
|
+
return outBuffer.slice(0, len);
|
|
45214
|
+
}
|
|
45215
|
+
editorViewGetCursor(view) {
|
|
45216
|
+
const row = new Uint32Array(1);
|
|
45217
|
+
const col = new Uint32Array(1);
|
|
45218
|
+
this.opentui.symbols.editorViewGetCursor(view, ptr(row), ptr(col));
|
|
45219
|
+
return { row: row[0], col: col[0] };
|
|
45220
|
+
}
|
|
45221
|
+
editorViewGetText(view, maxLength) {
|
|
45222
|
+
const outBuffer = new Uint8Array(maxLength);
|
|
45223
|
+
const actualLen = this.opentui.symbols.editorViewGetText(view, ptr(outBuffer), maxLength);
|
|
45224
|
+
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
45225
|
+
if (len === 0) return null;
|
|
45226
|
+
return outBuffer.slice(0, len);
|
|
45227
|
+
}
|
|
45228
|
+
editorViewGetVisualCursor(view) {
|
|
45229
|
+
const cursorBuffer = new ArrayBuffer(VisualCursorStruct.size);
|
|
45230
|
+
this.opentui.symbols.editorViewGetVisualCursor(view, ptr(cursorBuffer));
|
|
45231
|
+
return VisualCursorStruct.unpack(cursorBuffer);
|
|
45232
|
+
}
|
|
45233
|
+
editorViewMoveUpVisual(view) {
|
|
45234
|
+
this.opentui.symbols.editorViewMoveUpVisual(view);
|
|
45235
|
+
}
|
|
45236
|
+
editorViewMoveDownVisual(view) {
|
|
45237
|
+
this.opentui.symbols.editorViewMoveDownVisual(view);
|
|
45238
|
+
}
|
|
45239
|
+
editorViewDeleteSelectedText(view) {
|
|
45240
|
+
this.opentui.symbols.editorViewDeleteSelectedText(view);
|
|
45241
|
+
}
|
|
45242
|
+
editorViewSetCursorByOffset(view, offset) {
|
|
45243
|
+
this.opentui.symbols.editorViewSetCursorByOffset(view, offset);
|
|
45244
|
+
}
|
|
45245
|
+
editorViewGetNextWordBoundary(view) {
|
|
45246
|
+
const cursorBuffer = new ArrayBuffer(VisualCursorStruct.size);
|
|
45247
|
+
this.opentui.symbols.editorViewGetNextWordBoundary(view, ptr(cursorBuffer));
|
|
45248
|
+
return VisualCursorStruct.unpack(cursorBuffer);
|
|
45249
|
+
}
|
|
45250
|
+
editorViewGetPrevWordBoundary(view) {
|
|
45251
|
+
const cursorBuffer = new ArrayBuffer(VisualCursorStruct.size);
|
|
45252
|
+
this.opentui.symbols.editorViewGetPrevWordBoundary(view, ptr(cursorBuffer));
|
|
45253
|
+
return VisualCursorStruct.unpack(cursorBuffer);
|
|
45254
|
+
}
|
|
45255
|
+
editorViewGetEOL(view) {
|
|
45256
|
+
const cursorBuffer = new ArrayBuffer(VisualCursorStruct.size);
|
|
45257
|
+
this.opentui.symbols.editorViewGetEOL(view, ptr(cursorBuffer));
|
|
45258
|
+
return VisualCursorStruct.unpack(cursorBuffer);
|
|
45259
|
+
}
|
|
45260
|
+
editorViewGetVisualSOL(view) {
|
|
45261
|
+
const cursorBuffer = new ArrayBuffer(VisualCursorStruct.size);
|
|
45262
|
+
this.opentui.symbols.editorViewGetVisualSOL(view, ptr(cursorBuffer));
|
|
45263
|
+
return VisualCursorStruct.unpack(cursorBuffer);
|
|
45264
|
+
}
|
|
45265
|
+
editorViewGetVisualEOL(view) {
|
|
45266
|
+
const cursorBuffer = new ArrayBuffer(VisualCursorStruct.size);
|
|
45267
|
+
this.opentui.symbols.editorViewGetVisualEOL(view, ptr(cursorBuffer));
|
|
45268
|
+
return VisualCursorStruct.unpack(cursorBuffer);
|
|
45269
|
+
}
|
|
45270
|
+
bufferPushScissorRect(buffer, x2, y2, width, height) {
|
|
45271
|
+
this.opentui.symbols.bufferPushScissorRect(buffer, x2, y2, width, height);
|
|
45272
|
+
}
|
|
45273
|
+
bufferPopScissorRect(buffer) {
|
|
45274
|
+
this.opentui.symbols.bufferPopScissorRect(buffer);
|
|
45275
|
+
}
|
|
45276
|
+
bufferClearScissorRects(buffer) {
|
|
45277
|
+
this.opentui.symbols.bufferClearScissorRects(buffer);
|
|
45278
|
+
}
|
|
45279
|
+
bufferPushOpacity(buffer, opacity) {
|
|
45280
|
+
this.opentui.symbols.bufferPushOpacity(buffer, opacity);
|
|
45281
|
+
}
|
|
45282
|
+
bufferPopOpacity(buffer) {
|
|
45283
|
+
this.opentui.symbols.bufferPopOpacity(buffer);
|
|
45284
|
+
}
|
|
45285
|
+
bufferGetCurrentOpacity(buffer) {
|
|
45286
|
+
return this.opentui.symbols.bufferGetCurrentOpacity(buffer);
|
|
45287
|
+
}
|
|
45288
|
+
bufferClearOpacity(buffer) {
|
|
45289
|
+
this.opentui.symbols.bufferClearOpacity(buffer);
|
|
45290
|
+
}
|
|
45291
|
+
getTerminalCapabilities(renderer) {
|
|
45292
|
+
const capsBuffer = new ArrayBuffer(TerminalCapabilitiesStruct.size);
|
|
45293
|
+
this.opentui.symbols.getTerminalCapabilities(renderer, ptr(capsBuffer));
|
|
45294
|
+
const caps = TerminalCapabilitiesStruct.unpack(capsBuffer);
|
|
45295
|
+
return {
|
|
45296
|
+
kitty_keyboard: caps.kitty_keyboard,
|
|
45297
|
+
kitty_graphics: caps.kitty_graphics,
|
|
45298
|
+
rgb: caps.rgb,
|
|
45299
|
+
unicode: caps.unicode,
|
|
45300
|
+
sgr_pixels: caps.sgr_pixels,
|
|
45301
|
+
color_scheme_updates: caps.color_scheme_updates,
|
|
45302
|
+
explicit_width: caps.explicit_width,
|
|
45303
|
+
scaled_text: caps.scaled_text,
|
|
45304
|
+
sixel: caps.sixel,
|
|
45305
|
+
focus_tracking: caps.focus_tracking,
|
|
45306
|
+
sync: caps.sync,
|
|
45307
|
+
bracketed_paste: caps.bracketed_paste,
|
|
45308
|
+
hyperlinks: caps.hyperlinks,
|
|
45309
|
+
osc52: caps.osc52,
|
|
45310
|
+
explicit_cursor_positioning: caps.explicit_cursor_positioning,
|
|
45311
|
+
terminal: {
|
|
45312
|
+
name: caps.term_name ?? "",
|
|
45313
|
+
version: caps.term_version ?? "",
|
|
45314
|
+
from_xtversion: caps.term_from_xtversion
|
|
45315
|
+
}
|
|
45316
|
+
};
|
|
45317
|
+
}
|
|
45318
|
+
processCapabilityResponse(renderer, response) {
|
|
45319
|
+
const responseBytes = this.encoder.encode(response);
|
|
45320
|
+
this.opentui.symbols.processCapabilityResponse(renderer, responseBytes, responseBytes.length);
|
|
45321
|
+
}
|
|
45322
|
+
encodeUnicode(text, widthMethod) {
|
|
45323
|
+
const textBytes = this.encoder.encode(text);
|
|
45324
|
+
const widthMethodCode = widthMethod === "wcwidth" ? 0 : 1;
|
|
45325
|
+
const outPtrBuffer = new ArrayBuffer(8);
|
|
45326
|
+
const outLenBuffer = new ArrayBuffer(8);
|
|
45327
|
+
const success = this.opentui.symbols.encodeUnicode(
|
|
45328
|
+
textBytes,
|
|
45329
|
+
textBytes.length,
|
|
45330
|
+
ptr(outPtrBuffer),
|
|
45331
|
+
ptr(outLenBuffer),
|
|
45332
|
+
widthMethodCode
|
|
45333
|
+
);
|
|
45334
|
+
if (!success) {
|
|
45335
|
+
return null;
|
|
45336
|
+
}
|
|
45337
|
+
const outPtrView = new BigUint64Array(outPtrBuffer);
|
|
45338
|
+
const outLenView = new BigUint64Array(outLenBuffer);
|
|
45339
|
+
const resultPtr = Number(outPtrView[0]);
|
|
45340
|
+
const resultLen = Number(outLenView[0]);
|
|
45341
|
+
if (resultLen === 0) {
|
|
45342
|
+
return { ptr: resultPtr, data: [] };
|
|
45343
|
+
}
|
|
45344
|
+
const byteLen = resultLen * EncodedCharStruct.size;
|
|
45345
|
+
const raw = toArrayBuffer(resultPtr, 0, byteLen);
|
|
45346
|
+
const data = EncodedCharStruct.unpackList(raw, resultLen);
|
|
45347
|
+
return { ptr: resultPtr, data };
|
|
45348
|
+
}
|
|
45349
|
+
freeUnicode(encoded) {
|
|
45350
|
+
this.opentui.symbols.freeUnicode(encoded.ptr, encoded.data.length);
|
|
45351
|
+
}
|
|
45352
|
+
bufferDrawChar(buffer, char, x2, y2, fg2, bg2, attributes = 0) {
|
|
45353
|
+
this.opentui.symbols.bufferDrawChar(buffer, char, x2, y2, fg2.buffer, bg2.buffer, attributes);
|
|
45354
|
+
}
|
|
45355
|
+
registerNativeSpanFeedStream(stream, handler) {
|
|
45356
|
+
const callback = this.ensureNativeSpanFeedCallback();
|
|
45357
|
+
this.nativeSpanFeedHandlers.set(toPointer(stream), handler);
|
|
45358
|
+
this.opentui.symbols.streamSetCallback(stream, callback.ptr);
|
|
45359
|
+
}
|
|
45360
|
+
unregisterNativeSpanFeedStream(stream) {
|
|
45361
|
+
this.opentui.symbols.streamSetCallback(stream, null);
|
|
45362
|
+
this.nativeSpanFeedHandlers.delete(toPointer(stream));
|
|
45363
|
+
}
|
|
45364
|
+
createNativeSpanFeed(options) {
|
|
45365
|
+
const optionsBuffer = options == null ? null : NativeSpanFeedOptionsStruct.pack(options);
|
|
45366
|
+
const streamPtr = this.opentui.symbols.createNativeSpanFeed(optionsBuffer ? ptr(optionsBuffer) : null);
|
|
45367
|
+
if (!streamPtr) {
|
|
45368
|
+
throw new Error("Failed to create stream");
|
|
45369
|
+
}
|
|
45370
|
+
return toPointer(streamPtr);
|
|
45371
|
+
}
|
|
45372
|
+
attachNativeSpanFeed(stream) {
|
|
45373
|
+
return this.opentui.symbols.attachNativeSpanFeed(stream);
|
|
45374
|
+
}
|
|
45375
|
+
destroyNativeSpanFeed(stream) {
|
|
45376
|
+
this.opentui.symbols.destroyNativeSpanFeed(stream);
|
|
45377
|
+
this.nativeSpanFeedHandlers.delete(toPointer(stream));
|
|
45378
|
+
}
|
|
45379
|
+
streamWrite(stream, data) {
|
|
45380
|
+
const bytes = typeof data === "string" ? this.encoder.encode(data) : data;
|
|
45381
|
+
return this.opentui.symbols.streamWrite(stream, ptr(bytes), bytes.length);
|
|
45382
|
+
}
|
|
45383
|
+
streamCommit(stream) {
|
|
45384
|
+
return this.opentui.symbols.streamCommit(stream);
|
|
45385
|
+
}
|
|
45386
|
+
streamDrainSpans(stream, outBuffer, maxSpans) {
|
|
45387
|
+
const count = this.opentui.symbols.streamDrainSpans(stream, ptr(outBuffer), maxSpans);
|
|
45388
|
+
return toNumber(count);
|
|
45389
|
+
}
|
|
45390
|
+
streamClose(stream) {
|
|
45391
|
+
return this.opentui.symbols.streamClose(stream);
|
|
45392
|
+
}
|
|
45393
|
+
streamSetOptions(stream, options) {
|
|
45394
|
+
const optionsBuffer = NativeSpanFeedOptionsStruct.pack(options);
|
|
45395
|
+
return this.opentui.symbols.streamSetOptions(stream, ptr(optionsBuffer));
|
|
45396
|
+
}
|
|
45397
|
+
streamGetStats(stream) {
|
|
45398
|
+
const statsBuffer = new ArrayBuffer(NativeSpanFeedStatsStruct.size);
|
|
45399
|
+
const status = this.opentui.symbols.streamGetStats(stream, ptr(statsBuffer));
|
|
45400
|
+
if (status !== 0) {
|
|
45401
|
+
return null;
|
|
45402
|
+
}
|
|
45403
|
+
const stats = NativeSpanFeedStatsStruct.unpack(statsBuffer);
|
|
45404
|
+
return {
|
|
45405
|
+
bytesWritten: typeof stats.bytesWritten === "bigint" ? stats.bytesWritten : BigInt(stats.bytesWritten),
|
|
45406
|
+
spansCommitted: typeof stats.spansCommitted === "bigint" ? stats.spansCommitted : BigInt(stats.spansCommitted),
|
|
45407
|
+
chunks: stats.chunks,
|
|
45408
|
+
pendingSpans: stats.pendingSpans
|
|
45409
|
+
};
|
|
45410
|
+
}
|
|
45411
|
+
streamReserve(stream, minLen) {
|
|
45412
|
+
const reserveBuffer = new ArrayBuffer(ReserveInfoStruct.size);
|
|
45413
|
+
const status = this.opentui.symbols.streamReserve(stream, minLen, ptr(reserveBuffer));
|
|
45414
|
+
if (status !== 0) {
|
|
45415
|
+
return { status, info: null };
|
|
45416
|
+
}
|
|
45417
|
+
return { status, info: ReserveInfoStruct.unpack(reserveBuffer) };
|
|
45418
|
+
}
|
|
45419
|
+
streamCommitReserved(stream, length) {
|
|
45420
|
+
return this.opentui.symbols.streamCommitReserved(stream, length);
|
|
45421
|
+
}
|
|
45422
|
+
createSyntaxStyle() {
|
|
45423
|
+
const stylePtr = this.opentui.symbols.createSyntaxStyle();
|
|
45424
|
+
if (!stylePtr) {
|
|
45425
|
+
throw new Error("Failed to create SyntaxStyle");
|
|
45426
|
+
}
|
|
45427
|
+
return stylePtr;
|
|
45428
|
+
}
|
|
45429
|
+
destroySyntaxStyle(style) {
|
|
45430
|
+
this.opentui.symbols.destroySyntaxStyle(style);
|
|
45431
|
+
}
|
|
45432
|
+
syntaxStyleRegister(style, name, fg2, bg2, attributes) {
|
|
45433
|
+
const nameBytes = this.encoder.encode(name);
|
|
45434
|
+
const fgPtr = fg2 ? fg2.buffer : null;
|
|
45435
|
+
const bgPtr = bg2 ? bg2.buffer : null;
|
|
45436
|
+
return this.opentui.symbols.syntaxStyleRegister(style, nameBytes, nameBytes.length, fgPtr, bgPtr, attributes);
|
|
45437
|
+
}
|
|
45438
|
+
syntaxStyleResolveByName(style, name) {
|
|
45439
|
+
const nameBytes = this.encoder.encode(name);
|
|
45440
|
+
const id = this.opentui.symbols.syntaxStyleResolveByName(style, nameBytes, nameBytes.length);
|
|
45441
|
+
return id === 0 ? null : id;
|
|
45442
|
+
}
|
|
45443
|
+
syntaxStyleGetStyleCount(style) {
|
|
45444
|
+
const result = this.opentui.symbols.syntaxStyleGetStyleCount(style);
|
|
45445
|
+
return typeof result === "bigint" ? Number(result) : result;
|
|
45446
|
+
}
|
|
45447
|
+
editorViewSetPlaceholderStyledText(view, chunks) {
|
|
45448
|
+
const nonEmptyChunks = chunks.filter((c) => c.text.length > 0);
|
|
45449
|
+
if (nonEmptyChunks.length === 0) {
|
|
45450
|
+
this.opentui.symbols.editorViewSetPlaceholderStyledText(view, null, 0);
|
|
45451
|
+
return;
|
|
45452
|
+
}
|
|
45453
|
+
const chunksBuffer = StyledChunkStruct.packList(nonEmptyChunks);
|
|
45454
|
+
this.opentui.symbols.editorViewSetPlaceholderStyledText(view, ptr(chunksBuffer), nonEmptyChunks.length);
|
|
45455
|
+
}
|
|
45456
|
+
editorViewSetTabIndicator(view, indicator) {
|
|
45457
|
+
this.opentui.symbols.editorViewSetTabIndicator(view, indicator);
|
|
45458
|
+
}
|
|
45459
|
+
editorViewSetTabIndicatorColor(view, color) {
|
|
45460
|
+
this.opentui.symbols.editorViewSetTabIndicatorColor(view, color.buffer);
|
|
45461
|
+
}
|
|
45462
|
+
onNativeEvent(name, handler) {
|
|
45463
|
+
this._nativeEvents.on(name, handler);
|
|
45464
|
+
}
|
|
45465
|
+
onceNativeEvent(name, handler) {
|
|
45466
|
+
this._nativeEvents.once(name, handler);
|
|
45467
|
+
}
|
|
45468
|
+
offNativeEvent(name, handler) {
|
|
45469
|
+
this._nativeEvents.off(name, handler);
|
|
45470
|
+
}
|
|
45471
|
+
onAnyNativeEvent(handler) {
|
|
45472
|
+
this._anyEventHandlers.push(handler);
|
|
45473
|
+
}
|
|
45474
|
+
};
|
|
45475
|
+
var opentuiLibPath;
|
|
45476
|
+
try {
|
|
45477
|
+
registerRenderLib(new FFIRenderLib(opentuiLibPath));
|
|
45478
|
+
} catch (error) {
|
|
45479
|
+
}
|
|
45480
|
+
|
|
42611
45481
|
// ../../opentui/packages/react/src/reconciler/renderer.ts
|
|
42612
45482
|
import React3 from "react";
|
|
42613
45483
|
|