@opentui/core 0.5.7 → 0.5.8

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.
@@ -5996,7 +5996,7 @@ class MouseParser {
5996
5996
  if (type === "down" && button !== 3) {
5997
5997
  this.mouseButtonsPressed.add(button);
5998
5998
  } else if (type === "up") {
5999
- this.mouseButtonsPressed.clear();
5999
+ this.mouseButtonsPressed.delete(button);
6000
6000
  }
6001
6001
  }
6002
6002
  return {
@@ -13099,7 +13099,7 @@ var VisualCursorStruct = defineStruct([
13099
13099
  ["logicalCol", "u32"],
13100
13100
  ["offset", "u32"]
13101
13101
  ]);
13102
- var UnicodeMethodEnum = defineEnum({ wcwidth: 0, unicode: 1 }, "u8");
13102
+ var UnicodeMethodEnum = defineEnum({ wcwidth: 0, unicode: 1, "unicode-wide": 3 }, "u8");
13103
13103
  var TerminalMultiplexerEnum = defineEnum({ none: 0, tmux: 1, zellij: 2, screen: 3, unknown: 4 }, "u8");
13104
13104
  var Osc52SupportEnum = defineEnum({ unknown: 0, supported: 1, unsupported: 2 }, "u8");
13105
13105
  var ImageProtocolEnum = defineEnum({ auto: 0, kitty: 1, sixel: 2, blocks: 3 }, "u8");
@@ -13573,6 +13573,14 @@ function selectionBehaviorByte(behavior) {
13573
13573
  function editorLocalSelectionFlags(updateCursor, followCursor, behavior) {
13574
13574
  return ffiBool(updateCursor) | ffiBool(followCursor) << 1 | selectionBehaviorByte(behavior) << 2;
13575
13575
  }
13576
+ function widthMethodCode(widthMethod) {
13577
+ return widthMethod === "wcwidth" ? 0 : widthMethod === "unicode-wide" ? 3 : 1;
13578
+ }
13579
+ function widthMethodFromCode(code) {
13580
+ if (code === 0)
13581
+ return "wcwidth";
13582
+ return code === 3 ? "unicode-wide" : "unicode";
13583
+ }
13576
13584
  function getOpenTUILib(libPath) {
13577
13585
  const resolvedLibPath = libPath || targetLibPath;
13578
13586
  if (!resolvedLibPath) {
@@ -13783,6 +13791,10 @@ function getOpenTUILib(libPath) {
13783
13791
  args: ["u32"],
13784
13792
  returns: "u32"
13785
13793
  },
13794
+ getBufferWidthMethod: {
13795
+ args: ["u32"],
13796
+ returns: "u8"
13797
+ },
13786
13798
  bufferClear: {
13787
13799
  args: ["u32", "buffer"],
13788
13800
  returns: "void"
@@ -15759,7 +15771,8 @@ class FFIRenderLib {
15759
15771
  }
15760
15772
  const width = this.opentui.symbols.getBufferWidth(bufferPtr);
15761
15773
  const height = this.opentui.symbols.getBufferHeight(bufferPtr);
15762
- return new OptimizedBuffer(this, bufferPtr, width, height, { id: "next buffer", widthMethod: "unicode" });
15774
+ const widthMethod = widthMethodFromCode(this.opentui.symbols.getBufferWidthMethod(bufferPtr));
15775
+ return new OptimizedBuffer(this, bufferPtr, width, height, { id: "next buffer", widthMethod });
15763
15776
  }
15764
15777
  getCurrentBuffer(renderer) {
15765
15778
  const bufferPtr = this.opentui.symbols.getCurrentBuffer(renderer);
@@ -15768,7 +15781,8 @@ class FFIRenderLib {
15768
15781
  }
15769
15782
  const width = this.opentui.symbols.getBufferWidth(bufferPtr);
15770
15783
  const height = this.opentui.symbols.getBufferHeight(bufferPtr);
15771
- return new OptimizedBuffer(this, bufferPtr, width, height, { id: "current buffer", widthMethod: "unicode" });
15784
+ const widthMethod = widthMethodFromCode(this.opentui.symbols.getBufferWidthMethod(bufferPtr));
15785
+ return new OptimizedBuffer(this, bufferPtr, width, height, { id: "current buffer", widthMethod });
15772
15786
  }
15773
15787
  rendererSetPaletteState(renderer, palette, defaultForeground, defaultBackground, paletteEpoch) {
15774
15788
  const paletteBuffer = new Uint16Array(palette.length * 4);
@@ -15972,10 +15986,9 @@ class FFIRenderLib {
15972
15986
  if (Number.isNaN(width) || Number.isNaN(height)) {
15973
15987
  console.error(new Error(`Invalid dimensions for OptimizedBuffer: ${width}x${height}`).stack);
15974
15988
  }
15975
- const widthMethodCode = widthMethod === "wcwidth" ? 0 : 1;
15976
15989
  const idToUse = id || "unnamed buffer";
15977
15990
  const idBytes = this.encoder.encode(idToUse);
15978
- const bufferPtr = this.opentui.symbols.createOptimizedBuffer(width, height, ffiBool(respectAlpha), widthMethodCode, idBytes, idBytes.byteLength);
15991
+ const bufferPtr = this.opentui.symbols.createOptimizedBuffer(width, height, ffiBool(respectAlpha), widthMethodCode(widthMethod), idBytes, idBytes.byteLength);
15979
15992
  if (!bufferPtr) {
15980
15993
  throw new Error(`Failed to create optimized buffer: ${width}x${height}`);
15981
15994
  }
@@ -16365,8 +16378,7 @@ class FFIRenderLib {
16365
16378
  });
16366
16379
  }
16367
16380
  createTextBuffer(widthMethod) {
16368
- const widthMethodCode = widthMethod === "wcwidth" ? 0 : 1;
16369
- const bufferPtr = this.opentui.symbols.createTextBuffer(widthMethodCode);
16381
+ const bufferPtr = this.opentui.symbols.createTextBuffer(widthMethodCode(widthMethod));
16370
16382
  if (!bufferPtr) {
16371
16383
  throw new Error(`Failed to create TextBuffer`);
16372
16384
  }
@@ -16768,8 +16780,7 @@ class FFIRenderLib {
16768
16780
  };
16769
16781
  }
16770
16782
  createEditBuffer(widthMethod) {
16771
- const widthMethodCode = widthMethod === "wcwidth" ? 0 : 1;
16772
- const bufferPtr = this.opentui.symbols.createEditBuffer(widthMethodCode, this.eventSinkPtr ?? 0);
16783
+ const bufferPtr = this.opentui.symbols.createEditBuffer(widthMethodCode(widthMethod), this.eventSinkPtr ?? 0);
16773
16784
  if (!bufferPtr) {
16774
16785
  throw new Error("Failed to create EditBuffer");
16775
16786
  }
@@ -17124,10 +17135,9 @@ class FFIRenderLib {
17124
17135
  }
17125
17136
  encodeUnicode(text, widthMethod) {
17126
17137
  const textBytes = this.encoder.encode(text);
17127
- const widthMethodCode = widthMethod === "wcwidth" ? 0 : 1;
17128
17138
  const outPtrBuffer = new ArrayBuffer(8);
17129
17139
  const outLenBuffer = new ArrayBuffer(8);
17130
- const success = this.opentui.symbols.encodeUnicode(viewOrNull(textBytes), textBytes.byteLength, outPtrBuffer, outLenBuffer, widthMethodCode);
17140
+ const success = this.opentui.symbols.encodeUnicode(viewOrNull(textBytes), textBytes.byteLength, outPtrBuffer, outLenBuffer, widthMethodCode(widthMethod));
17131
17141
  if (!success) {
17132
17142
  return null;
17133
17143
  }
@@ -18578,5 +18588,5 @@ var yoga_default = Yoga;
18578
18588
 
18579
18589
  export { toArrayBuffer, singleton, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, sleep, stringWidth2 as stringWidth, resolveBundledFilePath, DEFAULT_FOREGROUND_RGB, DEFAULT_BACKGROUND_RGB, normalizeIndexedColorIndex, ansi256IndexToRgb, RGBA, normalizeColorValue, hexToRgb, rgbToHex, hsvToRgb, parseColor, isValidBorderStyle, parseBorderStyle, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, ATTRIBUTE_BASE_BITS, ATTRIBUTE_BASE_MASK, getBaseAttributes, DebugOverlayCorner, TargetChannel, createTextAttributes, attributesWithLink, getLinkId, visualizeRenderableTree, isStyledText, StyledText, stringToStyledText, black, red, green, yellow, blue, magenta, cyan, white, brightBlack, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bold, italic, underline, strikethrough, dim, reverse, blink, fg, bg, link, t, hastToStyledText, SystemClock, nonAlphanumericKeys, terminalNamedSingleStrokeKeys, parseKeypress, LinearScrollAccel, MacOSScrollAccel, parseAlign, parseAlignItems, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, StdinParser, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extensionToFiletype, basenameToFiletype, extToFiletype, pathToFiletype, infoStringToFiletype, getTreeSitterClient, destroyTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, normalizeTerminalPalette, buildTerminalPaletteSignature, decodePasteBytes, stripAnsiSequences, createHostClipboard, createClipboard, ClipboardTarget, createRendererClipboardAdapter, Clipboard, detectLinks, OptimizedBuffer, TextBuffer, SpanInfoStruct, NativeAudioStreamFormat, NativeAudioStreamState, NativeAudioStreamStateNames, NativeAudioStreamCloseReason, NativeAudioStreamState2 as NativeAudioStreamState1, NativeAudioStreamCloseReason2 as NativeAudioStreamCloseReason1, NativeAudioStreamFormat2 as NativeAudioStreamFormat1, NativeClipboardOperationStatus, NativeClipboardStartStatus, NativeClipboardCancelStatus, NativeClipboardCopyStatus, NativeClipboardDestroyStatus, NativeClipboardShutdownStatus, LogLevel2 as LogLevel, NativeMeasureTargetKind, setRenderLibPath, resolveRenderLib, Align, BoxSizing, Dimension, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, LogLevel as LogLevel1, MeasureMode, NodeType, Overflow, PositionType, Unit, Wrap, ALIGN_AUTO, ALIGN_FLEX_START, ALIGN_CENTER, ALIGN_FLEX_END, ALIGN_STRETCH, ALIGN_BASELINE, ALIGN_SPACE_BETWEEN, ALIGN_SPACE_AROUND, ALIGN_SPACE_EVENLY, BOX_SIZING_BORDER_BOX, BOX_SIZING_CONTENT_BOX, DIMENSION_WIDTH, DIMENSION_HEIGHT, DIRECTION_INHERIT, DIRECTION_LTR, DIRECTION_RTL, DISPLAY_FLEX, DISPLAY_NONE, DISPLAY_CONTENTS, EDGE_LEFT, EDGE_TOP, EDGE_RIGHT, EDGE_BOTTOM, EDGE_START, EDGE_END, EDGE_HORIZONTAL, EDGE_VERTICAL, EDGE_ALL, ERRATA_NONE, ERRATA_STRETCH_FLEX_BASIS, ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING, ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE, ERRATA_ALL, ERRATA_CLASSIC, EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS, FLEX_DIRECTION_COLUMN, FLEX_DIRECTION_COLUMN_REVERSE, FLEX_DIRECTION_ROW, FLEX_DIRECTION_ROW_REVERSE, GUTTER_COLUMN, GUTTER_ROW, GUTTER_ALL, JUSTIFY_FLEX_START, JUSTIFY_CENTER, JUSTIFY_FLEX_END, JUSTIFY_SPACE_BETWEEN, JUSTIFY_SPACE_AROUND, JUSTIFY_SPACE_EVENLY, LOG_LEVEL_ERROR, LOG_LEVEL_WARN, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_VERBOSE, LOG_LEVEL_FATAL, MEASURE_MODE_UNDEFINED, MEASURE_MODE_EXACTLY, MEASURE_MODE_AT_MOST, NODE_TYPE_DEFAULT, NODE_TYPE_TEXT, OVERFLOW_VISIBLE, OVERFLOW_HIDDEN, OVERFLOW_SCROLL, POSITION_TYPE_STATIC, POSITION_TYPE_RELATIVE, POSITION_TYPE_ABSOLUTE, UNIT_UNDEFINED, UNIT_POINT, UNIT_PERCENT, UNIT_AUTO, WRAP_NO_WRAP, WRAP_WRAP, WRAP_WRAP_REVERSE, Config, Node, exports_yoga, yoga_default };
18580
18590
 
18581
- //# debugId=4B7BC8814EED9E3164756E2164756E21
18582
- //# sourceMappingURL=chunk-node-267dafd8.js.map
18591
+ //# debugId=C4207D33D39A542764756E2164756E21
18592
+ //# sourceMappingURL=chunk-node-mfda59vq.js.map