@opentui/core 0.1.55 → 0.1.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/3d.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  __export,
6
6
  __require,
7
7
  __toESM
8
- } from "./index-0razn4m6.js";
8
+ } from "./index-crebvcxc.js";
9
9
 
10
10
  // ../../node_modules/omggif/omggif.js
11
11
  var require_omggif = __commonJS((exports) => {
@@ -7205,9 +7205,22 @@ function getParsers() {
7205
7205
  }
7206
7206
 
7207
7207
  // src/lib/tree-sitter/client.ts
7208
- import { resolve as resolve2, isAbsolute } from "path";
7208
+ import { resolve as resolve2, isAbsolute, parse } from "path";
7209
7209
  import { existsSync } from "fs";
7210
- import { parse } from "path";
7210
+
7211
+ // src/lib/bunfs.ts
7212
+ import { basename, join } from "path";
7213
+ function isBunfsPath(path) {
7214
+ return path.includes("$bunfs") || /^B:[\\/]~BUN/i.test(path);
7215
+ }
7216
+ function getBunfsRootPath() {
7217
+ return process.platform === "win32" ? "B:\\~BUN\\root" : "/$bunfs/root";
7218
+ }
7219
+ function normalizeBunfsPath(fileName) {
7220
+ return join(getBunfsRootPath(), basename(fileName));
7221
+ }
7222
+
7223
+ // src/lib/tree-sitter/client.ts
7211
7224
  registerEnvVar({
7212
7225
  name: "OTUI_TREE_SITTER_WORKER_PATH",
7213
7226
  description: "Path to the TreeSitter worker",
@@ -7329,8 +7342,8 @@ class TreeSitterClient extends EventEmitter3 {
7329
7342
  if (isUrl(path)) {
7330
7343
  return path;
7331
7344
  }
7332
- if (/\$bunfs/.test(path)) {
7333
- return "/$bunfs/root/" + parse(path).base;
7345
+ if (isBunfsPath(path)) {
7346
+ return normalizeBunfsPath(parse(path).base);
7334
7347
  }
7335
7348
  if (!isAbsolute(path)) {
7336
7349
  return resolve2(path);
@@ -10080,7 +10093,7 @@ var MeasureResultStruct = defineStruct([
10080
10093
  // src/zig.ts
10081
10094
  var module = await import(`@opentui/core-${process.platform}-${process.arch}/index.ts`);
10082
10095
  var targetLibPath = module.default;
10083
- if (/\$bunfs/.test(targetLibPath)) {
10096
+ if (isBunfsPath(targetLibPath)) {
10084
10097
  targetLibPath = targetLibPath.replace("../", "");
10085
10098
  }
10086
10099
  if (!existsSync2(targetLibPath)) {
@@ -14536,6 +14549,12 @@ registerEnvVar({
14536
14549
  type: "boolean",
14537
14550
  default: true
14538
14551
  });
14552
+ registerEnvVar({
14553
+ name: "OTUI_DEBUG",
14554
+ description: "Enable debug mode to capture all raw input for debugging purposes.",
14555
+ type: "boolean",
14556
+ default: false
14557
+ });
14539
14558
 
14540
14559
  class MouseEvent {
14541
14560
  type;
@@ -14581,13 +14600,6 @@ var MouseButton;
14581
14600
  MouseButton2[MouseButton2["WHEEL_UP"] = 4] = "WHEEL_UP";
14582
14601
  MouseButton2[MouseButton2["WHEEL_DOWN"] = 5] = "WHEEL_DOWN";
14583
14602
  })(MouseButton ||= {});
14584
- singleton("ProcessExitSignals", () => {
14585
- ["SIGINT", "SIGTERM", "SIGQUIT", "SIGABRT"].forEach((signal) => {
14586
- process.on(signal, () => {
14587
- process.exit();
14588
- });
14589
- });
14590
- });
14591
14603
  var rendererTracker = singleton("RendererTracker", () => {
14592
14604
  const renderers = new Set;
14593
14605
  return {
@@ -14655,6 +14667,8 @@ class CliRenderer extends EventEmitter9 {
14655
14667
  stdin;
14656
14668
  stdout;
14657
14669
  exitOnCtrlC;
14670
+ exitSignals;
14671
+ _exitListenersAdded = false;
14658
14672
  _isDestroyed = false;
14659
14673
  nextRenderBuffer;
14660
14674
  currentRenderBuffer;
@@ -14750,6 +14764,8 @@ class CliRenderer extends EventEmitter9 {
14750
14764
  inputHandlers = [];
14751
14765
  prependedInputHandlers = [];
14752
14766
  idleResolvers = [];
14767
+ _debugInputs = [];
14768
+ _debugModeEnabled = env.OTUI_DEBUG;
14753
14769
  handleError = ((error) => {
14754
14770
  console.error(error);
14755
14771
  if (this._openConsoleOnError) {
@@ -14812,6 +14828,7 @@ Captured output:
14812
14828
  }
14813
14829
  this.rendererPtr = rendererPtr;
14814
14830
  this.exitOnCtrlC = config.exitOnCtrlC === undefined ? true : config.exitOnCtrlC;
14831
+ this.exitSignals = config.exitSignals || ["SIGINT", "SIGTERM", "SIGQUIT", "SIGABRT"];
14815
14832
  this.resizeDebounceDelay = config.debounceDelay || 100;
14816
14833
  this.targetFps = config.targetFps || 30;
14817
14834
  this.maxFps = config.maxFps || 60;
@@ -14838,7 +14855,7 @@ Captured output:
14838
14855
  process.on("warning", this.warningHandler);
14839
14856
  process.on("uncaughtException", this.handleError);
14840
14857
  process.on("unhandledRejection", this.handleError);
14841
- process.on("exit", this.exitHandler);
14858
+ process.on("beforeExit", this.exitHandler);
14842
14859
  this._keyHandler = new InternalKeyHandler(config.useKittyKeyboard ?? true);
14843
14860
  this._keyHandler.on("keypress", (event) => {
14844
14861
  if (this.exitOnCtrlC && event.name === "c" && event.ctrl) {
@@ -14848,6 +14865,7 @@ Captured output:
14848
14865
  return;
14849
14866
  }
14850
14867
  });
14868
+ this.addExitListeners();
14851
14869
  this._stdinBuffer = new StdinBuffer({ timeout: 5 });
14852
14870
  this._console = new TerminalConsole(this, config.consoleOptions);
14853
14871
  this.useConsole = config.useConsole ?? true;
@@ -14876,6 +14894,22 @@ Captured output:
14876
14894
  }
14877
14895
  this.setupInput();
14878
14896
  }
14897
+ addExitListeners() {
14898
+ if (this._exitListenersAdded || this.exitSignals.length === 0)
14899
+ return;
14900
+ this.exitSignals.forEach((signal) => {
14901
+ process.addListener(signal, this.exitHandler);
14902
+ });
14903
+ this._exitListenersAdded = true;
14904
+ }
14905
+ removeExitListeners() {
14906
+ if (!this._exitListenersAdded || this.exitSignals.length === 0)
14907
+ return;
14908
+ this.exitSignals.forEach((signal) => {
14909
+ process.removeListener(signal, this.exitHandler);
14910
+ });
14911
+ this._exitListenersAdded = false;
14912
+ }
14879
14913
  get isDestroyed() {
14880
14914
  return this._isDestroyed;
14881
14915
  }
@@ -15019,6 +15053,9 @@ Captured output:
15019
15053
  get capabilities() {
15020
15054
  return this._capabilities;
15021
15055
  }
15056
+ getDebugInputs() {
15057
+ return [...this._debugInputs];
15058
+ }
15022
15059
  get useKittyKeyboard() {
15023
15060
  return this.lib.getUseKittyKeyboard(this.rendererPtr);
15024
15061
  }
@@ -15195,6 +15232,12 @@ Captured output:
15195
15232
  this.stdin.setEncoding("utf8");
15196
15233
  this.stdin.on("data", this.stdinListener);
15197
15234
  this._stdinBuffer.on("data", (sequence) => {
15235
+ if (this._debugModeEnabled) {
15236
+ this._debugInputs.push({
15237
+ timestamp: new Date().toISOString(),
15238
+ sequence
15239
+ });
15240
+ }
15198
15241
  for (const handler of this.inputHandlers) {
15199
15242
  if (handler(sequence)) {
15200
15243
  return;
@@ -15528,6 +15571,7 @@ Captured output:
15528
15571
  this.internalPause();
15529
15572
  this._suspendedMouseEnabled = this._useMouse;
15530
15573
  this.disableMouse();
15574
+ this.removeExitListeners();
15531
15575
  this._stdinBuffer.clear();
15532
15576
  this.stdin.removeListener("data", this.stdinListener);
15533
15577
  this.lib.suspendRenderer(this.rendererPtr);
@@ -15541,6 +15585,7 @@ Captured output:
15541
15585
  this.stdin.setRawMode(true);
15542
15586
  }
15543
15587
  this.stdin.resume();
15588
+ this.addExitListeners();
15544
15589
  setImmediate(() => {
15545
15590
  while (this.stdin.read() !== null) {}
15546
15591
  this.stdin.on("data", this.stdinListener);
@@ -15900,5 +15945,5 @@ Captured output:
15900
15945
 
15901
15946
  export { __toESM, __commonJS, __export, __require, Edge, Gutter, MeasureMode, exports_src, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, nonAlphanumericKeys, parseKeypress, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, RGBA, hexToRgb, rgbToHex, hsvToRgb, parseColor, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, DebugOverlayCorner, createTextAttributes, visualizeRenderableTree, isStyledText, StyledText, stringToStyledText, black, red, green, yellow, blue, magenta, cyan, white, brightBlack, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bold, italic, underline, strikethrough, dim, reverse, blink, fg, bg, t, hastToStyledText, LinearScrollAccel, MacOSScrollAccel, StdinBuffer, parseAlign, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extToFiletype, pathToFiletype, main, getTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, TextBuffer, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, OptimizedBuffer, h, isVNode, maybeMakeRenderable, wrapWithDelegates, instantiate, delegate, isValidPercentage, LayoutEvents, RenderableEvents, isRenderable, BaseRenderable, Renderable, RootRenderable, ANSI, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
15902
15947
 
15903
- //# debugId=E61ED12D8C1C497964756E2164756E21
15904
- //# sourceMappingURL=index-0razn4m6.js.map
15948
+ //# debugId=50CCF62F4F782D5964756E2164756E21
15949
+ //# sourceMappingURL=index-crebvcxc.js.map