@opentui/core 0.5.11 → 0.5.13

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.
@@ -8319,11 +8319,9 @@ function createNodeWorkerConstructor(node) {
8319
8319
  return this.terminationPromise;
8320
8320
  }
8321
8321
  this.worker.off("message", this.handleMessage);
8322
- this.worker.off("error", this.handleError);
8323
8322
  const termination = this.worker.terminate().catch((error) => {
8324
8323
  this.terminationPromise = undefined;
8325
8324
  this.worker.on("message", this.handleMessage);
8326
- this.worker.on("error", this.handleError);
8327
8325
  throw error;
8328
8326
  });
8329
8327
  this.terminationPromise = termination;
@@ -13642,7 +13640,44 @@ registerEnvVar2({
13642
13640
  });
13643
13641
  var CURSOR_STYLE_TO_ID = { block: 0, line: 1, underline: 2, default: 3 };
13644
13642
  var CURSOR_ID_TO_STYLE = ["block", "line", "underline", "default"];
13645
- var MOUSE_STYLE_TO_ID = { default: 0, pointer: 1, text: 2, crosshair: 3, move: 4, "not-allowed": 5 };
13643
+ var MOUSE_STYLE_TO_ID = {
13644
+ auto: 0,
13645
+ default: 1,
13646
+ none: 2,
13647
+ "context-menu": 3,
13648
+ help: 4,
13649
+ pointer: 5,
13650
+ progress: 6,
13651
+ wait: 7,
13652
+ cell: 8,
13653
+ crosshair: 9,
13654
+ text: 10,
13655
+ "vertical-text": 11,
13656
+ alias: 12,
13657
+ copy: 13,
13658
+ move: 14,
13659
+ "no-drop": 15,
13660
+ "not-allowed": 16,
13661
+ grab: 17,
13662
+ grabbing: 18,
13663
+ "all-scroll": 19,
13664
+ "col-resize": 20,
13665
+ "row-resize": 21,
13666
+ "n-resize": 22,
13667
+ "e-resize": 23,
13668
+ "s-resize": 24,
13669
+ "w-resize": 25,
13670
+ "ne-resize": 26,
13671
+ "nw-resize": 27,
13672
+ "se-resize": 28,
13673
+ "sw-resize": 29,
13674
+ "ew-resize": 30,
13675
+ "ns-resize": 31,
13676
+ "nesw-resize": 32,
13677
+ "nwse-resize": 33,
13678
+ "zoom-in": 34,
13679
+ "zoom-out": 35
13680
+ };
13646
13681
  var MAX_FFI_U32 = 4294967295;
13647
13682
  var globalTraceSymbols = null;
13648
13683
  var globalFFILogPath = null;
@@ -13668,6 +13703,10 @@ function toSafeFFIU32Length(value, label) {
13668
13703
  function isFFIU32(value) {
13669
13704
  return Number.isInteger(value) && value >= 0 && value <= MAX_FFI_U32;
13670
13705
  }
13706
+ var DRAW_TEXT_SCRATCH_BYTES = 4096;
13707
+ function drawTextString(text) {
13708
+ return typeof text === "string" ? text : text === undefined ? "" : `${text}`;
13709
+ }
13671
13710
  function viewOrNull(value) {
13672
13711
  return value.byteLength === 0 ? null : value;
13673
13712
  }
@@ -13781,6 +13820,10 @@ function getOpenTUILib(libPath) {
13781
13820
  args: ["u32"],
13782
13821
  returns: "i32"
13783
13822
  },
13823
+ embeddedTerminalSetTransparentBackground: {
13824
+ args: ["u32", "u8"],
13825
+ returns: "i32"
13826
+ },
13784
13827
  embeddedTerminalScroll: {
13785
13828
  args: ["u32", "i32"],
13786
13829
  returns: "i32"
@@ -14484,6 +14527,10 @@ function getOpenTUILib(libPath) {
14484
14527
  args: ["u32", "u8"],
14485
14528
  returns: "void"
14486
14529
  },
14530
+ textBufferViewSetTextAlign: {
14531
+ args: ["u32", "u8"],
14532
+ returns: "void"
14533
+ },
14487
14534
  textBufferViewSetFirstLineOffset: {
14488
14535
  args: ["u32", "u32"],
14489
14536
  returns: "void"
@@ -15566,6 +15613,8 @@ class FFIRenderLib {
15566
15613
  clipboardServices = new Set;
15567
15614
  encoder = new TextEncoder;
15568
15615
  decoder = new TextDecoder;
15616
+ drawTextScratch = new Uint8Array(DRAW_TEXT_SCRATCH_BYTES);
15617
+ drawBottomTitleScratch = new Uint8Array(DRAW_TEXT_SCRATCH_BYTES);
15569
15618
  logCallbackWrapper = null;
15570
15619
  eventCallbackWrapper = null;
15571
15620
  eventSinkPtr = null;
@@ -15612,6 +15661,9 @@ class FFIRenderLib {
15612
15661
  embeddedTerminalInvalidate(handle) {
15613
15662
  embeddedTerminalResult(this.opentui.symbols.embeddedTerminalInvalidate(handle), "invalidation");
15614
15663
  }
15664
+ embeddedTerminalSetTransparentBackground(handle, transparent) {
15665
+ embeddedTerminalResult(this.opentui.symbols.embeddedTerminalSetTransparentBackground(handle, transparent ? 1 : 0), "transparent background update");
15666
+ }
15615
15667
  embeddedTerminalScroll(handle, delta) {
15616
15668
  embeddedTerminalResult(this.opentui.symbols.embeddedTerminalScroll(handle, embeddedTerminalI32(delta, "scroll delta")), "scroll");
15617
15669
  }
@@ -16004,10 +16056,15 @@ class FFIRenderLib {
16004
16056
  this.opentui.symbols.bufferClear(buffer, rgbaBuffer(color));
16005
16057
  }
16006
16058
  bufferDrawText(buffer, text, x, y, color, bgColor, attributes) {
16007
- const textBytes = this.encoder.encode(text);
16008
16059
  const bg = optionalRgbaBuffer(bgColor);
16009
16060
  const fg = rgbaBuffer(color);
16010
- this.opentui.symbols.bufferDrawText(buffer, viewOrNull(textBytes), textBytes.byteLength, x, y, fg, bg, attributes ?? 0);
16061
+ const string = drawTextString(text);
16062
+ const bytes = this.drawTextStorage(string, this.drawTextScratch);
16063
+ const length = this.encoder.encodeInto(string, bytes).written;
16064
+ this.opentui.symbols.bufferDrawText(buffer, length === 0 ? null : bytes, length, x, y, fg, bg, attributes ?? 0);
16065
+ }
16066
+ drawTextStorage(text, scratch) {
16067
+ return text.length * 3 <= scratch.byteLength ? scratch : new Uint8Array(text.length * 3);
16011
16068
  }
16012
16069
  bufferSetCellWithAlphaBlending(buffer, x, y, char, color, bgColor, attributes) {
16013
16070
  const charPtr = char.codePointAt(0) ?? " ".codePointAt(0);
@@ -16067,13 +16124,16 @@ class FFIRenderLib {
16067
16124
  this.opentui.symbols.bufferDrawGrid(buffer, borderChars, rgbaBuffer(borderFg), rgbaBuffer(borderBg), columnOffsets, columnCount, rowOffsets, rowCount, this.ffiStructStorage.gridDrawOptions.ffiView);
16068
16125
  }
16069
16126
  bufferDrawBox(buffer, x, y, width, height, borderChars, packedOptions, borderColor, backgroundColor, titleColor, title, bottomTitle) {
16070
- const titleBytes = title ? this.encoder.encode(title) : null;
16071
- const titleLen = titleBytes?.byteLength ?? 0;
16072
- const titleBuffer = titleBytes ? titleBytes : null;
16073
- const bottomTitleBytes = bottomTitle ? this.encoder.encode(bottomTitle) : null;
16074
- const bottomTitleLen = bottomTitleBytes?.byteLength ?? 0;
16075
- const bottomTitleBuffer = bottomTitleBytes ? bottomTitleBytes : null;
16076
- this.opentui.symbols.bufferDrawBox(buffer, x, y, width, height, borderChars, packedOptions, rgbaBuffer(borderColor), rgbaBuffer(backgroundColor), rgbaBuffer(titleColor), titleBuffer, titleLen, bottomTitleBuffer, bottomTitleLen);
16127
+ const border = rgbaBuffer(borderColor);
16128
+ const background = rgbaBuffer(backgroundColor);
16129
+ const titleFg = rgbaBuffer(titleColor);
16130
+ const top = title ? drawTextString(title) : null;
16131
+ const bottom = bottomTitle ? drawTextString(bottomTitle) : null;
16132
+ const topBytes = top === null ? null : this.drawTextStorage(top, this.drawTextScratch);
16133
+ const bottomBytes = bottom === null ? null : this.drawTextStorage(bottom, this.drawBottomTitleScratch);
16134
+ const topLength = top === null ? 0 : this.encoder.encodeInto(top, topBytes).written;
16135
+ const bottomLength = bottom === null ? 0 : this.encoder.encodeInto(bottom, bottomBytes).written;
16136
+ this.opentui.symbols.bufferDrawBox(buffer, x, y, width, height, borderChars, packedOptions, border, background, titleFg, topBytes, topLength, bottomBytes, bottomLength);
16077
16137
  }
16078
16138
  bufferResize(buffer, width, height) {
16079
16139
  this.opentui.symbols.bufferResize(buffer, width, height);
@@ -16704,6 +16764,10 @@ class FFIRenderLib {
16704
16764
  const modeValue = mode === "none" ? 0 : mode === "char" ? 1 : 2;
16705
16765
  this.opentui.symbols.textBufferViewSetWrapMode(view, modeValue);
16706
16766
  }
16767
+ textBufferViewSetTextAlign(view, alignment) {
16768
+ const alignValue = alignment === "left" ? 0 : alignment === "center" ? 1 : 2;
16769
+ this.opentui.symbols.textBufferViewSetTextAlign(view, alignValue);
16770
+ }
16707
16771
  textBufferViewSetFirstLineOffset(view, offset) {
16708
16772
  this.opentui.symbols.textBufferViewSetFirstLineOffset(view, offset);
16709
16773
  }
@@ -18788,5 +18852,5 @@ var yoga_default = Yoga;
18788
18852
 
18789
18853
  export { toArrayBuffer, singleton, envRegistry2, registerEnvVar2, clearEnvCache2, generateEnvMarkdown2, generateEnvColored2, env2, sleep, stringWidth, resolveBundledFilePath2, DEFAULT_FOREGROUND_RGB2, DEFAULT_BACKGROUND_RGB2, normalizeIndexedColorIndex2, ansi256IndexToRgb2, RGBA2, normalizeColorValue2, hexToRgb2, rgbToHex2, hsvToRgb2, parseColor2, isValidBorderStyle2, parseBorderStyle2, BorderChars2, getBorderFromSides2, getBorderSides2, borderCharsToArray2, BorderCharArrays2, KeyEvent2, PasteEvent2, KeyHandler2, InternalKeyHandler2, fonts2, measureText2, getCharacterPositions2, coordinateToCharacterIndex2, renderFontToFrameBuffer2, TextAttributes2, ATTRIBUTE_BASE_BITS2, ATTRIBUTE_BASE_MASK2, getBaseAttributes2, DebugOverlayCorner2, TargetChannel2, createTextAttributes2, attributesWithLink2, getLinkId2, visualizeRenderableTree2, isStyledText2, StyledText2, stringToStyledText2, black2, red2, green2, yellow2, blue2, magenta2, cyan2, white2, brightBlack2, brightRed2, brightGreen2, brightYellow2, brightBlue2, brightMagenta2, brightCyan2, brightWhite2, bgBlack2, bgRed2, bgGreen2, bgYellow2, bgBlue2, bgMagenta2, bgCyan2, bgWhite2, bold2, italic2, underline2, strikethrough2, dim2, reverse2, blink2, fg2, bg2, link2, t2, hastToStyledText2, SystemClock2, nonAlphanumericKeys2, terminalNamedSingleStrokeKeys2, parseKeypress2, LinearScrollAccel2, MacOSScrollAccel2, parseAlign2, parseAlignItems2, parseBoxSizing2, parseDimension2, parseDirection2, parseDisplay2, parseEdge2, parseFlexDirection2, parseGutter2, parseJustify2, parseLogLevel2, parseMeasureMode2, parseOverflow2, parsePositionType2, parseUnit2, parseWrap2, MouseParser2, Selection2, convertGlobalToLocalSelection2, ASCIIFontSelectionHelper2, StdinParser2, addDefaultParsers2, TreeSitterClient2, treeSitterToTextChunks2, treeSitterToStyledText2, DataPathsManager2, getDataPaths2, extensionToFiletype2, basenameToFiletype2, extToFiletype2, pathToFiletype2, infoStringToFiletype2, getTreeSitterClient2, destroyTreeSitterClient2, ExtmarksController2, createExtmarksController2, TerminalPalette2, createTerminalPalette2, normalizeTerminalPalette2, buildTerminalPaletteSignature2, decodePasteBytes2, stripAnsiSequences2, createHostClipboard2, createClipboard2, ClipboardTarget2, createRendererClipboardAdapter2, Clipboard2, normalizeMarkdownLinkTarget, detectLinks2, OptimizedBuffer2, TextBuffer2, SpanInfoStruct, NativeAudioStreamFormat2, NativeAudioStreamState2, NativeAudioStreamStateNames, NativeAudioStreamCloseReason2, NativeAudioStreamState3, NativeAudioStreamCloseReason3, NativeAudioStreamFormat3, MAX_LINK_URL_BYTES2, NativeClipboardOperationStatus2, NativeClipboardStartStatus2, NativeClipboardCancelStatus2, NativeClipboardCopyStatus2, NativeClipboardDestroyStatus2, NativeClipboardShutdownStatus2, LogLevel2, NativeMeasureTargetKind2, setRenderLibPath2, resolveRenderLib2, Align2, BoxSizing2, Dimension2, Direction2, Display2, Edge2, Errata2, ExperimentalFeature2, FlexDirection2, Gutter2, Justify2, LogLevel3, MeasureMode2, NodeType2, Overflow2, PositionType2, Unit2, Wrap2, ALIGN_AUTO2, ALIGN_FLEX_START2, ALIGN_CENTER2, ALIGN_FLEX_END2, ALIGN_STRETCH2, ALIGN_BASELINE2, ALIGN_SPACE_BETWEEN2, ALIGN_SPACE_AROUND2, ALIGN_SPACE_EVENLY2, BOX_SIZING_BORDER_BOX2, BOX_SIZING_CONTENT_BOX2, DIMENSION_WIDTH2, DIMENSION_HEIGHT2, DIRECTION_INHERIT2, DIRECTION_LTR2, DIRECTION_RTL2, DISPLAY_FLEX2, DISPLAY_NONE2, DISPLAY_CONTENTS2, EDGE_LEFT2, EDGE_TOP2, EDGE_RIGHT2, EDGE_BOTTOM2, EDGE_START2, EDGE_END2, EDGE_HORIZONTAL2, EDGE_VERTICAL2, EDGE_ALL2, ERRATA_NONE2, ERRATA_STRETCH_FLEX_BASIS2, ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING2, ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE2, ERRATA_ALL2, ERRATA_CLASSIC2, EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS2, FLEX_DIRECTION_COLUMN2, FLEX_DIRECTION_COLUMN_REVERSE2, FLEX_DIRECTION_ROW2, FLEX_DIRECTION_ROW_REVERSE2, GUTTER_COLUMN2, GUTTER_ROW2, GUTTER_ALL2, JUSTIFY_FLEX_START2, JUSTIFY_CENTER2, JUSTIFY_FLEX_END2, JUSTIFY_SPACE_BETWEEN2, JUSTIFY_SPACE_AROUND2, JUSTIFY_SPACE_EVENLY2, LOG_LEVEL_ERROR2, LOG_LEVEL_WARN2, LOG_LEVEL_INFO2, LOG_LEVEL_DEBUG2, LOG_LEVEL_VERBOSE2, LOG_LEVEL_FATAL2, MEASURE_MODE_UNDEFINED2, MEASURE_MODE_EXACTLY2, MEASURE_MODE_AT_MOST2, NODE_TYPE_DEFAULT2, NODE_TYPE_TEXT2, OVERFLOW_VISIBLE2, OVERFLOW_HIDDEN2, OVERFLOW_SCROLL2, POSITION_TYPE_STATIC2, POSITION_TYPE_RELATIVE2, POSITION_TYPE_ABSOLUTE2, UNIT_UNDEFINED2, UNIT_POINT2, UNIT_PERCENT2, UNIT_AUTO2, WRAP_NO_WRAP2, WRAP_WRAP2, WRAP_WRAP_REVERSE2, Config2, Node2, exports_yoga, yoga_default };
18790
18854
 
18791
- //# debugId=C2AA7ABE4C3E076964756E2164756E21
18792
- //# sourceMappingURL=chunk-bun-37s3zwb6.js.map
18855
+ //# debugId=B5A6C4CAF586358164756E2164756E21
18856
+ //# sourceMappingURL=chunk-bun-sjw2d9bq.js.map